Package com.google.android.filament
Class BufferObject
- java.lang.Object
-
- com.google.android.filament.BufferObject
-
public class BufferObject extends java.lang.ObjectA generic GPU buffer containing data. Usage of this BufferObject is optional. For simple use cases it is not necessary. It is useful only when you need to share data between multiple VertexBuffer instances. It also allows you to efficiently swap-out the buffers in VertexBuffer. NOTE: For now this is only used for vertex data, but in the future we may use it for other things (e.g. compute).- See Also:
VertexBuffer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBufferObject.Builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetByteCount()Returns the size of thisBufferObjectin elements.longgetNativeObject()voidsetBuffer(Engine engine, java.nio.Buffer buffer)Asynchronously copy-initializes thisBufferObjectfrom the data provided.voidsetBuffer(Engine engine, java.nio.Buffer buffer, int destOffsetInBytes, int count)Asynchronously copy-initializes a region of thisBufferObjectfrom the data provided.voidsetBuffer(Engine engine, java.nio.Buffer buffer, int destOffsetInBytes, int count, java.lang.Object handler, java.lang.Runnable callback)Asynchronously copy-initializes a region of thisBufferObjectfrom the data provided.
-
-
-
Method Detail
-
getByteCount
@IntRange(from=0L) public int getByteCount()
Returns the size of thisBufferObjectin elements.- Returns:
- the number of bytes the
BufferObjectholds
-
setBuffer
public void setBuffer(@NonNull Engine engine, @NonNull java.nio.Buffer buffer)Asynchronously copy-initializes thisBufferObjectfrom the data provided.- Parameters:
engine- reference to theEngineto associate thisBufferObjectwithbuffer- a CPU-sideBufferwith the data used to initialize theBufferObject.
-
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 thisBufferObjectfrom the data provided.- Parameters:
engine- reference to theEngineto associate thisBufferObjectwithbuffer- a CPU-sideBufferwith the data used to initialize theBufferObject.destOffsetInBytes- offset in bytes into theBufferObjectcount- number of bytes to consume, defaults tobuffer.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 thisBufferObjectfrom the data provided.- Parameters:
engine- reference to theEngineto associate thisBufferObjectwithbuffer- a CPU-sideBufferwith the data used to initialize theBufferObject.destOffsetInBytes- offset in bytes into theBufferObjectcount- number of bytes to consume, defaults tobuffer.remaining()handler- anExecutor. On Android this can also be aHandler.callback- a callback executed byhandlerwhenbufferis no longer needed.
-
getNativeObject
public long getNativeObject()
-
-