Files
loop/shader/basic.vert
T
2021-02-25 23:30:02 +01:00

35 lines
790 B
GLSL

#version 430 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec4 color;
out vec4 vColor;
uniform vec2 winSize;
uniform float zoom;
uniform float rotation;
uniform vec2 translation;
uniform mat4 worldMat;
mat4 tranMat = mat4
( 1.0, 0.0, 0.0, 0.0
, 0.0, 1.0, 0.0, 0.0
, 0.0, 0.0, 1.0, 0.0
, -translation.x, -translation.y, 0.0, 1.0
) ;
mat4 rotMat = mat4
( cos(rotation), sin(-rotation), 0.0, 0.0
, sin(rotation), cos(rotation), 0.0, 0.0
, 0.0, 0.0, 1.0, 0.0
, 0.0, 0.0, 0.0, 1.0
) ;
mat4 scalMat = mat4
( 2*zoom/winSize.x, 0.0, 0.0, 0.0
, 0.0, 2*zoom/winSize.y, 0.0, 0.0
, 0.0, 0.0, 1.0, 0.0
, 0.0, 0.0, 0.0, 1.0
) ;
void main()
{
gl_Position = worldMat * vec4(position.xyz,1);
vColor = color;
}