Class UniformBuffer
Hierarchy
- UniformBuffer
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Instantiates a new Uniform buffer objects.
Handles blocks of uniform on the GPU.
If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.
For more information, please refer to :
Parameters
-
engine: Engine
Define the engine the buffer is associated with
-
Optional data: number[]
Define the data contained in the buffer
-
Optional dynamic: boolean
Define if the buffer is updatable
-
Optional name: string
to assign to the buffer (debugging purpose)
Returns UniformBuffer
-
Properties
update ArraySearch playground for updateArray
Lambda to Update an array of number in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
array: number[]
Returns void
-
-
update Color3Search playground for updateColor3
Lambda to Update vec3 of float from a Color in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
color: Color3
-
Optional suffix: string
Returns void
-
-
update Color4Search playground for updateColor4
Lambda to Update vec4 of float from a Color in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
color: Color3
-
alpha: number
-
Optional suffix: string
Returns void
-
-
update FloatSearch playground for updateFloat
Lambda to Update a single float in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
Returns void
-
-
update Float2Search playground for updateFloat2
Lambda to Update a vec2 of float in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
-
y: number
-
Optional suffix: string
Returns void
-
-
update Float3Search playground for updateFloat3
Lambda to Update a vec3 of float in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
-
y: number
-
z: number
-
Optional suffix: string
Returns void
-
-
update Float4Search playground for updateFloat4
Lambda to Update a vec4 of float in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
-
y: number
-
z: number
-
w: number
-
Optional suffix: string
Returns void
-
-
update Float ArraySearch playground for updateFloatArray
Lambda to Update an array of float in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
array: Float32Array
Returns void
-
-
update IntSearch playground for updateInt
Lambda to Update a int a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
-
Optional suffix: string
Returns void
-
-
update Int2Search playground for updateInt2
Lambda to Update a vec2 of int in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
-
y: number
-
Optional suffix: string
Returns void
-
-
update Int3Search playground for updateInt3
Lambda to Update a vec3 of int in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
-
y: number
-
z: number
-
Optional suffix: string
Returns void
-
-
update Int4Search playground for updateInt4
Lambda to Update a vec4 of int in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
x: number
-
y: number
-
z: number
-
w: number
-
Optional suffix: string
Returns void
-
-
update Int ArraySearch playground for updateIntArray
Lambda to Update an array of number in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
array: Int32Array
Returns void
-
-
update MatricesSearch playground for updateMatrices
Lambda to Update an array of 4x4 Matrix in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
mat: Float32Array
Returns void
-
-
update MatrixSearch playground for updateMatrix
Lambda to Update a 4x4 Matrix in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
mat: IMatrixLike
Returns void
-
-
update Matrix2x2Search playground for updateMatrix2x2
Lambda to Update a 2x2 Matrix in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
matrix: Float32Array
Returns void
-
-
update Matrix3x3Search playground for updateMatrix3x3
Lambda to Update a 3x3 Matrix in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
matrix: Float32Array
Returns void
-
-
update Vector3Search playground for updateVector3
Lambda to Update vec3 of float from a Vector in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
vector: Vector3
Returns void
-
-
update Vector4Search playground for updateVector4
Lambda to Update vec4 of float from a Vector in a uniform buffer. This is dynamic to allow compat with webgl 1 and 2. You will need to pass the name of the uniform as well as the value.
Type declaration
-
-
Parameters
-
name: string
-
vector: Vector4
Returns void
-
-
Accessors
is Sync
-
Indicates if the WebGL underlying uniform buffer is in sync with the javascript cache data.
Returns boolean
name
-
Gets the name of this buffer
Returns string
use Ubo
-
Indicates if the buffer is using the WebGL2 UBO implementation, or just falling back on setUniformXXX calls.
Returns boolean
Methods
add Color3Search playground for addColor3
-
Adds a vec3 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
-
color: Color3
Define the vec3 from a Color
Returns void
-
add Color4Search playground for addColor4
-
Adds a vec4 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
-
color: Color3
Define the rgb components from a Color
-
alpha: number
Define the a component of the vec4
Returns void
-
add Float2Search playground for addFloat2
-
Adds a vec2 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
-
x: number
Define the x component value of the vec2
-
y: number
Define the y component value of the vec2
Returns void
-
add Float3Search playground for addFloat3
-
Adds a vec3 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
-
x: number
Define the x component value of the vec3
-
y: number
Define the y component value of the vec3
-
z: number
Define the z component value of the vec3
Returns void
-
add MatrixSearch playground for addMatrix
-
Adds a Matrix 4x4 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
-
mat: Matrix
A 4x4 matrix.
Returns void
-
add Matrix2x2Search playground for addMatrix2x2
-
Adds a Matrix 2x2 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
Returns void
-
add Matrix3x3Search playground for addMatrix3x3
-
Adds a Matrix 3x3 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
Returns void
-
add UniformSearch playground for addUniform
-
Adds an uniform in the buffer. Warning : the subsequents calls of this function must be in the same order as declared in the shader for the layout to be correct !
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
-
size: number | number[]
Data size, or data directly.
-
Optional arraySize: number
The number of elements in the array, 0 if not an array.
Returns void
-
add Vector3Search playground for addVector3
-
Adds a vec3 to the uniform buffer.
Parameters
-
name: string
Name of the uniform, as used in the uniform block in the shader.
-
vector: Vector3
Define the vec3 components from a Vector
Returns void
-
bind ToEffectSearch playground for bindToEffect
-
Binds this uniform buffer to an effect.
Parameters
-
effect: Effect
Define the effect to bind the buffer to
-
name: string
Name of the uniform block in the shader.
Returns void
-
createSearch playground for create
-
Effectively creates the WebGL Uniform Buffer, once layout is completed with
addUniform
.Returns void
disposeSearch playground for dispose
-
Disposes the uniform buffer.
Returns void
get BufferSearch playground for getBuffer
-
The underlying WebGL Uniform buffer.
Returns Nullable<DataBuffer>
the webgl buffer
get DataSearch playground for getData
-
The data cache on JS side.
Returns Float32Array
the underlying data as a float array
is DynamicSearch playground for isDynamic
-
Indicates if the WebGL underlying uniform buffer is dynamic. Also, a dynamic UniformBuffer will disable cache verification and always update the underlying WebGL uniform buffer to the GPU.
Returns boolean
if Dynamic, otherwise false
set TextureSearch playground for setTexture
-
Sets a sampler uniform on the effect.
Parameters
-
name: string
Define the name of the sampler.
-
texture: Nullable<BaseTexture>
Define the texture to set in the sampler
Returns void
-
updateSearch playground for update
-
Updates the WebGL Uniform Buffer on the GPU. If the
dynamic
flag is set to true, no cache comparison is done. Otherwise, the buffer will be updated only if the cache differs.Returns void
update UniformSearch playground for updateUniform
-
Updates the value of an uniform. The
update
method must be called afterwards to make it effective in the GPU.Parameters
-
uniformName: string
Define the name of the uniform, as used in the uniform block in the shader.
-
data: FloatArray
Define the flattened data
-
size: number
Define the size of the data.
Returns void
-
update Uniform ArraySearch playground for updateUniformArray
-
Updates the value of an uniform. The
update
method must be called afterwards to make it effective in the GPU.Parameters
-
uniformName: string
Define the name of the uniform, as used in the uniform block in the shader.
-
data: FloatArray
Define the flattened data
-
size: number
Define the size of the data.
Returns void
-
update Uniform DirectlySearch playground for updateUniformDirectly
-
Directly updates the value of the uniform in the cache AND on the GPU.
Parameters
-
uniformName: string
Define the name of the uniform, as used in the uniform block in the shader.
-
data: FloatArray
Define the flattened data
Returns void
-
Uniform buffer objects.
Handles blocks of uniform on the GPU.
If WebGL 2 is not available, this class falls back on traditionnal setUniformXXX calls.
For more information, please refer to : https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object