Update rmodels.c segfault with animation and missing normals/animnormals
This commit is contained in:
parent
130fb2a993
commit
970bb6e8bb
|
|
@ -2380,7 +2380,7 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
|
||||||
|
|
||||||
// Normals processing
|
// Normals processing
|
||||||
// NOTE: We use meshes.baseNormals (default normal) to calculate meshes.normals (animated normals)
|
// NOTE: We use meshes.baseNormals (default normal) to calculate meshes.normals (animated normals)
|
||||||
if (mesh.normals != NULL)
|
if ((mesh.normals != NULL) && (mesh.animNormals != NULL ))
|
||||||
{
|
{
|
||||||
animNormal = (Vector3){ mesh.normals[vCounter], mesh.normals[vCounter + 1], mesh.normals[vCounter + 2] };
|
animNormal = (Vector3){ mesh.normals[vCounter], mesh.normals[vCounter + 1], mesh.normals[vCounter + 2] };
|
||||||
animNormal = Vector3Transform(animNormal,model.meshes[m].boneMatrices[boneId]);
|
animNormal = Vector3Transform(animNormal,model.meshes[m].boneMatrices[boneId]);
|
||||||
|
|
@ -2394,6 +2394,7 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
|
||||||
if (updated)
|
if (updated)
|
||||||
{
|
{
|
||||||
rlUpdateVertexBuffer(mesh.vboId[0], mesh.animVertices, mesh.vertexCount*3*sizeof(float), 0); // Update vertex position
|
rlUpdateVertexBuffer(mesh.vboId[0], mesh.animVertices, mesh.vertexCount*3*sizeof(float), 0); // Update vertex position
|
||||||
|
if (mesh.normals != NULL)
|
||||||
rlUpdateVertexBuffer(mesh.vboId[2], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0); // Update vertex normals
|
rlUpdateVertexBuffer(mesh.vboId[2], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0); // Update vertex normals
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user