diff options
author | Jonathan Duran | 2012-07-17 09:30:22 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-07-17 09:30:22 -0700 |
commit | 53051672a62208fbc96957719d8285fac6431ed6 (patch) | |
tree | 79d542ee811044e8af2ef84aa0d6662c6eb895c4 /js/helper-classes/RDGE/src/core/script/run_state.js | |
parent | 7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (diff) | |
parent | 5146f224258929415adf4a8022e492454b4e2476 (diff) | |
download | ninja-53051672a62208fbc96957719d8285fac6431ed6.tar.gz |
Merge branch 'refs/heads/NINJA-master' into TimelineUber
Conflicts:
js/panels/Timeline/DragDrop.js
js/panels/Timeline/Keyframe.reel/Keyframe.js
js/panels/Timeline/Layer.reel/Layer.js
js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
js/panels/Timeline/Span.reel/Span.js
js/panels/Timeline/Style.reel/Style.js
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
js/panels/Timeline/Track.reel/Track.html
js/panels/Timeline/Track.reel/Track.js
js/panels/Timeline/Track.reel/css/Track.css
js/panels/Timeline/TrackSpacer.reel/TrackSpacer.html
js/panels/Timeline/TrackSpacer.reel/TrackSpacer.js
js/panels/Timeline/TrackSpacer.reel/css/TrackSpacer.css
js/panels/Timeline/Tween.reel/Tween.js
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/run_state.js')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/run_state.js | 753 |
1 files changed, 377 insertions, 376 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/run_state.js b/js/helper-classes/RDGE/src/core/script/run_state.js index 2bccea6a..82cf975e 100755 --- a/js/helper-classes/RDGE/src/core/script/run_state.js +++ b/js/helper-classes/RDGE/src/core/script/run_state.js | |||
@@ -1,24 +1,25 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | ||
5 | 4 | ||
6 | Redistribution and use in source and binary forms, with or without | 5 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 6 | modification, 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 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
@@ -26,368 +27,368 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | POSSIBILITY OF SUCH DAMAGE. | 29 | POSSIBILITY OF SUCH DAMAGE. |
29 | </copyright> */ | 30 | </copyright> */ |
30 | 31 | ||
31 | var RDGE = RDGE || {}; | 32 | var RDGE = RDGE || {}; |
32 | 33 | ||
33 | RDGE.RunState = function (userRunState, context) { | 34 | RDGE.RunState = function (userRunState, context) { |
34 | this.name = "RunState"; | 35 | this.name = "RunState"; |
35 | this.userRunState = userRunState != undefined ? userRunState : new RDGE.core.RDGEState; | 36 | this.userRunState = userRunState != undefined ? userRunState : new RDGE.core.RDGEState; |
36 | this.hasUserState = userRunState != undefined ? true : false; | 37 | this.hasUserState = userRunState != undefined ? true : false; |
37 | this.renderer = context.renderer; | 38 | this.renderer = context.renderer; |
38 | this.initialized = false; | 39 | this.initialized = false; |
39 | }; | 40 | }; |
40 | 41 | ||
41 | RDGE.RunState.prototype.Init = function () { | 42 | RDGE.RunState.prototype.Init = function () { |
42 | this.initialized = true; | 43 | this.initialized = true; |
43 | var width = this.renderer.vpWidth; | 44 | var width = this.renderer.vpWidth; |
44 | var height = this.renderer.vpHeight; | 45 | var height = this.renderer.vpHeight; |
45 | var cam = new RDGE.camera(); | 46 | var cam = new RDGE.camera(); |
46 | cam.setPerspective(45.0, width / height, 1.0, 100.0); | 47 | cam.setPerspective(45.0, width / height, 1.0, 100.0); |
47 | cam.setLookAt([0, 0, 20], [0, 0, 0], RDGE.vec3.up()); | 48 | cam.setLookAt([0, 0, 20], [0, 0, 0], RDGE.vec3.up()); |
48 | 49 | ||
49 | this.renderer.cameraManager().setActiveCamera( cam ); | 50 | this.renderer.cameraManager().setActiveCamera( cam ); |
50 | 51 | ||
51 | if (this.hasUserState && this.userRunState.init != undefined) { | 52 | if (this.hasUserState && this.userRunState.init != undefined) { |
52 | this.userRunState.init(); | 53 | this.userRunState.init(); |
53 | } | 54 | } |
54 | 55 | ||
55 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) | 56 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) |
56 | this.userRunState.onRunState(); | 57 | this.userRunState.onRunState(); |
57 | 58 | ||
58 | 59 | ||
59 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 60 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
60 | 61 | ||
61 | // if(theScene=="Robots_rt") { | 62 | // if(theScene=="Robots_rt") { |
62 | // g_enableShadowMapping=false; | 63 | // g_enableShadowMapping=false; |
63 | // g_showSSAO=false; | 64 | // g_showSSAO=false; |
64 | // RDGE.globals.engine.defaultContext.uniforms[1]={ 'name': "u_lightAmb",'value': [0.5,0.5,0.5,1.0] }; | 65 | // RDGE.globals.engine.defaultContext.uniforms[1]={ 'name': "u_lightAmb",'value': [0.5,0.5,0.5,1.0] }; |
65 | // RDGE.globals.engine.defaultContext.uniforms[7]={ 'name': "u_matAmbient",'value': [0.8,0.8,0.8,1] }; | 66 | // RDGE.globals.engine.defaultContext.uniforms[7]={ 'name': "u_matAmbient",'value': [0.8,0.8,0.8,1] }; |
66 | // } | 67 | // } |
67 | 68 | ||
68 | 69 | ||
69 | // g_hrDepthMapGenShader=createShader(this.renderer.ctx,'depthMap_vshader','depthMap_fshader',["vert","normal"]); | 70 | // g_hrDepthMapGenShader=createShader(this.renderer.ctx,'depthMap_vshader','depthMap_fshader',["vert","normal"]); |
70 | // g_depthMapGenShader=createShader(this.renderer.ctx,'norm_depth_vshader','norm_depth_fshader',["vert","normal"]); | 71 | // g_depthMapGenShader=createShader(this.renderer.ctx,'norm_depth_vshader','norm_depth_fshader',["vert","normal"]); |
71 | 72 | ||
72 | // // shadow light | 73 | // // shadow light |
73 | // g_mainLight=new RDGE.camera(); // camera to represent our light's point of view | 74 | // g_mainLight=new RDGE.camera(); // camera to represent our light's point of view |
74 | // g_mainLight.setPerspective(45.0,width/height,1.0,200.0); | 75 | // g_mainLight.setPerspective(45.0,width/height,1.0,200.0); |
75 | // g_mainLight.setLookAt([-60,17,-15],[-5,-5,15],RDGE.vec3.up()); // lights position and point of view | 76 | // g_mainLight.setLookAt([-60,17,-15],[-5,-5,15],RDGE.vec3.up()); // lights position and point of view |
76 | // g_mainLight.mvMatrix=RDGE.mat4.copy(g_mainLight.view); // hold model view transform | 77 | // g_mainLight.mvMatrix=RDGE.mat4.copy(g_mainLight.view); // hold model view transform |
77 | // g_mainLight.invViewMatrix=RDGE.mat4.inverse(g_mainLight.view); | 78 | // g_mainLight.invViewMatrix=RDGE.mat4.inverse(g_mainLight.view); |
78 | // g_mainLight.mvpMatrix=RDGE.mat4.identity(); | 79 | // g_mainLight.mvpMatrix=RDGE.mat4.identity(); |
79 | // g_mainLight.shadowMatrix=RDGE.mat4.identity(); // shadow matrix creates shadow bias | 80 | // g_mainLight.shadowMatrix=RDGE.mat4.identity(); // shadow matrix creates shadow bias |
80 | // g_mainLight.shadowMatrix=RDGE.mat4.scale(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); | 81 | // g_mainLight.shadowMatrix=RDGE.mat4.scale(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); |
81 | // g_mainLight.shadowMatrix=RDGE.mat4.translate(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); | 82 | // g_mainLight.shadowMatrix=RDGE.mat4.translate(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); |
82 | // //g_cameraManager.setActiveCamera( g_mainLight ); | 83 | // //g_cameraManager.setActiveCamera( g_mainLight ); |
83 | // | 84 | // |
84 | // uniformEnableGlow = this.renderer.ctx.getUniformLocation(RDGE.globals.engine.defaultContext.shaderProg, "u_renderGlow"); | 85 | // uniformEnableGlow = this.renderer.ctx.getUniformLocation(RDGE.globals.engine.defaultContext.shaderProg, "u_renderGlow"); |
85 | // | 86 | // |
86 | // depthRTT=createRenderTargetTexture(1024,1024); | 87 | // depthRTT=createRenderTargetTexture(1024,1024); |
87 | // glowRTT=createRenderTargetTexture(512,512); | 88 | // glowRTT=createRenderTargetTexture(512,512); |
88 | // blurFX=new RDGE.fx.fxBlur([256,128,64],true); | 89 | // blurFX=new RDGE.fx.fxBlur([256,128,64],true); |
89 | // mainRTT=createRenderTargetTexture(1024,1024); | 90 | // mainRTT=createRenderTargetTexture(1024,1024); |
90 | // ssaoFX=new RDGE.fx.fxSSAO(true); | 91 | // ssaoFX=new RDGE.fx.fxSSAO(true); |
91 | // ssaoRTT=createRenderTargetTexture(1024,1024); | 92 | // ssaoRTT=createRenderTargetTexture(1024,1024); |
92 | // depthRTT=createRenderTargetTexture(1024,1024); | 93 | // depthRTT=createRenderTargetTexture(1024,1024); |
93 | // hrDepthRTT=createRenderTargetTexture(1024,1024); | 94 | // hrDepthRTT=createRenderTargetTexture(1024,1024); |
94 | // hrDepthRTTSSAO=createRenderTargetTexture(1024,1024); | 95 | // hrDepthRTTSSAO=createRenderTargetTexture(1024,1024); |
95 | // mainSceneQuad=new RDGE.ScreenQuad(mainRTT); | 96 | // mainSceneQuad=new RDGE.ScreenQuad(mainRTT); |
96 | // mainSceneQuad.initialize(RDGE.renderInitScreenQuad); | 97 | // mainSceneQuad.initialize(RDGE.renderInitScreenQuad); |
97 | 98 | ||
98 | // cubelight_Glow = this.renderer.createTexture("assets/images/cubelight_Glow.png"); | 99 | // cubelight_Glow = this.renderer.createTexture("assets/images/cubelight_Glow.png"); |
99 | // lightRack_Glow = this.renderer.createTexture("assets/images/lightRack_Glow.png"); | 100 | // lightRack_Glow = this.renderer.createTexture("assets/images/lightRack_Glow.png"); |
100 | // black = this.renderer.createTexture("assets/images/black.png"); | 101 | // black = this.renderer.createTexture("assets/images/black.png"); |
101 | 102 | ||
102 | // renderGlow=false; | 103 | // renderGlow=false; |
103 | 104 | ||
104 | // // depth map and normal proc | 105 | // // depth map and normal proc |
105 | // renderProcDepth=new GenerateDepthMap(); | 106 | // renderProcDepth=new GenerateDepthMap(); |
106 | // renderProcGlow=new GenerateGlowMap(); | 107 | // renderProcGlow=new GenerateGlowMap(); |
107 | // renderProc=new RDGE.SceneRender(); | 108 | // renderProc=new RDGE.SceneRender(); |
108 | // renderProcCreateShadowMap=new SceneCreateShadowMap(); | 109 | // renderProcCreateShadowMap=new SceneCreateShadowMap(); |
109 | // renderProcHighResDepth=new GenerateHighResDepthMap(); | 110 | // renderProcHighResDepth=new GenerateHighResDepthMap(); |
110 | 111 | ||
111 | // RDGE.globals.engine.defaultContext.textureList.push({ 'handle': hrDepthRTT,'unit': 7,'type': RDGE.UNIFORMTYPE.TEXTURE2D }); | 112 | // RDGE.globals.engine.defaultContext.textureList.push({ 'handle': hrDepthRTT,'unit': 7,'type': RDGE.UNIFORMTYPE.TEXTURE2D }); |
112 | // RDGE.globals.engine.defaultContext.uniforms.push({ 'name': "depthMap",'value': [hrDepthRTT] }); | 113 | // RDGE.globals.engine.defaultContext.uniforms.push({ 'name': "depthMap",'value': [hrDepthRTT] }); |
113 | 114 | ||
114 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |