summaryrefslogtreecommitdiff
path: root/indra/llmeshoptimizer
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-12 23:23:08 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-13 00:08:41 +0300
commit833a82f8593c513b12b59c489760f77d5a806668 (patch)
treee72f97afdf7554c6f579b80f8432d35991fbebca /indra/llmeshoptimizer
parent4372913f59a39dcf6b4818eaea64369c7c7242d5 (diff)
DRTVWR-542 WIP #7
Diffstat (limited to 'indra/llmeshoptimizer')
-rw-r--r--indra/llmeshoptimizer/llmeshoptimizer.cpp23
-rw-r--r--indra/llmeshoptimizer/llmeshoptimizer.h7
2 files changed, 27 insertions, 3 deletions
diff --git a/indra/llmeshoptimizer/llmeshoptimizer.cpp b/indra/llmeshoptimizer/llmeshoptimizer.cpp
index 2f3d2491c2..0ddaa82c3d 100644
--- a/indra/llmeshoptimizer/llmeshoptimizer.cpp
+++ b/indra/llmeshoptimizer/llmeshoptimizer.cpp
@@ -40,6 +40,26 @@ LLMeshOptimizer::~LLMeshOptimizer()
}
//static
+void LLMeshOptimizer::generateShadowIndexBuffer(U16 *destination,
+ const U16 *indices,
+ U64 index_count,
+ const LLVector4a *vertex_positions,
+ U64 vertex_count
+)
+{
+ const size_t vertex_stride = 4; // should be either 0 or 4
+
+ meshopt_generateShadowIndexBuffer<unsigned short>(destination,
+ indices,
+ index_count,
+ (const float*)vertex_positions, // verify that it is correct to convert to float
+ vertex_count,
+ sizeof(LLVector4a),
+ vertex_stride
+ );
+}
+
+//static
U64 LLMeshOptimizer::simplify(U16 *destination,
const U16 *indices,
U64 index_count,
@@ -52,9 +72,6 @@ U64 LLMeshOptimizer::simplify(U16 *destination,
{
const size_t vertex_stride = 4; // should be either 0 or 4
- // Consider running meshopt_generateShadowIndexBuffer<unsigned short> first.
- // meshopt_generateShadowIndexBuffer is only needed if models don't use some of the vertices,
- // but since we call optimize() in a lot of cases, it likely isn't needed
return meshopt_simplify<unsigned short>(destination,
indices,
index_count,
diff --git a/indra/llmeshoptimizer/llmeshoptimizer.h b/indra/llmeshoptimizer/llmeshoptimizer.h
index c4250c537d..744856361c 100644
--- a/indra/llmeshoptimizer/llmeshoptimizer.h
+++ b/indra/llmeshoptimizer/llmeshoptimizer.h
@@ -36,6 +36,13 @@ public:
LLMeshOptimizer();
~LLMeshOptimizer();
+ static void LLMeshOptimizer::generateShadowIndexBuffer(
+ U16 *destination,
+ const U16 *indices,
+ U64 index_count,
+ const LLVector4a *vertex_positions,
+ U64 vertex_count);
+
// returns amount of indices in destiantion
// result_error returns how far from original the model is in % if not NULL
static U64 simplify(