From 5b4f6b1618cf571a6bce5a631f976a008e04a64e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 29 Mar 2012 15:52:08 -0700 Subject: Updated shapes to always check for its stroke and fill colors and materials instead of relying on the shapeModel cache because it can get out of sync. Signed-off-by: Nivesh Rajbhandari --- js/lib/geom/rectangle.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'js/lib/geom/rectangle.js') diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index e511d5f4..b01aea53 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js @@ -290,6 +290,21 @@ var Rectangle = function GLRectangle() { this._strokeStyle = jObj.strokeStyle; var strokeMaterialName = jObj.strokeMat; var fillMaterialName = jObj.fillMat; + + var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); + if (!strokeMat) { + console.log( "object material not found in library: " + strokeMaterialName ); + strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); + } + this._strokeMaterial = strokeMat; + + var fillMat = MaterialsModel.getMaterial( fillMaterialName ); + if (!fillMat) { + console.log( "object material not found in library: " + fillMaterialName ); + fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); + } + this._fillMaterial = fillMat; + this.importMaterialsJSON( jObj.materials ); }; -- cgit v1.2.3 From fb0a659c9ca3479fd6799325498b11f074689936 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Mon, 2 Apr 2012 14:57:31 -0700 Subject: -Namespaced all RDGE javascript. -Removed the following unused files from the build script /core/script/fx/blur.js /core/script/fx/ssao.js /core/script/animation.js - Fully removed the following from the build and from source control as they are unused or no longer needed /core/script/util/dbgpanel.js /core/script/util/fpsTracker.js /core/script/util/statTracker.js /core/script/input.js /core/script/TextureManager.js /core/script/ubershader.js --- js/lib/geom/rectangle.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/lib/geom/rectangle.js') diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index 81b385b3..98621a98 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js @@ -276,7 +276,7 @@ var Rectangle = function GLRectangle() { if (!world._useWebGL) return; // make sure RDGE has the correct context - g_Engine.setContext( world.getCanvas().rdgeid ); + RDGE.globals.engine.setContext( world.getCanvas().rdgeid ); // create the gl buffer var gl = world.getGLContext(); @@ -826,7 +826,7 @@ RectangleFill.create = function( rectCtr, width, height, tlRad, blRad, brRad, // } // create the RDGE primitive - return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); + return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices); }; RectangleFill.pushVertex = function( x, y, z ) { @@ -1058,7 +1058,7 @@ RectangleStroke.create = function( rectCtr, width, height, strokeWidth, tlRad, // } // create the RDGE primitive - return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); + return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices); }; RectangleStroke.getRoundedCorner = function( ctr, insidePt, outsidePt ) { @@ -1144,7 +1144,7 @@ RectangleGeometry.create = function( ctr, width, height, material ) { // } // create the RDGE primitive - return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); + return ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, RDGE.globals.engine.getContext().renderer.TRIANGLES, nVertices); }; RectangleGeometry.pushVertex = RectangleFill.pushVertex; -- cgit v1.2.3 From 18609d375e7aab9cb48c9b3f5b291f85cbd28683 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 13:39:32 -0700 Subject: removed old unused import and export functions. --- js/lib/geom/rectangle.js | 110 ----------------------------------------------- 1 file changed, 110 deletions(-) (limited to 'js/lib/geom/rectangle.js') diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index 46876ba7..00c40eb9 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js @@ -187,65 +187,6 @@ var Rectangle = function GLRectangle() { /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - /* - this.export = function() { - var rtnStr = "type: " + this.geomType() + "\n"; - - ///////////////////////////////////////////////////////////////////////// - // - // world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, - // tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle - // - ///////////////////////////////////////////////////////////////////////////// - - rtnStr += "xoff: " + this._xOffset + "\n"; - rtnStr += "yoff: " + this._yOffset + "\n"; - rtnStr += "width: " + this._width + "\n"; - rtnStr += "height: " + this._height + "\n"; - rtnStr += "strokeWidth: " + this._strokeWidth + "\n"; - - if(this._strokeColor.gradientMode) { - rtnStr += "strokeGradientMode: " + this._strokeColor.gradientMode + "\n"; - rtnStr += "strokeColor: " + this.gradientToString(this._strokeColor.color) + "\n"; - } else { - rtnStr += "strokeColor: " + String(this._strokeColor) + "\n"; - } - - if(this._fillColor.gradientMode) { - rtnStr += "fillGradientMode: " + this._fillColor.gradientMode + "\n"; - rtnStr += "fillColor: " + this.gradientToString(this._fillColor.color) + "\n"; - } else { - rtnStr += "fillColor: " + String(this._fillColor) + "\n"; - } - rtnStr += "tlRadius: " + this._tlRadius + "\n"; - rtnStr += "trRadius: " + this._trRadius + "\n"; - rtnStr += "blRadius: " + this._blRadius + "\n"; - rtnStr += "brRadius: " + this._brRadius + "\n"; - rtnStr += "innerRadius: " + this._innerRadius + "\n"; - rtnStr += "strokeStyle: " + this._strokeStyle + "\n"; - - rtnStr += "strokeMat: "; - if (this._strokeMaterial) { - rtnStr += this._strokeMaterial.getName(); - } else { - rtnStr += MaterialsModel.getDefaultMaterialName(); - } - rtnStr += "\n"; - - rtnStr += "fillMat: "; - if (this._fillMaterial) { - rtnStr += this._fillMaterial.getName(); - } else { - rtnStr += MaterialsModel.getDefaultMaterialName(); - } - rtnStr += "\n"; - - rtnStr += this.exportMaterials(); - - return rtnStr; - }; - */ - // JSON export this.exportJSON = function() { @@ -293,57 +234,6 @@ var Rectangle = function GLRectangle() { this.importMaterialsJSON( jObj.materials ); }; - this.import = function( importStr ) { - this._xOffset = Number( this.getPropertyFromString( "xoff: ", importStr ) ); - this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) ); - this._width = Number( this.getPropertyFromString( "width: ", importStr ) ); - this._height = Number( this.getPropertyFromString( "height: ", importStr ) ); - this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) ); - this._innerRadius = Number( this.getPropertyFromString( "innerRadius: ", importStr ) ); - this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) ); - var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); - var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr ); - this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr ); - - if(importStr.indexOf("fillGradientMode: ") < 0) { - this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" ); - } else { - this._fillColor = {}; - this._fillColor.gradientMode = this.getPropertyFromString( "fillGradientMode: ", importStr ); - this._fillColor.color = this.stringToGradient(this.getPropertyFromString( "fillColor: ", importStr )); - } - - if(importStr.indexOf("strokeGradientMode: ") < 0) - { - this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); - } else { - this._strokeColor = {}; - this._strokeColor.gradientMode = this.getPropertyFromString( "strokeGradientMode: ", importStr ); - this._strokeColor.color = this.stringToGradient(this.getPropertyFromString( "strokeColor: ", importStr )); - } - - this._tlRadius = Number( this.getPropertyFromString( "tlRadius: ", importStr ) ); - this._trRadius = Number( this.getPropertyFromString( "trRadius: ", importStr ) ); - this._blRadius = Number( this.getPropertyFromString( "blRadius: ", importStr ) ); - this._brRadius = Number( this.getPropertyFromString( "brRadius: ", importStr ) ); - - var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); - if (!strokeMat) { - console.log( "object material not found in library: " + strokeMaterialName ); - strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); - } - this._strokeMaterial = strokeMat; - - var fillMat = MaterialsModel.getMaterial( fillMaterialName ); - if (!fillMat) { - console.log( "object material not found in library: " + fillMaterialName ); - fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); - } - this._fillMaterial = fillMat; - - this.importMaterials( importStr ); - }; - this.buildBuffers = function() { // get the world var world = this.getWorld(); -- cgit v1.2.3