Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
labs_ihm_2020
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geoffrey.menetrey
labs_ihm_2020
Commits
e60b9239
Commit
e60b9239
authored
4 years ago
by
geoffrey.menetrey
Browse files
Options
Downloads
Patches
Plain Diff
lumière spéculaire calculé dans le fragment shader
parent
f1106374
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lab3/src/debug.log
+1
-0
1 addition, 0 deletions
lab3/src/debug.log
lab3/src/lab3.js
+27
-13
27 additions, 13 deletions
lab3/src/lab3.js
with
28 additions
and
13 deletions
lab3/src/debug.log
+
1
−
0
View file @
e60b9239
[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)
This diff is collapsed.
Click to expand it.
lab3/src/lab3.js
+
27
−
13
View file @
e60b9239
...
...
@@ -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
(){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment