1234567891011121314151617181920212223242526272829303132333435 |
- #version 430
- layout (location = 0) in vec3 position;
- layout (location = 1) in vec2 tex;
- layout (location = 2) in vec3 normal;
- uniform mat4 proj;
- uniform mat4 view;
- uniform mat4 model;
- uniform mat4 projShadow;
- uniform mat4 viewShadow;
- uniform mat4 projViewShadow;
- out vec3 varPosition;
- out vec2 varTex;
- out vec3 varNormal;
- out vec4 varShadow;
- const vec3 light = vec3(-0.280166, -0.573576, -0.769751);
- void main(void)
- {
- // transforming normals must not use the fourth dimension
- // should be the inverse transposed matrix
- varNormal = (model * vec4(normal, 0.0)).xyz;
-
- varTex = tex;
-
- vec4 worldPos = view * model * vec4(position, 1.0);
- varPosition = worldPos.xyz;
- gl_Position = proj * worldPos;
- varShadow = projViewShadow * vec4(position - light * 0.05, 1.0);
- }
|