This repository has been archived on 2022-05-19. You can view files and clone it, but cannot push or open issues or pull requests.
DemoGL4D/shaders/cube.vs
2022-05-15 21:09:27 +02:00

23 lines
492 B
GLSL

#version 330
layout(location = 0) in vec3 position;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 texCoord;
uniform mat4 proj;
uniform mat4 modview;
uniform mat4 view;
out vec4 vsoColor;
out float il;
const vec3 Ld = vec3(0., -.707, -.707);
void main() {
vec3 n = (transpose(inverse(modview)) * vec4(normal, 0.0)).xyz;
il = clamp(dot(n, -Ld), 0.0, 1.0);
gl_Position = proj * view * modview * vec4(position, 1.);
vsoColor = vec4(texCoord, 0.5, 1);
}