summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatermodelpreview.cpp13
-rw-r--r--indra/newview/llmeshrepository.cpp40
-rw-r--r--indra/newview/llspatialpartition.cpp26
3 files changed, 44 insertions, 35 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 258da7b406..d067970806 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -868,16 +868,17 @@ void LLFloaterModelPreview::showDecompFloater()
cur_y += 30;
- const LLCDStageData* stage;
- S32 stage_count = 0;
- if (LLConvexDecomposition::getInstance() != NULL)
+ static const LLCDStageData* stage = NULL;
+ static S32 stage_count = 0;
+
+ if (!stage && LLConvexDecomposition::getInstance() != NULL)
{
stage_count = LLConvexDecomposition::getInstance()->getStages(&stage);
}
- const LLCDParam* param;
- S32 param_count = 0;
- if (LLConvexDecomposition::getInstance() != NULL)
+ static const LLCDParam* param = NULL;
+ static S32 param_count = 0;
+ if (!param && LLConvexDecomposition::getInstance() != NULL)
{
param_count = LLConvexDecomposition::getInstance()->getParameters(&param);
}
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index e97fd52c7e..3c51781dfa 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -460,7 +460,7 @@ LLMeshRepoThread::~LLMeshRepoThread()
void LLMeshRepoThread::run()
{
mCurlRequest = new LLCurlRequest();
- LLCDResult res = LLConvexDecomposition::initThread();
+ LLCDResult res = LLConvexDecomposition::initThread();
if (res != LLCD_OK)
{
llwarns << "convex decomposition unable to be loaded" << llendl;
@@ -1835,6 +1835,8 @@ void LLMeshRepository::init()
{
mMeshMutex = new LLMutex(NULL);
+ LLConvexDecomposition::getInstance()->initSystem();
+
mDecompThread = new LLPhysicsDecomp();
mDecompThread->start();
@@ -1843,6 +1845,8 @@ void LLMeshRepository::init()
apr_sleep(100);
}
+
+
mThread = new LLMeshRepoThread();
mThread->start();
}
@@ -1870,6 +1874,8 @@ void LLMeshRepository::shutdown()
delete mDecompThread;
mDecompThread = NULL;
}
+
+ LLConvexDecomposition::quitSystem();
}
@@ -2807,8 +2813,12 @@ void LLPhysicsDecomp::doDecomposition()
//build parameter map
std::map<std::string, const LLCDParam*> param_map;
- const LLCDParam* params;
- S32 param_count = LLConvexDecomposition::getInstance()->getParameters(&params);
+ static const LLCDParam* params = NULL;
+ static S32 param_count = 0;
+ if (!params)
+ {
+ param_count = LLConvexDecomposition::getInstance()->getParameters(&params);
+ }
for (S32 i = 0; i < param_count; ++i)
{
@@ -2965,8 +2975,13 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
//set all parameters to default
std::map<std::string, const LLCDParam*> param_map;
- const LLCDParam* params;
- S32 param_count = LLConvexDecomposition::getInstance()->getParameters(&params);
+ static const LLCDParam* params = NULL;
+ static S32 param_count = 0;
+
+ if (!params)
+ {
+ param_count = LLConvexDecomposition::getInstance()->getParameters(&params);
+ }
LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
@@ -3048,13 +3063,18 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
void LLPhysicsDecomp::run()
{
- LLConvexDecomposition::initSystem();
+ LLConvexDecomposition::getInstance()->initThread();
mInited = true;
LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
- const LLCDStageData* stages;
- S32 num_stages = decomp->getStages(&stages);
+ static const LLCDStageData* stages = NULL;
+ static S32 num_stages = 0;
+
+ if (!stages)
+ {
+ num_stages = decomp->getStages(&stages);
+ }
for (S32 i = 0; i < num_stages; i++)
{
@@ -3083,8 +3103,8 @@ void LLPhysicsDecomp::run()
}
}
- LLConvexDecomposition::quitSystem();
-
+ LLConvexDecomposition::getInstance()->quitThread();
+
//delete mSignal;
delete mMutex;
mSignal = NULL;
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index c40a411978..6ce6a3ecdb 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2911,7 +2911,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
{
renderMeshBaseHull(volume, data_mask, color);
}
-#if 0 && LL_WINDOWS
+#if LL_WINDOWS
else
{
LLVolumeParams volume_params = volume->getVolume()->getParams();
@@ -2958,8 +2958,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
LLCDMeshData res;
- LLConvexDecomposition::getInstance()->initThread();
-
LLConvexDecomposition::getInstance()->generateSingleHullMeshFromMesh( &mesh, &res );
//copy res into phys_volume
@@ -2970,11 +2968,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
phys_volume->mHullIndices = (U16*) malloc(idx_size);
phys_volume->mNumHullIndices = res.mNumTriangles*3;
- const F32* v = mesh.mVertexBase;
+ const F32* v = res.mVertexBase;
for (S32 i = 0; i < res.mNumVertices; ++i)
{
- F32* p = (F32*) ((U8*)v+i*mesh.mVertexStrideBytes);
+ F32* p = (F32*) ((U8*)v+i*res.mVertexStrideBytes);
phys_volume->mHullPoints[i].load3(p);
}
@@ -3000,8 +2998,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
phys_volume->mHullIndices[i*3+2] = (U16) idx[2];
}
}
-
- LLConvexDecomposition::getInstance()->quitThread();
}
if (phys_volume->mHullPoints)
@@ -3014,20 +3010,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
glColor3fv(color.mV);
LLVertexBuffer::unbind();
- glPointSize(2.f);
- gGL.begin(LLRender::POINTS);
- gGL.color3fv(color.mV);
- for (U32 i = 0; i < phys_volume->mNumHullPoints; i++)
- {
- gGL.vertex3fv(phys_volume->mHullPoints[i].getF32ptr());
- }
- gGL.end();
- gGL.flush();
- //glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
+ glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
+ glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
- /*glColor4fv(color.mV);
+ glColor4fv(color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);*/
+ glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices);
gGL.popMatrix();
}