1
0
Fork 0

Change the extra culling to do only a quarter of the scene every 200

frames rather than the whole thing, to avoid tiny stutters.
This commit is contained in:
david 2002-07-25 17:47:42 +00:00
parent e7e576055f
commit 9bf3c10743

View file

@ -647,20 +647,34 @@ void fgRenderFrame() {
ssgSetNearFar( scene_nearplane, scene_farplane ); ssgSetNearFar( scene_nearplane, scene_farplane );
ssgCullAndDraw( globals->get_scenery()->get_scene_graph() ); ssgCullAndDraw( globals->get_scenery()->get_scene_graph() );
// This is a bit kludgy. Every 200 frames, do an extra traversal // This is a bit kludgy. Every 200 frames, do an extra
// of the scene graph without drawing anything and with frustum // traversal of the scene graph without drawing anything and
// culling disabled. This ensures that out-of-range random // the frustum set to a different 25% of the full range of
// objects that are not in the current view frustum will still be // view. This ensures that out-of-range random objects that
// freed properly. // are not in the current view frustum will still be freed
// properly.
static int counter = 0; static int counter = 0;
if (++counter == 200) { counter++;
// We disable frustrum testing, so if (counter % 200 == 0) {
// the default is fine.
sgFrustum f; sgFrustum f;
switch (counter) {
case 200:
f.setFrustum(SG_180, SG_ZERO, SG_90, SG_ZERO, 0, 500000000);
break;
case 400:
f.setFrustum(SG_ZERO, SG_180, SG_90, SG_ZERO, 0, 500000000);
break;
case 600:
f.setFrustum(SG_180, SG_ZERO, SG_ZERO, SG_90, 0, 500000000);
break;
case 800:
f.setFrustum(SG_ZERO, SG_180, SG_ZERO, SG_90, 0, 500000000);
counter = 0;
break;
}
sgMat4 m; sgMat4 m;
ssgGetModelviewMatrix(m); ssgGetModelviewMatrix(m);
globals->get_scenery()->get_scene_graph()->cull(&f, m, false); globals->get_scenery()->get_scene_graph()->cull(&f, m, true);
counter = 0;
} }
// change state for lighting here // change state for lighting here