Class Buffer
Constructors
constructor
-
new Buffer(
engine: AbstractEngine,
data: DataArray | DataBuffer,
updatable: boolean,
stride?: number,
postponeInternalCreation?: boolean,
instanced?: boolean,
useBytes?: boolean,
divisor?: number,
label?: string,
): BufferConstructor
Parameters
- engine: AbstractEngine
the engine
- data: DataArray | DataBuffer
the data to use for this buffer
- updatable: boolean
whether the data is updatable
- stride: number = 0
the stride (optional)
- postponeInternalCreation: boolean = false
whether to postpone creating the internal WebGL buffer (optional)
- instanced: boolean = false
whether the buffer is instanced (optional)
- useBytes: boolean = false
set to true if the stride in in bytes (optional)
Optionaldivisor: numbersets an optional divisor for instances (1 by default)
Optionallabel: stringdefines the label of the buffer (for debug purpose)
Returns Buffer
- engine: AbstractEngine
Accessors
is Disposed
-
get isDisposed(): boolean
Gets a boolean indicating if the Buffer is disposed
Returns boolean
Methods
create
create Vertex Buffer
-
createVertexBuffer(
kind: string,
offset: number,
size: number,
stride?: number,
instanced?: boolean,
useBytes?: boolean,
divisor?: number,
): VertexBufferCreate 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)
Optionalstride: numberdefines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)
Optionalinstanced: booleandefines if the vertex buffer contains indexed data
- useBytes: boolean = false
defines if the offset and stride are in bytes *
Optionaldivisor: numbersets an optional divisor for instances (1 by default)
Returns VertexBuffer
the new vertex buffer
- kind: string
dispose
-
Release all resources
Returns void
get Buffer
get Data
get Stride Size
is Updatable
-
Gets a boolean indicating if the Buffer is updatable?
Returns boolean
true if the buffer is updatable
update
update Directly
-
Updates the data directly.
Parameters
- data: DataArray
the new data
- offset: number
the new offset
OptionalvertexCount: numberthe vertex count (optional)
- useBytes: boolean = false
set to true if the offset is in bytes
Returns void
- data: DataArray
Class used to store data that will be store in GPU memory