Package com.jme3.scene.mesh
Class VirtualIndexBuffer
java.lang.Object
com.jme3.scene.mesh.IndexBuffer
com.jme3.scene.mesh.VirtualIndexBuffer
- Direct Known Subclasses:
WrappedIndexBuffer
IndexBuffer implementation that generates vertex indices sequentially
based on a specific Mesh
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 | ...
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintget()Returns the vertex index for the current position.intget(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.intvoidrewind()intsize()Returns the size of the index buffer.Methods inherited from class com.jme3.scene.mesh.IndexBuffer
createIndexBuffer, wrapIndexBuffer
-
Field Details
-
numVerts
protected int numVerts -
numIndices
protected int numIndices -
meshMode
-
position
protected int position
-
-
Constructor Details
-
VirtualIndexBuffer
-
-
Method Details
-
get
public int get()Description copied from class:IndexBufferReturns the vertex index for the current position.- Specified by:
getin classIndexBuffer- Returns:
- the index
-
rewind
public void rewind()- Overrides:
rewindin classIndexBuffer- See Also:
-
remaining
public int remaining()- Overrides:
remainingin classIndexBuffer- Returns:
- the count (≥0)
- See Also:
-
get
public int get(int i) Description copied from class:IndexBufferReturns the vertex index for the given index in the index buffer.- Specified by:
getin classIndexBuffer- Parameters:
i- The index inside the index buffer- Returns:
- the index
-
put
Description copied from class:IndexBufferAbsolute 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).- Specified by:
putin classIndexBuffer- Parameters:
i- The buffer indexvalue- The vertex index- Returns:
- This buffer
-
size
public int size()Description copied from class:IndexBufferReturns the size of the index buffer.- Specified by:
sizein classIndexBuffer- Returns:
- the size of the index buffer.
-
getBuffer
Description copied from class:IndexBufferReturns the underlying data-type specificBuffer. Implementations may return null if there's no underlying buffer.- Specified by:
getBufferin classIndexBuffer- Returns:
- the underlying
Buffer.
-
put
Description copied from class:IndexBufferRelative 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).- Specified by:
putin classIndexBuffer- Parameters:
value- The vertex index- Returns:
- This buffer
-
getFormat
Description copied from class:IndexBufferReturns 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);- Specified by:
getFormatin classIndexBuffer- Returns:
- an enum value
-