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/bump-metal-material.js | 6 +++--- js/lib/rdge/materials/deform-material.js | 4 ++-- js/lib/rdge/materials/flat-material.js | 4 ++-- js/lib/rdge/materials/fly-material.js | 4 ++-- js/lib/rdge/materials/julia-material.js | 6 +++--- js/lib/rdge/materials/keleidoscope-material.js | 6 +++--- js/lib/rdge/materials/linear-gradient-material.js | 4 ++-- js/lib/rdge/materials/mandel-material.js | 6 +++--- js/lib/rdge/materials/plasma-material.js | 4 ++-- js/lib/rdge/materials/pulse-material.js | 10 +++++----- js/lib/rdge/materials/radial-blur-material.js | 10 +++++----- js/lib/rdge/materials/radial-gradient-material.js | 4 ++-- js/lib/rdge/materials/relief-tunnel-material.js | 4 ++-- js/lib/rdge/materials/square-tunnel-material.js | 4 ++-- js/lib/rdge/materials/star-material.js | 4 ++-- js/lib/rdge/materials/taper-material.js | 4 ++-- js/lib/rdge/materials/tunnel-material.js | 4 ++-- js/lib/rdge/materials/twist-material.js | 6 +++--- js/lib/rdge/materials/twist-vert-material.js | 6 +++--- js/lib/rdge/materials/uber-material.js | 16 ++++++++-------- js/lib/rdge/materials/water-material.js | 4 ++-- js/lib/rdge/materials/z-invert-material.js | 6 +++--- 22 files changed, 63 insertions(+), 63 deletions(-) (limited to 'js/lib/rdge/materials') diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index 61126952..e0ca8d4a 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js @@ -110,13 +110,13 @@ var BumpMetalMaterial = function BumpMetalMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = bumpMetalMaterialDef; this._shader.init(); this._shader['default'].u_light0Diff.set( this.getLightDiff() ); // set up the material node - this._materialNode = createMaterialNode( this.getShaderName() ); + this._materialNode = RDGE.createMaterialNode(this.getShaderName()); this._materialNode.setShader(this._shader); // set some image maps @@ -131,7 +131,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() { if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var texMapName = this._propValues[this._propNames[index]]; diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js index 1e6af6ac..4c6e06b1 100644 --- a/js/lib/rdge/materials/deform-material.js +++ b/js/lib/rdge/materials/deform-material.js @@ -55,12 +55,12 @@ var DeformMaterial = function DeformMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = deformMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("deformMaterial"); + this._materialNode = RDGE.createMaterialNode("deformMaterial"); this._materialNode.setShader(this._shader); this._time = 0; 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); }; diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js index 8eadb3ab..09dae536 100644 --- a/js/lib/rdge/materials/fly-material.js +++ b/js/lib/rdge/materials/fly-material.js @@ -48,12 +48,12 @@ var FlyMaterial = function FlyMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = flyMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("flyMaterial"); + this._materialNode = RDGE.createMaterialNode("flyMaterial"); this._materialNode.setShader(this._shader); this._time = 0; diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js index 07536f33..77d9bb3a 100644 --- a/js/lib/rdge/materials/julia-material.js +++ b/js/lib/rdge/materials/julia-material.js @@ -50,12 +50,12 @@ var JuliaMaterial = function JuliaMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = JuliaMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("juliaMaterial"); + this._materialNode = RDGE.createMaterialNode("juliaMaterial"); this._materialNode.setShader(this._shader); this._time = 0; @@ -72,7 +72,7 @@ var JuliaMaterial = function JuliaMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { if (this._shader && this._shader['default']) { this._shader['default'].u_time.set( [this._time] ); diff --git a/js/lib/rdge/materials/keleidoscope-material.js b/js/lib/rdge/materials/keleidoscope-material.js index 3ef5d613..e1f4841f 100644 --- a/js/lib/rdge/materials/keleidoscope-material.js +++ b/js/lib/rdge/materials/keleidoscope-material.js @@ -55,12 +55,12 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = keleidoscopeMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("keleidoscopeMaterial"); + this._materialNode = RDGE.createMaterialNode("keleidoscopeMaterial"); this._materialNode.setShader(this._shader); this._time = 0; @@ -80,7 +80,7 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() { if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { if (this._shader && this._shader['default']) { diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js index 2c52c67d..d9307274 100755 --- a/js/lib/rdge/materials/linear-gradient-material.js +++ b/js/lib/rdge/materials/linear-gradient-material.js @@ -207,12 +207,12 @@ var LinearGradientMaterial = function LinearGradientMaterial() { this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = linearGradientMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode( this.getShaderName() ); + this._materialNode = RDGE.createMaterialNode(this.getShaderName()); this._materialNode.setShader(this._shader); // send the current values to the shader diff --git a/js/lib/rdge/materials/mandel-material.js b/js/lib/rdge/materials/mandel-material.js index 07e009a2..c4d5bf6f 100644 --- a/js/lib/rdge/materials/mandel-material.js +++ b/js/lib/rdge/materials/mandel-material.js @@ -61,12 +61,12 @@ var MandelMaterial = function MandelMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = MandelMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("mandelMaterial"); + this._materialNode = RDGE.createMaterialNode("mandelMaterial"); this._materialNode.setShader(this._shader); this._time = 0; @@ -83,7 +83,7 @@ var MandelMaterial = function MandelMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { if (this._shader && this._shader['default']) this._shader['default'].u_time.set( [this._time] ); diff --git a/js/lib/rdge/materials/plasma-material.js b/js/lib/rdge/materials/plasma-material.js index 9ecc2b48..d52f4b88 100644 --- a/js/lib/rdge/materials/plasma-material.js +++ b/js/lib/rdge/materials/plasma-material.js @@ -56,7 +56,7 @@ var PlasmaMaterial = function PlasmaMaterial() { this.init = function() { // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = plasmaShaderDef; this._shader.init(); @@ -66,7 +66,7 @@ var PlasmaMaterial = function PlasmaMaterial() { this.setProperty( "color", [this._time, 0, 0, 1] ); // set up the material node - this._materialNode = createMaterialNode("plasmaMaterial"); + this._materialNode = RDGE.createMaterialNode("plasmaMaterial"); this._materialNode.setShader(this._shader); }; diff --git a/js/lib/rdge/materials/pulse-material.js b/js/lib/rdge/materials/pulse-material.js index 63cab2f4..89cbaea4 100644 --- a/js/lib/rdge/materials/pulse-material.js +++ b/js/lib/rdge/materials/pulse-material.js @@ -96,12 +96,12 @@ var PulseMaterial = function PulseMaterial() { this._dTime = 0.01; // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = pulseMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("pulseMaterial"); + this._materialNode = RDGE.createMaterialNode("pulseMaterial"); this._materialNode.setShader(this._shader); this._time = 0; @@ -120,7 +120,7 @@ var PulseMaterial = function PulseMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var texMapName = this._propValues[this._propNames[0]]; var wrap = 'REPEAT', mips = true; @@ -151,7 +151,7 @@ var PulseMaterial = function PulseMaterial() { if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { if (this._shader && this._shader['default']) { this._shader['default'].u_time.set( [this._time] ); @@ -167,7 +167,7 @@ var PulseMaterial = function PulseMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { technique.u_resolution.set( res ); } diff --git a/js/lib/rdge/materials/radial-blur-material.js b/js/lib/rdge/materials/radial-blur-material.js index 41e68182..3adb6bb5 100644 --- a/js/lib/rdge/materials/radial-blur-material.js +++ b/js/lib/rdge/materials/radial-blur-material.js @@ -89,12 +89,12 @@ var RadialBlurMaterial = function RadialBlurMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = radialBlurMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("radialBlurMaterial"); + this._materialNode = RDGE.createMaterialNode("radialBlurMaterial"); this._materialNode.setShader(this._shader); this._time = 0; @@ -112,7 +112,7 @@ var RadialBlurMaterial = function RadialBlurMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var texMapName = this._propValues[this._propNames[0]]; var tex = renderer.getTextureByName(texMapName, 'REPEAT'); @@ -130,7 +130,7 @@ var RadialBlurMaterial = function RadialBlurMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { if (this._shader && this._shader['default']) { this._shader['default'].u_time.set( [this._time] ); @@ -150,7 +150,7 @@ var RadialBlurMaterial = function RadialBlurMaterial() { if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { technique.u_resolution.set( res ); } diff --git a/js/lib/rdge/materials/radial-gradient-material.js b/js/lib/rdge/materials/radial-gradient-material.js index 13be50f5..faac7f1b 100755 --- a/js/lib/rdge/materials/radial-gradient-material.js +++ b/js/lib/rdge/materials/radial-gradient-material.js @@ -195,12 +195,12 @@ var RadialGradientMaterial = function RadialGradientMaterial() { this.init = function() { // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = radialGradientMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("radialGradientMaterial"); + this._materialNode = RDGE.createMaterialNode("radialGradientMaterial"); this._materialNode.setShader(this._shader); // set the shader values in the shader diff --git a/js/lib/rdge/materials/relief-tunnel-material.js b/js/lib/rdge/materials/relief-tunnel-material.js index 20290895..7bf780fe 100644 --- a/js/lib/rdge/materials/relief-tunnel-material.js +++ b/js/lib/rdge/materials/relief-tunnel-material.js @@ -49,12 +49,12 @@ var ReliefTunnelMaterial = function ReliefTunnelMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = reliefTunnelMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("reliefTunnelMaterial"); + this._materialNode = RDGE.createMaterialNode("reliefTunnelMaterial"); this._materialNode.setShader(this._shader); this._time = 0; diff --git a/js/lib/rdge/materials/square-tunnel-material.js b/js/lib/rdge/materials/square-tunnel-material.js index b5cbff30..23b0db03 100644 --- a/js/lib/rdge/materials/square-tunnel-material.js +++ b/js/lib/rdge/materials/square-tunnel-material.js @@ -50,12 +50,12 @@ var SquareTunnelMaterial = function SquareTunnelMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = squareTunnelMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("squareTunnelMaterial"); + this._materialNode = RDGE.createMaterialNode("squareTunnelMaterial"); this._materialNode.setShader(this._shader); this._time = 0; diff --git a/js/lib/rdge/materials/star-material.js b/js/lib/rdge/materials/star-material.js index 9c0f3172..cec93301 100644 --- a/js/lib/rdge/materials/star-material.js +++ b/js/lib/rdge/materials/star-material.js @@ -50,12 +50,12 @@ var StarMaterial = function StarMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = starMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("starMaterial"); + this._materialNode = RDGE.createMaterialNode("starMaterial"); this._materialNode.setShader(this._shader); this._time = 0; diff --git a/js/lib/rdge/materials/taper-material.js b/js/lib/rdge/materials/taper-material.js index eeb08aec..7feea79a 100644 --- a/js/lib/rdge/materials/taper-material.js +++ b/js/lib/rdge/materials/taper-material.js @@ -45,7 +45,7 @@ function TaperMaterial() this.init = function() { // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = taperShaderDef; this._shader.init(); @@ -53,7 +53,7 @@ function TaperMaterial() this._shader.colorMe.color.set( this.getColor() ); // set up the material node - this._materialNode = createMaterialNode("taperMaterial"); + this._materialNode = RDGE.createMaterialNode("taperMaterial"); this._materialNode.setShader(this._shader); // initialize the taper properties diff --git a/js/lib/rdge/materials/tunnel-material.js b/js/lib/rdge/materials/tunnel-material.js index fe787d16..53a2d4f2 100644 --- a/js/lib/rdge/materials/tunnel-material.js +++ b/js/lib/rdge/materials/tunnel-material.js @@ -51,12 +51,12 @@ var TunnelMaterial = function TunnelMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = tunnelMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("tunnelMaterial"); + this._materialNode = RDGE.createMaterialNode("tunnelMaterial"); this._materialNode.setShader(this._shader); this._time = 0; diff --git a/js/lib/rdge/materials/twist-material.js b/js/lib/rdge/materials/twist-material.js index eb562e99..8648d60b 100644 --- a/js/lib/rdge/materials/twist-material.js +++ b/js/lib/rdge/materials/twist-material.js @@ -51,12 +51,12 @@ var TwistMaterial = function TwistMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = twistMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("twistMaterial"); + this._materialNode = RDGE.createMaterialNode("twistMaterial"); this._materialNode.setShader(this._shader); this._time = 0; @@ -75,7 +75,7 @@ var TwistMaterial = function TwistMaterial() { if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { if (this._shader && this._shader['default']) this._shader['default'].u_time.set( [this._time] ); diff --git a/js/lib/rdge/materials/twist-vert-material.js b/js/lib/rdge/materials/twist-vert-material.js index c2573071..1f7b06b1 100644 --- a/js/lib/rdge/materials/twist-vert-material.js +++ b/js/lib/rdge/materials/twist-vert-material.js @@ -49,7 +49,7 @@ function TwistVertMaterial() this.init = function() { // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = twistVertShaderDef; this._shader.init(); @@ -57,7 +57,7 @@ function TwistVertMaterial() this._shader.twistMe.color.set( this.getColor() ); // set up the material node - this._materialNode = createMaterialNode("twistVertMaterial"); + this._materialNode = RDGE.createMaterialNode("twistVertMaterial"); this._materialNode.setShader(this._shader); // initialize the twist vert properties @@ -189,7 +189,7 @@ function TwistVertMaterial() if (material) { var technique = material.shaderProgram['default']; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var texMapName = this._propValues[this._propNames[5]]; diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js index 6bc35d51..e2f86511 100755 --- a/js/lib/rdge/materials/uber-material.js +++ b/js/lib/rdge/materials/uber-material.js @@ -237,7 +237,7 @@ var UberMaterial = function UberMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram.defaultTechnique; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var tex = renderer.getTextureByName(value, caps.environmentMap.wrap); this.registerTexture( tex ); @@ -265,7 +265,7 @@ var UberMaterial = function UberMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram.defaultTechnique; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var tex = renderer.getTextureByName(value, caps.diffuseMap.wrap); this.registerTexture( tex ); @@ -293,7 +293,7 @@ var UberMaterial = function UberMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram.defaultTechnique; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var tex = renderer.getTextureByName(value, caps.specularMap.wrap); this.registerTexture( tex ); @@ -321,7 +321,7 @@ var UberMaterial = function UberMaterial() { var material = this._materialNode; if (material) { var technique = material.shaderProgram.defaultTechnique; - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if (renderer && technique) { var tex = renderer.getTextureByName(value, caps.normalMap.wrap); this.registerTexture( tex ); @@ -363,7 +363,7 @@ var UberMaterial = function UberMaterial() { this._shader = this.buildUberShader( this._ubershaderCaps ); // set up the material node - this._materialNode = createMaterialNode("uberMaterial"); + this._materialNode = RDGE.createMaterialNode("uberMaterial"); this._materialNode.setShader(this._shader); }; @@ -450,7 +450,7 @@ var UberMaterial = function UberMaterial() { var fshader = preproc + uberFShader; // build output jshader - var uberJShader = new jshader(); + var uberJShader = new RDGE.jshader(); uberJShader.def = { 'shaders': { 'defaultVShader': vshader, @@ -517,9 +517,9 @@ var UberMaterial = function UberMaterial() { } } } - technique.u_uvMatrix.set(caps.uvTransform || mat4.identity()); + technique.u_uvMatrix.set(caps.uvTransform || RDGE.mat4.identity()); - var renderer = g_Engine.getContext().renderer; + var renderer = RDGE.globals.engine.getContext().renderer; if(this._useDiffuseMap) { var tex = renderer.getTextureByName(caps.diffuseMap.texture, caps.diffuseMap.wrap, caps.diffuseMap.mips); this.registerTexture( tex ); diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 92b96b18..0c7badf5 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -52,12 +52,12 @@ var WaterMaterial = function WaterMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = waterMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("waterMaterial"); + this._materialNode = RDGE.createMaterialNode("waterMaterial"); this._materialNode.setShader(this._shader); this._time = 0; diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js index 051b724f..fff01a15 100644 --- a/js/lib/rdge/materials/z-invert-material.js +++ b/js/lib/rdge/materials/z-invert-material.js @@ -29,7 +29,7 @@ var ZInvertMaterial = function ZInvertMaterial() { /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - // duplcate method requirde + // duplicate method required this.dup = function( world ) { // allocate a new uber material var newMat = new ZInvertMaterial(); @@ -50,12 +50,12 @@ var ZInvertMaterial = function ZInvertMaterial() { if (world) this.setWorld( world ); // set up the shader - this._shader = new jshader(); + this._shader = new RDGE.jshader(); this._shader.def = zInvertMaterialDef; this._shader.init(); // set up the material node - this._materialNode = createMaterialNode("zInvertMaterial"); + this._materialNode = RDGE.createMaterialNode("zInvertMaterial"); this._materialNode.setShader(this._shader); this._time = 0; -- 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/cloud-material.js | 390 +++-- js/lib/rdge/materials/deform-material.js | 88 +- js/lib/rdge/materials/flat-material.js | 151 +- js/lib/rdge/materials/fly-material.js | 5 +- js/lib/rdge/materials/julia-material.js | 2 +- js/lib/rdge/materials/keleidoscope-material.js | 2 +- js/lib/rdge/materials/linear-gradient-material.js | 489 +++--- js/lib/rdge/materials/mandel-material.js | 2 +- js/lib/rdge/materials/material-parser.js | 81 +- js/lib/rdge/materials/pulse-material.js | 10 +- js/lib/rdge/materials/radial-blur-material.js | 446 +++--- js/lib/rdge/materials/radial-gradient-material.js | 495 +++--- js/lib/rdge/materials/relief-tunnel-material.js | 132 +- js/lib/rdge/materials/square-tunnel-material.js | 133 +- js/lib/rdge/materials/star-material.js | 133 +- js/lib/rdge/materials/taper-material.js | 439 +++--- js/lib/rdge/materials/tunnel-material.js | 79 +- js/lib/rdge/materials/twist-material.js | 161 +- js/lib/rdge/materials/twist-vert-material.js | 486 +++--- js/lib/rdge/materials/uber-material.js | 1721 ++++++++++----------- js/lib/rdge/materials/water-material.js | 275 ++-- js/lib/rdge/materials/z-invert-material.js | 132 +- 22 files changed, 2857 insertions(+), 2995 deletions(-) (limited to 'js/lib/rdge/materials') diff --git a/js/lib/rdge/materials/cloud-material.js b/js/lib/rdge/materials/cloud-material.js index 85088f91..092553ce 100644 --- a/js/lib/rdge/materials/cloud-material.js +++ b/js/lib/rdge/materials/cloud-material.js @@ -1,8 +1,8 @@ /* - This file contains proprietary software owned by Motorola Mobility, Inc.
- No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
- (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. + */ var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser; var Material = require("js/lib/rdge/materials/material").Material; @@ -14,275 +14,263 @@ var CloudMaterial = function CloudMaterial() { /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// - this._name = "CloudMaterial"; - this._shaderName = "cloud"; + this._name = "CloudMaterial"; + this._shaderName = "cloud"; - this._texMap = 'assets/images/cloud2.jpg'; - this._diffuseColor = [0.5, 0.5, 0.5, 0.5]; + this._texMap = 'assets/images/cloud2.jpg'; + this._diffuseColor = [0.5, 0.5, 0.5, 0.5]; - this._time = 0.0; - this._dTime = 0.01; + this._time = 0.0; + this._dTime = 0.01; /////////////////////////////////////////////////////////////////////// // Property Accessors /////////////////////////////////////////////////////////////////////// - this.getName = function() { return this._name; }; - this.getShaderName = function() { return this._shaderName; }; + this.getName = function () { return this._name; }; + this.getShaderName = function () { return this._shaderName; }; - this.getTextureMap = function() { return this._propValues[this._propNames[0]] ? this._propValues[this._propNames[0]].slice() : null }; - this.setTextureMap = function(m) { this._propValues[this._propNames[0]] = m ? m.slice(0) : null; this.updateTexture(); }; + this.getTextureMap = function () { return this._propValues[this._propNames[0]] ? this._propValues[this._propNames[0]].slice() : null }; + this.setTextureMap = function (m) { this._propValues[this._propNames[0]] = m ? m.slice(0) : null; this.updateTexture(); }; - this.setDiffuseColor = function(c) { this._propValues[this._propNames[1]] = c.slice(0); this.updateColor(); }; - this.getDiffuseColor = function() { return this._propValues[this._propNames[1]] ? this._propValues[this._propNames[1]].slice() : null; }; + this.setDiffuseColor = function (c) { this._propValues[this._propNames[1]] = c.slice(0); this.updateColor(); }; + this.getDiffuseColor = function () { return this._propValues[this._propNames[1]] ? this._propValues[this._propNames[1]].slice() : null; }; - this.isAnimated = function() { return true; }; + this.isAnimated = function () { return true; }; /////////////////////////////////////////////////////////////////////// // Material Property Accessors /////////////////////////////////////////////////////////////////////// - this._propNames = ["texmap", "diffusecolor"]; - this._propLabels = ["Texture map", "Diffuse Color"]; - this._propTypes = ["file", "color"]; - this._propValues = []; + this._propNames = ["texmap", "diffusecolor"]; + this._propLabels = ["Texture map", "Diffuse Color"]; + this._propTypes = ["file", "color"]; + this._propValues = []; - this._propValues[ this._propNames[0] ] = this._texMap.slice(0); - this._propValues[ this._propNames[1] ] = this._diffuseColor.slice(); + this._propValues[this._propNames[0]] = this._texMap.slice(0); + this._propValues[this._propNames[1]] = this._diffuseColor.slice(); - this.setProperty = function( prop, value ) - { - if (prop === 'color') prop = 'diffusecolor'; + this.setProperty = function (prop, value) { + if (prop === 'color') prop = 'diffusecolor'; - // make sure we have legitimate imput - var ok = this.validateProperty( prop, value ); - if (!ok) { - console.log( "invalid property in Radial Gradient Material:" + prop + " : " + value ); + // make sure we have legitimate imput + var ok = this.validateProperty(prop, value); + if (!ok) { + console.log("invalid property in Radial Gradient Material:" + prop + " : " + value); } - switch (prop) - { - case "texmap": - this.setTextureMap(value); - break; - - case "diffusecolor": - this.setDiffuseColor( value ); - break; - - case "color": - break; - } - }; + switch (prop) { + case "texmap": + this.setTextureMap(value); + break; + + case "diffusecolor": + this.setDiffuseColor(value); + break; + + case "color": + break; + } + }; /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - // duplcate method requirde - this.dup = function( world ) - { - // save the world - if (world) this.setWorld( world ); - - // allocate a new uber material - var newMat = new CloudMaterial(); - - // copy over the current values; - var propNames = [], propValues = [], propTypes = [], propLabels = []; - this.getAllProperties( propNames, propValues, propTypes, propLabels); - var n = propNames.length; - for (var i=0; i 200.0) this._time = 0.0; - } - } - }; + if (this._time > 200.0) this._time = 0.0; + } + } + }; - // JSON export - this.exportJSON = function() - { - var jObj = + // JSON export + this.exportJSON = function () { + var jObj = { - 'material' : this.getShaderName(), - 'name' : this.getName(), - 'texture' : this._propValues[this._propNames[0]] + 'material': this.getShaderName(), + 'name': this.getName(), + 'texture': this._propValues[this._propNames[0]] }; - return jObj; - }; + return jObj; + }; - this.importJSON = function( jObj ) - { - if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); - this.setName( jObj.name ); + this.importJSON = function (jObj) { + if (this.getShaderName() != jObj.material) throw new Error("ill-formed material"); + this.setName(jObj.name); try { - this._propValues[this._propNames[0]] = jObj.texture; + this._propValues[this._propNames[0]] = jObj.texture; } - catch (e) - { - throw new Error( "could not import material: " + jObj ); + catch (e) { + throw new Error("could not import material: " + jObj); } - } + }; + + this.export = function () { + // every material needs the base type and instance name + var exportStr = "material: " + this.getShaderName() + "\n"; + exportStr += "name: " + this.getName() + "\n"; - this.export = function() { - // every material needs the base type and instance name - var exportStr = "material: " + this.getShaderName() + "\n"; - exportStr += "name: " + this.getName() + "\n"; + var world = this.getWorld(); + if (!world) + throw new Error("no world in material.export, " + this.getName()); - var world = this.getWorld(); - if (!world) - throw new Error( "no world in material.export, " + this.getName() ); + var texMapName = this._propValues[this._propNames[0]]; + exportStr += "texture: " + texMapName + "\n"; - var texMapName = this._propValues[this._propNames[0]]; - exportStr += "texture: " +texMapName + "\n"; - - // every material needs to terminate like this - exportStr += "endMaterial\n"; + // every material needs to terminate like this + 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; + var rtnStr; try { - this._propValues[this._propNames[0]] = pu.nextValue( "texture: " ); + this._propValues[this._propNames[0]] = pu.nextValue("texture: "); var endKey = "endMaterial\n"; - var index = importStr.indexOf( endKey ); + var index = importStr.indexOf(endKey); index += endKey.length; - rtnStr = importStr.substr( index ); + rtnStr = importStr.substr(index); } - catch (e) - { - throw new Error( "could not import material: " + importStr ); + catch (e) { + throw new Error("could not import material: " + importStr); } - return rtnStr; - } + return rtnStr; + }; }; /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var cloudMaterialDef = -{'shaders': +{ 'shaders': { - 'defaultVShader':"assets/shaders/Cloud.vert.glsl", - 'defaultFShader':"assets/shaders/Cloud.frag.glsl" + 'defaultVShader': "assets/shaders/Cloud.vert.glsl", + 'defaultFShader': "assets/shaders/Cloud.frag.glsl" }, - 'techniques': - { - 'default': + 'techniques': + { + 'default': [ { - 'vshader' : 'defaultVShader', - 'fshader' : 'defaultFShader', - // attributes - 'attributes' : + 'vshader': 'defaultVShader', + 'fshader': 'defaultFShader', + // attributes + 'attributes': { - 'vert' : { 'type' : 'vec3' }, - 'normal' : { 'type' : 'vec3' }, - 'texcoord' : { 'type' : 'vec2' } + 'vert': { 'type': 'vec3' }, + 'normal': { 'type': 'vec3' }, + 'texcoord': { 'type': 'vec2' } }, - // parameters - 'params' : + // parameters + 'params': { - 'u_tex0': { 'type' : 'tex2d' }, - 'u_time' : { 'type' : 'float' }, - 'u_DiffuseColor' : { 'type' : 'vec4' } + 'u_tex0': { 'type': 'tex2d' }, + 'u_time': { 'type': 'float' }, + 'u_DiffuseColor': { 'type': 'vec4' } }, - // render states - 'states' : + // render states + 'states': { - 'depthEnable' : true, - 'offset':[1.0, 0.1] + 'depthEnable': true, + 'offset': [1.0, 0.1] } } ] diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js index 8746bb47..328330bf 100644 --- a/js/lib/rdge/materials/deform-material.js +++ b/js/lib/rdge/materials/deform-material.js @@ -10,20 +10,20 @@ var DeformMaterial = function DeformMaterial() { /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// - this._name = "DeformMaterial"; - this._shaderName = "deform"; + this._name = "DeformMaterial"; + this._shaderName = "deform"; - this._texMap = 'assets/images/rocky-normal.jpg'; + this._texMap = 'assets/images/rocky-normal.jpg'; - this._time = 0.0; - this._dTime = 0.01; + this._time = 0.0; + this._dTime = 0.01; /////////////////////////////////////////////////////////////////////// // Properties /////////////////////////////////////////////////////////////////////// - // all defined in parent PulseMaterial.js - // load the local default value - this._propValues[ this._propNames[0] ] = this._texMap.slice(0); + // all defined in parent PulseMaterial.js + // load the local default value + this._propValues[this._propNames[0]] = this._texMap.slice(0); /////////////////////////////////////////////////////////////////////// // Material Property Accessors @@ -35,44 +35,44 @@ var DeformMaterial = function DeformMaterial() { /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - // duplcate method requirde - this.dup = function( world ) { - // allocate a new uber material - var newMat = new DeformMaterial(); - - // copy over the current values; - var propNames = [], propValues = [], propTypes = [], propLabels = []; - this.getAllProperties( propNames, propValues, propTypes, propLabels); - var n = propNames.length; - for (var i=0; i