aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script/shadowLight.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-04-04 15:58:49 -0700
committerValerio Virgillito2012-04-04 15:58:49 -0700
commit347b4179be5581841fc94825dcb18901e625c670 (patch)
tree93556d56b049aa47c615a8b58add230cd96da166 /js/helper-classes/RDGE/src/core/script/shadowLight.js
parent9f1806a7134ec4744a8009e6a7467f5cea04cabf (diff)
parente721a7c1009f298a1bd8fea583da14535e039880 (diff)
downloadninja-347b4179be5581841fc94825dcb18901e625c670.tar.gz
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/shadowLight.js')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/shadowLight.js90
1 files changed, 44 insertions, 46 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/shadowLight.js b/js/helper-classes/RDGE/src/core/script/shadowLight.js
index 80d9331a..3d6e42f6 100755
--- a/js/helper-classes/RDGE/src/core/script/shadowLight.js
+++ b/js/helper-classes/RDGE/src/core/script/shadowLight.js
@@ -4,51 +4,49 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7// RDGE namespaces
8var RDGE = RDGE || {};
9
7/* 10/*
8 * shadow light - a modified camera used to describe a shadow casting light 11* shadow light - a modified camera used to describe a shadow casting light
9 */ 12*/
10shadowLight = function() 13RDGE.shadowLight = function () {
11{ 14 // inherit from the base class
12 // inherit from the base class 15 this.inheritedFrom = RDGE.camera;
13 this.inheritedFrom = camera; 16 this.inheritedFrom();
14 this.inheritedFrom(); 17
15 18 // matrices needed for shadow projection
16 // matrices needed for shadow projection 19 this.invViewMatrix = RDGE.mat4.identity();
17 this.invViewMatrix=mat4.identity(); 20 this.mvpMatrix = RDGE.mat4.identity();
18 this.mvpMatrix=mat4.identity(); 21
19 22 // texture matrix
20 // texture matrix 23 this.shadowMatrix = RDGE.mat4.identity();
21 this.shadowMatrix=mat4.identity(); 24 this.shadowMatrix = RDGE.mat4.scale(this.shadowMatrix, [0.5, 0.5, 0.5]);
22 this.shadowMatrix=mat4.scale(this.shadowMatrix,[0.5,0.5,0.5]); 25 this.shadowMatrix = RDGE.mat4.translate(this.shadowMatrix, [0.5, 0.5, 0.5]);
23 this.shadowMatrix=mat4.translate(this.shadowMatrix,[0.5,0.5,0.5]); 26
24 27 // cached references
25 // cached references 28 this.renderer = null;
26 this.renderer = null; 29 this.cameraManager = null;
27 this.cameraManager = null; 30
28 31 // shadow bias offset
29 // shadow bias offset 32 this.shadowBias = 0.0195;
30 this.shadowBias = 0.0195; 33
31 34 this.init = function () {
32 this.init = function () 35 this.renderer = RDGE.globals.engine.getContext().renderer;
33 { 36 this.cameraManager = this.renderer.cameraManager();
34 this.renderer = g_Engine.getContext().renderer; 37 };
35 this.cameraManager = this.renderer.cameraManager(); 38
36 } 39 /*
37 40 * makes the light the current 'camera'
38 /* 41 */
39 * makes the light the current 'camera' 42 this.activate = function () {
40 */ 43 this.cameraManager.pushCamera(this);
41 this.activate = function() 44 };
42 { 45
43 this.cameraManager.pushCamera(this); 46 /*
44 } 47 * restores the camera stack
45 48 */
46 /* 49 this.deactivate = function () {
47 * restores the camera stack 50 this.cameraManager.popCamera();
48 */ 51 };
49 this.deactivate = function()
50 {
51 this.cameraManager.popCamera();
52 }
53
54} 52}