scripts/renderer.js
changeset 33 2af408534f28
parent 31 744b427d1379
child 34 f471c01dca99
     1.1 --- a/scripts/renderer.js	Wed Apr 27 14:45:41 2011 +0200
     1.2 +++ b/scripts/renderer.js	Wed Apr 27 15:10:42 2011 +0200
     1.3 @@ -68,13 +68,14 @@
     1.4      this.pMatrixUniform = gl.getUniformLocation(this.program, "uPMatrix");
     1.5      this.mvMatrixUniform = gl.getUniformLocation(this.program, "uMVMatrix");    
     1.6      this.nMatrixUniform = gl.getUniformLocation(this.program, "uNMatrix");
     1.7 -    //this.samplerUniform = gl.getUniformLocation(this.program, "uSampler");
     1.8 +    this.materialShininessUniform = gl.getUniformLocation(this.program, "uMaterialShininess");
     1.9      this.useLightingUniform = gl.getUniformLocation(this.program, "uUseLighting");
    1.10      this.ambientColourUniform = gl.getUniformLocation(this.program, "uAmbientColour");
    1.11      this.lightingDirectionUniform = gl.getUniformLocation(this.program, "uLightingDirection");
    1.12      this.directionalColourUniform = gl.getUniformLocation(this.program, "uDirectionalColour");
    1.13      this.pointLightingLocationUniform = gl.getUniformLocation(this.program, "uPointLightingLocation");
    1.14 -    this.pointLightingColourUniform = gl.getUniformLocation(this.program, "uPointLightingColour");
    1.15 +    this.pointLightingSpecularColourUniform = gl.getUniformLocation(this.program, "uPointLightingSpecularColour");
    1.16 +    this.pointLightingDiffuseColourUniform = gl.getUniformLocation(this.program, "uPointLightingDiffuseColour");
    1.17      
    1.18      function loadShader(gl, id)
    1.19      {
    1.20 @@ -130,6 +131,7 @@
    1.21  
    1.22      var lighting = true;
    1.23      gl.uniform1i(shader.useLightingUniform, lighting);
    1.24 +    gl.uniform1f(shader.materialShininessUniform, 25.0);
    1.25     
    1.26      if (lighting)
    1.27      {   
    1.28 @@ -138,8 +140,10 @@
    1.29  
    1.30  	var pos = [0, 0, 0];
    1.31  	gl.uniform3f(shader.pointLightingLocationUniform, pos[0], pos[1], pos[2]);
    1.32 -	uni = .3;
    1.33 -	gl.uniform3f(shader.pointLightingColourUniform, uni, uni, uni);
    1.34 +	uni = .5;
    1.35 +	gl.uniform3f(shader.pointLightingSpecularColourUniform, uni, uni, uni);
    1.36 +	uni = .1;
    1.37 +	gl.uniform3f(shader.pointLightingDiffuseColourUniform, uni, uni, uni);
    1.38  
    1.39  	// var lightingDir = vec3.create();
    1.40  	// vec3.add(lightingDir, [0.5, -0.5, 0.0]);