From e065244ac75d1d0f25fd5c75cb58e714a13fe16b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 14 Mar 2012 08:59:17 -0700 Subject: Squashed commit of the following: merge master into timeline Signed-off-by: Jonathan Duran --- .../backup-delete/Materials/FlatMaterial.js | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'js/helper-classes/backup-delete/Materials/FlatMaterial.js') diff --git a/js/helper-classes/backup-delete/Materials/FlatMaterial.js b/js/helper-classes/backup-delete/Materials/FlatMaterial.js index 570e7f9e..eb8970b8 100755 --- a/js/helper-classes/backup-delete/Materials/FlatMaterial.js +++ b/js/helper-classes/backup-delete/Materials/FlatMaterial.js @@ -40,19 +40,27 @@ function FlatMaterial() // duplcate method requirde this.dup = function() { return new FlatMaterial(); } ; - this.init = function() + this.init = function( world ) { - // set up the shader - this._shader = new jshader(); - this._shader.def = flatShaderDef; - this._shader.init(); + // save the world + if (world) + { + this.setWorld( world ); + + // set up the shader + this._shader = new jshader(); + this._shader.def = flatShaderDef; + this._shader.init(); - // set the defaults - this._shader.colorMe.color.set( this.getColor() ); + // set the defaults + this._shader.colorMe.color.set( this.getColor() ); - // set up the material node - this._materialNode = createMaterialNode("flatMaterial"); - this._materialNode.setShader(this._shader); + // set up the material node + this._materialNode = createMaterialNode("flatMaterial_" + world.generateUniqueNodeID() ); + this._materialNode.setShader(this._shader); + } + else + throw new Error( "GLWorld not supplied to material initialization" ); }; @@ -83,11 +91,7 @@ function FlatMaterial() // this function should be overridden by subclasses var exportStr = "material: " + this.getShaderName() + "\n"; exportStr += "name: " + this.getName() + "\n"; - - if (this._shader) - exportStr += "color: " + String(this._shader.colorMe.color) + "\n"; - else - exportStr += "color: " + this.getColor() + "\n"; + exportStr += "color: " + String(this._propValues["color"]) + "\n"; exportStr += "endMaterial\n"; return exportStr; -- cgit v1.2.3