Samples - Animations set browsing
View browse sample source code.
Description
List animations and lets user browsing through and preview all animations.
Concept
This sample lists all animations from set and allows to select which animation to playback.
It is based on skinning sample for the most part.
It loads a skeleton, an animation and skinned meshes from ozz binary archives. It playbacks animation every frame and uses model-space matrices to build skinning matrices and render a skinned mesh.
Sample usage
The sample UI exposes:
- A list of animations grouped by name prefix, with buttons to select the next animation or pick any animation from a group.
- Playback controls (play/pause, scrub time, speed) via the built-in playback controller.
- Rendering toggles:
- Draw skeleton.
- Draw mesh.
- Show triangles, texture, vertices, normals, tangents, binormals, colors.
- Wireframe.
- Skip skinning.
Implementation
- Load the skeleton archive.
- Read the animations list file and build a sorted list of animation archive filenames.
- Randomly pick an animation at startup and load it from
media/<animation_name>.
- Allocate runtime buffers.
- Every frame:
- Update animation time using the playback controller.
- Sample the current animation with
ozz::animation::SamplingJob.
- Convert local-space transforms to model-space using
ozz::animation::LocalToModelJob.
- Update skinning matrices and render the skeleton/mesh.