summaryrefslogtreecommitdiff
path: root/builtins/tools
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-06-09 15:47:09 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-06-09 15:47:34 -0700
commit43ff6fc4ae5f47f1537707b794253929780cafc1 (patch)
tree9edeeec5683877d0a58e0a1ba31354f3e9c73313 /builtins/tools
parent0c8ffadc8cc0b0497873a8ce46ae4e1ae03eee54 (diff)
Implement 1.20 'outerProduct' builtin.
Diffstat (limited to 'builtins/tools')
-rwxr-xr-xbuiltins/tools/generate_outerProductGLSL.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/builtins/tools/generate_outerProductGLSL.py b/builtins/tools/generate_outerProductGLSL.py
new file mode 100755
index 0000000000..48fb72197c
--- /dev/null
+++ b/builtins/tools/generate_outerProductGLSL.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+def gen(x, y):
+ type = "mat" + str(x)
+ if x != y:
+ type = type + "x" + str(y)
+ print type + " outerProduct(vec" + str(x) + " u, vec" + str(y) + " v)\n{"
+ print " " + type + " m;"
+
+ for i in range(x):
+ print " m[" + str(i) + "] = v * u[" + str(i) + "];"
+ print " return m;\n}"
+
+print "#version 120"
+gen(2,2)
+gen(2,3) # mat2x3 means 2 columns, 3 rows
+gen(2,4)
+gen(3,2)
+gen(3,3)
+gen(3,4)
+gen(4,2)
+gen(4,3)
+gen(4,4)