diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-09-06 21:29:51 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-09-06 21:29:51 +0300 |
commit | b45c0e3ed926270e100271f33885b8d31085a858 (patch) | |
tree | c89afd29b6fc71294c0f35e3cddc2518a68fd2b0 /indra/newview | |
parent | bac30c9ba5fc9f947788b4fbb468d3259a20fc2e (diff) |
SL-15940 Remove ability to set zero triangle limit
Setting lod to zero triangles doesn't work and shouldn't work, so UI shouldn't allow setting less then one triangle per model as well.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llmodelpreview.h | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index bf661d39b2..b17aa960ce 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -194,6 +194,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) mPreviewLOD = 0; mModelLoader = NULL; mMaxTriangleLimit = 0; + mMinTriangleLimit = 0; mDirty = false; mGenLOD = false; mLoading = false; @@ -1508,6 +1509,7 @@ void LLModelPreview::genGlodLODs(S32 which_lod, U32 decimation, bool enforce_tri } mMaxTriangleLimit = base_triangle_count; + mMinTriangleLimit = mBaseModel.size(); for (S32 lod = start; lod >= end; --lod) { @@ -1541,7 +1543,7 @@ void LLModelPreview::genGlodLODs(S32 which_lod, U32 decimation, bool enforce_tri U32 actual_verts = 0; U32 submeshes = 0; - mRequestedTriangleCount[lod] = (S32)((F32)triangle_count / triangle_ratio); + mRequestedTriangleCount[lod] = llmax(mMinTriangleLimit, (S32)((F32)triangle_count / triangle_ratio)); mRequestedErrorThreshold[lod] = lod_error_threshold; glodGroupParameteri(mGroup, GLOD_ADAPT_MODE, lod_mode); @@ -2100,6 +2102,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } mMaxTriangleLimit = base_triangle_count; + mMinTriangleLimit = mBaseModel.size(); // TODO: Glod regenerates vertex buffer at this stage // check why, it might be needed to regenerate buffer as well @@ -2133,7 +2136,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } } - mRequestedTriangleCount[lod] = triangle_limit; + mRequestedTriangleCount[lod] = llmax(mMinTriangleLimit, (S32)triangle_limit); mRequestedErrorThreshold[lod] = lod_error_threshold; mRequestedLoDMode[lod] = lod_mode; @@ -2431,6 +2434,7 @@ void LLModelPreview::updateStatusMessages() if (mMaxTriangleLimit == 0) { mMaxTriangleLimit = total_tris[LLModel::LOD_HIGH]; + mMinTriangleLimit = mUploadData.size(); } mHasDegenerate = false; @@ -2933,6 +2937,7 @@ void LLModelPreview::updateLodControls(S32 lod) LLSpinCtrl* limit = mFMP->getChild<LLSpinCtrl>("lod_triangle_limit_" + lod_name[lod]); limit->setMaxValue(mMaxTriangleLimit); + limit->setMinValue(mMinTriangleLimit); limit->forceSetValue(mRequestedTriangleCount[lod]); threshold->forceSetValue(mRequestedErrorThreshold[lod]); @@ -2945,6 +2950,7 @@ void LLModelPreview::updateLodControls(S32 lod) threshold->setVisible(false); limit->setMaxValue(mMaxTriangleLimit); + limit->setMinValue(mMinTriangleLimit); limit->setIncrement(llmax((U32)1, mMaxTriangleLimit / 32)); } else diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index b3296fecf6..49032f0dbf 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -296,8 +296,14 @@ protected: U32 mGroup; std::map<LLPointer<LLModel>, U32> mObject; + + // Amount of triangles in original(base) model U32 mMaxTriangleLimit; + // Minimum amount of allowed triangles in lod for spin cntrl. + // Leave at least one triangle per model. + S32 mMinTriangleLimit; + LLMeshUploadThread::instance_list mUploadData; std::set<LLViewerFetchedTexture * > mTextureSet; |