Package 

Class VertexBuffer


  • 
    public class VertexBuffer
    
                        

    Holds a set of buffers that define the geometry of a Renderable.

    The geometry of the Renderable itself is defined by a set of vertex attributes such as position, color, normals, tangents, etc...

    There is no need to have a 1-to-1 mapping between attributes and buffer. A buffer can hold the data of several attributes -- attributes are then referred as being "interleaved".

    The buffers themselves are GPU resources, therefore mutating their data can be relatively slow. For this reason, it is best to separate the constant data from the dynamic data into multiple buffers.

    It is possible, and even encouraged, to use a single vertex buffer for several Renderables.

    • Method Detail

      • setBufferAt

         void setBufferAt(@NonNull() Engine engine, int bufferIndex, @NonNull() Buffer buffer)

        Asynchronously copy-initializes the specified buffer from the given buffer data.

        Parameters:
        engine - reference to the Engine to associate thisVertexBuffer with
        bufferIndex - index of the buffer to initialize.
        buffer - a CPU-side Buffer representing the data used to initializethe VertexBuffer at index bufferIndex.
      • setBufferAt

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

        Asynchronously copy-initializes a region of the specified buffer from the given buffer data.

        Parameters:
        engine - reference to the Engine to associate thisVertexBuffer with
        bufferIndex - index of the buffer to initialize.
        buffer - a CPU-side Buffer representing the data used to initializethe VertexBuffer at index bufferIndex.
        destOffsetInBytes - offset in bytes into the buffer at indexbufferIndex of this vertex buffer set.
      • setBufferAt

         void setBufferAt(@NonNull() Engine engine, int bufferIndex, @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 the specified buffer from the given buffer data.

        Parameters:
        engine - reference to the Engine to associate thisVertexBuffer with
        bufferIndex - index of the buffer to initialize.
        buffer - a CPU-side Buffer representing the data used to initializethe VertexBuffer at index bufferIndex.
        destOffsetInBytes - offset in bytes into the buffer at indexbufferIndex of this vertex buffer set.
        handler - an Executor.
        callback - a callback executed by handler when bufferis no longer needed.
      • setBufferObjectAt

         void setBufferObjectAt(@NonNull() Engine engine, int bufferIndex, @NonNull() BufferObject bufferObject)

        Swaps in the given buffer object.To use this, you must first call enableBufferObjects() on the Builder.

        Parameters:
        engine - Reference to the filament::Engine to associate this VertexBuffer with.
        bufferIndex - Index of the buffer to initialize.
        bufferObject - The handle to the GPU data that will be used in this buffer slot.