diff options
Diffstat (limited to 'js/lib/rdge/materials/linear-gradient-material.js')
-rwxr-xr-x | js/lib/rdge/materials/linear-gradient-material.js | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js index 87e41ad6..51a7430c 100755 --- a/js/lib/rdge/materials/linear-gradient-material.js +++ b/js/lib/rdge/materials/linear-gradient-material.js | |||
@@ -296,69 +296,6 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
296 | throw new Error("could not import material: " + importStr); | 296 | throw new Error("could not import material: " + importStr); |
297 | } | 297 | } |
298 | }; | 298 | }; |
299 | |||
300 | this.export = function () { | ||
301 | // every material needs the base type and instance name | ||
302 | var exportStr = "material: " + this.getShaderName() + "\n"; | ||
303 | exportStr += "name: " + this.getName() + "\n"; | ||
304 | |||
305 | exportStr += "color1: " + this.getColor1() + "\n"; | ||
306 | exportStr += "color2: " + this.getColor2() + "\n"; | ||
307 | exportStr += "color3: " + this.getColor3() + "\n"; | ||
308 | exportStr += "color4: " + this.getColor4() + "\n"; | ||
309 | |||
310 | exportStr += "colorStop1: " + this.getColorStop1() + "\n"; | ||
311 | exportStr += "colorStop2: " + this.getColorStop2() + "\n"; | ||
312 | exportStr += "colorStop3: " + this.getColorStop3() + "\n"; | ||
313 | exportStr += "colorStop4: " + this.getColorStop4() + "\n"; | ||
314 | |||
315 | exportStr += "angle: " + this.getAngle() + "\n"; | ||
316 | |||
317 | // every material needs to terminate like this | ||
318 | exportStr += "endMaterial\n"; | ||
319 | |||
320 | return exportStr; | ||
321 | }; | ||
322 | |||
323 | this.import = function (importStr) { | ||
324 | var pu = new MaterialParser(importStr); | ||
325 | var material = pu.nextValue("material: "); | ||
326 | if (material != this.getShaderName()) throw new Error("ill-formed material"); | ||
327 | this.setName(pu.nextValue("name: ")); | ||
328 | |||
329 | var rtnStr; | ||
330 | try { | ||
331 | var color1 = eval("[" + pu.nextValue("color1: ") + "]"), | ||
332 | color2 = eval("[" + pu.nextValue("color2: ") + "]"), | ||
333 | color3 = eval("[" + pu.nextValue("color3: ") + "]"), | ||
334 | color4 = eval("[" + pu.nextValue("color4: ") + "]"), | ||
335 | colorStop1 = Number(pu.nextValue("colorStop1: ")), | ||
336 | colorStop2 = Number(pu.nextValue("colorStop2: ")), | ||
337 | colorStop3 = Number(pu.nextValue("colorStop3: ")), | ||
338 | colorStop4 = Number(pu.nextValue("colorStop4: ")), | ||
339 | angle = Number(pu.nextValue("angle: ")); | ||
340 | |||
341 | var endKey = "endMaterial\n"; | ||
342 | var index = importStr.indexOf(endKey); | ||
343 | index += endKey.length; | ||
344 | rtnStr = importStr.substr(index); | ||
345 | |||
346 | this.setProperty("color1", color1); | ||
347 | this.setProperty("color2", color2); | ||
348 | this.setProperty("color3", color3); | ||
349 | this.setProperty("color4", color4); | ||
350 | this.setProperty("colorStop1", colorStop1); | ||
351 | this.setProperty("colorStop2", colorStop2); | ||
352 | this.setProperty("colorStop3", colorStop3); | ||
353 | this.setProperty("colorStop4", colorStop4); | ||
354 | this.setProperty("angle", angle); | ||
355 | } | ||
356 | catch (e) { | ||
357 | throw new Error("could not import material: " + importStr); | ||
358 | } | ||
359 | |||
360 | return rtnStr; | ||
361 | }; | ||
362 | }; | 299 | }; |
363 | 300 | ||
364 | /////////////////////////////////////////////////////////////////////////////////////// | 301 | /////////////////////////////////////////////////////////////////////////////////////// |