Skip to content
Snippets Groups Projects
Commit e60b9239 authored by geoffrey.menetrey's avatar geoffrey.menetrey
Browse files

lumière spéculaire calculé dans le fragment shader

parent f1106374
Branches
No related tags found
No related merge requests found
[1120/133929.315:ERROR:directory_reader_win.cc(43)] FindFirstFile: Le chemin daccs spcifi est introuvable. (0x3)
[1126/175840.510:ERROR:directory_reader_win.cc(43)] FindFirstFile: Le chemin daccs spcifi est introuvable. (0x3)
[1127/141033.333:ERROR:directory_reader_win.cc(43)] FindFirstFile: Le chemin daccs spcifi est introuvable. (0x3)
......@@ -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(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment