Class: UniformReflectionFactories

UniformReflectionFactories

A collection of static factory methods that return WebGLMath objects reflecting WebGL uniforms. The purpose is to offer a way of creating objects by ESSL type name and array size.

new UniformReflectionFactories()

Methods


<static> float()

Returns a new Vec1 or Vec1Array with appropriate size.
Parameters:
Type Description
arraySize The number of elements in the uniform, if it is an array. For a single float, it must be 1.
Returns:
The new reflection object.
Type
Vec1 | Vec1Array

<static> makeVar(gl, type, arraySize)

Returns a new reflection variable based on a numberical WebGL type ID.
Parameters:
Name Type Description
gl WebGLRenderingContext The rendering context.
type Number The numeric type of the uniform, i.e. a value of a type identifier property in the rendering context.
arraySize Number The number of elements in the uniform, if it is an array. Otherwise, it must be 1.
Returns:
The new reflection object.
Type
Vec1 | Vec1Array | Vec2 | Vec2Array | Vec3 | Vec3Array | Vec4 | Vec4Array | Mat4 | Mat4Array | Sampler2D | Sampler2DArray | SamplerCube | SamplerCubeArray

<static> mat4()

Returns a new Sampler2D object.
Parameters:
Type Description
arraySize Ignored. There are no Sampler2D arrays in ESSL.
Returns:
The new reflection object.
Type
Mat4 | Mat4Array

<static> mat4()

Returns a new Mat4 or Mat4Array with appropriate size.
Parameters:
Type Description
arraySize The number of elements in the uniform, if it is an array. For a single mat4, it must be 1.
Returns:
The new reflection object.
Type
Mat4 | Mat4Array

<static> vec2()

Returns a new Vec2 or Vec2Array with appropriate size.
Parameters:
Type Description
arraySize The number of elements in the uniform, if it is an array. For a single vec2, it must be 1.
Returns:
The new reflection object.
Type
Vec2 | Vec2Array

<static> vec3()

Returns a new Vec3 or Vec3Array with appropriate size.
Parameters:
Type Description
arraySize The number of elements in the uniform, if it is an array. For a single vec3, it must be 1.
Returns:
The new reflection object.
Type
Vec3 | Vec3Array

<static> vec4()

Returns a new Vec4 or Vec4Array with appropriate size.
Parameters:
Type Description
arraySize The number of elements in the uniform, if it is an array. For a single vec4, it must be 1.
Returns:
The new reflection object.
Type
Vec4 | Vec4Array