Class MeshShapeSettings

All Implemented Interfaces:
ConstJoltPhysicsObject, ConstMeshShapeSettings, ConstSerializableObject, ConstShapeSettings, RefTarget, AutoCloseable, Comparable<JoltPhysicsObject>

public class MeshShapeSettings extends ShapeSettings implements ConstMeshShapeSettings
Settings used to construct a MeshShape.
  • Constructor Details

    • MeshShapeSettings

      public MeshShapeSettings()
      Instantiate the default settings.
    • MeshShapeSettings

      public MeshShapeSettings(ConstFloat3[] vertices, IndexedTriangleList indices)
      Instantiate settings for the specified vertices and triangles.
      Parameters:
      vertices - the array of vertices (not null, unaffected)
      indices - the list of triangles (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(ConstFloat3[] vertexArray, IndexedTriangle... itArray)
      Instantiate settings for the specified vertices and triangles.
      Parameters:
      vertexArray - the array of vertices (not null, unaffected)
      itArray - the array of triangles (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(ConstMeshShapeSettings original)
      Instantiate a copy of the specified settings.
      Parameters:
      original - the settings to copy (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(ConstTriangle... triangleArray)
      Instantiate settings for the specified array of triangles.
      Parameters:
      triangleArray - the array of triangles (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(ConstTriangle[] triangleArray, PhysicsMaterialList materials)
      Instantiate settings for the specified parameters.
      Parameters:
      triangleArray - the array of triangles (not null, unaffected)
      materials - the desired surface properties (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(ConstVertexList vertices, IndexedTriangleList indices)
      Instantiate settings for the specified vertices and indices.
      Parameters:
      vertices - list of vertex locations (not null, unaffected)
      indices - list of triangles that use those vertices (not null)
    • MeshShapeSettings

      public MeshShapeSettings(FloatBuffer positionBuffer)
      Instantiate settings for the specified vertices without indices.
      Parameters:
      positionBuffer - the vertex positions (not null, capacity a multiple of 9, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(List<ConstFloat3> vertices, IndexedTriangleList indices)
      Instantiate settings for the specified lists of vertices and triangles.
      Parameters:
      vertices - the list of vertices (not null, unaffected)
      indices - the list of triangles (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(List<? extends ConstTriangle> triangleList)
      Instantiate settings for the specified list of triangles.
      Parameters:
      triangleList - the list of triangles (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(List<? extends ConstTriangle> triangleList, PhysicsMaterialList materials)
      Instantiate settings for the specified parameters.
      Parameters:
      triangleList - the list of triangles (not null, unaffected)
      materials - the desired surface properties (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(TriangleList triangleList)
      Instantiate settings for the specified list of triangles.
      Parameters:
      triangleList - the list of triangles (not null, unaffected)
    • MeshShapeSettings

      public MeshShapeSettings(TriangleList triangleList, PhysicsMaterialList materials)
      Instantiate settings for the specified parameters.
      Parameters:
      triangleList - the list of triangles (not null, unaffected)
      materials - the desired surface properties (not null, unaffected)
  • Method Details

    • addIndexedTriangle

      public void addIndexedTriangle(int vi0, int vi1, int vi2)
      Append the specified triangle to the internal array.
      Parameters:
      vi0 - the desired first mesh-vertex index
      vi1 - the desired 2nd mesh-vertex index
      vi2 - the desired 3rd mesh-vertex index
    • addTriangleVertex

      public void addTriangleVertex(ConstFloat3 vertex)
      Append the specified vertex to the internal array.
      Parameters:
      vertex - the location of the vertex to add (not null, unaffected)
    • getIndexedTriangles

      public IndexedTriangleList getIndexedTriangles()
      Access the list of indexed triangles. (native attribute: mIndexedTriangles)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getMaterials

      public PhysicsMaterialList getMaterials()
      Access the list of physics materials. (native attribute: mMaterials)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • reserveIndexedTriangles

      public void reserveIndexedTriangles(int numTriangles)
      Reserve storage for the specified number of triangles.
      Parameters:
      numTriangles - the desired capacity
    • reserveTriangleVertices

      public void reserveTriangleVertices(int numVertices)
      Reserve storage for the specified number of vertices.
      Parameters:
      numVertices - the desired capacity
    • sanitize

      public void sanitize()
      Sanitize the mesh data to remove degenerate and duplicate triangles.
    • set

      public void set(ConstMeshShapeSettings source)
      Copy the argument to the current settings.
      Parameters:
      source - the settings to copy (not null, unaffected)
    • setActiveEdgeCosThresholdAngle

      public void setActiveEdgeCosThresholdAngle(float cosine)
      Alter the active-edge threshold angle. (native attribute: mActiveEdgeCosThresholdAngle)
      Parameters:
      cosine - the cosine of the desired angle (default=0.996195)
    • setBuildQuality

      public void setBuildQuality(EBuildQuality quality)
      Alter the build quality. (native attribute: mBuildQuality)
      Parameters:
      quality - the desired quality (not null, default=FavorRuntimePerformance)
    • setMaxTrianglesPerLeaf

      public void setMaxTrianglesPerLeaf(int numTriangles)
      Alter the maximum number of triangles per leaf. (native attribute: mMaxTrianglesPerLeaf)
      Parameters:
      numTriangles - the desired number (default=8)
    • setPerTriangleUserData

      public void setPerTriangleUserData(boolean include)
      Alter whether each triangle will include user data. (native attribute: mPerTriangleUserData)
      Parameters:
      include - true to include per-triangle data, false to omit it (default=false)
    • countMaterials

      public int countMaterials()
      Count the physics materials. The settings are unaffected.
      Specified by:
      countMaterials in interface ConstMeshShapeSettings
      Returns:
      the count (≥0)
    • countTriangles

      public int countTriangles()
      Count the triangles in the mesh. The settings are unaffected.
      Specified by:
      countTriangles in interface ConstMeshShapeSettings
      Returns:
      the count (≥0)
    • countTriangleVertices

      public int countTriangleVertices()
      Count the vertices in the mesh. The settings are unaffected.
      Specified by:
      countTriangleVertices in interface ConstMeshShapeSettings
      Returns:
      the count (≥0)
    • getActiveEdgeCosThresholdAngle

      public float getActiveEdgeCosThresholdAngle()
      Return the cosine of the active-edge threshold angle. The settings are unaffected. (native attribute: mActiveEdgeCosThresholdAngle)
      Specified by:
      getActiveEdgeCosThresholdAngle in interface ConstMeshShapeSettings
      Returns:
      the cosine
    • getBuildQuality

      public EBuildQuality getBuildQuality()
      Return the build quality. The settings are unaffected. (native attribute: mBuildQuality)
      Specified by:
      getBuildQuality in interface ConstMeshShapeSettings
      Returns:
      an enum value (not null)
    • getTriangleVertex

      public Float3 getTriangleVertex(int vertexIndex)
      Copy the specified vertex. The settings are unaffected.
      Specified by:
      getTriangleVertex in interface ConstMeshShapeSettings
      Parameters:
      vertexIndex - the index of the vertex to copy (≥0)
      Returns:
      a new vector
    • getTriangleVertices

      public VertexList getTriangleVertices()
      Copy the vertex list. The settings are unaffected. (native attribute: mTriangleVertices)
      Specified by:
      getTriangleVertices in interface ConstMeshShapeSettings
      Returns:
      a new object
    • getMaxTrianglesPerLeaf

      public int getMaxTrianglesPerLeaf()
      Return the maximum number of triangles per leaf. The settings are unaffected. (native attribute: mMaxTrianglesPerLeaf)
      Specified by:
      getMaxTrianglesPerLeaf in interface ConstMeshShapeSettings
      Returns:
      the maximum number
    • getPerTriangleUserData

      public boolean getPerTriangleUserData()
      Test whether each triangle will include user data. The settings are unaffected. (native attribute: mPerTriangleUserData)
      Specified by:
      getPerTriangleUserData in interface ConstMeshShapeSettings
      Returns:
      true if per-triangle data is included, otherwise false