If you have a terrain and a camera and you rotate the terrain OR you rotate the camera around the terrain, basically the same thing is happening.ratamovic wrote:But I can't understand the slowdown when I move the camera instead.
Have you watched it as a wireframe? Then you can see what is happening. Use a FPcam too to see, so you can see updates when you move.
It's recomputing it's patches everytime the distance between the camera and the terrain is changed then saves the indices in the patches to an indexbuffer. At least something like that. Then it renders the 'new patched indexbuffer' until the distance is changed. That distance check is happening at line 597-613: CTerrainSceneNode.cpp
LOD systems are strange things actually. There goal is to reduce gpu time, to do that the cpu gets grazy when updating resulting in exactly that thing wich you want to avoid - low FPS rate - so that update should be reduced and you get some neat terrain.
Maybe the next three functions can manipulate the update LOD update.
Code: Select all
CTerrainSceneNode::
virtual void setCameraMovementDelta(f32 delta);
virtual void setCameraRotationDelta(f32 delta);
virtual bool overrideLODDistance( s32 LOD, f64 newDistance ); <-- not sure about this one but sounds interresting :)
KP84
EDIT: By the way, it's not computing anything on load, just loading the heights from the file then only calculating the smoothing and normals. When the node is being registered for rendering (line 568) it will check if recalculating is neccesary. That check is done every frame. And when the distance isn't changed out of the movement/rotation delta, it is skipping the recomputing thing.
btw btw: Thus the smoothing is only done once.