From 3a754133dbc138390503341fd2e9beba3e43aa4b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 27 Jan 2012 12:05:17 -0800 Subject: Merged old FileIO --- js/helper-classes/RDGE/src/core/script/MeshManager.js | 0 js/helper-classes/RDGE/src/core/script/RenderInitProcs.js | 0 js/helper-classes/RDGE/src/core/script/RenderProcs.js | 0 js/helper-classes/RDGE/src/core/script/ScreenQuad.js | 0 js/helper-classes/RDGE/src/core/script/ShaderManager.js | 0 js/helper-classes/RDGE/src/core/script/TextureManager.js | 0 js/helper-classes/RDGE/src/core/script/animation.js | 0 js/helper-classes/RDGE/src/core/script/box.js | 0 js/helper-classes/RDGE/src/core/script/camera.js | 0 js/helper-classes/RDGE/src/core/script/engine.js | 0 js/helper-classes/RDGE/src/core/script/fx/blur.js | 0 js/helper-classes/RDGE/src/core/script/fx/ssao.js | 0 js/helper-classes/RDGE/src/core/script/init_state.js | 0 js/helper-classes/RDGE/src/core/script/input.js | 0 js/helper-classes/RDGE/src/core/script/jpass.js | 0 js/helper-classes/RDGE/src/core/script/jshader.js | 0 js/helper-classes/RDGE/src/core/script/lightmanager.js | 0 js/helper-classes/RDGE/src/core/script/math/mat4.js | 0 js/helper-classes/RDGE/src/core/script/math/quat.js | 0 js/helper-classes/RDGE/src/core/script/math/vec2.js | 0 js/helper-classes/RDGE/src/core/script/math/vec3.js | 0 js/helper-classes/RDGE/src/core/script/math/vec4.js | 0 js/helper-classes/RDGE/src/core/script/objectManager.js | 0 js/helper-classes/RDGE/src/core/script/particle.js | 0 js/helper-classes/RDGE/src/core/script/precompiled.js | 0 js/helper-classes/RDGE/src/core/script/renderUtils.js | 0 js/helper-classes/RDGE/src/core/script/rendercontext.js | 0 js/helper-classes/RDGE/src/core/script/renderer.js | 0 js/helper-classes/RDGE/src/core/script/run_state.js | 0 js/helper-classes/RDGE/src/core/script/runtime.js | 0 js/helper-classes/RDGE/src/core/script/scenegraph.js | 0 js/helper-classes/RDGE/src/core/script/scenegraphNodes.js | 0 js/helper-classes/RDGE/src/core/script/shadowLight.js | 0 js/helper-classes/RDGE/src/core/script/sockets.js | 0 js/helper-classes/RDGE/src/core/script/ubershader.js | 0 js/helper-classes/RDGE/src/core/script/util/dbgpanel.js | 0 js/helper-classes/RDGE/src/core/script/util/fpsTracker.js | 0 js/helper-classes/RDGE/src/core/script/util/statTracker.js | 0 js/helper-classes/RDGE/src/core/script/utilities.js | 0 39 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/MeshManager.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/RenderInitProcs.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/RenderProcs.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/ScreenQuad.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/ShaderManager.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/TextureManager.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/animation.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/box.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/camera.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/engine.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/fx/blur.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/fx/ssao.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/init_state.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/input.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/jpass.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/jshader.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/lightmanager.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/math/mat4.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/math/quat.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/math/vec2.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/math/vec3.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/math/vec4.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/objectManager.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/particle.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/precompiled.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/renderUtils.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/rendercontext.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/renderer.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/run_state.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/runtime.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/scenegraph.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/scenegraphNodes.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/shadowLight.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/sockets.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/ubershader.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/util/dbgpanel.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/util/fpsTracker.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/util/statTracker.js mode change 100644 => 100755 js/helper-classes/RDGE/src/core/script/utilities.js (limited to 'js/helper-classes/RDGE/src') diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/RenderInitProcs.js b/js/helper-classes/RDGE/src/core/script/RenderInitProcs.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/RenderProcs.js b/js/helper-classes/RDGE/src/core/script/RenderProcs.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/ScreenQuad.js b/js/helper-classes/RDGE/src/core/script/ScreenQuad.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/ShaderManager.js b/js/helper-classes/RDGE/src/core/script/ShaderManager.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/TextureManager.js b/js/helper-classes/RDGE/src/core/script/TextureManager.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/animation.js b/js/helper-classes/RDGE/src/core/script/animation.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/box.js b/js/helper-classes/RDGE/src/core/script/box.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/camera.js b/js/helper-classes/RDGE/src/core/script/camera.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/engine.js b/js/helper-classes/RDGE/src/core/script/engine.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/fx/blur.js b/js/helper-classes/RDGE/src/core/script/fx/blur.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/fx/ssao.js b/js/helper-classes/RDGE/src/core/script/fx/ssao.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/init_state.js b/js/helper-classes/RDGE/src/core/script/init_state.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/input.js b/js/helper-classes/RDGE/src/core/script/input.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/jpass.js b/js/helper-classes/RDGE/src/core/script/jpass.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/jshader.js b/js/helper-classes/RDGE/src/core/script/jshader.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/lightmanager.js b/js/helper-classes/RDGE/src/core/script/lightmanager.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/math/mat4.js b/js/helper-classes/RDGE/src/core/script/math/mat4.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/math/quat.js b/js/helper-classes/RDGE/src/core/script/math/quat.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/math/vec2.js b/js/helper-classes/RDGE/src/core/script/math/vec2.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/math/vec3.js b/js/helper-classes/RDGE/src/core/script/math/vec3.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/math/vec4.js b/js/helper-classes/RDGE/src/core/script/math/vec4.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/objectManager.js b/js/helper-classes/RDGE/src/core/script/objectManager.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/particle.js b/js/helper-classes/RDGE/src/core/script/particle.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/precompiled.js b/js/helper-classes/RDGE/src/core/script/precompiled.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/renderUtils.js b/js/helper-classes/RDGE/src/core/script/renderUtils.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/rendercontext.js b/js/helper-classes/RDGE/src/core/script/rendercontext.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/renderer.js b/js/helper-classes/RDGE/src/core/script/renderer.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/run_state.js b/js/helper-classes/RDGE/src/core/script/run_state.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/runtime.js b/js/helper-classes/RDGE/src/core/script/runtime.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/scenegraph.js b/js/helper-classes/RDGE/src/core/script/scenegraph.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js b/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/shadowLight.js b/js/helper-classes/RDGE/src/core/script/shadowLight.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/sockets.js b/js/helper-classes/RDGE/src/core/script/sockets.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/ubershader.js b/js/helper-classes/RDGE/src/core/script/ubershader.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/util/dbgpanel.js b/js/helper-classes/RDGE/src/core/script/util/dbgpanel.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/util/fpsTracker.js b/js/helper-classes/RDGE/src/core/script/util/fpsTracker.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/util/statTracker.js b/js/helper-classes/RDGE/src/core/script/util/statTracker.js old mode 100644 new mode 100755 diff --git a/js/helper-classes/RDGE/src/core/script/utilities.js b/js/helper-classes/RDGE/src/core/script/utilities.js old mode 100644 new mode 100755 -- cgit v1.2.3 From 191cb96b3b4e1e5aa805211e5ab8dbd6aa075881 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 9 Feb 2012 10:09:13 -0800 Subject: Merging WebGL changes that allow users to modify different shape instances. Also, merging in changes that improve rendering performance by not updating static materials. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/RDGE/src/core/script/engine.js | 18 ++++++------ .../RDGE/src/core/script/init_state.js | 7 ++++- js/helper-classes/RDGE/src/core/script/jshader.js | 6 ++-- js/helper-classes/RDGE/src/core/script/renderer.js | 32 ++++++++++++++++++---- .../RDGE/src/core/script/run_state.js | 10 ++++++- js/helper-classes/RDGE/src/core/script/runtime.js | 2 +- 6 files changed, 55 insertions(+), 20 deletions(-) (limited to 'js/helper-classes/RDGE/src') diff --git a/js/helper-classes/RDGE/src/core/script/engine.js b/js/helper-classes/RDGE/src/core/script/engine.js index 6fe964c7..5bc9305c 100644 --- a/js/helper-classes/RDGE/src/core/script/engine.js +++ b/js/helper-classes/RDGE/src/core/script/engine.js @@ -377,13 +377,13 @@ Engine.prototype.getRDGEPanel=function(panelID) return panelObjectManager.handleToObject(panelID); } -Engine.prototype.registerCanvas = function(canvas, runState) { - if (canvas && this.getContext(canvas.id)) - return; - +Engine.prototype.registerCanvas = function(canvas, runState) { + if (canvas && this.getContext(canvas.rdgeid)) + return; + canvas.renderer = new _renderer(canvas); // create the renderer for the context - this.canvasToRendererMap[canvas.id] = canvas; // store the canvas in the context map - canvas.renderer.id = canvas.id; + this.canvasToRendererMap[canvas.rdgeid] = canvas; // store the canvas in the context map + canvas.renderer.id = canvas.rdgeid; // configure the state manager for this context var stateMan = new stateManager(); @@ -391,11 +391,11 @@ Engine.prototype.registerCanvas = function(canvas, runState) { // add this context to the contextManager and attach the handle to DOM canvas for user retrieval var context = new contextDef(); - context.id = canvas.id; + context.id = canvas.rdgeid; context.renderer = canvas.renderer; context.ctxStateManager = stateMan; context.startUpState; - context.fpsTracker = new fpsTracker(canvas.id); + context.fpsTracker = new fpsTracker(canvas.rdgeid); context.renderer.mvMatrix = mat4.identity(); context.renderer.invMvMatrix = mat4.identity(); @@ -471,7 +471,7 @@ Engine.prototype.registerCanvas = function(canvas, runState) { } Engine.prototype.unregisterCanvas = function(canvas) { - stat.closePage(canvas.id + "_fps"); + stat.closePage(canvas.rdgeid + "_fps"); contextManager.removeObject(canvas.rdgeCtxHandle); } diff --git a/js/helper-classes/RDGE/src/core/script/init_state.js b/js/helper-classes/RDGE/src/core/script/init_state.js index 8c69d218..4b97a4f4 100644 --- a/js/helper-classes/RDGE/src/core/script/init_state.js +++ b/js/helper-classes/RDGE/src/core/script/init_state.js @@ -42,11 +42,16 @@ LoadState.prototype.Init = function() if(this.sceneName) { this.loadScene("assets_web/mesh/" + this.sceneName + ".json", this.sceneName); - } + } + + if (this.hasUserState && this.userRunState && this.userRunState.onLoadState) + this.userRunState.onLoadState(); } LoadState.prototype.ReInit = function() { + if (this.hasUserState && this.userRunState && this.userRunState.onLoadState) + this.userRunState.onLoadState(); } LoadState.prototype.Resize = function() diff --git a/js/helper-classes/RDGE/src/core/script/jshader.js b/js/helper-classes/RDGE/src/core/script/jshader.js index f28219cf..36c5939e 100644 --- a/js/helper-classes/RDGE/src/core/script/jshader.js +++ b/js/helper-classes/RDGE/src/core/script/jshader.js @@ -173,7 +173,7 @@ jshader = function(addr) { // if the parameter does not exist in the shader cull it from the pass if (this.loc == null) { - window.console.log("ctx:" + ctx.canvas.id + ", technique: " + technique + ", uniform: " + name + " was not found, jshader param will have no affect"); + window.console.log("ctx:" + ctx.canvas.rdgeid + ", technique: " + technique + ", uniform: " + name + " was not found, jshader param will have no affect"); //return; } @@ -308,7 +308,7 @@ jshader = function(addr) { } } - program.ctxId = this.ctx.canvas.id; + program.ctxId = this.ctx.canvas.rdgeid; if (!program) { this.renderer.console.log("Build errors found in technique: " + t); this.def[t] = null; // remove bad technique @@ -322,7 +322,7 @@ jshader = function(addr) { var gp = new globalParam(this.ctx, p, rdgeGlobalParameters[p], program); if (gp.loc != null) { - gp.loc.ctxID = this.ctx.canvas.id; + gp.loc.ctxID = this.ctx.canvas.rdgeid; this[t].passes[i].defParams[p] = gp; this.global[p] = gp; } diff --git a/js/helper-classes/RDGE/src/core/script/renderer.js b/js/helper-classes/RDGE/src/core/script/renderer.js index 0c51d2cb..a50b8a68 100644 --- a/js/helper-classes/RDGE/src/core/script/renderer.js +++ b/js/helper-classes/RDGE/src/core/script/renderer.js @@ -335,14 +335,19 @@ _renderer = function(canvas) { var tex = this.textureMap[name]; - if (tex === undefined) { - - + if (tex === undefined) + { // load the texture tex = this.createTexture(name + ext, wrap, mips); this.textureMap[name] = tex; tex.lookUpName = name; + tex.previouslyReferenced = false; } + else + { + //console.log( "texture already loaded: " + name ); + tex.previouslyReferenced = true; + } return tex; @@ -354,9 +359,11 @@ _renderer = function(canvas) { * @param wrap - optional "CLAMP or "REPEAT", default is clamp * @param mips - optional true/false value to create mipmaps, the default is true */ + this.unloadedTextureCount = 0; _texparams = function(wrap, mips) { this.wrap = wrap, this.mips = mips }; this.createTexture = function(url, wrap, mips) { var texture = this.ctx.createTexture(); + this.unloadedTextureCount++; if (wrap === undefined) wrap = "CLAMP"; @@ -371,7 +378,20 @@ _renderer = function(canvas) { texture.image.onload = function() { var stateMan = this.context.ctxStateManager; stateMan.RDGEInitState.loadTexture(texture); + this.context.renderer.unloadedTextureCount--; + //console.log( "loaded texture: " + texture.lookUpName + ",to: " + this.context.renderer._world._worldCount + ", textures remaining to load: " + this.context.renderer.unloadedTextureCount ); + if (texture.callback) texture.callback( texture ); + if (this.context.renderer.unloadedTextureCount < 0) + console.log( "more textures loaded then created..." ); }; + texture.image.onerror = function() { + this.context.renderer.unloadedTextureCount--; + if (texture.callback) texture.callback( texture ); + //console.log( "Error loading texture: " + texture.image.src ); + if (this.context.renderer.unloadedTextureCount < 0) + console.log( "more textures loaded then created..." ); + } + } return texture; } @@ -544,8 +564,10 @@ _renderer = function(canvas) { */ rdgeDefaultShaderDefintion = { 'shaders': { - 'defaultVShader':"assets/shaders/test_vshader.glsl", - 'defaultFShader':"assets/shaders/test_fshader.glsl" + //'defaultVShader':"assets/shaders/test_vshader.glsl", + //'defaultFShader':"assets/shaders/test_fshader.glsl" + 'defaultVShader':"assets/shaders/Basic.vert.glsl", + 'defaultFShader':"assets/shaders/Basic.frag.glsl" }, 'techniques': { 'defaultTechnique':[{ 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 ad56d9ea..acdb6797 100644 --- a/js/helper-classes/RDGE/src/core/script/run_state.js +++ b/js/helper-classes/RDGE/src/core/script/run_state.js @@ -30,6 +30,9 @@ RunState.prototype.Init = function() this.userRunState.init(); } + if (this.hasUserState && this.userRunState && this.userRunState.onRunState) + this.userRunState.onRunState(); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -94,6 +97,11 @@ RunState.prototype.ReInit = function() if(!this.initialized) { this.Init(); + } + else + { + if (this.hasUserState && this.userRunState && this.userRunState.onRunState) + this.userRunState.onRunState(); } } @@ -117,7 +125,7 @@ RunState.prototype.Draw = function () var width = this.renderer.vpWidth; var height = this.renderer.vpHeight; - this.renderer._clear(); +// this.renderer._clear(); this.userRunState.draw(); diff --git a/js/helper-classes/RDGE/src/core/script/runtime.js b/js/helper-classes/RDGE/src/core/script/runtime.js index 8d8fdf38..18b9b223 100644 --- a/js/helper-classes/RDGE/src/core/script/runtime.js +++ b/js/helper-classes/RDGE/src/core/script/runtime.js @@ -179,7 +179,7 @@ RDGERequestAnimationFrame = (function() { RDGETask = (function() { var tasks = {}; return function(canvas, startNow) { - this.id = canvas.id; + this.id = canvas.rdgeid; this.currTime = 0.0; this.lastTime = 0.0; this.running = false; -- cgit v1.2.3 From 96a0a8c916533eb5625816192ed38488f639326d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 11:00:20 -0800 Subject: Integrating canvas-2d drawing and WebGL fixes, including adding back WebGL materials. Signed-off-by: Nivesh Rajbhandari --- .../RDGE/src/core/script/precompiled.js | 10 +- js/helper-classes/RDGE/src/core/script/runtime.js | 14 +- .../RDGE/src/core/script/scenegraphNodes.js | 8 +- .../RDGE/src/tools/compile-rdge-core.bat | 4 + .../RDGE/src/tools/compile-rdge-core.sh | 3 + js/helper-classes/RDGE/src/tools/compiler.jar | Bin 0 -> 4927265 bytes js/helper-classes/RDGE/src/tools/rdge-compiled.js | 454 +++++++++++++++++++++ 7 files changed, 479 insertions(+), 14 deletions(-) create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.bat create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.sh create mode 100644 js/helper-classes/RDGE/src/tools/compiler.jar create mode 100644 js/helper-classes/RDGE/src/tools/rdge-compiled.js (limited to 'js/helper-classes/RDGE/src') diff --git a/js/helper-classes/RDGE/src/core/script/precompiled.js b/js/helper-classes/RDGE/src/core/script/precompiled.js index 7fd1a425..bed94e4e 100755 --- a/js/helper-classes/RDGE/src/core/script/precompiled.js +++ b/js/helper-classes/RDGE/src/core/script/precompiled.js @@ -48,11 +48,11 @@ rdgeGlobalParameters = "u_light3Amb": {'type': 'vec4', 'data': [0.5, 0.5, 0.5, 1.0]}, "u_light3Spec": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}}, "colMap": {'type': 'tex2d', 'data': "assets/images/white.png"}, - "envMap": {'type': 'tex2d', 'data': null}, - "normalMap": {'type': 'tex2d', 'data': null}, - "glowMap": {'type': 'tex2d', 'data': "assets/images/black.png"}, - "u_shadowDepthMap": {'type': 'tex2d', 'data': null}, - "u_depthMap": {'type': 'tex2d', 'data': null}, + //"envMap": {'type': 'tex2d', 'data': null}, + //"normalMap": {'type': 'tex2d', 'data': null}, + //"glowMap": {'type': 'tex2d', 'data': "assets/images/black.png"}, + //"u_shadowDepthMap": {'type': 'tex2d', 'data': null}, + //"u_depthMap": {'type': 'tex2d', 'data': null}, "u_matAmbient": {'type': 'vec4', 'data': [1.00,1.00,1.00, 1]}, "u_matDiffuse": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}, "u_matSpecular": {'type': 'vec4', 'data': [1.0, 1.0, 1.0, 1.0]}, diff --git a/js/helper-classes/RDGE/src/core/script/runtime.js b/js/helper-classes/RDGE/src/core/script/runtime.js index 18b9b223..3d824faf 100755 --- a/js/helper-classes/RDGE/src/core/script/runtime.js +++ b/js/helper-classes/RDGE/src/core/script/runtime.js @@ -206,11 +206,15 @@ RDGETask = (function() { self.lastTime = self.currTime; } - this.start = function() { - this.running = true; - this.currTime = new Date().getTime(); - this.lastTime = this.currTime; - tasks[this.id](); + this.start = function() + { + if (!this.running) + { + this.running = true; + this.currTime = new Date().getTime(); + this.lastTime = this.currTime; + tasks[this.id](); + } } this.stop = function() { diff --git a/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js b/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js index 48f0aab9..e80a14fb 100755 --- a/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js +++ b/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js @@ -321,10 +321,10 @@ materialNodeTemplate = function(matNode) var renderer = g_Engine.getContext().renderer; matNode.textureList = [ - {'name':"colMap", 'handle':renderer.getTextureByName("assets/images/white"), 'unit': TEX_DIF, "type":UNIFORMTYPE.TEXTURE2D}, - {'name':"envMap", 'handle':renderer.getTextureByName("assets/images/material_paint"),'unit': TEX_SPEC, "type":UNIFORMTYPE.TEXTURE2D}, - {'name':"normalMap",'handle':renderer.getTextureByName("assets/images/blue"), 'unit': TEX_NORM, "type":UNIFORMTYPE.TEXTURE2D}, - {'name':"glowMap", 'handle':renderer.getTextureByName("assets/images/black"), 'unit': TEX_GLOW, "type":UNIFORMTYPE.TEXTURE2D} +// {'name':"colMap", 'handle':renderer.getTextureByName("assets/images/white"), 'unit': TEX_DIF, "type":UNIFORMTYPE.TEXTURE2D}, +// {'name':"envMap", 'handle':renderer.getTextureByName("assets/images/material_paint"),'unit': TEX_SPEC, "type":UNIFORMTYPE.TEXTURE2D}, +// {'name':"normalMap",'handle':renderer.getTextureByName("assets/images/blue"), 'unit': TEX_NORM, "type":UNIFORMTYPE.TEXTURE2D}, +// {'name':"glowMap", 'handle':renderer.getTextureByName("assets/images/black"), 'unit': TEX_GLOW, "type":UNIFORMTYPE.TEXTURE2D} ]; } diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat new file mode 100644 index 00000000..b2933fa9 --- /dev/null +++ b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat @@ -0,0 +1,4 @@ +java -jar ./compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies --js ../core/script/math/vec2.js --js ../core/script/math/vec3.js --js ../core/script/math/vec4.js --js ../core/script/math/mat4.js --js ../core/script/math/quat.js --js ../core/script/util/statTracker.js --js ../core/script/util/fpsTracker.js --js ../core/script/objectManager.js --js ../core/script/precompiled.js --js ../core/script/renderer.js --js ../core/script/renderUtils.js --js ../core/script/jshader.js --js ../core/script/jpass.js --js ../core/script/RenderProcs.js --js ../core/script/RenderInitProcs.js --js ../core/script/MeshManager.js --js ../core/script/TextureManager.js --js ../core/script/ShaderManager.js --js ../core/script/fx/blur.js --js ../core/script/fx/ssao.js --js ../core/script/ScreenQuad.js --js ../core/script/box.js --js ../core/script/camera.js --js ../core/script/shadowLight.js --js ../core/script/utilities.js --js ../core/script/input.js --js ../core/script/engine.js --js ../core/script/scenegraphNodes.js --js ../core/script/scenegraph.js --js ../core/script/lightmanager.js --js ../core/script/rendercontext.js --js ../core/script/animation.js --js ../core/script/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js ../core/script/util/dbgpanel.js --js_output_file rdge-compiled.js +cd ../core/script +type precompiled.js >> ../../tools/rdge-compiled.js +pause diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh b/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh new file mode 100644 index 00000000..1a2c4676 --- /dev/null +++ b/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh @@ -0,0 +1,3 @@ +java -jar ./compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies --js ../core/script/math/vec2.js --js ../core/script/math/vec3.js --js ../core/script/math/vec4.js --js ../core/script/math/mat4.js --js ../core/script/math/quat.js --js ../core/script/util/statTracker.js --js ../core/script/util/fpsTracker.js --js ../core/script/objectManager.js --js ../core/script/precompiled.js --js ../core/script/renderer.js --js ../core/script/renderUtils.js --js ../core/script/jshader.js --js ../core/script/jpass.js --js ../core/script/RenderProcs.js --js ../core/script/RenderInitProcs.js --js ../core/script/MeshManager.js --js ../core/script/TextureManager.js --js ../core/script/ShaderManager.js --js ../core/script/fx/blur.js --js ../core/script/fx/ssao.js --js ../core/script/ScreenQuad.js --js ../core/script/box.js --js ../core/script/camera.js --js ../core/script/shadowLight.js --js ../core/script/utilities.js --js ../core/script/input.js --js ../core/script/engine.js --js ../core/script/scenegraphNodes.js --js ../core/script/scenegraph.js --js ../core/script/lightmanager.js --js ../core/script/rendercontext.js --js ../core/script/animation.js --js ../core/script/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js ../core/script/util/dbgpanel.js --js ../core/script/ubershader.js --js_output_file rdge-compiled.js + +cat ../core/script/precompiled.js >> ./rdge-compiled.js diff --git a/js/helper-classes/RDGE/src/tools/compiler.jar b/js/helper-classes/RDGE/src/tools/compiler.jar new file mode 100644 index 00000000..f361e9cd Binary files /dev/null and b/js/helper-classes/RDGE/src/tools/compiler.jar differ diff --git a/js/helper-classes/RDGE/src/tools/rdge-compiled.js b/js/helper-classes/RDGE/src/tools/rdge-compiled.js new file mode 100644 index 00000000..4301200f --- /dev/null +++ b/js/helper-classes/RDGE/src/tools/rdge-compiled.js @@ -0,0 +1,454 @@ +vec2={string:function(a){return"{ "+a[0]+", "+a[1]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<2?!1:typeof a[0]!="number"||typeof a[1]!="number"?!1:!0},copy:function(a){return a.length==void 0?[a,a]:[a[0],a[1]]},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1]},zero:function(){return[0,0]},up:function(){return[0,1]},right:function(){return[1,0]},add:function(a,b){return[a[0]+b[0],a[1]+b[1]]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1]]},mul:function(a,b){return[a[0]*b[0], +a[1]*b[1]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=2?[a[0]+b[0]*f[0],a[1]+b[1]*f[1]]:[a[0]+b[0]*f,a[1]+b[1]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=2?[a[0]*b[0],a[1]*b[1]]:[a[0]*b,a[1]*b]},negate:function(a){return[-a[0],-a[1]]},normalize:function(a){var b=Math.sqrt(a[0]*a[0],a[1]*a[1]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b]):a},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]},perp:function(a){return[a[1],-a[0]]},lengthSq:function(a){return a[0]*a[0]+ +a[1]*a[1]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])},min:function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1])]},max:function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1])]}};vec2.clamp=function(a,b,f){return vec2.min(f,vec2.max(a,b))};vec3={string:function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<3?!1:typeof a[0]!="number"||typeof a[1]!="number"||typeof a[2]!="number"?!1:!0},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2]},copy:function(a){return a.length==void 0?[a,a,a]:[a[0],a[1],a[2]]},translation:function(a){return[a[12],a[13],a[14]]},basisX:function(a){return[a[0],a[1],a[2]]},basisY:function(a){return[a[4],a[5],a[6]]},basisZ:function(a){return[a[8], +a[9],a[10]]},zero:function(){return[0,0,0]},up:function(){return[0,1,0]},forward:function(){return[0,0,1]},right:function(){return[1,0,0]},random:function(a,b){return[a[0]+(b[0]-a[0])*Math.random(),a[1]+(b[1]-a[1])*Math.random(),a[2]+(b[2]-a[2])*Math.random()]},xy:function(a){return[a[0],a[1]]},xz:function(a){return[a[0],a[2]]},add:function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2]]},plusEqual:function(a,b){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2]]}, +mul:function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=3?[a[0]+b[0]*f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f]},plusEqualMul:function(a,b,f){f.length!==void 0&&f.length>=3?(a[0]+=b[0]*f[0],a[1]+=b[1]*f[1],a[2]+=b[2]*f[2]):(a[0]+=b[0]*f,a[1]+=b[1]*f,a[2]+=b[2]*f)},scale:function(a,b){return b.length!==void 0&&b.length>=3?[a[0]*b[0],a[1]*b[1],a[2]*b[2]]:[a[0]*b,a[1]*b,a[2]*b]},inplace_scale:function(a,b){b.length!== +void 0&&b.length>=3?(a[0]*=b[0],a[1]*=b[1],a[2]*=b[2]):(a[0]*=b,a[1]*=b,a[2]*=b)},negate:function(a){return[-a[0],-a[1],-a[2]]},inplace_negate:function(a){a[0]=-a[0];a[1]=-a[1];a[2]=-a[2]},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b]):a},cross:function(a,b){return[a[1]*b[2]-b[1]*a[2],a[2]*b[0]-b[2]*a[0],a[0]*b[1]-b[0]*a[1]]},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]},lengthSq:function(a){return a[0]*a[0]+ +a[1]*a[1]+a[2]*a[2]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])},distanceSq:function(a,b){var f=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return f[0]*f[0]+f[1]*f[1]+f[2]*f[2]},distance:function(a,b){var f=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2])}};vec3.angle=function(a,b){return Math.acos(vec3.dot(a,b))/(vec3.length(a)*vec3.length(b))};vec3.direction=function(a,b){return vec3.normalize(vec3.sub(b,a))}; +vec3.abs=function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2])]};vec3.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2])]};vec3.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2])]};vec3.clamp=function(a,b,f){return vec3.min(f,vec3.max(a,b))};vec3.equal=function(a,b,f){f||(f=0.0010);return vec3.distanceSq(a,b)=4?[a[0]+b[0]* +f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2],a[3]+b[3]*f[3]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f,a[3]+b[3]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=4?[a[0]*b[0],a[1]*b[1],a[2]*b[2],a[3]*b[3]]:[a[0]*b,a[1]*b,a[2]*b,a[3]*b]},negate:function(a){return[-a[0],-a[1],-a[2],-a[3]]},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b,a[3]*b]):a},lengthSq:function(a){return a[0]* +a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])},abs:function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2]),Math.abs(a[3])]},min:function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2]),Math.min(a[3],b[3])]},max:function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2]),Math.min(a[3],b[3])]}};vec4.clamp=function(a,b,f){return vec4.min(f,vec4.max(a,b))}; +vec4.equal=function(a,b,f){f||(f=0.0010);return vec4.distanceSq(a,b)=4?b[3]:1;return[a[0]*f+a[4]*g+a[8]*h+a[12]*l,a[1]*f+a[5]*g+a[9]*h+a[13]*l,a[2]*f+a[6]*g+a[10]*h+a[14]*l,a[3]*f+a[7]*g+a[11]*h+a[15]*l]};mat4.transformVector=function(a,b){var a=mat4.inverse(a),f=b[0],g=b[1],h=b[2],l=b.length>=4?b[3]:0;return[a[0]*f+a[1]*g+a[2]*h+a[3]*l,a[4]*f+a[5]*g+a[6]*h+a[7]*l,a[8]*f+a[9]*g+a[10]*h+a[11]*l,a[12]*f+a[13]*g+a[14]*h+a[15]*l]}; +mat4.transformPoint4x3=function(a,b){var f=b[0],g=b[1],h=b[2];return[a[0]*f+a[4]*g+a[8]*h+a[12],a[1]*f+a[5]*g+a[9]*h+a[13],a[2]*f+a[6]*g+a[10]*h+a[14],1]};mat4.transformVector4x3=function(a,b){var a=mat4.inverse(a),f=b[0],g=b[1],h=b[2];return[a[0]*f+a[1]*g+a[2]*h,a[4]*f+a[5]*g+a[6]*h,a[8]*f+a[9]*g+a[10]*h,0]};mat4.getRow=function(a,b){b*=4;return[a[b],a[b+1],a[b+2],a[b+3]]};mat4.getCol=function(a,b){return[a[b],a[b+4],a[b+8],a[b+12]]}; +mat4.setRow=function(a,b,f){b*=4;a[b+0]=f[0];a[b+1]=f[1];a[b+2]=f[2];f.length>=4&&(a[b+3]=f[3]);return a};mat4.setCol=function(a,b,f){a[b+0]=f[0];a[b+4]=f[1];a[b+8]=f[2];f.length>=4&&(a[b+12]=f[3]);return a};mat4.rotate=function(a,b,f){return mat4.mul(a,mat4.angleAxis(b,f))};mat4.rotateX=function(a,b){return mat4.mul(a,mat4.angleAxis(b,vec3.basisX(a)))};mat4.rotateY=function(a,b){return mat4.mul(a,mat4.angleAxis(b,vec3.basisY(a)))};mat4.rotateZ=function(a,b){return mat4.mul(a,mat4.angleAxis(b,vec3.basisZ(a)))}; +mat4.scale=function(a,b){var f=mat4.identity();b.length==void 0&&(b=[b,b,b]);f[0]=b[0];f[5]=b[1];f[10]=b[2];return mat4.mul(a,f)};mat4.scaleX=function(a,b){return mat4.scale(a,[b,1,1])};mat4.scaleY=function(a,b){return mat4.scale(a,[1,b,1])};mat4.scaleZ=function(a,b){return mat4.scale(a,[1,1,b])};mat4.translate=function(a,b){matT=mat4.identity();matT[12]=b[0];matT[13]=b[1];matT[14]=b[2];return mat4.mul(a,matT)};mat4.translateX=function(a,b){return mat4.translate(a,[b,0,0])}; +mat4.translateY=function(a,b){return mat4.translate(a,[0,b,0])};mat4.translateZ=function(a,b){return mat4.translate(a,[0,0,b])};quat={string:function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<4?!1:typeof a[0]!="number"||typeof a[1]!="number"||typeof a[2]!="number"||typeof a[3]!="number"?!1:!0},identity:function(){return[0,0,0,1]},add:function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2],a[3]+b[3]]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2],a[3]-b[3]]},mul:function(a,b){return[a[3]*b[3]-a[0]*b[0]-a[1]*b[1]-a[2]*b[2],a[3]*b[0]+a[0]*b[3]+a[1]* +b[2]-a[2]*b[1],a[3]*b[1]-a[0]*b[2]+a[1]*b[3]+a[2]*b[0],a[3]*b[2]+a[0]*b[1]-a[1]*b[0]+a[2]*b[3]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=4?[a[0]+b[0]*f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2],a[3]+b[3]*f[3]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f,a[3]+b[3]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=4?[a[0]*b[0],a[1]*a[1],a[2]*b[2],a[3]*b[3]]:[a[0]*b,a[1]*b,a[2]*b,a[3]*b]},lengthSq:function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]},length:function(a){return Math.sqrt(a[0]* +a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b,a[3]*b]):a},inverse:function(a){var b=vec4.lengthSq(a);return b>1.0E-5?(b=1/b,[a[0]*-b,a[1]*-b,a[2]*-b,a[3]]):a},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}};quat.applyRotation=function(a,b){return mat4.transformPoint(quat.toMatrix(a),b)}; +quat.lerp=function(a,b,f){return quat.normalize([a[0]+(b[0]-a[0])*f,a[1]+(b[1]-a[1])*f,a[2]+(b[2]-a[2])*f,a[3]+(b[3]-a[3])*f])};quat.slerp=function(a,b,f){var g=quat.dot(a,b);if(g>=0.9)return quat.lerp(a,b,f);var h=Math.sqrt(Math.abs(1-g*g));if(h<0.0010)return a;var g=g<0?-1:1,l=Math.asin(h),n=1/h,h=Math.sin((1-f)*l)*n,f=Math.sin(f*l)*n*g;quat.scale(a,h);quat.scale(b,f);return quat.normalize(quat.add(a,b))}; +quat.toMatrix=function(a){var b=2*a[0],f=2*a[1],g=2*a[2],h=b*a[3],l=f*a[3],n=g*a[3];b*=a[0];var o=f*a[0],p=g*a[0];f*=a[1];var q=g*a[1],a=g*a[2];return[1-(f+a),o+n,p-l,0,o-n,1-(b+a),q+h,0,p+l,q-h,1-(b+f),0,0,0,0,1]};var stat=function(){pages={};dlgId="";self=function(a,b,f,g,h){h==void 0&&(h=!0);category=!a?"default":a;pages[category]||(pages[category]=[]);pages[category].push(this);this.name=b;this.value=this.defValue=f;this.func=g;this.reset=h;this.reportInterval=500;stat.dirty=!0;stat.find=function(a,b){var f=pages[a];for(i=0;i'+a+"");g+="";for(a in pages)pages[a]&&(g+='
',g+="
");g+="";f.innerHTML=g;$("#stat_tabs").tabs();stat.dirty=!1}for(a in pages)f=document.getElementById(a),stat.report(f,a,b)};stat.report=function(a,b){b||(b="default");var f=pages[b];if(f){outputHTML='';var g=0;for(i=0;i', +outputHTML+=f[i].func?f[i].name+" : "+f[i].func(f[i].value):f[i].name+" : "+f[i].value,outputHTML+="",g++>=3&&(outputHTML+="",g=0),f[i].reset)f[i].value=f[i].defValue;outputHTML+="
";a.innerHTML=outputHTML}}};setInterval(function(){self.reportAll("RDGE_STATS")},500);return self}(); +dbCanvas=function(a,b){this.front=document.createElement("canvas");this.front.setAttribute("width",a);this.front.setAttribute("height",b);this.front.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");this.front.ctx=this.front.getContext("2d");this.back=document.createElement("canvas");this.back.setAttribute("width",a);this.back.setAttribute("height",b);this.front.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");this.back.ctx=this.back.getContext("2d"); +this.swap=function(){var a=this.front;this.front=this.back;this.back=a;this.front.style.visibility="visible";this.back.style.visibility="hidden"}};function getCanvasDimensions(a){var b={x:0,y:0};b.width=a.width;b.height=a.height;if(a.offsetParent){do b.x+=a.offsetLeft,b.y+=a.offsetTop;while(a=a.offsetParent)}return b} +graph2D=function(a,b,f,g,h,l,n){this.style=n||{bgcolor:"#000"};this.sampleRes=512;this.scale=1;this.rangeMin=h;this.rangeMax=l;this.offsetY=0;this.canvas=document.createElement("canvas");this.canvas.setAttribute("width",f);this.canvas.setAttribute("height",g-32);this.canvas.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");o=this;this.onclick=function(a){for(var b=getCanvasDimensions(o.canvas),f=a.clientX-b.x,a=a.clientY-b.y,b=0;bg.x+g.w)&&!(a>g.y+g.h)&&!(athis.sampleRes&&b.samples.shift();b.samples.push(b.stat.value)}};this.draw=function(){var a=this.canvas,b=this.ctx,f=a.width,g=a.height,h=this.rangeMin*this.scale,l=1/(this.rangeMax*this.scale-h),n=16+Math.floor(this.tracked.length/4+0.5)* +16;b.fillStyle=this.style.bgcolor;b.strokeStyle=this.style.bgcolor;b.fillRect(0,0,f,g-n);for(a=0;athis.maxSamples&&this.samples.shift();this.timeStampMS= +a;for(var f=0,g=-1E10,a=1E10,h=this.samples.length-1;h>=0;)f+=this.samples[h],g=Math.max(g,this.samples[h]),a=Math.min(a,this.samples[h]),h--;f=this.samples.length>0?f/this.samples.length:0;f=f>0?1E3/f:0;g=g>0?1E3/g:0;a=a>0?1E3/a:0;h=this.samples[this.samples.length-1];this.fpsRaw.value=(h>0?1E3/h:0).toFixed(2);this.fpsAvg.value=f.toFixed(2);this.fpsMin.value=g.toFixed(2);this.fpsMax.value=a.toFixed(2)}};objectManager=function(){this.guidCounter=0;this.objects=[];this.numObjects=0;this.freelist=[];this.reset=function(){this.objects=[];this.freelist=[];this.guidCounter=0};this.validHandle=function(a){return this.handleToIndex(a)!=-1};this.handleToIndex=function(a){var b=a>>16&65535;return this.objects[b]!=null&&a==this.objects[b].handle?b:-1};this.handleToObject=function(a){a=this.handleToIndex(a);return a!=-1?this.objects[a]:null};this.addObject=function(a){var b=this.objects.length;this.freelist.length> +0&&(b=this.freelist.pop());if(++this.guidCounter>=65535)this.guidCounter=1;a.handle=b<<16|++this.guidCounter;this.objects[b]=a;return a.handle};this.removeObject=function(a){a=this.handleToIndex(a);if(a!=-1){if(this.objects[a].onremove!=void 0)this.objects[a].onremove();this.objects[a]=null;this.freelist.push(a)}}};rdgeGlobalParameters={u_projMatrix:{type:"mat4",data:mat4.identity()},u_mvMatrix:{type:"mat4",data:mat4.identity()},u_invMvMatrix:{type:"mat4",data:mat4.identity()},u_normalMatrix:{type:"mat4",data:mat4.identity()},u_worldMatrix:{type:"mat4",data:mat4.identity()},u_viewMatrix:{type:"mat4",data:mat4.identity()},u_invViewMatrix:{type:"mat4",data:mat4.identity()},u_invWorldMatrix:{type:"mat4",data:mat4.identity()},u_inv_viewport_width:{type:"float",data:[1]},u_inv_viewport_height:{type:"float",data:[1]}, +u_lightPos:{type:"vec3",data:[-20,50,20]},u_lightDiff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_lightAmb:{type:"vec4",data:[1,1,1,1]},rdge_lights:{u_light0Pos:{type:"vec3",data:[-20,50,20]},u_light0Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light0Amb:{type:"vec4",data:[8.0E-4,8.0E-4,8.0E-4,1]},u_light0Spec:{type:"vec4",data:[1,1,1,1]},u_light1Pos:{type:"vec3",data:[0,0,0]},u_light1Diff:{type:"vec4",data:[0,0,0,0]},u_light1Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light1Spec:{type:"vec4",data:[1,1,1,1]}, +u_light2Pos:{type:"vec3",data:[0,0,0]},u_light2Diff:{type:"vec4",data:[0,0,0,1]},u_light2Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light2Spec:{type:"vec4",data:[1,1,1,1]},u_light3Pos:{type:"vec3",data:[0,0,0]},u_light3Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light3Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light3Spec:{type:"vec4",data:[1,1,1,1]}},colMap:{type:"tex2d",data:"assets/images/white.png"},envMap:{type:"tex2d",data:null},normalMap:{type:"tex2d",data:null},glowMap:{type:"tex2d",data:"assets/images/black.png"}, +u_shadowDepthMap:{type:"tex2d",data:null},u_depthMap:{type:"tex2d",data:null},u_matAmbient:{type:"vec4",data:[1,1,1,1]},u_matDiffuse:{type:"vec4",data:[1,1,1,1]},u_matSpecular:{type:"vec4",data:[1,1,1,1]},u_matShininess:{type:"float",data:[128]},u_matEmission:{type:"float",data:[0,0,0,1]},u_frustumFarZ:{type:"float",data:[1E3]},u_shadowLightWorld:{type:"mat4",data:mat4.identity()},u_shadowBiasMatrix:{type:"mat4",data:mat4.identity()},u_vShadowLight:{type:"mat4",data:mat4.identity()},u_shadowBPV:{type:"mat4", +data:mat4.identity()},u_farZ:{type:"float",data:[1E3]},u_shadowLightFarZ:{type:"float",data:[1E3]},u_cameraFTR:{type:"vec3",data:[0,0,0]}};g_renderStats={};g_renderStats.numDrawCalls=new stat("rendering","numDrawCalls",0,null,!1);g_renderStats.numTriangles=new stat("rendering","numTriangles",0,null,!1);g_renderStats.numVerts=new stat("rendering","numVerts",0,null,!1);g_renderStats.numPasses=new stat("rendering","numPasses",0,null,!1);g_renderStats.reset=function(){g_renderStats.numTriangles.value=0;g_renderStats.numDrawCalls.value=0;g_renderStats.numVerts.value=0;g_renderStats.numPasses.value=0}; +rdgeConstants={colorBuffer:16384,depthBuffer:256,stencilBuffer:1024,BUFFER_STATIC:0,BUFFER_DYNAMIC:1,BUFFER_STREAM:2,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,VS_ELEMENT_FLOAT4:4,VS_ELEMENT_POS:3,VS_ELEMENT_NORM:3,VS_ELEMENT_FLOAT3:3,VS_ELEMENT_FLOAT2:2,VS_ELEMENT_UV:2,VS_ELEMENT_FLOAT:1,MAX_ELEM_TYPES:7,BUFFER_STATIC:35040,BUFFER_DYNAMIC:35044,BUFFER_STREAM:35048, +MAX_MATERIAL_LIGHTS:4,categoryEnumeration:{BACKGROUND:0,OPAQUE:1,TRANSPARENT:2,ADDITIVE:3,TRANSLUCENT:4,FOREGROUND:5,MAX_CAT:6},nodeType:{TRNODE:0,MESHNODE:1,MATNODE:2,LIGHTNODE:3}};rdgeId=0;function getBufferID(){return rdgeId++} +_renderer=function(a){try{this.ctx=a.getContext("experimental-webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webkit-3d",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("moz-webgl",{preserveDrawingBuffer:!0})}catch(b){}if(!this.ctx)return window.console.log("Could not create GL context"),null;this.ctx.viewport(0,0,a.width,a.height);this.console="console"in window?window.console:{log:function(){}}; +this.ctx.clearColor(1,0,0,1);this.clearColor=[1,0,0,1];this.clearFlags=this.ctx.COLOR_BUFFER_BIT|this.ctx.DEPTH_BUFFER_BIT;this.colorBuffer=this.ctx.COLOR_BUFFER_BIT;this.depthBuffer=this.ctx.DEPTH_BUFFER_BIT;this.stencilBuffer=this.ctx.STENCIL_BUFFER_BIT;this.BUFFER_STATIC=0;this.BUFFER_DYNAMIC=1;this.BUFFER_STREAM=2;this.POINTS=0;this.LINES=1;this.LINE_LOOP=2;this.LINE_STRIP=3;this.TRIANGLES=4;this.TRIANGLE_STRIP=5;this.TRIANGLE_FAN=6;this.BYTE=5120;this.UNSIGNED_BYTE=5121;this.SHORT=5122;this.UNSIGNED_SHORT= +5123;this.INT=5124;this.UNSIGNED_INT=5125;this.FLOAT=5126;this.VS_ELEMENT_FLOAT4=4;this.VS_ELEMENT_FLOAT3=this.VS_ELEMENT_NORM=this.VS_ELEMENT_POS=3;this.VS_ELEMENT_UV=this.VS_ELEMENT_FLOAT2=2;this.VS_ELEMENT_FLOAT=1;this.MAX_ELEM_TYPES=7;this.BUFFER_STATIC=35040;this.BUFFER_DYNAMIC=35044;this.BUFFER_STREAM=35048;this.MAX_MATERIAL_LIGHTS=4;this.usedTextureUnits=5;this.vpY=this.vpX=0;this.vpWidth=a.width;this.vpHeight=a.height;this.cameraMan=new cameraManager;this.buffers=[];this.cullBackFace=function(){this.ctx.cullFace(this.ctx.Back)}; +this.cullFrontFace=function(){this.ctx.cullFace(this.ctx.FRONT)};this.disableCulling=function(){this.ctx.disable(this.ctx.CULL_FACE)};this.enableCulling=function(){this.ctx.enable(this.ctx.CULL_FACE)};this.enablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.disablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.enablePointSprites=function(){};this.disablePointSprites=function(){};this.setClearColor=function(a){this.clearColor=a.slice(); +this.ctx.clearColor(a[0],a[1],a[2],a[3])};this.setClearFlags=function(a){this.clearFlags=a};this._clear=function(){this.ctx.clear(this.clearFlags)};this.clear=function(a){this.ctx.clear(a)};this.flush=function(){this.ctx.flush()};this.setViewPort=function(a,b,h,l){this.vpX=a;this.vpY=b;this.vpWidth=h;this.vpHeight=l;this.ctx.viewport(this.vpX,this.vpY,this.vpWidth,this.vpHeight)};this.cameraManager=function(){return this.cameraMan};this.textureMap=[];this.rttMap=[];this.getTextureByName=function(a, +b,h){var l=a.split(".")[1],n=this.textureMap[a];n===void 0?(n=this.createTexture(a+(l?"":".png"),b,h),this.textureMap[a]=n,n.lookUpName=a,n.previouslyReferenced=!1):n.previouslyReferenced=!0;return n};this.unloadedTextureCount=0;_texparams=function(a,b){this.wrap=a;this.mips=b};this.createTexture=function(a,b,h){var l=this.ctx.createTexture();this.unloadedTextureCount++;b===void 0&&(b="CLAMP");h===void 0&&(h=!0);if(l)l.image=new Image,l.image.src=a,l.image.context=g_Engine.getContext(),l.texparams= +new _texparams(b,h),l.image.onload=function(){this.context.ctxStateManager.RDGEInitState.loadTexture(l);this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")},l.image.onerror=function(){this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")};return l};this.commitTexture=function(a){this.ctx.bindTexture(this.ctx.TEXTURE_2D, +a);this.ctx.texImage2D(this.ctx.TEXTURE_2D,0,this.ctx.RGBA,this.ctx.RGBA,this.ctx.UNSIGNED_BYTE,a.image);a.texparams.mips&&this.ctx.generateMipmap(this.ctx.TEXTURE_2D);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MAG_FILTER,this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MIN_FILTER,a.texparams.mips?this.ctx.LINEAR_MIPMAP_LINEAR:this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_S,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT: +this.ctx.CLAMP_TO_EDGE);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_T,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT:this.ctx.CLAMP_TO_EDGE);this.ctx.bindTexture(this.ctx.TEXTURE_2D,null)};this.verify=function(a){var b=this.ctx.getError();b!=0&&window.console.log("GLError ( "+a+") : "+b)};this.createRenderTargetTexture=function(a,b,h,l){var n=this.ctx,o=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,o);o.width=b;o.height=h;b=n.createTexture();n.bindTexture(n.TEXTURE_2D,b); +try{n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,null)}catch(p){h=new WebctxUnsignedByteArray(o.width*o.height*4),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,h)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,l?n.LINEAR_MIPMAP_NEAREST:n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);l&& +n.generateMipmap(n.TEXTURE_2D);l=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,l);n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height);n.getError(n.bindFramebuffer(n.FRAMEBUFFER,o));n.getError(n.bindRenderbuffer(n.RENDERBUFFER,l));n.getError(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height));n.bindRenderbuffer(n.RENDERBUFFER,null);n.getError(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b,0));n.getError(n.framebufferRenderbuffer(n.FRAMEBUFFER, +n.DEPTH_ATTACHMENT,n.RENDERBUFFER,l));n.bindFramebuffer(n.FRAMEBUFFER,null);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null);b.id="RT_"+nodeIdGen.getId();b.frameBuffer=o;this.textureMap[a]&&window.console.log("Notification: render target: "+a+" has overwritten an existing render target");return this.textureMap[a]=b};this.defaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/test_vshader.glsl",defaultFShader:"assets/shaders/test_fshader.glsl"}, +techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}}; +rdgeDefaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/Basic.vert.glsl",defaultFShader:"assets/shaders/Basic.frag.glsl"},techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; +rdgeDepthMapShaderDef={shaders:{depthMapVShader:"assets/shaders/depthMap_vshader.glsl",depthMapFShader:"assets/shaders/depthMap_fshader.glsl"},techniques:{shadowDepthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}],depthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}}, +params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}};rdgeViewSpaceNormalsShader={shaders:{normalsVShader:"assets/shaders/norm_depth_vshader.glsl",normalsFShader:"assets/shaders/norm_depth_fshader.glsl"},techniques:{depthMapWNormal:[{vshader:"normalsVShader",fshader:"normalsFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}