Compare to cosine of angle, not angle.

This commit is contained in:
Daniel Buckmaster 2014-12-11 12:30:48 +11:00
parent 27252b0864
commit 93fdcdecbe

View file

@ -182,9 +182,9 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
cam.getColumn(3, &camPos); cam.getColumn(3, &camPos);
cam.getColumn(1, &camDir); cam.getColumn(1, &camDir);
F32 camFov; F32 camFovCos;
conn->getControlCameraFov(&camFov); conn->getControlCameraFov(&camFovCos);
camFov = mDegToRad(camFov) / 2; camFovCos = mCos(mDegToRad(camFovCos) / 2);
// Visible distance info & name fading // Visible distance info & name fading
F32 visDistance = gClientSceneGraph->getVisibleDistance(); F32 visDistance = gClientSceneGraph->getVisibleDistance();
@ -236,7 +236,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
// projection and box test. // projection and box test.
shapeDir.normalize(); shapeDir.normalize();
F32 dot = mDot(shapeDir, camDir); F32 dot = mDot(shapeDir, camDir);
if (dot < camFov) if (dot < camFovCos)
continue; continue;
// Test to see if it's behind something, and we want to // Test to see if it's behind something, and we want to