diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-07-08 20:29:28 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-07-08 21:14:13 +0300 |
commit | 1a17e19a610b598650624fb0ae3e67352f00e499 (patch) | |
tree | ef57ba0f5097b24b7538880713269eba9f2272d1 /indra/newview | |
parent | 7b7b8a8da8f3a7e726b7de2b152cd00c67df0f18 (diff) |
DRTVWR-542 WIP #2
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index a6eef74cdc..f23143e3fa 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3705,13 +3705,33 @@ void LLModelPreview::onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_lim mModel[lod][mdl_idx]->mLabel = name; mModel[lod][mdl_idx]->mSubmodelID = base->mSubmodelID; - //mModel[lod][mdl_idx]->setNumVolumeFaces( ); + mModel[lod][mdl_idx]->setNumVolumeFaces(base->getNumVolumeFaces()); LLModel* target_model = mModel[lod][mdl_idx]; + // Run meshoptimizer for each face + for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) + { + const LLVolumeFace &face = base->getVolumeFace(face_idx); + S32 num_indices = face.mNumIndices; + std::vector<U16> output(num_indices); //todo: do not allocate per each face, add one large buffer somewhere + + // todo: run generateShadowIndexBuffer, at some stage, potentially inside simplify + + F32 error_code = 0; + LLMeshOptimizer::simplify(&output[0], + &face.mIndices[0], + num_indices, + &face.mPositions[0], + face.mNumVertices, + triangle_count * 3, //todo: indices limit, not triangles limit*3 + lod_error_threshold, + &error_code); + + // todo: copy result into face + } - // - LLMeshOptimizer::simplifyModel(/*Some params*/); + LL_WARNS() << "WORK IN PROGRESS" << LL_ENDL; //blind copy skin weights and just take closest skin weight to point on //decimated mesh for now (auto-generating LODs with skin weights is still a bit @@ -3755,7 +3775,6 @@ void LLModelPreview::onLODMeshOptimizerParamCommit(S32 lod, bool enforce_tri_lim mResourceCost = calcResourceCost(); - LLMeshOptimizer::simplifyModel(); refresh(); } |