From 66ba1c4c8e840bb5e9da23e2b5772cd24b23714f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 Jul 2021 02:14:16 +0300 Subject: DRTVWR-542 WIP Fixed Stride --- indra/llmeshoptimizer/llmeshoptimizer.cpp | 19 +++++++++---------- indra/llmeshoptimizer/llmeshoptimizer.h | 7 +++++-- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'indra/llmeshoptimizer') diff --git a/indra/llmeshoptimizer/llmeshoptimizer.cpp b/indra/llmeshoptimizer/llmeshoptimizer.cpp index 0ddaa82c3d..09fa7cb235 100644 --- a/indra/llmeshoptimizer/llmeshoptimizer.cpp +++ b/indra/llmeshoptimizer/llmeshoptimizer.cpp @@ -44,18 +44,17 @@ void LLMeshOptimizer::generateShadowIndexBuffer(U16 *destination, const U16 *indices, U64 index_count, const LLVector4a *vertex_positions, - U64 vertex_count + U64 vertex_count, + U64 vertex_positions_stride ) { - const size_t vertex_stride = 4; // should be either 0 or 4 - meshopt_generateShadowIndexBuffer(destination, indices, index_count, (const float*)vertex_positions, // verify that it is correct to convert to float vertex_count, sizeof(LLVector4a), - vertex_stride + vertex_positions_stride ); } @@ -65,19 +64,19 @@ U64 LLMeshOptimizer::simplify(U16 *destination, U64 index_count, const LLVector4a *vertex_positions, U64 vertex_count, + U64 vertex_positions_stride, U64 target_index_count, F32 target_error, F32* result_error ) { - const size_t vertex_stride = 4; // should be either 0 or 4 return meshopt_simplify(destination, indices, index_count, - (const float*)vertex_positions, // verify that it is correct to convert to float + (const float*)vertex_positions, vertex_count, - vertex_stride, + vertex_positions_stride, target_index_count, target_error, result_error @@ -90,18 +89,18 @@ U64 LLMeshOptimizer::simplifySloppy(U16 *destination, U64 index_count, const LLVector4a *vertex_positions, U64 vertex_count, + U64 vertex_positions_stride, 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 + (const float*)vertex_positions, vertex_count, - vertex_stride, + vertex_positions_stride, target_index_count, target_error, result_error diff --git a/indra/llmeshoptimizer/llmeshoptimizer.h b/indra/llmeshoptimizer/llmeshoptimizer.h index 744856361c..1aa02372fa 100644 --- a/indra/llmeshoptimizer/llmeshoptimizer.h +++ b/indra/llmeshoptimizer/llmeshoptimizer.h @@ -36,12 +36,13 @@ public: LLMeshOptimizer(); ~LLMeshOptimizer(); - static void LLMeshOptimizer::generateShadowIndexBuffer( + static void generateShadowIndexBuffer( U16 *destination, const U16 *indices, U64 index_count, const LLVector4a *vertex_positions, - U64 vertex_count); + U64 vertex_count, + U64 vertex_positions_stride); // returns amount of indices in destiantion // result_error returns how far from original the model is in % if not NULL @@ -51,6 +52,7 @@ public: U64 index_count, const LLVector4a *vertex_positions, U64 vertex_count, + U64 vertex_positions_stride, U64 target_index_count, F32 target_error, F32* result_error); @@ -63,6 +65,7 @@ public: U64 index_count, const LLVector4a *vertex_positions, U64 vertex_count, + U64 vertex_positions_stride, U64 target_index_count, F32 target_error, F32* result_error); -- cgit v1.2.3