32 lines
808 B
GLSL
32 lines
808 B
GLSL
#version 330
|
|
|
|
// Matrices
|
|
uniform mat4 modelViewMatrix;
|
|
uniform mat4 MVP;
|
|
uniform mat4 normalMatrix;
|
|
uniform mat4 viewMatrix;
|
|
|
|
layout(location = 0)in vec3 inPosition;
|
|
layout(location = 1)in vec3 inNormal;
|
|
layout(location = 2)in vec4 inTexCoord;
|
|
|
|
out vec3 varNormal;
|
|
out vec2 varTexCoord;
|
|
|
|
/*void computeLightingVectorsInView(in vec3 posInView, in vec3 lightPosition, out vec3 lightDir, out vec3 halfVec){
|
|
lightDir = vec3(viewMatrix*vec4(lightPosition, 1.0)) - posInView;
|
|
halfVec = normalize(lightDir - posInView);
|
|
lightDir = normalize(lightDir);
|
|
}*/
|
|
|
|
void main(void) {
|
|
// normales corrigées (en fonction de la vue)
|
|
varNormal = normalize(vec3(normalMatrix*vec4(inNormal,0)));
|
|
|
|
// coordonnées de texture
|
|
varTexCoord = inTexCoord.xy;
|
|
|
|
// position du vertex
|
|
gl_Position = MVP*vec4(inPosition, 1.0);
|
|
}
|