summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-13 11:32:59 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-13 11:32:59 +0300
commit33819e157e9a9638d4869e90601f7b7011804e08 (patch)
treead6cc008031ca9b9579bd40c3e13702809a53961
parent66ba1c4c8e840bb5e9da23e2b5772cd24b23714f (diff)
DRTVWR-542 Fixed size of indices array
-rw-r--r--indra/newview/llmodelpreview.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index aa065edf92..26eac71281 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -1874,7 +1874,9 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, U32 decimation, bool en
lod_error_threshold,
&result_code);
}
-
+
+ // todo: instead of checking (new_indices <= 0)
+ // create a dummy triangle if simplifySloppy returns nothing
if (new_indices <= 0)
{
new_indices = LLMeshOptimizer::simplify(
@@ -1892,7 +1894,18 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, U32 decimation, bool en
if (result_code < 0)
{
- LL_WARNS() << "Negative result from meshoptimizer" << LL_ENDL;
+ LL_WARNS() << "Negative result code from meshoptimizer for face " << face_idx
+ << " of model " << target_model->mLabel
+ << " target Indices: " << target_indices
+ << " new Indices: " << new_indices
+ << " original count: " << num_indices << LL_ENDL;
+ }
+ if (new_indices == 0)
+ {
+ LL_WARNS() << "No indices generated by meshoptimizer for face " << face_idx
+ << " of model " << target_model->mLabel
+ << " target Indices: " << target_indices
+ << " original count: " << num_indices << LL_ENDL;
}
LLVolumeFace &new_face = target_model->getVolumeFace(face_idx);
@@ -1901,20 +1914,12 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, U32 decimation, bool en
new_face = face;
// Assign new values
+ new_face.resizeIndices(new_indices); // will wipe out mIndices, so new_face can't substitute output
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
- << " of model " << target_model->mLabel
- << " target Indices: " << target_indices
- << " original count: " << num_indices << LL_ENDL;
- }
}
//blind copy skin weights and just take closest skin weight to point on