diff options
author | hwc487 | 2012-03-22 15:47:11 -0700 |
---|---|---|
committer | hwc487 | 2012-03-22 15:47:11 -0700 |
commit | e927e4702d7dbd4a878f6979b3f56b46758f93de (patch) | |
tree | e6bb8951374a6504bd6c745ce7233da5cd4869dc /js/lib/rdge/materials/radial-gradient-material.js | |
parent | 00cd98e49c959906d7c44bb6adcdef1f3d5148ae (diff) | |
parent | 31e924e1b8b8da8342b3ff2341c8284915486c0b (diff) | |
download | ninja-e927e4702d7dbd4a878f6979b3f56b46758f93de.tar.gz |
Merge branch 'integration' of github.com:ericmueller/ninja-internal into Textures
Diffstat (limited to 'js/lib/rdge/materials/radial-gradient-material.js')
-rwxr-xr-x | js/lib/rdge/materials/radial-gradient-material.js | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/js/lib/rdge/materials/radial-gradient-material.js b/js/lib/rdge/materials/radial-gradient-material.js index d19b44b7..87e20ad4 100755 --- a/js/lib/rdge/materials/radial-gradient-material.js +++ b/js/lib/rdge/materials/radial-gradient-material.js | |||
@@ -158,7 +158,8 @@ var RadialGradientMaterial = function RadialGradientMaterial() { | |||
158 | this._propValues[ this._propNames[6] ] = this._colorStop3; | 158 | this._propValues[ this._propNames[6] ] = this._colorStop3; |
159 | this._propValues[ this._propNames[7] ] = this._colorStop4; | 159 | this._propValues[ this._propNames[7] ] = this._colorStop4; |
160 | 160 | ||
161 | this.setProperty = function( prop, value ) { | 161 | this.setProperty = function( prop, value ) |
162 | { | ||
162 | if (prop === "color") prop = "color1"; | 163 | if (prop === "color") prop = "color1"; |
163 | 164 | ||
164 | // make sure we have legitimate imput | 165 | // make sure we have legitimate imput |
@@ -236,6 +237,57 @@ var RadialGradientMaterial = function RadialGradientMaterial() { | |||
236 | } | 237 | } |
237 | }; | 238 | }; |
238 | 239 | ||
240 | this.exportJSON = function() | ||
241 | { | ||
242 | var jObj = | ||
243 | { | ||
244 | 'material' : this.getShaderName(), | ||
245 | 'name' : this.getName(), | ||
246 | |||
247 | 'color1' : this.getColor1(), | ||
248 | 'color2' : this.getColor2(), | ||
249 | 'color3' : this.getColor3(), | ||
250 | 'color4' : this.getColor4(), | ||
251 | 'colorStop1' : this.getColorStop1(), | ||
252 | 'colorStop2' : this.getColorStop2(), | ||
253 | 'colorStop3' : this.getColorStop3(), | ||
254 | 'colorStop4' : this.getColorStop4() | ||
255 | }; | ||
256 | |||
257 | return jObj; | ||
258 | }; | ||
259 | |||
260 | this.importJSON = function( jObj ) | ||
261 | { | ||
262 | if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" ); | ||
263 | this.setName( jObj.name ); | ||
264 | |||
265 | try | ||
266 | { | ||
267 | var color1 = jObj.color1, | ||
268 | color2 = jObj.color2, | ||
269 | color3 = jObj.color3, | ||
270 | color4 = jObj.color4, | ||
271 | colorStop1 = jObj.colorStop1, | ||
272 | colorStop2 = jObj.colorStop2, | ||
273 | colorStop3 = jObj.colorStop3, | ||
274 | colorStop4 = jObj.colorStop4; | ||
275 | |||
276 | this.setProperty( "color1", color1 ); | ||
277 | this.setProperty( "color2", color2 ); | ||
278 | this.setProperty( "color3", color3 ); | ||
279 | this.setProperty( "color4", color4 ); | ||
280 | this.setProperty( "colorStop1", colorStop1 ); | ||
281 | this.setProperty( "colorStop2", colorStop2 ); | ||
282 | this.setProperty( "colorStop3", colorStop3 ); | ||
283 | this.setProperty( "colorStop4", colorStop4 ); | ||
284 | } | ||
285 | catch (e) | ||
286 | { | ||
287 | throw new Error( "could not import material: " + importStr ); | ||
288 | } | ||
289 | }; | ||
290 | |||
239 | this.export = function() { | 291 | this.export = function() { |
240 | // every material needs the base type and instance name | 292 | // every material needs the base type and instance name |
241 | var exportStr = "material: " + this.getShaderName() + "\n"; | 293 | var exportStr = "material: " + this.getShaderName() + "\n"; |