diff options
author | Eric Anholt <eric@anholt.net> | 2010-05-19 14:01:33 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-06-01 15:15:05 -0700 |
commit | 5b9ac87941a11c72a220ba14c25cf0f8bc5acffa (patch) | |
tree | 476f8cf8e317b9bfa8ab344f3d369d5f97146a14 /builtin_function.cpp | |
parent | da46e5f5345ed2fa9c74d135267f3d5729c04ed1 (diff) |
builtins: Add support for reflect().
Fixes glsl-orangebook-ch06.frag parsing.
Diffstat (limited to 'builtin_function.cpp')
-rw-r--r-- | builtin_function.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/builtin_function.cpp b/builtin_function.cpp index 4203502e45..5bb0007e6d 100644 --- a/builtin_function.cpp +++ b/builtin_function.cpp @@ -1329,6 +1329,67 @@ static const char *builtins_110_radians = { "))\n" }; +static const char *builtins_110_reflect = { + "((function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float i)\n" + " (declare (in) float n))\n" + " ((return (expression float -\n" + " (var_ref i)\n" + " (expression float *\n" + " (constant float (2.0))\n" + " (expression float *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 i)\n" + " (declare (in) vec2 n))\n" + " ((return (expression vec2 -\n" + " (var_ref i)\n" + " (expression vec2 *\n" + " (constant float (2.0))\n" + " (expression vec2 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 i)\n" + " (declare (in) vec3 n))\n" + " ((return (expression vec3 -\n" + " (var_ref i)\n" + " (expression vec3 *\n" + " (constant float (2.0))\n" + " (expression vec3 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 i)\n" + " (declare (in) vec4 n))\n" + " ((return (expression vec4 -\n" + " (var_ref i)\n" + " (expression vec4 *\n" + " (constant float (2.0))\n" + " (expression vec4 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + "))\n" +}; + static const char *builtins_110_sign = { "((function sign\n" " (signature float\n" @@ -1770,6 +1831,7 @@ static const char *functions_for_110 [] = { builtins_110_notEqual, builtins_110_pow, builtins_110_radians, + builtins_110_reflect, builtins_110_sign, builtins_110_sin, builtins_110_smoothstep, |