浏览代码

Reviewed formating, removed assert() #4635

pull/4638/head
Ray 4 个月前
父节点
当前提交
ae3c0df206
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. +5
    -6
      src/rmodels.c

+ 5
- 6
src/rmodels.c 查看文件

@ -2277,7 +2277,6 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
{ {
if (model.meshes[i].boneMatrices) if (model.meshes[i].boneMatrices)
{ {
assert(model.meshes[i].boneCount == anim.boneCount);
if (firstMeshWithBones == -1) if (firstMeshWithBones == -1)
{ {
firstMeshWithBones = i; firstMeshWithBones = i;
@ -2286,7 +2285,6 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
} }
} }
// Update all bones and boneMatrices of first mesh with bones. // Update all bones and boneMatrices of first mesh with bones.
for (int boneId = 0; boneId < anim.boneCount; boneId++) for (int boneId = 0; boneId < anim.boneCount; boneId++)
{ {
@ -2351,7 +2349,8 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
bool updated = false; // Flag to check when anim vertex information is updated bool updated = false; // Flag to check when anim vertex information is updated
const int vValues = mesh.vertexCount*3; const int vValues = mesh.vertexCount*3;
if ((mesh.boneWeights==NULL) || (mesh.boneIds==NULL)) continue; // skip if missing bone data, causes segfault without on some models
// Skip if missing bone data, causes segfault without on some models
if ((mesh.boneWeights == NULL) || (mesh.boneIds == NULL)) continue;
for (int vCounter = 0; vCounter < vValues; vCounter += 3) for (int vCounter = 0; vCounter < vValues; vCounter += 3)
{ {
@ -2364,7 +2363,8 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
mesh.animNormals[vCounter + 1] = 0; mesh.animNormals[vCounter + 1] = 0;
mesh.animNormals[vCounter + 2] = 0; mesh.animNormals[vCounter + 2] = 0;
} }
// Iterates over 4 bones per vertex
// Iterates over 4 bones per vertex
for (int j = 0; j < 4; j++, boneCounter++) for (int j = 0; j < 4; j++, boneCounter++)
{ {
boneWeight = mesh.boneWeights[boneCounter]; boneWeight = mesh.boneWeights[boneCounter];
@ -2395,8 +2395,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
if (mesh.normals != NULL) rlUpdateVertexBuffer(mesh.vboId[2], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0); // Update vertex normals
} }
} }
} }

正在加载...
取消
保存