public class VirtualIndexBuffer extends IndexBuffer
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:
Mesh.Mode.Triangles
: 0, 1, 2 | 3, 4, 5 | 6, 7, 8 | ...Mesh.Mode.TriangleStrip
: 0, 1, 2 | 2, 1, 3 | 2, 3, 4 | ...Mesh.Mode.TriangleFan
: 0, 1, 2 | 0, 2, 3 | 0, 3, 4 | ...Modifier and Type | Field and Description |
---|---|
protected Mesh.Mode |
meshMode |
protected int |
numIndices |
protected int |
numVerts |
protected int |
position |
Constructor and Description |
---|
VirtualIndexBuffer(int numVerts,
Mesh.Mode meshMode) |
Modifier and Type | Method and Description |
---|---|
int |
get()
Returns the vertex index for the current position.
|
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 . |
VertexBuffer.Format |
getFormat()
Returns the format of the data stored in this buffer.
|
IndexBuffer |
put(int value)
Relative put method.
|
IndexBuffer |
put(int i,
int value)
Absolute put method.
|
int |
remaining() |
void |
rewind() |
int |
size()
Returns the size of the index buffer.
|
createIndexBuffer, wrapIndexBuffer
protected int numVerts
protected int numIndices
protected Mesh.Mode meshMode
protected int position
public VirtualIndexBuffer(int numVerts, Mesh.Mode meshMode)
public int get()
IndexBuffer
get
in class IndexBuffer
public void rewind()
rewind
in class IndexBuffer
Buffer.rewind()
public int remaining()
remaining
in class IndexBuffer
Buffer.remaining()
public int get(int i)
IndexBuffer
get
in class IndexBuffer
i
- The index inside the index bufferpublic IndexBuffer put(int i, int value)
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).
put
in class IndexBuffer
i
- The buffer indexvalue
- The vertex indexpublic int size()
IndexBuffer
size
in class IndexBuffer
public java.nio.Buffer getBuffer()
IndexBuffer
Buffer
.
Implementations may return null if there's no underlying
buffer.getBuffer
in class IndexBuffer
Buffer
.public IndexBuffer put(int value)
IndexBuffer
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).
put
in class IndexBuffer
value
- The vertex indexpublic VertexBuffer.Format getFormat()
IndexBuffer
This method can be used to set an IndexBuffer
to a
Mesh
:
mesh.setBuffer(Type.Index, 3, indexBuffer.getFormat(), indexBuffer);
getFormat
in class IndexBuffer