Skip to content

Commit

Permalink
Improves documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeblanc committed May 28, 2024
1 parent c23ae12 commit 9b40225
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions samples/motion_blend/sample_motion_blend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,28 @@ class MotionBlendSampleApplication : public ozz::sample::Application {
// Blends motion.
//-------------------------------------------------------------------------
{
// Fills job layers with delta transforms and weights.
ozz::animation::MotionBlendingJob::Layer layers[kNumLayers];
for (size_t i = 0; i < kNumLayers; ++i) {
const auto& sampler = samplers_[i];
layers[i].delta = &sampler.motion_sampler.delta;
layers[i].weight = sampler.weight;
layers[i].delta =
&sampler.motion_sampler.delta; // Uses delta transform from motion
// sampler accumulator.
layers[i].weight = sampler.weight; // Reuses animation weight.
}

// Setup blending job.
ozz::math::Transform delta;
ozz::animation::MotionBlendingJob motion_blend_job;
motion_blend_job.layers = layers;
motion_blend_job.output = &delta;

// Blends.
// Executes blending job.
if (!motion_blend_job.Run()) {
return false;
}

// Applies blended delta to the character accumulator.
const auto rotation = FrameRotation(_dt);
accumulator_.Update(delta, rotation);
}
Expand Down

0 comments on commit 9b40225

Please sign in to comment.