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) { Â Â Â Â Â Â Â Â Â ...