parent
311de59e3c
commit
e4e61df438
5 changed files with 55 additions and 46 deletions
2
thirdparty/README.md
vendored
2
thirdparty/README.md
vendored
|
@ -336,7 +336,7 @@ File extracted from upstream release tarball:
|
|||
## meshoptimizer
|
||||
|
||||
- Upstream: https://github.com/zeux/meshoptimizer
|
||||
- Version: git (f4c356d79fadb99cbf432f7e199d823581b0e19e, 2021)
|
||||
- Version: git (8a7d69caa68f778cb559f1879b6beb7987c8c6b7, 2022)
|
||||
- License: MIT
|
||||
|
||||
Files extracted from upstream repository:
|
||||
|
|
2
thirdparty/meshoptimizer/allocator.cpp
vendored
2
thirdparty/meshoptimizer/allocator.cpp
vendored
|
@ -1,7 +1,7 @@
|
|||
// This file is part of meshoptimizer library; see meshoptimizer.h for version/license details
|
||||
#include "meshoptimizer.h"
|
||||
|
||||
void meshopt_setAllocator(void* (*allocate)(size_t), void (*deallocate)(void*))
|
||||
void meshopt_setAllocator(void* (MESHOPTIMIZER_ALLOC_CALLCONV *allocate)(size_t), void (MESHOPTIMIZER_ALLOC_CALLCONV *deallocate)(void*))
|
||||
{
|
||||
meshopt_Allocator::Storage::allocate = allocate;
|
||||
meshopt_Allocator::Storage::deallocate = deallocate;
|
||||
|
|
65
thirdparty/meshoptimizer/meshoptimizer.h
vendored
65
thirdparty/meshoptimizer/meshoptimizer.h
vendored
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* meshoptimizer - version 0.16
|
||||
* meshoptimizer - version 0.17
|
||||
*
|
||||
* Copyright (C) 2016-2021, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://github.com/zeux/meshoptimizer
|
||||
|
@ -12,13 +12,22 @@
|
|||
#include <stddef.h>
|
||||
|
||||
/* Version macro; major * 1000 + minor * 10 + patch */
|
||||
#define MESHOPTIMIZER_VERSION 160 /* 0.16 */
|
||||
#define MESHOPTIMIZER_VERSION 170 /* 0.17 */
|
||||
|
||||
/* If no API is defined, assume default */
|
||||
#ifndef MESHOPTIMIZER_API
|
||||
#define MESHOPTIMIZER_API
|
||||
#endif
|
||||
|
||||
/* Set the calling-convention for alloc/dealloc function pointers */
|
||||
#ifndef MESHOPTIMIZER_ALLOC_CALLCONV
|
||||
#ifdef _MSC_VER
|
||||
#define MESHOPTIMIZER_ALLOC_CALLCONV __cdecl
|
||||
#else
|
||||
#define MESHOPTIMIZER_ALLOC_CALLCONV
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Experimental APIs have unstable interface and might have implementation that's not fully tested or optimized */
|
||||
#define MESHOPTIMIZER_EXPERIMENTAL MESHOPTIMIZER_API
|
||||
|
||||
|
@ -108,7 +117,7 @@ MESHOPTIMIZER_API void meshopt_generateShadowIndexBufferMulti(unsigned int* dest
|
|||
* destination must contain enough space for the resulting index buffer (index_count*2 elements)
|
||||
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL void meshopt_generateAdjacencyIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
MESHOPTIMIZER_API void meshopt_generateAdjacencyIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
|
||||
/**
|
||||
* Generate index buffer that can be used for PN-AEN tessellation with crack-free displacement
|
||||
|
@ -124,7 +133,7 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_generateAdjacencyIndexBuffer(unsigned in
|
|||
* destination must contain enough space for the resulting index buffer (index_count*4 elements)
|
||||
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL void meshopt_generateTessellationIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
MESHOPTIMIZER_API void meshopt_generateTessellationIndexBuffer(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
|
||||
/**
|
||||
* Vertex transform cache optimizer
|
||||
|
@ -201,10 +210,10 @@ MESHOPTIMIZER_API size_t meshopt_encodeIndexBuffer(unsigned char* buffer, size_t
|
|||
MESHOPTIMIZER_API size_t meshopt_encodeIndexBufferBound(size_t index_count, size_t vertex_count);
|
||||
|
||||
/**
|
||||
* Experimental: Set index encoder format version
|
||||
* Set index encoder format version
|
||||
* version must specify the data format version to encode; valid values are 0 (decodable by all library versions) and 1 (decodable by 0.14+)
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeIndexVersion(int version);
|
||||
MESHOPTIMIZER_API void meshopt_encodeIndexVersion(int version);
|
||||
|
||||
/**
|
||||
* Index buffer decoder
|
||||
|
@ -217,15 +226,15 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeIndexVersion(int version);
|
|||
MESHOPTIMIZER_API int meshopt_decodeIndexBuffer(void* destination, size_t index_count, size_t index_size, const unsigned char* buffer, size_t buffer_size);
|
||||
|
||||
/**
|
||||
* Experimental: Index sequence encoder
|
||||
* Index sequence encoder
|
||||
* Encodes index sequence into an array of bytes that is generally smaller and compresses better compared to original.
|
||||
* Input index sequence can represent arbitrary topology; for triangle lists meshopt_encodeIndexBuffer is likely to be better.
|
||||
* Returns encoded data size on success, 0 on error; the only error condition is if buffer doesn't have enough space
|
||||
*
|
||||
* buffer must contain enough space for the encoded index sequence (use meshopt_encodeIndexSequenceBound to compute worst case size)
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_encodeIndexSequence(unsigned char* buffer, size_t buffer_size, const unsigned int* indices, size_t index_count);
|
||||
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_encodeIndexSequenceBound(size_t index_count, size_t vertex_count);
|
||||
MESHOPTIMIZER_API size_t meshopt_encodeIndexSequence(unsigned char* buffer, size_t buffer_size, const unsigned int* indices, size_t index_count);
|
||||
MESHOPTIMIZER_API size_t meshopt_encodeIndexSequenceBound(size_t index_count, size_t vertex_count);
|
||||
|
||||
/**
|
||||
* Index sequence decoder
|
||||
|
@ -235,7 +244,7 @@ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_encodeIndexSequenceBound(size_t index_
|
|||
*
|
||||
* destination must contain enough space for the resulting index sequence (index_count elements)
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL int meshopt_decodeIndexSequence(void* destination, size_t index_count, size_t index_size, const unsigned char* buffer, size_t buffer_size);
|
||||
MESHOPTIMIZER_API int meshopt_decodeIndexSequence(void* destination, size_t index_count, size_t index_size, const unsigned char* buffer, size_t buffer_size);
|
||||
|
||||
/**
|
||||
* Vertex buffer encoder
|
||||
|
@ -250,10 +259,10 @@ MESHOPTIMIZER_API size_t meshopt_encodeVertexBuffer(unsigned char* buffer, size_
|
|||
MESHOPTIMIZER_API size_t meshopt_encodeVertexBufferBound(size_t vertex_count, size_t vertex_size);
|
||||
|
||||
/**
|
||||
* Experimental: Set vertex encoder format version
|
||||
* Set vertex encoder format version
|
||||
* version must specify the data format version to encode; valid values are 0 (decodable by all library versions)
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeVertexVersion(int version);
|
||||
MESHOPTIMIZER_API void meshopt_encodeVertexVersion(int version);
|
||||
|
||||
/**
|
||||
* Vertex buffer decoder
|
||||
|
@ -285,15 +294,15 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_decodeFilterExp(void* buffer, size_t cou
|
|||
/**
|
||||
* Vertex buffer filter encoders
|
||||
* These functions can be used to encode data in a format that meshopt_decodeFilter can decode
|
||||
*
|
||||
*
|
||||
* meshopt_encodeFilterOct encodes unit vectors with K-bit (K <= 16) signed X/Y as an output.
|
||||
* Each component is stored as an 8-bit or 16-bit normalized integer; stride must be equal to 4 or 8. W is preserved as is.
|
||||
* Input data must contain 4 floats for every vector (count*4 total).
|
||||
*
|
||||
*
|
||||
* meshopt_encodeFilterQuat encodes unit quaternions with K-bit (4 <= K <= 16) component encoding.
|
||||
* Each component is stored as an 16-bit integer; stride must be equal to 8.
|
||||
* Input data must contain 4 floats for every quaternion (count*4 total).
|
||||
*
|
||||
*
|
||||
* meshopt_encodeFilterExp encodes arbitrary (finite) floating-point data with 8-bit exponent and K-bit integer mantissa (1 <= K <= 24).
|
||||
* Mantissa is shared between all components of a given vector as defined by stride; stride must be divisible by 4.
|
||||
* Input data must contain stride/4 floats for every vector (count*stride/4 total).
|
||||
|
@ -353,7 +362,7 @@ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyPoints(unsigned int* destinati
|
|||
|
||||
/**
|
||||
* Experimental: Returns the error scaling factor used by the simplifier to convert between absolute and relative extents
|
||||
*
|
||||
*
|
||||
* Absolute error must be *divided* by the scaling factor before passing it to meshopt_simplify as target_error
|
||||
* Relative error returned by meshopt_simplify via result_error must be *multiplied* by the scaling factor to get absolute error.
|
||||
*/
|
||||
|
@ -438,7 +447,7 @@ struct meshopt_Meshlet
|
|||
};
|
||||
|
||||
/**
|
||||
* Experimental: Meshlet builder
|
||||
* Meshlet builder
|
||||
* Splits the mesh into a set of meshlets where each meshlet has a micro index buffer indexing into meshlet vertices that refer to the original vertex buffer
|
||||
* The resulting data can be used to render meshes using NVidia programmable mesh shading pipeline, or in other cluster-based renderers.
|
||||
* When using buildMeshlets, vertex positions need to be provided to minimize the size of the resulting clusters.
|
||||
|
@ -451,9 +460,9 @@ struct meshopt_Meshlet
|
|||
* max_vertices and max_triangles must not exceed implementation limits (max_vertices <= 255 - not 256!, max_triangles <= 512)
|
||||
* cone_weight should be set to 0 when cone culling is not used, and a value between 0 and 1 otherwise to balance between cluster size and cone culling efficiency
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_buildMeshlets(struct meshopt_Meshlet* meshlets, unsigned int* meshlet_vertices, unsigned char* meshlet_triangles, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t max_vertices, size_t max_triangles, float cone_weight);
|
||||
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_buildMeshletsScan(struct meshopt_Meshlet* meshlets, unsigned int* meshlet_vertices, unsigned char* meshlet_triangles, const unsigned int* indices, size_t index_count, size_t vertex_count, size_t max_vertices, size_t max_triangles);
|
||||
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_buildMeshletsBound(size_t index_count, size_t max_vertices, size_t max_triangles);
|
||||
MESHOPTIMIZER_API size_t meshopt_buildMeshlets(struct meshopt_Meshlet* meshlets, unsigned int* meshlet_vertices, unsigned char* meshlet_triangles, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t max_vertices, size_t max_triangles, float cone_weight);
|
||||
MESHOPTIMIZER_API size_t meshopt_buildMeshletsScan(struct meshopt_Meshlet* meshlets, unsigned int* meshlet_vertices, unsigned char* meshlet_triangles, const unsigned int* indices, size_t index_count, size_t vertex_count, size_t max_vertices, size_t max_triangles);
|
||||
MESHOPTIMIZER_API size_t meshopt_buildMeshletsBound(size_t index_count, size_t max_vertices, size_t max_triangles);
|
||||
|
||||
struct meshopt_Bounds
|
||||
{
|
||||
|
@ -472,7 +481,7 @@ struct meshopt_Bounds
|
|||
};
|
||||
|
||||
/**
|
||||
* Experimental: Cluster bounds generator
|
||||
* Cluster bounds generator
|
||||
* Creates bounding volumes that can be used for frustum, backface and occlusion culling.
|
||||
*
|
||||
* For backface culling with orthographic projection, use the following formula to reject backfacing clusters:
|
||||
|
@ -492,8 +501,8 @@ struct meshopt_Bounds
|
|||
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
||||
* index_count/3 should be less than or equal to 512 (the function assumes clusters of limited size)
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL struct meshopt_Bounds meshopt_computeClusterBounds(const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
MESHOPTIMIZER_EXPERIMENTAL struct meshopt_Bounds meshopt_computeMeshletBounds(const unsigned int* meshlet_vertices, const unsigned char* meshlet_triangles, size_t triangle_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
MESHOPTIMIZER_API struct meshopt_Bounds meshopt_computeClusterBounds(const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
MESHOPTIMIZER_API struct meshopt_Bounds meshopt_computeMeshletBounds(const unsigned int* meshlet_vertices, const unsigned char* meshlet_triangles, size_t triangle_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride);
|
||||
|
||||
/**
|
||||
* Experimental: Spatial sorter
|
||||
|
@ -519,7 +528,7 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_spatialSortTriangles(unsigned int* desti
|
|||
* Note that all algorithms only allocate memory for temporary use.
|
||||
* allocate/deallocate are always called in a stack-like order - last pointer to be allocated is deallocated first.
|
||||
*/
|
||||
MESHOPTIMIZER_API void meshopt_setAllocator(void* (*allocate)(size_t), void (*deallocate)(void*));
|
||||
MESHOPTIMIZER_API void meshopt_setAllocator(void* (MESHOPTIMIZER_ALLOC_CALLCONV *allocate)(size_t), void (MESHOPTIMIZER_ALLOC_CALLCONV *deallocate)(void*));
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -701,8 +710,8 @@ public:
|
|||
template <typename T>
|
||||
struct StorageT
|
||||
{
|
||||
static void* (*allocate)(size_t);
|
||||
static void (*deallocate)(void*);
|
||||
static void* (MESHOPTIMIZER_ALLOC_CALLCONV *allocate)(size_t);
|
||||
static void (MESHOPTIMIZER_ALLOC_CALLCONV *deallocate)(void*);
|
||||
};
|
||||
|
||||
typedef StorageT<void> Storage;
|
||||
|
@ -733,8 +742,8 @@ private:
|
|||
};
|
||||
|
||||
// This makes sure that allocate/deallocate are lazily generated in translation units that need them and are deduplicated by the linker
|
||||
template <typename T> void* (*meshopt_Allocator::StorageT<T>::allocate)(size_t) = operator new;
|
||||
template <typename T> void (*meshopt_Allocator::StorageT<T>::deallocate)(void*) = operator delete;
|
||||
template <typename T> void* (MESHOPTIMIZER_ALLOC_CALLCONV *meshopt_Allocator::StorageT<T>::allocate)(size_t) = operator new;
|
||||
template <typename T> void (MESHOPTIMIZER_ALLOC_CALLCONV *meshopt_Allocator::StorageT<T>::deallocate)(void*) = operator delete;
|
||||
#endif
|
||||
|
||||
/* Inline implementation for C++ templated wrappers */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git a/thirdparty/meshoptimizer/simplifier.cpp b/thirdparty/meshoptimizer/simplifier.cpp
|
||||
index 0f10ebef4b..cf5db4e119 100644
|
||||
index e384046ffe..ccc99edb1a 100644
|
||||
--- a/thirdparty/meshoptimizer/simplifier.cpp
|
||||
+++ b/thirdparty/meshoptimizer/simplifier.cpp
|
||||
@@ -20,7 +20,7 @@
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git a/thirdparty/meshoptimizer/meshoptimizer.h b/thirdparty/meshoptimizer/meshoptimizer.h
|
||||
index fe8d349731..e44b99ce52 100644
|
||||
index be4b765d97..463fad29da 100644
|
||||
--- a/thirdparty/meshoptimizer/meshoptimizer.h
|
||||
+++ b/thirdparty/meshoptimizer/meshoptimizer.h
|
||||
@@ -298,6 +298,11 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_decodeFilterExp(void* buffer, size_t ver
|
||||
@@ -328,6 +328,11 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_encodeFilterExp(void* destination, size_
|
||||
*/
|
||||
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* result_error);
|
||||
|
||||
|
@ -13,9 +13,9 @@ index fe8d349731..e44b99ce52 100644
|
|||
+
|
||||
/**
|
||||
* Experimental: Mesh simplifier (sloppy)
|
||||
* Reduces the number of triangles in the mesh, sacrificing mesh apperance for simplification performance
|
||||
* Reduces the number of triangles in the mesh, sacrificing mesh appearance for simplification performance
|
||||
diff --git a/thirdparty/meshoptimizer/simplifier.cpp b/thirdparty/meshoptimizer/simplifier.cpp
|
||||
index b2cb589462..059cabb055 100644
|
||||
index bf1431269d..e384046ffe 100644
|
||||
--- a/thirdparty/meshoptimizer/simplifier.cpp
|
||||
+++ b/thirdparty/meshoptimizer/simplifier.cpp
|
||||
@@ -20,6 +20,8 @@
|
||||
|
@ -27,7 +27,7 @@ index b2cb589462..059cabb055 100644
|
|||
// This work is based on:
|
||||
// Michael Garland and Paul S. Heckbert. Surface simplification using quadric error metrics. 1997
|
||||
// Michael Garland. Quadric-based polygonal surface simplification. 1999
|
||||
@@ -358,6 +360,10 @@ static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned
|
||||
@@ -363,6 +365,10 @@ static void classifyVertices(unsigned char* result, unsigned int* loop, unsigned
|
||||
struct Vector3
|
||||
{
|
||||
float x, y, z;
|
||||
|
@ -38,7 +38,7 @@ index b2cb589462..059cabb055 100644
|
|||
};
|
||||
|
||||
static float rescalePositions(Vector3* result, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride)
|
||||
@@ -414,6 +420,13 @@ struct Quadric
|
||||
@@ -419,6 +425,13 @@ struct Quadric
|
||||
float a10, a20, a21;
|
||||
float b0, b1, b2, c;
|
||||
float w;
|
||||
|
@ -52,7 +52,7 @@ index b2cb589462..059cabb055 100644
|
|||
};
|
||||
|
||||
struct Collapse
|
||||
@@ -456,6 +469,16 @@ static void quadricAdd(Quadric& Q, const Quadric& R)
|
||||
@@ -461,6 +474,16 @@ static void quadricAdd(Quadric& Q, const Quadric& R)
|
||||
Q.b2 += R.b2;
|
||||
Q.c += R.c;
|
||||
Q.w += R.w;
|
||||
|
@ -69,7 +69,7 @@ index b2cb589462..059cabb055 100644
|
|||
}
|
||||
|
||||
static float quadricError(const Quadric& Q, const Vector3& v)
|
||||
@@ -481,6 +504,17 @@ static float quadricError(const Quadric& Q, const Vector3& v)
|
||||
@@ -486,6 +509,17 @@ static float quadricError(const Quadric& Q, const Vector3& v)
|
||||
r += ry * v.y;
|
||||
r += rz * v.z;
|
||||
|
||||
|
@ -87,7 +87,7 @@ index b2cb589462..059cabb055 100644
|
|||
float s = Q.w == 0.f ? 0.f : 1.f / Q.w;
|
||||
|
||||
return fabsf(r) * s;
|
||||
@@ -504,6 +538,13 @@ static void quadricFromPlane(Quadric& Q, float a, float b, float c, float d, flo
|
||||
@@ -509,6 +543,13 @@ static void quadricFromPlane(Quadric& Q, float a, float b, float c, float d, flo
|
||||
Q.b2 = c * dw;
|
||||
Q.c = d * dw;
|
||||
Q.w = w;
|
||||
|
@ -101,7 +101,7 @@ index b2cb589462..059cabb055 100644
|
|||
}
|
||||
|
||||
static void quadricFromPoint(Quadric& Q, float x, float y, float z, float w)
|
||||
@@ -556,6 +597,84 @@ static void quadricFromTriangleEdge(Quadric& Q, const Vector3& p0, const Vector3
|
||||
@@ -561,6 +602,84 @@ static void quadricFromTriangleEdge(Quadric& Q, const Vector3& p0, const Vector3
|
||||
quadricFromPlane(Q, normal.x, normal.y, normal.z, -distance, length * weight);
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ index b2cb589462..059cabb055 100644
|
|||
static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indices, size_t index_count, const Vector3* vertex_positions, const unsigned int* remap)
|
||||
{
|
||||
for (size_t i = 0; i < index_count; i += 3)
|
||||
@@ -567,6 +686,9 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
|
||||
@@ -572,6 +691,9 @@ static void fillFaceQuadrics(Quadric* vertex_quadrics, const unsigned int* indic
|
||||
Quadric Q;
|
||||
quadricFromTriangle(Q, vertex_positions[i0], vertex_positions[i1], vertex_positions[i2], 1.f);
|
||||
|
||||
|
@ -196,7 +196,7 @@ index b2cb589462..059cabb055 100644
|
|||
quadricAdd(vertex_quadrics[remap[i0]], Q);
|
||||
quadricAdd(vertex_quadrics[remap[i1]], Q);
|
||||
quadricAdd(vertex_quadrics[remap[i2]], Q);
|
||||
@@ -1259,13 +1381,19 @@ unsigned int* meshopt_simplifyDebugLoopBack = 0;
|
||||
@@ -1265,13 +1387,19 @@ MESHOPTIMIZER_API unsigned int* meshopt_simplifyDebugLoopBack = 0;
|
||||
#endif
|
||||
|
||||
size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices, size_t index_count, const float* vertex_positions_data, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count, float target_error, float* out_result_error)
|
||||
|
@ -218,7 +218,7 @@ index b2cb589462..059cabb055 100644
|
|||
|
||||
meshopt_Allocator allocator;
|
||||
|
||||
@@ -1279,7 +1407,7 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
|
||||
@@ -1285,7 +1413,7 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
|
||||
// build position remap that maps each vertex to the one with identical position
|
||||
unsigned int* remap = allocator.allocate<unsigned int>(vertex_count);
|
||||
unsigned int* wedge = allocator.allocate<unsigned int>(vertex_count);
|
||||
|
@ -227,7 +227,7 @@ index b2cb589462..059cabb055 100644
|
|||
|
||||
// classify vertices; vertex kind determines collapse rules, see kCanCollapse
|
||||
unsigned char* vertex_kind = allocator.allocate<unsigned char>(vertex_count);
|
||||
@@ -1303,7 +1431,21 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
|
||||
@@ -1309,7 +1437,21 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
|
||||
#endif
|
||||
|
||||
Vector3* vertex_positions = allocator.allocate<Vector3>(vertex_count);
|
||||
|
@ -250,7 +250,7 @@ index b2cb589462..059cabb055 100644
|
|||
|
||||
Quadric* vertex_quadrics = allocator.allocate<Quadric>(vertex_count);
|
||||
memset(vertex_quadrics, 0, vertex_count * sizeof(Quadric));
|
||||
@@ -1395,7 +1537,9 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
|
||||
@@ -1401,7 +1543,9 @@ size_t meshopt_simplify(unsigned int* destination, const unsigned int* indices,
|
||||
|
||||
// result_error is quadratic; we need to remap it back to linear
|
||||
if (out_result_error)
|
||||
|
|
Loading…
Reference in a new issue