minor doc cleanup and improvements
This commit is contained in:
parent
e336922caa
commit
d222955ac3
|
|
@ -3834,6 +3834,9 @@ static void BuildPoseFromParentJoints(BoneInfo *bones, int boneCount, Transform
|
||||||
{
|
{
|
||||||
if (bones[i].parent >= 0)
|
if (bones[i].parent >= 0)
|
||||||
{
|
{
|
||||||
|
// Assumes bones are topologically sorted and we've transformed
|
||||||
|
// the parent before this node.
|
||||||
|
assert(bones[i].parent < i);
|
||||||
transforms[i].rotation = QuaternionMultiply(transforms[bones[i].parent].rotation, transforms[i].rotation);
|
transforms[i].rotation = QuaternionMultiply(transforms[bones[i].parent].rotation, transforms[i].rotation);
|
||||||
transforms[i].translation = Vector3RotateByQuaternion(transforms[i].translation, transforms[bones[i].parent].rotation);
|
transforms[i].translation = Vector3RotateByQuaternion(transforms[i].translation, transforms[bones[i].parent].rotation);
|
||||||
transforms[i].translation = Vector3Add(transforms[i].translation, transforms[bones[i].parent].translation);
|
transforms[i].translation = Vector3Add(transforms[i].translation, transforms[bones[i].parent].translation);
|
||||||
|
|
@ -4720,6 +4723,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
- Supports PBR metallic/roughness flow, loads material textures, values and colors
|
- Supports PBR metallic/roughness flow, loads material textures, values and colors
|
||||||
PBR specular/glossiness flow and extended texture flows not supported
|
PBR specular/glossiness flow and extended texture flows not supported
|
||||||
- Supports multiple meshes per model (every primitives is loaded as a separate mesh)
|
- Supports multiple meshes per model (every primitives is loaded as a separate mesh)
|
||||||
|
- Supports basic animation
|
||||||
|
|
||||||
RESTRICTIONS:
|
RESTRICTIONS:
|
||||||
- Only triangle meshes supported
|
- Only triangle meshes supported
|
||||||
|
|
@ -5064,15 +5068,12 @@ static Model LoadGLTF(const char *fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Load glTF meshes animation data
|
// Load glTF meshes animation data
|
||||||
// REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skins
|
// REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skins
|
||||||
// REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skinned-mesh-attributes
|
// REF: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#skinned-mesh-attributes
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
if(data->skins_count > 0) {
|
if(data->skins_count == 1) {
|
||||||
if(data->skins_count != 1) {
|
|
||||||
TRACELOG(LOG_ERROR, "MODEL: [%s] can only load one skin (armature) per model, but gltf skins_count == %i", fileName, data->skins_count);
|
|
||||||
} else {
|
|
||||||
cgltf_skin skin = data->skins[0];
|
cgltf_skin skin = data->skins[0];
|
||||||
model.bones = LoadGLTFBoneInfo(skin, &model.boneCount);
|
model.bones = LoadGLTFBoneInfo(skin, &model.boneCount);
|
||||||
model.bindPose = RL_MALLOC(model.boneCount * sizeof(Transform));
|
model.bindPose = RL_MALLOC(model.boneCount * sizeof(Transform));
|
||||||
|
|
@ -5094,7 +5095,8 @@ static Model LoadGLTF(const char *fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildPoseFromParentJoints(model.bones, model.boneCount, model.bindPose);
|
BuildPoseFromParentJoints(model.bones, model.boneCount, model.bindPose);
|
||||||
}
|
} else if(data->skins_count > 1) {
|
||||||
|
TRACELOG(LOG_ERROR, "MODEL: [%s] can only load one skin (armature) per model, but gltf skins_count == %i", fileName, data->skins_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0, meshIndex = 0; i < data->meshes_count; i++)
|
for (unsigned int i = 0, meshIndex = 0; i < data->meshes_count; i++)
|
||||||
|
|
@ -5270,6 +5272,8 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, unsigned in
|
||||||
boneChannels[boneIndex].rotate = &animData.channels[j];
|
boneChannels[boneIndex].rotate = &animData.channels[j];
|
||||||
} else if(channel.target_path == cgltf_animation_path_type_scale) {
|
} else if(channel.target_path == cgltf_animation_path_type_scale) {
|
||||||
boneChannels[boneIndex].scale = &animData.channels[j];
|
boneChannels[boneIndex].scale = &animData.channels[j];
|
||||||
|
} else {
|
||||||
|
TRACELOG(LOG_WARNING, "MODEL: [%s] Unsupported target_path on channel %d's sampler for animation %d. Skipping.", fileName, j, i);
|
||||||
}
|
}
|
||||||
} else TRACELOG(LOG_WARNING, "MODEL: [%s] Only linear interpolation curves are supported for GLTF animation.", fileName);
|
} else TRACELOG(LOG_WARNING, "MODEL: [%s] Only linear interpolation curves are supported for GLTF animation.", fileName);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user