2
0

DebugRendererSP.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2022 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Renderer/DebugRendererImp.h>
  6. // This file contains debug renderer functions that take single precision arguments for tests that do not need to deal with large worlds.
  7. // They're split off so that we don't accidentally call single precision versions.
  8. inline void DrawLineSP(DebugRenderer *inRenderer, Vec3Arg inFrom, Vec3Arg inTo, Color inColor)
  9. {
  10. inRenderer->DrawLine(RVec3(inFrom), RVec3(inTo), inColor);
  11. }
  12. inline void DrawMarkerSP(DebugRenderer *inRenderer, Vec3Arg inPosition, ColorArg inColor, float inSize)
  13. {
  14. inRenderer->DrawMarker(RVec3(inPosition), inColor, inSize);
  15. }
  16. inline void DrawArrowSP(DebugRenderer *inRenderer, Vec3Arg inFrom, Vec3Arg inTo, ColorArg inColor, float inSize)
  17. {
  18. inRenderer->DrawArrow(RVec3(inFrom), RVec3(inTo), inColor, inSize);
  19. }
  20. inline void DrawTriangleSP(DebugRenderer *inRenderer, Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, ColorArg inColor)
  21. {
  22. inRenderer->DrawTriangle(RVec3(inV1), RVec3(inV2), RVec3(inV3), inColor);
  23. }
  24. inline void DrawWireBoxSP(DebugRenderer *inRenderer, Mat44Arg inMatrix, const AABox &inBox, ColorArg inColor)
  25. {
  26. inRenderer->DrawWireBox(RMat44(inMatrix), inBox, inColor);
  27. }
  28. inline void DrawBoxSP(DebugRenderer *inRenderer, Mat44Arg inMatrix, const AABox &inBox, ColorArg inColor, DebugRenderer::ECastShadow inCastShadow = DebugRenderer::ECastShadow::On, DebugRenderer::EDrawMode inDrawMode = DebugRenderer::EDrawMode::Solid)
  29. {
  30. inRenderer->DrawBox(RMat44(inMatrix), inBox, inColor, inCastShadow, inDrawMode);
  31. }
  32. inline void DrawWireSphereSP(DebugRenderer *inRenderer, Vec3Arg inCenter, float inRadius, ColorArg inColor, int inLevel = 3)
  33. {
  34. inRenderer->DrawWireSphere(RVec3(inCenter), inRadius, inColor, inLevel);
  35. }
  36. inline void DrawSphereSP(DebugRenderer *inRenderer, Vec3Arg inCenter, float inRadius, ColorArg inColor, DebugRenderer::ECastShadow inCastShadow = DebugRenderer::ECastShadow::On, DebugRenderer::EDrawMode inDrawMode = DebugRenderer::EDrawMode::Solid)
  37. {
  38. inRenderer->DrawSphere(RVec3(inCenter), inRadius, inColor, inCastShadow, inDrawMode);
  39. }
  40. inline void DrawText3DSP(DebugRenderer *inRenderer, Vec3Arg inPosition, const string_view &inString, ColorArg inColor = Color::sWhite, float inHeight = 0.5f)
  41. {
  42. inRenderer->DrawText3D(RVec3(inPosition), inString, inColor, inHeight);
  43. }