summaryrefslogtreecommitdiff
path: root/indra/llmeshoptimizer
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-12 19:18:25 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-12 19:18:25 +0300
commit938969c811732a3e2faf0229301de286bd12c1a5 (patch)
tree808583514409914544ce476cf9f6d20dfb397c3d /indra/llmeshoptimizer
parenteb13133e3e0020c73399414cea4d9b39ef526cd3 (diff)
DRTVWR-542 WIP #6
Trying out 'sloppy' variant
Diffstat (limited to 'indra/llmeshoptimizer')
-rw-r--r--indra/llmeshoptimizer/llmeshoptimizer.cpp24
-rw-r--r--indra/llmeshoptimizer/llmeshoptimizer.h12
2 files changed, 36 insertions, 0 deletions
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<unsigned short>(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:
};