com.bulletphysics.collision.shapes
Class TriangleIndexVertexArray

java.lang.Object
  extended by com.bulletphysics.collision.shapes.StridingMeshInterface
      extended by com.bulletphysics.collision.shapes.TriangleIndexVertexArray

public class TriangleIndexVertexArray
extends StridingMeshInterface

TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays. Additional meshes can be added using addIndexedMesh.

No duplicate is made of the vertex/index data, it only indexes into external vertex/index arrays. So keep those arrays around during the lifetime of this TriangleIndexVertexArray.


Constructor Summary
TriangleIndexVertexArray()
           
TriangleIndexVertexArray(int numTriangles, ByteBuffer triangleIndexBase, int triangleIndexStride, int numVertices, ByteBuffer vertexBase, int vertexStride)
          Just to be backwards compatible.
 
Method Summary
 void addIndexedMesh(IndexedMesh mesh)
           
 void addIndexedMesh(IndexedMesh mesh, ScalarType indexType)
           
 ObjectArrayList<IndexedMesh> getIndexedMeshArray()
           
 VertexData getLockedReadOnlyVertexIndexBase(int subpart)
           
 VertexData getLockedVertexIndexBase(int subpart)
          Get read and write access to a subpart of a triangle mesh.
 int getNumSubParts()
          getNumSubParts returns the number of seperate subparts.
 void preallocateIndices(int numindices)
           
 void preallocateVertices(int numverts)
           
 void unLockReadOnlyVertexBase(int subpart)
           
 void unLockVertexBase(int subpart)
          unLockVertexBase finishes the access to a subpart of the triangle mesh.
 
Methods inherited from class com.bulletphysics.collision.shapes.StridingMeshInterface
calculateAabbBruteForce, getScaling, internalProcessAllTriangles, setScaling
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriangleIndexVertexArray

public TriangleIndexVertexArray()

TriangleIndexVertexArray

public TriangleIndexVertexArray(int numTriangles,
                                ByteBuffer triangleIndexBase,
                                int triangleIndexStride,
                                int numVertices,
                                ByteBuffer vertexBase,
                                int vertexStride)
Just to be backwards compatible.

Method Detail

addIndexedMesh

public void addIndexedMesh(IndexedMesh mesh)

addIndexedMesh

public void addIndexedMesh(IndexedMesh mesh,
                           ScalarType indexType)

getLockedVertexIndexBase

public VertexData getLockedVertexIndexBase(int subpart)
Description copied from class: StridingMeshInterface
Get read and write access to a subpart of a triangle mesh. This subpart has a continuous array of vertices and indices. In this way the mesh can be handled as chunks of memory with striding very similar to OpenGL vertexarray support. Make a call to unLockVertexBase when the read and write access is finished.

Specified by:
getLockedVertexIndexBase in class StridingMeshInterface

getLockedReadOnlyVertexIndexBase

public VertexData getLockedReadOnlyVertexIndexBase(int subpart)
Specified by:
getLockedReadOnlyVertexIndexBase in class StridingMeshInterface

unLockVertexBase

public void unLockVertexBase(int subpart)
unLockVertexBase finishes the access to a subpart of the triangle mesh. Make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished.

Specified by:
unLockVertexBase in class StridingMeshInterface

unLockReadOnlyVertexBase

public void unLockReadOnlyVertexBase(int subpart)
Specified by:
unLockReadOnlyVertexBase in class StridingMeshInterface

getNumSubParts

public int getNumSubParts()
getNumSubParts returns the number of seperate subparts. Each subpart has a continuous array of vertices and indices.

Specified by:
getNumSubParts in class StridingMeshInterface

getIndexedMeshArray

public ObjectArrayList<IndexedMesh> getIndexedMeshArray()

preallocateVertices

public void preallocateVertices(int numverts)
Specified by:
preallocateVertices in class StridingMeshInterface

preallocateIndices

public void preallocateIndices(int numindices)
Specified by:
preallocateIndices in class StridingMeshInterface