parameter
A parameter is a variable, which can be directly manipulated in the GUI, and is accessible throughout the remainder of the script, including GLSL functions. Changing a parameter's value triggers re-rendering of objects that depend on it. It is a handy tool for fine-tuning the appearance of your outputs.
Its syntax can be one of:
parameter <type> <name>;
parameter <type> <name> = <value>;
parameter <type> <name> : <control type>;
parameter <type> <name> = <value> : <control type>;
The parameter keyword may be shortened to param. <type> is the type of the parameter variable. Currently, only basic GLSL types are allowed (float, int, uint, bool, double, vecN, ivecN, uvecN, bvecN, dvecN, matN, matNxM, dmatN, and dmatNxM). Double precision types require an OpenGL 4 compatible GPU. <value> is its default value (zero if not specified), and <control type> is the type of GUI element that shall control it, possibly with additional parameters. The available control types are listed below. A linear range will be used by default.
Control types
The parameter control type can be one of:
- range(<minimum>, <maximum>, <step>) – the default control, allows the user to change the value (or its individual components) using a linear slider. The <step> argument is optional and sets a discrete step size. If <minimum> is omitted, it will be 0. If <maximum> is also omitted, the range will be from 0 to 1 for floating point types.
- logrange(<minimum>, <maximum>, <step>) – allows the user to change the value (or its individual components) using a logarithmic scale slider. The <step> argument is optional. Both <minimum> and <maximum> must be greater than zero.
- toggle() – the default control for bool parameters, cannot be used with other types. Allows to toggle between true and false using a simple checkbox.
- color() – an interactive color selection control, only applicable to vec3 (RGB) and vec4 (RGBA) parameter types.
- srgb_color() – same as color, but displays the color in sRGB color space. To be used in conjunction with sRGB image shaders.
- hidden() – the parameter won't be shown in the GUI, but can be controlled programmatically.
Example
parameter vec2 myCoord = vec2(0.3, -0.4) : range(vec2(-1.0, -1.0), vec2(1.0, 1.0));