aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials')
-rw-r--r--js/lib/rdge/materials/julia-material.js6
-rw-r--r--js/lib/rdge/materials/mandel-material.js6
-rw-r--r--js/lib/rdge/materials/plasma-material.js19
-rw-r--r--js/lib/rdge/materials/pulse-material.js1
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js29
-rw-r--r--js/lib/rdge/materials/water-material.js25
6 files changed, 73 insertions, 13 deletions
diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js
index 976dfad3..a85bd6f7 100644
--- a/js/lib/rdge/materials/julia-material.js
+++ b/js/lib/rdge/materials/julia-material.js
@@ -21,11 +21,7 @@ var JuliaMaterial = function JuliaMaterial() {
21 /////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////
22 // Properties 22 // Properties
23 /////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////
24 // no properties 24 // properties inherited from PulseMaterial
25 this._propNames = [];
26 this._propLabels = [];
27 this._propTypes = [];
28 this._propValues = [];
29 25
30 /////////////////////////////////////////////////////////////////////// 26 ///////////////////////////////////////////////////////////////////////
31 // Methods 27 // Methods
diff --git a/js/lib/rdge/materials/mandel-material.js b/js/lib/rdge/materials/mandel-material.js
index d9f00383..e7b105e1 100644
--- a/js/lib/rdge/materials/mandel-material.js
+++ b/js/lib/rdge/materials/mandel-material.js
@@ -21,11 +21,7 @@ var MandelMaterial = function MandelMaterial() {
21 /////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////
22 // Properties 22 // Properties
23 /////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////
24 // no properties 24 // properties inherited from PulseMaterial
25 this._propNames = [];
26 this._propLabels = [];
27 this._propTypes = [];
28 this._propValues = [];
29 25
30 /////////////////////////////////////////////////////////////////////// 26 ///////////////////////////////////////////////////////////////////////
31 // Material Property Accessors 27 // Material Property Accessors
diff --git a/js/lib/rdge/materials/plasma-material.js b/js/lib/rdge/materials/plasma-material.js
index 86b1a93c..316a5989 100644
--- a/js/lib/rdge/materials/plasma-material.js
+++ b/js/lib/rdge/materials/plasma-material.js
@@ -67,6 +67,25 @@ var PlasmaMaterial = function PlasmaMaterial() {
67 this._time += this._dTime; 67 this._time += this._dTime;
68 } 68 }
69 69
70 this.exportJSON = function()
71 {
72
73 var jObj =
74 {
75 'material' : this.getShaderName(),
76 'name' : this.getName(),
77 'speed' : this._speed,
78 'dTime' : this._dTime
79 }
80
81 return jObj;
82 }
83
84 this.importJSON = function( jObj )
85 {
86 this._speed = jObj.speed;
87 this._dTime = jObj.dTime;
88 }
70}; 89};
71 90
72/////////////////////////////////////////////////////////////////////////////////////// 91///////////////////////////////////////////////////////////////////////////////////////
diff --git a/js/lib/rdge/materials/pulse-material.js b/js/lib/rdge/materials/pulse-material.js
index 6f19ab2b..fd2cbe0b 100644
--- a/js/lib/rdge/materials/pulse-material.js
+++ b/js/lib/rdge/materials/pulse-material.js
@@ -186,6 +186,7 @@ var PulseMaterial = function PulseMaterial() {
186 186
187 try { 187 try {
188 this._propValues[this._propNames[0]] = jObj.texture; 188 this._propValues[this._propNames[0]] = jObj.texture;
189 this._texMap = jObj.texture;
189 } 190 }
190 catch (e) 191 catch (e)
191 { 192 {
diff --git a/js/lib/rdge/materials/radial-blur-material.js b/js/lib/rdge/materials/radial-blur-material.js
index e76b302f..d67a3d43 100644
--- a/js/lib/rdge/materials/radial-blur-material.js
+++ b/js/lib/rdge/materials/radial-blur-material.js
@@ -174,7 +174,7 @@ var RadialBlurMaterial = function RadialBlurMaterial() {
174 return jObj; 174 return jObj;
175 }; 175 };
176 176
177 this.importJSON = function( importStr ) 177 this.importJSON = function( jObj )
178 { 178 {
179 if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); 179 if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" );
180 this.setName( jObj.name ); 180 this.setName( jObj.name );
@@ -278,10 +278,33 @@ var radialBlurMaterialDef =
278 } 278 }
279}; 279};
280 280
281
282/*
283var RaidersMaterial = function RaidersMaterial()
284{
285 // initialize the inherited members
286 this.inheritedFrom = RadialBlurMaterial;
287 this.inheritedFrom();
288
289 this._name = "RaidersMaterial";
290 this._shaderName = "radialBlur";
291
292 this._texMap = 'assets/images/raiders.png';
293 this._propValues[ this._propNames[0] ] = this._texMap.slice(0);
294}
295
296RaidersMaterial.prototype = new Material();
297
298if (typeof exports === "object")
299{
300 exports.RaidersMaterial = RaidersMaterial;
301}
302*/
303
304
281RadialBlurMaterial.prototype = new Material(); 305RadialBlurMaterial.prototype = new Material();
282 306
283if (typeof exports === "object") { 307if (typeof exports === "object")
284 exports.RadialBlurMaterial = RadialBlurMaterial; 308 exports.RadialBlurMaterial = RadialBlurMaterial;
285}
286 309
287 310
diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js
index cac5a249..565055a1 100644
--- a/js/lib/rdge/materials/water-material.js
+++ b/js/lib/rdge/materials/water-material.js
@@ -18,6 +18,7 @@ var WaterMaterial = function WaterMaterial() {
18 this._shaderName = "water"; 18 this._shaderName = "water";
19 19
20 this._texMap = 'assets/images/rocky-normal.jpg'; 20 this._texMap = 'assets/images/rocky-normal.jpg';
21 //this._texMap = 'assets/images/powderblue.png';
21 22
22 this._time = 0.0; 23 this._time = 0.0;
23 this._dTime = 0.01; 24 this._dTime = 0.01;
@@ -27,6 +28,7 @@ var WaterMaterial = function WaterMaterial() {
27 /////////////////////////////////////////////////////////////////////// 28 ///////////////////////////////////////////////////////////////////////
28 // all defined in parent PulseMaterial.js 29 // all defined in parent PulseMaterial.js
29 // load the local default value 30 // load the local default value
31 this._propValues = [];
30 this._propValues[ this._propNames[0] ] = this._texMap.slice(0); 32 this._propValues[ this._propNames[0] ] = this._texMap.slice(0);
31 33
32 /////////////////////////////////////////////////////////////////////// 34 ///////////////////////////////////////////////////////////////////////
@@ -115,6 +117,29 @@ var waterMaterialDef =
115 } 117 }
116}; 118};
117 119
120/*
121var ParisMaterial = function ParisMaterial()
122{
123 // initialize the inherited members
124 this.inheritedFrom = WaterMaterial;
125 this.inheritedFrom();
126
127 this._name = "ParisMaterial";
128 this._shaderName = "water";
129
130 this._texMap = 'assets/images/paris.png';
131 this._propValues[ this._propNames[0] ] = this._texMap.slice(0);
132
133 this._diffuseColor = [0.5, 0.5, 0.5, 0.5];
134 this._propValues[ this._propNames[1] ] = this._diffuseColor.slice();
135}
136ParisMaterial.prototype = new PulseMaterial();
137if (typeof exports === "object") {
138 exports.ParisMaterial = ParisMaterial;
139}
140*/
141
142
118WaterMaterial.prototype = new PulseMaterial(); 143WaterMaterial.prototype = new PulseMaterial();
119 144
120if (typeof exports === "object") { 145if (typeof exports === "object") {