aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/radial-gradient-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/radial-gradient-material.js')
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js59
1 files changed, 0 insertions, 59 deletions
diff --git a/js/lib/rdge/materials/radial-gradient-material.js b/js/lib/rdge/materials/radial-gradient-material.js
index 2d288c46..dd40d31d 100755
--- a/js/lib/rdge/materials/radial-gradient-material.js
+++ b/js/lib/rdge/materials/radial-gradient-material.js
@@ -280,65 +280,6 @@ var RadialGradientMaterial = function RadialGradientMaterial() {
280 throw new Error("could not import material: " + importStr); 280 throw new Error("could not import material: " + importStr);
281 } 281 }
282 }; 282 };
283
284 this.export = function () {
285 // every material needs the base type and instance name
286 var exportStr = "material: " + this.getShaderName() + "\n";
287 exportStr += "name: " + this.getName() + "\n";
288
289 exportStr += "color1: " + this.getColor1() + "\n";
290 exportStr += "color2: " + this.getColor2() + "\n";
291 exportStr += "color3: " + this.getColor3() + "\n";
292 exportStr += "color4: " + this.getColor4() + "\n";
293
294 exportStr += "colorStop1: " + this.getColorStop1() + "\n";
295 exportStr += "colorStop2: " + this.getColorStop2() + "\n";
296 exportStr += "colorStop3: " + this.getColorStop3() + "\n";
297 exportStr += "colorStop4: " + this.getColorStop4() + "\n";
298
299 // every material needs to terminate like this
300 exportStr += "endMaterial\n";
301
302 return exportStr;
303 };
304
305 this.import = function (importStr) {
306 var pu = new MaterialParser(importStr);
307 var material = pu.nextValue("material: ");
308 if (material != this.getShaderName()) throw new Error("ill-formed material");
309 this.setName(pu.nextValue("name: "));
310
311 var rtnStr;
312 try {
313 var color1 = eval("[" + pu.nextValue("color1: ") + "]"),
314 color2 = eval("[" + pu.nextValue("color2: ") + "]"),
315 color3 = eval("[" + pu.nextValue("color3: ") + "]"),
316 color4 = eval("[" + pu.nextValue("color4: ") + "]"),
317 colorStop1 = Number(pu.nextValue("colorStop1: ")),
318 colorStop2 = Number(pu.nextValue("colorStop2: ")),
319 colorStop3 = Number(pu.nextValue("colorStop3: ")),
320 colorStop4 = Number(pu.nextValue("colorStop4: "));
321
322 this.setProperty("color1", color1);
323 this.setProperty("color2", color2);
324 this.setProperty("color3", color3);
325 this.setProperty("color4", color4);
326 this.setProperty("colorStop1", colorStop1);
327 this.setProperty("colorStop2", colorStop2);
328 this.setProperty("colorStop3", colorStop3);
329 this.setProperty("colorStop4", colorStop4);
330
331 var endKey = "endMaterial\n";
332 var index = importStr.indexOf(endKey);
333 index += endKey.length;
334 rtnStr = importStr.substr(index);
335 }
336 catch (e) {
337 throw new Error("could not import material: " + importStr);
338 }
339
340 return rtnStr;
341 };
342}; 283};
343 284
344/////////////////////////////////////////////////////////////////////////////////////// 285///////////////////////////////////////////////////////////////////////////////////////