Fixed debug draw system cube rendering
This commit is contained in:
parent
904d6be6b0
commit
dc8ed48be3
|
@ -139,9 +139,10 @@ namespace Sandbox
|
|||
SHInputManager::UpdateInput(SHFrameRateController::GetRawDeltaTime());
|
||||
|
||||
auto debugDraw = SHSystemManager::GetSystem<SHDebugDrawSystem>();
|
||||
debugDraw->DrawLine(SHVec4(1.0f, 1.0f, 1.0f, 1.0f), SHVec3(-5.0f, 0.0f, 0.0f), SHVec3(5.0f, 0.0f, 0.0f));
|
||||
debugDraw->DrawLine(SHVec4(1.0f, 1.0f, 1.0f, 1.0f), SHVec3(-5.0f, 1.0f, 0.0f), SHVec3(5.0f, 1.0f, 0.0f));
|
||||
/*debugDraw->DrawLine(SHVec4(1.0f, 1.0f, 1.0f, 1.0f), SHVec3(-5.0f, 0.0f, 0.0f), SHVec3(5.0f, 0.0f, 0.0f));
|
||||
debugDraw->DrawLine(SHVec4(1.0f, 1.0f, 1.0f, 1.0f), SHVec3(-5.0f, 1.0f, 0.0f), SHVec3(5.0f, 1.0f, 0.0f));*/
|
||||
//debugDraw->DrawCube(SHVec4(1.0f, 1.0f, 1.0f, 1.0f), {}, SHVec3(1.0f, 1.0f, 1.0f));
|
||||
debugDraw->DrawSphere(SHVec4(1.0f, 1.0f, 1.0f, 1.0f), {}, 3.0f);
|
||||
SHSceneManager::UpdateSceneManager();
|
||||
#ifdef SHEDITOR
|
||||
if(editor->editorState == SHEditor::State::PLAY)
|
||||
|
|
|
@ -145,14 +145,14 @@ namespace SHADE
|
|||
void SHDebugDrawSystem::DrawCube(const SHVec4& color, const SHVec3& pos, const SHVec3& size)
|
||||
{
|
||||
static const SHVec3 EXTENTS = SHVec3 { 0.5f, 0.5f, 0.5f };
|
||||
static const SHVec3 UNIT_BOT_LEFT_BACK = SHVec3 { pos - EXTENTS };
|
||||
static const SHVec3 UNIT_BOT_RIGHT_BACK = SHVec3 { pos + SHVec3 { EXTENTS.x, -EXTENTS.y, 0.0f } };
|
||||
static const SHVec3 UNIT_BOT_LEFT_FRONT = SHVec3 { pos + SHVec3 { 0.0f , -EXTENTS.y, EXTENTS.z } };
|
||||
static const SHVec3 UNIT_BOT_RIGHT_FRONT = SHVec3 { pos + SHVec3 { EXTENTS.x, -EXTENTS.y, EXTENTS.z } };
|
||||
static const SHVec3 UNIT_TOP_LEFT_BACK = SHVec3 { pos + SHVec3 { EXTENTS.x, EXTENTS.y, 0.0f } };
|
||||
static const SHVec3 UNIT_TOP_RIGHT_BACK = SHVec3 { pos + SHVec3 { 0.0f , EXTENTS.y, EXTENTS.z } };
|
||||
static const SHVec3 UNIT_TOP_LEFT_FRONT = SHVec3 { pos + SHVec3 { EXTENTS.x, EXTENTS.y, EXTENTS.z } };
|
||||
static const SHVec3 UNIT_TOP_RIGHT_FRONT = SHVec3 { pos + EXTENTS };
|
||||
static const SHVec3 UNIT_BOT_LEFT_FRONT = SHVec3 { pos - EXTENTS };
|
||||
static const SHVec3 UNIT_BOT_RIGHT_FRONT = SHVec3 { pos + SHVec3 { EXTENTS.x, -EXTENTS.y, -EXTENTS.z } };
|
||||
static const SHVec3 UNIT_BOT_RIGHT_BACK = SHVec3 { pos + SHVec3 { EXTENTS.x, -EXTENTS.y, EXTENTS.z } };
|
||||
static const SHVec3 UNIT_BOT_LEFT_BACK = SHVec3 { pos + SHVec3 { -EXTENTS.x, -EXTENTS.y, EXTENTS.z } };
|
||||
static const SHVec3 UNIT_TOP_LEFT_BACK = SHVec3 { pos + SHVec3 { -EXTENTS.x, EXTENTS.y, EXTENTS.z } };
|
||||
static const SHVec3 UNIT_TOP_RIGHT_FRONT = SHVec3 { pos + SHVec3 { EXTENTS.x, EXTENTS.y, -EXTENTS.z } };
|
||||
static const SHVec3 UNIT_TOP_LEFT_FRONT = SHVec3 { pos + SHVec3 { -EXTENTS.x, EXTENTS.y, -EXTENTS.z } };
|
||||
static const SHVec3 UNIT_TOP_RIGHT_BACK = SHVec3 { pos + EXTENTS };
|
||||
|
||||
const SHVec3 BOT_LEFT_BACK = UNIT_BOT_LEFT_BACK * size;
|
||||
const SHVec3 BOT_RIGHT_BACK = UNIT_BOT_RIGHT_BACK * size;
|
||||
|
@ -172,17 +172,16 @@ namespace SHADE
|
|||
BOT_RIGHT_BACK , BOT_RIGHT_FRONT,
|
||||
BOT_RIGHT_FRONT, BOT_LEFT_FRONT,
|
||||
BOT_LEFT_FRONT , BOT_LEFT_BACK,
|
||||
// Middle Lines
|
||||
TOP_LEFT_BACK , BOT_LEFT_BACK,
|
||||
TOP_RIGHT_BACK , BOT_RIGHT_BACK,
|
||||
TOP_RIGHT_FRONT, BOT_RIGHT_FRONT,
|
||||
TOP_LEFT_FRONT , BOT_LEFT_FRONT,
|
||||
// Top Square
|
||||
TOP_LEFT_BACK , TOP_RIGHT_BACK,
|
||||
TOP_RIGHT_BACK , TOP_RIGHT_FRONT,
|
||||
TOP_RIGHT_FRONT, TOP_LEFT_FRONT,
|
||||
TOP_LEFT_FRONT , TOP_LEFT_BACK
|
||||
|
||||
TOP_LEFT_FRONT , TOP_LEFT_BACK,
|
||||
// Middle Lines
|
||||
TOP_LEFT_BACK , BOT_LEFT_BACK,
|
||||
TOP_RIGHT_BACK , BOT_RIGHT_BACK,
|
||||
TOP_RIGHT_FRONT, BOT_RIGHT_FRONT,
|
||||
TOP_LEFT_FRONT , BOT_LEFT_FRONT
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -192,7 +191,7 @@ namespace SHADE
|
|||
if (spherePoints.empty())
|
||||
{
|
||||
// Generate
|
||||
const SHMeshData SPHERE = SHPrimitiveGenerator::Sphere();
|
||||
static const SHMeshData SPHERE = SHPrimitiveGenerator::Sphere();
|
||||
for (const auto& idx : SPHERE.Indices)
|
||||
{
|
||||
spherePoints.emplace_back(SPHERE.VertexPositions[idx]);
|
||||
|
|
|
@ -39,10 +39,10 @@ namespace SHADE
|
|||
return;
|
||||
}
|
||||
|
||||
for (auto pointIter = pointListBegin + 1; pointIter != pointListEnd; ++pointIter)
|
||||
const size_t POINTS_ROUNDED_COUNT = POINTS_COUNT / 2 * 2;
|
||||
for (auto pointIter = pointListBegin; pointIter != (pointListBegin + POINTS_ROUNDED_COUNT); ++pointIter)
|
||||
{
|
||||
points.emplace_back(PointVertex { *(pointIter - 1), color });
|
||||
points.emplace_back(PointVertex { *pointIter , color });
|
||||
points.emplace_back(PointVertex { *pointIter, color });
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue