Class CompoundMesh
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.shapes.infos.CompoundMesh
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
A scalable mesh that combines multiple indexed meshes. Based on Bullet's
btTriangleIndexVertexArray
.-
Field Summary
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionInstantiate an empty mesh.CompoundMesh
(CompoundMesh original) Copy an existing mesh.CompoundMesh
(CompoundMesh base, Vector3f offset) Instantiate a mesh by applying an offset to an existing mesh. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
add
(IndexedMesh submesh) Add a submesh to this mesh.int
Count how many submeshes are in this mesh.int
Count how many triangles are in this mesh.int
Count how many vertices are in this mesh.Copy the scale factors.getSubmesh
(int index) Access the specified submesh.void
Find the maximum and minimum coordinates for each local axis among the scaled vertices in this mesh.void
Alter the scale factors.Attempt to divide this mesh into 2 meshes.Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, toString, unassignNativeObject
-
Field Details
-
logger
message logger for this class
-
-
Constructor Details
-
CompoundMesh
public CompoundMesh()Instantiate an empty mesh. -
CompoundMesh
Copy an existing mesh.- Parameters:
original
- the mesh to copy (not null, unaffected)
-
CompoundMesh
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
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
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
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
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
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
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
-