From 648ee61ae84216d0236e0dbc211addc13b2cfa3a Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:52:06 -0700 Subject: Expand tabs --- js/lib/rdge/materials/bump-metal-material.js | 154 +++++++++++++-------------- 1 file changed, 77 insertions(+), 77 deletions(-) (limited to 'js/lib/rdge/materials/bump-metal-material.js') diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index 3db3df1d..bcc092f9 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js @@ -40,62 +40,62 @@ var BumpMetalMaterial = function BumpMetalMaterial() { /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// - this._name = "Bump Metal"; - this._shaderName = "bumpMetal"; + this._name = "Bump Metal"; + this._shaderName = "bumpMetal"; this._defaultDiffuseTexture = "assets/images/metal.png"; this._defaultSpecularTexture = "assets/images/silver.png"; - this._defaultNormalTexture = "assets/images/normalMap.png"; + this._defaultNormalTexture = "assets/images/normalMap.png"; // array textures indexed by shader uniform name this._glTextures = []; - this._speed = 1.0; + this._speed = 1.0; /////////////////////////////////////////////////////////////////////// // Property Accessors /////////////////////////////////////////////////////////////////////// - this.isAnimated = function() { return true; }; - this.getShaderDef = function() { return bumpMetalMaterialDef; }; + this.isAnimated = function() { return true; }; + this.getShaderDef = function() { return bumpMetalMaterialDef; }; /////////////////////////////////////////////////////////////////////// // Material Property Accessors /////////////////////////////////////////////////////////////////////// - this._propNames = ["u_light0Diff", "u_colMap", "u_normalMap", "u_glowMap" ]; - this._propLabels = ["Diffuse Color", "Diffuse Map", "Bump Map", "Specular Map" ]; - this._propTypes = ["color", "file", "file", "file" ]; - this._propValues = []; + this._propNames = ["u_light0Diff", "u_colMap", "u_normalMap", "u_glowMap" ]; + this._propLabels = ["Diffuse Color", "Diffuse Map", "Bump Map", "Specular Map" ]; + this._propTypes = ["color", "file", "file", "file" ]; + this._propValues = []; - this._propValues[ this._propNames[0] ] = [0.3, 0.3, 0.3, 1.0]; - this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0); - this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0); - this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0); + this._propValues[ this._propNames[0] ] = [0.3, 0.3, 0.3, 1.0]; + this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0); + this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0); + this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0); /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - this.init = function( world ) - { - // save the world - if (world) { - this.setWorld( world ); + this.init = function( world ) + { + // save the world + if (world) { + this.setWorld( world ); } - // set up the shader - this._shader = new RDGE.jshader(); - this._shader.def = bumpMetalMaterialDef; - this._shader.init(); + // set up the shader + this._shader = new RDGE.jshader(); + this._shader.def = bumpMetalMaterialDef; + this._shader.init(); - // set up the material node - this._materialNode = RDGE.createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); - this._materialNode.setShader(this._shader); + // set up the material node + this._materialNode = RDGE.createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); + this._materialNode.setShader(this._shader); - this.setShaderValues(); - this.update(0); - }; + this.setShaderValues(); + this.update(0); + }; }; /////////////////////////////////////////////////////////////////////////////////////// @@ -104,28 +104,28 @@ var BumpMetalMaterial = function BumpMetalMaterial() { // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var bumpMetalMaterialDef = bumpMetalShaderDef = { - 'shaders': - { - // this shader is being referenced by file - 'defaultVShader':"assets/shaders/test_vshader.glsl", - 'defaultFShader':"assets/shaders/test_fshader.glsl", + 'shaders': + { + // this shader is being referenced by file + 'defaultVShader':"assets/shaders/test_vshader.glsl", + 'defaultFShader':"assets/shaders/test_fshader.glsl", - // this shader is inline - 'dirLightVShader': "\ - uniform mat4 u_mvMatrix;\ - uniform mat4 u_normalMatrix;\ - uniform mat4 u_projMatrix;\ - uniform mat4 u_worldMatrix;\ - attribute vec3 a_pos;\ - attribute vec3 a_nrm;\ - varying vec3 vNormal;\ - varying vec3 vPos;\ - void main() {\ - vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\ - gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ - vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\ - }", - 'dirLightFShader': "\ + // this shader is inline + 'dirLightVShader': "\ + uniform mat4 u_mvMatrix;\ + uniform mat4 u_normalMatrix;\ + uniform mat4 u_projMatrix;\ + uniform mat4 u_worldMatrix;\ + attribute vec3 a_pos;\ + attribute vec3 a_nrm;\ + varying vec3 vNormal;\ + varying vec3 vPos;\ + void main() {\ + vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\ + gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ + vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\ + }", + 'dirLightFShader': "\ precision highp float;\ uniform vec4 u_light1Diff;\ uniform vec3 u_light1Pos;\ @@ -142,29 +142,29 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = float alpha2 = max(0.0, 1.0 - ( (light2.x*light2.x)/range + (light2.y*light2.y)/range + (light2.z*light2.z)/range));\ gl_FragColor = vec4((u_light2Diff*alpha2 + u_light1Diff*alpha1).rgb, 1.0);\ }" - }, - 'techniques': - { - 'default': - [ - { - 'vshader' : 'defaultVShader', - 'fshader' : 'defaultFShader', - // attributes - 'attributes' : - { - 'vert' : { 'type' : 'vec3' }, - 'normal' : { 'type' : 'vec3' }, - 'texcoord' : { 'type' : 'vec2' } - }, - // parameters - 'params' : - { - 'u_light0Diff' : { 'type' : 'vec4' }, - 'u_colMap': { 'type' : 'tex2d' }, - 'u_normalMap': { 'type' : 'tex2d' }, - 'u_glowMap': { 'type' : 'tex2d' } - }, + }, + 'techniques': + { + 'default': + [ + { + 'vshader' : 'defaultVShader', + 'fshader' : 'defaultFShader', + // attributes + 'attributes' : + { + 'vert' : { 'type' : 'vec3' }, + 'normal' : { 'type' : 'vec3' }, + 'texcoord' : { 'type' : 'vec2' } + }, + // parameters + 'params' : + { + 'u_light0Diff' : { 'type' : 'vec4' }, + 'u_colMap': { 'type' : 'tex2d' }, + 'u_normalMap': { 'type' : 'tex2d' }, + 'u_glowMap': { 'type' : 'tex2d' } + }, // render states 'states' : @@ -172,7 +172,7 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = 'depthEnable' : true, 'offset':[1.0, 0.1] } - }, + }, { // light pass 'vshader' : 'dirLightVShader', 'fshader' : 'dirLightFShader', @@ -195,9 +195,9 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = "srcBlend" : "SRC_ALPHA", "dstBlend" : "DST_ALPHA" } - } // light pass - ] - } // techniques + } // light pass + ] + } // techniques }; BumpMetalMaterial.prototype = new Material(); -- cgit v1.2.3 From 04343eda8c2f870b0da55cfdc8003c99fe1cc4de Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:53:10 -0700 Subject: Remove trailing spaces --- js/lib/rdge/materials/bump-metal-material.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'js/lib/rdge/materials/bump-metal-material.js') diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index bcc092f9..fa830d3d 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js @@ -100,7 +100,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var bumpMetalMaterialDef = bumpMetalShaderDef = { @@ -109,7 +109,7 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = // this shader is being referenced by file 'defaultVShader':"assets/shaders/test_vshader.glsl", 'defaultFShader':"assets/shaders/test_fshader.glsl", - + // this shader is inline 'dirLightVShader': "\ uniform mat4 u_mvMatrix;\ @@ -124,7 +124,7 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\ gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\ - }", + }", 'dirLightFShader': "\ precision highp float;\ uniform vec4 u_light1Diff;\ @@ -144,7 +144,7 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = }" }, 'techniques': - { + { 'default': [ { @@ -158,7 +158,7 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_light0Diff' : { 'type' : 'vec4' }, 'u_colMap': { 'type' : 'tex2d' }, @@ -167,7 +167,7 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] @@ -183,12 +183,12 @@ var bumpMetalMaterialDef = bumpMetalShaderDef = 'a_nrm' : { 'type' : 'vec3' } }, // parameters - 'params' : + 'params' : { }, // render states - 'states' : + 'states' : { 'depthEnable' : true, "blendEnable" : true, -- cgit v1.2.3