Class VertexBuffer
Hierarchy
- VertexBuffer
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Constructor
Parameters
-
engine: any
the engine
-
data: DataArray | Buffer
the data to use for this vertex buffer
-
kind: string
the vertex buffer kind
-
updatable: boolean
whether the data is updatable
-
Optional postponeInternalCreation: boolean
whether to postpone creating the internal WebGL buffer (optional)
-
Optional stride: number
the stride (optional)
-
Optional instanced: boolean
whether the buffer is instanced (optional)
-
Optional offset: number
the offset of the data (optional)
-
Optional size: number
the number of components (optional)
-
Optional type: number
the type of the component (optional)
-
Optional normalized: boolean
whether the data contains normalized data (optional)
-
Optional useBytes: boolean
set to true if stride and offset are in bytes (optional)
-
Optional divisor: number
defines the instance divisor to use (1 by default)
-
Optional takeBufferOwnership: boolean
defines if the buffer should be released when the vertex buffer is disposed
Returns VertexBuffer
-
Properties
Readonly byte OffsetSearch playground for byteOffset
Gets the byte offset.
Readonly byte StrideSearch playground for byteStride
Gets the byte stride.
Readonly normalizedSearch playground for normalized
Gets whether integer data values should be normalized into a certain range when being casted to a float.
Readonly typeSearch playground for type
Gets the data type of each component in the array.
Readonly unique IdSearch playground for uniqueId
Gets the unique id of this vertex buffer
Static Readonly BYTESearch playground for BYTE
The byte type.
Static Readonly Color KindSearch playground for ColorKind
Colors
Static Readonly FLOATSearch playground for FLOAT
The float type.
Static Readonly INTSearch playground for INT
The integer type.
Static Readonly Matrices Indices Extra KindSearch playground for MatricesIndicesExtraKind
Additional matrix indices (for bones)
Static Readonly Matrices Indices KindSearch playground for MatricesIndicesKind
Matrix indices (for bones)
Static Readonly Matrices Weights Extra KindSearch playground for MatricesWeightsExtraKind
Additional matrix weights (for bones)
Static Readonly Matrices Weights KindSearch playground for MatricesWeightsKind
Matrix weights (for bones)
Static Readonly Normal KindSearch playground for NormalKind
Normals
Static Readonly Position KindSearch playground for PositionKind
Positions
Static Readonly SHORTSearch playground for SHORT
The short type.
Static Readonly Tangent KindSearch playground for TangentKind
Tangents
Static Readonly UNSIGNED_ BYTESearch playground for UNSIGNED_BYTE
The unsigned byte type.
Static Readonly UNSIGNED_ INTSearch playground for UNSIGNED_INT
The unsigned integer type.
Static Readonly UNSIGNED_ SHORTSearch playground for UNSIGNED_SHORT
The unsigned short type.
Static Readonly UV2 KindSearch playground for UV2Kind
Texture coordinates 2
Static Readonly UV3 KindSearch playground for UV3Kind
Texture coordinates 3
Static Readonly UV4 KindSearch playground for UV4Kind
Texture coordinates 4
Static Readonly UV5 KindSearch playground for UV5Kind
Texture coordinates 5
Static Readonly UV6 KindSearch playground for UV6Kind
Texture coordinates 6
Static Readonly UVKindSearch playground for UVKind
Texture coordinates
Accessors
instance Divisor
-
Gets or sets the instance divisor when in instanced mode
Returns number
-
Gets or sets the instance divisor when in instanced mode
Parameters
-
value: number
Returns any
-
Methods
createSearch playground for create
-
Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property
Parameters
-
Optional data: DataArray
defines the data to store
Returns void
-
disposeSearch playground for dispose
-
Disposes the VertexBuffer and the underlying WebGLBuffer.
Returns void
for EachSearch playground for forEach
-
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
-
-
Parameters
-
value: number
-
index: number
Returns void
-
-
-
Returns void
-
get BufferSearch playground for getBuffer
-
Gets underlying native buffer
Returns Nullable<DataBuffer>
underlying native buffer
get DataSearch playground for getData
get Instance DivisorSearch playground for getInstanceDivisor
-
Returns the instancing divisor, zero for non-instanced (integer).
Returns number
a number
get IsInstancedSearch playground for getIsInstanced
-
Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced
Returns boolean
true if this buffer is instanced
get KindSearch playground for getKind
-
Returns the kind of the VertexBuffer (string)
Returns string
a string
get OffsetSearch playground for getOffset
-
Returns the offset as a multiple of the type byte length.
Returns number
the offset in bytes
get SizeSearch playground for getSize
-
Returns the number of components per vertex attribute (integer)
Returns number
the size in float
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 VertexBuffer is updatable?
Returns boolean
true if the buffer is updatable
updateSearch playground for 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
-
update DirectlySearch playground for updateDirectly
-
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
-
Optional useBytes: boolean
set to true if the offset is in bytes
Returns void
-
Static Deduce StrideSearch playground for DeduceStride
-
Deduces the stride given a kind.
Parameters
-
kind: string
The kind string to deduce
Returns number
The deduced stride
-
Static For EachSearch playground for ForEach
-
Enumerates each value of the given parameters as numbers.
Parameters
-
data: DataArray
the data to enumerate
-
byteOffset: number
the byte offset of the data
-
byteStride: number
the byte stride of the data
-
componentCount: number
the number of components per element
-
componentType: number
the type of the component
-
count: number
the number of values to enumerate
-
normalized: boolean
whether the data is normalized
-
callback: (value: number, index: number) => void
the callback function called for each value
-
-
Parameters
-
value: number
-
index: number
Returns void
-
-
-
Returns void
-
Static Get Type Byte LengthSearch playground for GetTypeByteLength
-
Gets the byte length of the given type.
Parameters
-
type: number
the type
Returns number
the number of bytes
-
Specialized buffer used to store vertex data