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

24 lines
489 B
Text
Raw Normal View History

#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() {
2022-05-16 12:39:23 +02:00
vec3 n = (transpose(inverse(modview)) * vec4(normal, 0.)).xyz;
il = clamp(dot(n, -Ld), 0., 1.);
2022-05-15 21:09:27 +02:00
gl_Position = proj * view * modview * vec4(position, 1.);
vsoColor = vec4(texCoord, 0.5, 1);
}