early exit LoadModelAnimationsGLTF if the gtlf file fails to parse
This commit is contained in:
parent
2189692f94
commit
4aa5796993
|
|
@ -35,6 +35,9 @@ int main(void)
|
|||
|
||||
// Loaf gltf model
|
||||
Model model = LoadModel("resources/models/gltf/robot.glb");
|
||||
unsigned int animationCount;
|
||||
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/robot.glb", &animationCount);
|
||||
ModelAnimation anim = modelAnimations[0];
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
|
|
@ -49,6 +52,7 @@ int main(void)
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
UpdateModelAnimation(model, anim, 2);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
|
|
|||
|
|
@ -5222,6 +5222,11 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, unsigned in
|
|||
cgltf_options options = { 0 };
|
||||
cgltf_data *data = NULL;
|
||||
cgltf_result result = cgltf_parse(&options, fileData, dataSize, &data);
|
||||
if(result != cgltf_result_success) {
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to load glTF data", fileName);
|
||||
*animCount = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = cgltf_load_buffers(&options, data, fileName);
|
||||
if (result != cgltf_result_success) TRACELOG(LOG_INFO, "MODEL: [%s] Failed to load animation buffers", fileName);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user