summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2011-07-12 18:10:44 -0700
committerDon Kjer <don@lindenlab.com>2011-07-12 18:10:44 -0700
commit40a489a9cc1b23db35c7b12f34e35cd2b191a307 (patch)
tree316e420be0ea12d6094772a337da50c19d4b6142 /indra/newview/llmeshrepository.cpp
parent4e16dc26ab3fd0506ba800f124649259aec46136 (diff)
parentc45c603eeefb3b5692213e7840dda6a55f6e4b68 (diff)
Merge
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-xindra/newview/llmeshrepository.cpp93
1 files changed, 64 insertions, 29 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 4d9c324936..78e2716be2 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -34,6 +34,7 @@
#include "llagent.h"
#include "llappviewer.h"
#include "llbufferstream.h"
+#include "llcallbacklist.h"
#include "llcurl.h"
#include "lldatapacker.h"
#include "llfloatermodelpreview.h"
@@ -356,7 +357,6 @@ public:
cc = llsd_from_file("fake_upload_error.xml");
}
- llinfos << "completed" << llendl;
mThread->mPendingUploads--;
dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num));
@@ -365,7 +365,6 @@ public:
if (isGoodStatus(status) &&
cc["state"].asString() == "upload")
{
- llinfos << "fee request succeeded" << llendl;
mThread->mWholeModelUploadURL = cc["uploader"].asString();
if (observer)
@@ -415,8 +414,7 @@ public:
//assert_main_thread();
mThread->mPendingUploads--;
dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num));
- llinfos << "LLWholeModelUploadResponder content: " << cc << llendl;
-
+
LLWholeModelUploadObserver* observer = mObserverHandle.get();
// requested "mesh" asset type isn't actually the type
@@ -424,13 +422,12 @@ public:
if (isGoodStatus(status) &&
cc["state"].asString() == "complete")
{
- llinfos << "upload succeeded" << llendl;
mModelData["asset_type"] = "object";
gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData,cc));
if (observer)
{
- observer->onModelUploadSuccess();
+ doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadSuccess, observer));
}
}
else
@@ -441,7 +438,7 @@ public:
if (observer)
{
- observer->onModelUploadFailure();
+ doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadFailure, observer));
}
}
}
@@ -2896,24 +2893,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)
@@ -2937,7 +2937,7 @@ void LLPhysicsDecomp::doDecomposition()
//load data intoLLCD
if (stage == 0)
{
- setMeshData(mesh);
+ setMeshData(mesh, false);
}
//build parameter map
@@ -3111,11 +3111,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;
@@ -3124,23 +3167,15 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
if (!params)
{
- param_count = LLConvexDecomposition::getInstance()->getParameters(&params);
+ param_count = decomp->getParameters(&params);
}
- 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;
@@ -3202,7 +3237,7 @@ void LLPhysicsDecomp::doDecompositionSingleHull()
}
}
}
-
+#endif
{
completeCurrent();