com.jme3.scene.mesh
Class VirtualIndexBuffer

java.lang.Object
  extended by com.jme3.scene.mesh.IndexBuffer
      extended by com.jme3.scene.mesh.VirtualIndexBuffer
Direct Known Subclasses:
WrappedIndexBuffer

public class VirtualIndexBuffer
extends IndexBuffer

IndexBuffer implementation that generates vertex indices sequentially based on a specific Mesh Mesh.Mode. The generated indices are as if the mesh is in the given mode but contains no index buffer, thus this implementation will return the indices if the index buffer was there and contained sequential triangles. Example:


Field Summary
protected  Mesh.Mode meshMode
           
protected  int numIndices
           
protected  int numVerts
           
 
Constructor Summary
VirtualIndexBuffer(int numVerts, Mesh.Mode meshMode)
           
 
Method Summary
 int get(int i)
          Returns the vertex index for the given index in the index buffer.
 java.nio.Buffer getBuffer()
          Returns the underlying data-type specific Buffer.
 void put(int i, int value)
          Puts the vertex index at the index buffer's index.
 int size()
          Returns the size of the index buffer.
 
Methods inherited from class com.jme3.scene.mesh.IndexBuffer
createIndexBuffer, wrapIndexBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numVerts

protected int numVerts

numIndices

protected int numIndices

meshMode

protected Mesh.Mode meshMode
Constructor Detail

VirtualIndexBuffer

public VirtualIndexBuffer(int numVerts,
                          Mesh.Mode meshMode)
Method Detail

get

public int get(int i)
Description copied from class: IndexBuffer
Returns the vertex index for the given index in the index buffer.

Specified by:
get in class IndexBuffer
Parameters:
i - The index inside the index buffer
Returns:

put

public void put(int i,
                int value)
Description copied from class: IndexBuffer
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).

Specified by:
put in class IndexBuffer

size

public int size()
Description copied from class: IndexBuffer
Returns the size of the index buffer.

Specified by:
size in class IndexBuffer
Returns:
the size of the index buffer.

getBuffer

public java.nio.Buffer getBuffer()
Description copied from class: IndexBuffer
Returns the underlying data-type specific Buffer. Implementations may return null if there's no underlying buffer.

Specified by:
getBuffer in class IndexBuffer
Returns:
the underlying Buffer.