-
public class VertexBufferHolds a set of buffers that define the geometry of a
Renderable.The geometry of the
Renderableitself 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumVertexBuffer.VertexAttributepublic enumVertexBuffer.AttributeTypepublic classVertexBuffer.Builder
-
Method Summary
Modifier and Type Method Description intgetVertexCount()Returns the vertex count. voidsetBufferAt(@NonNull() Engine engine, int bufferIndex, @NonNull() Buffer buffer)Asynchronously copy-initializes the specified buffer from the given buffer data. voidsetBufferAt(@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. voidsetBufferAt(@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. voidsetBufferObjectAt(@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. longgetNativeObject()-
-
Method Detail
-
getVertexCount
@IntRange(from = 0) int getVertexCount()
Returns the vertex count.
-
setBufferAt
void setBufferAt(@NonNull() Engine engine, int bufferIndex, @NonNull() Buffer buffer)
Asynchronously copy-initializes the specified buffer from the given buffer data.
-
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 thisVertexBufferwithbufferIndex- index of the buffer to initialize.buffer- a CPU-side Buffer representing the data used to initializetheVertexBufferat indexbufferIndex.destOffsetInBytes- offset in bytes into the buffer at indexbufferIndexof 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 thisVertexBufferwithbufferIndex- index of the buffer to initialize.buffer- a CPU-side Buffer representing the data used to initializetheVertexBufferat indexbufferIndex.destOffsetInBytes- offset in bytes into the buffer at indexbufferIndexof this vertex buffer set.handler- an Executor.callback- a callback executed byhandlerwhenbufferis 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.
-
getNativeObject
long getNativeObject()
-
-
-
-