summaryrefslogtreecommitdiff
path: root/indra/llmeshoptimizer/llmeshoptimizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmeshoptimizer/llmeshoptimizer.cpp')
-rw-r--r--indra/llmeshoptimizer/llmeshoptimizer.cpp97
1 files changed, 54 insertions, 43 deletions
diff --git a/indra/llmeshoptimizer/llmeshoptimizer.cpp b/indra/llmeshoptimizer/llmeshoptimizer.cpp
index 8097a05511..a879389c5a 100644
--- a/indra/llmeshoptimizer/llmeshoptimizer.cpp
+++ b/indra/llmeshoptimizer/llmeshoptimizer.cpp
@@ -67,19 +67,36 @@ U64 LLMeshOptimizer::simplifyU32(U32 *destination,
U64 vertex_positions_stride,
U64 target_index_count,
F32 target_error,
+ bool sloppy,
F32* result_error
)
{
- return meshopt_simplify<unsigned int>(destination,
- indices,
- index_count,
- (const float*)vertex_positions,
- vertex_count,
- vertex_positions_stride,
- target_index_count,
- target_error,
- result_error
- );
+ if (sloppy)
+ {
+ return meshopt_simplifySloppy<unsigned int>(destination,
+ indices,
+ index_count,
+ (const float*)vertex_positions,
+ vertex_count,
+ vertex_positions_stride,
+ target_index_count,
+ target_error,
+ result_error
+ );
+ }
+ else
+ {
+ return meshopt_simplify<unsigned int>(destination,
+ indices,
+ index_count,
+ (const float*)vertex_positions,
+ vertex_count,
+ vertex_positions_stride,
+ target_index_count,
+ target_error,
+ result_error
+ );
+ }
}
//static
@@ -91,41 +108,35 @@ U64 LLMeshOptimizer::simplify(U16 *destination,
U64 vertex_positions_stride,
U64 target_index_count,
F32 target_error,
+ bool sloppy,
F32* result_error
)
{
- return meshopt_simplify<unsigned short>(destination,
- indices,
- index_count,
- (const float*)vertex_positions,
- vertex_count,
- vertex_positions_stride,
- target_index_count,
- target_error,
- result_error
- );
+ if (sloppy)
+ {
+ return meshopt_simplifySloppy<unsigned short>(destination,
+ indices,
+ index_count,
+ (const float*)vertex_positions,
+ vertex_count,
+ vertex_positions_stride,
+ target_index_count,
+ target_error,
+ result_error
+ );
+ }
+ else
+ {
+ return meshopt_simplify<unsigned short>(destination,
+ indices,
+ index_count,
+ (const float*)vertex_positions,
+ vertex_count,
+ vertex_positions_stride,
+ target_index_count,
+ target_error,
+ result_error
+ );
+ }
}
-//static
-U64 LLMeshOptimizer::simplifySloppy(U16 *destination,
- const U16 *indices,
- U64 index_count,
- const LLVector4a *vertex_positions,
- U64 vertex_count,
- U64 vertex_positions_stride,
- U64 target_index_count,
- F32 target_error,
- F32* result_error
- )
-{
- return meshopt_simplifySloppy<unsigned short>(destination,
- indices,
- index_count,
- (const float*)vertex_positions,
- vertex_count,
- vertex_positions_stride,
- target_index_count,
- target_error,
- result_error
- );
-}