18 lines
517 B
GLSL
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;
|
|
}
|