summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2023-10-31 11:32:07 +0100
committerRay <[email protected]>2023-10-31 11:32:07 +0100
commit0d186a0557a3c74d34ddce1daa7a66ae0fc1e699 (patch)
tree7b755e8436fa287b060b5255ef18177d00e0c264 /src
parentab61bad1687044b9ad1144692e8c6bdf6a129794 (diff)
downloadraylib-0d186a0557a3c74d34ddce1daa7a66ae0fc1e699.tar.gz
raylib-0d186a0557a3c74d34ddce1daa7a66ae0fc1e699.zip
REVIEWED: `LoadModel()`, removed cube fallback mechanism #3459
Diffstat (limited to 'src')
-rw-r--r--src/rmodels.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/rmodels.c b/src/rmodels.c
index 0a997f85..b0120932 100644
--- a/src/rmodels.c
+++ b/src/rmodels.c
@@ -1052,26 +1052,16 @@ Model LoadModel(const char *fileName)
// Make sure model transform is set to identity matrix!
model.transform = MatrixIdentity();
- if (model.meshCount == 0)
+ if ((model.meshCount != 0) && (model.meshes != NULL))
{
- model.meshCount = 1;
- model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh));
-#if defined(SUPPORT_MESH_GENERATION)
- TRACELOG(LOG_WARNING, "MESH: [%s] Failed to load mesh data, default to cube mesh", fileName);
- model.meshes[0] = GenMeshCube(1.0f, 1.0f, 1.0f);
-#else
- TRACELOG(LOG_WARNING, "MESH: [%s] Failed to load mesh data", fileName);
-#endif
- }
- else
- {
- // Upload vertex data to GPU (static mesh)
+ // Upload vertex data to GPU (static meshes)
for (int i = 0; i < model.meshCount; i++) UploadMesh(&model.meshes[i], false);
}
+ else TRACELOG(LOG_WARNING, "MESH: [%s] Failed to load model mesh(es) data", fileName);
if (model.materialCount == 0)
{
- TRACELOG(LOG_WARNING, "MATERIAL: [%s] Failed to load material data, default to white material", fileName);
+ TRACELOG(LOG_WARNING, "MATERIAL: [%s] Failed to load model material data, default to white material", fileName);
model.materialCount = 1;
model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material));