diff --git a/docs/api/core/Uniform.html b/docs/api/core/Uniform.html new file mode 100644 index 0000000000000000000000000000000000000000..5aebb88191e6d6945fabfb074e1dc3f301ab7404 --- /dev/null +++ b/docs/api/core/Uniform.html @@ -0,0 +1,213 @@ + + + + + + + + + + +

[name]

+ +
Uniforms are global [link:https://www.opengl.org/documentation/glsl/ GLSL] variables. They are passed to shader programs. +
+ +

Example

+

+ When declaring a uniform of a [page:ShaderMaterial], it is declared by value or by object. +

+ + uniforms: { + time: { value: 1.0 }, + resolution: new THREE.Uniform(new THREE.Vector2()) + } + + +

Uniform types

+ +

+ 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 *THREE.Vector2* objects or ten *number*s. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Uniform types
GLSL typeJavaScript type
int[page:Number]
float[page:Number]
bool[page:Boolean]
bool[page:Number]
vec2[page:Vector2 THREE.Vector2]
vec2[page:Float32Array Float32Array] (*)
vec2[page:Array Array] (*)
vec3[page:Vector3 THREE.Vector3]
vec3[page:Color THREE.Color]
vec3[page:Float32Array Float32Array] (*)
vec3[page:Array Array] (*)
vec4[page:Vector4 THREE.Vector4]
vec4[page:Quaternion THREE.Quaternion]
vec4[page:Float32Array Float32Array] (*)
vec4[page:Array Array] (*)
mat2[page:Float32Array Float32Array] (*)
mat2[page:Array Array] (*)
mat3[page:Matrix3 THREE.Matrix3]
mat3[page:Float32Array Float32Array] (*)
mat3[page:Array Array] (*)
mat4[page:Matrix3 THREE.Matrix4]
mat4[page:Float32Array Float32Array] (*)
mat4[page:Array Array] (*)
ivec2, bvec2[page:Float32Array Float32Array] (*)
ivec2, bvec2[page:Array Array] (*)
ivec3, bvec3[page:Int32Array Int32Array] (*)
ivec3, bvec3[page:Array Array] (*)
ivec4, bvec4[page:Int32Array Int32Array] (*)
ivec4, bvec4[page:Array Array] (*)
sampler2D[page:Texture THREE.Texture]
samplerCube[page:CubeTexture THREE.CubeTexture]
+

+

+ (*) Same for an (innermost) array (dimension) of the same GLSL type, containing the components of all vectors or matrices in the array. +

+ +

Constructor

+ +

[name]( [page:Object value] )

+
+ value -- An object containing the value to set up the uniform. It's type must be one of the Uniform Types described above. +
+ +

Properties

+ +

[property:Object value]

+
+ Current value of the uniform. +
+ +

[property:Boolean dynamic]

+
+ Sets wether this uniform is updated at each render call when used by a renderer. + You must set this attribute by calling [page:.onUpdate]. +
+ +

Methods

+ +

[method:Uniform onUpdate]( [page:Function callback] ) [page:Uniform this]

+
+ Set the callback function to update this uniform at each render call. The callback has two optional parameters : + +
+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/materials/ShaderMaterial.html b/docs/api/materials/ShaderMaterial.html index 74ced779c9fc89fc6bc841b8cf1318ea67817cf1..84a71af088b47017421be76ee11a05440cc58230 100644 --- a/docs/api/materials/ShaderMaterial.html +++ b/docs/api/materials/ShaderMaterial.html @@ -120,158 +120,13 @@

- To declare a custom uniform, use the *uniforms* property: + To declare a custom [page:Uniform], use the *uniforms* property: uniforms: { time: { value: 1.0 }, resolution: { value: new THREE.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 *THREE.Vector2* objects or ten *number*s. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uniform types
GLSL typeJavaScript type
int[page:Number]
float[page:Number]
bool[page:Boolean]
bool[page:Number]
vec2[page:Vector2 THREE.Vector2]
vec2[page:Float32Array Float32Array] (*)
vec2[page:Array Array] (*)
vec3[page:Vector3 THREE.Vector3]
vec3[page:Color THREE.Color]
vec3[page:Float32Array Float32Array] (*)
vec3[page:Array Array] (*)
vec4[page:Vector4 THREE.Vector4]
vec4[page:Quaternion THREE.Quaternion]
vec4[page:Float32Array Float32Array] (*)
vec4[page:Array Array] (*)
mat2[page:Float32Array Float32Array] (*)
mat2[page:Array Array] (*)
mat3[page:Matrix3 THREE.Matrix3]
mat3[page:Float32Array Float32Array] (*)
mat3[page:Array Array] (*)
mat4[page:Matrix3 THREE.Matrix4]
mat4[page:Float32Array Float32Array] (*)
mat4[page:Array Array] (*)
ivec2, bvec2[page:Float32Array Float32Array] (*)
ivec2, bvec2[page:Array Array] (*)
ivec3, bvec3[page:Int32Array Int32Array] (*)
ivec3, bvec3[page:Array Array] (*)
ivec4, bvec4[page:Int32Array Int32Array] (*)
ivec4, bvec4[page:Array Array] (*)
sampler2D[page:Texture THREE.Texture]
samplerCube[page:CubeTexture THREE.CubeTexture]
-

-

- (*) Same for an (innermost) array (dimension) of the same GLSL type, containing the components of all vectors or matrices in the array.

Constructor

diff --git a/docs/list.js b/docs/list.js index 13a1ffa286c02603c8dedde2b49bc406979ca1c4..3c88832710727e02620989d52511c6e5b0ae330e 100644 --- a/docs/list.js +++ b/docs/list.js @@ -31,7 +31,8 @@ var list = { [ "Face3", "api/core/Face3" ], [ "Geometry", "api/core/Geometry" ], [ "Object3D", "api/core/Object3D" ], - [ "Raycaster", "api/core/Raycaster" ] + [ "Raycaster", "api/core/Raycaster" ], + [ "Uniform", "api/core/Uniform"] ], "Lights": [