Fixed a problem with terrain culling not updating as the camera FOV changes.

reported here: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=30575

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1633 dfc29bdd-3216-0410-991c-e03cc46cb475
master
lukeph 2008-10-17 05:11:14 +00:00
parent 67b315786d
commit a98153f8d5
2 changed files with 11 additions and 2 deletions

View File

@ -38,7 +38,7 @@ namespace scene
OverrideDistanceThreshold(false), UseDefaultRotationPivot(true), ForceRecalculation(false),
OldCameraPosition(core::vector3df(-99999.9f, -99999.9f, -99999.9f)),
OldCameraRotation(core::vector3df(-99999.9f, -99999.9f, -99999.9f)),
CameraMovementDelta(10.0f), CameraRotationDelta(1.0f),
CameraMovementDelta(10.0f), CameraRotationDelta(1.0f),CameraFOVDelta(0.1f),
TCoordScale1(1.0f), TCoordScale2(1.0f), FileSystem(fs)
{
#ifdef _DEBUG
@ -451,6 +451,8 @@ namespace scene
// Determine the camera rotation, based on the camera direction.
const core::vector3df cameraPosition = SceneManager->getActiveCamera()->getAbsolutePosition();
const core::vector3df cameraRotation = core::line3d<f32>(cameraPosition, SceneManager->getActiveCamera()->getTarget()).getVector().getHorizontalAngle();
const f32 CameraFOV = SceneManager->getActiveCamera()->getFOV();
// Only check on the Camera's Y Rotation
if (!ForceRecalculation)
@ -462,13 +464,18 @@ namespace scene
(fabs(cameraPosition.Y - OldCameraPosition.Y) < CameraMovementDelta) &&
(fabs(cameraPosition.Z - OldCameraPosition.Z) < CameraMovementDelta))
{
return;
if (fabs(CameraFOV-OldCameraFOV) < CameraFOVDelta)
{
return;
}
}
}
}
OldCameraPosition = cameraPosition;
OldCameraRotation = cameraRotation;
OldCameraFOV = CameraFOV;
const SViewFrustum* frustum = SceneManager->getActiveCamera()->getViewFrustum();
// Determine each patches LOD based on distance from camera ( and whether or not they are in

View File

@ -324,8 +324,10 @@ namespace scene
core::vector3df OldCameraPosition;
core::vector3df OldCameraRotation;
f32 OldCameraFOV;
f32 CameraMovementDelta;
f32 CameraRotationDelta;
f32 CameraFOVDelta;
// needed for (de)serialization
f32 TCoordScale1;