public final class NativeSoftBodyUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Logger |
logger
message logger for this class
|
| Modifier and Type | Method and Description |
|---|---|
static void |
appendFromLineMesh(Mesh mesh,
PhysicsSoftBody softBody)
Append the edges in the specified line-mode Mesh to the specified soft
body.
|
static void |
appendFromNativeMesh(IndexedMesh mesh,
PhysicsSoftBody softBody)
Add the triangles and unique edges in the specified native mesh to the
specified soft body.
|
static void |
appendFromTriMesh(Mesh mesh,
PhysicsSoftBody softBody)
Add the triangles and unique edges in the specified LBJ mesh to the
specified soft body.
|
static void |
appendTetras(PhysicsSoftBody softBody)
Append tetrahedra to the specified soft body, one per face, connecting
its faces with the center of its axis-aligned bounding box.
|
static java.nio.IntBuffer |
generateIndexMap(java.nio.FloatBuffer positionBuffer)
Create an index map to merge any mesh vertices that share the same
position.
|
static IndexBuffer |
mapIndices(java.nio.IntBuffer indexMap,
IndexBuffer inputBuffer,
IndexBuffer reuseBuffer)
Map all indices in the specified input buffer using the specified map
buffer.
|
static java.nio.FloatBuffer |
mapVertexData(java.nio.IntBuffer indexMap,
java.nio.FloatBuffer inputBuffer,
int numFloatsPerVertex)
Copy all vertex data in the specified input buffer, using the specified
map buffer to map vertex indices.
|
static void |
updateClusterMesh(PhysicsSoftBody body,
Mesh store,
boolean meshInLocalSpace)
Update the position buffer of a Mesh from the clusters in the specified
soft body.
|
static void |
updateMesh(PhysicsSoftBody body,
java.nio.IntBuffer vertexToNodeMap,
Mesh store,
boolean meshInLocalSpace,
boolean updateNormals,
Transform physicsToMesh)
Update the position/normal buffers of a Mesh from the nodes in the
specified soft body.
|
static void |
updatePinMesh(PhysicsSoftBody body,
Mesh store,
boolean meshInLocalSpace)
Update the position buffer of a Mesh from the pinned nodes in the
specified soft body.
|
public static final java.util.logging.Logger logger
public static void appendFromLineMesh(Mesh mesh, PhysicsSoftBody softBody)
mesh - the input LBJ mesh (not null, unaffected, mode=Lines,
position and index buffers must be direct)softBody - the soft body to which links will be added (not null,
modified)public static void appendFromNativeMesh(IndexedMesh mesh, PhysicsSoftBody softBody)
mesh - the input native mesh (not null)softBody - the soft body to which faces and links will be added (not
null, modified)public static void appendFromTriMesh(Mesh mesh, PhysicsSoftBody softBody)
mesh - the input LBJ mesh (not null, unaffected, mode=Triangles,
position and index buffers must be direct)softBody - the soft body to which faces and links will be added (not
null, modified)public static void appendTetras(PhysicsSoftBody softBody)
softBody - the soft body to append to (not null, modified)public static java.nio.IntBuffer generateIndexMap(java.nio.FloatBuffer positionBuffer)
positionBuffer - the buffer of mesh-vertex positions (not null,
limit a multiple of 3, unaffected)public static IndexBuffer mapIndices(java.nio.IntBuffer indexMap, IndexBuffer inputBuffer, IndexBuffer reuseBuffer)
indexMap - the buffer to use to map input indices to result indices
(not null, unaffected)inputBuffer - the input buffer to map (not null, unaffected)reuseBuffer - the buffer to reuse for output, or null if none
(modified)public static java.nio.FloatBuffer mapVertexData(java.nio.IntBuffer indexMap,
java.nio.FloatBuffer inputBuffer,
int numFloatsPerVertex)
indexMap - the buffer to use to map input indices to result indices
(not null, unaffected)inputBuffer - the input buffer to map (not null, length a multiple
of numFloatsPerVertex, unaffected)numFloatsPerVertex - the number of float components per vertex
(>0)public static void updateClusterMesh(PhysicsSoftBody body, Mesh store, boolean meshInLocalSpace)
body - the soft body to provide locations (not null, unaffected)store - the Mesh to update (not null, position buffer must be
direct, modified)meshInLocalSpace - if true, transform the cluster locations into the
body's local coordinates (relative to its bounding-box center), otherwise
use physics-space coordinatespublic static void updateMesh(PhysicsSoftBody body, java.nio.IntBuffer vertexToNodeMap, Mesh store, boolean meshInLocalSpace, boolean updateNormals, Transform physicsToMesh)
body - the soft body to provide locations and normals (not null,
unaffected)vertexToNodeMap - the index map to apply (must be direct) or null
for identitystore - the Mesh to update (not null, position, normal, and index
buffers must be direct, modified)meshInLocalSpace - if true, transform node locations into the body's
local coordinates (relative to its bounding-box center), otherwise use
physics-space coordinatesupdateNormals - if true, update the normal buffer, otherwise ignore
the normal bufferphysicsToMesh - the coordinate transform to apply, or null for
identity (unaffected)public static void updatePinMesh(PhysicsSoftBody body, Mesh store, boolean meshInLocalSpace)
body - the soft body to provide locations (not null, unaffected)store - the Mesh to update (not null, position buffer must be
direct, modified)meshInLocalSpace - if true, transform the pin locations into the
body's local coordinates (relative to its bounding-box center), otherwise
use physics-space coordinates