Advanced all clips and updates animated properties in the scene.
56 {
57 if (!previous_time_.has_value()) {
58 previous_time_ = Clock::now();
59 }
60 auto new_time = Clock::now();
61 auto delta_time = new_time - previous_time_.value();
62 previous_time_ = new_time;
63
64
65 for (auto& [node, transforms] : target_transforms_) {
66 transforms.animated_pose = transforms.bind_pose;
67 }
68
69
71 for (
auto& [_,
clip] : clips_) {
72 total_weight +=
clip.GetWeight();
73 }
74 Scalar weight_multiplier = total_weight > 1 ? 1 / total_weight : 1;
75
76
77 for (
auto& [_,
clip] : clips_) {
78 clip.Advance(delta_time);
79 clip.ApplyToBindings(target_transforms_, weight_multiplier);
80 }
81
82
83 for (auto& [node, transforms] : target_transforms_) {
84 node->SetLocalTransform(Matrix(transforms.animated_pose));
85 }
86}