소스 검색

Fix DebugLine::add_obb

Daniele Bartolini 10 년 전
부모
커밋
d2b31ad046
2개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 4 4
      src/renderers/debug_line.cpp
  2. 2 2
      src/renderers/debug_line.h

+ 4 - 4
src/renderers/debug_line.cpp

@@ -174,12 +174,12 @@ void DebugLine::add_sphere(const Vector3& center, const float radius, const Colo
 	}
 }
 
-void DebugLine::add_obb(const Matrix4x4& tm, const Vector3& extents, const Color4& color)
+void DebugLine::add_obb(const Matrix4x4& tm, const Vector3& half_extents, const Color4& color)
 {
 	const Vector3 o = vector3(tm.t.x, tm.t.y, tm.t.z);
-	const Vector3 x = vector3(tm.x.x, tm.x.y, tm.x.z) * (extents.x * 0.5f);
-	const Vector3 y = vector3(tm.y.x, tm.y.y, tm.y.z) * (extents.y * 0.5f);
-	const Vector3 z = vector3(tm.z.x, tm.z.y, tm.z.z) * (extents.z * 0.5f);
+	const Vector3 x = vector3(tm.x.x, tm.x.y, tm.x.z) * half_extents.x;
+	const Vector3 y = vector3(tm.y.x, tm.y.y, tm.y.z) * half_extents.y;
+	const Vector3 z = vector3(tm.z.x, tm.z.y, tm.z.z) * half_extents.z;
 
 	// Back face
 	add_line(o - x - y - z, o + x - y - z, color);

+ 2 - 2
src/renderers/debug_line.h

@@ -32,8 +32,8 @@ struct DebugLine
 	void add_sphere(const Vector3& center, const float radius, const Color4& color);
 
 	/// Adds an orientd bounding box. @a tm describes the position and orientation of
-	/// the box. @a extents describes the size of the box along the axis.
-	void add_obb(const Matrix4x4& tm, const Vector3& extents, const Color4& color);
+	/// the box. @a half_extents describes the size of the box along the axis.
+	void add_obb(const Matrix4x4& tm, const Vector3& half_extents, const Color4& color);
 
 	/// Clears all the lines.
 	void clear();