Added support for debug drawing wireframe capsules #302
|
@ -362,12 +362,12 @@ namespace SHADE
|
||||||
void SHDebugDrawSystem::drawWireCapsule(LinesBatch& lineBatch, MeshBatch& meshBatch, const SHVec3& position, const SHQuaternion& rotation, float height, float radius, const SHColour& color)
|
void SHDebugDrawSystem::drawWireCapsule(LinesBatch& lineBatch, MeshBatch& meshBatch, const SHVec3& position, const SHQuaternion& rotation, float height, float radius, const SHColour& color)
|
||||||
{
|
{
|
||||||
// Get local axis vectors
|
// Get local axis vectors
|
||||||
const SHVec3 LOCAL_UP = SHVec3::Up;
|
const SHVec3 LOCAL_UP = SHVec3::Rotate(SHVec3::Up, rotation);
|
||||||
const SHVec3 LOCAL_RIGHT = SHVec3::Right;
|
const SHVec3 LOCAL_RIGHT = SHVec3::Rotate(SHVec3::Right, rotation);
|
||||||
const SHVec3 LOCAL_FORWARD = SHVec3::Forward;
|
const SHVec3 LOCAL_FORWARD = SHVec3::Rotate(SHVec3::Forward, rotation);
|
||||||
|
|
||||||
// Rotate the circle
|
// Rotate the circle
|
||||||
SHQuaternion circleOrientation = SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(90.0), 0.0f, 0.0f));
|
SHQuaternion circleOrientation = SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(90.0), 0.0f, 0.0f)) * rotation;
|
||||||
|
|
||||||
// Compute top and bottom of the cylinder
|
// Compute top and bottom of the cylinder
|
||||||
const SHVec3 HALF_UP = LOCAL_UP * (height * 0.5f - radius);
|
const SHVec3 HALF_UP = LOCAL_UP * (height * 0.5f - radius);
|
||||||
|
@ -396,7 +396,7 @@ namespace SHADE
|
||||||
const SHMatrix BOT_CAP_MAT = SHMatrix::Transform
|
const SHMatrix BOT_CAP_MAT = SHMatrix::Transform
|
||||||
(
|
(
|
||||||
BOT_POS,
|
BOT_POS,
|
||||||
rotation * SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(180.0), 0.0f, 0.0f)),
|
SHQuaternion::FromEuler(SHVec3(SHMath::DegreesToRadians(180.0), 0.0f, 0.0f)) * rotation,
|
||||||
RADIUS_SCALE
|
RADIUS_SCALE
|
||||||
);
|
);
|
||||||
drawMesh
|
drawMesh
|
||||||
|
|
Loading…
Reference in New Issue