1
0
Fork 0

Fix a problem with the culling of out-of-range random objects. When

the triangles containing the objects were out of the view Frustum,
they were never traversed by ssg (and thus, never culled).  Now, every
200 frames, do a pass through the whole scene graph with cull-testing
disabled and without drawing anything; that will allow random-objects
to be collected incrementally.
This commit is contained in:
david 2002-07-25 17:29:08 +00:00
parent 6ac85b8625
commit 1c35d89eb4

View file

@ -647,6 +647,22 @@ void fgRenderFrame() {
ssgSetNearFar( scene_nearplane, scene_farplane );
ssgCullAndDraw( globals->get_scenery()->get_scene_graph() );
// This is a bit kludgy. Every 200 frames, do an extra traversal
// of the scene graph without drawing anything and with frustum
// culling disabled. This ensures that out-of-range random
// objects that are not in the current view frustum will still be
// freed properly.
static int counter = 0;
if (++counter == 200) {
// We disable frustrum testing, so
// the default is fine.
sgFrustum f;
sgMat4 m;
ssgGetModelviewMatrix(m);
globals->get_scenery()->get_scene_graph()->cull(&f, m, false);
counter = 0;
}
// change state for lighting here
// draw lighting