|
@@ -213,9 +213,9 @@ They can be initialized at the beginning like:
|
|
|
|
|
|
.. code-block:: glsl
|
|
|
|
|
|
- float float_arr[3] = float[3] ( 1.0, 0.5, 0.0 ); // first constructor
|
|
|
+ float float_arr[3] = float[3] (1.0, 0.5, 0.0); // first constructor
|
|
|
|
|
|
- int int_arr[3] = int[] ( 2, 1, 0 ); // second constructor
|
|
|
+ int int_arr[3] = int[] (2, 1, 0); // second constructor
|
|
|
|
|
|
vec2 vec2_arr[3] = { vec2(1.0, 1.0), vec2(0.5, 0.5), vec2(0.0, 0.0) }; // third constructor
|
|
|
|
|
@@ -226,7 +226,7 @@ You can declare multiple arrays (even with different sizes) in one expression:
|
|
|
.. code-block:: glsl
|
|
|
|
|
|
float a[3] = float[3] (1.0, 0.5, 0.0),
|
|
|
- b[2] = {1.0, 0.5},
|
|
|
+ b[2] = { 1.0, 0.5 },
|
|
|
c[] = { 0.7 },
|
|
|
d = 0.0,
|
|
|
e[5];
|
|
@@ -295,33 +295,33 @@ Operators
|
|
|
|
|
|
Godot shading language supports the same set of operators as GLSL ES 3.0. Below is the list of them in precedence order:
|
|
|
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| Precedence | Class | Operator |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 1 (highest) | parenthetical grouping| **()** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 2 | unary | **+, -, !, ~** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 3 | multiplicative | **/, \*, %** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 4 | additive | **+, -** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 5 | bit-wise shift | **<<, >>** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 6 | relational | **<, >, <=, >=** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 7 | equality | **==, !=** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 8 | bit-wise and | **&** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 9 | bit-wise exclusive or | **^** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 10 | bit-wise inclusive or | **|** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 11 | logical and | **&&** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
-| 12 (lowest) | logical inclusive or | **||** |
|
|
|
-+-------------+-----------------------+--------------------+
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| Precedence | Class | Operator |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 1 (highest) | parenthetical grouping | **()** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 2 | unary | **+, -, !, ~** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 3 | multiplicative | **/, \*, %** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 4 | additive | **+, -** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 5 | bit-wise shift | **<<, >>** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 6 | relational | **<, >, <=, >=** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 7 | equality | **==, !=** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 8 | bit-wise AND | **&** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 9 | bit-wise exclusive OR | **^** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 10 | bit-wise inclusive OR | **|** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 11 | logical AND | **&&** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
+| 12 (lowest) | logical inclusive OR | **||** |
|
|
|
++-------------+------------------------+------------------+
|
|
|
|
|
|
Flow control
|
|
|
------------
|
|
@@ -513,25 +513,25 @@ It's important to understand that textures that are supplied as color require hi
|
|
|
|
|
|
Full list of hints below:
|
|
|
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| Type | Hint | Description |
|
|
|
-+================+===============================+=====================================+
|
|
|
-| **vec4** | hint_color | Used as color |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| **int, float** | hint_range(min,max [,step] ) | Used as range (with min/max/step) |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| **sampler2D** | hint_albedo | Used as albedo color, default white |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| **sampler2D** | hint_black_albedo | Used as albedo color, default black |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| **sampler2D** | hint_normal | Used as normalmap |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| **sampler2D** | hint_white | As value, default to white. |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| **sampler2D** | hint_black | As value, default to black |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
-| **sampler2D** | hint_aniso | As flowmap, default to right. |
|
|
|
-+----------------+-------------------------------+-------------------------------------+
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| Type | Hint | Description |
|
|
|
++================+=============================+=====================================+
|
|
|
+| **vec4** | hint_color | Used as color |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| **int, float** | hint_range(min,max [,step]) | Used as range (with min/max/step) |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| **sampler2D** | hint_albedo | Used as albedo color, default white |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| **sampler2D** | hint_black_albedo | Used as albedo color, default black |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| **sampler2D** | hint_normal | Used as normalmap |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| **sampler2D** | hint_white | As value, default to white. |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| **sampler2D** | hint_black | As value, default to black |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
+| **sampler2D** | hint_aniso | As flowmap, default to right. |
|
|
|
++----------------+-----------------------------+-------------------------------------+
|
|
|
|
|
|
GDScript uses different variable types than GLSL does, so when passing variables from GDScript
|
|
|
to shaders, Godot converts the type automatically. Below is a table of the corresponding types:
|
|
@@ -577,202 +577,202 @@ When vec_type (float), vec_int_type, vec_uint_type, vec_bool_type nomenclature i
|
|
|
.. note:: For a list of the functions that are not available in the GLES2 backend, please see the
|
|
|
:ref:`Differences between GLES2 and GLES3 doc <doc_gles2_gles3_differences>`.
|
|
|
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| Function | Description |
|
|
|
-+============================================================================+==================================================+
|
|
|
-| vec_type **radians** ( vec_type degrees ) | Convert degrees to radians |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **degrees** ( vec_type radians ) | Convert radians to degrees |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **sin** ( vec_type x ) | Sine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **cos** ( vec_type x ) | Cosine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **tan** ( vec_type x ) | Tangent |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **asin** ( vec_type x ) | Arc-Sine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **acos** ( vec_type x ) | Arc-Cosine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **atan** ( vec_type y_over_x ) | Arc-Tangent |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **atan** ( vec_type y, vec_type x ) | Arc-Tangent to convert vector to angle |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **sinh** ( vec_type x ) | Hyperbolic-Sine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **cosh** ( vec_type x ) | Hyperbolic-Cosine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **tanh** ( vec_type x ) | Hyperbolic-Tangent |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **asinh** ( vec_type x ) | Inverse-Hyperbolic-Sine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **acosh** ( vec_type x ) | Inverse-Hyperbolic-Cosine |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **atanh** ( vec_type x ) | Inverse-Hyperbolic-Tangent |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **pow** ( vec_type x, vec_type y ) | Power |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **exp** ( vec_type x ) | Base-e Exponential |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **exp2** ( vec_type x ) | Base-2 Exponential |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **log** ( vec_type x ) | Natural Logarithm |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **log2** ( vec_type x ) | Base-2 Logarithm |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **sqrt** ( vec_type x ) | Square Root |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **inversesqrt** ( vec_type x ) | Inverse Square Root |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **abs** ( vec_type x ) | Absolute |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| ivec_type **abs** ( ivec_type x ) | Absolute |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **sign** ( vec_type x ) | Sign |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| ivec_type **sign** ( ivec_type x ) | Sign |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **floor** ( vec_type x ) | Floor |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **round** ( vec_type x ) | Round |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **roundEven** ( vec_type x ) | Round nearest even |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **trunc** ( vec_type x ) | Truncation |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **ceil** ( vec_type x ) | Ceil |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **fract** ( vec_type x ) | Fractional |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **mod** ( vec_type x, vec_type y ) | Remainder |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **mod** ( vec_type x , float y ) | Remainder |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **modf** ( vec_type x, out vec_type i ) | Fractional of x, with i has integer part |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **min** ( vec_type a, vec_type b ) | Minimum |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **max** ( vec_type a, vec_type b ) | Maximum |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **clamp** ( vec_type x, vec_type min, vec_type max ) | Clamp to Min-Max |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **mix** ( float a, float b, float c ) | Linear Interpolate |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **mix** ( vec_type a, vec_type b, float c ) | Linear Interpolate (Scalar Coef.) |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **mix** ( vec_type a, vec_type b, vec_type c ) | Linear Interpolate (Vector Coef.) |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **mix** ( vec_type a, vec_type b, bvec_type c ) | Linear Interpolate (Boolean-Vector Selection) |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **step** ( vec_type a, vec_type b ) | ``b[i] < a[i] ? 0.0 : 1.0`` |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **step** ( float a, vec_type b) | ``b[i] < a ? 0.0 : 1.0`` |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **smoothstep** ( vec_type a, vec_type b, vec_type c ) | Hermite Interpolate |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **smoothstep** ( float a, float b, vec_type c ) | Hermite Interpolate |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **isnan** ( vec_type x ) | Scalar, or vector component being NaN |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **isinf** ( vec_type x ) | Scalar, or vector component being INF |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| ivec_type **floatBitsToInt** ( vec_type x ) | Float->Int bit copying, no conversion |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| uvec_type **floatBitsToUint** ( vec_type x ) | Float->UInt bit copying, no conversion |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **intBitsToFloat** ( ivec_type x ) | Int->Float bit copying, no conversion |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **uintBitsToFloat** ( uvec_type x ) | UInt->Float bit copying, no conversion |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| float **length** ( vec_type x ) | Vector Length |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| float **distance** ( vec_type a, vec_type b ) | Distance between vectors i.e ``length(a - b)`` |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| float **dot** ( vec_type a, vec_type b ) | Dot Product |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec3 **cross** ( vec3 a, vec3 b ) | Cross Product |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **normalize** ( vec_type x ) | Normalize to unit length |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec3 **reflect** ( vec3 I, vec3 N ) | Reflect |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec3 **refract** ( vec3 I, vec3 N, float eta ) | Refract |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **faceforward** ( vec_type N, vec_type I, vec_type Nref ) | If dot(Nref, I) < 0, return N, otherwise –N |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| mat_type **matrixCompMult** ( mat_type x, mat_type y ) | Matrix Component Multiplication |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| mat_type **outerProduct** ( vec_type column, vec_type row ) | Matrix Outer Product |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| mat_type **transpose** ( mat_type m ) | Transpose Matrix |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| float **determinant** ( mat_type m ) | Matrix Determinant |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| mat_type **inverse** ( mat_type m ) | Inverse Matrix |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **lessThan** ( vec_type x, vec_type y ) | Bool vector cmp on < int/uint/float vectors |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **greaterThan** ( vec_type x, vec_type y ) | Bool vector cmp on > int/uint/float vectors |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **lessThanEqual** ( vec_type x, vec_type y ) | Bool vector cmp on <= int/uint/float vectors |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **greaterThanEqual** ( vec_type x, vec_type y ) | Bool vector cmp on >= int/uint/float vectors |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **equal** ( vec_type x, vec_type y ) | Bool vector cmp on == int/uint/float vectors |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **notEqual** ( vec_type x, vec_type y ) | Bool vector cmp on != int/uint/float vectors |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bool **any** ( bvec_type x ) | Any component is ``true`` |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bool **all** ( bvec_type x ) | All components are ``true`` |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| bvec_type **not** ( bvec_type x ) | Invert boolean vector |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| ivec2 **textureSize** ( sampler2D_type s, int lod ) | Get the size of a 2D texture |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| ivec3 **textureSize** ( sampler2DArray_type s, int lod ) | Get the size of a 2D texture array |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| ivec3 **textureSize** ( sampler3D s, int lod ) | Get the size of a 3D texture |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| ivec2 **textureSize** ( samplerCube s, int lod ) | Get the size of a Cube texture |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **texture** ( sampler2D_type s, vec2 uv [, float bias] ) | Perform a 2D texture read |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **texture** ( sampler2DArray_type s, vec3 uv [, float bias] ) | Perform a 2D texture array read |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **texture** ( sampler3D_type s, vec3 uv [, float bias] ) | Perform a 3D texture read |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4 **texture** ( samplerCube s, vec3 uv [, float bias] ) | Perform an Cube texture read |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureProj** ( sampler2D_type s, vec3 uv [, float bias] ) | Perform a 2D texture read with projection |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureProj** ( sampler2D_type s, vec4 uv [, float bias] ) | Perform a 2D texture read with projection |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureProj** ( sampler3D_type s, vec4 uv [, float bias] ) | Perform a 3D texture read with projection |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureLod** ( sampler2D_type s, vec2 uv, float lod ) | Perform a 2D texture read at custom mipmap |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureLod** ( sampler2DArray_type s, vec3 uv, float lod ) | Perform a 2D texture array read at custom mipmap |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureLod** ( sampler3D_type s, vec3 uv, float lod ) | Perform a 3D texture read at custom mipmap |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4 **textureLod** ( samplerCube s, vec3 uv, float lod ) | Perform a 3D texture read at custom mipmap |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureProjLod** ( sampler2D_type s, vec3 uv, float lod ) | Perform a 2D texture read with projection/lod |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureProjLod** ( sampler2D_type s, vec4 uv, float lod ) | Perform a 2D texture read with projection/lod |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **textureProjLod** ( sampler3D_type s, vec4 uv, float lod ) | Perform a 3D texture read with projection/lod |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **texelFetch** ( sampler2D_type s, ivec2 uv, int lod ) | Fetch a single texel using integer coords |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **texelFetch** ( sampler2DArray_type s, ivec3 uv, int lod ) | Fetch a single texel using integer coords |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec4_type **texelFetch** ( sampler3D_type s, ivec3 uv, int lod ) | Fetch a single texel using integer coords |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **dFdx** ( vec_type p ) | Derivative in x using local differencing |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **dFdy** ( vec_type p ) | Derivative in y using local differencing |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
-| vec_type **fwidth** ( vec_type p ) | Sum of absolute derivative in x and y |
|
|
|
-+----------------------------------------------------------------------------+--------------------------------------------------+
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| Function | Description |
|
|
|
++========================================================================+===============================================================+
|
|
|
+| vec_type **radians** (vec_type degrees) | Convert degrees to radians |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **degrees** (vec_type radians) | Convert radians to degrees |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **sin** (vec_type x) | Sine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **cos** (vec_type x) | Cosine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **tan** (vec_type x) | Tangent |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **asin** (vec_type x) | Arcsine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **acos** (vec_type x) | Arccosine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **atan** (vec_type y_over_x) | Arctangent |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **atan** (vec_type y, vec_type x) | Arctangent to convert vector to angle |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **sinh** (vec_type x) | Hyperbolic sine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **cosh** (vec_type x) | Hyperbolic cosine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **tanh** (vec_type x) | Hyperbolic tangent |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **asinh** (vec_type x) | Inverse hyperbolic sine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **acosh** (vec_type x) | Inverse hyperbolic cosine |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **atanh** (vec_type x) | Inverse hyperbolic tangent |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **pow** (vec_type x, vec_type y) | Power (undefined if ``x`` < 0 or if ``x`` = 0 and ``y`` <= 0) |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **exp** (vec_type x) | Base-e exponential |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **exp2** (vec_type x) | Base-2 exponential |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **log** (vec_type x) | Natural logarithm |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **log2** (vec_type x) | Base-2 logarithm |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **sqrt** (vec_type x) | Square root |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **inversesqrt** (vec_type x) | Inverse square root |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **abs** (vec_type x) | Absolute |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| ivec_type **abs** (ivec_type x) | Absolute |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **sign** (vec_type x) | Sign |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| ivec_type **sign** (ivec_type x) | Sign |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **floor** (vec_type x) | Floor |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **round** (vec_type x) | Round |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **roundEven** (vec_type x) | Round to the nearest even number |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **trunc** (vec_type x) | Truncation |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **ceil** (vec_type x) | Ceil |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **fract** (vec_type x) | Fractional |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **mod** (vec_type x, vec_type y) | Remainder |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **mod** (vec_type x , float y) | Remainder |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **modf** (vec_type x, out vec_type i) | Fractional of ``x``, with ``i`` as integer part |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **min** (vec_type a, vec_type b) | Minimum |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **max** (vec_type a, vec_type b) | Maximum |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **clamp** (vec_type x, vec_type min, vec_type max) | Clamp to ``min..max`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **mix** (float a, float b, float c) | Linear interpolate |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **mix** (vec_type a, vec_type b, float c) | Linear interpolate (scalar coefficient) |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **mix** (vec_type a, vec_type b, vec_type c) | Linear interpolate (vector coefficient) |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **mix** (vec_type a, vec_type b, bvec_type c) | Linear interpolate (boolean-vector selection) |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **step** (vec_type a, vec_type b) | ``b[i] < a[i] ? 0.0 : 1.0`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **step** (float a, vec_type b) | ``b[i] < a ? 0.0 : 1.0`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **smoothstep** (vec_type a, vec_type b, vec_type c) | Hermite interpolate |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **smoothstep** (float a, float b, vec_type c) | Hermite interpolate |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **isnan** (vec_type x) | Returns ``true`` if scalar or vector component is ``NaN`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **isinf** (vec_type x) | Returns ``true`` if scalar or vector component is ``INF`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| ivec_type **floatBitsToInt** (vec_type x) | Float->Int bit copying, no conversion |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| uvec_type **floatBitsToUint** (vec_type x) | Float->UInt bit copying, no conversion |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **intBitsToFloat** (ivec_type x) | Int->Float bit copying, no conversion |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **uintBitsToFloat** (uvec_type x) | UInt->Float bit copying, no conversion |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| float **length** (vec_type x) | Vector length |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| float **distance** (vec_type a, vec_type b) | Distance between vectors i.e ``length(a - b)`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| float **dot** (vec_type a, vec_type b) | Dot product |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec3 **cross** (vec3 a, vec3 b) | Cross croduct |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **normalize** (vec_type x) | Normalize to unit length |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec3 **reflect** (vec3 I, vec3 N) | Reflect |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec3 **refract** (vec3 I, vec3 N, float eta) | Refract |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **faceforward** (vec_type N, vec_type I, vec_type Nref) | If ``dot(Nref, I)`` < 0, return N, otherwise –N |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| mat_type **matrixCompMult** (mat_type x, mat_type y) | Matrix component multiplication |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| mat_type **outerProduct** (vec_type column, vec_type row) | Matrix outer product |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| mat_type **transpose** (mat_type m) | Transpose matrix |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| float **determinant** (mat_type m) | Matrix determinant |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| mat_type **inverse** (mat_type m) | Inverse matrix |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **lessThan** (vec_type x, vec_type y) | Bool vector comparison on < int/uint/float vectors |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **greaterThan** (vec_type x, vec_type y) | Bool vector comparison on > int/uint/float vectors |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **lessThanEqual** (vec_type x, vec_type y) | Bool vector comparison on <= int/uint/float vectors |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **greaterThanEqual** (vec_type x, vec_type y) | Bool vector comparison on >= int/uint/float vectors |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **equal** (vec_type x, vec_type y) | Bool vector comparison on == int/uint/float vectors |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **notEqual** (vec_type x, vec_type y) | Bool vector comparison on != int/uint/float vectors |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bool **any** (bvec_type x) | Any component is ``true`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bool **all** (bvec_type x) | All components are ``true`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| bvec_type **not** (bvec_type x) | Invert boolean vector |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| ivec2 **textureSize** (sampler2D_type s, int lod) | Get the size of a 2D texture |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| ivec3 **textureSize** (sampler2DArray_type s, int lod) | Get the size of a 2D texture array |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| ivec3 **textureSize** (sampler3D s, int lod) | Get the size of a 3D texture |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| ivec2 **textureSize** (samplerCube s, int lod) | Get the size of a cubemap texture |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **texture** (sampler2D_type s, vec2 uv [, float bias]) | Perform a 2D texture read |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **texture** (sampler2DArray_type s, vec3 uv [, float bias]) | Perform a 2D texture array read |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **texture** (sampler3D_type s, vec3 uv [, float bias]) | Perform a 3D texture read |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4 **texture** (samplerCube s, vec3 uv [, float bias]) | Perform a cubemap texture read |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureProj** (sampler2D_type s, vec3 uv [, float bias]) | Perform a 2D texture read with projection |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureProj** (sampler2D_type s, vec4 uv [, float bias]) | Perform a 2D texture read with projection |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureProj** (sampler3D_type s, vec4 uv [, float bias]) | Perform a 3D texture read with projection |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureLod** (sampler2D_type s, vec2 uv, float lod) | Perform a 2D texture read at custom mipmap |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureLod** (sampler2DArray_type s, vec3 uv, float lod) | Perform a 2D texture array read at custom mipmap |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureLod** (sampler3D_type s, vec3 uv, float lod) | Perform a 3D texture read at custom mipmap |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4 **textureLod** (samplerCube s, vec3 uv, float lod) | Perform a 3D texture read at custom mipmap |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureProjLod** (sampler2D_type s, vec3 uv, float lod) | Perform a 2D texture read with projection/LOD |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureProjLod** (sampler2D_type s, vec4 uv, float lod) | Perform a 2D texture read with projection/LOD |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **textureProjLod** (sampler3D_type s, vec4 uv, float lod) | Perform a 3D texture read with projection/LOD |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **texelFetch** (sampler2D_type s, ivec2 uv, int lod) | Fetch a single texel using integer coordinates |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **texelFetch** (sampler2DArray_type s, ivec3 uv, int lod) | Fetch a single texel using integer coordinates |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec4_type **texelFetch** (sampler3D_type s, ivec3 uv, int lod) | Fetch a single texel using integer coordinates |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **dFdx** (vec_type p) | Derivative in ``x`` using local differencing |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **dFdy** (vec_type p) | Derivative in ``y`` using local differencing |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|
|
|
+| vec_type **fwidth** (vec_type p) | Sum of absolute derivative in ``x`` and ``y`` |
|
|
|
++------------------------------------------------------------------------+---------------------------------------------------------------+
|