Create a new IndexBuffer instance.
The graphics device used to manage this index buffer.
The type of each index to be stored in the index buffer. Can be:
The number of indices to be stored in the index buffer.
Optionalusage: number = BUFFER_STATICThe usage type of the vertex buffer. Can be:
Defaults to BUFFER_STATIC.
OptionalinitialData: ArrayBuffer | ArrayBufferView<ArrayBufferLike>Initial data. Can be an ArrayBuffer or a typed array (for example a Uint16Array). The data is stored by reference and is not copied, so a typed array that is a view into a larger buffer is kept as-is. If left unspecified, the index buffer will be initialized to zeros.
Optionaloptions: { storage?: boolean }Object for passing optional arguments.
Optionalstorage?: booleanDefines if the index buffer can be used as a storage buffer by a compute shader. Defaults to false. Only supported on WebGPU.
Frees resources associated with this index buffer.
Returns the data format of the specified index buffer.
The data format of the specified index buffer. Can be:
Returns the number of indices stored in the specified index buffer.
The number of indices stored in the specified index buffer.
Gives access to the block of memory that stores the buffer's indices.
The memory that stores the buffer's indices. This matches whatever was supplied as the initial data: an ArrayBuffer when none was provided, otherwise the ArrayBuffer or typed array that was passed in. Use ArrayBufferConstructor.isView to distinguish the two before accessing it.
Signals that the block of memory returned by a call to the lock function is ready to be given to the graphics hardware. Only unlocked index buffers can be set on the currently active device.
An index buffer stores index values into a VertexBuffer. Indexed graphical primitives can normally utilize less memory that unindexed primitives (if vertices are shared).
Typically, index buffers are set on Mesh objects.