Uniform()
new Uniform()
Uniform is a container for uniform buffer related data and actions.
- Source:
- Uniform.js, line 3
Members
name
The name that the Uniform will have on the WGSL side.
- Source:
- Uniform.js, line 49
Example
myUniform.name = 'myUniformName'; // wgsl myUniformName = 13.0;js
size
For internal use mostly. Size in bytes.
- Source:
- Uniform.js, line 94
type
Get or set the type of the uniform.
It can be inferred automatically by just passing the value, but if
something more specific is required, then you should use type.
- Source:
- Uniform.js, line 81
Example
myUniform.type = 'u32';
value
To get or set the value of the uniform from the JS side to the WGSL side.
- Source:
- Uniform.js, line 63
Methods
serialize() → Object
Clone of the Uniform data as a plain object to avoid modifications on the original data.
- Source:
- Uniform.js, line 104
Returns:
- Type:
- Object
setType(value)
Set the data type of the uniform.
Parameters:
| Name | Type | Description |
|---|---|---|
value
|
String | WGSL data type of the uniform |
- Source:
- Uniform.js, line 135
Example
myUniform.setType('u32')
setValue(value)
Sets or updates the value of the Uniform.
Parameters:
| Name | Type | Description |
|---|---|---|
value
|
|
- Source:
- Uniform.js, line 122