diff options
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llfloatermodelpreview.h | 7 |
2 files changed, 33 insertions, 8 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 47a3a4cd30..0346b06e2f 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); @@ -533,9 +533,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); } @@ -2841,7 +2846,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()) { @@ -3072,7 +3077,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(); @@ -4338,6 +4353,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 63377bb1d6..81899e968a 100644..100755 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -189,6 +189,7 @@ protected: static void onAutoFillCommit(LLUICtrl*,void*); static void onLODParamCommit(LLUICtrl*,void*); + static void onLODParamCommitTriangleLimit(LLUICtrl*,void*); static void onExplodeCommit(LLUICtrl*, void*); @@ -234,6 +235,7 @@ protected: LLMenuButton* mViewOptionMenuButton; LLToggleableMenu* mViewOptionMenu; LLMutex* mStatusLock; + }; class LLMeshFilePicker : public LLFilePickerThread @@ -253,7 +255,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex typedef boost::signals2::signal<void (F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost)> details_signal_t; public: - LLModelPreview(S32 width, S32 height, LLFloater* fmp); + LLModelPreview(S32 width, S32 height, LLFloater* fmp); virtual ~LLModelPreview(); void resetPreviewTarget(); @@ -274,7 +276,7 @@ public: 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(); @@ -284,6 +286,7 @@ public: 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 ); |