From 938969c811732a3e2faf0229301de286bd12c1a5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 12 Jul 2021 19:18:25 +0300 Subject: DRTVWR-542 WIP #6 Trying out 'sloppy' variant --- indra/llmeshoptimizer/llmeshoptimizer.cpp | 24 ++++++++++++++++++++++++ indra/llmeshoptimizer/llmeshoptimizer.h | 12 ++++++++++++ 2 files changed, 36 insertions(+) (limited to 'indra/llmeshoptimizer') diff --git a/indra/llmeshoptimizer/llmeshoptimizer.cpp b/indra/llmeshoptimizer/llmeshoptimizer.cpp index dbf8e5b631..2f3d2491c2 100644 --- a/indra/llmeshoptimizer/llmeshoptimizer.cpp +++ b/indra/llmeshoptimizer/llmeshoptimizer.cpp @@ -66,3 +66,27 @@ U64 LLMeshOptimizer::simplify(U16 *destination, result_error ); } + +//static +U64 LLMeshOptimizer::simplifySloppy(U16 *destination, + const U16 *indices, + U64 index_count, + const LLVector4a *vertex_positions, + U64 vertex_count, + U64 target_index_count, + F32 target_error, + F32* result_error + ) +{ + const size_t vertex_stride = 4; // should be either 0 or 4 + return meshopt_simplifySloppy(destination, + indices, + index_count, + (const float*)vertex_positions, // verify that it is correct to convert to float + vertex_count, + vertex_stride, + target_index_count, + target_error, + result_error + ); +} diff --git a/indra/llmeshoptimizer/llmeshoptimizer.h b/indra/llmeshoptimizer/llmeshoptimizer.h index 157de0251d..c4250c537d 100644 --- a/indra/llmeshoptimizer/llmeshoptimizer.h +++ b/indra/llmeshoptimizer/llmeshoptimizer.h @@ -47,6 +47,18 @@ public: U64 target_index_count, F32 target_error, F32* result_error); + + // returns amount of indices in destiantion + // result_error returns how far from original the model is in % if not NULL + static U64 simplifySloppy( + U16 *destination, + const U16 *indices, + U64 index_count, + const LLVector4a *vertex_positions, + U64 vertex_count, + U64 target_index_count, + F32 target_error, + F32* result_error); private: }; -- cgit v1.2.3