aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom
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
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')
-rwxr-xr-xjs/lib/geom/brush-stroke.js2
-rwxr-xr-xjs/lib/geom/circle.js1433
-rwxr-xr-xjs/lib/geom/geom-obj.js897
-rwxr-xr-xjs/lib/geom/line.js914
-rwxr-xr-xjs/lib/geom/rectangle.js1407
-rwxr-xr-xjs/lib/geom/sub-path.js2
6 files changed, 2410 insertions, 2245 deletions
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index 1fae0c1d..6facdd5d 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -768,7 +768,7 @@ var BrushStroke = function GLBrushStroke() {
768 768
769}; //function BrushStroke ...class definition 769}; //function BrushStroke ...class definition
770 770
771BrushStroke.prototype = new GeomObj(); 771BrushStroke.prototype = Object.create(GeomObj, {});
772 772
773BrushStroke.prototype._CatmullRomSplineInterpolate = function(ctrlPts, t) 773BrushStroke.prototype._CatmullRomSplineInterpolate = function(ctrlPts, t)
774{ 774{
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 0f1f49a9..425b869a 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -4,9 +4,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var GeomObj = require("js/lib/geom/geom-obj").GeomObj; 7var GeomObj = require("js/lib/geom/geom-obj").GeomObj;
8var ShapePrimitive = require("js/lib/geom/shape-primitive").ShapePrimitive; 8var ShapePrimitive = require("js/lib/geom/shape-primitive").ShapePrimitive;
9var MaterialsModel = require("js/models/materials-model").MaterialsModel; 9var MaterialsModel = require("js/models/materials-model").MaterialsModel;
10var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; 10var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils;
11var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; 11var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
12 12
@@ -16,744 +16,790 @@ var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
16// Derived from class GLGeomObj 16// Derived from class GLGeomObj
17// The position and dimensions of the stroke, fill, and inner Radius should be in pixels 17// The position and dimensions of the stroke, fill, and inner Radius should be in pixels
18/////////////////////////////////////////////////////////////////////// 18///////////////////////////////////////////////////////////////////////
19var Circle = function GLCircle() { 19exports.Circle = Object.create(GeomObj, {
20 20
21 this.init = function( world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) { 21 ///////////////////////////////////////////////////////////////////////
22 /////////////////////////////////////////////////////////////////////// 22 // Instance variables
23 // Instance variables 23 ///////////////////////////////////////////////////////////////////////
24 /////////////////////////////////////////////////////////////////////// 24 _width: { value : 2.0, writable: true },
25 this._width = 2.0; 25 _height: { value : 2.0, writable: true },
26 this._height = 2.0; 26 _xOffset: { value : 0, writable: true },
27 this._xOffset = 0; 27 _yOffset: { value : 0, writable: true },
28 this._yOffset = 0; 28
29 29 _radius: { value : 2.0, writable: true },
30 this._radius = 2.0; 30 _strokeWidth: { value : 0.25, writable: true },
31 this._strokeWidth = 0.25; 31 _innerRadius: { value : 0, writable: true },
32 this._innerRadius = 0; 32 _ovalHeight: { value : 4.0, writable: true },
33 33 _strokeStyle: { value : "Solid", writable: true },
34 this._ovalHeight = this._ovalHeight = 2.0 * this._radius; 34 _aspectRatio: { value : 1.0, writable: true },
35 35
36 this._strokeStyle = "Solid"; 36 init: {
37 37 value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) {
38 this._aspectRatio = 1.0; 38 if(arguments.length > 0) {
39 39 this._width = width;
40 if (arguments.length > 0) { 40 this._height = height;
41 this._width = width; 41 this._xOffset = xOffset;
42 this._height = height; 42 this._yOffset = yOffset;
43 this._xOffset = xOffset; 43 this._ovalHeight = 2.0 * this._radius;
44 this._yOffset = yOffset; 44
45 45 this._strokeWidth = strokeSize;
46 this._strokeWidth = strokeSize; 46 this._innerRadius = innerRadius;
47 this._innerRadius = innerRadius; 47 this._strokeColor = strokeColor;
48 this._strokeColor = strokeColor; 48 this._fillColor = fillColor;
49 this._fillColor = fillColor; 49
50 50 this._strokeStyle = strokeStyle;
51 this._strokeStyle = strokeStyle; 51
52 52 this._matrix = Matrix.I(4);
53 this._matrix = Matrix.I(4); 53 //this._matrix[12] = xOffset;
54 //this._matrix[12] = xOffset; 54 //this._matrix[13] = yOffset;
55 //this._matrix[13] = yOffset; 55 }
56 } 56
57 57 this.m_world = world;
58 this.m_world = world;
59
60 if(strokeMaterial){
61 this._strokeMaterial = strokeMaterial;
62 } else {
63 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
64 }
65 58
66 if(fillMaterial) { 59 if(strokeMaterial) {
67 this._fillMaterial = fillMaterial; 60 this._strokeMaterial = strokeMaterial;
68 } else { 61 } else {
69 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); 62 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
63 }
64
65 if(fillMaterial) {
66 this._fillMaterial = fillMaterial;
67 } else {
68 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
69 }
70 } 70 }
71 }; 71 },
72 72
73 /////////////////////////////////////////////////////////////////////// 73 ///////////////////////////////////////////////////////////////////////
74 // Property Accessors 74 // Property Accessors
75 /////////////////////////////////////////////////////////////////////// 75 ///////////////////////////////////////////////////////////////////////
76 this.getStrokeWidth = function() { 76 // TODO - Use getters/setters in the future
77 return this._strokeWidth; 77 getStrokeWidth: {
78 }; 78 value: function() {
79 79 return this._strokeWidth;
80 this.setStrokeWidth = function(w) { 80 }
81 this._strokeWidth = w; 81 },
82 };
83
84 this.getStrokeMaterial = function() {
85 return this._strokeMaterial;
86 };
87 82
88 this.setStrokeMaterial = function(m) { 83 setStrokeWidth: {
89 this._strokeMaterial = m; 84 value: function(w) {
90 }; 85 this._strokeWidth = w;
86 }
87 },
91 88
92 this.getFillMaterial = function() { 89 getStrokeMaterial: {
93 return this._fillMaterial; 90 value: function() {
94 }; 91 return this._strokeMaterial;
92 }
93 },
95 94
96 this.setFillMaterial = function(m) { 95 setStrokeMaterial: {
97 this._fillMaterial = m; 96 value: function(m) {
98 }; 97 this._strokeMaterial = m;
98 }
99 },
99 100
100 this.getRadius = function() { 101 getFillMaterial: {
101 return this._radius; 102 value: function() {
102 }; 103 return this._fillMaterial;
104 }
105 },
103 106
104 this.setRadius = function(r) { 107 setFillMaterial: {
105 this._radius = r; 108 value: function(m) {
106 }; 109 this._fillMaterial = m;
110 }
111 },
107 112
108 this.getWorld = function() { 113 getRadius: {
109 return this._world; 114 value: function() {
110 }; 115 return this._radius;
116 }
117 },
111 118
112 this.setWorld = function(w) { 119 setRadius: {
113 this._world = w; 120 value: function(r) {
114 }; 121 this._radius = r;
122 }
123 },
115 124
116 this.getInnerRadius = function() { 125 getInnerRadius: {
117 return this._innerRadius; 126 value: function() {
118 }; 127 return this._innerRadius;
128 }
129 },
119 130
120 this.setInnerRadius = function(r) { 131 setInnerRadius: {
121 this._innerRadius = r; 132 value: function(r) {
122 }; 133 this._innerRadius = r;
134 }
135 },
123 136
124 this.getStrokeStyle = function() { 137 getStrokeStyle: {
125 return this._strokeStyle; 138 value: function() {
126 }; 139 return this._strokeStyle;
127 this.setStrokeStyle = function(s) { 140 }
128 this._strokeStyle = s; 141 },
129 };
130 142
131 this.getWidth = function() { 143 setStrokeStyle: {
132 return this._width; 144 value: function(s) {
133 }; 145 this._strokeStyle = s;
146 }
147 },
134 148
135 this.setWidth = function(w) { 149 getWidth: {
136 this._width = w; 150 value: function() {
137 };