Class IndexBuffer


  • public class IndexBuffer
    extends java.lang.Object
    A buffer containing vertex indices into a VertexBuffer. Indices can be 16 or 32 bit. The buffer itself is a GPU resource, therefore mutating the data can be relatively slow. Typically these buffers are constant. It is possible, and even encouraged, to use a single index buffer for several Renderables.
    See Also:
    VertexBuffer, RenderableManager
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  IndexBuffer.Builder  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIndexCount()
      Returns the size of this IndexBuffer in elements.
      long getNativeObject()  
      void setBuffer​(Engine engine, java.nio.Buffer buffer)
      Asynchronously copy-initializes this IndexBuffer from the data provided.
      void setBuffer​(Engine engine, java.nio.Buffer buffer, int destOffsetInBytes, int count)
      Asynchronously copy-initializes a region of this IndexBuffer from the data provided.
      void setBuffer​(Engine engine, java.nio.Buffer buffer, int destOffsetInBytes, int count, java.lang.Object handler, java.lang.Runnable callback)
      Asynchronously copy-initializes a region of this IndexBuffer from the data provided.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getIndexCount

        @IntRange(from=0L)
        public int getIndexCount()
        Returns the size of this IndexBuffer in elements.
        Returns:
        the number of indices the IndexBuffer holds
      • setBuffer

        public void setBuffer​(@NonNull
                              Engine engine,
                              @NonNull
                              java.nio.Buffer buffer)
        Asynchronously copy-initializes this IndexBuffer from the data provided.
        Parameters:
        engine - reference to the Engine to associate this IndexBuffer with
        buffer - a CPU-side Buffer with the data used to initialize the IndexBuffer. buffer should contain raw, untyped data that will be interpreted as either 16-bit or 32-bits indices based on the IndexType of this IndexBuffer.
      • setBuffer

        public void setBuffer​(@NonNull
                              Engine engine,
                              @NonNull
                              java.nio.Buffer buffer,
                              @IntRange(from=0L)
                              int destOffsetInBytes,
                              @IntRange(from=0L)
                              int count)
        Asynchronously copy-initializes a region of this IndexBuffer from the data provided.
        Parameters:
        engine - reference to the Engine to associate this IndexBuffer with
        buffer - a CPU-side Buffer with the data used to initialize the IndexBuffer. buffer should contain raw, untyped data that will be interpreted as either 16-bit or 32-bits indices based on the IndexType of this IndexBuffer.
        destOffsetInBytes - offset in bytes into the IndexBuffer
        count - number of buffer elements to consume, defaults to buffer.remaining()
      • setBuffer

        public void setBuffer​(@NonNull
                              Engine engine,
                              @NonNull
                              java.nio.Buffer buffer,
                              @IntRange(from=0L)
                              int destOffsetInBytes,
                              @IntRange(from=0L)
                              int count,
                              @Nullable
                              java.lang.Object handler,
                              @Nullable
                              java.lang.Runnable callback)
        Asynchronously copy-initializes a region of this IndexBuffer from the data provided.
        Parameters:
        engine - reference to the Engine to associate this IndexBuffer with
        buffer - a CPU-side Buffer with the data used to initialize the IndexBuffer. buffer should contain raw, untyped data that will be interpreted as either 16-bit or 32-bits indices based on the IndexType of this IndexBuffer.
        destOffsetInBytes - offset in bytes into the IndexBuffer
        count - number of buffer elements to consume, defaults to buffer.remaining()
        handler - an Executor. On Android this can also be a Handler.
        callback - a callback executed by handler when buffer is no longer needed.
      • getNativeObject

        public long getNativeObject()