diff --git a/include/Nazara/Renderer/DebugDrawer.hpp b/include/Nazara/Renderer/DebugDrawer.hpp index cb1ae2953..f8faf0337 100644 --- a/include/Nazara/Renderer/DebugDrawer.hpp +++ b/include/Nazara/Renderer/DebugDrawer.hpp @@ -28,6 +28,7 @@ class NAZARA_API NzDebugDrawer static void Draw(const NzOrientedBoxf& orientedBox); static void Draw(const NzSkeleton* skeleton); static void Draw(const NzVector3f& position, float size = 0.1f); + static void DrawAxes(const NzVector3f& position = NzVector3f::Zero(), float size = 1.f); static void DrawBinormals(const NzStaticMesh* subMesh); static void DrawCone(const NzVector3f& origin, const NzQuaternionf& rotation, float angle, float length); static void DrawLine(const NzVector3f& p1, const NzVector3f& p2); diff --git a/src/Nazara/Renderer/DebugDrawer.cpp b/src/Nazara/Renderer/DebugDrawer.cpp index c13bcfce1..9d3559540 100644 --- a/src/Nazara/Renderer/DebugDrawer.cpp +++ b/src/Nazara/Renderer/DebugDrawer.cpp @@ -367,6 +367,25 @@ void NzDebugDrawer::Draw(const NzVector3f& position, float size) Draw(NzBoxf(position.x - size*0.5f, position.y - size*0.5f, position.z - size*0.5f, size, size, size)); } +void NzDebugDrawer::DrawAxes(const NzVector3f& position, float size) +{ + NzColor oldPrimaryColor = s_primaryColor; + s_primaryColor = NzColor::Red; + DrawLine(position, position + NzVector3f::UnitX() * 3.f * size / 4.f); + s_primaryColor = NzColor::Green; + DrawLine(position, position + NzVector3f::UnitY() * 3.f * size / 4.f); + s_primaryColor = NzColor::Blue; + DrawLine(position, position + NzVector3f::UnitZ() * 3.f * size / 4.f); + + s_primaryColor = NzColor::Red; + DrawCone(position + NzVector3f::UnitX() * size, NzEulerAnglesf(0.f, 90.f, 0.f), 15, size / 4.f); + s_primaryColor = NzColor::Green; + DrawCone(position + NzVector3f::UnitY() * size, NzEulerAnglesf(-90.f, 0.f, 0.f), 15, size / 4.f); + s_primaryColor = NzColor::Blue; + DrawCone(position + NzVector3f::UnitZ() * size, NzEulerAnglesf(0.f, 0.f, 0.f), 15, size / 4.f); + s_primaryColor = oldPrimaryColor; +} + void NzDebugDrawer::DrawBinormals(const NzStaticMesh* subMesh) { if (!Initialize())