fixed out of bounds error in GenMeshTangents (#3990)

This commit is contained in:
Salvador Galindo
2024-05-21 04:47:26 -07:00
committed by GitHub
parent b2f4f4d8fd
commit c4a51a3ebd

View File

@@ -3431,7 +3431,7 @@ void GenMeshTangents(Mesh *mesh)
Vector3 *tan1 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3));
Vector3 *tan2 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3));
for (int i = 0; i < mesh->vertexCount; i += 3)
for (int i = 0; i < mesh->vertexCount - 3; i += 3)
{
// Get triangle vertices
Vector3 v1 = { mesh->vertices[(i + 0)*3 + 0], mesh->vertices[(i + 0)*3 + 1], mesh->vertices[(i + 0)*3 + 2] };