diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-01-11 16:39:28 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-01-11 16:39:28 -0500 |
commit | 997c0d3924015910b62acaa85e46844fcfb43ec0 (patch) | |
tree | dd7d05a0ceb4c777e6bf0c214c69abcb7954a5cb | |
parent | f71228bf90b54f02f52b315d8a81c0cf296ba4ae (diff) |
SH-742 FIX, SH-743 FIX: now treat requesting a specific triangle limit differently from changing some other LOD parameter, to avoid successive simplification problem
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llfloatermodelpreview.h | 6 |
2 files changed, 33 insertions, 7 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index c0b5b7cfa6..02dc1ec8be 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -291,7 +291,7 @@ BOOL LLFloaterModelPreview::postBuild() childSetCommitCallback("lod_mode", onLODParamCommit, this); childSetCommitCallback("lod_error_threshold", onLODParamCommit, this); - childSetCommitCallback("lod_triangle_limit", onLODParamCommit, this); + childSetCommitCallback("lod_triangle_limit", onLODParamCommitTriangleLimit, this); childSetCommitCallback("build_operator", onLODParamCommit, this); childSetCommitCallback("queue_mode", onLODParamCommit, this); childSetCommitCallback("border_mode", onLODParamCommit, this); @@ -531,9 +531,14 @@ void LLFloaterModelPreview::onAutoFillCommit(LLUICtrl* ctrl, void* userdata) void LLFloaterModelPreview::onLODParamCommit(LLUICtrl* ctrl, void* userdata) { LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; - fp->mModelPreview->genLODs(fp->mModelPreview->mPreviewLOD); - fp->mModelPreview->updateStatusMessages(); - fp->mModelPreview->refresh(); + fp->mModelPreview->onLODParamCommit(false); +} + +//static +void LLFloaterModelPreview::onLODParamCommitTriangleLimit(LLUICtrl* ctrl, void* userdata) +{ + LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; + fp->mModelPreview->onLODParamCommit(true); } @@ -2810,7 +2815,7 @@ bool LLModelPreview::containsRiggedAsset( void ) } return false; } -void LLModelPreview::genLODs(S32 which_lod, U32 decimation) +void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_limit) { if (mBaseModel.empty()) { @@ -3041,7 +3046,17 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation) } else { - triangle_count = limit; + if (enforce_tri_limit) + { + triangle_count = limit; + } + else + { + for (S32 j=LLModel::LOD_HIGH; j>which_lod; --j) + { + triangle_count /= decimation; + } + } } mModel[lod].clear(); @@ -4307,6 +4322,13 @@ void LLModelPreview::textureLoadedCallback( BOOL success, LLViewerFetchedTexture preview->refresh(); } +void LLModelPreview::onLODParamCommit(bool enforce_tri_limit) +{ + genLODs(mPreviewLOD, 3, enforce_tri_limit); + updateStatusMessages(); + refresh(); +} + LLFloaterModelPreview::DecompRequest::DecompRequest(const std::string& stage, LLModel* mdl) { mStage = stage; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 04e5b9591c..0fccc4d765 100644..100755 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -187,6 +187,7 @@ protected: static void onAutoFillCommit(LLUICtrl*,void*); static void onLODParamCommit(LLUICtrl*,void*); + static void onLODParamCommitTriangleLimit(LLUICtrl*,void*); static void onExplodeCommit(LLUICtrl*, void*); @@ -232,6 +233,7 @@ protected: LLMenuButton* mViewOptionMenuButton; LLToggleableMenu* mViewOptionMenu; LLMutex* mStatusLock; + }; class LLMeshFilePicker : public LLFilePickerThread @@ -247,6 +249,7 @@ private: class LLModelPreview : public LLViewerDynamicTexture, public LLMutex + { public: @@ -271,7 +274,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex void clearModel(S32 lod); void loadModel(std::string filename, S32 lod); void loadModelCallback(S32 lod); - void genLODs(S32 which_lod = -1, U32 decimation = 3); + void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false); void generateNormals(); void consolidate(); void clearMaterials(); @@ -281,6 +284,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex void updateStatusMessages(); bool containsRiggedAsset( void ); void clearGLODGroup(); + void onLODParamCommit(bool enforce_tri_limit); static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); |