13 releases (breaking)

0.15.3 Aug 23, 2020
0.10.1 Aug 17, 2020
0.10.0 Mar 23, 2020
0.8.1 Oct 4, 2019
0.1.0 Dec 29, 2017

#38 in #amethyst

Download history 924/week @ 2024-03-13 1285/week @ 2024-03-20 1270/week @ 2024-03-27 1030/week @ 2024-04-03 984/week @ 2024-04-10 1209/week @ 2024-04-17 1288/week @ 2024-04-24 1062/week @ 2024-05-01 1091/week @ 2024-05-08 1048/week @ 2024-05-15 1119/week @ 2024-05-22 1235/week @ 2024-05-29 944/week @ 2024-06-05 782/week @ 2024-06-12 1005/week @ 2024-06-19 791/week @ 2024-06-26

3,722 downloads per month
Used in 10 crates (2 directly)

MIT/Apache

1MB
23K SLoC

This crate is used by the Amethyst game engine for animation.


lib.rs:

Provides computer graphics animation functionality.

Animation on a single entity comprises of one or more Samplers. Each sampler operates on a Channel. Thus, for a single entity, conceptually each (Channel, Sampler) pair is enough to define one part the animation, and a Vec<(Channel, Sampler)> defines the whole animation.

In a more complex situation, an object in game may be made up of multiple entities. Say you have a dragon monster, that is defined by a skinned mesh that has a skeleton with 10 joints. Each joint will then be an Entity. Our animation definition holds the samplers to run for the whole object. To animate each of the entities of this complex object, we need a way to link the sampler to the each of the entities.

Animation definitions are persistent and can be stored on disk. Entities however, are not. To link the right sampler to the right entity, when we construct each of the entities such as the joints, we track it with an index, called the node_index.

The following list might help to illustrate the scenario:

node index entity
0 body ("main" entity)
1 head
2 left left
3 right left
... ...

The node index to Entity mapping is stored in AnimationHierarchy.

Back to the animation definition, we also record the node_index in the tuple, which we call a "node". Each node is now (node_index, Channel, Sampler) (conceptually — in code the tuple holds references instead of the complete object). Hence, each node holds the information of what channel the sampler belongs to, and which entity it should be applied to.

So what happens for the nodes where we only have one entity? Right now Amethyst requires you to assign it node index 0.

Examples

The animation and gltf examples demonstrate usage of this crate.

Dependencies

~35–49MB
~708K SLoC