diff options
author | John Mayhew | 2012-04-02 16:28:39 -0700 |
---|---|---|
committer | John Mayhew | 2012-04-02 16:28:39 -0700 |
commit | b4155fb4c33675a8a7cd37473513718043fdf0ba (patch) | |
tree | 3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/helper-classes/RDGE/src/core/script/run_state.js | |
parent | 5ba9aeac94c86049423fd5d4b37b277263939c13 (diff) | |
parent | c6de22bf42be90b403491b5f87b1818d9020310c (diff) | |
download | ninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts:
js/helper-classes/RDGE/rdge-compiled.js
js/helper-classes/RDGE/runtime/GLRuntime.js
js/helper-classes/RDGE/src/core/script/MeshManager.js
js/helper-classes/RDGE/src/core/script/engine.js
js/helper-classes/RDGE/src/core/script/fx/ssao.js
js/helper-classes/RDGE/src/core/script/init_state.js
js/helper-classes/RDGE/src/core/script/run_state.js
js/helper-classes/RDGE/src/core/script/scenegraphNodes.js
js/helper-classes/RDGE/src/core/script/utilities.js
js/helper-classes/RDGE/src/tools/compile-rdge-core.bat
js/helper-classes/RDGE/src/tools/compile-rdge-core.sh
js/helper-classes/RDGE/src/tools/rdge-compiled.js
js/lib/drawing/world.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/deform-material.js
js/lib/rdge/materials/flat-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/linear-gradient-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-blur-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/relief-tunnel-material.js
js/lib/rdge/materials/square-tunnel-material.js
js/lib/rdge/materials/star-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/tunnel-material.js
js/lib/rdge/materials/twist-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/uber-material.js
js/lib/rdge/materials/water-material.js
js/lib/rdge/materials/z-invert-material.js
js/preloader/Preloader.js
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 | 416 |
1 files changed, 208 insertions, 208 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 7f08bd6c..d2f05fad 100755 --- a/js/helper-classes/RDGE/src/core/script/run_state.js +++ b/js/helper-classes/RDGE/src/core/script/run_state.js | |||
@@ -7,47 +7,47 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
7 | var RDGE = RDGE || {}; | 7 | var RDGE = RDGE || {}; |
8 | 8 | ||
9 | RDGE.RunState = function (userRunState, context) { | 9 | RDGE.RunState = function (userRunState, context) { |
10 | this.name = "RunState"; | 10 | this.name = "RunState"; |
11 | this.userRunState = userRunState != undefined ? userRunState : new RDGE.core.RDGEState; | 11 | this.userRunState = userRunState != undefined ? userRunState : new RDGE.core.RDGEState; |
12 | this.hasUserState = userRunState != undefined ? true : false; | 12 | this.hasUserState = userRunState != undefined ? true : false; |
13 | this.renderer = context.renderer; | 13 | this.renderer = context.renderer; |
14 | this.initialized = false; | 14 | this.initialized = false; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | RDGE.RunState.prototype.Init = function () { | 17 | RDGE.RunState.prototype.Init = function () { |
18 | this.initialized = true; | 18 | this.initialized = true; |
19 | var width = this.renderer.vpWidth; | 19 | var width = this.renderer.vpWidth; |
20 | var height = this.renderer.vpHeight; | 20 | var height = this.renderer.vpHeight; |
21 | var cam = new RDGE.camera(); | 21 | var cam = new RDGE.camera(); |
22 | cam.setPerspective(45.0, width / height, 1.0, 100.0); | 22 | cam.setPerspective(45.0, width / height, 1.0, 100.0); |
23 | cam.setLookAt([0, 0, 20], [0, 0, 0], RDGE.vec3.up()); | 23 | cam.setLookAt([0, 0, 20], [0, 0, 0], RDGE.vec3.up()); |
24 | 24 | ||
25 | this.renderer.cameraManager().setActiveCamera(cam); | 25 | this.renderer.cameraManager().setActiveCamera( cam ); |
26 | 26 | ||
27 | if (this.hasUserState && this.userRunState.init != undefined) { | 27 | if (this.hasUserState && this.userRunState.init != undefined) { |
28 | this.userRunState.init(); | 28 | this.userRunState.init(); |
29 | } | 29 | } |
30 | 30 | ||
31 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) | 31 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) |
32 | this.userRunState.onRunState(); | 32 | this.userRunState.onRunState(); |
33 | |||
33 | 34 | ||
35 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
34 | 36 | ||
35 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 37 | // if(theScene=="Robots_rt") { |
36 | 38 | // g_enableShadowMapping=false; | |
37 | // if(theScene=="Robots_rt") { | 39 | // g_showSSAO=false; |
38 | // g_enableShadowMapping=false; | ||
39 | // g_showSSAO=false; | ||
40 | // RDGE.globals.engine.defaultContext.uniforms[1]={ 'name': "u_lightAmb",'value': [0.5,0.5,0.5,1.0] }; | 40 | // RDGE.globals.engine.defaultContext.uniforms[1]={ 'name': "u_lightAmb",'value': [0.5,0.5,0.5,1.0] }; |
41 | // RDGE.globals.engine.defaultContext.uniforms[7]={ 'name': "u_matAmbient",'value': [0.8,0.8,0.8,1] }; | 41 | // RDGE.globals.engine.defaultContext.uniforms[7]={ 'name': "u_matAmbient",'value': [0.8,0.8,0.8,1] }; |
42 | // } | 42 | // } |
43 | 43 | ||
44 | 44 | ||
45 | // g_hrDepthMapGenShader=createShader(this.renderer.ctx,'depthMap_vshader','depthMap_fshader',["vert","normal"]); | 45 | // g_hrDepthMapGenShader=createShader(this.renderer.ctx,'depthMap_vshader','depthMap_fshader',["vert","normal"]); |
46 | // g_depthMapGenShader=createShader(this.renderer.ctx,'norm_depth_vshader','norm_depth_fshader',["vert","normal"]); | 46 | // g_depthMapGenShader=createShader(this.renderer.ctx,'norm_depth_vshader','norm_depth_fshader',["vert","normal"]); |
47 | 47 | ||
48 | // // shadow light | 48 | // // shadow light |
49 | // g_mainLight=new RDGE.camera(); // camera to represent our light's point of view | 49 | // g_mainLight=new RDGE.camera(); // camera to represent our light's point of view |
50 | // g_mainLight.setPerspective(45.0,width/height,1.0,200.0); | 50 | // g_mainLight.setPerspective(45.0,width/height,1.0,200.0); |
51 | // g_mainLight.setLookAt([-60,17,-15],[-5,-5,15],RDGE.vec3.up()); // lights position and point of view | 51 | // g_mainLight.setLookAt([-60,17,-15],[-5,-5,15],RDGE.vec3.up()); // lights position and point of view |
52 | // g_mainLight.mvMatrix=RDGE.mat4.copy(g_mainLight.view); // hold model view transform | 52 | // g_mainLight.mvMatrix=RDGE.mat4.copy(g_mainLight.view); // hold model view transform |
53 | // g_mainLight.invViewMatrix=RDGE.mat4.inverse(g_mainLight.view); | 53 | // g_mainLight.invViewMatrix=RDGE.mat4.inverse(g_mainLight.view); |
@@ -55,49 +55,49 @@ RDGE.RunState.prototype.Init = function () { | |||
55 | // g_mainLight.shadowMatrix=RDGE.mat4.identity(); // shadow matrix creates shadow bias | 55 | // g_mainLight.shadowMatrix=RDGE.mat4.identity(); // shadow matrix creates shadow bias |
56 | // g_mainLight.shadowMatrix=RDGE.mat4.scale(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); | 56 | // g_mainLight.shadowMatrix=RDGE.mat4.scale(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); |
57 | // g_mainLight.shadowMatrix=RDGE.mat4.translate(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); | 57 | // g_mainLight.shadowMatrix=RDGE.mat4.translate(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); |
58 | // //g_cameraManager.setActiveCamera( g_mainLight ); | 58 | // //g_cameraManager.setActiveCamera( g_mainLight ); |
59 | // | 59 | // |
60 | // uniformEnableGlow = this.renderer.ctx.getUniformLocation(RDGE.globals.engine.defaultContext.shaderProg, "u_renderGlow"); | 60 | // uniformEnableGlow = this.renderer.ctx.getUniformLocation(RDGE.globals.engine.defaultContext.shaderProg, "u_renderGlow"); |
61 | // | 61 | // |
62 | // depthRTT=createRenderTargetTexture(1024,1024); | 62 | // depthRTT=createRenderTargetTexture(1024,1024); |
63 | // glowRTT=createRenderTargetTexture(512,512); | 63 | // glowRTT=createRenderTargetTexture(512,512); |
64 | // blurFX=new RDGE.fx.fxBlur([256,128,64],true); | 64 | // blurFX=new RDGE.fx.fxBlur([256,128,64],true); |
65 | // mainRTT=createRenderTargetTexture(1024,1024); | 65 | // mainRTT=createRenderTargetTexture(1024,1024); |
66 | // ssaoFX=new RDGE.fx.fxSSAO(true); | 66 | // ssaoFX=new RDGE.fx.fxSSAO(true); |
67 | // ssaoRTT=createRenderTargetTexture(1024,1024); | 67 | // ssaoRTT=createRenderTargetTexture(1024,1024); |
68 | // depthRTT=createRenderTargetTexture(1024,1024); | 68 | // depthRTT=createRenderTargetTexture(1024,1024); |
69 | // hrDepthRTT=createRenderTargetTexture(1024,1024); | 69 | // hrDepthRTT=createRenderTargetTexture(1024,1024); |
70 | // hrDepthRTTSSAO=createRenderTargetTexture(1024,1024); | 70 | // hrDepthRTTSSAO=createRenderTargetTexture(1024,1024); |
71 | // mainSceneQuad=new RDGE.ScreenQuad(mainRTT); | 71 | // mainSceneQuad=new RDGE.ScreenQuad(mainRTT); |
72 | // mainSceneQuad.initialize(RDGE.renderInitScreenQuad); | 72 | // mainSceneQuad.initialize(RDGE.renderInitScreenQuad); |
73 | 73 | ||
74 | // cubelight_Glow = this.renderer.createTexture("assets/images/cubelight_Glow.png"); | 74 | // cubelight_Glow = this.renderer.createTexture("assets/images/cubelight_Glow.png"); |
75 | // lightRack_Glow = this.renderer.createTexture("assets/images/lightRack_Glow.png"); | 75 | // lightRack_Glow = this.renderer.createTexture("assets/images/lightRack_Glow.png"); |
76 | // black = this.renderer.createTexture("assets/images/black.png"); | 76 | // black = this.renderer.createTexture("assets/images/black.png"); |
77 | 77 | ||
78 | // renderGlow=false; | 78 | // renderGlow=false; |
79 | 79 | ||
80 | // // depth map and normal proc | 80 | // // depth map and normal proc |
81 | // renderProcDepth=new GenerateDepthMap(); | 81 | // renderProcDepth=new GenerateDepthMap(); |
82 | // renderProcGlow=new GenerateGlowMap(); | 82 | // renderProcGlow=new GenerateGlowMap(); |
83 | // renderProc=new RDGE.SceneRender(); | 83 | // renderProc=new RDGE.SceneRender(); |
84 | // renderProcCreateShadowMap=new SceneCreateShadowMap(); | 84 | // renderProcCreateShadowMap=new SceneCreateShadowMap(); |
85 | // renderProcHighResDepth=new GenerateHighResDepthMap(); | 85 | // renderProcHighResDepth=new GenerateHighResDepthMap(); |
86 | 86 | ||
87 | // RDGE.globals.engine.defaultContext.textureList.push({ 'handle': hrDepthRTT,'unit': 7,'type': RDGE.UNIFORMTYPE.TEXTURE2D }); | 87 | // RDGE.globals.engine.defaultContext.textureList.push({ 'handle': hrDepthRTT,'unit': 7,'type': RDGE.UNIFORMTYPE.TEXTURE2D }); |
88 | // RDGE.globals.engine.defaultContext.uniforms.push({ 'name': "depthMap",'value': [hrDepthRTT] }); | 88 | // RDGE.globals.engine.defaultContext.uniforms.push({ 'name': "depthMap",'value': [hrDepthRTT] }); |
89 | 89 | ||
90 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 90 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
91 | }; | 91 | }; |
92 | 92 | ||
93 | RDGE.RunState.prototype.ReInit = function () { | 93 | RDGE.RunState.prototype.ReInit = function () { |
94 | if (!this.initialized) { | 94 | if (!this.initialized) { |
95 | this.Init(); | 95 | this.Init(); |
96 | } | 96 | } |
97 | else { | 97 | else { |
98 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) | 98 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) |
99 | this.userRunState.onRunState(); | 99 | this.userRunState.onRunState(); |
100 | } | 100 | } |
101 | }; | 101 | }; |
102 | 102 | ||
103 | RDGE.RunState.prototype.Update = function (dt) { | 103 | RDGE.RunState.prototype.Update = function (dt) { |
@@ -106,105 +106,105 @@ RDGE.RunState.prototype.Update = function (dt) { | |||
106 | 106 | ||
107 | RDGE.RunState.prototype.Resize = function () { | 107 | RDGE.RunState.prototype.Resize = function () { |
108 | if (RDGE.globals.engine.lastWindowWidth == window.innerWidth && RDGE.globals.engine.lastWindowHeight == window.innerHeight) { | 108 | if (RDGE.globals.engine.lastWindowWidth == window.innerWidth && RDGE.globals.engine.lastWindowHeight == window.innerHeight) { |
109 | this.userRunState.resize(); | 109 | this.userRunState.resize(); |
110 | RDGE.globals.engine.lastWindowWidth = window.innerWidth; | 110 | RDGE.globals.engine.lastWindowWidth = window.innerWidth; |
111 | RDGE.globals.engine.lastWindowHeight = window.innerHeight; | 111 | RDGE.globals.engine.lastWindowHeight = window.innerHeight; |
112 | } | 112 | } |
113 | }; | 113 | }; |
114 | 114 | ||
115 | RDGE.RunState.prototype.Draw = function () { | 115 | RDGE.RunState.prototype.Draw = function () { |
116 | var width = this.renderer.vpWidth; | 116 | var width = this.renderer.vpWidth; |
117 | var height = this.renderer.vpHeight; | 117 | var height = this.renderer.vpHeight; |
118 | 118 | ||
119 | // this.renderer._clear(); | 119 | // this.renderer._clear(); |
120 | 120 | ||
121 | this.userRunState.draw(); | 121 | this.userRunState.draw(); |
122 | 122 | ||
123 | // ~~~~ removing post process till multi-context and post process system is in place | 123 | // ~~~~ removing post process till multi-context and post process system is in place |
124 | // if(this.currentScene==null) | 124 | // if(this.currentScene==null) |
125 | // return; < |