Create world matrix uniform

This commit is contained in:
2021-02-25 23:30:02 +01:00
parent 37e26dcb07
commit 9575eab230
9 changed files with 86 additions and 61 deletions
+2 -18
View File
@@ -9,27 +9,11 @@ uniform vec2 winSize;
uniform float zoom;
uniform vec2 translation;
uniform float rotation;
vec2 tran(vec2 v)
{
return (v - translation);
}
vec2 rot(vec2 v)
{
return vec2 ( v.x * cos(-rotation) - v.y * sin(-rotation)
, v.x * sin(-rotation) + v.y * cos(-rotation)
);
}
vec2 scal(vec2 v)
{
return vec2 ( 2 * v.x * zoom / winSize.x
, 2 * v.y * zoom / winSize.y
);
}
uniform mat4 worldMat;
void main()
{
gl_Position = vec4(scal(rot(tran(position.xy))),position.z,1);
gl_Position = worldMat * vec4(position.xyz,1);
vColor = color;
vparams = saEaRadWdth;
}