Fix identation issues
This commit is contained in:
parent
2b02adcefa
commit
e9c0cbd9dc
86
src/models.c
86
src/models.c
|
|
@ -3782,7 +3782,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
int primitivesCount = 0;
|
int primitivesCount = 0;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < data->meshes_count; i++)
|
for (unsigned int i = 0; i < data->meshes_count; i++)
|
||||||
primitivesCount += (int)data->meshes[i].primitives_count;
|
primitivesCount += (int)data->meshes[i].primitives_count;
|
||||||
|
|
||||||
// Process glTF data and map to model
|
// Process glTF data and map to model
|
||||||
model.meshCount = primitivesCount;
|
model.meshCount = primitivesCount;
|
||||||
|
|
@ -3795,7 +3795,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
model.bindPose = RL_CALLOC(model.boneCount, sizeof(Transform));
|
model.bindPose = RL_CALLOC(model.boneCount, sizeof(Transform));
|
||||||
|
|
||||||
for (int i = 0; i < model.meshCount; i++)
|
for (int i = 0; i < model.meshCount; i++)
|
||||||
model.meshes[i].vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int));
|
model.meshes[i].vboId = (unsigned int *)RL_CALLOC(DEFAULT_MESH_VERTEX_BUFFERS, sizeof(unsigned int));
|
||||||
|
|
||||||
for (unsigned int j = 0; j < data->nodes_count; j++)
|
for (unsigned int j = 0; j < data->nodes_count; j++)
|
||||||
{
|
{
|
||||||
|
|
@ -3803,51 +3803,51 @@ static Model LoadGLTF(const char *fileName)
|
||||||
model.bones[j].parent = j != 0 ? data->nodes[j].parent - data->nodes : 0;
|
model.bones[j].parent = j != 0 ? data->nodes[j].parent - data->nodes : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < data->nodes_count; i++)
|
for (unsigned int i = 0; i < data->nodes_count; i++)
|
||||||
{
|
{
|
||||||
if(data->nodes[i].has_translation)
|
if(data->nodes[i].has_translation)
|
||||||
{
|
{
|
||||||
memcpy(&model.bindPose[i].translation, data->nodes[i].translation, 3 * sizeof(float));
|
memcpy(&model.bindPose[i].translation, data->nodes[i].translation, 3 * sizeof(float));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
model.bindPose[i].translation = Vector3Zero();
|
model.bindPose[i].translation = Vector3Zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data->nodes[i].has_rotation)
|
if(data->nodes[i].has_rotation)
|
||||||
{
|
{
|
||||||
memcpy(&model.bindPose[i].rotation, data->nodes[i].rotation, 4 * sizeof(float));
|
memcpy(&model.bindPose[i].rotation, data->nodes[i].rotation, 4 * sizeof(float));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
model.bindPose[i].rotation = QuaternionIdentity();
|
model.bindPose[i].rotation = QuaternionIdentity();
|
||||||
}
|
}
|
||||||
model.bindPose[i].rotation = QuaternionNormalize(model.bindPose[i].rotation);
|
model.bindPose[i].rotation = QuaternionNormalize(model.bindPose[i].rotation);
|
||||||
|
|
||||||
if(data->nodes[i].has_scale)
|
if(data->nodes[i].has_scale)
|
||||||
{
|
{
|
||||||
memcpy(&model.bindPose[i].scale, data->nodes[i].scale, 3 * sizeof(float));
|
memcpy(&model.bindPose[i].scale, data->nodes[i].scale, 3 * sizeof(float));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
model.bindPose[i].scale = Vector3One();
|
model.bindPose[i].scale = Vector3One();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < model.boneCount; i++)
|
for (int i = 0; i < model.boneCount; i++)
|
||||||
{
|
{
|
||||||
Transform* currentTransform = model.bindPose + i;
|
Transform* currentTransform = model.bindPose + i;
|
||||||
BoneInfo* currentBone = model.bones + i;
|
BoneInfo* currentBone = model.bones + i;
|
||||||
Transform* parentTransform = model.bindPose + currentBone->parent;
|
Transform* parentTransform = model.bindPose + currentBone->parent;
|
||||||
|
|
||||||
if (currentBone->parent >= 0)
|
if (currentBone->parent >= 0)
|
||||||
{
|
{
|
||||||
currentTransform->rotation = QuaternionMultiply(parentTransform->rotation, currentTransform->rotation);
|
currentTransform->rotation = QuaternionMultiply(parentTransform->rotation, currentTransform->rotation);
|
||||||
currentTransform->translation = Vector3RotateByQuaternion(currentTransform->translation, parentTransform->rotation);
|
currentTransform->translation = Vector3RotateByQuaternion(currentTransform->translation, parentTransform->rotation);
|
||||||
currentTransform->translation = Vector3Add(currentTransform->translation, parentTransform->translation);
|
currentTransform->translation = Vector3Add(currentTransform->translation, parentTransform->translation);
|
||||||
currentTransform->scale = Vector3Multiply(parentTransform->scale, parentTransform->scale);
|
currentTransform->scale = Vector3Multiply(parentTransform->scale, parentTransform->scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < model.materialCount - 1; i++)
|
for (int i = 0; i < model.materialCount - 1; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user