Преглед на файлове

Merge pull request #5015 from Sir-Irk/gltf_model_fix

[rmodels] Fixing offset for processing tangents for GLTF/GLB loading
pull/5018/head
Ray преди 1 седмица
committed by GitHub
родител
ревизия
7f32b9a964
No known key found for this signature in database GPG ключ ID: B5690EEEBB952194
променени са 1 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. +5
    -5
      src/rmodels.c

+ 5
- 5
src/rmodels.c Целия файл

@ -5577,7 +5577,7 @@ static Model LoadGLTF(const char *fileName)
}
else TRACELOG(LOG_WARNING, "MODEL: [%s] Normal attribute data format not supported, use vec3 float", fileName);
}
else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_tangent) // TANGENT, vec3, float
else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_tangent) // TANGENT, vec4, float, w is tangent basis sign
{
cgltf_accessor *attribute = mesh->primitives[p].attributes[j].data;
@ -5593,10 +5593,10 @@ static Model LoadGLTF(const char *fileName)
float *tangents = model.meshes[meshIndex].tangents;
for (unsigned int k = 0; k < attribute->count; k++)
{
Vector3 tt = Vector3Transform((Vector3){ tangents[3*k], tangents[3*k+1], tangents[3*k+2] }, worldMatrix);
tangents[3*k] = tt.x;
tangents[3*k+1] = tt.y;
tangents[3*k+2] = tt.z;
Vector3 tt = Vector3Transform((Vector3){ tangents[4*k], tangents[4*k+1], tangents[4*k+2] }, worldMatrix);
tangents[4*k] = tt.x;
tangents[4*k+1] = tt.y;
tangents[4*k+2] = tt.z;
}
}
else TRACELOG(LOG_WARNING, "MODEL: [%s] Tangent attribute data format not supported, use vec4 float", fileName);

Зареждане…
Отказ
Запис