summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-03-09 23:15:31 -0600
committerDave Parks <davep@lindenlab.com>2011-03-09 23:15:31 -0600
commita135831c848717cf3809a4ae47d36e57e2076c5b (patch)
tree5d7c86dca88865c0f98fd9eed9874ef1942b7ba8 /indra/newview
parentc2bdb9be1455b7e6414b9a7d034b3118f6a07f23 (diff)
SH-632 Fix for inconsistent decimation results and off by one errors causing decimations where none are needed.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index fabf92c3c6..f65fab41e7 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -2787,9 +2787,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
lod_mode = GLOD_TRIANGLE_BUDGET;
if (which_lod != -1)
{
- //SH-632 take budget as supplied limit+1 to prevent GLOD from creating a smaller
- //decimation when the given decimation is possible
- limit = mFMP->childGetValue("lod_triangle_limit").asInteger(); //+1;
+ limit = mFMP->childGetValue("lod_triangle_limit").asInteger();
}
}
else
@@ -2948,13 +2946,6 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
{
start = end = which_lod;
}
- else
- {
- //SH-632 -- incremenet triangle count to avoid removing any triangles from
- //highest LoD when auto-generating LoD
- triangle_count++;
- }
-
mMaxTriangleLimit = base_triangle_count;
@@ -2998,15 +2989,25 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
glodGroupParameteri(mGroup, GLOD_ERROR_MODE, GLOD_OBJECT_SPACE_ERROR);
stop_gloderror();
- glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, triangle_count);
+ glodGroupParameterf(mGroup, GLOD_OBJECT_SPACE_ERROR_THRESHOLD, lod_error_threshold);
stop_gloderror();
- glodGroupParameterf(mGroup, GLOD_OBJECT_SPACE_ERROR_THRESHOLD, lod_error_threshold);
+ glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, 0);
stop_gloderror();
glodAdaptGroup(mGroup);
stop_gloderror();
+ if (lod_mode == GLOD_TRIANGLE_BUDGET)
+ { //SH-632 Always adapt to 0 before adapting to actual desired amount, and always
+ //add 1 to desired amount to avoid decimating below desired amount
+ glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, triangle_count+1);
+ stop_gloderror();
+
+ glodAdaptGroup(mGroup);
+ stop_gloderror();
+ }
+
for (U32 mdl_idx = 0; mdl_idx < mBaseModel.size(); ++mdl_idx)
{
LLModel* base = mBaseModel[mdl_idx];