From fb0a659c9ca3479fd6799325498b11f074689936 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Mon, 2 Apr 2012 14:57:31 -0700 Subject: -Namespaced all RDGE javascript. -Removed the following unused files from the build script /core/script/fx/blur.js /core/script/fx/ssao.js /core/script/animation.js - Fully removed the following from the build and from source control as they are unused or no longer needed /core/script/util/dbgpanel.js /core/script/util/fpsTracker.js /core/script/util/statTracker.js /core/script/input.js /core/script/TextureManager.js /core/script/ubershader.js --- js/lib/rdge/materials/flat-material.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/lib/rdge/materials/flat-material.js') diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index be8bf2b8..bc612476 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js @@ -39,7 +39,7 @@ var FlatMaterial = function FlatMaterial() { this.init = function() { // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = flatShaderDef; this._shader.init(); @@ -47,7 +47,7 @@ var FlatMaterial = function FlatMaterial() { this._shader.colorMe.color.set( this.getColor() ); // set up the material node - this._materialNode = createMaterialNode("flatMaterial"); + this._materialNode = RDGE.createMaterialNode("flatMaterial"); this._materialNode.setShader(this._shader); }; -- cgit v1.2.3 From 8d1cc709340da845d76f84220fe92c11e6217ff3 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 09:36:14 -0700 Subject: Made use of semicolons consistent and updated new files to use the new RDGE namespace --- js/lib/rdge/materials/flat-material.js | 151 ++++++++++++++++----------------- 1 file changed, 71 insertions(+), 80 deletions(-) (limited to 'js/lib/rdge/materials/flat-material.js') diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index e1363c06..106641a9 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js @@ -14,129 +14,120 @@ var FlatMaterial = function FlatMaterial() { /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// - this._name = "FlatMaterial"; - this._shaderName = "flat"; + this._name = "FlatMaterial"; + this._shaderName = "flat"; - this._color = [1,0,0,1]; + this._color = [1, 0, 0, 1]; /////////////////////////////////////////////////////////////////////// // Property Accessors /////////////////////////////////////////////////////////////////////// - this.getColor = function() { return this._color; }; - this.getShaderName = function() { return this._shaderName; }; + this.getColor = function () { return this._color; }; + this.getShaderName = function () { return this._shaderName; }; - this.isAnimated = function() { return false; }; - this.hasVertexDeformation = function() { return true; }; - this._hasVertexDeformation = true; - this._vertexDeformationTolerance = 0.2; + this.isAnimated = function () { return false; }; + this.hasVertexDeformation = function () { return true; }; + this._hasVertexDeformation = true; + this._vertexDeformationTolerance = 0.2; //////////////////////////////////s///////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - // duplcate method requirde - this.dup = function() { return new FlatMaterial(); } ; + // duplcate method requirde + this.dup = function () { return new FlatMaterial(); }; - 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 = flatShaderDef; - this._shader.init(); + // set up the shader + this._shader = new RDGE.jshader(); + this._shader.def = flatShaderDef; + this._shader.init(); - // set the defaults - this._shader.colorMe.color.set( this.getColor() ); + // set the defaults + this._shader.colorMe.color.set(this.getColor()); - // set up the material node - this._materialNode = RDGE.createMaterialNode("flatMaterial_" + world.generateUniqueNodeID() ); - this._materialNode.setShader(this._shader); - } - else - throw new Error( "GLWorld not supplied to material initialization" ); - }; + // set up the material node + this._materialNode = RDGE.createMaterialNode("flatMaterial_" + world.generateUniqueNodeID()); + this._materialNode.setShader(this._shader); + } + else + throw new Error("GLWorld not supplied to material initialization"); + }; /////////////////////////////////////////////////////////////////////// // Material Property Accessors /////////////////////////////////////////////////////////////////////// - this._propNames = ["color"]; - this._propLabels = ["Color"]; - this._propTypes = ["color"]; - this._propValues = []; + this._propNames = ["color"]; + this._propLabels = ["Color"]; + this._propTypes = ["color"]; + this._propValues = []; - this._propValues[ this._propNames[0] ] = this._color; + this._propValues[this._propNames[0]] = this._color; - this.setProperty = function( prop, value ) { - // make sure we have legitimate input - if (this.validateProperty( prop, value )) { + this.setProperty = function (prop, value) { + // make sure we have legitimate input + if (this.validateProperty(prop, value)) { this._propValues[prop] = value; if (this._shader && this._shader.colorMe) { this._shader.colorMe[prop].set(value); } - } - }; + } + }; /////////////////////////////////////////////////////////////////////// - this.export = function() - { - // this function should be overridden by subclasses - var exportStr = "material: " + this.getShaderName() + "\n"; - exportStr += "name: " + this.getName() + "\n"; - exportStr += "color: " + String(this._propValues["color"]) + "\n"; - exportStr += "endMaterial\n"; + this.export = function () { + // this function should be overridden by subclasses + var exportStr = "material: " + this.getShaderName() + "\n"; + exportStr += "name: " + this.getName() + "\n"; + exportStr += "color: " + String(this._propValues["color"]) + "\n"; + exportStr += "endMaterial\n"; - return exportStr; - }; + return exportStr; + }; - this.import = function( importStr ) { - var pu = new MaterialParser( importStr ); - var material = pu.nextValue( "material: " ); - if (material != this.getShaderName()) throw new Error( "ill-formed material" ); - this.setName( pu.nextValue( "name: ") ); + this.import = function (importStr) { + var pu = new MaterialParser(importStr); + var material = pu.nextValue("material: "); + if (material != this.getShaderName()) throw new Error("ill-formed material"); + this.setName(pu.nextValue("name: ")); var rtnStr; - try - { - var color = eval( "[" + pu.nextValue( "color: " ) + "]" ); - this.setProperty( "color", color); + try { + var color = eval("[" + pu.nextValue("color: ") + "]"); + this.setProperty("color", color); } - catch (e) - { - throw new Error( "could not import material: " + importStr ); + catch (e) { + throw new Error("could not import material: " + importStr); } return rtnStr; }; - this.exportJSON = function() - { - var jObj = + this.exportJSON = function () { + var jObj = { - 'material' : this.getShaderName(), - 'name' : this.getName(), - 'color' : this._propValues["color"] + 'material': this.getShaderName(), + 'name': this.getName(), + 'color': this._propValues["color"] }; - return jObj; - } + return jObj; + }; - this.importJSON = function( jObj ) - { - if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); - this.setName( jObj.name ); - - var color = jObj.color; - this.setProperty( "color", color); - } + this.importJSON = function (jObj) { + if (this.getShaderName() != jObj.material) throw new Error("ill-formed material"); + this.setName(jObj.name); - this.update = function( time ) - { - }; + var color = jObj.color; + this.setProperty("color", color); + }; + this.update = function (time) { + }; }; /////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 18609d375e7aab9cb48c9b3f5b291f85cbd28683 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 13:39:32 -0700 Subject: removed old unused import and export functions. --- js/lib/rdge/materials/flat-material.js | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'js/lib/rdge/materials/flat-material.js') diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index 106641a9..9442ae5b 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js @@ -79,34 +79,6 @@ var FlatMaterial = function FlatMaterial() { }; /////////////////////////////////////////////////////////////////////// - this.export = function () { - // this function should be overridden by subclasses - var exportStr = "material: " + this.getShaderName() + "\n"; - exportStr += "name: " + this.getName() + "\n"; - exportStr += "color: " + String(this._propValues["color"]) + "\n"; - exportStr += "endMaterial\n"; - - return exportStr; - }; - - this.import = function (importStr) { - var pu = new MaterialParser(importStr); - var material = pu.nextValue("material: "); - if (material != this.getShaderName()) throw new Error("ill-formed material"); - this.setName(pu.nextValue("name: ")); - - var rtnStr; - try { - var color = eval("[" + pu.nextValue("color: ") + "]"); - this.setProperty("color", color); - } - catch (e) { - throw new Error("could not import material: " + importStr); - } - - return rtnStr; - }; - this.exportJSON = function () { var jObj = { -- cgit v1.2.3