From 6a9b1e1f06c2859f0c20375189c6ff02ed769d1a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 3 May 2010 21:29:01 -0700 Subject: Implement "cross" builtin. --- builtins/110/cross | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 builtins/110/cross diff --git a/builtins/110/cross b/builtins/110/cross new file mode 100644 index 0000000000..deb2f952bf --- /dev/null +++ b/builtins/110/cross @@ -0,0 +1,17 @@ +((function cross + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1))) + (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0))))) + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1))) + (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0))))) + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1))) + (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0))))) + (return (var_ref t)))) +)) -- cgit v1.2.3