aboutsummaryrefslogtreecommitdiff
path: root/js/tools/drawing-tool-base.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-17 14:49:18 -0700
committerPushkar Joshi2012-04-17 14:49:18 -0700
commitdf903a01e14134cadf109b733d09c6eadfa3966b (patch)
tree2351f1c05b2f852053fa0be533072088a9ad4e7c /js/tools/drawing-tool-base.js
parent036cf034e124dbc1f4893e90f7c6d240904a3faf (diff)
parentcacb4a21825818af392c2949967b0f3c1df509c5 (diff)
downloadninja-df903a01e14134cadf109b733d09c6eadfa3966b.tar.gz
Merge branch 'master' into pentool
Conflicts: js/tools/PenTool.js
Diffstat (limited to 'js/tools/drawing-tool-base.js')
-rwxr-xr-xjs/tools/drawing-tool-base.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js
index 991a2f1c..2283dfab 100755
--- a/js/tools/drawing-tool-base.js
+++ b/js/tools/drawing-tool-base.js
@@ -229,7 +229,7 @@ exports.DrawingToolBase = Montage.create(Montage, {
229 //var planeMatInv = planeMat.inverse(); 229 //var planeMatInv = planeMat.inverse();
230 var planeMatInv = glmat4.inverse( planeMat, [] ); 230 var planeMatInv = glmat4.inverse( planeMat, [] );
231 //var midPt = this.unprojectPoints( s0, s1, planeMat, planeMatInv, s1Proj ); 231 //var midPt = this.unprojectPoints( s0, s1, planeMat, planeMatInv, s1Proj );
232 var midPt = this.unprojectPoints( s0, s1, planeMat, planeMatInv, true ); 232// var midPt = this.unprojectPoints( s0, s1, planeMat, planeMatInv, true );
233 233
234 // get the 4 points of the bounding box in 2D space 234 // get the 4 points of the bounding box in 2D space
235 p0 = MathUtils.transformPoint( s0, planeMatInv ); 235 p0 = MathUtils.transformPoint( s0, planeMatInv );
@@ -239,7 +239,7 @@ exports.DrawingToolBase = Montage.create(Montage, {
239 //midPt = s0.add(s1); 239 //midPt = s0.add(s1);
240 //midPt = midPt.multiply(0.5); 240 //midPt = midPt.multiply(0.5);
241 //midPt = MathUtils.makeDimension3(midPt); 241 //midPt = MathUtils.makeDimension3(midPt);
242 midPt = vec3.add(s0, s1, []); 242 var midPt = vec3.add(s0, s1, []);
243 midPt = vecUtils.vecScale( 3, midPt, 0.5 ); 243 midPt = vecUtils.vecScale( 3, midPt, 0.5 );
244 244
245 // the mid point is now relative to the center of the 3D space. To 245 // the mid point is now relative to the center of the 3D space. To
@@ -373,6 +373,9 @@ exports.DrawingToolBase = Montage.create(Montage, {
373 // determine if the geometry is going to be projected. If so a second projected rectangle is drawn 373 // determine if the geometry is going to be projected. If so a second projected rectangle is drawn
374 var isProjected = ((MathUtils.fpCmp(thePlane[2],1.0) !== 0) || (MathUtils.fpSign(thePlane[3]) !== 0)); 374 var isProjected = ((MathUtils.fpCmp(thePlane[2],1.0) !== 0) || (MathUtils.fpSign(thePlane[3]) !== 0));
375 375
376 // TODO - We no longer need to project drawing after perspective fix. Need to clean up this code.
377 // For now, just setting isProjected to false so rest of the drawing still works.
378 isProjected = false;
376 // get and draw the unprojected object points 379 // get and draw the unprojected object points
377 var projPtArr = []; 380 var projPtArr = [];
378 if (isProjected) 381 if (isProjected)
@@ -444,7 +447,7 @@ exports.DrawingToolBase = Montage.create(Montage, {
444 flatMat = divMat; 447 flatMat = divMat;
445 flatMatSafe = MathUtils.scientificToDecimal(flatMat, 10); 448 flatMatSafe = MathUtils.scientificToDecimal(flatMat, 10);
446 449
447 return "perspective(" + 1400 + ") matrix3d( " + flatMatSafe + ")"; 450 return "matrix3d(" + flatMatSafe + ")";
448 } 451 }
449 }, 452 },
450 453