summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
author630Studios <[email protected]>2021-08-12 14:01:40 -0500
committerGitHub <[email protected]>2021-08-12 21:01:40 +0200
commit092435d51c7cbb94105d0b2b34156e0bf28d5980 (patch)
tree24d341d1cce3d8973eae243bde44ef35fe80078a /src
parent1dff5814be140a69de77b634f2d3e3ddac73243f (diff)
downloadraylib-092435d51c7cbb94105d0b2b34156e0bf28d5980.tar.gz
raylib-092435d51c7cbb94105d0b2b34156e0bf28d5980.zip
[Models] Fix for issue #1809 (#1917)
* GenMeshTangents Fix * GenMeshTangents Fix - Comment Update * GenMeshTangents Fix - Comment Update final * Code Style Changes * Code Style Changes Final * Code Style Changes Final 2 * GenMeshTangents better handling for issue #1876 * GenMeshTangents better handling for issue #1876 * GenMeshTangents: Better fix for issue #1876 * vboId location fix * rlUpdateVertexBuffer - bufferId is an unsigned int * Fix for issue#1809 - Obj with more materials then mesh caused crash * Fix for issue#1809 - Formatting Update
Diffstat (limited to 'src')
-rw-r--r--src/models.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/models.c b/src/models.c
index 329d8d4a..fd7daee6 100644
--- a/src/models.c
+++ b/src/models.c
@@ -3370,7 +3370,7 @@ static Model LoadOBJ(const char *fileName)
if (ret != TINYOBJ_SUCCESS) TRACELOG(LOG_WARNING, "MODEL: [%s] Failed to load OBJ data", fileName);
else TRACELOG(LOG_INFO, "MODEL: [%s] OBJ data loaded successfully: %i meshes/%i materials", fileName, meshCount, materialCount);
- model.meshCount = materialCount; // TODO: REVIEW!!!
+ model.meshCount = materialCount;
// Init model materials array
if (materialCount > 0)
@@ -3389,7 +3389,7 @@ static Model LoadOBJ(const char *fileName)
model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int));
// Count the faces for each material
- int *matFaces = RL_CALLOC(meshCount, sizeof(int));
+ int *matFaces = RL_CALLOC(materialCount, sizeof(int));
for (unsigned int mi = 0; mi < meshCount; mi++)
{
@@ -3400,7 +3400,6 @@ static Model LoadOBJ(const char *fileName)
matFaces[idx]++;
}
}
-
//--------------------------------------
// Create the material meshes