diff options
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 26 | ||||
-rwxr-xr-x | indra/newview/llfloatermodelpreview.h | 10 |
2 files changed, 27 insertions, 9 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 088c9e6546..8be56009aa 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1989,13 +1989,13 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) if (lod == 3 && !mGroup.empty()) { - for (std::map<LLModel*, U32>::iterator iter = mGroup.begin(); iter != mGroup.end(); ++iter) + for (std::map<LLPointer<LLModel>, U32>::iterator iter = mGroup.begin(); iter != mGroup.end(); ++iter) { glodDeleteGroup(iter->second); stop_gloderror(); } - for (std::map<LLModel*, U32>::iterator iter = mObject.begin(); iter != mObject.end(); ++iter) + for (std::map<LLPointer<LLModel>, U32>::iterator iter = mObject.begin(); iter != mObject.end(); ++iter) { glodDeleteObject(iter->second); stop_gloderror(); @@ -2055,6 +2055,11 @@ void LLModelPreview::loadModelCallback(S32 lod) mScene[lod] = mModelLoader->mScene; mVertexBuffer[lod].clear(); + if (lod == LLModel::LOD_PHYSICS) + { + mPhysicsMesh.clear(); + } + setPreviewLOD(lod); @@ -2338,6 +2343,11 @@ void LLModelPreview::genLODs(S32 which_lod) return; } + if (which_lod == LLModel::LOD_PHYSICS) + { //clear physics mesh map + mPhysicsMesh.clear(); + } + LLVertexBuffer::unbind(); stop_gloderror(); @@ -2365,6 +2375,14 @@ void LLModelPreview::genLODs(S32 which_lod) U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0; + if (mGroup[mBaseModel[0]] == 0) + { //clear LOD maps + mGroup.clear(); + mObject.clear(); + mPercentage.clear(); + mPatch.clear(); + } + for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter) { //build GLOD objects for each model in base model list LLModel* mdl = *iter; @@ -3118,7 +3136,7 @@ BOOL LLModelPreview::render() { LLMutexLock(decomp->mMutex); - std::map<LLModel*, std::vector<LLPointer<LLVertexBuffer> > >::iterator iter = + std::map<LLPointer<LLModel>, std::vector<LLPointer<LLVertexBuffer> > >::iterator iter = mPhysicsMesh.find(model); if (iter != mPhysicsMesh.end()) { @@ -3406,7 +3424,7 @@ void LLFloaterModelPreview::onDecompose(void* user_data) void LLFloaterModelPreview::onModelDecompositionComplete(LLModel* model, std::vector<LLPointer<LLVertexBuffer> >& physics_mesh) { if (sInstance && sInstance->mModelPreview) - { + { sInstance->mModelPreview->mPhysicsMesh[model] = physics_mesh; sInstance->mModelPreview->mDirty = true; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 148687aecd..d8f06295ac 100755 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -168,12 +168,12 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex LLModelLoader::model_list mModel[LLModel::NUM_LODS]; LLModelLoader::model_list mBaseModel; - std::map<LLModel*, U32> mGroup; - std::map<LLModel*, U32> mObject; - std::map<LLModel*, std::vector<U32> > mPatch; + std::map<LLPointer<LLModel>, U32> mGroup; + std::map<LLPointer<LLModel>, U32> mObject; + std::map<LLPointer<LLModel>, std::vector<U32> > mPatch; + std::map<LLPointer<LLModel>, F32> mPercentage; - std::map<LLModel*, F32> mPercentage; - std::map<LLModel*, std::vector<LLPointer<LLVertexBuffer> > > mPhysicsMesh; + std::map<LLPointer<LLModel>, std::vector<LLPointer<LLVertexBuffer> > > mPhysicsMesh; LLMeshUploadThread::instance_list mUploadData; std::set<LLPointer<LLViewerFetchedTexture> > mTextureSet; |