diff --git a/shaders/manif.fs b/shaders/manif.fs index a797592..1f0cca6 100644 --- a/shaders/manif.fs +++ b/shaders/manif.fs @@ -6,17 +6,17 @@ in vec3 vec_normal; out vec4 fragColor; uniform vec4 couleur; -uniform vec4 lumpos; +uniform vec4 lum_pos; uniform mat4 view; -uniform vec4 lumcolor; +uniform vec4 lum_color; void main() { const vec3 vue = vec3(0, 0, -1); const vec4 soleil_color = vec4(0.81f, 0.78f, 0.66f, 1.0f); - vec3 torche = normalize(pos_model.xyz - lumpos.xyz); + vec3 torche = normalize(pos_model.xyz - lum_pos.xyz); float intensite_lumineuse = clamp(dot(vec_normal, -torche), 0, 1); vec3 reflet = (transpose(inverse(view)) * vec4(reflect(torche, vec_normal), 0)).xyz; float intensite_specularite = pow(clamp(dot(reflet, -vue), 0, 1), 10); - fragColor = intensite_specularite * lumcolor + 0.1 * soleil_color + 0.9 * intensite_lumineuse * couleur; + fragColor = intensite_specularite * lum_color + 0.1 * soleil_color + 0.9 * intensite_lumineuse * couleur; } diff --git a/src/manif.c b/src/manif.c index b980898..59c5f3b 100644 --- a/src/manif.c +++ b/src/manif.c @@ -54,8 +54,8 @@ static void draw(void) { const GLfloat lumpos[] = {1, (GLfloat)(2 + 2 * sin(deplacement)), 1, 1}, lumcolor[] = {1, 0, 0, 1}; - glUniform4fv(glGetUniformLocation(_pId, "lumpos"), 1, lumpos); - glUniform4fv(glGetUniformLocation(_pId, "lumcolor"), 1, lumcolor); + glUniform4fv(glGetUniformLocation(_pId, "lum_pos"), 1, lumpos); + glUniform4fv(glGetUniformLocation(_pId, "lum_color"), 1, lumcolor); bindAndLoadf(matrix_proj); GLfloat ratio = (GLfloat)_dims[0] / (GLfloat)_dims[1]; @@ -63,9 +63,7 @@ static void draw(void) { bindAndLoadf(matrix_view); const GLfloat distance = 2; - const GLfloat eye[3] = {0, distance, distance}; - gl4duLookAtf(eye[0], eye[1], eye[2], 0, 0, 0, 0, 1, 0); - glUniform4fv(glGetUniformLocation(_pId, "camerapos"), 1, eye); + gl4duLookAtf(0, distance, distance, 0, 0, 0, 0, 1, 0); bindAndLoadf(matrix_model); gl4duRotatef(-90, 1, 0, 0);