From 3a8875c288049b466bfeb8b7f0510fd8cbfb970d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 13:30:08 -0800 Subject: Supporting switching materials in the PI. Also, moved makeFillMaterial and makeStrokeMaterial functions into GLGeomObj so shapes other than GLRectangle can use these routines. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/RDGE/GLLine.js | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'js/helper-classes/RDGE/GLLine.js') diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js index 9eaa69d1..bd3cbc26 100644 --- a/js/helper-classes/RDGE/GLLine.js +++ b/js/helper-classes/RDGE/GLLine.js @@ -27,12 +27,6 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro this._strokeWidth = 0.25; - // stroke colors - this._strokeColor = [0.4, 0.4, 0.4, 1.0]; - - // stroke materials - this._strokeMaterial; - this._strokeStyle = "Solid"; if (arguments.length > 0) @@ -267,26 +261,11 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro } var prim = ShapePrimitive.create(strokeVertices, strokeNormals, strokeTextures, indices, g_Engine.getContext().renderer.TRIANGLES, indices.length); - this._primArray.push( prim ); - var strokeMaterial; - if (this.getStrokeMaterial()) - strokeMaterial = this.getStrokeMaterial().dup(); - else - strokeMaterial = new FlatMaterial(); + var strokeMaterial = this.makeStrokeMaterial(); - if (strokeMaterial) - { - strokeMaterial.init( this.getWorld() ); - if(!this.getStrokeMaterial() && this._strokeColor) - { - strokeMaterial.setProperty("color", this._strokeColor); - } - } - - this._materialArray.push( strokeMaterial ); - this._materialTypeArray.push( "stroke" ); - this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); + this._primArray.push( prim ); + this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); world.updateObject(this); } -- cgit v1.2.3