Class IndexShortBuffer

java.lang.Object
com.jme3.scene.mesh.IndexBuffer
com.jme3.scene.mesh.IndexShortBuffer

public class IndexShortBuffer extends IndexBuffer
IndexBuffer implementation for ShortBuffers.
  • Constructor Details

    • IndexShortBuffer

      public IndexShortBuffer(ShortBuffer buffer)
      Instantiate an IndexBuffer using the specified ShortBuffer and a maximum index value of 65_535.
      Parameters:
      buffer - a pre-existing buffer (not null, alias created)
    • IndexShortBuffer

      public IndexShortBuffer(ShortBuffer buffer, int maxValue)
      Instantiate an IndexBuffer using the specified ShortBuffer and set its maximum index value.
      Parameters:
      buffer - a pre-existing buffer (not null, alias created)
      maxValue - the desired maximum index value (≥0, ≤65_535)
  • Method Details

    • get

      public int get()
      Description copied from class: IndexBuffer
      Returns the vertex index for the current position.
      Specified by:
      get in class IndexBuffer
      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 class IndexBuffer
      Parameters:
      i - The index inside the index buffer
      Returns:
      the index
    • put

      public IndexShortBuffer put(int i, int value)
      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 class IndexBuffer
      Parameters:
      i - The buffer index
      value - The vertex index
      Returns:
      This buffer
    • put

      public IndexShortBuffer put(int value)
      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 class IndexBuffer
      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 class IndexBuffer
      Returns:
      the size of the index buffer.
    • getBuffer

      public Buffer getBuffer()
      Description copied from class: IndexBuffer
      Returns the underlying data-type specific Buffer. Implementations may return null if there's no underlying buffer.
      Specified by:
      getBuffer in class IndexBuffer
      Returns:
      the underlying Buffer.
    • getFormat

      public VertexBuffer.Format 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 a Mesh:

       mesh.setBuffer(Type.Index, 3, 
           indexBuffer.getFormat(), indexBuffer);
       
      Specified by:
      getFormat in class IndexBuffer
      Returns:
      an enum value