Added debug draw of wire spheres, filled cube and filled sphere
This commit is contained in:
parent
b6ab7b44d9
commit
78575b11e4
|
@ -231,8 +231,6 @@ namespace Sandbox
|
|||
SHADE::SHScriptEngine* scriptEngine = static_cast<SHADE::SHScriptEngine*>(SHADE::SHSystemManager::GetSystem<SHADE::SHScriptEngine>());
|
||||
scriptEngine->RemoveAllScripts(testObj);
|
||||
}
|
||||
|
||||
SHDebugDraw::Cube(SHColour::CRIMSON, SHVec3(1.0f, 0.0f, 0.0f), SHVec3(1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
void SBTestScene::Render()
|
||||
|
|
|
@ -67,14 +67,18 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
// Set up persistent batches if it was wiped
|
||||
if (system->persistentBuffersCleared[FRAME_IDX])
|
||||
// Set up persistent batches if it was changed
|
||||
if (system->persistentBuffersUpdated[FRAME_IDX])
|
||||
{
|
||||
for (auto& batch : system->persistentLineBatches)
|
||||
{
|
||||
system->prepareBatch(batch, FRAME_IDX);
|
||||
}
|
||||
system->persistentBuffersCleared[FRAME_IDX] = false;
|
||||
for (auto& batch : system->persistentMeshBatches)
|
||||
{
|
||||
system->prepareBatch(batch, FRAME_IDX);
|
||||
}
|
||||
system->persistentBuffersUpdated[FRAME_IDX] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,6 +117,9 @@ namespace SHADE
|
|||
cmdBuffer->BeginLabeledSegment("SHDebugDraw (Meshes)");
|
||||
{
|
||||
renderBatch(meshBatches[static_cast<int>(MeshRenderMode::WireNoDepthTest)], cmdBuffer, FRAME_IDX);
|
||||
renderBatch(meshBatches[static_cast<int>(MeshRenderMode::FilledNoDepthTest)], cmdBuffer, FRAME_IDX);
|
||||
renderBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::WireNoDepthTest)], cmdBuffer, FRAME_IDX);
|
||||
renderBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::FilledNoDepthTest)], cmdBuffer, FRAME_IDX);
|
||||
}
|
||||
cmdBuffer->EndLabeledSegment();
|
||||
}
|
||||
|
@ -134,6 +141,9 @@ namespace SHADE
|
|||
cmdBuffer->BeginLabeledSegment("SHDebugDraw (Meshes)");
|
||||
{
|
||||
renderBatch(meshBatches[static_cast<int>(MeshRenderMode::WireDepthTested)], cmdBuffer, FRAME_IDX);
|
||||
renderBatch(meshBatches[static_cast<int>(MeshRenderMode::FilledDepthTested)], cmdBuffer, FRAME_IDX);
|
||||
renderBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::WireDepthTested)], cmdBuffer, FRAME_IDX);
|
||||
renderBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::FilledDepthTested)], cmdBuffer, FRAME_IDX);
|
||||
}
|
||||
cmdBuffer->EndLabeledSegment();
|
||||
}
|
||||
|
@ -167,11 +177,31 @@ namespace SHADE
|
|||
DrawLineLoop({ p1, p2, p3 }, color, depthTested);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color, bool depthTested)
|
||||
{
|
||||
DrawLineLoop({ p1, p2, p3, p4 }, color, depthTested);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawWireCube(const SHMatrix& matrix, const SHColour& color, bool depthTested)
|
||||
{
|
||||
drawWireCube(getMeshBatch(false, depthTested), matrix, color);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawWireSphere(const SHMatrix& matrix, const SHColour& color /*= SHColour::WHITE*/, bool depthTested /*= false*/)
|
||||
{
|
||||
drawWireSphere(getMeshBatch(false, depthTested), matrix, color);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawCube(const SHMatrix& matrix, const SHColour& color /*= SHColour::WHITE*/, bool depthTested /*= false*/)
|
||||
{
|
||||
drawCube(getMeshBatch(true, depthTested), matrix, color);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawSphere(const SHMatrix& matrix, const SHColour& color /*= SHColour::WHITE*/, bool depthTested /*= false*/)
|
||||
{
|
||||
drawSphere(getMeshBatch(true, depthTested), matrix, color);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Persistent Draw Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -179,23 +209,55 @@ namespace SHADE
|
|||
{
|
||||
// Insert into the batch
|
||||
drawLine(getPersistentLineBatch(depthTested), start, end, color);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
void SHDebugDrawSystem::DrawPersistentLineLoop(std::initializer_list<SHVec3> points, const SHColour& color, bool depthTested)
|
||||
{
|
||||
DrawPersistentLineLoop(points.begin(), points.end(), color, depthTested);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawPersistentTri(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHColour& color, bool depthTested)
|
||||
{
|
||||
DrawPersistentLineLoop({ p1, p2, p3 }, color, depthTested);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawPersistentQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color, bool depthTested)
|
||||
{
|
||||
DrawPersistentLineLoop({ p1, p2, p3, p4 }, color, depthTested);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawPersistentWireCube(const SHMatrix& matrix, const SHColour& color, bool depthTested)
|
||||
{
|
||||
drawWireCube(getPersistentMeshBatch(false, depthTested), matrix, color);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawPersistentWireSphere(const SHMatrix& matrix, const SHColour& color, bool depthTested)
|
||||
{
|
||||
drawWireSphere(getPersistentMeshBatch(false, depthTested), matrix, color);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawPersistentCube(const SHMatrix& matrix, const SHColour& color, bool depthTested)
|
||||
{
|
||||
drawCube(getPersistentMeshBatch(true, depthTested), matrix, color);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::DrawPersistentSphere(const SHMatrix& matrix, const SHColour& color, bool depthTested)
|
||||
{
|
||||
drawSphere(getPersistentMeshBatch(true, depthTested), matrix, color);
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::ClearPersistentDraws()
|
||||
{
|
||||
for (auto& batch : persistentLineBatches)
|
||||
batch.Points.clear();
|
||||
for (bool& cleared : persistentBuffersCleared)
|
||||
cleared = true;
|
||||
markPersistentDrawsDirty();
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -214,29 +276,56 @@ namespace SHADE
|
|||
batch.Points.emplace_back(end, color);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::drawWireCube(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color)
|
||||
void SHDebugDrawSystem::drawMesh(Handle<SHMesh> mesh, MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color)
|
||||
{
|
||||
|
||||
const auto* GFX_SYSTEM = SHSystemManager::GetSystem<SHGraphicsSystem>();
|
||||
if (!GFX_SYSTEM)
|
||||
{
|
||||
SHLOG_ERROR("[DebugDraw] Attempted to do debug draw without a graphics system.");
|
||||
return;
|
||||
}
|
||||
|
||||
Handle<SHMesh> box = GFX_SYSTEM->GetMeshPrimitive(PrimitiveType::LineCube);
|
||||
|
||||
// Create if doesn't exist
|
||||
if (!batch.SubBatches.contains(box))
|
||||
if (!batch.SubBatches.contains(mesh))
|
||||
{
|
||||
MeshBatch::MultiDrawSet set;
|
||||
set.Mesh = box;
|
||||
batch.SubBatches.emplace(box, std::move(set));
|
||||
set.Mesh = mesh;
|
||||
batch.SubBatches.emplace(mesh, std::move(set));
|
||||
}
|
||||
|
||||
// Add to the batch
|
||||
batch.SubBatches[box].InstanceTransforms.emplace_back(transformMatrix);
|
||||
batch.SubBatches[box].InstanceColors.emplace_back(color);
|
||||
auto& subBatch = batch.SubBatches[mesh];
|
||||
subBatch.InstanceTransforms.emplace_back(transformMatrix);
|
||||
subBatch.InstanceColors.emplace_back(color);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::drawWireCube(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color)
|
||||
{
|
||||
drawMesh
|
||||
(
|
||||
gfxSystem->GetMeshPrimitive(PrimitiveType::LineCube),
|
||||
batch, transformMatrix, color
|
||||
);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::drawWireSphere(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color)
|
||||
{
|
||||
drawMesh
|
||||
(
|
||||
gfxSystem->GetMeshPrimitive(PrimitiveType::Sphere),
|
||||
batch, transformMatrix, color
|
||||
);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::drawCube(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color)
|
||||
{
|
||||
drawMesh
|
||||
(
|
||||
gfxSystem->GetMeshPrimitive(PrimitiveType::Cube),
|
||||
batch, transformMatrix, color
|
||||
);
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::drawSphere(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color)
|
||||
{
|
||||
drawMesh
|
||||
(
|
||||
gfxSystem->GetMeshPrimitive(PrimitiveType::Sphere),
|
||||
batch, transformMatrix, color
|
||||
);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -386,6 +475,24 @@ namespace SHADE
|
|||
return meshBatches[static_cast<int>(mode)];
|
||||
}
|
||||
|
||||
SHDebugDrawSystem::MeshBatch& SHDebugDrawSystem::getPersistentMeshBatch(bool filled, bool depthTested)
|
||||
{
|
||||
MeshRenderMode mode = {};
|
||||
|
||||
if (filled)
|
||||
{
|
||||
mode = depthTested ? MeshRenderMode::FilledDepthTested
|
||||
: MeshRenderMode::FilledNoDepthTest;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = depthTested ? MeshRenderMode::WireDepthTested
|
||||
: MeshRenderMode::WireNoDepthTest;
|
||||
}
|
||||
|
||||
return persistentMeshBatches[static_cast<int>(mode)];
|
||||
}
|
||||
|
||||
void SHDebugDrawSystem::createMeshBatches()
|
||||
{
|
||||
auto gfxSys = SHSystemManager::GetSystem<SHGraphicsSystem>();
|
||||
|
@ -416,6 +523,28 @@ namespace SHADE
|
|||
meshBatches[static_cast<int>(MeshRenderMode::WireDepthTested)],
|
||||
gfxSys->GetDebugDrawPipeline(DebugDrawPipelineType::LineMeshDepthTested)
|
||||
);
|
||||
|
||||
// Set up persistent batches
|
||||
initBatch
|
||||
(
|
||||
persistentMeshBatches[static_cast<int>(MeshRenderMode::FilledNoDepthTest)],
|
||||
gfxSys->GetDebugDrawPipeline(DebugDrawPipelineType::FilledMeshNoDepthTest)
|
||||
);
|
||||
initBatch
|
||||
(
|
||||
persistentMeshBatches[static_cast<int>(MeshRenderMode::FilledDepthTested)],
|
||||
gfxSys->GetDebugDrawPipeline(DebugDrawPipelineType::FilledMeshDepthTested)
|
||||
);
|
||||
initBatch
|
||||
(
|
||||
persistentMeshBatches[static_cast<int>(MeshRenderMode::WireNoDepthTest)],
|
||||
gfxSys->GetDebugDrawPipeline(DebugDrawPipelineType::LineMeshNoDepthTest)
|
||||
);
|
||||
initBatch
|
||||
(
|
||||
persistentMeshBatches[static_cast<int>(MeshRenderMode::WireDepthTested)],
|
||||
gfxSys->GetDebugDrawPipeline(DebugDrawPipelineType::LineMeshDepthTested)
|
||||
);
|
||||
}
|
||||
void SHDebugDrawSystem::initBatch(MeshBatch& batch, Handle<SHVkPipeline> pipeline)
|
||||
{
|
||||
|
@ -552,5 +681,20 @@ namespace SHADE
|
|||
destroyBatch(meshBatches[static_cast<int>(MeshRenderMode::FilledDepthTested)]);
|
||||
destroyBatch(meshBatches[static_cast<int>(MeshRenderMode::WireNoDepthTest)]);
|
||||
destroyBatch(meshBatches[static_cast<int>(MeshRenderMode::WireDepthTested)]);
|
||||
|
||||
destroyBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::FilledNoDepthTest)]);
|
||||
destroyBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::FilledDepthTested)]);
|
||||
destroyBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::WireNoDepthTest)]);
|
||||
destroyBatch(persistentMeshBatches[static_cast<int>(MeshRenderMode::WireDepthTested)]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHDebugDrawSystem::markPersistentDrawsDirty()
|
||||
{
|
||||
for (bool& dirty : persistentBuffersUpdated)
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
}
|
|
@ -100,7 +100,11 @@ namespace SHADE
|
|||
template<typename IterType>
|
||||
void DrawLineLoop(IterType pointListBegin, IterType pointListEnd, 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);
|
||||
void DrawQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color = SHColour::WHITE, bool depthTested = false);
|
||||
void DrawWireCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
|
||||
void DrawWireSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
|
||||
void DrawCube(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 */
|
||||
|
@ -110,6 +114,11 @@ namespace SHADE
|
|||
template<typename IterType>
|
||||
void DrawPersistentLineLoop(IterType pointListBegin, IterType pointListEnd, 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);
|
||||
void DrawPersistentQuad(const SHVec3& p1, const SHVec3& p2, const SHVec3& p3, const SHVec3& p4, const SHColour& color = SHColour::WHITE, bool depthTested = false);
|
||||
void DrawPersistentWireCube(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
|
||||
void DrawPersistentWireSphere(const SHMatrix& matrix, const SHColour& color = SHColour::WHITE, bool depthTested = false);
|
||||
void DrawPersistentCube(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>
|
||||
/// Clears any persistent drawn debug primitives.
|
||||
/// </summary>
|
||||
|
@ -148,7 +157,6 @@ namespace SHADE
|
|||
// GPU Buffers
|
||||
TripleBuffer VertexBuffers;
|
||||
TripleUInt NumPoints;
|
||||
|
||||
};
|
||||
|
||||
struct MeshBatch : public Batch
|
||||
|
@ -193,8 +201,9 @@ namespace SHADE
|
|||
std::array<LinesBatch, LINE_MODE_COUNT> lineBatches;
|
||||
std::array<LinesBatch, LINE_MODE_COUNT> persistentLineBatches;
|
||||
std::array<MeshBatch , MESH_MODE_COUNT> meshBatches;
|
||||
std::array<MeshBatch , MESH_MODE_COUNT> persistentMeshBatches;
|
||||
// Tracking
|
||||
TripleBool persistentBuffersCleared; // TODO: Use this
|
||||
TripleBool persistentBuffersUpdated = { true, true, true };
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Helper Draw Functions */
|
||||
|
@ -202,7 +211,11 @@ namespace SHADE
|
|||
void drawLine(LinesBatch& batch, const SHVec3& start, const SHVec3& end, const SHColour& color);
|
||||
template<typename IterType>
|
||||
void drawLineLoop(LinesBatch& batch, IterType pointListBegin, IterType pointListEnd, const SHColour& color);
|
||||
void drawMesh(Handle<SHMesh> mesh, MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color);
|
||||
void drawWireCube(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color);
|
||||
void drawWireSphere(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color);
|
||||
void drawCube(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color);
|
||||
void drawSphere(MeshBatch& batch, const SHMatrix& transformMatrix, const SHColour& color);
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Helper Batch Functions - Lines */
|
||||
|
@ -220,12 +233,18 @@ namespace SHADE
|
|||
/* Helper Batch Functions - Meshes */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
MeshBatch& getMeshBatch(bool filled, bool depthTested);
|
||||
MeshBatch& getPersistentMeshBatch(bool filled, bool depthTested);
|
||||
void createMeshBatches();
|
||||
void initBatch(MeshBatch& batch, Handle<SHVkPipeline> pipeline);
|
||||
void prepareBatch(MeshBatch& batch, uint32_t frameIndex);
|
||||
void renderBatch(MeshBatch& batch, Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex);
|
||||
void destroyBatch(MeshBatch& batch);;
|
||||
void destroyMeshBatches();
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
void markPersistentDrawsDirty();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "SHDebugDraw.h"
|
||||
// Project Includes
|
||||
#include "Math/Vector/SHVec4.h"
|
||||
#include "Math/SHQuaternion.h"
|
||||
#include "Math/SHColour.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHDebugDrawSystem.h"
|
||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||
|
@ -48,27 +49,27 @@ namespace SHADE
|
|||
|
||||
void SHDebugDraw::Tri(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3)
|
||||
{
|
||||
//dbgDrawSys->DrawTri(color, pt1, pt2, pt3);
|
||||
dbgDrawSys->DrawTri(pt1, pt2, pt3, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::Quad(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4)
|
||||
{
|
||||
//dbgDrawSys->DrawQuad(color, pt1, pt2, pt3, pt4);
|
||||
dbgDrawSys->DrawQuad(pt1, pt2, pt3, pt4, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::Poly(const SHVec4& color, std::initializer_list<SHVec3> pointList)
|
||||
void SHDebugDraw::LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList)
|
||||
{
|
||||
//dbgDrawSys->DrawPoly(color, pointList);
|
||||
dbgDrawSys->DrawLineLoop(pointList, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::Cube(const SHVec4& color, const SHVec3& pos, const SHVec3& size)
|
||||
void SHDebugDraw::Cube(const SHMatrix& mat, const SHVec4& color)
|
||||
{
|
||||
//dbgDrawSys->DrawCube(color, pos, size);
|
||||
dbgDrawSys->DrawCube(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::Sphere(const SHVec4& color, const SHVec3& pos, double radius)
|
||||
void SHDebugDraw::Sphere(const SHMatrix& mat, const SHVec4& color)
|
||||
{
|
||||
//dbgDrawSys->DrawSphere(color, pos, radius);
|
||||
dbgDrawSys->DrawSphere(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::WireCube(const SHMatrix& mat, const SHVec4& color)
|
||||
|
@ -76,6 +77,24 @@ namespace SHADE
|
|||
dbgDrawSys->DrawWireCube(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color)
|
||||
{
|
||||
dbgDrawSys->DrawWireCube(SHMatrix::Transform(center, SHQuaternion(), scale), color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::WireSphere(const SHMatrix& mat, const SHVec4& color)
|
||||
{
|
||||
dbgDrawSys->DrawWireSphere(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color)
|
||||
{
|
||||
dbgDrawSys->DrawWireSphere(SHMatrix::Transform(center, SHQuaternion(), scale), color);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Persistent Draw Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHDebugDraw::PersistentLine(const SHVec4& color, const SHVec3& startPt, const SHVec3& endPt)
|
||||
{
|
||||
dbgDrawSys->DrawPersistentLine(startPt, endPt, color);
|
||||
|
@ -83,27 +102,37 @@ namespace SHADE
|
|||
|
||||
void SHDebugDraw::PersistentTri(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3)
|
||||
{
|
||||
//dbgDrawSys->DrawPersistentTri(color, pt1, pt2, pt3);
|
||||
dbgDrawSys->DrawPersistentTri(pt1, pt2, pt3, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::PersistentQuad(const SHVec4& color, const SHVec3& pt1, const SHVec3& pt2, const SHVec3& pt3, const SHVec3& pt4)
|
||||
{
|
||||
//dbgDrawSys->DrawPersistentQuad(color, pt1, pt2, pt3, pt4);
|
||||
dbgDrawSys->DrawPersistentQuad(pt1, pt2, pt3, pt4, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::PersistentPoly(const SHVec4& color, std::initializer_list<SHVec3> pointList)
|
||||
void SHDebugDraw::PersistentLineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList)
|
||||
{
|
||||
//dbgDrawSys->DrawPersistentPoly(color, pointList);
|
||||
dbgDrawSys->DrawPersistentLineLoop(pointList, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::PersistentCube(const SHVec4& color, const SHVec3& pos, const SHVec3& size)
|
||||
void SHDebugDraw::PersistentCube(const SHMatrix& mat, const SHVec4& color)
|
||||
{
|
||||
//dbgDrawSys->DrawPersistentCube(color, pos, size);
|
||||
dbgDrawSys->DrawPersistentCube(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::PersistentSphere(const SHVec4& color, const SHVec3& pos, double radius)
|
||||
void SHDebugDraw::PersistentSphere(const SHMatrix& mat, const SHVec4& color)
|
||||
{
|
||||
//dbgDrawSys->DrawPersistentSphere(color, pos, radius);
|
||||
dbgDrawSys->DrawPersistentSphere(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::PersistentWireCube(const SHMatrix& mat, const SHVec4& color)
|
||||
{
|
||||
dbgDrawSys->DrawPersistentWireCube(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::PersistentWireSphere(const SHMatrix& mat, const SHVec4& color)
|
||||
{
|
||||
dbgDrawSys->DrawPersistentWireSphere(mat, color);
|
||||
}
|
||||
|
||||
void SHDebugDraw::ClearPersistentDraws()
|
||||
|
|
|
@ -77,23 +77,13 @@ namespace SHADE
|
|||
/// </summary>
|
||||
/// <param name="color">Colour of the polygon.</param>
|
||||
/// <param name="pointList">List of points for the polygon.</param>
|
||||
static void Poly(const SHVec4& color, std::initializer_list<SHVec3> pointList);
|
||||
/// <summary>
|
||||
/// Renders a wireframe cube centered around the position specified in world space.
|
||||
/// </summary>
|
||||
/// <param name="color">Colour of the cube.</param>
|
||||
/// <param name="pos">Position where the cube wil be centered at.</param>
|
||||
/// <param name="size">Size of the rendered cube.</param>
|
||||
static void Cube(const SHVec4& color, const SHVec3& pos, const SHVec3& size);
|
||||
/// <summary>
|
||||
/// Renders a wireframe sphere centered around the position specified in world space.
|
||||
/// </summary>
|
||||
/// <param name="color">Colour of the sphere.</param>
|
||||
/// <param name="pos">Position where the sphere wil be centered at.</param>
|
||||
/// <param name="size">Size of the rendered sphere.</param>
|
||||
static void Sphere(const SHVec4& color, const SHVec3& pos, double radius);
|
||||
|
||||
static void LineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList);
|
||||
static void Cube(const SHMatrix& mat, const SHVec4& color);
|
||||
static void Sphere(const SHMatrix& mat, const SHVec4& color);
|
||||
static void WireCube(const SHMatrix& mat, const SHVec4& color);
|
||||
static void WireCube(const SHVec3& center, const SHVec3& scale, const SHVec4& color);
|
||||
static void WireSphere(const SHMatrix& mat, const SHVec4& color);
|
||||
static void WireSphere(const SHVec3& center, const SHVec3& scale, const SHVec4& color);
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Persistent Draw Functions */
|
||||
|
@ -131,23 +121,11 @@ namespace SHADE
|
|||
/// </summary>
|
||||
/// <param name="color">Colour of the polygon.</param>
|
||||
/// <param name="pointList">List of points for the polygon.</param>
|
||||
static void PersistentPoly(const SHVec4& color, std::initializer_list<SHVec3> pointList);
|
||||
/// <summary>
|
||||
/// Renders a wireframe cube centered around the position specified in world space
|
||||
/// that will persist until ClearPersistentDraws() is called.
|
||||
/// </summary>
|
||||
/// <param name="color">Colour of the cube.</param>
|
||||
/// <param name="pos">Position where the cube wil be centered at.</param>
|
||||
/// <param name="size">Size of the rendered cube.</param>
|
||||
static void PersistentCube(const SHVec4& color, const SHVec3& pos, const SHVec3& size);
|
||||
/// <summary>
|
||||
/// Renders a wireframe sphere centered around the position specified in world space
|
||||
/// that will persist until ClearPersistentDraws() is called.
|
||||
/// </summary>
|
||||
/// <param name="color">Colour of the sphere.</param>
|
||||
/// <param name="pos">Position where the sphere wil be centered at.</param>
|
||||
/// <param name="size">Size of the rendered sphere.</param>
|
||||
static void PersistentSphere(const SHVec4& color, const SHVec3& pos, double radius);
|
||||
static void PersistentLineLoop(const SHVec4& color, std::initializer_list<SHVec3> pointList);
|
||||
static void PersistentCube(const SHMatrix& mat, const SHVec4& color);
|
||||
static void PersistentSphere(const SHMatrix& mat, const SHVec4& color);
|
||||
static void PersistentWireCube(const SHMatrix& mat, const SHVec4& color);
|
||||
static void PersistentWireSphere(const SHMatrix& mat, const SHVec4& color);
|
||||
/// <summary>
|
||||
/// Clears any persistent drawn debug primitives.
|
||||
/// </summary>
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace SHADE
|
|||
|
||||
void Gizmos::DrawWireCube(Vector3 center, Vector3 extents, SHADE::Color color)
|
||||
{
|
||||
SHDebugDraw::Cube(Convert::ToNative(color), Convert::ToNative(center), Convert::ToNative(extents));
|
||||
SHDebugDraw::WireCube(Convert::ToNative(center), Convert::ToNative(extents), Convert::ToNative(color));
|
||||
}
|
||||
|
||||
void Gizmos::DrawWireSphere(Vector3 center, float radius)
|
||||
|
@ -64,6 +64,6 @@ namespace SHADE
|
|||
|
||||
void Gizmos::DrawWireSphere(Vector3 center, float radius, SHADE::Color color)
|
||||
{
|
||||
SHDebugDraw::Sphere(Convert::ToNative(color), Convert::ToNative(center), radius);
|
||||
SHDebugDraw::WireSphere(Convert::ToNative(center), SHVec3(radius, radius, radius), Convert::ToNative(color));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue