From fdeed8051c3af538d28ca3bc599121cea483c22c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 22 Mar 2012 15:47:56 -0700 Subject: Squashed commit of the following GL integration Signed-off-by: Valerio Virgillito --- js/models/materials-model.js | 90 ++++++++++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 24 deletions(-) (limited to 'js/models') diff --git a/js/models/materials-model.js b/js/models/materials-model.js index d8fb4016..692ac09a 100755 --- a/js/models/materials-model.js +++ b/js/models/materials-model.js @@ -17,6 +17,7 @@ var RadialGradientMaterial = require("js/lib/rdge/materials/radial-gradient-mate var BumpMetalMaterial = require("js/lib/rdge/materials/bump-metal-material").BumpMetalMaterial; var UberMaterial = require("js/lib/rdge/materials/uber-material").UberMaterial; var RadialBlurMaterial = require("js/lib/rdge/materials/radial-blur-material").RadialBlurMaterial; +var RaidersMaterial = require("js/lib/rdge/materials/radial-blur-material").RaidersMaterial; var PlasmaMaterial = require("js/lib/rdge/materials/plasma-material").PlasmaMaterial; var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; var TunnelMaterial = require("js/lib/rdge/materials/tunnel-material").TunnelMaterial; @@ -24,6 +25,7 @@ var ReliefTunnelMaterial = require("js/lib/rdge/materials/relief-tunnel-material var SquareTunnelMaterial = require("js/lib/rdge/materials/square-tunnel-material").SquareTunnelMaterial; var FlyMaterial = require("js/lib/rdge/materials/fly-material").FlyMaterial; var WaterMaterial = require("js/lib/rdge/materials/water-material").WaterMaterial; +var ParisMaterial = require("js/lib/rdge/materials/water-material").ParisMaterial; var ZInvertMaterial = require("js/lib/rdge/materials/z-invert-material").ZInvertMaterial; var DeformMaterial = require("js/lib/rdge/materials/deform-material").DeformMaterial; var StarMaterial = require("js/lib/rdge/materials/star-material").StarMaterial; @@ -48,6 +50,7 @@ exports.MaterialsModel = Montage.create(Component, { this.addMaterial(new BumpMetalMaterial()); this.addMaterial(new UberMaterial()); this.addMaterial(new RadialBlurMaterial()); + this.addMaterial(new RaidersMaterial()); this.addMaterial(new PlasmaMaterial()); this.addMaterial(new PulseMaterial()); this.addMaterial(new TunnelMaterial()); @@ -55,6 +58,7 @@ exports.MaterialsModel = Montage.create(Component, { this.addMaterial(new SquareTunnelMaterial()); this.addMaterial(new FlyMaterial()); this.addMaterial(new WaterMaterial()); + this.addMaterial(new ParisMaterial()); this.addMaterial(new ZInvertMaterial()); this.addMaterial(new DeformMaterial()); this.addMaterial(new StarMaterial()); @@ -112,10 +116,34 @@ exports.MaterialsModel = Montage.create(Component, { value: function (materialName) { var index = this.getIndexOfMaterial(materialName); if(index !== -1) { - return this._materials[index]; + return this._materials[index].dup(); } } - }, + }, + + getMaterialByShader: + { + value: function( shaderName ) + { + var index = this.getIndexOfMaterialByShader( shaderName ); + if (index >= 0) + return this._materials[index].dup(); + } + }, + + getIndexOfMaterialByShader: { + value: function (shaderName) { + var len = this._materials.length; + for(var i=0; i