Reworked SHDebugDraw to fit new interface of SHDebugDrawSystem

This commit is contained in:
Kah Wei 2022-12-15 23:25:49 +08:00
parent eb06eebc32
commit 8978515cb9
5 changed files with 636 additions and 153 deletions

View File

@ -271,7 +271,7 @@ namespace SHADE
void SHEditor::SetUpGridLines(bool drawGrid, bool drawAxes) void SHEditor::SetUpGridLines(bool drawGrid, bool drawAxes)
{ {
// Clear existing lines // Clear existing lines
SHDebugDraw::ClearPersistentDraws(); SHDebugDraw::Persistent::ClearDraws();
static constexpr float DELTA = 1.0f; static constexpr float DELTA = 1.0f;
static constexpr int EXTENT_COUNT = static_cast<int>(500.0f /* TODO: Remove hard code */ / DELTA); static constexpr int EXTENT_COUNT = static_cast<int>(500.0f /* TODO: Remove hard code */ / DELTA);
@ -284,30 +284,34 @@ namespace SHADE
for (int i = 1; i < EXTENT_COUNT; ++i) for (int i = 1; i < EXTENT_COUNT; ++i)
{ {
// X-Axis Lines // X-Axis Lines
SHDebugDraw::PersistentLine SHDebugDraw::Persistent::Line
( (
GRID_COL,
SHVec3 { -LINE_HALF_LENGTH, 0.0f, i * DELTA }, SHVec3 { -LINE_HALF_LENGTH, 0.0f, i * DELTA },
SHVec3 { LINE_HALF_LENGTH, 0.0f, i * DELTA } SHVec3 { LINE_HALF_LENGTH, 0.0f, i * DELTA },
);
SHDebugDraw::PersistentLine
(
GRID_COL, GRID_COL,
true
);
SHDebugDraw::Persistent::Line
(
SHVec3 { -LINE_HALF_LENGTH, 0.0f, i * -DELTA }, SHVec3 { -LINE_HALF_LENGTH, 0.0f, i * -DELTA },
SHVec3 { LINE_HALF_LENGTH, 0.0f, i * -DELTA } SHVec3 { LINE_HALF_LENGTH, 0.0f, i * -DELTA },
GRID_COL,
true
); );
// Y-Axis Lines // Y-Axis Lines
SHDebugDraw::PersistentLine SHDebugDraw::Persistent::Line
( (
GRID_COL,
SHVec3 { i * DELTA, 0.0f, -LINE_HALF_LENGTH }, SHVec3 { i * DELTA, 0.0f, -LINE_HALF_LENGTH },
SHVec3 { i * DELTA, 0.0f, LINE_HALF_LENGTH } SHVec3 { i * DELTA, 0.0f, LINE_HALF_LENGTH },
);
SHDebugDraw::PersistentLine
(
GRID_COL, GRID_COL,
true
);
SHDebugDraw::Persistent::Line
(
SHVec3 { -i * DELTA, 0.0f, -LINE_HALF_LENGTH }, SHVec3 { -i * DELTA, 0.0f, -LINE_HALF_LENGTH },
SHVec3 { -i * DELTA, 0.0f, LINE_HALF_LENGTH } SHVec3 { -i * DELTA, 0.0f, LINE_HALF_LENGTH },
GRID_COL,
true
); );
} }
} }
@ -319,25 +323,28 @@ namespace SHADE
const SHColour Y_AXIS_COL = drawAxes ? SHColour::GREEN : GRID_COL; const SHColour Y_AXIS_COL = drawAxes ? SHColour::GREEN : GRID_COL;
const SHColour Z_AXIS_COL = drawAxes ? SHColour::BLUE : GRID_COL; const SHColour Z_AXIS_COL = drawAxes ? SHColour::BLUE : GRID_COL;
// X // X
SHDebugDraw::PersistentLine SHDebugDraw::Persistent::Line
( (
X_AXIS_COL,
SHVec3 { -LINE_HALF_LENGTH, 0.0f, 0.0f }, SHVec3 { -LINE_HALF_LENGTH, 0.0f, 0.0f },
SHVec3 { LINE_HALF_LENGTH, 0.0f, 0.0f } SHVec3 { LINE_HALF_LENGTH, 0.0f, 0.0f },
X_AXIS_COL,
true
); );
// Y // Y
SHDebugDraw::PersistentLine SHDebugDraw::Persistent::Line
( (
Y_AXIS_COL,
SHVec3 { 0.0f, -LINE_HALF_LENGTH, 0.0f }, SHVec3 { 0.0f, -LINE_HALF_LENGTH, 0.0f },
SHVec3 { 0.0f, LINE_HALF_LENGTH, 0.0f } SHVec3 { 0.0f, LINE_HALF_LENGTH, 0.0f },
Y_AXIS_COL,
true
); );
// Z // Z
SHDebugDraw::PersistentLine SHDebugDraw::Persistent::Line
( (
Z_AXIS_COL,
SHVec3 { 0.0f, 0.0f, -LINE_HALF_LENGTH }, SHVec3 { 0.0f, 0.0f, -LINE_HALF_LENGTH },
SHVec3 { 0.0f, 0.0f, LINE_HALF_LENGTH } SHVec3 { 0.0f, 0.0f, LINE_HALF_LENGTH },
Z_AXIS_COL,
true
); );
} }
} }
@ -353,7 +360,7 @@ namespace SHADE
break; break;
case State::PLAY: case State::PLAY:
default: default:
SHDebugDraw::ClearPersistentDraws(); SHDebugDraw::Persistent::ClearDraws();
break; break;
} }
return eventData->handle; return eventData->handle;

View File

@ -46,35 +46,12 @@ namespace SHADE
{ {
public: public:
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Type Definitions */
/*---------------------------------------------------------------------------------*/
/// <summary>
/// Defines the rendering mode for debug lines.
/// </summary>
enum class LineRenderMode : uint32_t
{
NoDepthTest,
DepthTested,
Count
};
/// <summary>
/// Defines the rendering mode for debug meshes.
/// </summary>
enum class MeshRenderMode : uint32_t
{
FilledNoDepthTest,
FilledDepthTested,
WireNoDepthTest,
WireDepthTested,
Count
};
/*---------------------------------------------------------------------------------*/
/* System Routines */ /* System Routines */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
class SH_API ProcessPointsRoutine final : public SHSystemRoutine class SH_API ProcessPointsRoutine final : public SHSystemRoutine
{ {
public: public:
ProcessPointsRoutine(); ProcessPointsRoutine();
virtual void Execute(double dt) noexcept override final; virtual void Execute(double dt) noexcept override final;
}; };
@ -95,31 +72,201 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Draw Functions */ /* Draw Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/// <summary>
/// Draws a line between two specified points.
/// </summary>
/// <param name="start">Starting point.</param>
/// <param name="end">Ending point.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawLine(const SHVec3& start, const SHVec3& end, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawLine(const SHVec3& start, const SHVec3& end, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a set of points as a connected set of lines that loops back.
/// </summary>
/// <param name="points">List of points to draw the line across.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawLineLoop(std::initializer_list<SHVec3> points, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawLineLoop(std::initializer_list<SHVec3> points, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a set of points as a connected set of lines that loops back.
/// </summary>
/// <typeparam name="IterType">
/// Type of iterator of the container that contains the points.
/// </typeparam>
/// <param name="pointListBegin">Starting iterator to the line points.</param>
/// <param name="pointListEnd">One past end iterator to the line points.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
template<typename IterType> template<typename IterType>
void DrawLineLoop(IterType pointListBegin, IterType pointListEnd, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawLineLoop(IterType pointListBegin, IterType pointListEnd, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a triangle from the specified set of points.
/// </summary>
/// <param name="p1">1st point.</param>
/// <param name="p2">2nd point.</param>
/// <param name="p3">3rd point.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawTri(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawTri(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a quad from the specified set of points.
/// </summary>
/// <param name="p1">1st point.</param>
/// <param name="p2">2nd point.</param>
/// <param name="p3">3rd point.</param>
/// <param name="p4">4th point.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a 2-dimensional circle.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the circle should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawCircle(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawCircle(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws the outline of a cube.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the wire cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawWireCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawWireCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws the wireframe of a sphere.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawWireSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawWireSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a filled cube.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a filled sphere.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Persistent Draw Functions */ /* Persistent Draw Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/// <summary>
/// Draws a persistent line between two specified points.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="start">Starting point.</param>
/// <param name="end">Ending point.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentLine(const SHVec3& start, const SHVec3& end, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentLine(const SHVec3& start, const SHVec3& end, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a persistent set of points as a connected set of lines that loops back.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="points">List of points to draw the line across.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentLineLoop(std::initializer_list<SHVec3> points, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentLineLoop(std::initializer_list<SHVec3> points, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a persistent set of points as a connected set of lines that loops back.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <typeparam name="IterType">
/// Type of iterator of the container that contains the points.
/// </typeparam>
/// <param name="pointListBegin">Starting iterator to the line points.</param>
/// <param name="pointListEnd">One past end iterator to the line points.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
template<typename IterType> template<typename IterType>
void DrawPersistentLineLoop(IterType pointListBegin, IterType pointListEnd, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentLineLoop(IterType pointListBegin, IterType pointListEnd, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a persistent triangle from the specified set of points.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="p1">1st point.</param>
/// <param name="p2">2nd point.</param>
/// <param name="p3">3rd point.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentTri(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentTri(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a persistent quad from the specified set of points.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="p1">1st point.</param>
/// <param name="p2">2nd point.</param>
/// <param name="p3">3rd point.</param>
/// <param name="p4">4th point.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a persistent 2-dimensional circle.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the circle should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentCircle(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentCircle(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws the outline of a persistent cube.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the wire cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentWireCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentWireCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws the wireframe of a persistent sphere.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentWireSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentWireSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a persistent filled cube.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary>
/// Draws a persistent filled sphere.
/// This will remain drawn until ClearPersistentDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
void DrawPersistentSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false); void DrawPersistentSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
/// <summary> /// <summary>
/// Clears any persistent drawn debug primitives. /// Clears any persistent drawn debug primitives.
@ -134,6 +281,26 @@ namespace SHADE
using TripleUInt = std::array<uint32_t , SHGraphicsConstants::NUM_FRAME_BUFFERS>; using TripleUInt = std::array<uint32_t , SHGraphicsConstants::NUM_FRAME_BUFFERS>;
using TripleBool = std::array<bool , SHGraphicsConstants::NUM_FRAME_BUFFERS>; using TripleBool = std::array<bool , SHGraphicsConstants::NUM_FRAME_BUFFERS>;
/// <summary> /// <summary>
/// Defines the rendering mode for debug lines.
/// </summary>
enum class LineRenderMode : uint32_t
{
NoDepthTest,
DepthTested,
Count
};
/// <summary>
/// Defines the rendering mode for debug meshes.
/// </summary>
enum class MeshRenderMode : uint32_t
{
FilledNoDepthTest,
FilledDepthTested,
WireNoDepthTest,
WireDepthTested,
Count
};
/// <summary>
/// Defines a coloured Vertex /// Defines a coloured Vertex
/// </summary> /// </summary>
struct SH_API PointVertex struct SH_API PointVertex

View File

@ -16,6 +16,7 @@ of DigiPen Institute of Technology is prohibited.
// Project Includes // Project Includes
#include "Math/Vector/SHVec4.h" #include "Math/Vector/SHVec4.h"
#include "Math/SHQuaternion.h" #include "Math/SHQuaternion.h"
#include "Math/SHQuaternion.h"
#include "Math/SHColour.h" #include "Math/SHColour.h"
#include "Graphics/MiddleEnd/Interface/SHDebugDrawSystem.h" #include "Graphics/MiddleEnd/Interface/SHDebugDrawSystem.h"
#include "ECS_Base/Managers/SHSystemManager.h" #include "ECS_Base/Managers/SHSystemManager.h"
@ -42,110 +43,180 @@ namespace SHADE
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* Draw Functions */ /* Draw Functions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void SHDebugDraw::Line(const SHVec4& color, const SHVec3& startPt, const SHVec3& endPt) void SHDebugDraw::Line(const SHVec3& startPt, const SHVec3& endPt, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawLine(startPt, endPt, color); dbgDrawSys->DrawLine(startPt, endPt, color, depthTested);
} }
void SHDebugDraw::Tri(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3) void SHDebugDraw::Tri(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawTri(pt1, pt2, pt3, color); dbgDrawSys->DrawTri(pt1, pt2, pt3, color, depthTested);
} }
void SHDebugDraw::Quad(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4) void SHDebugDraw::Quad(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawQuad(pt1, pt2, pt3, pt4, color); dbgDrawSys->DrawQuad(pt1, pt2, pt3, pt4, color, depthTested);
} }
void SHDebugDraw::Circle(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Circle(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawCircle(mat, color); dbgDrawSys->DrawCircle(mat, color, depthTested);
} }
void SHDebugDraw::LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList) void SHDebugDraw::LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList, bool depthTested)
{ {
dbgDrawSys->DrawLineLoop(pointList, color); dbgDrawSys->DrawLineLoop(pointList, color, depthTested);
} }
void SHDebugDraw::Cube(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Cube(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawCube(mat, color); dbgDrawSys->DrawCube(mat, color, depthTested);
} }
void SHDebugDraw::Sphere(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Cube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawSphere(mat, color); dbgDrawSys->DrawCube(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
} }
void SHDebugDraw::WireCube(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Cube(const SHVec3& center, const SHQuaternion& orientation, const SHVec3& scale, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawWireCube(mat, color); dbgDrawSys->DrawCube(SHMatrix::Transform(center, orientation, scale), color, depthTested);
}
void SHDebugDraw::Cube(const SHVec3& center, const SHVec3& eulerAngles, const SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawCube(SHMatrix::Transform(center, eulerAngles, scale), color, depthTested);
}
void SHDebugDraw::Sphere(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawSphere(mat, color, depthTested);
}
void SHDebugDraw::Sphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawSphere(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
}
void SHDebugDraw::Sphere(const SHVec3& center, const SHQuaternion& orientation, SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawSphere(SHMatrix::Transform(center, orientation, scale), color, depthTested);
}
void SHDebugDraw::Sphere(const SHVec3& center, const SHVec3& eulerAngles, SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawSphere(SHMatrix::Transform(center, eulerAngles, scale), color, depthTested);
}
void SHDebugDraw::WireCube(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawWireCube(mat, color, depthTested);
} }
void SHDebugDraw::WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color) void SHDebugDraw::WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawWireCube(SHMatrix::Transform(center, SHQuaternion(), scale), color); dbgDrawSys->DrawWireCube(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
} }
void SHDebugDraw::WireSphere(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::WireSphere(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawWireSphere(mat, color); dbgDrawSys->DrawWireSphere(mat, color, depthTested);
} }
void SHDebugDraw::WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color) void SHDebugDraw::WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawWireSphere(SHMatrix::Transform(center, SHQuaternion(), scale), color); dbgDrawSys->DrawWireSphere(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* Persistent Draw Functions */ /* Persistent Draw Functions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void SHDebugDraw::PersistentLine(const SHVec4& color, const SHVec3& startPt, const SHVec3& endPt) void SHDebugDraw::Persistent::Line(const SHVec3& startPt, const SHVec3& endPt, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawPersistentLine(startPt, endPt, color); dbgDrawSys->DrawPersistentLine(startPt, endPt, color, depthTested);
} }
void SHDebugDraw::PersistentTri(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3) void SHDebugDraw::Persistent::Tri(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawPersistentTri(pt1, pt2, pt3, color); dbgDrawSys->DrawPersistentTri(pt1, pt2, pt3, color, depthTested);
} }
void SHDebugDraw::PersistentQuad(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4) void SHDebugDraw::Persistent::Quad(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawPersistentQuad(pt1, pt2, pt3, pt4, color); dbgDrawSys->DrawPersistentQuad(pt1, pt2, pt3, pt4, color, depthTested);
} }
void SHDebugDraw::PersistentCircle(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Persistent::Circle(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawPersistentCircle(mat, color); dbgDrawSys->DrawPersistentCircle(mat, color, depthTested);
} }
void SHDebugDraw::PersistentLineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList) void SHDebugDraw::Persistent::LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList, bool depthTested)
{ {
dbgDrawSys->DrawPersistentLineLoop(pointList, color); dbgDrawSys->DrawPersistentLineLoop(pointList, color, depthTested);
}
void SHDebugDraw::Persistent::Cube(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentCube(mat, color, depthTested);
}
void SHDebugDraw::Persistent::Cube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentCube(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
}
void SHDebugDraw::Persistent::Cube(const SHVec3& center, const SHQuaternion& orientation, const SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentCube(SHMatrix::Transform(center, orientation, scale), color, depthTested);
}
void SHDebugDraw::Persistent::Cube(const SHVec3& center, const SHVec3& eulerAngles, const SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentCube(SHMatrix::Transform(center, eulerAngles, scale), color, depthTested);
}
void SHDebugDraw::Persistent::Sphere(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentSphere(mat, color, depthTested);
}
void SHDebugDraw::Persistent::Sphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentSphere(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
}
void SHDebugDraw::Persistent::Sphere(const SHVec3& center, const SHQuaternion& orientation, SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentSphere(SHMatrix::Transform(center, orientation, scale), color, depthTested);
}
void SHDebugDraw::Persistent::Sphere(const SHVec3& center, const SHVec3& eulerAngles, SHVec3& scale, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentSphere(SHMatrix::Transform(center, eulerAngles, scale), color, depthTested);
}
void SHDebugDraw::Persistent::WireCube(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{
dbgDrawSys->DrawPersistentWireCube(mat, color, depthTested);
} }
void SHDebugDraw::PersistentCube(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Persistent::WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawPersistentCube(mat, color); dbgDrawSys->DrawPersistentWireCube(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
} }
void SHDebugDraw::PersistentSphere(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Persistent::WireSphere(const SHMatrix& mat, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawPersistentSphere(mat, color); dbgDrawSys->DrawPersistentWireSphere(mat, color, depthTested);
} }
void SHDebugDraw::PersistentWireCube(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Persistent::WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested)
{ {
dbgDrawSys->DrawPersistentWireCube(mat, color); dbgDrawSys->DrawPersistentWireSphere(SHMatrix::Transform(center, SHQuaternion(), scale), color, depthTested);
} }
void SHDebugDraw::PersistentWireSphere(const SHMatrix& mat, const SHVec4& color) void SHDebugDraw::Persistent::ClearDraws()
{
dbgDrawSys->DrawPersistentWireSphere(mat, color);
}
void SHDebugDraw::ClearPersistentDraws()
{ {
dbgDrawSys->ClearPersistentDraws(); dbgDrawSys->ClearPersistentDraws();
} }

View File

@ -22,6 +22,7 @@ namespace SHADE
class SHDebugDrawSystem; class SHDebugDrawSystem;
class SHVec4; class SHVec4;
class SHVec3; class SHVec3;
class SHQuaternion;
class SHMatrix; class SHMatrix;
class SHColour; class SHColour;
@ -51,87 +52,324 @@ namespace SHADE
/// <summary> /// <summary>
/// Renders a line between two points in world space. /// Renders a line between two points in world space.
/// </summary> /// </summary>
/// <param name="color">Colour of the line.</param>
/// <param name="startPt">First point of the line.</param> /// <param name="startPt">First point of the line.</param>
/// <param name="endPt">Second point of the line.</param> /// <param name="endPt">Second point of the line.</param>
static void Line(const SHVec4& color, const SHVec3& startPt, const SHVec3& endPt); /// <param name="color">Colour of the line.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Line(const SHVec3& startPt, const SHVec3& endPt, const SHVec4& color, bool depthTested = false);
/// <summary> /// <summary>
/// Renders a triangle indicated by three points in world space. /// Renders a triangle indicated by three points in world space.
/// </summary> /// </summary>
/// <param name="color">Colour of the triangle.</param>
/// <param name="pt1">First point of the triangle.</param> /// <param name="pt1">First point of the triangle.</param>
/// <param name="pt2">Second point of the triangle.</param> /// <param name="pt2">Second point of the triangle.</param>
/// <param name="pt3">Third point of the triangle.</param> /// <param name="pt3">Third point of the triangle.</param>
static void Tri(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3); /// <param name="color">Colour of the triangle.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Tri(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec4& color, bool depthTested = false);
/// <summary> /// <summary>
/// Renders a quadrilateral indicated by four points in world space. /// Renders a quadrilateral indicated by four points in world space.
/// </summary> /// </summary>
/// <param name="color">Colour of the quadrilateral.</param>
/// <param name="pt1">First point of the triangle.</param> /// <param name="pt1">First point of the triangle.</param>
/// <param name="pt2">Second point of the quadrilateral.</param> /// <param name="pt2">Second point of the quadrilateral.</param>
/// <param name="pt3">Third point of the quadrilateral.</param> /// <param name="pt3">Third point of the quadrilateral.</param>
/// <param name="pt4">Third point of the quadrilateral.</param> /// <param name="pt4">Third point of the quadrilateral.</param>
static void Quad(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4); /// <param name="color">Colour of the quadrilateral.</param>
static void Circle(const SHMatrix& mat,const SHVec4& color); /// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Quad(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a 2-dimensional circle in world space.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the circle should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Circle(const SHMatrix& mat,const SHVec4& color, bool depthTested = false);
/// <summary> /// <summary>
/// Renders a polygon indicated by the specified set of points in world space. /// Renders a polygon indicated by the specified set of points in world space.
/// </summary> /// </summary>
/// <param name="color">Colour of the polygon.</param> /// <param name="color">Colour of the polygon.</param>
/// <param name="pointList">List of points for the polygon.</param> /// <param name="pointList">List of points for the polygon.</param>
static void LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList); /// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHMatrix& mat, const SHVec4& color); static void LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList, bool depthTested = false);
static void Sphere(const SHMatrix& mat, const SHVec4& color); /// <summary>
static void WireCube(const SHMatrix& mat, const SHVec4& color); /// Draws a filled cube in world space.
static void WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color); /// </summary>
static void WireSphere(const SHMatrix& mat, const SHVec4& color); /// <param name="matrix">
static void WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color); /// Matrix transformation that defines how the cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled cube in world space.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled cube in world space.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="orientation">Orientation of the cube.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHVec3& center, const SHQuaternion& orientation, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled cube in world space.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="eulerAngles">Euler angle rotation of the cube in radians.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHVec3& center, const SHVec3& eulerAngles, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="scale">Size of the sphere.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="orientation">Orientation of the sphere.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHVec3& center, const SHQuaternion& orientation, SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="eulerAngles">Euler angle rotation of the sphere in radians.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHVec3& center, const SHVec3& eulerAngles, SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the outline of a cube in world space.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the wire cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireCube(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the outline of a cube in world space.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the wireframe of a sphere in world space.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireSphere(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the wireframe of a sphere in world space.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="scale">Size of the sphere.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Persistent Draw Functions */ /* Persistent Draw Function Class "Folder" */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/// <summary> struct SH_API Persistent
/// Renders a line between two points in world space that will persist until {
/// ClearPersistentDraws() is called. /*-------------------------------------------------------------------------------*/
/// </summary> /* Persistent Draw Functions */
/// <param name="color">Colour of the line.</param> /*-------------------------------------------------------------------------------*/
/// <param name="startPt">First point of the line.</param> /// <summary>
/// <param name="endPt">Second point of the line.</param> /// Renders a line between two points in world space.
static void PersistentLine(const SHVec4& color, const SHVec3& startPt, const SHVec3& endPt); /// This will remain drawn until ClearDraws() is called.
/// <summary> /// </summary>
/// Renders a triangle indicated by three points in world space that will persist /// <param name="startPt">First point of the line.</param>
/// until ClearPersistentDraws() is called. /// <param name="endPt">Second point of the line.</param>
/// </summary> /// <param name="color">Colour of the line.</param>
/// <param name="color">Colour of the triangle.</param> /// <param name="depthTested">Whether or not drawn object will be occluded.</param>
/// <param name="pt1">First point of the triangle.</param> static void Line(const SHVec3& startPt, const SHVec3& endPt, const SHVec4& color, bool depthTested = false);
/// <param name="pt2">Second point of the triangle.</param> /// <summary>
/// <param name="pt3">Third point of the triangle.</param> /// Renders a triangle indicated by three points in world space.
static void PersistentTri(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3); /// This will remain drawn until ClearDraws() is called.
/// <summary> /// </summary>
/// Renders a quadrilateral indicated by four points in world space that will persist /// <param name="pt1">First point of the triangle.</param>
/// until ClearPersistentDraws() is called. /// <param name="pt2">Second point of the triangle.</param>
/// </summary> /// <param name="pt3">Third point of the triangle.</param>
/// <param name="color">Colour of the quadrilateral.</param> /// <param name="color">Colour of the triangle.</param>
/// <param name="pt1">First point of the triangle.</param> /// <param name="depthTested">Whether or not drawn object will be occluded.</param>
/// <param name="pt2">Second point of the quadrilateral.</param> static void Tri(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec4& color, bool depthTested = false);
/// <param name="pt3">Third point of the quadrilateral.</param> /// <summary>
/// <param name="pt4">Third point of the quadrilateral.</param> /// Renders a quadrilateral indicated by four points in world space.
static void PersistentQuad(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4); /// This will remain drawn until ClearDraws() is called.
static void PersistentCircle(const SHMatrix& mat,const SHVec4& color); /// </summary>
/// <summary> /// <param name="pt1">First point of the triangle.</param>
/// Renders a polygon indicated by the specified set of points in world space that /// <param name="pt2">Second point of the quadrilateral.</param>
/// will persist until ClearPersistentDraws() is called. /// <param name="pt3">Third point of the quadrilateral.</param>
/// </summary> /// <param name="pt4">Third point of the quadrilateral.</param>
/// <param name="color">Colour of the polygon.</param> /// <param name="color">Colour of the quadrilateral.</param>
/// <param name="pointList">List of points for the polygon.</param> /// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void PersistentLineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList); static void Quad(const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4, const SHVec4& color, bool depthTested = false);
static void PersistentCube(const SHMatrix& mat, const SHVec4& color); /// <summary>
static void PersistentSphere(const SHMatrix& mat, const SHVec4& color); /// Draws a 2-dimensional circle in world space.
static void PersistentWireCube(const SHMatrix& mat, const SHVec4& color); /// This will remain drawn until ClearDraws() is called.
static void PersistentWireSphere(const SHMatrix& mat, const SHVec4& color); /// </summary>
/// <summary> /// <param name="matrix">
/// Clears any persistent drawn debug primitives. /// Matrix transformation that defines how the circle should be drawn.
/// </summary> /// </param>
static void ClearPersistentDraws(); /// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Circle(const SHMatrix& mat,const SHVec4& color, bool depthTested = false);
/// <summary>
/// Renders a polygon indicated by the specified set of points in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="color">Colour of the polygon.</param>
/// <param name="pointList">List of points for the polygon.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList, bool depthTested = false);
/// <summary>
/// Draws a filled cube in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled cube in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled cube in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="orientation">Orientation of the cube.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHVec3& center, const SHQuaternion& orientation, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled cube in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="eulerAngles">Euler angle rotation of the cube in radians.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Cube(const SHVec3& center, const SHVec3& eulerAngles, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="scale">Size of the sphere.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="orientation">Orientation of the sphere.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHVec3& center, const SHQuaternion& orientation, SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws a filled sphere in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="eulerAngles">Euler angle rotation of the sphere in radians.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void Sphere(const SHVec3& center, const SHVec3& eulerAngles, SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the outline of a cube in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the wire cube should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireCube(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the outline of a cube in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center of the Cube.</param>
/// <param name="scale">Size of the Cube.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the wireframe of a sphere in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="matrix">
/// Matrix transformation that defines how the sphere should be drawn.
/// </param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireSphere(const SHMatrix& mat, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Draws the wireframe of a sphere in world space.
/// This will remain drawn until ClearDraws() is called.
/// </summary>
/// <param name="center">Center point of the sphere.</param>
/// <param name="scale">Size of the sphere.</param>
/// <param name="color">Colour to draw with.</param>
/// <param name="depthTested">Whether or not drawn object will be occluded.</param>
static void WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color, bool depthTested = false);
/// <summary>
/// Clears any persistent drawn debug primitives.
/// </summary>
static void ClearDraws();
};
private: private:
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/

View File

@ -44,7 +44,7 @@ namespace SHADE
void Gizmos::DrawLine(Vector3 from, Vector3 to, SHADE::Color color) void Gizmos::DrawLine(Vector3 from, Vector3 to, SHADE::Color color)
{ {
SHDebugDraw::Line(Convert::ToNative(color), Convert::ToNative(from), Convert::ToNative(to)); SHDebugDraw::Line(Convert::ToNative(from), Convert::ToNative(to), Convert::ToNative(color));
} }
void Gizmos::DrawWireCube(Vector3 center, Vector3 extents) void Gizmos::DrawWireCube(Vector3 center, Vector3 extents)