summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-12-22 12:49:54 -0500
committerLoren Shih <seraph@lindenlab.com>2010-12-22 12:49:54 -0500
commit8de11e98cc198442f52c6950ed518a36ce8dbc8d (patch)
tree0c8fdad6b28849508bea414e350e5cba2d338ab1 /indra/newview/llmeshrepository.cpp
parentaba13fb96c048fedf62b492b0db5ca0b185ce0a8 (diff)
parent693b838b721c9d9405eda993cf2df38d9ed6e545 (diff)
Automated merge from mesh-development
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-xindra/newview/llmeshrepository.cpp55
1 files changed, 42 insertions, 13 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 4873eaeabd..861db7fd5d 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1396,6 +1396,7 @@ LLMeshUploadThread::DecompRequest::DecompRequest(LLModel* mdl, LLModel* base_mod
{
mStage = "single_hull";
mModel = mdl;
+ mDecompID = &mdl->mDecompID;
mBaseModel = base_model;
mThread = thread;
@@ -2262,6 +2263,9 @@ void LLMeshRepository::notifyLoadedMeshes()
mInventoryQ.pop();
}
}
+
+ //call completed callbacks on finished decompositions
+ mDecompThread->notifyCompleted();
if (!mThread->mWaiting)
{ //curl thread is churning, wait for it to go idle
@@ -3229,9 +3233,8 @@ void LLPhysicsDecomp::doDecomposition()
mCurRequest->mHullMesh.clear();
mCurRequest->setStatusMessage("FAIL");
- mCurRequest->completed();
-
- mCurRequest = NULL;
+
+ completeCurrent();
}
else
{
@@ -3282,13 +3285,33 @@ void LLPhysicsDecomp::doDecomposition()
LLMutexLock lock(mMutex);
mCurRequest->setStatusMessage("FAIL");
- mCurRequest->completed();
-
- mCurRequest = NULL;
+ completeCurrent();
+ }
+ }
+}
+
+void LLPhysicsDecomp::completeCurrent()
+{
+ LLMutexLock lock(mMutex);
+ mCompletedQ.push(mCurRequest);
+ mCurRequest = NULL;
+}
+
+void LLPhysicsDecomp::notifyCompleted()
+{
+ if (!mCompletedQ.empty())
+ {
+ LLMutexLock lock(mMutex);
+ while (!mCompletedQ.empty())
+ {
+ Request* req = mCompletedQ.front();
+ req->completed();
+ mCompletedQ.pop();
}
}
}
+
void make_box(LLPhysicsDecomp::Request * request)
{
LLVector3 min,max;
@@ -3406,18 +3429,17 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
{
- LLMutexLock lock(mMutex);
- mCurRequest->completed();
- mCurRequest = NULL;
+ completeCurrent();
+
}
}
+
void LLPhysicsDecomp::run()
{
- LLConvexDecomposition::getInstance()->initThread();
- mInited = true;
-
LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
+ decomp->initThread();
+ mInited = true;
static const LLCDStageData* stages = NULL;
static S32 num_stages = 0;
@@ -3443,6 +3465,13 @@ void LLPhysicsDecomp::run()
mRequestQ.pop();
}
+ S32& id = *(mCurRequest->mDecompID);
+ if (id == -1)
+ {
+ decomp->genDecomposition(id);
+ }
+ decomp->bindDecomposition(id);
+
if (mCurRequest->mStage == "single_hull")
{
doDecompositionSingleHull();
@@ -3454,7 +3483,7 @@ void LLPhysicsDecomp::run()
}
}
- LLConvexDecomposition::getInstance()->quitThread();
+ decomp->quitThread();
//delete mSignal;
delete mMutex;