summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-03-06 09:07:33 -0800
committerGraham Madarasz <graham@lindenlab.com>2013-03-06 09:07:33 -0800
commiteda81f68ca1b337164a94e89f42e53fe76c0e381 (patch)
tree85977debe23e122e6a53c387c33ec9046cc62959 /indra/newview
parent96a07b0cb7fcb3e523874f34d3f88c0ae3060257 (diff)
For MAINT-1842 fix model validation to check for NaNs
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index ea839e6f5a..8ea0b43b36 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -305,8 +305,34 @@ bool validate_face(const LLVolumeFace& face)
return false;
}
+ for (U32 i = 0; i < face.mNumIndices; i+=3)
+ {
+ U16 idx1 = face.mIndices[i];
+ U16 idx2 = face.mIndices[i+1];
+ U16 idx3 = face.mIndices[i+2];
+
+ if (face.mPositions
+ && (!face.mPositions[idx1].isFinite3()
+ || !face.mPositions[idx2].isFinite3()
+ || !face.mPositions[idx3].isFinite3()))
+ {
+ llwarns << "NaN position data in face found!" << llendl;
+ return false;
+ }
+
+ if (face.mNormals
+ && (!face.mNormals[idx1].isFinite3()
+ || !face.mNormals[idx2].isFinite3()
+ || !face.mNormals[idx3].isFinite3()))
+ {
+ llwarns << "NaN normal data in face found!" << llendl;
+ return false;
+ }
+ }
+
/*const LLVector4a scale(0.5f);
+
for (U32 i = 0; i < face.mNumIndices; i+=3)
{
U16 idx1 = face.mIndices[i];
@@ -323,7 +349,6 @@ bool validate_face(const LLVolumeFace& face)
return false;
}
}*/
-
return true;
}