java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.vhacd.Decomposer
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Decompose 3-D meshes into collections of convex hulls using Khaled Mamou's
Volumetric-Hierarchical Approximate Convex Decomposition (V-HACD) algorithm.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProgressListener
(ProgressListener listener) Register the specified progress listener.decompose
(float[] locations, int[] indices, Parameters params) Generate convex hulls to approximate the specified mesh.decompose
(FloatBuffer locations, IntBuffer indices, Parameters params) Generate convex hulls to approximate the specified mesh.void
removeProgressListener
(ProgressListener listener) De-register the specified progress listener.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
Decomposer
public Decomposer()Instantiate a default instance.
-
-
Method Details
-
addProgressListener
Register the specified progress listener.- Parameters:
listener
- the listener to register (not null, alias created)- Returns:
- the modified properties, for chaining
-
decompose
Generate convex hulls to approximate the specified mesh.- Parameters:
locations
- the locations of all mesh vertices (not null, length a multiple of 3, unaffected)indices
- the vertex indices of all mesh triangles (not null, length a multiple of 3, unaffected)params
- the tuning parameters to use (not null, unaffected)- Returns:
- a new unmodifiable collection of hulls, or an empty collection if the algorithm failed
-
decompose
public Collection<ConvexHull> decompose(FloatBuffer locations, IntBuffer indices, Parameters params) Generate convex hulls to approximate the specified mesh.- Parameters:
locations
- the locations of all mesh vertices (not null, direct, capacity a multiple of 3, unaffected)indices
- the vertex indices of all mesh triangles (not null, direct, capacity a multiple of 3, unaffected)params
- the tuning parameters to use (not null, unaffected)- Returns:
- a new unmodifiable collection of hulls, or an empty collection if the algorithm failed
-
removeProgressListener
De-register the specified progress listener.- Parameters:
listener
- the listener to de-register (not null, unaffected)
-