diff options
Diffstat (limited to 'js/lib/rdge')
22 files changed, 118 insertions, 102 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index 2ef83227..d764de66 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js | |||
@@ -107,16 +107,18 @@ var BumpMetalMaterial = function BumpMetalMaterial() { | |||
107 | this.init = function( world ) | 107 | this.init = function( world ) |
108 | { | 108 | { |
109 | // save the world | 109 | // save the world |
110 | if (world) this.setWorld( world ); | 110 | if (world) { |
111 | this.setWorld( world ); | ||
112 | } | ||
111 | 113 | ||
112 | // set up the shader | 114 | // set up the shader |
113 | this._shader = new jshader(); | 115 | this._shader = new RDGE.jshader(); |
114 | this._shader.def = bumpMetalMaterialDef; | 116 | this._shader.def = bumpMetalMaterialDef; |
115 | this._shader.init(); | 117 | this._shader.init(); |
116 | this._shader['default'].u_light0Diff.set( this.getLightDiff() ); | 118 | this._shader['default'].u_light0Diff.set( this.getLightDiff() ); |
117 | 119 | ||
118 | // set up the material node | 120 | // set up the material node |
119 | this._materialNode = createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); | 121 | this._materialNode = RDGE.createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); |
120 | this._materialNode.setShader(this._shader); | 122 | this._materialNode.setShader(this._shader); |
121 | 123 | ||
122 | // set some image maps | 124 | // set some image maps |
@@ -131,7 +133,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() { | |||
131 | if (material) | 133 | if (material) |
132 | { | 134 | { |
133 | var technique = material.shaderProgram['default']; | 135 | var technique = material.shaderProgram['default']; |
134 | var renderer = g_Engine.getContext().renderer; | 136 | var renderer = RDGE.globals.engine.getContext().renderer; |
135 | if (renderer && technique) | 137 | if (renderer && technique) |
136 | { | 138 | { |
137 | var texMapName = this._propValues[this._propNames[index]]; | 139 | var texMapName = this._propValues[this._propNames[index]]; |
@@ -205,7 +207,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() { | |||
205 | exportStr += "lightDiff: " + this.getLightDiff() + "\n"; | 207 | exportStr += "lightDiff: " + this.getLightDiff() + "\n"; |
206 | exportStr += "diffuseTexture: " + this.getDiffuseTexture() + "\n"; | 208 | exportStr += "diffuseTexture: " + this.getDiffuseTexture() + "\n"; |
207 | exportStr += "specularTexture: " + this.getSpecularTexture() + "\n"; | 209 | exportStr += "specularTexture: " + this.getSpecularTexture() + "\n"; |
208 | exportStr += "normalMap: " + this.getNormalTexture() + "\n"; | 210 | exportStr += "normalMap: " + this.getNormalTexture() + "\n"; |
209 | 211 | ||
210 | // every material needs to terminate like this | 212 | // every material needs to terminate like this |
211 | exportStr += "endMaterial\n"; | 213 | exportStr += "endMaterial\n"; |
diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js index dfd89d12..8746bb47 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() { | |||
55 | if (world) this.setWorld( world ); | 55 | if (world) this.setWorld( world ); |
56 | 56 | ||
57 | // set up the shader | 57 | // set up the shader |
58 | this._shader = new jshader(); | 58 | this._shader = new RDGE.jshader(); |
59 | this._shader.def = deformMaterialDef; | 59 | this._shader.def = deformMaterialDef; |
60 | this._shader.init(); | 60 | this._shader.init(); |
61 | 61 | ||
62 | // set up the material node | 62 | // set up the material node |
63 | this._materialNode = createMaterialNode("deformMaterial" + "_" + world.generateUniqueNodeID()); | 63 | this._materialNode = RDGE.createMaterialNode("deformMaterial" + "_" + world.generateUniqueNodeID()); |
64 | this._materialNode.setShader(this._shader); | 64 | this._materialNode.setShader(this._shader); |
65 | 65 | ||
66 | this._time = 0; | 66 | this._time = 0; |
diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index 5030cc88..e1363c06 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js | |||
@@ -43,17 +43,17 @@ var FlatMaterial = function FlatMaterial() { | |||
43 | { | 43 | { |
44 | this.setWorld( world ); | 44 | this.setWorld( world ); |
45 | 45 | ||
46 | // set up the shader | 46 | // set up the shader |
47 | this._shader = new jshader(); | 47 | this._shader = new RDGE.jshader(); |
48 | this._shader.def = flatShaderDef; | 48 | this._shader.def = flatShaderDef; |
49 | this._shader.init(); | 49 | this._shader.init(); |
50 | 50 | ||
51 | // set the defaults | 51 | // set the defaults |
52 | this._shader.colorMe.color.set( this.getColor() ); | 52 | this._shader.colorMe.color.set( this.getColor() ); |
53 | 53 | ||
54 | // set up the material node | 54 | // set up the material node |
55 | this._materialNode = createMaterialNode("flatMaterial_" + world.generateUniqueNodeID() ); | 55 | this._materialNode = RDGE.createMaterialNode("flatMaterial_" + world.generateUniqueNodeID() ); |
56 | this._materialNode.setShader(this._shader); | 56 | this._materialNode.setShader(this._shader); |
57 | } | 57 | } |
58 | else | 58 | else |
59 | throw new Error( "GLWorld not supplied to material initialization" ); | 59 | throw new Error( "GLWorld not supplied to material initialization" ); |
diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js index bd92ecd8..a28fcaee 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() { | |||
48 | if (world) this.setWorld( world ); | 48 | if (world) this.setWorld( world ); |
49 | 49 | ||
50 | // set up the shader | 50 | // set up the shader |
51 | this._shader = new jshader(); | 51 | this._shader = new RDGE.jshader(); |
52 | this._shader.def = flyMaterialDef; | 52 | this._shader.def = flyMaterialDef; |
53 | this._shader.init(); | 53 | this._shader.init(); |
54 | 54 | ||
55 | // set up the material node | 55 | // set up the material node |
56 | this._materialNode = createMaterialNode("flyMaterial" + "_" + world.generateUniqueNodeID()); | 56 | this._materialNode = RDGE.createMaterialNode("flyMaterial" + "_" + world.generateUniqueNodeID()); |
57 | this._materialNode.setShader(this._shader); | 57 | this._materialNode.setShader(this._shader); |
58 | 58 | ||
59 | this._time = 0; | 59 | this._time = 0; |
diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js index a85bd6f7..67d08b1a 100644 --- a/js/lib/rdge/materials/julia-material.js +++ b/js/lib/rdge/materials/julia-material.js | |||
@@ -46,12 +46,12 @@ var JuliaMaterial = function JuliaMaterial() { | |||
46 | if (world) this.setWorld( world ); | 46 | if (world) this.setWorld( world ); |
47 | 47 | ||
48 | // set up the shader | 48 | // set up the shader |
49 | this._shader = new jshader(); | 49 | this._shader = new RDGE.jshader(); |
50 | this._shader.def = JuliaMaterialDef; | 50 | this._shader.def = JuliaMaterialDef; |
51 | this._shader.init(); | 51 | this._shader.init(); |
52 | 52 | ||
53 | // set up the material node | 53 | // set up the material node |
54 | this._materialNode = createMaterialNode("juliaMaterial" + "_" + world.generateUniqueNodeID()); | 54 | this._materialNode = RDGE.createMaterialNode("juliaMaterial" + "_" + world.generateUniqueNodeID()); |
55 | this._materialNode.setShader(this._shader); | 55 | this._materialNode.setShader(this._shader); |
56 | 56 | ||
57 | this._time = 0; | 57 | this._time = 0; |
@@ -68,7 +68,7 @@ var JuliaMaterial = function JuliaMaterial() { | |||
68 | var material = this._materialNode; | 68 | var material = this._materialNode; |
69 | if (material) { | 69 | if (material) { |
70 | var technique = material.shaderProgram['default']; | 70 | var technique = material.shaderProgram['default']; |
71 | var renderer = g_Engine.getContext().renderer; | 71 | var renderer = RDGE.globals.engine.getContext().renderer; |
72 | if (renderer && technique) { | 72 | if (renderer && technique) { |
73 | if (this._shader && this._shader['default']) { | 73 | if (this._shader && this._shader['default']) { |
74 | this._shader['default'].u_time.set( [this._time] ); | 74 | 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 16d1ccfa..cbdd018c 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() { | |||
55 | if (world) this.setWorld( world ); | 55 | if (world) this.setWorld( world ); |
56 | 56 | ||
57 | // set up the shader | 57 | // set up the shader |
58 | this._shader = new jshader(); | 58 | this._shader = new RDGE.jshader(); |
59 | this._shader.def = keleidoscopeMaterialDef; | 59 | this._shader.def = keleidoscopeMaterialDef; |
60 | this._shader.init(); | 60 | this._shader.init(); |
61 | 61 | ||
62 | // set up the material node | 62 | // set up the material node |
63 | this._materialNode = createMaterialNode("keleidoscopeMaterial" + "_" + world.generateUniqueNodeID()); | 63 | this._materialNode = RDGE.createMaterialNode("keleidoscopeMaterial" + "_" + world.generateUniqueNodeID()); |
64 | this._materialNode.setShader(this._shader); | 64 | this._materialNode.setShader(this._shader); |