This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
api8/shaders/manif.vs
2023-05-08 11:29:12 +02:00

18 lines
517 B
GLSL

#version 330
layout(location = 0) in vec3 pos;
layout(location = 1) in vec3 normal;
out float intensite_eclairage;
uniform mat4 proj, model, view;
uniform vec4 lumpos;
void main() {
vec4 pos_model = model * vec4(pos, 1);
// vec3 soleil = normalize(vec3(0, -20, 0));
vec3 torche = normalize(pos_model.xyz - lumpos.xyz);
vec3 vec_normal = normalize(transpose(inverse(model)) * vec4(normal, 0)).xyz;
intensite_eclairage = clamp(dot(vec_normal, -(torche)), 0, 1);
gl_Position = proj * view * pos_model;
}