diff options
author | Nivesh Rajbhandari | 2012-04-16 16:06:24 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-16 16:06:24 -0700 |
commit | c253192a08b499ea7be46fa5438d273e51f7ec5a (patch) | |
tree | 18a1f0e3679c0eb993a9dedb537035d3861f49ac /js/helper-classes/RDGE/src/core/script/shadowLight.js | |
parent | e19376c54eedd1f1c457ba405b2f110be376a559 (diff) | |
parent | 4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff) | |
download | ninja-c253192a08b499ea7be46fa5438d273e51f7ec5a.tar.gz |
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
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 | } |