From f17eab60a395cb3caa18edc1e9619b695eb831d4 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 30 Jun 2021 20:38:40 +0300 Subject: SL-15488 FIXED Files ending in .DAE handle differently than files ending in .dae --- indra/newview/llmodelpreview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index a9e80ab5da..767c3b30ec 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2616,7 +2616,9 @@ void LLModelPreview::lookupLODModelFiles(S32 lod) std::string lod_filename = mLODFile[LLModel::LOD_HIGH]; std::string ext = ".dae"; - std::string::size_type i = lod_filename.rfind(ext); + std::string lod_filename_lower(lod_filename); + LLStringUtil::toLower(lod_filename_lower); + std::string::size_type i = lod_filename_lower.rfind(ext); if (i != std::string::npos) { lod_filename.replace(i, lod_filename.size() - ext.size(), getLodSuffix(next_lod) + ext); -- cgit v1.2.3 From 7f0e62ea9e1c2deac03ad9ffc3533f558fd77766 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 31 Mar 2022 22:52:56 +0300 Subject: SL-17121 Revert "SL-15940 Remove ability to set zero triangle limit" This reverts commit b45c0e3ed926270e100271f33885b8d31085a858. --- indra/newview/llmodelpreview.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index c7f56de4ed..8bf88cb5e8 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -180,7 +180,6 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) mPreviewLOD = 0; mModelLoader = NULL; mMaxTriangleLimit = 0; - mMinTriangleLimit = 0; mDirty = false; mGenLOD = false; mLoading = false; @@ -1643,7 +1642,6 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } mMaxTriangleLimit = base_triangle_count; - mMinTriangleLimit = mBaseModel.size(); // Build models @@ -1668,7 +1666,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } } - mRequestedTriangleCount[lod] = llmax(mMinTriangleLimit, (S32)triangle_limit); + mRequestedTriangleCount[lod] = triangle_limit; mRequestedErrorThreshold[lod] = lod_error_threshold; mRequestedLoDMode[lod] = lod_mode; @@ -2003,7 +2001,6 @@ void LLModelPreview::updateStatusMessages() if (mMaxTriangleLimit == 0) { mMaxTriangleLimit = total_tris[LLModel::LOD_HIGH]; - mMinTriangleLimit = mUploadData.size(); } mHasDegenerate = false; @@ -2506,7 +2503,6 @@ void LLModelPreview::updateLodControls(S32 lod) LLSpinCtrl* limit = mFMP->getChild("lod_triangle_limit_" + lod_name[lod]); limit->setMaxValue(mMaxTriangleLimit); - limit->setMinValue(mMinTriangleLimit); limit->forceSetValue(mRequestedTriangleCount[lod]); threshold->forceSetValue(mRequestedErrorThreshold[lod]); @@ -2519,7 +2515,6 @@ void LLModelPreview::updateLodControls(S32 lod) threshold->setVisible(false); limit->setMaxValue(mMaxTriangleLimit); - limit->setMinValue(mMinTriangleLimit); limit->setIncrement(llmax((U32)1, mMaxTriangleLimit / 32)); } else -- cgit v1.2.3 From 14e792766ebc00e1af6070ae27013ac29bf4eab8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 1 Apr 2022 00:33:51 +0300 Subject: SL-17121 Adjust uploader for possible 0 input. --- indra/newview/llmodelpreview.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 8bf88cb5e8..00613b1d80 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -1286,7 +1286,14 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe F32 result_error = 0; // how far from original the model is, 1 == 100% S32 new_indices = 0; - target_indices = llclamp(llfloor(size_indices / indices_decimator), 3, (S32)size_indices); // leave at least one triangle + if (indices_decimator > 0) + { + target_indices = llclamp(llfloor(size_indices / indices_decimator), 3, (S32)size_indices); // leave at least one triangle + } + else // indices_decimator can be zero for error_threshold based calculations + { + target_indices = 3; + } new_indices = LLMeshOptimizer::simplifyU32( output_indices, combined_indices, @@ -1490,7 +1497,14 @@ F32 LLModelPreview::genMeshOptimizerPerFace(LLModel *base_model, LLModel *target F32 result_error = 0; // how far from original the model is, 1 == 100% S32 new_indices = 0; - target_indices = llclamp(llfloor(size_indices / indices_decimator), 3, (S32)size_indices); // leave at least one triangle + if (indices_decimator > 0) + { + target_indices = llclamp(llfloor(size_indices / indices_decimator), 3, (S32)size_indices); // leave at least one triangle + } + else + { + target_indices = 3; + } new_indices = LLMeshOptimizer::simplify( output, face.mIndices, @@ -1627,7 +1641,8 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } // meshoptimizer doesn't use triangle limit, it uses indices limit, so convert it to aproximate ratio - indices_decimator = (F32)base_triangle_count / triangle_limit; + // triangle_limit can be 0. + indices_decimator = (F32)base_triangle_count / llmax(triangle_limit, 1.f); } else { -- cgit v1.2.3 From 84e22d410efb9ab774c9c5d8fe240c9c37c8e69b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 1 Apr 2022 22:32:57 +0300 Subject: SL-17121 Fix error threshold value --- indra/newview/llmodelpreview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmodelpreview.cpp') diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 00613b1d80..3822a98081 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -1646,7 +1646,8 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } else { - lod_error_threshold = mFMP->childGetValue("lod_error_threshold_" + lod_name[which_lod]).asReal(); + // UI shows 0 to 100%, but meshoptimizer works with 0 to 1 + lod_error_threshold = mFMP->childGetValue("lod_error_threshold_" + lod_name[which_lod]).asReal() / 100.f; } } else @@ -1682,7 +1683,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } mRequestedTriangleCount[lod] = triangle_limit; - mRequestedErrorThreshold[lod] = lod_error_threshold; + mRequestedErrorThreshold[lod] = lod_error_threshold * 100; mRequestedLoDMode[lod] = lod_mode; mModel[lod].clear(); -- cgit v1.2.3