aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/view-utils.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 16:42:40 -0700
committerValerio Virgillito2012-07-09 16:42:40 -0700
commit3489294afb739e75aa760eb45f1241cd2a14b8d0 (patch)
tree5b11abd0414e0a3ab50ec6276b6334fbd168db7e /js/helper-classes/3D/view-utils.js
parent26d4b5ce30e6e0ea6e0fde870853c1e2a673a7b4 (diff)
parent7bee50379c1df86bb571e0e8d6c08e24d25231f5 (diff)
downloadninja-3489294afb739e75aa760eb45f1241cd2a14b8d0.tar.gz
Merge pull request #379 from kriskowal/bsd-v0.7.0
BSD License for v0.7.0
Diffstat (limited to 'js/helper-classes/3D/view-utils.js')
-rwxr-xr-xjs/helper-classes/3D/view-utils.js41
1 files changed, 21 insertions, 20 deletions
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 3462428f..520e1245 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -1,24 +1,25 @@
1/* <copyright> 1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved. 3All Rights Reserved.
4BSD License.
5 4
6Redistribution and use in source and binary forms, with or without 5Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met: 6modification, are permitted provided that the following conditions are met:
8 7
9 - Redistributions of source code must retain the above copyright notice, 8* Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 9 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright 10
12 notice, this list of conditions and the following disclaimer in the 11* Redistributions in binary form must reproduce the above copyright notice,
13 documentation and/or other materials provided with the distribution. 12 this list of conditions and the following disclaimer in the documentation
14 - Neither the name of Motorola Mobility nor the names of its contributors 13 and/or other materials provided with the distribution.
15 may be used to endorse or promote products derived from this software 14
16 without specific prior written permission. 15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
17 18
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -158,7 +159,7 @@ exports.ViewUtils = Montage.create(Component, {
158 var stageMat = this.getMatrixFromElement(stage); 159 var stageMat = this.getMatrixFromElement(stage);
159 160
160 var mat = glmat4.multiply( stageMat, objMat, [] ); 161 var mat = glmat4.multiply( stageMat, objMat, [] );
161 162
162 var viewDir; 163 var viewDir;
163 if (localMode) 164 if (localMode)
164 { 165 {
@@ -183,7 +184,7 @@ exports.ViewUtils = Montage.create(Component, {
183 else 184 else
184 plane = vecUtils.vecCross( 3, yVec, xVec ); 185 plane = vecUtils.vecCross( 3, yVec, xVec );
185 break; 186 break;
186 187
187 case 1: 188 case 1:
188 xDot = Math.abs(vecUtils.vecDot(3, yVec, viewDir)); 189 xDot = Math.abs(vecUtils.vecDot(3, yVec, viewDir));
189 zDot = Math.abs(vecUtils.vecDot(3, zVec, viewDir)); 190 zDot = Math.abs(vecUtils.vecDot(3, zVec, viewDir));
@@ -571,7 +572,7 @@ exports.ViewUtils = Montage.create(Component, {
571 return localPlane; 572 return localPlane;
572 } 573 }
573 }, 574 },
574 575
575 parentToChild: { 576 parentToChild: {
576 value: function( parentPt, child, passthrough ) { 577 value: function( parentPt, child, passthrough ) {
577 var pt = parentPt.slice(0); 578 var pt = parentPt.slice(0);
@@ -620,7 +621,7 @@ exports.ViewUtils = Montage.create(Component, {
620 return childPt; 621 return childPt;
621 } 622 }
622 }, 623 },
623 624
624 parentToChildWorld: { 625 parentToChildWorld: {
625 value: function( parentPt, child ) { 626 value: function( parentPt, child ) {
626 var pt = parentPt.slice(0); 627 var pt = parentPt.slice(0);
@@ -694,7 +695,7 @@ exports.ViewUtils = Montage.create(Component, {
694 return vec; 695 return vec;
695 } 696 }
696 }, 697 },
697 698
698 getElementBounds: { 699 getElementBounds: {
699 value: function( elt, localSpace ) { 700 value: function( elt, localSpace ) {
700 // optional argument localSpace, if true, puts the top left at (0,0). 701 // optional argument localSpace, if true, puts the top left at (0,0).
@@ -876,7 +877,7 @@ exports.ViewUtils = Montage.create(Component, {
876 } 877 }
877 }, 878 },
878 879
879 880
880 unproject: { 881 unproject: {
881 value: function( pt ) { 882 value: function( pt ) {
882 if(!this._perspectiveDist) 883 if(!this._perspectiveDist)
@@ -968,7 +969,7 @@ exports.ViewUtils = Montage.create(Component, {
968 return viewPt; 969 return viewPt;
969 } 970 }
970 }, 971 },
971 972
972 globalScreenToLocalWorld: { 973 globalScreenToLocalWorld: {
973 value: function( globalPt, elt ) { 974 value: function( globalPt, elt ) {
974 var objPt = this.globalToLocal( globalPt, elt ); 975 var objPt = this.globalToLocal( globalPt, elt );
@@ -1341,7 +1342,7 @@ exports.ViewUtils = Montage.create(Component, {
1341// drawLayoutModule 1342// drawLayoutModule
1342// 1343//
1343// STAGE ACCESSORS: 1344// STAGE ACCESSORS:
1344// activeDocument: this.application.ninja.currentDocument 1345// activeDocument: this.application.ninja.currentDocument
1345// userContent (stage): this.application.ninja.currentDocument.model.documentRoot 1346// userContent (stage): this.application.ninja.currentDocument.model.documentRoot
1346// stageManager: this.application.ninja.stage // MainApp\js\stage\stage.reel\stage.js 1347// stageManager: this.application.ninja.stage // MainApp\js\stage\stage.reel\stage.js
1347// stageManager._canvas: this.application.ninja.stage.canvas 1348// stageManager._canvas: this.application.ninja.stage.canvas
@@ -1490,6 +1491,6 @@ exports.ViewUtils = Montage.create(Component, {
1490 } 1491 }
1491 1492
1492/////////////////////////////////////////////////////////////////////////////////// 1493///////////////////////////////////////////////////////////////////////////////////
1493 1494
1494}); 1495});
1495 1496