Class CompoundMesh

java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.shapes.infos.CompoundMesh
All Implemented Interfaces:
Comparable<NativePhysicsObject>

public class CompoundMesh extends NativePhysicsObject
A scalable mesh that combines multiple indexed meshes. Based on Bullet's btTriangleIndexVertexArray.
  • Field Details

    • logger

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

    • CompoundMesh

      public CompoundMesh()
      Instantiate an empty mesh.
    • CompoundMesh

      public CompoundMesh(CompoundMesh original)
      Copy an existing mesh.
      Parameters:
      original - the mesh to copy (not null, unaffected)
    • CompoundMesh

      public CompoundMesh(CompoundMesh base, Vector3f offset)
      Instantiate a mesh by applying an offset to an existing mesh.
      Parameters:
      base - the mesh to use as a base (not null, unaffected)
      offset - the offset to add to the scaled vertex positions (not null, unaffected)
  • Method Details

    • add

      public final void add(IndexedMesh submesh)
      Add a submesh to this mesh.
      Parameters:
      submesh - (not null, alias created)
    • countSubmeshes

      public int countSubmeshes()
      Count how many submeshes are in this mesh.
      Returns:
      the count (≥0)
    • countTriangles

      public int countTriangles()
      Count how many triangles are in this mesh.
      Returns:
      the count (≥0)
    • countVertices

      public int countVertices()
      Count how many vertices are in this mesh.
      Returns:
      the count (≥0)
    • getScale

      public Vector3f getScale(Vector3f storeResult)
      Copy the scale factors.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the scale factor for each local axis (either storeResult or a new vector, not null)
    • getSubmesh

      public IndexedMesh getSubmesh(int index)
      Access the specified submesh.
      Parameters:
      index - the index of the desired submesh (in the order the submeshes were added, ≥0)
      Returns:
      the pre-existing instance (not null)
    • maxMin

      public void maxMin(Vector3f storeMaxima, Vector3f storeMinima)
      Find the maximum and minimum coordinates for each local axis among the scaled vertices in this mesh.
      Parameters:
      storeMaxima - storage for the maxima (not null, modified)
      storeMinima - storage for the minima (not null, modified)
    • setScale

      public void setScale(Vector3f scale)
      Alter the scale factors.
      Parameters:
      scale - the desired scale factor for each local axis (not null, no negative component, unaffected, default=(1,1,1))
    • split

      public CompoundMesh[] split(Triangle scaledTriangle)
      Attempt to divide this mesh into 2 meshes.
      Parameters:
      scaledTriangle - to define the splitting plane (in scaled coordinates, not null, unaffected)
      Returns:
      a pair of meshes, the first mesh generated by the plane's minus side and the 2nd mesh generated by its plus side; either mesh may be null, indicating an empty mesh