aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/io/system/ninjalibrary.json2
-rw-r--r--js/lib/rdge/materials/flag-material.js31
2 files changed, 32 insertions, 1 deletions
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index 9547c1e8..bee603ae 100644
--- a/js/io/system/ninjalibrary.json
+++ b/js/io/system/ninjalibrary.json
@@ -1,6 +1,6 @@
1{ 1{
2 "libraries": [ 2 "libraries": [
3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.8.0.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.8.0.0"},
4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.6.4"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.6.6"}
5 ] 5 ]
6} \ No newline at end of file 6} \ No newline at end of file
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///////////////////////////////////////////////////////////////////////////////////////