aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/geom-obj.js
diff options
context:
space:
mode:
authorhwc4872012-05-11 13:52:55 -0700
committerhwc4872012-05-11 13:52:55 -0700
commit137bfc9d4c41cc918d969565bec28a834fe10472 (patch)
treee9fa109fc65218f45e386df48b713ff5858f3d62 /js/lib/geom/geom-obj.js
parentd21aaca3d7093b6af968b7f9f764ab54e004f02b (diff)
parent27f4cacb39de1c2e3910748dadc9fc16d0655480 (diff)
downloadninja-137bfc9d4c41cc918d969565bec28a834fe10472.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts: js/lib/geom/geom-obj.js js/lib/geom/rectangle.js js/tools/TagTool.js
Diffstat (limited to 'js/lib/geom/geom-obj.js')
-rwxr-xr-xjs/lib/geom/geom-obj.js897
1 files changed, 478 insertions, 419 deletions
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index 4efa5d60..803dbb53 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -10,551 +10,615 @@ var MaterialsModel = require("js/models/materials-model").MaterialsModel;
10// Class GLGeomObj 10// Class GLGeomObj
11// Super class for all geometry classes 11// Super class for all geometry classes
12/////////////////////////////////////////////////////////////////////// 12///////////////////////////////////////////////////////////////////////
13var GeomObj = function GLGeomObj() 13exports.GeomObj = Object.create(Object.prototype, {
14{ 14{
15 /////////////////////////////////////////////////////////////////////// 15 ///////////////////////////////////////////////////////////////////////
16 // Constants 16 // Constants
17 /////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////
18 this.GEOM_TYPE_RECTANGLE = 1; 18 // TODO - Is there a way to make these static constants?
19 this.GEOM_TYPE_CIRCLE = 2; 19 GEOM_TYPE_RECTANGLE: { value : 1, writable: false },
20 this.GEOM_TYPE_LINE = 3; 20 GEOM_TYPE_CIRCLE: { value : 2, writable: false },
21 this.GEOM_TYPE_PATH = 4; 21 GEOM_TYPE_LINE: { value : 3, writable: false },
22 this.GEOM_TYPE_CUBIC_BEZIER = 5; 22 GEOM_TYPE_PATH: { value : 4, writable: false },
23 this.GEOM_TYPE_BRUSH_STROKE = 6; 23 GEOM_TYPE_CUBIC_BEZIER: { value : 5, writable: false },
24 this.GEOM_TYPE_UNDEFINED = -1; 24 GEOM_TYPE_BRUSH_STROKE: { value : 6, writable: false },
25 25 GEOM_TYPE_UNDEFINED: { value : -1, writable: false },
26 // Needed for calculating dashed/dotted strokes
27 this.DASH_LENGTH = 0.15;
28 this.DOT_LENGTH = 0.05;
29 this.GAP_LENGTH = 0.05;
30 26
31 /////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////
32 // Instance variables 28 // Instance variables
33 /////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////
34 this._matrix = Matrix.I(4); 30 _matrix: { value : Matrix.I(4), writable: true },
35 31
36 this._next = undefined; 32 _next: { value : undefined, writable: true },
37 this._prev = undefined; 33 _prev: { value : undefined, writable: true },
38 this._child = undefined; 34 _child: { value : undefined, writable: true },
39 this._parent = undefined; 35 _parent: { value : undefined, writable: true },
40 36
41 this.m_world = null; 37 m_world: { value : null, writable: true },
42 38
43 // stroke and fill colors 39 // stroke and fill colors
44 this._strokeColor = [0, 0, 0, 0]; 40 _strokeColor: { value : [0, 0, 0, 0], writable: true },
45 this._fillColor = [0, 0, 0, 0]; 41 _fillColor: { value : [0, 0, 0, 0], writable: true },
46 42
47 // stroke and fill materials 43 // stroke and fill materials
48 this._fillMaterial = null; 44 _fillMaterial: { value : null, writable: true },
49 this._strokeMaterial = null; 45 _strokeMaterial: { value : null, writable: true },
50 46
51 // Shapes (such as lines) that don't support fill should set this to false 47 // Shapes (such as lines) that don't support fill should set this to false
52 this.canFill = true; 48 canFill: { value : true, writable: true },
53 49
54 // array of primitives - used in RDGE 50 // array of primitives - used in RDGE
55 this._primArray = []; 51 _primArray: { value : [], writable: true },
56 this._materialNodeArray = []; 52 _materialNodeArray: { value : [], writable: true },
57 this._materialArray = []; 53 _materialArray: { value : [], writable: true },
58 this._materialTypeArray = []; 54 _materialTypeArray: { value : [], writable: true },
59 55
60 // the transform node used by RDGE 56 // the transform node used by RDGE
61 this._trNode = null; 57 _trNode: { value : null, writable: true },
62 58
63 /////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////
64 // Property accessors 60 // Property accessors
65 /////////////////////////////////////////////////////////////////////// 61 ///////////////////////////////////////////////////////////////////////
66 this.setWorld = function (world) { 62 getWorld: {
67 this.m_world = world; 63 value: function() {
68 }; 64 return this.m_world;
69 65 }
70 this.getWorld = function () { 66 },
71 return this.m_world;
72 };
73 67
74 this.getMatrix = function () { 68 setWorld: {
75 return this._matrix.slice(0); 69 value: function(world) {
76 }; 70 this.m_world = world;
71 }
72 },
77 73
78 this.setMatrix = function (m) { 74 getMatrix: {
79 this._matrix = m.slice(0); 75 value: function() {
80 }; 76 return this._matrix.slice(0);
77 }
78 },
81 79
82 this.setNext = function (next) { 80 setMatrix: {
83 this._next = next; 81 value: function(m) {
84 }; 82 this._matrix = m.slice(0);
83 }
84 },
85 85
86 this.getNext = function () { 86 getNext: {
87 return this._next; 87 value: function() {
88 }; 88 return this._next;
89 }
90 },
89 91
90 this.setPrev = function (prev) { 92 setNext: {
91 this._prev = prev; 93 value: function(next) {
92 }; 94 this._next = next;
95 }
96 },
93 97
94 this.getPrev = function () { 98 getPrev: {
95 return this._prev; 99 value: function() {
96 }; 100 return this._prev;
101 }
102 },
97 103
98 this.setChild = function (child) { 104 setPrev: {
99 this._child = child; 105 value: function(prev) {
100 }; 106 this._prev = prev;
107 }
108 },
101 109
102 this.getChild = function () { 110 getChild: {
103 return this._child; 111 value: function() {
104 }; 112 return this._child;
113 }
114 },
105 115
106 this.setParent = function (parent) { 116 setChild: {
107 this._parent = parent; 117 value: function(child) {
108 }; 118 this._child = child;
119 }
120 },
109 121
110 this.getParent = function () { 122 getParent: {
111 return this._parent; 123 value: function() {
112 }; 124 return this._parent;
125 }
126 },
113 127
114 this.geomType = function () { 128 setParent: {
115 return this.GEOM_TYPE_UNDEFINED; 129 value: function(parent) {
116 }; 130 this._parent = parent;
131 }
132 },
117 133
118 this.getPrimitiveArray = function () { 134 geomType: {
119 return this._primArray; 135 value: function() {
120 }; 136 return this.GEOM_TYPE_UNDEFINED;
137 }
138 },
121 139
122 this.getMaterialNodeArray = function () { 140 getPrimitiveArray: {
123 return this._materialNodeArray; 141 value: function() {
124 }; 142 return this._primArray;
143 }
144 },
125 145
126 this.getMaterialArray = function () { 146 getMaterialNodeArray: {
127 return this._materialArray; 147 value: function() {
128 }; 148 return this._materialNodeArray;
149 }
150 },
129 151
130 this.getTransformNode = function () { 152 getMaterialArray: {
131 return this._trNode; 153 value: function() {
132 }; 154 return this._materialArray;
155 }
156 },
133 157
134 this.setTransformNode = function (t) { 158 getTransformNode: {
135 this._trNode = t; 159 value: function() {
136 }; 160 return this._trNode;
161 }
162 },
137 163
138 this.setFillColor = function (c) { 164 setTransformNode: {
139 this.setMaterialColor(c, "fill"); 165 value: function(t) {
140 }; 166 this._trNode = t;
167 }
168 },
141