glTF – loading the rest pose
In this book, we will assume that a glTF file only contains one animated character. It's safe to assume that the entire hierarchy of the glTF file can be treated as the skeleton of the model. This makes loading the rest pose easy as the rest pose becomes the hierarchy in its initial configuration.
Before loading the rest pose, you need to create several helper functions. These functions are internal to the glTF loader and should not be exposed in the header file. Create a new namespace in GLTFLoader.cpp
and call it GLTFHelpers
. All the helper functions are created in this namespace.
Follow these steps to implement the helper functions that are needed to load the rest pose from a glTF file:
- First, implement a helper function to get the local transform of
cgltf_node
. A node can store its transform either as a matrix or as a separate position, rotation, and scale components. If the node stores its transformation as a matrix, use the...