diff options
Diffstat (limited to 'js/lib/rdge')
-rwxr-xr-x | js/lib/rdge/materials/bump-metal-material.js | 54 | ||||
-rw-r--r-- | js/lib/rdge/materials/cloud-material.js | 41 | ||||
-rwxr-xr-x | js/lib/rdge/materials/flat-material.js | 28 | ||||
-rwxr-xr-x | js/lib/rdge/materials/linear-gradient-material.js | 63 | ||||
-rwxr-xr-x | js/lib/rdge/materials/material.js | 15 | ||||
-rw-r--r-- | js/lib/rdge/materials/pulse-material.js | 42 | ||||
-rw-r--r-- | js/lib/rdge/materials/radial-blur-material.js | 38 | ||||
-rwxr-xr-x | js/lib/rdge/materials/radial-gradient-material.js | 59 | ||||
-rw-r--r-- | js/lib/rdge/materials/taper-material.js | 38 | ||||
-rw-r--r-- | js/lib/rdge/materials/twist-vert-material.js | 38 | ||||
-rwxr-xr-x | js/lib/rdge/materials/uber-material.js | 187 |
11 files changed, 0 insertions, 603 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index d764de66..27d5793c 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js | |||
@@ -193,60 +193,6 @@ var BumpMetalMaterial = function BumpMetalMaterial() { | |||
193 | 193 | ||
194 | return; | 194 | return; |
195 | }; | 195 | }; |
196 | |||
197 | this.export = function() | ||
198 | { | ||
199 | // every material needs the base type and instance name | ||
200 | var exportStr = "material: " + this.getShaderName() + "\n"; | ||
201 | exportStr += "name: " + this.getName() + "\n"; | ||
202 | |||
203 | var world = this.getWorld(); | ||
204 | if (!world) | ||
205 | throw new Error( "no world in material.export, " + this.getName() ); | ||
206 | |||
207 | exportStr += "lightDiff: " + this.getLightDiff() + "\n"; | ||
208 | exportStr += "diffuseTexture: " + this.getDiffuseTexture() + "\n"; | ||
209 | exportStr += "specularTexture: " + this.getSpecularTexture() + "\n"; | ||
210 | exportStr += "normalMap: " + this.getNormalTexture() + "\n"; | ||
211 | |||
212 | // every material needs to terminate like this | ||
213 | exportStr += "endMaterial\n"; | ||
214 | |||
215 | return exportStr; | ||
216 | }; | ||
217 | |||
218 | this.import = function( importStr ) | ||
219 | { | ||
220 | var pu = new MaterialParser( importStr ); | ||
221 | var material = pu.nextValue( "material: " ); | ||
222 | if (material != this.getShaderName()) throw new Error( "ill-formed material" ); | ||
223 | this.setName( pu.nextValue( "name: ") ); | ||
224 | |||
225 | var rtnStr; | ||
226 | try | ||
227 | { | ||
228 | var lightDiff = eval( "[" + pu.nextValue( "lightDiff: " ) + "]" ), | ||
229 | dt = pu.nextValue( "diffuseTexture: " ), | ||
230 | st = pu.nextValue( "specularTexture: " ), | ||
231 | nt = pu.nextValue( "normalMap: " ); | ||
232 | |||
233 | this.setProperty( "lightDiff", lightDiff); | ||
234 | this.setProperty( "diffuseTexture", dt ); | ||
235 | this.setProperty( "specularTexture", st ); | ||
236 | this.setProperty( "normalMap", nt ); | ||
237 | |||
238 | var endKey = "endMaterial\n"; | ||
239 | var index = importStr.indexOf( endKey ); | ||
240 | index += endKey.length; | ||
241 | rtnStr = importStr.substr( index ); | ||
242 | } | ||
243 | catch (e) | ||
244 | { | ||
245 | throw new Error( "could not import material: " + importStr ); | ||
246 | } | ||
247 | |||
248 | return rtnStr; | ||
249 | }; | ||
250 | }; | 196 | }; |
251 | 197 | ||
252 | /////////////////////////////////////////////////////////////////////////////////////// | 198 | /////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/js/lib/rdge/materials/cloud-material.js b/js/lib/rdge/materials/cloud-material.js index 092553ce..bde42ac3 100644 --- a/js/lib/rdge/materials/cloud-material.js +++ b/js/lib/rdge/materials/cloud-material.js | |||
@@ -191,47 +191,6 @@ var CloudMaterial = function CloudMaterial() { | |||
191 | throw new Error("could not import material: " + jObj); | 191 | throw new Error("could not import material: " + jObj); |
192 | } | 192 | } |
193 | }; | 193 | }; |
194 | |||
195 | |||
196 | this.export = function () { | ||
197 | // every material needs the base type and instance name | ||
198 | var exportStr = "material: " + this.getShaderName() + "\n"; | ||
199 | exportStr += "name: " + this.getName() + "\n"; | ||
200 | |||
201 | var world = this.getWorld(); | ||
202 | if (!world) | ||
203 | throw new Error("no world in material.export, " + this.getName()); | ||
204 | |||
205 | var texMapName = this._propValues[this._propNames[0]]; | ||
206 | exportStr += "texture: " + texMapName + "\n"; | ||
207 | |||
208 | // every material needs to terminate like this | ||
209 | exportStr += "endMaterial\n"; | ||
210 | |||
211 | return exportStr; | ||
212 | }; | ||
213 | |||
214 | this.import = function (importStr) { | ||
215 | var pu = new MaterialParser(importStr); | ||
216 | var material = pu.nextValue("material: "); | ||
217 | if (material != this.getShaderName()) throw new Error("ill-formed material"); | ||
218 | this.setName(pu.nextValue("name: ")); | ||
219 | |||
220 | var rtnStr; | ||
221 | try { | ||
222 | this._propValues[this._propNames[0]] = pu.nextValue("texture: "); | ||
223 | |||
224 | var endKey = "endMaterial\n"; | ||
225 | var index = importStr.indexOf(endKey); | ||
226 | index += endKey.length; | ||
227 | rtnStr = importStr.substr(index); | ||
228 | } | ||
229 | catch (e) { | ||
230 | throw new Error("could not import material: " + importStr); | ||
231 | } | ||
232 | |||
233 | return rtnStr; | ||
234 | }; | ||
235 | }; | 194 | }; |
236 | 195 | ||
237 | /////////////////////////////////////////////////////////////////////////////////////// | 196 | /////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index 106641a9..9442ae5b 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js | |||
@@ -79,34 +79,6 @@ var FlatMaterial = function FlatMaterial() { | |||
79 | }; | 79 | }; |
80 | /////////////////////////////////////////////////////////////////////// | 80 | /////////////////////////////////////////////////////////////////////// |
81 | 81 | ||
82 | this.export = function () { | ||
83 | // this function should be overridden by subclasses | ||
84 | var exportStr = "material: " + this.getShaderName() + "\n"; | ||
85 | exportStr += "name: " + this.getName() + "\n"; | ||
86 | exportStr += "color: " + String(this._propValues["color"]) + "\n"; | ||
87 | exportStr += "endMaterial\n"; | ||
88 | |||
89 | return exportStr; | ||
90 | }; | ||
91 | |||
92 | this.import = function (importStr) { | ||
93 | var pu = new MaterialParser(importStr); | ||
94 | var material = pu.nextValue("material: "); | ||
95 | if (material != this.getShaderName()) throw new Error("ill-formed material"); | ||
96 | this.setName(pu.nextValue("name: ")); | ||
97 | |||
98 | var rtnStr; | ||
99 | try { | ||
100 | var color = eval("[" + pu.nextValue("color: ") + "]"); | ||
101 | this.setProperty("color", color); | ||
102 | } | ||
103 | catch (e) { | ||
104 | throw new Error("could not import material: " + importStr); | ||
105 | } | ||
106 | |||
107 | return rtnStr; | ||
108 | }; | ||
109 | |||
110 | this.exportJSON = function () { | 82 | this.exportJSON = function () { |
111 | var jObj = | 83 | var jObj = |
112 | { | 84 | { |
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: ")), |