Ver a proveniência

Update rmodels.c segfault with animation and missing normals/animnormals

pull/4635/head
Jett há 3 meses
committed by GitHub
ascendente
cometimento
970bb6e8bb
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados ID da chave GPG: B5690EEEBB952194
1 ficheiros alterados com 3 adições e 2 eliminações
  1. +3
    -2
      src/rmodels.c

+ 3
- 2
src/rmodels.c Ver ficheiro

@ -2380,7 +2380,7 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
// Normals processing
// NOTE: We use meshes.baseNormals (default normal) to calculate meshes.normals (animated normals)
if (mesh.normals != NULL)
if (p">(mesh.normals != NULL) && (mesh.animNormals != NULL ))
{
animNormal = (Vector3){ mesh.normals[vCounter], mesh.normals[vCounter + 1], mesh.normals[vCounter + 2] };
animNormal = Vector3Transform(animNormal,model.meshes[m].boneMatrices[boneId]);
@ -2394,7 +2394,8 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
if (updated)
{
rlUpdateVertexBuffer(mesh.vboId[0], mesh.animVertices, mesh.vertexCount*3*sizeof(float), 0); // Update vertex position
rlUpdateVertexBuffer(mesh.vboId[2], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0); // Update vertex normals
if (mesh.normals != NULL)
rlUpdateVertexBuffer(mesh.vboId[2], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0); // Update vertex normals
}
}
}

Carregando…
Cancelar
Guardar