diff --git a/lab3/src/debug.log b/lab3/src/debug.log index 15b0c938179ef68624aae18dec8e82a4fc30f2b6..813e154b4a5ed67d053f7f72135045737eaed596 100644 --- a/lab3/src/debug.log +++ b/lab3/src/debug.log @@ -1,2 +1,3 @@ [1120/133929.315:ERROR:directory_reader_win.cc(43)] FindFirstFile: Le chemin d�acc�s sp�cifi� est introuvable. (0x3) [1126/175840.510:ERROR:directory_reader_win.cc(43)] FindFirstFile: Le chemin d�acc�s sp�cifi� est introuvable. (0x3) +[1127/141033.333:ERROR:directory_reader_win.cc(43)] FindFirstFile: Le chemin d�acc�s sp�cifi� est introuvable. (0x3) diff --git a/lab3/src/lab3.js b/lab3/src/lab3.js index 29766829c41aef44bd4c13e1caf83af5facebc4d..b5b4295dd69b550abee218700b2c04734553035b 100644 --- a/lab3/src/lab3.js +++ b/lab3/src/lab3.js @@ -116,30 +116,44 @@ var VSHADER_SOURCE_PONCTUAL = 'uniform mat4 u_MvpMatrix;\n' + 'uniform mat4 u_ModelMatrix;\n' + - 'uniform mat4 u_NormalMatrix;\n' + + 'uniform mat4 u_NormalMatrix;\n' + - 'uniform vec3 u_LightColor;\n' + - 'uniform vec3 u_LightPosition;\n' + - 'uniform vec3 u_AmbientLight;\n' + + 'uniform vec3 u_AmbientLight;\n' + + + 'varying vec3 normal;\n' + + 'varying vec4 vertexPosition;\n' + + 'varying vec3 ambient;\n' + 'varying vec4 v_Color;\n' + + 'void main() {\n' + ' gl_Position = u_MvpMatrix * a_Position;\n' + - ' vec3 normal = normalize(vec3(u_NormalMatrix * a_Normal));\n' + - ' vec4 vertexPosition = u_ModelMatrix * a_Position;\n' + - ' vec3 lightDirection = normalize(u_LightPosition - vec3(vertexPosition));\n' + - ' float nDotL = max(dot(normal, lightDirection), 0.0);\n' + - ' vec3 diffuse = u_LightColor * a_Color.rgb * nDotL;\n' + - ' v_Color = vec4(diffuse, a_Color.a);\n' + + ' normal = normalize(vec3(u_NormalMatrix * a_Normal));\n' + + ' vertexPosition = u_ModelMatrix * a_Position;\n' + + + ' ambient = u_AmbientLight * a_Color.xyz;\n' + + + ' v_Color = a_Color;\n' + '}\n'; var FSHADER_SOURCE_PONCTUAL = - '#ifdef GL_ES\n' + 'precision mediump float;\n' + - '#endif\n' + + + 'uniform vec3 u_LightColor;\n' + + 'uniform vec3 u_LightPosition;\n' + + 'varying vec4 v_Color;\n' + + 'varying vec3 normal;\n' + + 'varying vec4 vertexPosition;\n' + + 'varying vec3 ambient;\n' + + 'void main() {\n' + - ' gl_FragColor = v_Color;\n' + + + ' vec3 lightDirection = normalize(u_LightPosition - vec3(vertexPosition));\n' + + ' float nDotL = max(dot(normal, lightDirection), 0.0);\n' + + ' vec3 diffuse = u_LightColor * v_Color.rgb * nDotL;\n' + + + ' gl_FragColor = vec4(diffuse + ambient, v_Color.a);\n' + '}\n'; function initElements(){