aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script/shadowLight.js
diff options
context:
space:
mode:
authorKris Kowal2012-07-06 12:34:53 -0700
committerKris Kowal2012-07-06 15:01:48 -0700
commit3644cb6def4f681c99959e5729e78ea353441fad (patch)
treef8a886f4829e507cc4956db37cff2580cae6003d /js/helper-classes/RDGE/src/core/script/shadowLight.js
parent04343eda8c2f870b0da55cfdc8003c99fe1cc4de (diff)
downloadninja-3644cb6def4f681c99959e5729e78ea353441fad.tar.gz
Normalize to unix line terminators
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/shadowLight.js')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/shadowLight.js152
1 files changed, 76 insertions, 76 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/shadowLight.js b/js/helper-classes/RDGE/src/core/script/shadowLight.js
index 4d1dd362..c1a40eb3 100755
--- a/js/helper-classes/RDGE/src/core/script/shadowLight.js
+++ b/js/helper-classes/RDGE/src/core/script/shadowLight.js
@@ -1,76 +1,76 @@
1/* <copyright> 1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility, Inc
3All Rights Reserved. 3All Rights Reserved.
4BSD License. 4BSD License.
5 5
6Redistribution and use in source and binary forms, with or without 6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met: 7modification, are permitted provided that the following conditions are met:
8 8
9 - Redistributions of source code must retain the above copyright notice, 9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer. 10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright 11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the 12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution. 13 documentation and/or other materials provided with the distribution.
14 - Neither the name of Motorola Mobility nor the names of its contributors 14 - Neither the name of Motorola Mobility nor the names of its contributors
15 may be used to endorse or promote products derived from this software 15 may be used to endorse or promote products derived from this software
16 without specific prior written permission. 16 without specific prior written permission.
17 17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE. 28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 29</copyright> */
30 30
31// RDGE namespaces 31// RDGE namespaces
32var RDGE = RDGE || {}; 32var RDGE = RDGE || {};
33 33
34/* 34/*
35* shadow light - a modified camera used to describe a shadow casting light 35* shadow light - a modified camera used to describe a shadow casting light
36*/ 36*/
37RDGE.shadowLight = function () { 37RDGE.shadowLight = function () {
38 // inherit from the base class 38 // inherit from the base class
39 this.inheritedFrom = RDGE.camera; 39 this.inheritedFrom = RDGE.camera;
40 this.inheritedFrom(); 40 this.inheritedFrom();
41 41
42 // matrices needed for shadow projection 42 // matrices needed for shadow projection
43 this.invViewMatrix = RDGE.mat4.identity(); 43 this.invViewMatrix = RDGE.mat4.identity();
44 this.mvpMatrix = RDGE.mat4.identity(); 44 this.mvpMatrix = RDGE.mat4.identity();
45 45
46 // texture matrix 46 // texture matrix
47 this.shadowMatrix = RDGE.mat4.identity(); 47 this.shadowMatrix = RDGE.mat4.identity();
48 this.shadowMatrix = RDGE.mat4.scale(this.shadowMatrix, [0.5, 0.5, 0.5]); 48 this.shadowMatrix = RDGE.mat4.scale(this.shadowMatrix, [0.5, 0.5, 0.5]);
49 this.shadowMatrix = RDGE.mat4.translate(this.shadowMatrix, [0.5, 0.5, 0.5]); 49 this.shadowMatrix = RDGE.mat4.translate(this.shadowMatrix, [0.5, 0.5, 0.5]);
50 50
51 // cached references 51 // cached references
52 this.renderer = null; 52 this.renderer = null;
53 this.cameraManager = null; 53 this.cameraManager = null;
54 54
55 // shadow bias offset 55 // shadow bias offset
56 this.shadowBias = 0.0195; 56 this.shadowBias = 0.0195;
57 57
58 this.init = function () { 58 this.init = function () {
59 this.renderer = RDGE.globals.engine.getContext().renderer; 59 this.renderer = RDGE.globals.engine.getContext().renderer;
60 this.cameraManager = this.renderer.cameraManager(); 60 this.cameraManager = this.renderer.cameraManager();
61 }; 61 };
62 62
63 /* 63 /*
64 * makes the light the current 'camera' 64 * makes the light the current 'camera'
65 */ 65 */
66 this.activate = function () { 66 this.activate = function () {
67 this.cameraManager.pushCamera(this); 67 this.cameraManager.pushCamera(this);
68 }; 68 };
69 69
70 /* 70 /*
71 * restores the camera stack 71 * restores the camera stack
72 */ 72 */
73 this.deactivate = function () { 73 this.deactivate = function () {
74 this.cameraManager.popCamera(); 74 this.cameraManager.popCamera();
75 }; 75 };
76} 76}