summaryrefslogtreecommitdiffstats
path: root/builtins/tools/generate_outerProductGLSL.py
blob: 48fb72197c3a630c0723816ee516d0015d796812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)