| 83 | } |
| 84 | |
| 85 | void AnimationsSystem::Job(int32 index) |
| 86 | { |
| 87 | PROFILE_CPU_NAMED("Animations.Job"); |
| 88 | PROFILE_MEM(Animations); |
| 89 | auto animatedModel = AnimationManagerInstance.UpdateList[index]; |
| 90 | if (CanUpdateModel(animatedModel)) |
| 91 | { |
| 92 | auto graph = animatedModel->AnimationGraph.Get(); |
| 93 | #if COMPILE_WITH_PROFILER && TRACY_ENABLE |
| 94 | const StringView graphName(graph->GetPath()); |
| 95 | ZoneName(*graphName, graphName.Length()); |
| 96 | #endif |
| 97 | |
| 98 | // Prepare skinning data |
| 99 | animatedModel->SetupSkinningData(); |
| 100 | |
| 101 | // Animation delta time can be based on a time since last update or the current delta |
| 102 | float dt = animatedModel->UseTimeScale ? DeltaTime : UnscaledDeltaTime; |
| 103 | float t = animatedModel->UseTimeScale ? Time : UnscaledTime; |
| 104 | const float lastUpdateTime = animatedModel->GraphInstance.LastUpdateTime; |
| 105 | if (lastUpdateTime > 0 && t > lastUpdateTime) |
| 106 | { |
| 107 | dt = t - lastUpdateTime; |
| 108 | } |
| 109 | dt *= animatedModel->UpdateSpeed; |
| 110 | animatedModel->GraphInstance.LastUpdateTime = t; |
| 111 | |
| 112 | // Evaluate animated nodes pose |
| 113 | graph->GraphExecutor.Update(animatedModel->GraphInstance, dt); |
| 114 | |
| 115 | // Update gameplay |
| 116 | animatedModel->OnAnimationUpdated_Async(); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | void AnimationsSystem::Execute(TaskGraph* graph) |
| 121 | { |
nothing calls this directly
no test coverage detected