com.jme3.scene.mesh
Class IndexBuffer

java.lang.Object
  extended by com.jme3.scene.mesh.IndexBuffer
Direct Known Subclasses:
IndexByteBuffer, IndexIntBuffer, IndexShortBuffer, VirtualIndexBuffer

public abstract class IndexBuffer
extends java.lang.Object

IndexBuffer is an abstraction for integer index buffers, it is used to retrieve indices without knowing in which format they are stored (ushort or uint).


Constructor Summary
IndexBuffer()
           
 
Method Summary
static IndexBuffer createIndexBuffer(int vertexCount, int indexCount)
          Creates an index buffer that can contain the given amount of vertices.
abstract  int get(int i)
          Returns the vertex index for the given index in the index buffer.
abstract  java.nio.Buffer getBuffer()
          Returns the underlying data-type specific Buffer.
abstract  void put(int i, int value)
          Puts the vertex index at the index buffer's index.
abstract  int size()
          Returns the size of the index buffer.
static IndexBuffer wrapIndexBuffer(java.nio.Buffer buf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexBuffer

public IndexBuffer()
Method Detail

wrapIndexBuffer

public static IndexBuffer wrapIndexBuffer(java.nio.Buffer buf)

createIndexBuffer

public static IndexBuffer createIndexBuffer(int vertexCount,
                                            int indexCount)
Creates an index buffer that can contain the given amount of vertices. Returns IndexShortBuffer

Parameters:
vertexCount - The amount of vertices to contain
indexCount - The amount of indices to contain.
Returns:
A new index buffer

get

public abstract int get(int i)
Returns the vertex index for the given index in the index buffer.

Parameters:
i - The index inside the index buffer
Returns:

put

public abstract void put(int i,
                         int value)
Puts the vertex index at the index buffer's index. Implementations may throw an UnsupportedOperationException if modifying the IndexBuffer is not supported (e.g. virtual index buffers).


size

public abstract int size()
Returns the size of the index buffer.

Returns:
the size of the index buffer.

getBuffer

public abstract java.nio.Buffer getBuffer()
Returns the underlying data-type specific Buffer. Implementations may return null if there's no underlying buffer.

Returns:
the underlying Buffer.