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)
Creates an index buffer that can contain the given amount of vertices.
|
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)
IndexByteBuffer
, IndexShortBuffer
or
IndexIntBuffer
vertexCount
- The amount of vertices to containindexCount
- The amount of indices to containpublic 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);