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/geom-obj.js | 442 ++++++++++++++++++++---------------------------- 1 file changed, 181 insertions(+), 261 deletions(-) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index f1aa9f8a..bb5b4a9a 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -14,19 +14,19 @@ var GeomObj = function GLGeomObj() { /////////////////////////////////////////////////////////////////////// // Constants /////////////////////////////////////////////////////////////////////// - this.GEOM_TYPE_RECTANGLE = 1; - this.GEOM_TYPE_CIRCLE = 2; - this.GEOM_TYPE_LINE = 3; - this.GEOM_TYPE_PATH = 4; - this.GEOM_TYPE_CUBIC_BEZIER = 5; - this.GEOM_TYPE_BRUSH_STROKE = 6; - this.GEOM_TYPE_UNDEFINED = -1; + this.GEOM_TYPE_RECTANGLE = 1; + this.GEOM_TYPE_CIRCLE = 2; + this.GEOM_TYPE_LINE = 3; + this.GEOM_TYPE_PATH = 4; + this.GEOM_TYPE_CUBIC_BEZIER = 5; + this.GEOM_TYPE_BRUSH_STROKE = 6; + this.GEOM_TYPE_UNDEFINED = -1; // Needed for calculating dashed/dotted strokes this.DASH_LENGTH = 0.15; this.DOT_LENGTH = 0.05; this.GAP_LENGTH = 0.05; - + /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// @@ -40,109 +40,111 @@ var GeomObj = function GLGeomObj() { this.m_world = null; // stroke and fill colors - this._strokeColor = [0,0,0,0]; - this._fillColor = [0,0,0,0]; + this._strokeColor = [0, 0, 0, 0]; + this._fillColor = [0, 0, 0, 0]; - // stroke and fill materials - this._fillMaterial = null; - this._strokeMaterial = null; + // stroke and fill materials + this._fillMaterial = null; + this._strokeMaterial = null; - // array of primitives - used in RDGE - this._primArray = []; - this._materialNodeArray = []; - this._materialArray = []; - this._materialTypeArray = []; + // array of primitives - used in RDGE + this._primArray = []; + this._materialNodeArray = []; + this._materialArray = []; + this._materialTypeArray = []; - // the transform node used by RDGE - this._trNode = null; + // the transform node used by RDGE + this._trNode = null; /////////////////////////////////////////////////////////////////////// // Property accessors /////////////////////////////////////////////////////////////////////// - this.setWorld = function( world ) { + this.setWorld = function (world) { this.m_world = world; }; - this.getWorld = function() { + this.getWorld = function () { return this.m_world; }; - this.getMatrix = function() { + this.getMatrix = function () { return this._matrix.slice(0); }; - this.setMatrix = function(m) { + this.setMatrix = function (m) { this._matrix = m.slice(0); }; - this.setNext = function( next ) { + this.setNext = function (next) { this._next = next; }; - this.getNext = function() { + this.getNext = function () { return this._next; }; - this.setPrev = function( prev ) { + this.setPrev = function (prev) { this._prev = prev; }; - this.getPrev = function() { + this.getPrev = function () { return this._prev; }; - this.setChild = function( child ) { + this.setChild = function (child) { this._child = child; }; - this.getChild = function() { + this.getChild = function () { return this._child; }; - this.setParent = function( parent ) { + this.setParent = function (parent) { this._parent = parent; }; - this.getParent = function() { + this.getParent = function () { return this._parent; }; - this.geomType = function() { + this.geomType = function () { return this.GEOM_TYPE_UNDEFINED; }; - this.getPrimitiveArray = function() { return this._primArray; + this.getPrimitiveArray = function () { + return this._primArray; }; - this.getMaterialNodeArray = function() { + this.getMaterialNodeArray = function () { return this._materialNodeArray; }; - this.getMaterialArray = function() { return this._materialArray; + this.getMaterialArray = function () { + return this._materialArray; }; - this.getTransformNode = function() { + this.getTransformNode = function () { return this._trNode; }; - this.setTransformNode = function(t) { + this.setTransformNode = function (t) { this._trNode = t; }; - this.setFillColor = function(c) { + this.setFillColor = function (c) { this.setMaterialColor(c, "fill"); }; - this.setStrokeColor = function(c) { + this.setStrokeColor = function (c) { this.setMaterialColor(c, "stroke"); }; /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - this.setMaterialColor = function(c, type) { + this.setMaterialColor = function (c, type) { var i = 0, nMats = 0; - if(c.gradientMode) { + if (c.gradientMode) { // Gradient support if (this._materialArray && this._materialTypeArray) { nMats = this._materialArray.length; @@ -153,21 +155,21 @@ var GeomObj = function GLGeomObj() { var len = colors.length; // TODO - Current shaders only support 4 color stops - if(len > 4) { + if (len > 4) { len = 4; } - for(var n=0; n 0) - { - var arr = []; + this.exportMaterialsJSON = function () { + var jObj; + if (this._materialArray && this._materialNodeArray && this.getWorld().isWebGL()) { + var nMats = this._materialArray.length; + if (nMats > 0) { + var arr = []; - for (var i=0; i= 0) { - rtnStr = rtnStr.substr(0, index); + var rtnStr = str.substr(index + prop.length); + index = rtnStr.indexOf("\n"); + if (index >= 0) { + rtnStr = rtnStr.substr(0, index); } - return rtnStr; - }; + return rtnStr; + }; // Gradient stops for rgba(255,0,0,1) at 0%; rgba(0,255,0,1) at 33%; rgba(0,0,255,1) at 100% will return // 255,0,0,1@0;0,255,0,1@33;0,0,255,1@100 - this.gradientToString = function(colors) { + this.gradientToString = function (colors) { var rtnStr = ""; - if(colors && colors.length) { - var c = colors[0], + if (colors && colors.length) { + var c = colors[0], len = colors.length; rtnStr += String(c.value.r + "," + c.value.g + "," + c.value.b + "," + c.value.a + "@" + c.position); - for(var i=1; i