Skip to content

Commit

Permalink
Another normalize that can div by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
atupone committed Jul 3, 2024
1 parent 3eb6bdb commit 73fc8ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/geometry/BillboardSceneNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// common implementation headers
#include "BZDBCache.h"
#include "TextureManager.h"
#include "mathRoutine.h"

// local implementation headers
#include "ViewFrustum.h"
Expand Down Expand Up @@ -365,7 +366,8 @@ void BillboardSceneNode::BillboardRenderNode::render()
dir[0] = eye[0] - sphere[0];
dir[1] = eye[1] - sphere[1];
dir[2] = eye[2] - sphere[2];
d = sceneNode->width / hypotf(dir[0], hypotf(dir[1], dir[2]));
float speed2 = dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2];
d = sceneNode->width * bzInverseSqrt(speed2);

glPushMatrix();
{
Expand Down

0 comments on commit 73fc8ba

Please sign in to comment.