Added DebugDrawer::DrawLine and DebugDrawer::DrawPoints
Former-commit-id: e1b2278a7c11ebfc8050bad23aef7a9a4cbf3c25
This commit is contained in:
parent
3dac383486
commit
ebb13d3bf2
|
|
@ -29,6 +29,8 @@ class NAZARA_API NzDebugDrawer
|
||||||
static void Draw(const NzSkeleton* skeleton);
|
static void Draw(const NzSkeleton* skeleton);
|
||||||
static void DrawBinormals(const NzStaticMesh* subMesh);
|
static void DrawBinormals(const NzStaticMesh* subMesh);
|
||||||
static void DrawCone(const NzVector3f& origin, const NzQuaternionf& rotation, float angle, float length);
|
static void DrawCone(const NzVector3f& origin, const NzQuaternionf& rotation, float angle, float length);
|
||||||
|
static void DrawLine(const NzVector3f& p1, const NzVector3f& p2);
|
||||||
|
static void DrawPoints(const NzVector3f* ptr, unsigned int pointCount);
|
||||||
static void DrawNormals(const NzStaticMesh* subMesh);
|
static void DrawNormals(const NzStaticMesh* subMesh);
|
||||||
static void DrawTangents(const NzStaticMesh* subMesh);
|
static void DrawTangents(const NzStaticMesh* subMesh);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -486,6 +486,51 @@ void NzDebugDrawer::DrawCone(const NzVector3f& origin, const NzQuaternionf& rota
|
||||||
NzRenderer::DrawPrimitives(nzPrimitiveMode_LineList, 0, 16);
|
NzRenderer::DrawPrimitives(nzPrimitiveMode_LineList, 0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NzDebugDrawer::DrawLine(const NzVector3f& p1, const NzVector3f& p2)
|
||||||
|
{
|
||||||
|
if (!s_initialized && !Initialize())
|
||||||
|
{
|
||||||
|
NazaraError("Failed to initialize Debug Drawer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NzVertexStruct_XYZ buffer[2];
|
||||||
|
buffer[0].position = p1;
|
||||||
|
buffer[1].position = p2;
|
||||||
|
|
||||||
|
s_vertexBuffer.Fill(&buffer[0], 0, 2);
|
||||||
|
|
||||||
|
NzRenderer::SetRenderStates(s_renderStates);
|
||||||
|
NzRenderer::SetShader(s_shader);
|
||||||
|
NzRenderer::SetVertexBuffer(&s_vertexBuffer);
|
||||||
|
|
||||||
|
s_shader->SendColor(s_colorLocation, s_primaryColor);
|
||||||
|
NzRenderer::DrawPrimitives(nzPrimitiveMode_LineList, 0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NzDebugDrawer::DrawPoints(const NzVector3f* ptr, unsigned int pointCount)
|
||||||
|
{
|
||||||
|
static_assert(sizeof(NzVertexStruct_XYZ) == sizeof(NzVector3f), "NzVertexStruct_XYZ is no longer equal to NzVector3f, please rewrite this");
|
||||||
|
|
||||||
|
if (!s_initialized && !Initialize())
|
||||||
|
{
|
||||||
|
NazaraError("Failed to initialize Debug Drawer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pointCount > 0)
|
||||||
|
{
|
||||||
|
s_vertexBuffer.Fill(ptr, 0, pointCount);
|
||||||
|
|
||||||
|
NzRenderer::SetRenderStates(s_renderStates);
|
||||||
|
NzRenderer::SetShader(s_shader);
|
||||||
|
NzRenderer::SetVertexBuffer(&s_vertexBuffer);
|
||||||
|
|
||||||
|
s_shader->SendColor(s_colorLocation, s_primaryColor);
|
||||||
|
NzRenderer::DrawPrimitives(nzPrimitiveMode_PointList, 0, pointCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NzDebugDrawer::DrawNormals(const NzStaticMesh* subMesh)
|
void NzDebugDrawer::DrawNormals(const NzStaticMesh* subMesh)
|
||||||
{
|
{
|
||||||
if (!s_initialized && !Initialize())
|
if (!s_initialized && !Initialize())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue