aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/plasma-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/plasma-material.js')
-rw-r--r--js/lib/rdge/materials/plasma-material.js24
1 files changed, 21 insertions, 3 deletions
diff --git a/js/lib/rdge/materials/plasma-material.js b/js/lib/rdge/materials/plasma-material.js
index 86b1a93c..02172a6b 100644
--- a/js/lib/rdge/materials/plasma-material.js
+++ b/js/lib/rdge/materials/plasma-material.js
@@ -49,7 +49,7 @@ var PlasmaMaterial = function PlasmaMaterial() {
49 this.setWorld( world ); 49 this.setWorld( world );
50 50
51 // set up the shader 51 // set up the shader
52 this._shader = new jshader(); 52 this._shader = new RDGE.jshader();
53 this._shader.def = plasmaShaderDef; 53 this._shader.def = plasmaShaderDef;
54 this._shader.init(); 54 this._shader.init();
55 55
@@ -58,15 +58,33 @@ var PlasmaMaterial = function PlasmaMaterial() {
58 this._shader['default'].u_time.set( [this._time] ); 58 this._shader['default'].u_time.set( [this._time] );
59 59
60 // set up the material node 60 // set up the material node
61 this._materialNode = createMaterialNode("plasmaMaterial" + "_" + world.generateUniqueNodeID()); 61 this._materialNode = RDGE.createMaterialNode("plasmaMaterial" + "_" + world.generateUniqueNodeID());
62 this._materialNode.setShader(this._shader); 62 this._materialNode.setShader(this._shader);
63 }; 63 };
64 64
65 this.update = function( time ) { 65 this.update = function( time ) {
66 this._shader['default'].u_time.set( [this._time] ); 66 this._shader['default'].u_time.set( [this._time] );
67 this._time += this._dTime; 67 this._time += this._dTime;
68 } 68 };
69 69
70 this.exportJSON = function()
71 {
72 var jObj =
73 {
74 'material' : this.getShaderName(),
75 'name' : this.getName(),
76 'speed' : this._speed,
77 'dTime' : this._dTime
78 };
79
80 return jObj;
81 };
82
83 this.importJSON = function( jObj )
84 {
85 this._speed = jObj.speed;
86 this._dTime = jObj.dTime;
87 };
70}; 88};
71 89
72/////////////////////////////////////////////////////////////////////////////////////// 90///////////////////////////////////////////////////////////////////////////////////////