Class Buffer
Hierarchy
- Buffer
Index
Constructors
Properties
Methods
Constructors
constructor
Constructor
Parameters
engine: any
the engine
data: DataArray | DataBuffer
the data to use for this buffer
updatable: boolean
whether the data is updatable
Optional stride: number
the stride (optional)
Optional postponeInternalCreation: boolean
whether to postpone creating the internal WebGL buffer (optional)
Optional instanced: boolean
whether the buffer is instanced (optional)
Optional useBytes: boolean
set to true if the stride in in bytes (optional)
Optional divisor: number
sets an optional divisor for instances (1 by default)
Returns Buffer
Properties
Readonly byte StrideSearch playground for byteStride
Gets the byte stride.
Methods
createSearch playground for create
create Vertex BufferSearch playground for createVertexBuffer
Create a new VertexBuffer based on the current buffer
Parameters
kind: string
defines the vertex buffer kind (position, normal, etc.)
offset: number
defines offset in the buffer (0 by default)
size: number
defines the size in floats of attributes (position is 3 for instance)
Optional stride: number
defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)
Optional instanced: boolean
defines if the vertex buffer contains indexed data
Optional useBytes: boolean
defines if the offset and stride are in bytes *
Optional divisor: number
sets an optional divisor for instances (1 by default)
Returns VertexBuffer
the new vertex buffer
disposeSearch playground for dispose
Release all resources
Returns void
get BufferSearch playground for getBuffer
Gets underlying native buffer
Returns Nullable<DataBuffer>
underlying native buffer
get DataSearch playground for getData
get Stride SizeSearch playground for getStrideSize
Gets the stride in float32 units (i.e. byte stride / 4). May not be an integer if the byte stride is not divisible by 4.
Returns number
the stride in float32 units
is UpdatableSearch playground for isUpdatable
Gets a boolean indicating if the Buffer is updatable?
Returns boolean
true if the buffer is updatable
updateSearch playground for update
Update current buffer data
Parameters
data: DataArray
defines the data to store
Returns void
update DirectlySearch playground for updateDirectly
Updates the data directly.
Parameters
data: DataArray
the new data
offset: number
the new offset
Optional vertexCount: number
the vertex count (optional)
Optional useBytes: boolean
set to true if the offset is in bytes
Returns void
Class used to store data that will be store in GPU memory