Browse Source

[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
pull/1919/head
630Studios 3 years ago
committed by GitHub
parent
commit
092435d51c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      src/models.c

+ 2
- 3
src/models.c View File

@ -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

Loading…
Cancel
Save