diff --git a/src/models.c b/src/models.c index 09cd431ce..1936b39dd 100644 --- a/src/models.c +++ b/src/models.c @@ -844,7 +844,8 @@ void UploadMesh(Mesh *mesh, bool dynamic) // NOTE: Attributes must be uploaded considering default locations points // Enable vertex attributes: position (shader-location = 0) - mesh->vboId[0] = rlLoadVertexBuffer(mesh->vertices, mesh->vertexCount*3*sizeof(float), dynamic); + void* vertices = mesh->animVertices != NULL ? mesh->animVertices : mesh->vertices; + mesh->vboId[0] = rlLoadVertexBuffer(vertices, mesh->vertexCount*3*sizeof(float), dynamic); rlSetVertexAttribute(0, 3, RL_FLOAT, 0, 0, 0); rlEnableVertexAttribute(0); @@ -856,7 +857,8 @@ void UploadMesh(Mesh *mesh, bool dynamic) if (mesh->normals != NULL) { // Enable vertex attributes: normals (shader-location = 2) - mesh->vboId[2] = rlLoadVertexBuffer(mesh->normals, mesh->vertexCount*3*sizeof(float), dynamic); + void* normals = mesh->animNormals != NULL ? mesh->animNormals : mesh->vertices; + mesh->vboId[2] = rlLoadVertexBuffer(normals, mesh->vertexCount*3*sizeof(float), dynamic); rlSetVertexAttribute(2, 3, RL_FLOAT, 0, 0, 0); rlEnableVertexAttribute(2); }