Skip to content

Commit

Permalink
Applied div by zero fix to other DebugRenderer::DrawBox function too
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouwe committed Sep 27, 2024
1 parent 81c9859 commit a8327c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Jolt/Renderer/DebugRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ void DebugRenderer::DrawBox(const AABox &inBox, ColorArg inColor, ECastShadow in
{
JPH_PROFILE_FUNCTION();

RMat44 m = RMat44::sScale(inBox.GetExtent());
RMat44 m = RMat44::sScale(Vec3::sMax(inBox.GetExtent(), Vec3::sReplicate(1.0e-6f))); // Prevent div by zero when one of the edges has length 0
m.SetTranslation(RVec3(inBox.GetCenter()));
DrawGeometry(m, inColor, mBox, ECullMode::CullBackFace, inCastShadow, inDrawMode);
}
Expand All @@ -733,7 +733,7 @@ void DebugRenderer::DrawBox(RMat44Arg inMatrix, const AABox &inBox, ColorArg inC
{
JPH_PROFILE_FUNCTION();

Mat44 m = Mat44::sScale(Vec3::sMax(inBox.GetExtent(), Vec3::sReplicate(1.0e-6f)));
Mat44 m = Mat44::sScale(Vec3::sMax(inBox.GetExtent(), Vec3::sReplicate(1.0e-6f))); // Prevent div by zero when one of the edges has length 0
m.SetTranslation(inBox.GetCenter());
DrawGeometry(inMatrix * m, inColor, mBox, ECullMode::CullBackFace, inCastShadow, inDrawMode);
}
Expand Down

0 comments on commit a8327c3

Please sign in to comment.