Class VertexBuffer
Index
Properties
Accessors
Methods
Properties
Readonlybyte Offset
Gets the byte offset.
Readonlybyte Stride
Gets the byte stride.
effective Buffer
Gets the effective buffer, that is the buffer that is actually sent to the GPU. It could be different from VertexBuffer.getBuffer() if a new buffer must be created under the hood because of the forceVertexBufferStrideAndOffsetMultiple4Bytes engine flag.
effective Byte Offset
Gets the effective byte offset, that is the byte offset of the buffer that is actually sent to the GPU. It could be different from VertexBuffer.byteOffset if a new buffer must be created under the hood because of the forceVertexBufferStrideAndOffsetMultiple4Bytes engine flag.
effective Byte Stride
Gets the effective byte stride, that is the byte stride of the buffer that is actually sent to the GPU. It could be different from VertexBuffer.byteStride if a new buffer must be created under the hood because of the forceVertexBufferStrideAndOffsetMultiple4Bytes engine flag.
Readonlyengine
Gets the engine associated with the buffer
Readonlyhash Code
Gets a hash code representing the format (type, normalized, size, instanced, stride) of this buffer All buffers with the same format will have the same hash code
Readonlynormalized
Gets whether integer data values should be normalized into a certain range when being casted to a float.
Readonlytype
Gets the data type of each component in the array.
Readonlyunique Id
Gets the unique id of this vertex buffer
Static ReadonlyBYTE
The byte type.
Static ReadonlyColor Instance Kind
Instance Colors
Static ReadonlyColor Kind
Colors
Static ReadonlyFLOAT
The float type.
Static ReadonlyHALF_ FLOAT
The half float type. Note: supported as a vertex attribute type only on the WebGL and WebGPU engines, not on Babylon Native.
Static ReadonlyINT
The integer type. Note: supported as a vertex attribute type only on the WebGL and WebGPU engines, not on Babylon Native.
Static ReadonlyMatrices Indices Extra Kind
Additional matrix indices (for bones)
Static ReadonlyMatrices Indices Kind
Matrix indices (for bones)
Static ReadonlyMatrices Weights Extra Kind
Additional matrix weights (for bones)
Static ReadonlyMatrices Weights Kind
Matrix weights (for bones)
Static ReadonlyNormal Kind
Normals
Static ReadonlyPosition Kind
Positions
Static ReadonlySHORT
The short type.
Static ReadonlyTangent Kind
Tangents
Static ReadonlyUNSIGNED_ BYTE
The unsigned byte type.
Static ReadonlyUNSIGNED_ INT
The unsigned integer type. Note: supported as a vertex attribute type only on the WebGL and WebGPU engines, not on Babylon Native.
Static ReadonlyUNSIGNED_ SHORT
The unsigned short type.
Static ReadonlyUV2 Kind
Texture coordinates 2
Static ReadonlyUV3 Kind
Texture coordinates 3
Static ReadonlyUV4 Kind
Texture coordinates 4
Static ReadonlyUV5 Kind
Texture coordinates 5
Static ReadonlyUV6 Kind
Texture coordinates 6
Static ReadonlyUV Kind
Texture coordinates
Accessors
instance Divisor
-
get instanceDivisor(): number
Gets or sets the instance divisor when in instanced mode
Returns number
-
set instanceDivisor(value: number): void
Parameters
- value: number
Returns void
is Disposed
-
get isDisposed(): boolean
Gets a boolean indicating if the Buffer is disposed
Returns boolean
Methods
create
-
Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property
Parameters
Optionaldata: DataArraydefines the data to store
Returns void
dispose
-
Disposes the VertexBuffer and the underlying WebGLBuffer.
Returns void
for Each
-
Enumerates each value of this vertex buffer as numbers.
Parameters
- count: number
the number of values to enumerate
- callback: (value: number, index: number) => void
the callback function called for each value
Returns void
- count: number
get Buffer
get Data
get Float Data
-
Gets this vertex buffer's data as a float array. Float data is constructed if the vertex buffer data cannot be returned directly.
Parameters
- totalVertices: number
number of vertices in the buffer to take into account
OptionalforceCopy: booleandefines a boolean indicating that the returned array must be cloned upon returning it
Returns Nullable<FloatArray>
a float array containing vertex data
- totalVertices: number
get Instance Divisor
-
Returns the instancing divisor, zero for non-instanced (integer).
Returns number
a number
get Is Instanced
-
Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced
Returns boolean
true if this buffer is instanced
get Kind
-
Returns the kind of the VertexBuffer (string)
Returns string
a string
get Offset
get Size
-
Returns the number of components or the byte size per vertex attribute
Parameters
- sizeInBytes: boolean = false
If true, returns the size in bytes or else the size in number of components of the vertex attribute (default: false)
Returns number
the number of components
- sizeInBytes: boolean = false
get Stride Size
get Wrapper Buffer
is Updatable
-
Gets a boolean indicating if the VertexBuffer is updatable?
Returns boolean
true if the buffer is updatable
update
-
Updates the underlying buffer according to the passed numeric array or Float32Array. This function will create a new buffer if the current one is not updatable
Parameters
- data: DataArray
defines the data to store
Returns void
- data: DataArray
update Directly
-
Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array. Returns the directly updated WebGLBuffer.
Parameters
- data: DataArray
the new data
- offset: number
the new offset
- useBytes: boolean = false
set to true if the offset is in bytes
Returns void
- data: DataArray
Specialized buffer used to store vertex data