diff options
author | Valerio Virgillito | 2012-04-04 15:53:29 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-04 15:53:29 -0700 |
commit | e721a7c1009f298a1bd8fea583da14535e039880 (patch) | |
tree | 9415f5ba25ad643df678e561719d2708fd3ead5a /js/helper-classes/RDGE/src/core/script/shadowLight.js | |
parent | 8482e23cd9b8c4700b5130f2588e5eb24d376536 (diff) | |
parent | 7249d6377c8897b2f9d8115be99717be971a0981 (diff) | |
download | ninja-e721a7c1009f298a1bd8fea583da14535e039880.tar.gz |
Merge pull request #156 from mayhewinator/WorkingBranch
Namespace and code cleanup for RDGE and related files
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/shadowLight.js')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/shadowLight.js | 90 |
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 | ||
8 | var 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 | */ |
10 | shadowLight = function() | 13 | RDGE.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 | } |