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 and Description |
---|
IndexBuffer() |
Modifier and Type | Method and Description |
---|---|
static IndexBuffer |
createIndexBuffer(int vertexCount,
int indexCount)
Create an IndexBuffer with the specified capacity.
|
abstract int |
get()
Returns the vertex index for the current position.
|
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 VertexBuffer.Format |
getFormat()
Returns the format of the data stored in this buffer.
|
abstract IndexBuffer |
put(int value)
Relative put method.
|
abstract IndexBuffer |
put(int i,
int value)
Absolute put method.
|
int |
remaining() |
void |
rewind() |
abstract int |
size()
Returns the size of the index buffer.
|
static IndexBuffer |
wrapIndexBuffer(java.nio.Buffer buf) |
public static IndexBuffer wrapIndexBuffer(java.nio.Buffer buf)
public static IndexBuffer createIndexBuffer(int vertexCount, int indexCount)
vertexCount
- the number of vertices that will be indexed into
(determines number of bits per element)indexCount
- the number of indices the IndexBuffer must hold
(determines number of elements in the buffer)IndexByteBuffer
, an IndexShortBuffer
, or an
IndexIntBuffer
public void rewind()
Buffer.rewind()
public int remaining()
Buffer.remaining()
public abstract int get()
public abstract int get(int i)
i
- The index inside the index bufferpublic abstract IndexBuffer 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).
i
- The buffer indexvalue
- The vertex indexpublic abstract IndexBuffer put(int value)
Puts the vertex index at the current position, then increments the
position. Implementations may throw an
UnsupportedOperationException
if modifying the IndexBuffer is not
supported (e.g. virtual index buffers).
value
- The vertex indexpublic abstract int size()
public abstract java.nio.Buffer getBuffer()
Buffer
.
Implementations may return null if there's no underlying
buffer.Buffer
.public abstract VertexBuffer.Format getFormat()
This method can be used to set an IndexBuffer
to a
Mesh
:
mesh.setBuffer(Type.Index, 3, indexBuffer.getFormat(), indexBuffer);