summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-11-15 23:23:09 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-11-15 23:23:09 +0200
commit3641541c6cc7f33f0e0dc2e1eb2cfdfcec23322b (patch)
tree9364983a8006240048bf5adba7dcd8aca8a3c4ab /indra/newview
parent27c1f52e6e484c778448d026600bdbcad7d19fb9 (diff)
SL-15756 Removed mHasGeneratedFaces
mHasGeneratedFaces is always true for some types of models and glod was treating faces as one mesh by default, so meshoptimizer should do the same regardles of mHasGeneratedFaces
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llmodelpreview.cpp73
1 files changed, 23 insertions, 50 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index d629358355..f6edbf6bc6 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -1775,68 +1775,41 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
if (model_meshopt_mode == MESH_OPTIMIZER_AUTO)
{
F32 allowed_ratio_drift = 2.f;
- F32 res_ratio = 0;
- if (base->mHasGeneratedFaces)
- {
- res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
+ F32 res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
- if (res_ratio < 0)
+ if (res_ratio < 0)
+ {
+ // U16 vertices overflow, shouldn't happen, but just in case
+ for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx)
{
- // U16 vertices overflow, shouldn't happen, but just in case
- for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx)
- {
- genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
- }
- LL_INFOS() << "Model " << target_model->getName()
- << " lod " << which_lod
- << " per model method overflow, defaulting to per face." << LL_ENDL;
+ genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
}
- else if (res_ratio * allowed_ratio_drift < indices_decimator)
- {
- // Try sloppy variant if normal one failed to simplify model enough.
- res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, true);
- LL_INFOS() << "Model " << target_model->getName()
- << " lod " << which_lod
- << " sloppily simplified using per model method." << LL_ENDL;
+ LL_INFOS() << "Model " << target_model->getName()
+ << " lod " << which_lod
+ << " per model method overflow, defaulting to per face." << LL_ENDL;
+ }
+ else if (res_ratio * allowed_ratio_drift < indices_decimator)
+ {
+ // Try sloppy variant if normal one failed to simplify model enough.
+ res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, true);
+ LL_INFOS() << "Model " << target_model->getName()
+ << " lod " << which_lod
+ << " sloppily simplified using per model method." << LL_ENDL;
- if (res_ratio < 0)
- {
- // Sloppy variant failed to generate triangles.
- // Can happen with models that are too simple as is.
- // Fallback to normal method.
- genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
- }
- }
- else
+ if (res_ratio < 0)
{
- LL_INFOS() << "Model " << target_model->getName()
- << " lod " << which_lod
- << " simplified using per model method." << LL_ENDL;
+ // Sloppy variant failed to generate triangles.
+ // Can happen with models that are too simple as is.
+ // Fallback to normal method.
+ genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
}
}
else
{
- for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx)
- {
- res_ratio = genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
-
- if (res_ratio * allowed_ratio_drift < indices_decimator)
- {
- // normal method failed to sufficiently simplify, try sloppy
- res_ratio = genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, true);
- if (res_ratio < 0)
- {
- // Sloppy failed to generate triangles.
- // Can happen with models that are too simple as is.
- // Fallback to normal method.
- genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
- }
- }
- }
LL_INFOS() << "Model " << target_model->getName()
<< " lod " << which_lod
- << " simplified using per face methods." << LL_ENDL;
+ << " simplified using per model method." << LL_ENDL;
}
}