/*
This file contains proprietary software owned by Motorola Mobility, Inc.
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
*/
var MaterialsModel = require("js/models/materials-model").MaterialsModel;
var FlatMaterial = require("js/lib/rdge/materials/flat-material").FlatMaterial;
var LinearGradientMaterial = require("js/lib/rdge/materials/linear-gradient-material").LinearGradientMaterial;
var RadialGradientMaterial = require("js/lib/rdge/materials/radial-gradient-material").RadialGradientMaterial;
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 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;
var ReliefTunnelMaterial = require("js/lib/rdge/materials/relief-tunnel-material").ReliefTunnelMaterial;
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 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;
var TwistMaterial = require("js/lib/rdge/materials/twist-material").TwistMaterial;
var JuliaMaterial = require("js/lib/rdge/materials/julia-material").JuliaMaterial;
var KeleidoscopeMaterial = require("js/lib/rdge/materials/keleidoscope-material").KeleidoscopeMaterial;
var MandelMaterial = require("js/lib/rdge/materials/mandel-material").MandelMaterial;
///////////////////////////////////////////////////////////////////////
// Class GLGeomObj
// Super class for all geometry classes
///////////////////////////////////////////////////////////////////////
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_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
///////////////////////////////////////////////////////////////////////
this._matrix = Matrix.I(4);
this._next = undefined;
this._prev = undefined;
this._child = undefined;
this._parent = undefined;
this.m_world = null;
// stroke and fill colors
this._strokeColor = [0,0,0,0];
this._fillColor = [0,0,0,0];
// stroke and fill materials
this._fillMaterial = null;
this._strokeMaterial = null;
// array of primitives - used in RDGE
this._primArray = [];
this._materialNodeArray = [];
this._materialArray = [];
this._materialTypeArray = [];
// the transform node used by RDGE
this._trNode = null;
///////////////////////////////////////////////////////////////////////
// Property accessors
///////////////////////////////////////////////////////////////////////
this.setWorld = function( world ) {
this.m_world = world;
};
this.getWorld = function() {
return this.m_world;
};
this.getMatrix = function() {
return this._matrix.slice(0);
};
this.setMatrix = function(m) {
this._matrix = m.slice(0);
};
this.setNext = function( next ) {
this._next = next;
};
this.getNext = function() {
return this._next;
};
this.setPrev = function( prev ) {
this._prev = prev;
};
this.getPrev = function() {
return this._prev;
};
this.setChild = function( child ) {
this._child = child;
};
this.getChild = function() {
return this._child;
};
this.setParent = function( parent ) {
this._parent = parent;
};
this.getParent = function() {
return this._parent;
};
this.geomType = function() {
return this.GEOM_TYPE_UNDEFINED;
};
this.getPrimitiveArray = function() { return this._primArray;
};
this.getMaterialNodeArray = function() {
return this._materialNodeArray;
};
this.getMaterialArray = function() { return this._materialArray;
};
this.getTransformNode = function() {
return this._trNode;
};
this.setTransformNode = function(t) {
this._trNode = t;
};
this.setFillColor = function(c) {
this.setMaterialColor(c, "fill");
};
this.setStrokeColor = function(c) {
this.setMaterialColor(c, "stroke");
};
///////////////////////////////////////////////////////////////////////
// Methods
///////////////////////////////////////////////////////////////////////
this.setMaterialColor = function(c, type) {
if (type == "fill") {
this._fillColor = c.slice(0);
} else {
this._strokeColor = c.slice(0);
}
if (this._materialArray && this._materialTypeArray) {
var nMats = this._materialArray.length;
if (nMats === this._materialTypeArray.length) {
for (var i=0; i= 0) {
rtnStr = rtnStr.substr(0, index);
}
return rtnStr;
};
/*
this.export = function() {
var rtnStr;
return rtnStr;
}
*/
};
if (typeof exports === "object") {
exports.GeomObj = GeomObj;
}