Package com.google.android.filament
Class IndexBuffer
- java.lang.Object
-
- com.google.android.filament.IndexBuffer
-
public class IndexBuffer extends java.lang.ObjectA buffer containing vertex indices into aVertexBuffer. 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 severalRenderables.- See Also:
VertexBuffer,RenderableManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndexBuffer.Builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndexCount()Returns the size of thisIndexBufferin elements.longgetNativeObject()voidsetBuffer(Engine engine, java.nio.Buffer buffer)Asynchronously copy-initializes thisIndexBufferfrom the data provided.voidsetBuffer(Engine engine, java.nio.Buffer buffer, int destOffsetInBytes, int count)Asynchronously copy-initializes a region of thisIndexBufferfrom 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 thisIndexBufferfrom the data provided.
-
-
-
Method Detail
-
getIndexCount
@IntRange(from=0L) public int getIndexCount()
Returns the size of thisIndexBufferin elements.- Returns:
- the number of indices the
IndexBufferholds
-
setBuffer
public void setBuffer(@NonNull Engine engine, @NonNull java.nio.Buffer buffer)Asynchronously copy-initializes thisIndexBufferfrom the data provided.- Parameters:
engine- reference to theEngineto associate thisIndexBufferwithbuffer- a CPU-sideBufferwith the data used to initialize theIndexBuffer.buffershould contain raw, untyped data that will be interpreted as either 16-bit or 32-bits indices based on theIndexTypeof thisIndexBuffer.
-
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 thisIndexBufferfrom the data provided.- Parameters:
engine- reference to theEngineto associate thisIndexBufferwithbuffer- a CPU-sideBufferwith the data used to initialize theIndexBuffer.buffershould contain raw, untyped data that will be interpreted as either 16-bit or 32-bits indices based on theIndexTypeof thisIndexBuffer.destOffsetInBytes- offset in bytes into theIndexBuffercount- number of buffer elements 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 thisIndexBufferfrom the data provided.- Parameters:
engine- reference to theEngineto associate thisIndexBufferwithbuffer- a CPU-sideBufferwith the data used to initialize theIndexBuffer.buffershould contain raw, untyped data that will be interpreted as either 16-bit or 32-bits indices based on theIndexTypeof thisIndexBuffer.destOffsetInBytes- offset in bytes into theIndexBuffercount- number of buffer elements 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()
-
-