diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-07-07 10:51:13 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-07-07 10:51:13 -0600 |
commit | 0400143b4dc37308b60fb29ee6e593f80b6a953f (patch) | |
tree | 2e1d5ed260d420a945f990ecda5060ac0e0fda9c | |
parent | 3b05866653606c247827747b0e767cd1a2545ac8 (diff) |
fix for SH-1808: uploading warthog model triggers LLPhysicsDecomp::doDecompositionSingleHull warnings
SH-1333: [PUBLIC] Simple mesh causing the viewer to crash
-rw-r--r-- | autobuild.xml | 12 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 82 | ||||
-rw-r--r-- | indra/newview/llmeshrepository.h | 2 |
3 files changed, 67 insertions, 29 deletions
diff --git a/autobuild.xml b/autobuild.xml index 39b7fe8d0e..6077ca0587 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1110,9 +1110,9 @@ <key>archive</key> <map> <key>hash</key> - <string>6e45ad68506cd1ba49fd35a3201f0478</string> + <string>0db10480362168f075c2af0ae302cb74</string> <key>url</key> - <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/228821/arch/Darwin/installer/llconvexdecomposition-0.1-darwin-20110504.tar.bz2</string> + <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/234943/arch/Darwin/installer/llconvexdecomposition-0.1-darwin-20110707.tar.bz2</string> </map> <key>name</key> <string>darwin</string> @@ -1122,9 +1122,9 @@ <key>archive</key> <map> <key>hash</key> - <string>00ff5144612c2e261a0811a4503ce3ba</string> + <string>f3c667dc159c0537a9122ce6e72e16db</string> <key>url</key> - <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/228821/arch/Linux/installer/llconvexdecomposition-0.1-linux-20110504.tar.bz2</string> + <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/234943/arch/Linux/installer/llconvexdecomposition-0.1-linux-20110707.tar.bz2</string> </map> <key>name</key> <string>linux</string> @@ -1134,9 +1134,9 @@ <key>archive</key> <map> <key>hash</key> - <string>a4635dcbbe0915ce023dd41d3b848d4c</string> + <string>46cac4d667446bbbc9b5023f2848a5ac</string> <key>url</key> - <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/228821/arch/CYGWIN/installer/llconvexdecomposition-0.1-windows-20110504.tar.bz2</string> + <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/3p-llconvexdecomposition/rev/234943/arch/CYGWIN/installer/llconvexdecomposition-0.1-windows-20110707.tar.bz2</string> </map> <key>name</key> <string>windows</string> diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4da5da9493..f3ceac9dbe 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3321,24 +3321,27 @@ S32 LLPhysicsDecomp::llcdCallback(const char* status, S32 p1, S32 p2) return 1; } -void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh) +void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) { mesh.mVertexBase = mCurRequest->mPositions[0].mV; mesh.mVertexStrideBytes = 12; mesh.mNumVertices = mCurRequest->mPositions.size(); - mesh.mIndexType = LLCDMeshData::INT_16; - mesh.mIndexBase = &(mCurRequest->mIndices[0]); - mesh.mIndexStrideBytes = 6; + if(!vertex_based) + { + mesh.mIndexType = LLCDMeshData::INT_16; + mesh.mIndexBase = &(mCurRequest->mIndices[0]); + mesh.mIndexStrideBytes = 6; - mesh.mNumTriangles = mCurRequest->mIndices.size()/3; + mesh.mNumTriangles = mCurRequest->mIndices.size()/3; + } - if (mesh.mNumTriangles > 0 && mesh.mNumVertices > 2) + if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2) { LLCDResult ret = LLCD_OK; if (LLConvexDecomposition::getInstance() != NULL) { - ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh); + ret = LLConvexDecomposition::getInstance()->setMeshData(&mesh, vertex_based); } if (ret) @@ -3362,7 +3365,7 @@ void LLPhysicsDecomp::doDecomposition() //load data intoLLCD if (stage == 0) { - setMeshData(mesh); + setMeshData(mesh, false); } //build parameter map @@ -3536,11 +3539,54 @@ void make_box(LLPhysicsDecomp::Request * request) void LLPhysicsDecomp::doDecompositionSingleHull() { - LLCDMeshData mesh; + LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance(); + + if (decomp == NULL) + { + //stub. do nothing. + return; + } - setMeshData(mesh); + LLCDMeshData mesh; + +#if 1 + setMeshData(mesh, true); + + LLCDResult ret = decomp->buildSingleHull() ; + if(ret) + { + llwarns << "Could not execute decomposition stage when attempting to create single hull." << llendl; + make_box(mCurRequest); + } + + mMutex->lock(); + mCurRequest->mHull.clear(); + mCurRequest->mHull.resize(1); + mCurRequest->mHullMesh.clear(); + mMutex->unlock(); + + std::vector<LLVector3> p; + LLCDHull hull; + + // if LLConvexDecomposition is a stub, num_hulls should have been set to 0 above, and we should not reach this code + decomp->getSingleHull(&hull); + + const F32* v = hull.mVertexBase; + + for (S32 j = 0; j < hull.mNumVertices; ++j) + { + LLVector3 vert(v[0], v[1], v[2]); + p.push_back(vert); + v = (F32*) (((U8*) v) + hull.mVertexStrideBytes); + } + + mMutex->lock(); + mCurRequest->mHull[0] = p; + mMutex->unlock(); - +#else + setMeshData(mesh, false); + //set all parameters to default std::map<std::string, const LLCDParam*> param_map; @@ -3549,23 +3595,15 @@ void LLPhysicsDecomp::doDecompositionSingleHull() if (!params) { - param_count = LLConvexDecomposition::getInstance()->getParameters(¶ms); + param_count = decomp->getParameters(¶ms); } - LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance(); - - if (decomp == NULL) - { - //stub. do nothing. - return; - } - for (S32 i = 0; i < param_count; ++i) { decomp->setParam(params[i].mName, params[i].mDefault.mIntOrEnumValue); } - const S32 STAGE_DECOMPOSE = mStageID["Decompose"]; + const S32 STAGE_DECOMPOSE = mStageID["Decompose"]; const S32 STAGE_SIMPLIFY = mStageID["Simplify"]; const S32 DECOMP_PREVIEW = 0; const S32 SIMPLIFY_RETAIN = 0; @@ -3627,7 +3665,7 @@ void LLPhysicsDecomp::doDecompositionSingleHull() } } } - +#endif { completeCurrent(); diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index f56734a7de..26cef1650a 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -189,7 +189,7 @@ public: static S32 llcdCallback(const char*, S32, S32); void cancel(); - void setMeshData(LLCDMeshData& mesh); + void setMeshData(LLCDMeshData& mesh, bool vertex_based); void doDecomposition(); void doDecompositionSingleHull(); |