diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2010-06-09 13:27:16 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2010-06-09 13:27:16 -0700 |
commit | 539f29323f16717da25502f7b0e2846289ef1399 (patch) | |
tree | a6c099299ecf85e871216ae872b5f405d63c4c47 /builtins/110 | |
parent | 29b22287fe18afe5b2c55878a59046edad544089 (diff) |
Implement 'faceforward' builtin.
Diffstat (limited to 'builtins/110')
-rw-r--r-- | builtins/110/faceforward | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/builtins/110/faceforward b/builtins/110/faceforward new file mode 100644 index 0000000000..d170397238 --- /dev/null +++ b/builtins/110/faceforward @@ -0,0 +1,37 @@ +((function faceforward + (signature float + (parameters + (declare (in) float N) + (declare (in) float I) + (declare (in) float Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression float neg (var_ref N))))))) + + (signature vec2 + (parameters + (declare (in) vec2 N) + (declare (in) vec2 I) + (declare (in) vec2 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec2 neg (var_ref N))))))) + + (signature vec3 + (parameters + (declare (in) vec3 N) + (declare (in) vec3 I) + (declare (in) vec3 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec3 neg (var_ref N))))))) + + (signature vec4 + (parameters + (declare (in) vec4 N) + (declare (in) vec4 I) + (declare (in) vec4 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec4 neg (var_ref N))))))) +)) |