glTF – loading joint names
At some point, you might want to know the name assigned to each joint that is loaded. This can help make debugging or building tools easier. To load the names of every joint in the same order that you loaded the joints for the rest pose in, loop through the joints and use the name accessor.
Implement the LoadJointNames
function in GLTFLoader.cpp
. Don't forget to add the function declaration to GLTFLoader.h
:
std::vector<std::string> LoadJointNames(cgltf_data* data) { unsigned int boneCount = (unsigned int)data->nodes_count; std::vector<std::string> result(boneCount, "Not Set"); for (unsigned int i = 0; i < boneCount; ++i) { cgltf_node* node = &(data->nodes[i]); if (node->name == 0) { ...