Package com.jme3.scene.mesh
Class IndexByteBuffer
java.lang.Object
com.jme3.scene.mesh.IndexBuffer
com.jme3.scene.mesh.IndexByteBuffer
IndexBuffer implementation for
ByteBuffer
s.-
Constructor Summary
ConstructorDescriptionIndexByteBuffer
(ByteBuffer buffer) Instantiate an IndexBuffer using the specified ByteBuffer and a maximum index value of 255.IndexByteBuffer
(ByteBuffer buffer, int maxValue) Instantiate an IndexBuffer using the specified ByteBuffer and set its maximum index value. -
Method Summary
Modifier and TypeMethodDescriptionint
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.Returns the underlying data-type specificBuffer
.Returns the format of the data stored in this buffer.put
(int value) Relative put method.put
(int i, int value) Absolute put method.int
size()
Returns the size of the index buffer.Methods inherited from class com.jme3.scene.mesh.IndexBuffer
createIndexBuffer, remaining, rewind, wrapIndexBuffer
-
Constructor Details
-
IndexByteBuffer
Instantiate an IndexBuffer using the specified ByteBuffer and a maximum index value of 255.- Parameters:
buffer
- a pre-existing buffer (not null, alias created)
-
IndexByteBuffer
Instantiate an IndexBuffer using the specified ByteBuffer and set its maximum index value.- Parameters:
buffer
- a pre-existing buffer (not null, alias created)maxValue
- the desired maximum index value (≥0, ≤255)
-
-
Method Details
-
get
public int get()Description copied from class:IndexBuffer
Returns the vertex index for the current position.- Specified by:
get
in classIndexBuffer
- Returns:
- the index
-
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 classIndexBuffer
- Parameters:
i
- The index inside the index buffer- Returns:
- the index
-
put
Description copied from class:IndexBuffer
Absolute put method.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 classIndexBuffer
- Parameters:
i
- The buffer indexvalue
- The vertex index- Returns:
- This buffer
-
put
Description copied from class:IndexBuffer
Relative put method.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).- Specified by:
put
in classIndexBuffer
- Parameters:
value
- The vertex index- Returns:
- This buffer
-
size
public int size()Description copied from class:IndexBuffer
Returns the size of the index buffer.- Specified by:
size
in classIndexBuffer
- Returns:
- the size of the index buffer.
-
getBuffer
Description copied from class:IndexBuffer
Returns the underlying data-type specificBuffer
. Implementations may return null if there's no underlying buffer.- Specified by:
getBuffer
in classIndexBuffer
- Returns:
- the underlying
Buffer
.
-
getFormat
Description copied from class:IndexBuffer
Returns the format of the data stored in this buffer.This method can be used to set an
IndexBuffer
to aMesh
:mesh.setBuffer(Type.Index, 3, indexBuffer.getFormat(), indexBuffer);
- Specified by:
getFormat
in classIndexBuffer
- Returns:
- an enum value
-