diff options
Diffstat (limited to 'js/helper-classes/3D/view-utils.js')
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index dabb1fcf..40a19b90 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 | ||
@@ -833,48 +839,6 @@ exports.ViewUtils = Montage.create(Component, { | |||
833 | } | 839 | } |
834 | }, | 840 | }, |
835 | 841 | ||
836 | /* | ||
837 | getStageWorldToGlobalMatrix: { | ||
838 | value: function() { | ||
839 | var stage = this.application.ninja.currentDocument.documentRoot, | ||
840 | projMat; | ||
841 | this.pushViewportObj( stage ); | ||
842 | |||
843 | // get the matrix to the parent | ||
844 | var mat = Matrix.I(4); | ||
845 | |||
846 | var cop = this.getCenterOfProjection(); | ||
847 | var v2s = Matrix.Translation([cop[0], cop[1], 0]); | ||
848 | |||
849 | var p = this.getPerspectiveDistFromElement(stage); | ||
850 | if(p) | ||
851 | { | ||
852 | projMat = glmat4.scale( Matrix.I(4), [p,p,p], [] ); | ||
853 | projMat[11] = -1; | ||
854 | mat = glmat4.multiply( v2s, projMat, [] ); | ||
855 | } | ||
856 | else | ||
857 | { | ||
858 | mat = v2s; | ||
859 | } | ||
860 | |||
861 | // offset to the parent | ||
862 | var offset = this.getElementOffset( stage ); | ||
863 | var offMat = Matrix.Translation([offset[0], offset[1], 0]); | ||
864 | //mat = offMat.multiply( mat ); | ||
865 | glmat4.multiply( offMat, mat, mat ); | ||
866 | |||
867 | this.popViewportObj(); | ||
868 | |||
869 | // var mat2 = this.getLocalToGlobalMatrix( stage.parentElement ); | ||
870 | var mat2 = this.getLocalToGlobalMatrix( this._rootElement ); | ||
871 | //var mat = mat2.multiply( mat ); | ||
872 | glmat4.multiply( mat2, mat, mat ); | ||
873 | |||
874 | return mat; | ||
875 | } | ||
876 | }, | ||
877 | */ | ||
878 | getStageWorldToGlobalMatrix: | 842 | getStageWorldToGlobalMatrix: |
879 | { | 843 | { |
880 | value: function() | 844 | value: function() |