Animate distant LOD actors at the original reduced animation FPS
Port CGrannyLODController::UpdateLODLevel and CGrannyModelInstance::Update(dwAniFPS): actors whose model has a _lod_01.gr2 sibling and stand more than 500 units from the camera target get 30-120 animation FPS by camera distance (LODDISTANCE_ACTOR 5000, LODDISTANCE_BUILDING 25000 for models of 500+ units), and their pose time only advances every 120/fps frames, so the SDK's cached pose is reused in between. Restarted or switched motions re-sample at once. The _lod_ meshes themselves are still not swapped in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
696f4f62e6
commit
b2c7c6ce7d
@@ -828,6 +828,30 @@ int main(int argc, char** argv) {
|
||||
const auto poseBeforeCull = actor.GetModel()->GetImpl()->GetPoseEvaluationCount();
|
||||
assert(!actor.IsVisible(cullCamera.GetViewMatrix(),cullCamera.GetProjMatrix()));
|
||||
assert(actor.GetModel()->GetImpl()->GetPoseEvaluationCount()==poseBeforeCull);
|
||||
|
||||
// CGrannyLODController: warrior_assasin1 has _lod_ models, so far from the camera it animates at
|
||||
// ANIFPS_MIN (pose re-sampled every 4/120 s) and near the camera target at full rate.
|
||||
actor.SetPosition(0,0,0);
|
||||
actor.UpdateLODLevel(0,200,-300,0,0);
|
||||
assert(actor.GetLODAniFPS()==120);
|
||||
actor.UpdateLODLevel(0,200,-4900,2000,0);
|
||||
assert(actor.GetLODAniFPS()==30);
|
||||
float lodBone[16];
|
||||
assert(actor.GetBoneWorldTransform("Bip01 Spine",lodBone));
|
||||
const auto poseBeforeLod=actor.GetModel()->GetImpl()->GetPoseEvaluationCount();
|
||||
for(int frame=0;frame<24;++frame){
|
||||
actor.Update(1.0f/60.0f,&terrain);
|
||||
actor.UpdateLODLevel(0,200,-4900,2000,0);
|
||||
assert(actor.GetBoneWorldTransform("Bip01 Spine",lodBone));
|
||||
}
|
||||
const auto farEvaluations=actor.GetModel()->GetImpl()->GetPoseEvaluationCount()-poseBeforeLod;
|
||||
assert(farEvaluations>=10 && farEvaluations<=14 && "30 FPS animation over 0.4 s");
|
||||
for(int frame=0;frame<24;++frame){
|
||||
actor.Update(1.0f/60.0f,&terrain);
|
||||
actor.UpdateLODLevel(0,200,-300,0,0);
|
||||
assert(actor.GetBoneWorldTransform("Bip01 Spine",lodBone));
|
||||
}
|
||||
assert(actor.GetModel()->GetImpl()->GetPoseEvaluationCount()-poseBeforeLod-farEvaluations==24);
|
||||
assert(actor.IsVisible(nullptr,nullptr));
|
||||
|
||||
// Test movement driving
|
||||
|
||||
Reference in New Issue
Block a user