mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Add more outline functions to DebugDraw
This commit is contained in:
parent
660bd8d347
commit
0ac3d95cb9
|
|
@ -139,6 +139,77 @@ void DebugDrawer::setupStateBlocks()
|
|||
mRenderAlpha = GFX->createStateBlock(d);
|
||||
}
|
||||
|
||||
void DebugDrawer::drawBoxOutline(const Point3F &a, const Point3F &b, const ColorF &color)
|
||||
{
|
||||
Point3F point0(a.x, a.y, a.z);
|
||||
Point3F point1(a.x, b.y, a.z);
|
||||
Point3F point2(b.x, b.y, a.z);
|
||||
Point3F point3(b.x, a.y, a.z);
|
||||
|
||||
Point3F point4(a.x, a.y, b.z);
|
||||
Point3F point5(a.x, b.y, b.z);
|
||||
Point3F point6(b.x, b.y, b.z);
|
||||
Point3F point7(b.x, a.y, b.z);
|
||||
|
||||
// Draw one plane
|
||||
drawLine(point0, point1, color);
|
||||
drawLine(point1, point2, color);
|
||||
drawLine(point2, point3, color);
|
||||
drawLine(point3, point0, color);
|
||||
|
||||
// Draw the other plane
|
||||
drawLine(point4, point5, color);
|
||||
drawLine(point5, point6, color);
|
||||
drawLine(point6, point7, color);
|
||||
drawLine(point7, point4, color);
|
||||
|
||||
// Draw the connecting corners
|
||||
drawLine(point0, point4, color);
|
||||
drawLine(point1, point5, color);
|
||||
drawLine(point2, point6, color);
|
||||
drawLine(point3, point7, color);
|
||||
}
|
||||
|
||||
void DebugDrawer::drawTransformedBoxOutline(const Point3F &a, const Point3F &b, const ColorF &color, const MatrixF& transform)
|
||||
{
|
||||
Point3F point0(a.x, a.y, a.z);
|
||||
Point3F point1(a.x, b.y, a.z);
|
||||
Point3F point2(b.x, b.y, a.z);
|
||||
Point3F point3(b.x, a.y, a.z);
|
||||
|
||||
Point3F point4(a.x, a.y, b.z);
|
||||
Point3F point5(a.x, b.y, b.z);
|
||||
Point3F point6(b.x, b.y, b.z);
|
||||
Point3F point7(b.x, a.y, b.z);
|
||||
|
||||
transform.mulP(point0);
|
||||
transform.mulP(point1);
|
||||
transform.mulP(point2);
|
||||
transform.mulP(point3);
|
||||
transform.mulP(point4);
|
||||
transform.mulP(point5);
|
||||
transform.mulP(point6);
|
||||
transform.mulP(point7);
|
||||
|
||||
// Draw one plane
|
||||
drawLine(point0, point1, color);
|
||||
drawLine(point1, point2, color);
|
||||
drawLine(point2, point3, color);
|
||||
drawLine(point3, point0, color);
|
||||
|
||||
// Draw the other plane
|
||||
drawLine(point4, point5, color);
|
||||
drawLine(point5, point6, color);
|
||||
drawLine(point6, point7, color);
|
||||
drawLine(point7, point4, color);
|
||||
|
||||
// Draw the connecting corners
|
||||
drawLine(point0, point4, color);
|
||||
drawLine(point1, point5, color);
|
||||
drawLine(point2, point6, color);
|
||||
drawLine(point3, point7, color);
|
||||
}
|
||||
|
||||
void DebugDrawer::render()
|
||||
{
|
||||
#ifdef ENABLE_DEBUGDRAW
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@ public:
|
|||
///
|
||||
/// @{
|
||||
|
||||
void drawBoxOutline(const Point3F &a, const Point3F &b, const ColorF &color = ColorF(1.0f, 1.0f, 1.0f));
|
||||
void drawTransformedBoxOutline(const Point3F &a, const Point3F &b, const ColorF &color, const MatrixF& transform);
|
||||
|
||||
void drawBox(const Point3F &a, const Point3F &b, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
||||
void drawLine(const Point3F &a, const Point3F &b, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
||||
void drawTri(const Point3F &a, const Point3F &b, const Point3F &c, const ColorF &color = ColorF(1.0f,1.0f,1.0f));
|
||||
|
|
|
|||
Loading…
Reference in a new issue