summaryrefslogtreecommitdiff
path: root/indra/llmeshoptimizer
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-08 20:29:28 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-07-08 21:14:13 +0300
commit1a17e19a610b598650624fb0ae3e67352f00e499 (patch)
treeef57ba0f5097b24b7538880713269eba9f2272d1 /indra/llmeshoptimizer
parent7b7b8a8da8f3a7e726b7de2b152cd00c67df0f18 (diff)
DRTVWR-542 WIP #2
Diffstat (limited to 'indra/llmeshoptimizer')
-rw-r--r--indra/llmeshoptimizer/CMakeLists.txt5
-rw-r--r--indra/llmeshoptimizer/llmeshoptimizer.cpp24
-rw-r--r--indra/llmeshoptimizer/llmeshoptimizer.h12
3 files changed, 34 insertions, 7 deletions
diff --git a/indra/llmeshoptimizer/CMakeLists.txt b/indra/llmeshoptimizer/CMakeLists.txt
index 1eea19de66..016794cfad 100644
--- a/indra/llmeshoptimizer/CMakeLists.txt
+++ b/indra/llmeshoptimizer/CMakeLists.txt
@@ -6,9 +6,11 @@ include(MESHOPTIMIZER)
include(00-Common)
include(LLCommon)
+include(LLMath)
include_directories(
${LLCOMMON_INCLUDE_DIRS}
+ ${LLMATH_INCLUDE_DIRS}
${LLMESHOPTIMIZER_INCLUDE_DIR}
${MESHOPTIMIZER_INCLUDE_DIRS}
${LIBS_PREBUILT_DIR}/include #access to boost headers, needed for LLError
@@ -34,7 +36,8 @@ list(APPEND llmeshoptimizer_SOURCE_FILES ${llmeshoptimizer_HEADER_FILES})
target_link_libraries(llmeshoptimizer
${LLCOMMON_LIBRARIES}
- ${MESHOPTIMIZER_LIBRARY})
+ ${LLMATH_LIBRARIES}
+ ${MESHOPTIMIZER_LIBRARIES})
# Add tests
diff --git a/indra/llmeshoptimizer/llmeshoptimizer.cpp b/indra/llmeshoptimizer/llmeshoptimizer.cpp
index c46fa8dcf3..02e97ef984 100644
--- a/indra/llmeshoptimizer/llmeshoptimizer.cpp
+++ b/indra/llmeshoptimizer/llmeshoptimizer.cpp
@@ -28,7 +28,6 @@
#include "meshoptimizer.h"
-
LLMeshOptimizer::LLMeshOptimizer()
{
// Todo: Looks like for memory management, we can add allocator and deallocator callbacks
@@ -38,12 +37,27 @@ LLMeshOptimizer::LLMeshOptimizer()
LLMeshOptimizer::~LLMeshOptimizer()
{
-
}
//static
-U32 LLMeshOptimizer::simplifyModel()
+U64 LLMeshOptimizer::simplify(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
+ )
{
- LL_WARNS() << "NOT IMPLEMENTED" << LL_ENDL;
- return 0;
+ return meshopt_simplify<unsigned short>(destination,
+ indices,
+ index_count,
+ (const float*)vertex_positions, // verify that it is correct to convert to float
+ vertex_count,
+ sizeof(LLVector4a), // should be either 0 or 4
+ target_index_count,
+ target_error,
+ result_error
+ );
}
diff --git a/indra/llmeshoptimizer/llmeshoptimizer.h b/indra/llmeshoptimizer/llmeshoptimizer.h
index d53ec2e24c..a0c53ed9e1 100644
--- a/indra/llmeshoptimizer/llmeshoptimizer.h
+++ b/indra/llmeshoptimizer/llmeshoptimizer.h
@@ -28,6 +28,8 @@
#include "linden_common.h"
+#include "llmath.h"
+
class LLMeshOptimizer
{
public:
@@ -35,7 +37,15 @@ public:
~LLMeshOptimizer();
// returns state
- static U32 simplifyModel();
+ static U64 simplify(
+ 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:
};