aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-06 10:53:27 -0700
committerPushkar Joshi2012-04-06 10:53:27 -0700
commitf492c816575f990429f4540c9a3eb60c28a89623 (patch)
treeeef2eab16c4d99d2c67f542b454bf0251548b57e /js/helper-classes
parent0681b34b506767b6caf2816b9096bc1a57a17a2d (diff)
downloadninja-f492c816575f990429f4540c9a3eb60c28a89623.tar.gz
complete version of the code for rendering selected subpath anchor points and path overlay (code needs cleanup)...still buggy if creating new paths
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/view-utils.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index f60b953a..35f4a568 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -787,6 +787,7 @@ exports.ViewUtils = Montage.create(Component, {
787 } 787 }
788 }, 788 },
789 789
790 /*
790 getStageWorldToGlobalMatrix: { 791 getStageWorldToGlobalMatrix: {
791 value: function() { 792 value: function() {
792 var stage = this.application.ninja.currentDocument.documentRoot; 793 var stage = this.application.ninja.currentDocument.documentRoot;
@@ -820,6 +821,26 @@ exports.ViewUtils = Montage.create(Component, {
820 return mat; 821 return mat;
821 } 822 }
822 }, 823 },
824 */
825 getStageWorldToGlobalMatrix:
826 {
827 value: function()
828 {
829 var stage = this.application.ninja.currentDocument.documentRoot;
830
831 this.pushViewportObj( stage );
832 // put the point into screen space of the stage - requires
833 // a translation to the top/left only
834 var cop = this.getCenterOfProjection();
835 var v2s = Matrix.Translation([cop[0], cop[1], 0]);
836 this.popViewportObj();
837
838 // append the localToGlobal matrix of the stage.
839 var mat = this.getLocalToGlobalMatrix( stage );
840 glmat4.multiply( mat, v2s );
841 return mat;
842 }
843 },
823 844
824 localScreenToLocalWorld: { 845 localScreenToLocalWorld: {
825 value: function( objPt, elt ) { 846 value: function( objPt, elt ) {
@@ -967,6 +988,56 @@ exports.ViewUtils = Montage.create(Component, {
967 } 988 }
968 }, 989 },
969 990
991 getLocalToStageWorldMatrix: {
992 value: function( elt, shouldProject, shouldLocalTransform ) {
993 var mat = Matrix.I(4);
994 while (elt)
995 {
996 this.pushViewportObj( elt );
997 var cop = this.getCenterOfProjection();
998 var s2v = Matrix.Translation([-cop[0], -cop[1], 0]);
999 var objMat = this.getMatrixFromElement( elt );
1000 var projMat;
1001 if(shouldProject)
1002 {
1003 //projMat = Matrix.I(4).multiply( this.getPerspectiveDistFromElement(elt) );
1004 var pDist = this.getPerspectiveDistFromElement(elt);
1005 var projMat = glmat4.scale(Matrix.I(4), [pDist,pDist,pDist], []);
1006 projMat[11] = -1;
1007 projMat[15] = 1400;
1008 }
1009 var v2s = Matrix.Translation([cop[0], cop[1], 0]);
1010 this.popViewportObj();
1011
1012 // multiply all the matrices together
1013 //mat = s2v.multiply( mat );
1014 glmat4.multiply( s2v, mat, mat );
1015 if (elt === this._stageElement) break;
1016 //mat = objMat.multiply( mat );
1017 if (shouldLocalTransform) {
1018 glmat4.multiply( objMat, mat, mat );
1019 }
1020 if(shouldProject)
1021 {
1022 //mat = projMat.multiply( mat );
1023 glmat4.multiply( projMat, mat, mat );
1024 }
1025 //mat = v2s.multiply( mat );
1026 glmat4.multiply( v2s, mat, mat );
1027
1028 // offset to the parent
1029 var offset = this.getElementOffset( elt );
1030 var offMat = Matrix.Translation([offset[0], offset[1], 0]);
1031 //mat = offMat.multiply( mat );
1032 glmat4.multiply( offMat, mat, mat );
1033
1034 elt = elt.parentElement;
1035 }
1036
1037 return mat;
1038 }
1039 },
1040
970 getUpVectorFromMatrix: { 1041 getUpVectorFromMatrix: {
971 value: function( mat ) { 1042 value: function( mat ) {
972 //var inv = mat.inverse(); 1043 //var inv = mat.inverse();