diff options
author | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
commit | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch) | |
tree | 3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/helper-classes/RDGE/src/core/script/run_state.js | |
parent | c0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff) | |
parent | 40c6eb2c06b34f65a74d59ef9687251952858bab (diff) | |
download | ninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz |
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts:
js/components/gradientpicker.reel/gradientpicker.js
js/components/tools-properties/text-properties.reel/text-properties.js
js/document/views/base.js
js/document/views/design.js
js/helper-classes/3D/StageLine.js
js/helper-classes/3D/draw-utils.js
js/lib/drawing/world.js
js/lib/geom/circle.js
js/lib/geom/line.js
js/lib/geom/rectangle.js
js/lib/geom/shape-primitive.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/flag-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/mandel-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/water-material.js
js/panels/Materials/materials-library-panel.reel/materials-library-panel.html
js/panels/Materials/materials-library-panel.reel/materials-library-panel.js
js/panels/Materials/materials-popup.reel/materials-popup.html
js/panels/Materials/materials-popup.reel/materials-popup.js
js/tools/LineTool.js
Signed-off-by: Valerio Virgillito <valerio@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 | 730 |
1 files changed, 365 insertions, 365 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..bb86f72e 100755 --- a/js/helper-classes/RDGE/src/core/script/run_state.js +++ b/js/helper-classes/RDGE/src/core/script/run_state.js | |||
@@ -26,368 +26,368 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | 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 | 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | POSSIBILITY OF SUCH DAMAGE. |
29 | </copyright> */ | 29 | </copyright> */ |
30 | 30 | ||
31 | var RDGE = RDGE || {}; | 31 | var RDGE = RDGE || {}; |
32 | 32 | ||
33 | RDGE.RunState = function (userRunState, context) { | 33 | RDGE.RunState = function (userRunState, context) { |
34 | this.name = "RunState"; | 34 | this.name = "RunState"; |
35 | this.userRunState = userRunState != undefined ? userRunState : new RDGE.core.RDGEState; | 35 | this.userRunState = userRunState != undefined ? userRunState : new RDGE.core.RDGEState; |
36 | this.hasUserState = userRunState != undefined ? true : false; | 36 | this.hasUserState = userRunState != undefined ? true : false; |
37 | this.renderer = context.renderer; | 37 | this.renderer = context.renderer; |
38 | this.initialized = false; | 38 | this.initialized = false; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | RDGE.RunState.prototype.Init = function () { | 41 | RDGE.RunState.prototype.Init = function () { |
42 | this.initialized = true; | 42 | this.initialized = true; |
43 | var width = this.renderer.vpWidth; | 43 | var width = this.renderer.vpWidth; |
44 | var height = this.renderer.vpHeight; | 44 | var height = this.renderer.vpHeight; |
45 | var cam = new RDGE.camera(); | 45 | var cam = new RDGE.camera(); |
46 | cam.setPerspective(45.0, width / height, 1.0, 100.0); | 46 | cam.setPerspective(45.0, width / height, 1.0, 100.0); |
47 | cam.setLookAt([0, 0, 20], [0, 0, 0], RDGE.vec3.up()); | 47 | cam.setLookAt([0, 0, 20], [0, 0, 0], RDGE.vec3.up()); |
48 | 48 | ||
49 | this.renderer.cameraManager().setActiveCamera( cam ); | 49 | this.renderer.cameraManager().setActiveCamera( cam ); |
50 | 50 | ||
51 | if (this.hasUserState && this.userRunState.init != undefined) { | 51 | if (this.hasUserState && this.userRunState.init != undefined) { |
52 | this.userRunState.init(); | 52 | this.userRunState.init(); |
53 | } | 53 | } |
54 | 54 | ||
55 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) | 55 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) |
56 | this.userRunState.onRunState(); | 56 | this.userRunState.onRunState(); |
57 | 57 | ||
58 | 58 | ||
59 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 59 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
60 | 60 | ||
61 | // if(theScene=="Robots_rt") { | 61 | // if(theScene=="Robots_rt") { |
62 | // g_enableShadowMapping=false; | 62 | // g_enableShadowMapping=false; |
63 | // g_showSSAO=false; | 63 | // g_showSSAO=false; |
64 | // RDGE.globals.engine.defaultContext.uniforms[1]={ 'name': "u_lightAmb",'value': [0.5,0.5,0.5,1.0] }; | 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[7]={ 'name': "u_matAmbient",'value': [0.8,0.8,0.8,1] }; | 65 | // RDGE.globals.engine.defaultContext.uniforms[7]={ 'name': "u_matAmbient",'value': [0.8,0.8,0.8,1] }; |
66 | // } | 66 | // } |
67 | 67 | ||
68 | 68 | ||
69 | // g_hrDepthMapGenShader=createShader(this.renderer.ctx,'depthMap_vshader','depthMap_fshader',["vert","normal"]); | 69 | // 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"]); | 70 | // g_depthMapGenShader=createShader(this.renderer.ctx,'norm_depth_vshader','norm_depth_fshader',["vert","normal"]); |
71 | 71 | ||
72 | // // shadow light | 72 | // // shadow light |
73 | // g_mainLight=new RDGE.camera(); // camera to represent our light's point of view | 73 | // 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); | 74 | // 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 | 75 | // 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 | 76 | // g_mainLight.mvMatrix=RDGE.mat4.copy(g_mainLight.view); // hold model view transform |
77 | // g_mainLight.invViewMatrix=RDGE.mat4.inverse(g_mainLight.view); | 77 | // g_mainLight.invViewMatrix=RDGE.mat4.inverse(g_mainLight.view); |
78 | // g_mainLight.mvpMatrix=RDGE.mat4.identity(); | 78 | // g_mainLight.mvpMatrix=RDGE.mat4.identity(); |
79 | // g_mainLight.shadowMatrix=RDGE.mat4.identity(); // shadow matrix creates shadow bias | 79 | // 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]); | 80 | // 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]); | 81 | // g_mainLight.shadowMatrix=RDGE.mat4.translate(g_mainLight.shadowMatrix,[0.5,0.5,0.5]); |
82 | // //g_cameraManager.setActiveCamera( g_mainLight ); | 82 | // //g_cameraManager.setActiveCamera( g_mainLight ); |
83 | // | 83 | // |
84 | // uniformEnableGlow = this.renderer.ctx.getUniformLocation(RDGE.globals.engine.defaultContext.shaderProg, "u_renderGlow"); | 84 | // uniformEnableGlow = this.renderer.ctx.getUniformLocation(RDGE.globals.engine.defaultContext.shaderProg, "u_renderGlow"); |
85 | // | 85 | // |
86 | // depthRTT=createRenderTargetTexture(1024,1024); | 86 | // depthRTT=createRenderTargetTexture(1024,1024); |
87 | // glowRTT=createRenderTargetTexture(512,512); | 87 | // glowRTT=createRenderTargetTexture(512,512); |
88 | // blurFX=new RDGE.fx.fxBlur([256,128,64],true); | 88 | // blurFX=new RDGE.fx.fxBlur([256,128,64],true); |
89 | // mainRTT=createRenderTargetTexture(1024,1024); | 89 | // mainRTT=createRenderTargetTexture(1024,1024); |
90 | // ssaoFX=new RDGE.fx.fxSSAO(true); | 90 | // ssaoFX=new RDGE.fx.fxSSAO(true); |
91 | // ssaoRTT=createRenderTargetTexture(1024,1024); | 91 | // ssaoRTT=createRenderTargetTexture(1024,1024); |
92 | // depthRTT=createRenderTargetTexture(1024,1024); | 92 | // depthRTT=createRenderTargetTexture(1024,1024); |
93 | // hrDepthRTT=createRenderTargetTexture(1024,1024); | 93 | // hrDepthRTT=createRenderTargetTexture(1024,1024); |
94 | // hrDepthRTTSSAO=createRenderTargetTexture(1024,1024); | 94 | // hrDepthRTTSSAO=createRenderTargetTexture(1024,1024); |
95 | // mainSceneQuad=new RDGE.ScreenQuad(mainRTT); | 95 | // mainSceneQuad=new RDGE.ScreenQuad(mainRTT); |
96 | // mainSceneQuad.initialize(RDGE.renderInitScreenQuad); | 96 | // mainSceneQuad.initialize(RDGE.renderInitScreenQuad); |
97 | 97 | ||
98 | // cubelight_Glow = this.renderer.createTexture("assets/images/cubelight_Glow.png"); | 98 | // cubelight_Glow = this.renderer.createTexture("assets/images/cubelight_Glow.png"); |
99 | // lightRack_Glow = this.renderer.createTexture("assets/images/lightRack_Glow.png"); | 99 | // lightRack_Glow = this.renderer.createTexture("assets/images/lightRack_Glow.png"); |
100 | // black = this.renderer.createTexture("assets/images/black.png"); | 100 | // black = this.renderer.createTexture("assets/images/black.png"); |
101 | 101 | ||
102 | // renderGlow=false; | 102 | // renderGlow=false; |
103 | 103 | ||
104 | // // depth map and normal proc | 104 | // // depth map and normal proc |
105 | // renderProcDepth=new GenerateDepthMap(); | 105 | // renderProcDepth=new GenerateDepthMap(); |
106 | // renderProcGlow=new GenerateGlowMap(); | 106 | // renderProcGlow=new GenerateGlowMap(); |
107 | // renderProc=new RDGE.SceneRender(); | 107 | // renderProc=new RDGE.SceneRender(); |
108 | // renderProcCreateShadowMap=new SceneCreateShadowMap(); | 108 | // renderProcCreateShadowMap=new SceneCreateShadowMap(); |
109 | // renderProcHighResDepth=new GenerateHighResDepthMap(); | 109 | // renderProcHighResDepth=new GenerateHighResDepthMap(); |
110 | 110 | ||
111 | // RDGE.globals.engine.defaultContext.textureList.push({ 'handle': hrDepthRTT,'unit': 7,'type': RDGE.UNIFORMTYPE.TEXTURE2D }); | 111 | // 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] }); | 112 | // RDGE.globals.engine.defaultContext.uniforms.push({ 'name': "depthMap",'value': [hrDepthRTT] }); |
113 | 113 | ||
114 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 114 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
115 | }; | 115 | }; |
116 | 116 | ||
117 | RDGE.RunState.prototype.ReInit = function () { | 117 | RDGE.RunState.prototype.ReInit = function () { |
118 | if (!this.initialized) { | 118 | if (!this.initialized) { |
119 | this.Init(); | 119 | this.Init(); |
120 | } | 120 | } |
121 | else { | 121 | else { |
122 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) | 122 | if (this.hasUserState && this.userRunState && this.userRunState.onRunState) |
123 | this.userRunState.onRunState(); | 123 | this.userRunState.onRunState(); |
124 | } | 124 | } |
125 | }; | 125 | }; |
126 | 126 | ||
127 | RDGE.RunState.prototype.Update = function (dt) { | 127 | RDGE.RunState.prototype.Update = function (dt) { |
128 | this.userRunState.update(dt); | 128 | this.userRunState.update(dt); |
129 | }; | 129 | }; |
130 | 130 | ||
131 | RDGE.RunState.prototype.Resize = function () { | 131 | RDGE.RunState.prototype.Resize = function () { |
132 | if (RDGE.globals.engine.lastWindowWidth == window.innerWidth && RDGE.globals.engine.lastWindowHeight == window.innerHeight) { | 132 | if (RDGE.globals.engine.lastWindowWidth == window.innerWidth && RDGE.globals.engine.lastWindowHeight == window.innerHeight) { |
133 | this.userRunState.resize(); | 133 | this.userRunState.resize(); |
134 | RDGE.globals.engine.lastWindowWidth = window.innerWidth; | 134 | RDGE.globals.engine.lastWindowWidth = window.innerWidth; |
135 | RDGE.globals.engine.lastWindowHeight = window.innerHeight; | 135 | RDGE.globals.engine.lastWindowHeight = window.innerHeight; |
136 | } | 136 | } |
137 | }; | 137 | }; |
138 | 138 |