From: ehofman Date: Sat, 19 Mar 2005 10:19:30 +0000 (+0000) Subject: Melchior FRANZ: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=61a2e0f104e7fcd40e37d8e466f419da8a15918f;p=simgear.git Melchior FRANZ: the cause for the disappearing shadows is, that SimGear doesn't tell plib to call the pre-traversal-callback function on culled objects. These calls, however, are necessary to execute the transform animation that does, for example, translate a shadow back into the frustum! Curretnly, the callback is only executed, and the shadow only magically pops up again, when the object enters the frustum because the view has changed significantly. The plib documentation does only talk about TRUE and FALSE for possible return values from the pre-traversal-callback. But src/ssgEntity.cxx reads like this: int ssgEntity::preTravTests ( int *test_needed, int which ) ... int result = (*preTravCB)(this,which) ; if ( result == 0 ) return FALSE ; if ( result == 2 ) *test_needed = 0 ; ... So the return value needs to be 2 to bypass the cull test for pretraversal, and get the pretraversal in any case. I only changed the return values in four animations: scale, rotate, translate, and range, because these are the most likely to move an object out of the frustum. It's not necessary for blend/alpha/texture manipulation etc. Of course, this is a bit more work for plib, but the performance will probably not be affected, because: * these four animations are mainly used for the aircraft model (the spin and billboard (trees!) animations are not affected) * the number of extra nodes to process is quite low * a part of the time spent for the extra nodes to be processed, was before used for workarounds that are now not necessary any more I didn't observe a frame rate drop, at least. --- diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index b17b1438..641331d1 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -293,7 +293,7 @@ SGRangeAnimation::update() ranges[1] = 1000000000.f; } ((ssgRangeSelector *)_branch)->setRanges(ranges, 2); - return 1; + return 2; } @@ -679,7 +679,7 @@ SGRotateAnimation::update() set_rotation(_matrix, _position_deg, _center, _axis); ((ssgTransform *)_branch)->setTransform(_matrix); } - return 1; + return 2; } @@ -781,7 +781,7 @@ SGTranslateAnimation::update() set_translation(_matrix, _position_m, _axis); ((ssgTransform *)_branch)->setTransform(_matrix); } - return 1; + return 2; } @@ -856,7 +856,7 @@ SGScaleAnimation::update() set_scale(_matrix, _x_scale, _y_scale, _z_scale ); ((ssgTransform *)_branch)->setTransform(_matrix); - return 1; + return 2; }