Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Uniform

Uniforms are global GLSL variables. They are passed to shader programs.

Code Example

uniforms: {
time: { value: 1.0 }, resolution: new Uniform( new Vector2() )
};

Each uniform must have a value property. The type of the value must correspond to the type of the uniform variable in the GLSL code as specified for the primitive GLSL types in the table below. Uniform structures and arrays are also supported. GLSL arrays of primitive type must either be specified as an array of the corresponding THREE objects or as a flat array containing the data of all the objects. In other words; GLSL primitives in arrays must not be represented by arrays. This rule does not apply transitively. An array of vec2 arrays, each with a length of five vectors, must be an array of arrays, of either five Vector2 objects or ten numbers.

GLSL type JavaScript type
int Number
uint (WebGL 2) Number
float Number
bool Boolean
bool Number
vec2 THREE.Vector2
vec2 Float32Array (*)
vec2 Array (*)
vec3 THREE.Vector3
vec3 THREE.Color
vec3 Float32Array (*)
vec3 Array (*)
vec4 THREE.Vector4
vec4 THREE.Quaternion
vec4 Float32Array (*)
vec4 Array (*)
mat2 Float32Array (*)
mat2 Array (*)
mat3 THREE.Matrix3
mat3 Float32Array (*)
mat3 Array (*)
mat4 THREE.Matrix4
mat4 Float32Array (*)
mat4 Array (*)
ivec2, bvec2 Float32Array (*)
ivec2, bvec2 Array (*)
ivec3, bvec3 Int32Array (*)
ivec3, bvec3 Array (*)
ivec4, bvec4 Int32Array (*)
ivec4, bvec4 Array (*)
sampler2D THREE.Texture
samplerCube THREE.CubeTexture

Hierarchy

  • Uniform

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

value

value: any

Methods

onUpdateCallback

  • onUpdateCallback(): void

Generated using TypeDoc