summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermodelpreview.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2011-01-11 16:39:28 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2011-01-11 16:39:28 -0500
commit997c0d3924015910b62acaa85e46844fcfb43ec0 (patch)
treedd7d05a0ceb4c777e6bf0c214c69abcb7954a5cb /indra/newview/llfloatermodelpreview.cpp
parentf71228bf90b54f02f52b315d8a81c0cf296ba4ae (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
Diffstat (limited to 'indra/newview/llfloatermodelpreview.cpp')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp34
1 files changed, 28 insertions, 6 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;