summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-05-24 17:36:06 -0600
committerXiaohong Bao <bao@lindenlab.com>2011-05-24 17:36:06 -0600
commitf5726a094db77ec4fbba67e33d436cba8bf60a4b (patch)
tree6fd493a5ef0901a1b2ef51d981643deac46a67ba /indra/newview/llmeshrepository.cpp
parenta704394bb50012e3e8d3be358d286188afccbdf2 (diff)
fix for
SH-712:Asset error given on upload of duck.dae using High LOD for physics shape - Analyze seems to not complete; SH-889: Viewer crash when analyzing physics LOD; SH-890: Viewer crash on Exit after analyzing physics layer which never seems to complete
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r--indra/newview/llmeshrepository.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index d9a58d56fe..90e8f055dc 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -3751,6 +3751,25 @@ void LLPhysicsDecomp::run()
mDone = true;
}
+void LLPhysicsDecomp::Request::updateTriangleAreaThreshold()
+{
+ F32 range = mBBox[1].mV[0] - mBBox[0].mV[0] ;
+ range = llmin(range, mBBox[1].mV[1] - mBBox[0].mV[1]) ;
+ range = llmin(range, mBBox[1].mV[2] - mBBox[0].mV[2]) ;
+
+ mTriangleAreaThreshold = llmin(0.0002f, range * 0.000002f) ;
+}
+
+//check if the triangle area is large enough to qualify for a valid triangle
+bool LLPhysicsDecomp::Request::isValidTriangle(U16 idx1, U16 idx2, U16 idx3)
+{
+ LLVector3 a = mPositions[idx2] - mPositions[idx1] ;
+ LLVector3 b = mPositions[idx3] - mPositions[idx1] ;
+ F32 c = a * b ;
+
+ return ((a*a) * (b*b) - c * c) > mTriangleAreaThreshold ;
+}
+
void LLPhysicsDecomp::Request::setStatusMessage(const std::string& msg)
{
mStatusMessage = msg;