aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorhwc4872012-05-31 17:07:10 -0700
committerhwc4872012-05-31 17:07:10 -0700
commit335ce503996e3ccbd2909086328d0a31fbd03370 (patch)
treee54d588e0993572f1d794ff5b75a5082aa2035b1 /js/lib
parent129b5282ef35f320ea39d1878d2b5f77ae73a3e2 (diff)
downloadninja-335ce503996e3ccbd2909086328d0a31fbd03370.tar.gz
Added the flag shader to the runtime.
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/rdge/materials/flag-material.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/js/lib/rdge/materials/flag-material.js b/js/lib/rdge/materials/flag-material.js
index fa844cc3..d1788fb8 100644
--- a/js/lib/rdge/materials/flag-material.js
+++ b/js/lib/rdge/materials/flag-material.js
@@ -160,6 +160,37 @@ var FlagMaterial = function FlagMaterial() {
160 this.updateTexture(); 160 this.updateTexture();
161 this.update( 0 ); 161 this.update( 0 );
162 } 162 }
163
164 this.exportJSON = function () {
165 var jObj =
166 {
167 'material' : this.getShaderName(),
168 'name' : this.getName(),
169
170 'texMap' : this._propValues[this._propNames[0]],
171 'waveWidth' : this._propValues[this._propNames[1]],
172 'waveHeight' : this._propValues[this._propNames[2]],
173 'speed' : this._propValues[this._propNames[3]]
174 };
175
176 return jObj;
177 };
178
179 this.importJSON = function (jObj) {
180 if (this.getShaderName() != jObj.material) throw new Error("ill-formed material");
181 this.setName(jObj.name);
182
183 try {
184
185 this._texMap = this._propValues[this._propNames[0]] = jObj.texMap;
186 this._waveWidth = this._propValues[this._propNames[1]] = jObj.waveWidth;
187 this._waveHeight = this._propValues[this._propNames[2]] = jObj.waveHeight;
188 this._speed = this._propValues[this._propNames[3]] = jObj.speed;
189 }
190 catch (e) {
191 throw new Error("could not import material: " + importStr);
192 }
193 };
163}; 194};
164 195
165/////////////////////////////////////////////////////////////////////////////////////// 196///////////////////////////////////////////////////////////////////////////////////////