Home | History | Annotate | Download | only in profiles
      1 #version 120
      2 /*
      3  * 8.1 - Angle and Trigonometry Functions
      4  */
      5 float radians(float degrees);
      6 vec2  radians(vec2  degrees);
      7 vec3  radians(vec3  degrees);
      8 vec4  radians(vec4  degrees);
      9 
     10 float degrees(float radians);
     11 vec2  degrees(vec2  radians);
     12 vec3  degrees(vec3  radians);
     13 vec4  degrees(vec4  radians);
     14 
     15 float sin(float angle);
     16 vec2  sin(vec2  angle);
     17 vec3  sin(vec3  angle);
     18 vec4  sin(vec4  angle);
     19 
     20 float cos(float angle);
     21 vec2  cos(vec2  angle);
     22 vec3  cos(vec3  angle);
     23 vec4  cos(vec4  angle);
     24 
     25 float tan(float angle);
     26 vec2  tan(vec2  angle);
     27 vec3  tan(vec3  angle);
     28 vec4  tan(vec4  angle);
     29 
     30 float asin(float angle);
     31 vec2  asin(vec2  angle);
     32 vec3  asin(vec3  angle);
     33 vec4  asin(vec4  angle);
     34 
     35 float acos(float angle);
     36 vec2  acos(vec2  angle);
     37 vec3  acos(vec3  angle);
     38 vec4  acos(vec4  angle);
     39 
     40 float atan(float y, float x);
     41 vec2  atan(vec2  y, vec2  x);
     42 vec3  atan(vec3  y, vec3  x);
     43 vec4  atan(vec4  y, vec4  x);
     44 
     45 float atan(float y_over_x);
     46 vec2  atan(vec2  y_over_x);
     47 vec3  atan(vec3  y_over_x);
     48 vec4  atan(vec4  y_over_x);
     49 
     50 /*
     51  * 8.2 - Exponential Functions
     52  */
     53 float pow(float x, float y);
     54 vec2  pow(vec2  x, vec2  y);
     55 vec3  pow(vec3  x, vec3  y);
     56 vec4  pow(vec4  x, vec4  y);
     57 
     58 float exp(float x);
     59 vec2  exp(vec2  x);
     60 vec3  exp(vec3  x);
     61 vec4  exp(vec4  x);
     62 
     63 float log(float x);
     64 vec2  log(vec2  x);
     65 vec3  log(vec3  x);
     66 vec4  log(vec4  x);
     67 
     68 float exp2(float x);
     69 vec2  exp2(vec2  x);
     70 vec3  exp2(vec3  x);
     71 vec4  exp2(vec4  x);
     72 
     73 float log2(float x);
     74 vec2  log2(vec2  x);
     75 vec3  log2(vec3  x);
     76 vec4  log2(vec4  x);
     77 
     78 float sqrt(float x);
     79 vec2  sqrt(vec2  x);
     80 vec3  sqrt(vec3  x);
     81 vec4  sqrt(vec4  x);
     82 
     83 float inversesqrt(float x);
     84 vec2  inversesqrt(vec2  x);
     85 vec3  inversesqrt(vec3  x);
     86 vec4  inversesqrt(vec4  x);
     87 
     88 /*
     89  * 8.3 - Common Functions
     90  */
     91 float abs(float x);
     92 vec2  abs(vec2  x);
     93 vec3  abs(vec3  x);
     94 vec4  abs(vec4  x);
     95 
     96 float sign(float x);
     97 vec2  sign(vec2  x);
     98 vec3  sign(vec3  x);
     99 vec4  sign(vec4  x);
    100 
    101 float floor(float x);
    102 vec2  floor(vec2  x);
    103 vec3  floor(vec3  x);
    104 vec4  floor(vec4  x);
    105 
    106 float ceil(float x);
    107 vec2  ceil(vec2  x);
    108 vec3  ceil(vec3  x);
    109 vec4  ceil(vec4  x);
    110 
    111 float fract(float x);
    112 vec2  fract(vec2  x);
    113 vec3  fract(vec3  x);
    114 vec4  fract(vec4  x);
    115 
    116 float mod(float x, float y);
    117 vec2  mod(vec2  x, float y);
    118 vec3  mod(vec3  x, float y);
    119 vec4  mod(vec4  x, float y);
    120 
    121 vec2  mod(vec2  x, vec2  y);
    122 vec3  mod(vec3  x, vec3  y);
    123 vec4  mod(vec4  x, vec4  y);
    124 
    125 float min(float x, float y);
    126 vec2  min(vec2  x, vec2  y);
    127 vec3  min(vec3  x, vec3  y);
    128 vec4  min(vec4  x, vec4  y);
    129 
    130 vec2  min(vec2  x, float y);
    131 vec3  min(vec3  x, float y);
    132 vec4  min(vec4  x, float y);
    133 
    134 float max(float x, float y);
    135 vec2  max(vec2  x, vec2  y);
    136 vec3  max(vec3  x, vec3  y);
    137 vec4  max(vec4  x, vec4  y);
    138 
    139 vec2  max(vec2  x, float y);
    140 vec3  max(vec3  x, float y);
    141 vec4  max(vec4  x, float y);
    142 
    143 float clamp(float x, float minVal, float maxVal);
    144 vec2  clamp(vec2  x, vec2  minVal, vec2  maxVal);
    145 vec3  clamp(vec3  x, vec3  minVal, vec3  maxVal);
    146 vec4  clamp(vec4  x, vec4  minVal, vec4  maxVal);
    147 
    148 vec2  clamp(vec2  x, float minVal, float maxVal);
    149 vec3  clamp(vec3  x, float minVal, float maxVal);
    150 vec4  clamp(vec4  x, float minVal, float maxVal);
    151 
    152 float mix(float x, float y, float a);
    153 vec2  mix(vec2  x, vec2  y, vec2  a);
    154 vec3  mix(vec3  x, vec3  y, vec3  a);
    155 vec4  mix(vec4  x, vec4  y, vec4  a);
    156 
    157 vec2  mix(vec2  x, vec2  y, float a);
    158 vec3  mix(vec3  x, vec3  y, float a);
    159 vec4  mix(vec4  x, vec4  y, float a);
    160 
    161 float step(float edge, float x);
    162 vec2  step(vec2  edge, vec2  x);
    163 vec3  step(vec3  edge, vec3  x);
    164 vec4  step(vec4  edge, vec4  x);
    165 
    166 vec2  step(float edge, vec2  x);
    167 vec3  step(float edge, vec3  x);
    168 vec4  step(float edge, vec4  x);
    169 
    170 float smoothstep(float edge0, float edge1, float x);
    171 vec2  smoothstep(vec2  edge0, vec2  edge1, vec2  x);
    172 vec3  smoothstep(vec3  edge0, vec3  edge1, vec3  x);
    173 vec4  smoothstep(vec4  edge0, vec4  edge1, vec4  x);
    174 
    175 vec2  smoothstep(float edge0, float edge1, vec2  x);
    176 vec3  smoothstep(float edge0, float edge1, vec3  x);
    177 vec4  smoothstep(float edge0, float edge1, vec4  x);
    178 
    179 /*
    180  * 8.4 - Geometric Functions
    181  */
    182 float length(float x);
    183 float length(vec2  x);
    184 float length(vec3  x);
    185 float length(vec4  x);
    186 
    187 float distance(float p0, float p1);
    188 float distance(vec2  p0, vec2  p1);
    189 float distance(vec3  p0, vec3  p1);
    190 float distance(vec4  p0, vec4  p1);
    191 
    192 float dot(float x, float y);
    193 float dot(vec2  x, vec2  y);
    194 float dot(vec3  x, vec3  y);
    195 float dot(vec4  x, vec4  y);
    196 
    197 vec3 cross(vec3 x, vec3 y);
    198 
    199 float normalize(float x);
    200 vec2  normalize(vec2  x);
    201 vec3  normalize(vec3  x);
    202 vec4  normalize(vec4  x);
    203 
    204 float faceforward(float N, float I, float Nref);
    205 vec2  faceforward(vec2  N, vec2  I, vec2  Nref);
    206 vec3  faceforward(vec3  N, vec3  I, vec3  Nref);
    207 vec4  faceforward(vec4  N, vec4  I, vec4  Nref);
    208 
    209 float reflect(float I, float N);
    210 vec2  reflect(vec2  I, vec2  N);
    211 vec3  reflect(vec3  I, vec3  N);
    212 vec4  reflect(vec4  I, vec4  N);
    213 
    214 float refract(float I, float N, float eta);
    215 vec2  refract(vec2  I, vec2  N, float eta);
    216 vec3  refract(vec3  I, vec3  N, float eta);
    217 vec4  refract(vec4  I, vec4  N, float eta);
    218 
    219 
    220 /*
    221  * 8.5 - Matrix Functions
    222  */
    223 mat2   matrixCompMult(mat2   x, mat2   y);
    224 mat3   matrixCompMult(mat3   x, mat3   y);
    225 mat4   matrixCompMult(mat4   x, mat4   y);
    226 mat2x3 matrixCompMult(mat2x3 x, mat2x3 y);
    227 mat2x4 matrixCompMult(mat2x4 x, mat2x4 y);
    228 mat3x2 matrixCompMult(mat3x2 x, mat3x2 y);
    229 mat3x4 matrixCompMult(mat3x4 x, mat3x4 y);
    230 mat4x2 matrixCompMult(mat4x2 x, mat4x2 y);
    231 mat4x3 matrixCompMult(mat4x3 x, mat4x3 y);
    232 
    233 mat2   outerProduct(vec2 c, vec2 r);
    234 mat3   outerProduct(vec3 c, vec3 r);
    235 mat4   outerProduct(vec4 c, vec4 r);
    236 
    237 mat2x3 outerProduct(vec3 c, vec2 r);
    238 mat3x2 outerProduct(vec2 c, vec3 r);
    239 
    240 mat2x4 outerProduct(vec4 c, vec2 r);
    241 mat4x2 outerProduct(vec2 c, vec4 r);
    242 
    243 mat3x4 outerProduct(vec4 c, vec3 r);
    244 mat4x3 outerProduct(vec3 c, vec4 r);
    245 
    246 mat2   transpose(mat2 m);
    247 mat3   transpose(mat3 m);
    248 mat4   transpose(mat4 m);
    249 
    250 mat2x3 transpose(mat3x2 m);
    251 mat3x2 transpose(mat2x3 m);
    252 
    253 mat2x4 transpose(mat4x2 m);
    254 mat4x2 transpose(mat2x4 m);
    255 
    256 mat3x4 transpose(mat4x3 m);
    257 mat4x3 transpose(mat3x4 m);
    258 
    259 /*
    260  * 8.6 - Vector Relational Functions
    261  */
    262 bvec2 lessThan( vec2 x,  vec2 y);
    263 bvec3 lessThan( vec3 x,  vec3 y);
    264 bvec4 lessThan( vec4 x,  vec4 y);
    265 bvec2 lessThan(ivec2 x, ivec2 y);
    266 bvec3 lessThan(ivec3 x, ivec3 y);
    267 bvec4 lessThan(ivec4 x, ivec4 y);
    268 
    269 bvec2 lessThanEqual( vec2 x,  vec2 y);
    270 bvec3 lessThanEqual( vec3 x,  vec3 y);
    271 bvec4 lessThanEqual( vec4 x,  vec4 y);
    272 bvec2 lessThanEqual(ivec2 x, ivec2 y);
    273 bvec3 lessThanEqual(ivec3 x, ivec3 y);
    274 bvec4 lessThanEqual(ivec4 x, ivec4 y);
    275 
    276 bvec2 greaterThan( vec2 x,  vec2 y);
    277 bvec3 greaterThan( vec3 x,  vec3 y);
    278 bvec4 greaterThan( vec4 x,  vec4 y);
    279 bvec2 greaterThan(ivec2 x, ivec2 y);
    280 bvec3 greaterThan(ivec3 x, ivec3 y);
    281 bvec4 greaterThan(ivec4 x, ivec4 y);
    282 
    283 bvec2 greaterThanEqual( vec2 x,  vec2 y);
    284 bvec3 greaterThanEqual( vec3 x,  vec3 y);
    285 bvec4 greaterThanEqual( vec4 x,  vec4 y);
    286 bvec2 greaterThanEqual(ivec2 x, ivec2 y);
    287 bvec3 greaterThanEqual(ivec3 x, ivec3 y);
    288 bvec4 greaterThanEqual(ivec4 x, ivec4 y);
    289 
    290 bvec2 equal( vec2 x,  vec2 y);
    291 bvec3 equal( vec3 x,  vec3 y);
    292 bvec4 equal( vec4 x,  vec4 y);
    293 bvec2 equal(ivec2 x, ivec2 y);
    294 bvec3 equal(ivec3 x, ivec3 y);
    295 bvec4 equal(ivec4 x, ivec4 y);
    296 bvec2 equal(bvec2 x, bvec2 y);
    297 bvec3 equal(bvec3 x, bvec3 y);
    298 bvec4 equal(bvec4 x, bvec4 y);
    299 
    300 bvec2 notEqual( vec2 x,  vec2 y);
    301 bvec3 notEqual( vec3 x,  vec3 y);
    302 bvec4 notEqual( vec4 x,  vec4 y);
    303 bvec2 notEqual(ivec2 x, ivec2 y);
    304 bvec3 notEqual(ivec3 x, ivec3 y);
    305 bvec4 notEqual(ivec4 x, ivec4 y);
    306 bvec2 notEqual(bvec2 x, bvec2 y);
    307 bvec3 notEqual(bvec3 x, bvec3 y);
    308 bvec4 notEqual(bvec4 x, bvec4 y);
    309 
    310 bool any(bvec2 x);
    311 bool any(bvec3 x);
    312 bool any(bvec4 x);
    313 
    314 bool all(bvec2 x);
    315 bool all(bvec3 x);
    316 bool all(bvec4 x);
    317 
    318 bvec2 not(bvec2 x);
    319 bvec3 not(bvec3 x);
    320 bvec4 not(bvec4 x);
    321 
    322 /*
    323  * 8.7 - Texture Lookup Functions
    324  */
    325 vec4 texture1D       (sampler1D sampler, float coord);
    326 vec4 texture1DProj   (sampler1D sampler, vec2  coord);
    327 vec4 texture1DProj   (sampler1D sampler, vec4  coord);
    328 
    329 vec4 texture2D       (sampler2D sampler, vec2 coord);
    330 vec4 texture2DProj   (sampler2D sampler, vec3 coord);
    331 vec4 texture2DProj   (sampler2D sampler, vec4 coord);
    332 
    333 vec4 texture3D       (sampler3D sampler, vec3 coord);
    334 vec4 texture3DProj   (sampler3D sampler, vec4 coord);
    335 
    336 vec4 textureCube     (samplerCube sampler, vec3 coord);
    337 
    338 vec4 shadow1D       (sampler1DShadow sampler, vec3 coord);
    339 vec4 shadow2D       (sampler2DShadow sampler, vec3 coord);
    340 vec4 shadow1DProj   (sampler1DShadow sampler, vec4 coord);
    341 vec4 shadow2DProj   (sampler2DShadow sampler, vec4 coord);
    342 
    343 /*
    344  * 8.9 - Noise Functions
    345  */
    346 float noise1(float x);
    347 float noise1(vec2  x);
    348 float noise1(vec3  x);
    349 float noise1(vec4  x);
    350 
    351 vec2  noise2(float x);
    352 vec2  noise2(vec2  x);
    353 vec2  noise2(vec3  x);
    354 vec2  noise2(vec4  x);
    355 
    356 vec3  noise3(float x);
    357 vec3  noise3(vec2  x);
    358 vec3  noise3(vec3  x);
    359 vec3  noise3(vec4  x);
    360 
    361 vec4  noise4(float x);
    362 vec4  noise4(vec2  x);
    363 vec4  noise4(vec3  x);
    364 vec4  noise4(vec4  x);
    365