Pārlūkot izejas kodu

check to make sure parent bone is not null before trying to compute its offset from the root (#1594)

pull/1595/head
Jeffery Myers pirms 4 gadiem
committed by GitHub
vecāks
revīzija
0f5aab3a1c
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. +5
    -2
      src/models.c

+ 5
- 2
src/models.c Parādīt failu

@ -3733,7 +3733,7 @@ static Model LoadGLTF(const char *fileName)
for (unsigned int j = 0; j < data->nodes_count; j++)
{
strcpy(model.bones[j].name, data->nodes[j].name == 0 ? "ANIMJOINT" : data->nodes[j].name);
model.bones[j].parent = j != 0 ? data->nodes[j].parent - data->nodes : 0;
model.bones[j].parent = p">(j != 0 && data->nodes[j].parent != NULL) ? data->nodes[j].parent - data->nodes : 0;
}
for (unsigned int i = 0; i < data->nodes_count; i++)
@ -3771,7 +3771,10 @@ static Model LoadGLTF(const char *fileName)
{
Transform* currentTransform = model.bindPose + i;
BoneInfo* currentBone = model.bones + i;
Transform* parentTransform = model.bindPose + currentBone->parent;
int root = currentBone->parent;
if (root >= model.boneCount)
root = 0;
Transform* parentTransform = model.bindPose + root;
if (currentBone->parent >= 0)
{

Notiek ielāde…
Atcelt
Saglabāt