DebugRendererSP.h 2.3 KB

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