aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/linear-gradient-material.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-04-02 16:28:39 -0700
committerJohn Mayhew2012-04-02 16:28:39 -0700
commitb4155fb4c33675a8a7cd37473513718043fdf0ba (patch)
tree3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/lib/rdge/materials/linear-gradient-material.js
parent5ba9aeac94c86049423fd5d4b37b277263939c13 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts: js/helper-classes/RDGE/rdge-compiled.js js/helper-classes/RDGE/runtime/GLRuntime.js js/helper-classes/RDGE/src/core/script/MeshManager.js js/helper-classes/RDGE/src/core/script/engine.js js/helper-classes/RDGE/src/core/script/fx/ssao.js js/helper-classes/RDGE/src/core/script/init_state.js js/helper-classes/RDGE/src/core/script/run_state.js js/helper-classes/RDGE/src/core/script/scenegraphNodes.js js/helper-classes/RDGE/src/core/script/utilities.js js/helper-classes/RDGE/src/tools/compile-rdge-core.bat js/helper-classes/RDGE/src/tools/compile-rdge-core.sh js/helper-classes/RDGE/src/tools/rdge-compiled.js js/lib/drawing/world.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/deform-material.js js/lib/rdge/materials/flat-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/linear-gradient-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-blur-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/relief-tunnel-material.js js/lib/rdge/materials/square-tunnel-material.js js/lib/rdge/materials/star-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/tunnel-material.js js/lib/rdge/materials/twist-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/uber-material.js js/lib/rdge/materials/water-material.js js/lib/rdge/materials/z-invert-material.js js/preloader/Preloader.js
Diffstat (limited to 'js/lib/rdge/materials/linear-gradient-material.js')
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js55
1 files changed, 54 insertions, 1 deletions
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js
index d9307274..efeabf95 100755
--- a/js/lib/rdge/materials/linear-gradient-material.js
+++ b/js/lib/rdge/materials/linear-gradient-material.js
@@ -212,7 +212,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
212 this._shader.init(); 212 this._shader.init();
213 213
214 // set up the material node 214 // set up the material node
215 this._materialNode = RDGE.createMaterialNode(this.getShaderName()); 215 this._materialNode = RDGE.createMaterialNode(this.getShaderName() + "_" + world.generateUniqueNodeID());
216 this._materialNode.setShader(this._shader); 216 this._materialNode.setShader(this._shader);
217 217
218 // send the current values to the shader 218 // send the current values to the shader
@@ -249,6 +249,59 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
249 } 249 }
250 }; 250 };
251 251
252 this.exportJSON = function()
253 {
254 var jObj =
255 {
256 'material' : this.getShaderName(),
257 'name' : this.getName(),
258 'color1' : this.getColor1(),
259 'color2' : this.getColor2(),
260 'color3' : this.getColor3(),
261 'color4' : this.getColor4(),
262 'colorStop1' : this.getColorStop1(),
263 'colorStop2' : this.getColorStop2(),
264 'colorStop3' : this.getColorStop3(),
265 'colorStop4' : this.getColorStop4(),
266 'angle' : this.getAngle()
267 };
268
269 return jObj;
270 };
271
272 this.importJSON = function( jObj )
273 {
274 if (this.getShaderName() != jObj.material) throw new Error( "ill-formed material" );
275 this.setName( jObj.name );
276
277 try
278 {
279 var color1 = jObj.color1,
280 color2 = jObj.color2,
281 color3 = jObj.color3,
282 color4 = jObj.color4,
283 colorStop1 = jObj.colorStop1,
284 colorStop2 = jObj.colorStop2,
285 colorStop3 = jObj.colorStop3,
286 colorStop4 = jObj.colorStop4,
287 angle = jObj.angle;
288
289 this.setProperty( "color1", color1 );
290 this.setProperty( "color2", color2 );
291 this.setProperty( "color3", color3 );
292 this.setProperty( "color4", color4 );
293 this.setProperty( "colorStop1", colorStop1 );
294 this.setProperty( "colorStop2", colorStop2 );
295 this.setProperty( "colorStop3", colorStop3 );
296 this.setProperty( "colorStop4", colorStop4 );
297 this.setProperty( "angle", angle );
298 }
299 catch (e)
300 {
301 throw new Error( "could not import material: " + importStr );
302 }
303 };
304
252 this.export = function() { 305 this.export = function() {
253 // every material needs the base type and instance name 306 // every material needs the base type and instance name
254 var exportStr = "material: " + this.getShaderName() + "\n"; 307 var exportStr = "material: " + this.getShaderName() + "\n";