aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script/camera.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/camera.js')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/camera.js47
1 files changed, 24 insertions, 23 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/camera.js b/js/helper-classes/RDGE/src/core/script/camera.js
index da9aff3d..290be1ef 100755
--- a/js/helper-classes/RDGE/src/core/script/camera.js
+++ b/js/helper-classes/RDGE/src/core/script/camera.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
@@ -27,8 +28,8 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE. 29POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 30</copyright> */
30/* 31/*
31 * camera class 32 * camera class
32 */ 33 */
33var RDGE = RDGE || {}; 34var RDGE = RDGE || {};
34 35
@@ -84,7 +85,7 @@ RDGE.camera = function () {
84 return p; 85 return p;
85 }; 86 };
86 87
87 /* This is the old way 88 /* This is the old way
88 var t = this.persp.near * Math.tan(0.017453292519943295769236 * this.persp.fov * 0.5); 89 var t = this.persp.near * Math.tan(0.017453292519943295769236 * this.persp.fov * 0.5);
89 var r = t * this.persp.aratio; 90 var r = t * this.persp.aratio;
90 var u = t; 91 var u = t;
@@ -204,7 +205,7 @@ RDGE.camera = function () {
204 return 0.0; 205 return 0.0;
205 }; 206 };
206 207
207 // this is used by ambient occlusion... 208 // this is used by ambient occlusion...
208 this.getFTR = function () { 209 this.getFTR = function () {
209 var fovyRad = (this.persp.fov * 0.5) * Math.PI / 180.0; 210 var fovyRad = (this.persp.fov * 0.5) * Math.PI / 180.0;
210 return [ 211 return [
@@ -220,15 +221,15 @@ RDGE.camera = function () {
220 221
221 222
222/** Camera Manager 223/** Camera Manager
223 * This class is used to manage the active camera. It provides functionality 224 * This class is used to manage the active camera. It provides functionality
224 * for getting and setting the active camera, as well as providing stack operations 225 * for getting and setting the active camera, as well as providing stack operations
225 * to switch to and from multiple cameras. 226 * to switch to and from multiple cameras.
226 */ 227 */
227RDGE.cameraManager = function () { 228RDGE.cameraManager = function () {
228 this.stack = []; 229 this.stack = [];
229 230
230 /* Set the active camera. 231 /* Set the active camera.
231 * This function sets the active camera to the given camera. 232 * This function sets the active camera to the given camera.
232 */ 233 */
233 this.setActiveCamera = function (c) { 234 this.setActiveCamera = function (c) {
234 // pop the active camera off the stack. 235 // pop the active camera off the stack.
@@ -239,8 +240,8 @@ RDGE.cameraManager = function () {
239 this.stack.push(c); 240 this.stack.push(c);
240 }; 241 };
241 242
242 /* Get the active camera. 243 /* Get the active camera.
243 * The active camera always resides at the top of the stack. 244 * The active camera always resides at the top of the stack.
244 */ 245 */
245 this.getActiveCamera = function () { 246 this.getActiveCamera = function () {
246 if (this.stack.length > 0) { 247 if (this.stack.length > 0) {
@@ -250,14 +251,14 @@ RDGE.cameraManager = function () {
250 } 251 }
251 }; 252 };
252 253
253 /* Push a camera onto the stack. 254 /* Push a camera onto the stack.
254 * The given camera becomes the active camera. 255 * The given camera becomes the active camera.
255 */ 256 */
256 this.pushCamera = function (c) { 257 this.pushCamera = function (c) {
257 this.stack.push(c); 258 this.stack.push(c);
258 }; 259 };
259 260
260 /* Pop a camera off the stack. 261 /* Pop a camera off the stack.
261 * Returns the camera that was popped. 262 * Returns the camera that was popped.
262 * The next camera on the stack becomes active. 263 * The next camera on the stack becomes active.
263 */ 264 */