From 08cf89bd27cde3a44b8b033e067cdcd506b0a475 Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Sun, 24 Aug 2025 16:49:20 -0400 Subject: [PATCH] Clean up some bad formatting in camera resetting code --- RecastDemo/Source/AppData.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/RecastDemo/Source/AppData.cpp b/RecastDemo/Source/AppData.cpp index e1eddf9b..26fd178a 100644 --- a/RecastDemo/Source/AppData.cpp +++ b/RecastDemo/Source/AppData.cpp @@ -26,14 +26,16 @@ void AppData::resetCamera() const float* boundsMin = inputGeometry->getNavMeshBoundsMin(); const float* boundsMax = inputGeometry->getNavMeshBoundsMax(); - camr = sqrtf( - rcSqr(boundsMax[0] - boundsMin[0]) + rcSqr(boundsMax[1] - boundsMin[1]) + - rcSqr(boundsMax[2] - boundsMin[2])) / - 2; - cameraPos[0] = (boundsMax[0] + boundsMin[0]) / 2 + camr; - cameraPos[1] = (boundsMax[1] + boundsMin[1]) / 2 + camr; - cameraPos[2] = (boundsMax[2] + boundsMin[2]) / 2 + camr; - camr *= 3; + camr = rcSqr(boundsMax[0] - boundsMin[0]); + camr += rcSqr(boundsMax[1] - boundsMin[1]); + camr += rcSqr(boundsMax[2] - boundsMin[2]); + camr = sqrtf(camr) / 2.0f; + + cameraPos[0] = (boundsMax[0] + boundsMin[0]) / 2.0f + camr; + cameraPos[1] = (boundsMax[1] + boundsMin[1]) / 2.0f + camr; + cameraPos[2] = (boundsMax[2] + boundsMin[2]) / 2.0f + camr; + + camr *= 3.0f; } cameraEulers[0] = 45; cameraEulers[1] = -45;