From 47313dd601a9a4b76fdc23467f38138006102c35 Mon Sep 17 00:00:00 2001 From: Hristo Stamenov Date: Sat, 13 Mar 2021 20:33:34 +0200 Subject: [PATCH] Split GLTF model loading into separate functions for readability. --- src/models.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/models.c b/src/models.c index 1f9e166d2..959cfc97e 100644 --- a/src/models.c +++ b/src/models.c @@ -3769,10 +3769,10 @@ static Model LoadGLTF(const char *fileName) } else if (acc->component_type == cgltf_component_type_r_32u) { - unsigned int readValue[3]; + int readValue[3]; for(int a = 0; a < acc->count; a++) { - GLTFReadValue(acc, a, readValue, 3, sizeof(unsigned int)); + GLTFReadValue(acc, a, readValue, 3, sizeof(int)); model.meshes[primitiveIndex].vertices[(a * 3) + 0] = readValue[0]; model.meshes[primitiveIndex].vertices[(a * 3) + 1] = readValue[1]; model.meshes[primitiveIndex].vertices[(a * 3) + 2] = readValue[2]; @@ -3803,10 +3803,10 @@ static Model LoadGLTF(const char *fileName) } else if (acc->component_type == cgltf_component_type_r_32u) { - unsigned int readValue[3]; + int readValue[3]; for(int a = 0; a < acc->count; a++) { - GLTFReadValue(acc, a, readValue, 3, sizeof(unsigned int)); + GLTFReadValue(acc, a, readValue, 3, sizeof(int)); model.meshes[primitiveIndex].normals[(a * 3) + 0] = readValue[0]; model.meshes[primitiveIndex].normals[(a * 3) + 1] = readValue[1]; model.meshes[primitiveIndex].normals[(a * 3) + 2] = readValue[2]; @@ -3889,14 +3889,14 @@ static Model LoadGLTF(const char *fileName) { model.meshMaterial[primitiveIndex] = model.materialCount - 1; } - + BindGLTFPrimitivePose(&model, data, primitiveIndex); primitiveIndex++; } - + } - + cgltf_free(data); } else TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to load glTF data", fileName);