DRTVWR-542 Fixed size of indices array

meow-7.2.2
Andrey Kleshchev 2021-07-13 11:32:59 +03:00
parent 66ba1c4c8e
commit 33819e157e
1 changed files with 16 additions and 11 deletions

View File

@ -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