Pouring the knowledge into C++ classes
We will split the code for the animations into two separate classes to follow the structure of the glTF file format. In a glTF file, the animation clips and the animation channels are stored in different elements because one animation clip uses data from multiple animation channels.
The first class, named GltfAnimationChannel
, will contain the data of a glTF animation channel. We will store all data of a single channels
entry and the corresponding samplers
entry in this class: the time points from the input
buffer, the new data for the target node from the output
buffer, the interpolation type from the sampler, plus the target path and the target node from the channel definition.
The second class, GltfAnimationClip
, manages the animation clips and uses the GltfAnimationChannel
class to store the animation channel data per clip.
Storing the channel data in a class
We start the animation channel class, GltfAnimationChannel
, with the...