diff --git a/App/objViewer.html b/App/objViewer.html index 7099559..de546f6 100644 --- a/App/objViewer.html +++ b/App/objViewer.html @@ -3,7 +3,7 @@ Simple OBJ Viewer - + @@ -11,18 +11,18 @@ attribute vec4 vPosition; attribute vec4 vNormal; varying vec4 fColor; - - uniform vec4 ambientProduct; + + uniform vec4 ambientProduct; uniform vec4 diffuseProduct; uniform vec4 specularProduct; uniform float shininess; - + uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; // normal matrix uniform mat4 normalMatrix; - + uniform vec4 lightPosition; // matriz de translacao @@ -37,44 +37,44 @@ void main() { vec3 pos = -(modelViewMatrix * vPosition).xyz; - + // fixed light postion vec3 light = lightPosition.xyz; vec3 L = normalize( light - pos ); - + vec3 E = normalize( -pos ); vec3 H = normalize( L + E ); - + // transform vertex normal into eye coordinates vec3 N = normalize( (normalMatrix * vNormal).xyz ); - + // compute terms in the illumination equation vec4 ambient = ambientProduct; - + float Kd = max( dot(L, N), 0.0 ); vec4 diffuse = Kd * diffuseProduct; - + float Ks = pow( max(dot(N, H), 0.0), shininess ); vec4 specular = Ks * specularProduct; - + if ( dot(L, N) < 0.0 ) { specular = vec4(0.0, 0.0, 0.0, 1.0); - } - - gl_Position = projectionMatrix * modelViewMatrix + } + + gl_Position = projectionMatrix * modelViewMatrix * scaleMatrix * transMatrix * vPosition; - + fColor = ambient + diffuse +specular; - + fColor.a = 1.0; } - + - - - + + + + +
- + Oops ... your browser doesn't support the HTML5 canvas element @@ -101,7 +103,7 @@ - +