Преглед на файлове

Add API for drawing 4x4 matrices as three axes

Daniele Bartolini преди 12 години
родител
ревизия
a76f0a6aec
променени са 2 файла, в които са добавени 12 реда и са изтрити 1 реда
  1. 8 1
      engine/renderers/DebugRenderer.cpp
  2. 4 0
      engine/renderers/DebugRenderer.h

+ 8 - 1
engine/renderers/DebugRenderer.cpp

@@ -127,6 +127,14 @@ void DebugRenderer::add_box(const Vec3& min, const Vec3& max, const Color4& colo
 	add_line(Vec3(min.x, max.y, min.z), Vec3(min.x, max.y, max.z), color, depth_write);
 }
 
+//-----------------------------------------------------------------------------
+void DebugRenderer::add_pose(const Mat4& pose, bool depth_write)
+{
+	add_line(pose.translation(), pose.translation() + pose.x(), Color4::RED, depth_write);
+	add_line(pose.translation(), pose.translation() + pose.y(), Color4::GREEN, depth_write);
+	add_line(pose.translation(), pose.translation() + pose.z(), Color4::BLUE, depth_write);
+}
+
 //-----------------------------------------------------------------------------
 void DebugRenderer::draw_all()
 {
@@ -139,4 +147,3 @@ void DebugRenderer::draw_all()
 }
 
 } // namespace crown
-

+ 4 - 0
engine/renderers/DebugRenderer.h

@@ -29,6 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Types.h"
 #include "Vec3.h"
 #include "Color4.h"
+#include "Mat4.h"
 
 namespace crown
 {
@@ -56,6 +57,9 @@ public:
 	/// Total cost: 12 lines
 	void		add_box(const Vec3& min, const Vec3& max, const Color4& color, bool depth_write);
 
+	/// Total cost: 3 lines
+	void		add_pose(const Mat4& pose, bool depth_write);
+
 private:
 
 	void		draw_all();