UNIFORM-TUPLE:
GPU-accelerated rendering » Rendering

Prev:render-set


Vocabulary
gpu.render

Syntax
UNIFORM-TUPLE: class-name { "slot" uniform-type dimension } { "slot" uniform-type dimension } ... { "slot" uniform-type dimension } ;


Word description
Defines a new uniform-tuple class. Tuples of the new class can be used as the uniforms slot of a render-set in order to set the uniform parameters of the active shader program. The uniform-type of each slot defines the component type, and the dimension specifies an array length if not f.

Uniform parameters are passed from Factor to the shader program through the uniform tuple as follows:
int-uniforms and uint-uniforms take their values from Factor integers.
float-uniforms take their values from Factor floats.
bool-uniforms take their values from Factor booleans.
texture-uniforms take their values from texture objects.
Vector uniforms take their values from Factor sequences of the corresponding component type.
Float vector types: vec2-uniform, vec3-uniform, vec4-uniform
Integer vector types: ivec2-uniform, ivec3-uniform, ivec4-uniform
Unsigned integer vector types: uvec2-uniform, uvec3-uniform, uvec4-uniform
Boolean vector types: bvec2-uniform, bvec3-uniform, bvec4-uniform
Matrix uniforms take their values either from row-major Factor sequences of sequences of floats, or from aliens or float-arrays referencing packed column-major arrays of floats. Matrix types are:
mat2-uniform, mat2x3-uniform, mat2x4-uniform
mat3x2-uniform, mat3-uniform, mat3x4-uniform
mat4x2-uniform, mat4x3-uniform, mat4-uniform

Rectangular matrix type names are column x row.
Uniform slots can also be defined as other uniform-tuple types to bind uniform structures. The uniform structure will take its value from the slots of a tuple of the given type.
Array uniforms are passed either as Factor sequences of the corresponding type specified above, or as aliens or specialized-arrays that reference pre-packed binary arrays of ints or floats.


A value of a uniform tuple type is a standard Factor tuple. Uniform tuples are constructed with new or boa, and values are placed inside them using standard slot accessors.

Definition