Package 

Class IndexBuffer


  • 
    public class IndexBuffer
    
                        

    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.

    • Method Detail

      • getIndexCount

        @IntRange(from = 0) int getIndexCount()

        Returns the size of this IndexBuffer in elements.

      • setBuffer

         void setBuffer(@NonNull() Engine engine, @NonNull() Buffer buffer)

        Asynchronously copy-initializes this IndexBuffer from the data provided.

        Parameters:
        engine - reference to the Engine to associate thisIndexBuffer with
        buffer - a CPU-side Buffer with the data used to initialize theIndexBuffer.
      • setBuffer

         void setBuffer(@NonNull() Engine engine, @NonNull() Buffer buffer, @IntRange(from = 0) int destOffsetInBytes, @IntRange(from = 0) int count)

        Asynchronously copy-initializes a region of this IndexBuffer from the dataprovided.

        Parameters:
        engine - reference to the Engine to associate thisIndexBuffer with
        buffer - a CPU-side Buffer with the data used to initialize theIndexBuffer.
        destOffsetInBytes - offset in bytes into the IndexBuffer
        count - number of buffer elements to consume, defaults tobuffer.remaining()
      • setBuffer

         void setBuffer(@NonNull() Engine engine, @NonNull() Buffer buffer, @IntRange(from = 0) int destOffsetInBytes, @IntRange(from = 0) int count, @Nullable() Object handler, @Nullable() Runnable callback)

        Asynchronously copy-initializes a region of this IndexBuffer from the dataprovided.

        Parameters:
        engine - reference to the Engine to associate thisIndexBuffer with
        buffer - a CPU-side Buffer with the data used to initialize theIndexBuffer.
        destOffsetInBytes - offset in bytes into the IndexBuffer
        count - number of buffer elements to consume, defaults tobuffer.remaining()
        handler - an Executor.
        callback - a callback executed by handler when bufferis no longer needed.