aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/view-utils.js
diff options
context:
space:
mode:
authorJon Reid2012-04-19 14:30:38 -0700
committerJon Reid2012-04-19 14:30:38 -0700
commit71e1e65d6aaa64afc9fffba9b1fd6d19904b52b0 (patch)
tree78292a128cd79f2aa7fbc7a7077dea83389a52e8 /js/helper-classes/3D/view-utils.js
parentfc22cd3b5c65dc6f137fbb59443e2061cbbcac26 (diff)
parent4465a66996f2b022ab9e838e028415fd87cfa405 (diff)
downloadninja-71e1e65d6aaa64afc9fffba9b1fd6d19904b52b0.tar.gz
Merge remote-tracking branch 'ninja-jduran/TimelineUber' into timeline-local
Conflicts: js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js Used mine.
Diffstat (limited to 'js/helper-classes/3D/view-utils.js')
-rwxr-xr-xjs/helper-classes/3D/view-utils.js35
1 files changed, 21 insertions, 14 deletions
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 1cd1c313..ee822f1f 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -135,6 +135,12 @@ exports.ViewUtils = Montage.create(Component, {
135 var stageMat = this.getMatrixFromElement(stage); 135 var stageMat = this.getMatrixFromElement(stage);
136 var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; 136 var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]];
137 137
138 if (elt === stage)
139 {
140 xVec = [1,0,0];
141 yVec = [0,1,0];
142 }
143
138 var xDot = Math.abs(vecUtils.vecDot(3, xVec, stagePlane)); 144 var xDot = Math.abs(vecUtils.vecDot(3, xVec, stagePlane));
139 var yDot = Math.abs(vecUtils.vecDot(3, yVec, stagePlane)); 145 var yDot = Math.abs(vecUtils.vecDot(3, yVec, stagePlane));
140 146
@@ -834,42 +840,43 @@ exports.ViewUtils = Montage.create(Component, {
834 } 840 }
835 }, 841 },
836 842
837 getStageWorldToGlobalMatrix: { 843 getStageWorldToGlobalMatrix:
838 value: function() { 844 {
839 var stage = this.application.ninja.currentDocument.documentRoot, 845 value: function()
840 projMat; 846 {
841 this.pushViewportObj( stage ); 847 var stage = this.application.ninja.currentDocument.documentRoot;
842 848 //projMat;
849
843 // get the matrix to the parent 850 // get the matrix to the parent
844 var mat = Matrix.I(4); 851 //var mat = Matrix.I(4);
845 852
853 this.pushViewportObj( stage );
846 var cop = this.getCenterOfProjection(); 854 var cop = this.getCenterOfProjection();
847 var v2s = Matrix.Translation([cop[0], cop[1], 0]); 855 var v2s = Matrix.Translation([cop[0], cop[1], 0]);
856 this.popViewportObj();
848 857
858 /*
849 var p = this.getPerspectiveDistFromElement(stage); 859 var p = this.getPerspectiveDistFromElement(stage);
850 if(p) 860 if(p)
851 { 861 {
852 projMat = glmat4.scale( Matrix.I(4), [p,p,p], [] ); 862 projMat = glmat4.scale( Matrix.I(4), [p,p,p], [] );
853 projMat[11] = -1; 863 projMat[11] = -1;
854 mat = glmat4.multiply( v2s, projMat, [] );
855 } 864 }
856 else 865 else
857 { 866 {
858 mat = v2s; 867 mat = v2s;
859 } 868 }
860
861 // offset to the parent 869 // offset to the parent
862 var offset = this.getElementOffset( stage ); 870 var offset = this.getElementOffset( stage );
863 var offMat = Matrix.Translation([offset[0], offset[1], 0]); 871 var offMat = Matrix.Translation([offset[0], offset[1], 0]);
864 //mat = offMat.multiply( mat ); 872 //mat = offMat.multiply( mat );
865 glmat4.multiply( offMat, mat, mat ); 873 glmat4.multiply( offMat, mat, mat );
866
867 this.popViewportObj(); 874 this.popViewportObj();
875 */
868 876
869 // var mat2 = this.getLocalToGlobalMatrix( stage.parentElement ); 877 // append the localToGlobal matrix of the stage.
870 var mat2 = this.getLocalToGlobalMatrix( this._rootElement ); 878 var mat = this.getLocalToGlobalMatrix( stage );
871 //var mat = mat2.multiply( mat ); 879 glmat4.multiply( mat, v2s );
872 glmat4.multiply( mat2, mat, mat );
873 880
874 return mat; 881 return mat;
875 } 882 }