Class NativeSoftBodyUtil

java.lang.Object
com.jme3.bullet.util.NativeSoftBodyUtil

public final class NativeSoftBodyUtil extends Object
A utility class for interfacing with Native Bullet, specifically for soft bodies.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
    message logger for this class
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    appendFromLineMesh(com.jme3.scene.Mesh mesh, PhysicsSoftBody softBody)
    Append the edges in the specified line-mode Mesh to the specified soft body.
    static void
    Add the triangles and unique edges in the specified native mesh to the specified soft body.
    static void
    appendFromTriMesh(com.jme3.scene.Mesh mesh, PhysicsSoftBody softBody)
    Add the triangles and unique edges in the specified JME mesh to the specified soft body.
    static void
    Append tetrahedra to the specified soft body, one per face, connecting its faces with the center of its axis-aligned bounding box.
    static IntBuffer
    generateIndexMap(FloatBuffer positionBuffer)
    Create an index map to merge any mesh vertices that share the same position.
    static com.jme3.scene.mesh.IndexBuffer
    mapIndices(IntBuffer indexMap, com.jme3.scene.mesh.IndexBuffer inputBuffer, com.jme3.scene.mesh.IndexBuffer reuseBuffer)
    Map all indices in the specified input buffer using the specified map buffer.
    mapVertexData(IntBuffer indexMap, 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, com.jme3.scene.Mesh store, boolean meshInLocalSpace)
    Update the position buffer of a Mesh from the clusters in the specified soft body.
    static void
    updateMesh(PhysicsSoftBody body, IntBuffer vertexToNodeMap, com.jme3.scene.Mesh store, boolean meshInLocalSpace, boolean updateNormals, com.jme3.math.Transform physicsToMesh)
    Update the position/normal buffers of a Mesh from the nodes in the specified soft body.
    static void
    updatePinMesh(PhysicsSoftBody body, com.jme3.scene.Mesh store, boolean meshInLocalSpace)
    Update the position buffer of a Mesh from the pinned nodes in the specified soft body.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Method Details

    • appendFromLineMesh

      public static void appendFromLineMesh(com.jme3.scene.Mesh mesh, PhysicsSoftBody softBody)
      Append the edges in the specified line-mode Mesh to the specified soft body.
      Parameters:
      mesh - the input JME 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)
    • appendFromNativeMesh

      public static void appendFromNativeMesh(IndexedMesh mesh, PhysicsSoftBody softBody)
      Add the triangles and unique edges in the specified native mesh to the specified soft body.
      Parameters:
      mesh - the input native mesh (not null)
      softBody - the soft body to which faces and links will be added (not null, modified)
    • appendFromTriMesh

      public static void appendFromTriMesh(com.jme3.scene.Mesh mesh, PhysicsSoftBody softBody)
      Add the triangles and unique edges in the specified JME mesh to the specified soft body.
      Parameters:
      mesh - the input JME 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)
    • appendTetras

      public 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.
      Parameters:
      softBody - the soft body to append to (not null, modified)
    • generateIndexMap

      public static IntBuffer generateIndexMap(FloatBuffer positionBuffer)
      Create an index map to merge any mesh vertices that share the same position. Other vertex properties (such as bone weights, normals, and texture coordinates) are ignored.
      Parameters:
      positionBuffer - the buffer of mesh-vertex positions (not null, limit a multiple of 3, unaffected)
      Returns:
      a new index map (not null)
    • mapIndices

      public static com.jme3.scene.mesh.IndexBuffer mapIndices(IntBuffer indexMap, com.jme3.scene.mesh.IndexBuffer inputBuffer, com.jme3.scene.mesh.IndexBuffer reuseBuffer)
      Map all indices in the specified input buffer using the specified map buffer.
      Parameters:
      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)
      Returns:
      a buffer containing mapped indices (either reuseBuffer or a new buffer, not null)
    • mapVertexData

      public static FloatBuffer mapVertexData(IntBuffer indexMap, FloatBuffer inputBuffer, int numFloatsPerVertex)
      Copy all vertex data in the specified input buffer, using the specified map buffer to map vertex indices.
      Parameters:
      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)
      Returns:
      a new buffer containing mapped vertex data
    • updateClusterMesh

      public static void updateClusterMesh(PhysicsSoftBody body, com.jme3.scene.Mesh store, boolean meshInLocalSpace)
      Update the position buffer of a Mesh from the clusters in the specified soft body.
      Parameters:
      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 coordinates
    • updateMesh

      public static void updateMesh(PhysicsSoftBody body, IntBuffer vertexToNodeMap, com.jme3.scene.Mesh store, boolean meshInLocalSpace, boolean updateNormals, com.jme3.math.Transform physicsToMesh)
      Update the position/normal buffers of a Mesh from the nodes in the specified soft body. Mesh-vertex indices may be mapped to body-node indices, and physics-space locations may be transformed into mesh positions.
      Parameters:
      body - the soft body to provide locations and normals (not null, unaffected)
      vertexToNodeMap - the index map to apply (must be direct) or null for identity
      store - 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 coordinates
      updateNormals - if true, update the normal buffer, otherwise ignore the normal buffer
      physicsToMesh - the coordinate transform to apply, or null for identity (unaffected)
    • updatePinMesh

      public static void updatePinMesh(PhysicsSoftBody body, com.jme3.scene.Mesh store, boolean meshInLocalSpace)
      Update the position buffer of a Mesh from the pinned nodes in the specified soft body.
      Parameters:
      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