SPV: Implement all matrix operators {+,-,*,/} for {matrix,scalar,vector}.

This commit is contained in:
John Kessenich
2015-12-12 12:28:14 -07:00
parent 494a02a2b0
commit 04bb8a01d6
9 changed files with 1140 additions and 76 deletions

View File

@@ -1,34 +1,45 @@
#version 130
uniform mat3 colorTransform;
in vec3 Color;
uniform mat4 m, n;
in mat3x4 m1;
in mat3x4 m2;
in float f;
in vec3 v3;
in vec4 v4;
uniform mat4x3 um43;
uniform mat3x4 un34;
in vec4 v;
in vec3 u;
out vec4 color;
void main()
{
gl_FragColor = vec4(un34[1]);
gl_FragColor += vec4(Color * colorTransform, 1.0);
mat3x4 sum34;
vec3 sum3;
vec4 sum4;
if (m != n)
gl_FragColor += v;
else {
gl_FragColor += m * v;
gl_FragColor += v * (m - n);
}
sum34 = m1 - m2;
sum34 += m1 * f;
sum34 += f * m1;
sum34 /= matrixCompMult(m1, m2);
sum34 += m1 / f;
sum34 += f / m1;
sum34 += f;
sum34 -= f;
mat3x4 m34 = outerProduct(v, u);
m34 += mat3x4(v.x);
m34 += mat3x4(u, u.x, u, u.x, u, u.x);
sum3 = v4 * m2;
sum4 = m2 * v3;
if (m34 == un34)
gl_FragColor += m34 * u;
else
gl_FragColor += (un34 * um43) * v;
mat4x3 m43 = transpose(sum34);
mat4 m4 = m1 * m43;
sum4 = v4 * m4;
color = sum4;
//spv if (m1 != sum34)
++sum34;
// else
--sum34;
sum34 += mat3x4(f);
sum34 += mat3x4(v3, f, v3, f, v3, f);
color += sum3 * m43 + sum4;
}