diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-07-12 16:47:45 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-07-12 16:50:10 +0300 |
commit | eb13133e3e0020c73399414cea4d9b39ef526cd3 (patch) | |
tree | 483afbc59153a21b70d9acbc124b6f6f533c8dde /indra/newview | |
parent | 17131ac20336b5561b574a9c121c6a5876be2d53 (diff) |
DRTVWR-542 WIP #5
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 27341eff3c..5eb49ee938 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -1767,7 +1767,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, U32 decimation, bool en } // meshoptimizer doesn't use triangle limit, it uses indices limit, so convert it to aproximate ratio - indices_ratio = (F32)triangle_limit / (F32)base_triangle_count; + indices_ratio = triangle_limit / (F32)base_triangle_count; } else { @@ -1849,7 +1849,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, U32 decimation, bool en // todo: run generateShadowIndexBuffer, at some stage, potentially inside simplify - F32 target_indices = llmax((F32)3, num_indices * indices_ratio); // leave at least one triangle + S32 target_indices = llmax(3, llfloor(num_indices * indices_ratio)); // leave at least one triangle F32 result_code = 0; // how far from original the model is S32 new_indices = LLMeshOptimizer::simplify(&output[0], face.mIndices, @@ -1868,9 +1868,16 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, U32 decimation, bool en LLVolumeFace &new_face = target_model->getVolumeFace(face_idx); // Copy old values - // todo: no point copying faces? new_face = face; + // Assign new values + S32 idx_size = (new_indices * sizeof(U16) + 0xF) & ~0xF; + LLVector4a::memcpyNonAliased16((F32*)new_face.mIndices, (F32*)(&output[0]), idx_size); + new_face.mNumIndices = new_indices; + + // clear unused values + new_face.optimize(); + if (new_indices == 0) { LL_WARNS() << "No indices generated for face " << face_idx @@ -1878,16 +1885,6 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, U32 decimation, bool en << " target Indices: " << target_indices << " original count: " << num_indices << LL_ENDL; } - else - { - // Assign new values - S32 idx_size = (new_indices * sizeof(U16) + 0xF) & ~0xF; - LLVector4a::memcpyNonAliased16((F32*)new_face.mIndices, (F32*)(&output[0]), idx_size); - new_face.mNumIndices = new_indices; - - // clear unused values - new_face.optimize(); - } } //blind copy skin weights and just take closest skin weight to point on |