diff options
author | Pushkar Joshi | 2012-03-27 09:10:58 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-03-27 09:10:58 -0700 |
commit | 0c26aff9c19c2b39fca06fa6b3bc76b672204065 (patch) | |
tree | e778f2b9d5d525aa364360d5996536a0a06379bd /js/lib/rdge/materials/radial-blur-material.js | |
parent | 753244b4713243ab19ca246be674f0b45fb85b72 (diff) | |
parent | 309dde5a8c4599cef6a1052c1ff9ee1ad8ec5858 (diff) | |
download | ninja-0c26aff9c19c2b39fca06fa6b3bc76b672204065.tar.gz |
Merge branch 'master' into brushtool
Conflicts:
js/controllers/elements/shapes-controller.js
Diffstat (limited to 'js/lib/rdge/materials/radial-blur-material.js')
-rw-r--r-- | js/lib/rdge/materials/radial-blur-material.js | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/js/lib/rdge/materials/radial-blur-material.js b/js/lib/rdge/materials/radial-blur-material.js index 46cdda74..f4a4baa2 100644 --- a/js/lib/rdge/materials/radial-blur-material.js +++ b/js/lib/rdge/materials/radial-blur-material.js | |||
@@ -157,6 +157,38 @@ var RadialBlurMaterial = function RadialBlurMaterial() { | |||
157 | } | 157 | } |
158 | }; | 158 | }; |
159 | 159 | ||
160 | this.exportJSON = function() | ||
161 | { | ||
162 | var jObj = | ||
163 | { | ||
164 | 'material' : this.getShaderName(), | ||
165 | 'name' : this.getName(), | ||
166 | 'color' : this._propValues["color"], | ||
167 | 'texture' : this._propValues[this._propNames[0]] | ||
168 | }; | ||
169 | |||
170 | return jObj; | ||
171 | }; | ||
172 | |||
173 | this.importJSON = function( jObj ) | ||
174 | { | ||
175 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
176 | this.setName( jObj.name ); | ||
177 | |||
178 | var rtnStr; | ||
179 | try | ||
180 | { | ||
181 | this._propValues[this._propNames[0]] = jObj.texture; | ||
182 | this.updateTexture(); | ||
183 | } | ||
184 | catch (e) | ||
185 | { | ||
186 | throw new Error( "could not import material: " + importStr ); | ||
187 | } | ||
188 | |||
189 | return rtnStr; | ||
190 | } | ||
191 | |||
160 | this.export = function() { | 192 | this.export = function() { |
161 | // every material needs the base type and instance name | 193 | // every material needs the base type and instance name |
162 | var exportStr = "material: " + this.getShaderName() + "\n"; | 194 | var exportStr = "material: " + this.getShaderName() + "\n"; |
@@ -242,10 +274,31 @@ var radialBlurMaterialDef = | |||
242 | } | 274 | } |
243 | }; | 275 | }; |
244 | 276 | ||
277 | |||
278 | var RaidersMaterial = function RaidersMaterial() | ||
279 | { | ||
280 | // initialize the inherited members | ||
281 | this.inheritedFrom = RadialBlurMaterial; | ||
282 | this.inheritedFrom(); | ||
283 | |||
284 | this._name = "RaidersMaterial"; | ||
285 | this._shaderName = "radialBlur"; | ||
286 | |||
287 | this._texMap = 'assets/images/raiders.png'; | ||
288 | this._propValues[ this._propNames[0] ] = this._texMap.slice(0); | ||
289 | } | ||
290 | |||
291 | RaidersMaterial.prototype = new Material(); | ||
292 | |||
293 | if (typeof exports === "object") | ||
294 | { | ||
295 | exports.RaidersMaterial = RaidersMaterial; | ||
296 | } | ||
297 | |||
298 | |||
245 | RadialBlurMaterial.prototype = new Material(); | 299 | RadialBlurMaterial.prototype = new Material(); |
246 | 300 | ||
247 | if (typeof exports === "object") { | 301 | if (typeof exports === "object") |
248 | exports.RadialBlurMaterial = RadialBlurMaterial; | 302 | exports.RadialBlurMaterial = RadialBlurMaterial; |
249 | } | ||
250 | 303 | ||
251 | 304 | ||