CalcTangents: zero vector is invalid for tangent/bitangent (#5432)
* CalcTangents: zero vector is invalid for tangent/bitangentpull/5414/head^2
parent
571ba09dc7
commit
c55158cd82
|
@ -200,8 +200,10 @@ bool CalcTangentsProcess::ProcessMesh(aiMesh *pMesh, unsigned int meshIndex) {
|
||||||
localBitangent.NormalizeSafe();
|
localBitangent.NormalizeSafe();
|
||||||
|
|
||||||
// reconstruct tangent/bitangent according to normal and bitangent/tangent when it's infinite or NaN.
|
// reconstruct tangent/bitangent according to normal and bitangent/tangent when it's infinite or NaN.
|
||||||
bool invalid_tangent = is_special_float(localTangent.x) || is_special_float(localTangent.y) || is_special_float(localTangent.z);
|
bool invalid_tangent = is_special_float(localTangent.x) || is_special_float(localTangent.y) || is_special_float(localTangent.z)
|
||||||
bool invalid_bitangent = is_special_float(localBitangent.x) || is_special_float(localBitangent.y) || is_special_float(localBitangent.z);
|
|| (-0.5f < localTangent.x && localTangent.x < 0.5f && -0.5f < localTangent.y && localTangent.y < 0.5f && -0.5f < localTangent.z && localTangent.z < 0.5f);
|
||||||
|
bool invalid_bitangent = is_special_float(localBitangent.x) || is_special_float(localBitangent.y) || is_special_float(localBitangent.z)
|
||||||
|
|| (-0.5f < localBitangent.x && localBitangent.x < 0.5f && -0.5f < localBitangent.y && localBitangent.y < 0.5f && -0.5f < localBitangent.z && localBitangent.z < 0.5f);
|
||||||
if (invalid_tangent != invalid_bitangent) {
|
if (invalid_tangent != invalid_bitangent) {
|
||||||
if (invalid_tangent) {
|
if (invalid_tangent) {
|
||||||
localTangent = meshNorm[p] ^ localBitangent;
|
localTangent = meshNorm[p] ^ localBitangent;
|
||||||
|
|
Loading…
Reference in New Issue