master
Dave Parks 2010-10-15 19:51:28 -05:00
commit 22edf673cf
4 changed files with 46 additions and 37 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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();
}

View File

@ -1058,9 +1058,9 @@ anguage Infrstructure (CLI) international standard</string>
<key>windows</key>
<map>
<key>md5sum</key>
<string>7c7526e45f8d0281bf4c0981911463ef</string>
<string>50fb24b9ad5baf16cbd7b7bf8a607010</string>
<key>url</key>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/llconvexdecomposition-0.3-windows-20101006.tar.bz2</uri>
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/llconvexdecomposition-0.3-windows-20101015a.tar.bz2</uri>
</map>
<key>linux</key>
<map>