class UniformBuffer
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
Name | Type | Description | |
---|---|---|---|
engine | Engine | ||
optional | data | number[] | |
optional | dynamic | boolean |
Wrapper for updateUniform.
@method updateMatrix3x3
Name | Type | Description | |
---|---|---|---|
name | string | ||
matrix | Float32Array |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
matrix | Float32Array |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
x | number |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
x | number | ||
y | number |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
x | number | ||
y | number | ||
z | number |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
x | number | ||
y | number | ||
z | number | ||
w | number |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
mat | Matrix |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
vector | Vector3 |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
vector | Vector4 |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
color | Color3 | ||
optional | suffix | string |
Wrapper for updateUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
color | Color3 | ||
alpha | number |
Indicates if the buffer is using the WebGL2 UBO implementation,
or just falling back on setUniformXXX calls.
Indicates if the WebGL underlying uniform buffer is in sync
with the javascript cache data.
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.
The data cache on JS side.
The underlying WebGL Uniform buffer.
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 !
Name | Type | Description | |
---|---|---|---|
name | string | ||
size | number or number |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
mat | Matrix |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
x | number | ||
y | number |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
x | number | ||
y | number |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
color | Color3 |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
color | Color3 | ||
alpha | number |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string | ||
vector | Vector3 |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string |
Wrapper for addUniform.
Name | Type | Description | |
---|---|---|---|
name | string |
Effectively creates the WebGL Uniform Buffer, once layout is completed with addUniform
.
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.
Updates the value of an uniform. The update
method must be called afterwards to make it effective in the GPU.
Name | Type | Description | |
---|---|---|---|
uniformName | string | ||
data | FloatArray | ||
size | number |
Sets a sampler uniform on the effect.
Name | Type | Description | |
---|---|---|---|
name | string | ||
texture | Nullable<BaseTexture> |
Directly updates the value of the uniform in the cache AND on the GPU.
Name | Type | Description | |
---|---|---|---|
uniformName | string | ||
data | FloatArray |
Binds this uniform buffer to an effect.
Name | Type | Description | |
---|---|---|---|
effect | Effect | ||
name | string |
Disposes the uniform buffer.