aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorhwc4872012-02-07 14:42:51 -0800
committerhwc4872012-02-07 14:42:51 -0800
commit6173fe8440152b1e4c63834a6b4dc7573d532339 (patch)
treed23449204ae7f23cb9bab09836d126e90c30484b /js/helper-classes
parent2d4da18a778471b02e188ad668752e331ee76127 (diff)
parentaec849d91e4b697d496b9ede28b5d89cf2283781 (diff)
downloadninja-6173fe8440152b1e4c63834a6b4dc7573d532339.tar.gz
Merge branch 'ToolFixes' of github.com:mqg734/ninja-internal into working
Conflicts: js/helper-classes/RDGE/GLRectangle.js js/helper-classes/RDGE/GLWorld.js js/helper-classes/RDGE/MaterialsLibrary.js
Diffstat (limited to 'js/helper-classes')
-rw-r--r--js/helper-classes/3D/snap-manager.js15
-rw-r--r--js/helper-classes/RDGE/GLCircle.js79
-rw-r--r--js/helper-classes/RDGE/GLGeomObj.js51
-rw-r--r--js/helper-classes/RDGE/GLLine.js27
-rw-r--r--js/helper-classes/RDGE/GLRectangle.js65
-rw-r--r--js/helper-classes/RDGE/GLWorld.js6
-rw-r--r--js/helper-classes/RDGE/MaterialsLibrary.js2
7 files changed, 85 insertions, 160 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index f3e8b823..0a950658 100644
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -9,14 +9,13 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
9// Class to do hit testing of objects in the html page 9// Class to do hit testing of objects in the html page
10/////////////////////////////////////////////////////////////////////// 10///////////////////////////////////////////////////////////////////////
11var Montage = require("montage/core/core").Montage, 11var Montage = require("montage/core/core").Montage,
12 Component = require("montage/ui/component").Component; 12 Component = require("montage/ui/component").Component,
13 13 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils,
14var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils; 14 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
15var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; 15 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils,
16var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; 16 HitRecord = require("js/helper-classes/3D/hit-record").HitRecord,
17var HitRecord = require("js/helper-classes/3D/hit-record").HitRecord; 17 Snap2DRecord = require("js/helper-classes/3D/snap-2d-record").Snap2DRecord,
18var Snap2DRecord = require("js/helper-classes/3D/snap-2d-record").Snap2DRecord; 18 NJUtils = require("js/lib/NJUtils").NJUtils;
19var NJUtils = require("js/lib/NJUtils").NJUtils;
20 19
21var SnapManager = exports.SnapManager = Montage.create(Component, { 20var SnapManager = exports.SnapManager = Montage.create(Component, {
22 /////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js
index 8f7a5d30..942eb528 100644
--- a/js/helper-classes/RDGE/GLCircle.js
+++ b/js/helper-classes/RDGE/GLCircle.js
@@ -33,14 +33,6 @@ function GLCircle()
33 33
34 this._ovalHeight = this._ovalHeight = 2.0*this.radius; 34 this._ovalHeight = this._ovalHeight = 2.0*this.radius;
35 35
36 // stroke and fill colors
37 this._strokeColor = [0.4, 0.4, 0.4, 1.0];
38 this._fillColor = [0.0, 0.6, 0.0, 1.0];
39
40 // stroke and fill materials
41 this._fillMaterial;
42 this._strokeMaterial;
43
44 this._strokeStyle = "Solid"; 36 this._strokeStyle = "Solid";
45 37
46 this._aspectRatio = 1.0; 38 this._aspectRatio = 1.0;
@@ -191,19 +183,19 @@ function GLCircle()
191 var reverseRotMat = Matrix.RotationZ( -angle ); 183 var reverseRotMat = Matrix.RotationZ( -angle );
192 184
193 // calculate matrices to scale the circle and stroke to fit the bounds of the ellipse 185 // calculate matrices to scale the circle and stroke to fit the bounds of the ellipse
194 strokeScaleMat = Matrix.I(4); 186 var strokeScaleMat = Matrix.I(4);
195 strokeScaleMat[0] = xRad; 187 strokeScaleMat[0] = xRad;
196 strokeScaleMat[5] = yRad; 188 strokeScaleMat[5] = yRad;
197 189
198 fillScaleMat = Matrix.I(4); 190 var fillScaleMat = Matrix.I(4);
199 fillScaleMat[0] = xRad - xStroke; 191 fillScaleMat[0] = xRad - xStroke;
200 fillScaleMat[5] = yRad - yStroke; 192 fillScaleMat[5] = yRad - yStroke;
201 193
202 innerRadiusScaleMat = Matrix.I(4); 194 var innerRadiusScaleMat = Matrix.I(4);
203 innerRadiusScaleMat[0] = xInnRad; 195 innerRadiusScaleMat[0] = xInnRad;
204 innerRadiusScaleMat[5] = yInnRad; 196 innerRadiusScaleMat[5] = yInnRad;
205 197
206 innerStrokeScaleMat = Matrix.I(4); 198 var innerStrokeScaleMat = Matrix.I(4);
207 innerStrokeScaleMat[0] = xInnRad - xStroke; 199 innerStrokeScaleMat[0] = xInnRad - xStroke;
208 innerStrokeScaleMat[5] = yInnRad - yStroke; 200 innerStrokeScaleMat[5] = yInnRad - yStroke;
209 201
@@ -235,69 +227,24 @@ function GLCircle()
235 227
236 if (fillPrim) 228 if (fillPrim)
237 { 229 {
238 this._primArray.push( fillPrim ); 230 fillMaterial = this.makeFillMaterial();
239
240 if (this.getFillMaterial())
241 fillMaterial = this.getFillMaterial().dup();
242 else
243 fillMaterial = new FlatMaterial();
244 231
245 if (fillMaterial) 232 this._primArray.push( fillPrim );
246 { 233 this._materialNodeArray.push( fillMaterial.getMaterialNode() );
247 fillMaterial.init( this.getWorld() );
248 if(!this.getFillMaterial() && this._fillColor)
249 {
250 fillMaterial.setProperty("color", this._fillColor);
251 }
252 this._materialArray.push( fillMaterial );
253 this._materialTypeArray.push( "fill" );
254 var matNode = fillMaterial.getMaterialNode();
255 this._materialNodeArray.push( matNode );
256 }
257 } 234 }
258 if (strokePrim0) 235 if (strokePrim0)
259 { 236 {
260 if (this.getStrokeMaterial()) 237 strokeMaterial0 = this.makeStrokeMaterial();
261 strokeMaterial = this.getStrokeMaterial().dup();
262 else
263 strokeMaterial = new FlatMaterial();
264 238
265 if (strokeMaterial) 239 this._primArray.push( strokePrim0 );
266 { 240 this._materialNodeArray.push( strokeMaterial0.getMaterialNode() );
267 strokeMaterial.init( this.getWorld() );
268 if(!this.getStrokeMaterial() && this._strokeColor)
269 {
270 strokeMaterial.setProperty("color", this._strokeColor);
271 }
272 this._primArray.push( strokePrim0 );
273
274 var materialNode = createMaterialNode("ovalFillMaterial");
275 this._materialArray.push( strokeMaterial );
276 this._materialTypeArray.push( "stroke" );
277 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
278 }
279 } 241 }
280 if (strokePrim1) 242 if (strokePrim1)
281 { 243 {
282 if (this.getStrokeMaterial()) 244 strokeMaterial2 = this.makeStrokeMaterial();
283 strokeMaterial = this.getStrokeMaterial().dup();
284 else
285 strokeMaterial = new FlatMaterial();
286 245
287 if (strokeMaterial) 246 this._primArray.push( strokePrim1 );
288 { 247 this._materialNodeArray.push( strokeMaterial2.getMaterialNode() );
289 strokeMaterial.init( this.getWorld() );
290 if(!this.getStrokeMaterial() && this._strokeColor)
291 {
292 strokeMaterial.setProperty("color", this._strokeColor);
293 }
294 this._primArray.push( strokePrim1 );
295
296 var materialNode = createMaterialNode("ovalFillMaterial");
297 this._materialArray.push( strokeMaterial );
298 this._materialTypeArray.push( "stroke" );
299 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
300 }
301 } 248 }
302 249
303 world.updateObject(this); 250 world.updateObject(this);
diff --git a/js/helper-classes/RDGE/GLGeomObj.js b/js/helper-classes/RDGE/GLGeomObj.js
index e04b3283..5d7497ad 100644
--- a/js/helper-classes/RDGE/GLGeomObj.js
+++ b/js/helper-classes/RDGE/GLGeomObj.js
@@ -37,6 +37,10 @@ function GLGeomObj()
37 37
38 this.m_world = null; 38 this.m_world = null;
39 39
40 // stroke and fill colors
41 this._strokeColor;
42 this._fillColor;
43
40 // stroke and fill materials 44 // stroke and fill materials
41 this._fillMaterial; 45 this._fillMaterial;
42 this._strokeMaterial; 46 this._strokeMaterial;
@@ -107,6 +111,53 @@ function GLGeomObj()
107 this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); } 111 this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); }
108 this.setStrokeColor = function(c) { this.setMaterialColor(c, "stroke"); } 112 this.setStrokeColor = function(c) { this.setMaterialColor(c, "stroke"); }
109 113
114 this.makeStrokeMaterial = function()
115 {
116 var strokeMaterial;
117 if (this.getStrokeMaterial())
118 strokeMaterial = this.getStrokeMaterial().dup();
119 else
120 strokeMaterial = new FlatMaterial();
121
122 if (strokeMaterial)
123 {
124 strokeMaterial.init( this.getWorld() );
125 if(this._strokeColor)
126 {
127 strokeMaterial.setProperty("color", this._strokeColor);
128 }
129 }
130
131 this._materialArray.push( strokeMaterial );
132 this._materialTypeArray.push( "stroke" );
133
134 return strokeMaterial;
135 }
136
137 this.makeFillMaterial = function()
138 {
139 var fillMaterial;
140 if (this.getFillMaterial())
141 fillMaterial = this.getFillMaterial().dup();
142 else
143 fillMaterial = new FlatMaterial();
144
145 if (fillMaterial)
146 {
147 fillMaterial.init( this.getWorld() );
148 //if(!this.getFillMaterial() && this._fillColor)