Cross posting from stack overflow:
Reading the source code of tinygltf I see this:
struct Skin {
std::string name;
int inverseBindMatrices; // required here but not in the spec
int skeleton; // The index of the node used as a skeleton root
std::vector<int> joints; // Indices of skeleton nodes
Value extras;
ExtensionMap extensions;
// Filled when SetStoreOriginalJSONForExtrasAndExtensions is enabled.
std::string extras_json_string;
std::string extensions_json_string;
Skin() {
inverseBindMatrices = -1;
skeleton = -1;
}
DEFAULT_METHODS(Skin)
bool operator==(const Skin &) const;
};
That would made you assume that the skeleton value is mandatory. However, on the gltf simple skin example json, I see the following:
"skins" : [ {
"inverseBindMatrices" : 4,
"joints" : [ 1, 2 ]
} ],
That's the full extent of the skins
array. So it seems it is perfectly possible for a skin not to specify which one is the root node of its skeleton. In that case, which node in the joints array should I treat at the parent? Can I safely assume it is the first element of the joints
list?