|
@@ -262,7 +262,7 @@ MESHOPTIMIZER_EXPERIMENTAL void meshopt_decodeFilterExp(void* buffer, size_t ver
|
|
* The resulting index buffer references vertices from the original vertex buffer.
|
|
* The resulting index buffer references vertices from the original vertex buffer.
|
|
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
|
|
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
|
|
*
|
|
*
|
|
- * destination must contain enough space for the *source* index buffer (since optimization is iterative, this means index_count elements - *not* target_index_count!)
|
|
|
|
|
|
+ * destination must contain enough space for the target index buffer, worst case is index_count elements (*not* target_index_count)!
|
|
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
|
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
|
* target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation
|
|
* target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation
|
|
* result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification
|
|
* result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification
|
|
@@ -272,15 +272,17 @@ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplify(unsigned int* destination, co
|
|
/**
|
|
/**
|
|
* Experimental: Mesh simplifier (sloppy)
|
|
* 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 apperance for simplification performance
|
|
- * The algorithm doesn't preserve mesh topology but is always able to reach target triangle count.
|
|
|
|
|
|
+ * The algorithm doesn't preserve mesh topology but can stop short of the target goal based on target error.
|
|
* Returns the number of indices after simplification, with destination containing new index data
|
|
* Returns the number of indices after simplification, with destination containing new index data
|
|
* The resulting index buffer references vertices from the original vertex buffer.
|
|
* The resulting index buffer references vertices from the original vertex buffer.
|
|
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
|
|
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
|
|
*
|
|
*
|
|
- * destination must contain enough space for the target index buffer
|
|
|
|
|
|
+ * destination must contain enough space for the target index buffer, worst case is index_count elements (*not* target_index_count)!
|
|
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
|
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
|
|
|
+ * target_error represents the error relative to mesh extents that can be tolerated, e.g. 0.01 = 1% deformation
|
|
|
|
+ * result_error can be NULL; when it's not NULL, it will contain the resulting (relative) error after simplification
|
|
*/
|
|
*/
|
|
-MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifySloppy(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);
|
|
|
|
|
|
+MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifySloppy(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);
|
|
|
|
|
|
/**
|
|
/**
|
|
* Experimental: Point cloud simplifier
|
|
* Experimental: Point cloud simplifier
|
|
@@ -289,7 +291,7 @@ MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifySloppy(unsigned int* destinati
|
|
* The resulting index buffer references vertices from the original vertex buffer.
|
|
* The resulting index buffer references vertices from the original vertex buffer.
|
|
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
|
|
* If the original vertex data isn't required, creating a compact vertex buffer using meshopt_optimizeVertexFetch is recommended.
|
|
*
|
|
*
|
|
- * destination must contain enough space for the target index buffer
|
|
|
|
|
|
+ * destination must contain enough space for the target index buffer (target_vertex_count elements)
|
|
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
|
* vertex_positions should have float3 position in the first 12 bytes of each vertex - similar to glVertexPointer
|
|
*/
|
|
*/
|
|
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyPoints(unsigned int* destination, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_vertex_count);
|
|
MESHOPTIMIZER_EXPERIMENTAL size_t meshopt_simplifyPoints(unsigned int* destination, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_vertex_count);
|
|
@@ -533,7 +535,7 @@ inline int meshopt_decodeIndexSequence(T* destination, size_t index_count, const
|
|
template <typename T>
|
|
template <typename T>
|
|
inline size_t meshopt_simplify(T* destination, const T* 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 = 0);
|
|
inline size_t meshopt_simplify(T* destination, const T* 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 = 0);
|
|
template <typename T>
|
|
template <typename T>
|
|
-inline size_t meshopt_simplifySloppy(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count);
|
|
|
|
|
|
+inline size_t meshopt_simplifySloppy(T* destination, const T* 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 = 0);
|
|
template <typename T>
|
|
template <typename T>
|
|
inline size_t meshopt_stripify(T* destination, const T* indices, size_t index_count, size_t vertex_count, T restart_index);
|
|
inline size_t meshopt_stripify(T* destination, const T* indices, size_t index_count, size_t vertex_count, T restart_index);
|
|
template <typename T>
|
|
template <typename T>
|
|
@@ -855,12 +857,12 @@ inline size_t meshopt_simplify(T* destination, const T* indices, size_t index_co
|
|
}
|
|
}
|
|
|
|
|
|
template <typename T>
|
|
template <typename T>
|
|
-inline size_t meshopt_simplifySloppy(T* destination, const T* indices, size_t index_count, const float* vertex_positions, size_t vertex_count, size_t vertex_positions_stride, size_t target_index_count)
|
|
|
|
|
|
+inline size_t meshopt_simplifySloppy(T* destination, const T* 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)
|
|
{
|
|
{
|
|
meshopt_IndexAdapter<T> in(0, indices, index_count);
|
|
meshopt_IndexAdapter<T> in(0, indices, index_count);
|
|
- meshopt_IndexAdapter<T> out(destination, 0, target_index_count);
|
|
|
|
|
|
+ meshopt_IndexAdapter<T> out(destination, 0, index_count);
|
|
|
|
|
|
- return meshopt_simplifySloppy(out.data, in.data, index_count, vertex_positions, vertex_count, vertex_positions_stride, target_index_count);
|
|
|
|
|
|
+ return meshopt_simplifySloppy(out.data, in.data, index_count, vertex_positions, vertex_count, vertex_positions_stride, target_index_count, target_error, result_error);
|
|
}
|
|
}
|
|
|
|
|
|
template <typename T>
|
|
template <typename T>
|