aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/Materials
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/Materials')
-rwxr-xr-xjs/helper-classes/RDGE/Materials/BumpMetalMaterial.js39
-rw-r--r--js/helper-classes/RDGE/Materials/DeformMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/FlatMaterial.js34
-rw-r--r--js/helper-classes/RDGE/Materials/FlyMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/JuliaMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/LinearGradientMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/MandelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/PlasmaMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/PulseMaterial.js5
-rw-r--r--js/helper-classes/RDGE/Materials/RadialBlurMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/RadialGradientMaterial.js6
-rw-r--r--js/helper-classes/RDGE/Materials/ReliefTunnelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/SquareTunnelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/StarMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/TaperMaterial.js4
-rw-r--r--js/helper-classes/RDGE/Materials/TunnelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/TwistMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/TwistVertMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/UberMaterial.js38
-rw-r--r--js/helper-classes/RDGE/Materials/WaterMaterial.js4
-rw-r--r--js/helper-classes/RDGE/Materials/ZInvertMaterial.js2
22 files changed, 105 insertions, 55 deletions
diff --git a/js/helper-classes/RDGE/Materials/BumpMetalMaterial.js b/js/helper-classes/RDGE/Materials/BumpMetalMaterial.js
index a7a3724e..52332ab8 100755
--- a/js/helper-classes/RDGE/Materials/BumpMetalMaterial.js
+++ b/js/helper-classes/RDGE/Materials/BumpMetalMaterial.js
@@ -65,7 +65,7 @@ function BumpMetalMaterial()
65 this.setProperty = function( prop, value ) 65 this.setProperty = function( prop, value )
66 { 66 {
67 // every material should do something with the "color" property 67 // every material should do something with the "color" property
68 if (prop === "color") prop = "lightDiff"; 68 if (prop === "color") return; //prop = "lightDiff";
69 69
70 // make sure we have legitimate imput 70 // make sure we have legitimate imput
71 var ok = this.validateProperty( prop, value ); 71 var ok = this.validateProperty( prop, value );
@@ -97,22 +97,27 @@ function BumpMetalMaterial()
97 this.init = function( world ) 97 this.init = function( world )
98 { 98 {
99 // save the world 99 // save the world
100 if (world) this.setWorld( world ); 100 if (world)
101 101 {
102 // set up the shader 102 this.setWorld( world );
103 this._shader = new jshader(); 103
104 this._shader.def = bumpMetalMaterialDef; 104 // set up the shader
105 this._shader.init(); 105 this._shader = new jshader();
106 this._shader.default.u_light0Diff.set( this.getLightDiff() ); 106 this._shader.def = bumpMetalMaterialDef;
107 107 this._shader.init();
108 // set up the material node 108 this._shader.default.u_light0Diff.set( this.getLightDiff() );
109 this._materialNode = createMaterialNode( this.getShaderName() ); 109
110 this._materialNode.setShader(this._shader); 110 // set up the material node
111 111 this._materialNode = createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() );
112 // set some image maps 112 this._materialNode.setShader(this._shader);
113 this.updateTexture(1); 113
114 this.updateTexture(2); 114 // set some image maps
115 this.updateTexture(3); 115 this.updateTexture(1);
116 this.updateTexture(2);
117 this.updateTexture(3);
118 }
119 else
120 throw new Error( "GLWorld not supplied to material initialization" );
116 }; 121 };
117 122
118 this.updateTexture = function( index ) 123 this.updateTexture = function( index )
diff --git a/js/helper-classes/RDGE/Materials/DeformMaterial.js b/js/helper-classes/RDGE/Materials/DeformMaterial.js
index ddc97383..b7101227 100644
--- a/js/helper-classes/RDGE/Materials/DeformMaterial.js
+++ b/js/helper-classes/RDGE/Materials/DeformMaterial.js
@@ -71,7 +71,7 @@ function DeformMaterial()
71 this._shader.init(); 71 this._shader.init();
72 72
73 // set up the material node 73 // set up the material node
74 this._materialNode = createMaterialNode("deformMaterial"); 74 this._materialNode = createMaterialNode("deformMaterial_" + world.generateUniqueNodeID());
75 this._materialNode.setShader(this._shader); 75 this._materialNode.setShader(this._shader);
76 76
77 this._time = 0; 77 this._time = 0;
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js
index 570e7f9e..eb8970b8 100755
--- a/js/helper-classes/RDGE/Materials/FlatMaterial.js
+++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js
@@ -40,19 +40,27 @@ function FlatMaterial()
40 // duplcate method requirde 40 // duplcate method requirde
41 this.dup = function() { return new FlatMaterial(); } ; 41 this.dup = function() { return new FlatMaterial(); } ;
42 42
43 this.init = function() 43 this.init = function( world )
44 { 44 {
45 // set up the shader 45 // save the world
46 this._shader = new jshader(); 46 if (world)
47 this._shader.def = flatShaderDef; 47 {
48 this._shader.init(); 48 this.setWorld( world );
49
50 // set up the shader
51 this._shader = new jshader();
52 this._shader.def = flatShaderDef;
53 this._shader.init();
49 54
50 // set the defaults 55 // set the defaults
51 this._shader.colorMe.color.set( this.getColor() ); 56 this._shader.colorMe.color.set( this.getColor() );
52 57
53 // set up the material node 58 // set up the material node
54 this._materialNode = createMaterialNode("flatMaterial"); 59 this._materialNode = createMaterialNode("flatMaterial_" + world.generateUniqueNodeID() );
55 this._materialNode.setShader(this._shader); 60 this._materialNode.setShader(this._shader);
61 }
62 else
63 throw new Error( "GLWorld not supplied to material initialization" );
56 }; 64 };
57 65
58 66
@@ -83,11 +91,7 @@ function FlatMaterial()
83 // this function should be overridden by subclasses 91 // this function should be overridden by subclasses
84 var exportStr = "material: " + this.getShaderName() + "\n"; 92 var exportStr = "material: " + this.getShaderName() + "\n";
85 exportStr += "name: " + this.getName() + "\n"; 93 exportStr += "name: " + this.getName() + "\n";
86 94 exportStr += "color: " + String(this._propValues["color"]) + "\n";
87 if (this._shader)
88 exportStr += "color: " + String(this._shader.colorMe.color) + "\n";
89 else
90 exportStr += "color: " + this.getColor() + "\n";
91 exportStr += "endMaterial\n"; 95 exportStr += "endMaterial\n";
92 96
93 return exportStr; 97 return exportStr;
diff --git a/js/helper-classes/RDGE/Materials/FlyMaterial.js b/js/helper-classes/RDGE/Materials/FlyMaterial.js
index 4a44e2e5..a70b53e8 100644
--- a/js/helper-classes/RDGE/Materials/FlyMaterial.js
+++ b/js/helper-classes/RDGE/Materials/FlyMaterial.js
@@ -71,7 +71,7 @@ function FlyMaterial()
71 this._shader.init(); 71 this._shader.init();
72 72
73 // set up the material node 73 // set up the material node
74 this._materialNode = createMaterialNode("flyMaterial"); 74 this._materialNode = createMaterialNode("flyMaterial_" + world.generateUniqueNodeID());
75 this._materialNode.setShader(this._shader); 75 this._materialNode.setShader(this._shader);
76 76
77 this._time = 0; 77 this._time = 0;
diff --git a/js/helper-classes/RDGE/Materials/JuliaMaterial.js b/js/helper-classes/RDGE/Materials/JuliaMaterial.js
index f95263f4..9b5d588c 100644
--- a/js/helper-classes/RDGE/Materials/JuliaMaterial.js
+++ b/js/helper-classes/RDGE/Materials/JuliaMaterial.js
@@ -73,7 +73,7 @@ function JuliaMaterial()
73 this._shader.init(); 73 this._shader.init();
74 74
75 // set up the material node 75 // set up the material node
76 this._materialNode = createMaterialNode("juliaMaterial"); 76 this._materialNode = createMaterialNode("juliaMaterial_" + world.generateUniqueNodeID());
77 this._materialNode.setShader(this._shader); 77 this._materialNode.setShader(this._shader);
78 78
79 this._time = 0; 79 this._time = 0;
diff --git a/js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js b/js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js
index 1547aca9..af7ce97c 100644
--- a/js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js
+++ b/js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js
@@ -71,7 +71,7 @@ function KeleidoscopeMaterial()
71 this._shader.init(); 71 this._shader.init();
72 72
73 // set up the material node 73 // set up the material node
74 this._materialNode = createMaterialNode("keleidoscopeMaterial"); 74 this._materialNode = createMaterialNode("keleidoscopeMaterial_" + world.generateUniqueNodeID());
75 this._materialNode.setShader(this._shader); 75 this._materialNode.setShader(this._shader);
76 76
77 this._time = 0; 77 this._time = 0;
diff --git a/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js b/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js
index 7fe2be0c..2f900894 100755
--- a/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js
+++ b/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js
@@ -159,7 +159,7 @@ function LinearGradientMaterial()
159 this._shader.init(); 159 this._shader.init();
160 160
161 // set up the material node 161 // set up the material node