Class IndexedMesh
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.shapes.infos.IndexedMesh
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
An indexed triangle mesh based on Bullet's
btIndexedMesh
. Immutable.-
Field Summary
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionIndexedMesh
(CollisionShape shape, int meshResolution) Instantiate a IndexedMesh to visualize the specified collision shape.IndexedMesh
(Vector3f[] positionArray, int[] indexArray) Instantiate an IndexedMesh based on the specified positions and indices.IndexedMesh
(FloatBuffer buffer) Instantiate an IndexedMesh based on the specified vertex positions.IndexedMesh
(FloatBuffer positionBuffer, IntBuffer indexBuffer) Instantiate an IndexedMesh based on the specified positions and indices. -
Method Summary
Modifier and TypeMethodDescriptionCopy the triangle indices.void
copyTriangle
(int triangleIndex, Triangle destination) Copy the vertex positions of the specified triangle.Copy the unindexed triangle vertices to a new buffer.Copy the vertex positions to a new buffer.int
Count how many triangles are in this mesh.int
Count how many vertices are in this mesh.float
maxDistance
(Transform meshToWorld) Calculate how far the mesh extends from some origin.void
Find the maximum and minimum coordinates for each axis among the vertices in this mesh.Attempt to divide this mesh into 2 meshes.float
Calculate the (one-sided) surface area of the mesh.float
Calculate volume of the mesh, assuming it's both closed and convex.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
-
IndexedMesh
Instantiate an IndexedMesh based on the specified positions and indices.- Parameters:
positionArray
- (not null, unaffected)indexArray
- (not null, unaffected, length a multiple of 3)
-
IndexedMesh
Instantiate an IndexedMesh based on the specified vertex positions. An index will be assigned to each distinct position.- Parameters:
buffer
- the vertex positions of a non-indexed triangle mesh (not null, flipped, limit a multiple of 9, unaffected)
-
IndexedMesh
Instantiate an IndexedMesh based on the specified positions and indices.- Parameters:
positionBuffer
- (not null, not flipped, length a multiple of 3, alias created)indexBuffer
- (not null, not flipped, length a multiple of 3, alias created)
-
IndexedMesh
Instantiate a IndexedMesh to visualize the specified collision shape.- Parameters:
shape
- shape to visualize (not null, not compound, unaffected)meshResolution
- 0→low, 1→high for convex shapes, 2→high for all shapes
-
-
Method Details
-
copyIndices
Copy the triangle indices.- Returns:
- a new, direct, unflipped buffer
-
copyTriangle
Copy the vertex positions of the specified triangle.- Parameters:
triangleIndex
- the index of the source triangle (≥0)destination
- storage for the result (not null, modified)
-
copyTriangles
Copy the unindexed triangle vertices to a new buffer.- Returns:
- a new, direct, unflipped buffer
-
copyVertexPositions
Copy the vertex positions to a new buffer.- Returns:
- a new, direct, unflipped buffer
-
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)
-
maxDistance
Calculate how far the mesh extends from some origin.- Parameters:
meshToWorld
- the transform to apply to vertex locations (not null, unaffected)- Returns:
- the maximum length of the transformed vectors (≥0)
-
maxMin
Find the maximum and minimum coordinates for each axis among the vertices in this mesh.- Parameters:
storeMaxima
- storage for the maxima (not null, modified)storeMinima
- storage for the minima (not null, modified)
-
split
Attempt to divide this mesh into 2 meshes.- Parameters:
splittingPlane
- the splitting plane (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
-
surfaceArea
public float surfaceArea()Calculate the (one-sided) surface area of the mesh.- Returns:
- the area (in square mesh units, ≥0)
-
volumeConvex
public float volumeConvex()Calculate volume of the mesh, assuming it's both closed and convex.- Returns:
- the volume (in cubic mesh units, ≥0)
-