Package com.jme3.scene.mesh
Class IndexBuffer
java.lang.Object
com.jme3.scene.mesh.IndexBuffer
- Direct Known Subclasses:
IndexByteBuffer,IndexIntBuffer,IndexShortBuffer,VirtualIndexBuffer
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IndexBuffercreateIndexBuffer(int vertexCount, int indexCount) Create an IndexBuffer with the specified capacity.abstract intget()Returns the vertex index for the current position.abstract intget(int i) Returns the vertex index for the given index in the index buffer.abstract BufferReturns the underlying data-type specificBuffer.abstract VertexBuffer.FormatReturns the format of the data stored in this buffer.abstract IndexBufferput(int value) Relative put method.abstract IndexBufferput(int i, int value) Absolute put method.intvoidrewind()abstract intsize()Returns the size of the index buffer.static IndexBufferwrapIndexBuffer(Buffer buf)
-
Constructor Details
-
IndexBuffer
public IndexBuffer()
-
-
Method Details
-
wrapIndexBuffer
-
createIndexBuffer
Create an IndexBuffer with the specified capacity.- Parameters:
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)- Returns:
- a new, appropriately sized IndexBuffer, which may be an
IndexByteBuffer, anIndexShortBuffer, or anIndexIntBuffer
-
rewind
public void rewind()- See Also:
-
remaining
public int remaining()- Returns:
- the count (≥0)
- See Also:
-
get
public abstract int get()Returns the vertex index for the current position.- Returns:
- the index
-
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:
- the index
-
put
Absolute put method.Puts the vertex index at the index buffer's index. Implementations may throw an
UnsupportedOperationExceptionif modifying the IndexBuffer is not supported (e.g. virtual index buffers).- Parameters:
i- The buffer indexvalue- The vertex index- Returns:
- This buffer
-
put
Relative put method.Puts the vertex index at the current position, then increments the position. Implementations may throw an
UnsupportedOperationExceptionif modifying the IndexBuffer is not supported (e.g. virtual index buffers).- Parameters:
value- The vertex index- Returns:
- This buffer
-
size
public abstract int size()Returns the size of the index buffer.- Returns:
- the size of the index buffer.
-
getBuffer
Returns the underlying data-type specificBuffer. Implementations may return null if there's no underlying buffer.- Returns:
- the underlying
Buffer.
-
getFormat
Returns the format of the data stored in this buffer.This method can be used to set an
IndexBufferto aMesh:mesh.setBuffer(Type.Index, 3, indexBuffer.getFormat(), indexBuffer);- Returns:
- an enum value
-