From 648ee61ae84216d0236e0dbc211addc13b2cfa3a Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:52:06 -0700 Subject: Expand tabs --- .../RDGE/src/core/script/MeshManager.js | 82 +-- js/helper-classes/RDGE/src/core/script/box.js | 64 +- js/helper-classes/RDGE/src/core/script/camera.js | 8 +- js/helper-classes/RDGE/src/core/script/engine.js | 186 ++--- .../RDGE/src/core/script/init_state.js | 312 ++++---- js/helper-classes/RDGE/src/core/script/jpass.js | 102 +-- js/helper-classes/RDGE/src/core/script/jshader.js | 60 +- .../RDGE/src/core/script/lightmanager.js | 12 +- .../RDGE/src/core/script/math/mat4.js | 192 ++--- .../RDGE/src/core/script/math/quat.js | 64 +- .../RDGE/src/core/script/math/vec2.js | 6 +- .../RDGE/src/core/script/math/vec3.js | 18 +- .../RDGE/src/core/script/math/vec4.js | 46 +- .../RDGE/src/core/script/objectManager.js | 120 ++-- js/helper-classes/RDGE/src/core/script/particle.js | 14 +- .../RDGE/src/core/script/precompiled.js | 26 +- .../RDGE/src/core/script/renderUtils.js | 100 +-- js/helper-classes/RDGE/src/core/script/renderer.js | 782 ++++++++++----------- .../RDGE/src/core/script/run_state.js | 462 ++++++------ js/helper-classes/RDGE/src/core/script/runtime.js | 24 +- .../RDGE/src/core/script/scenegraph.js | 306 ++++---- .../RDGE/src/core/script/scenegraphNodes.js | 462 ++++++------ .../RDGE/src/core/script/shadowLight.js | 4 +- js/helper-classes/RDGE/src/core/script/sockets.js | 130 ++-- .../RDGE/src/core/script/utilities.js | 14 +- 25 files changed, 1798 insertions(+), 1798 deletions(-) (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 index 768b7213..81359fc4 100755 --- a/js/helper-classes/RDGE/src/core/script/MeshManager.js +++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js @@ -38,16 +38,16 @@ RDGE.Model = function (name, mesh) { }; /* - * Maintains a list of meshes to allow instancing of data + * Maintains a list of meshes to allow instancing of data */ RDGE.MeshManager = function () { - this.contentUrl = "assets_web/mesh/"; - this.modelMap = {}; - this.readyList = []; // meshes that have data ready - this.meshesLoading = true; // indicates that no meshes have loaded or that they are still loading - this.postMeshLoadCallbackList = []; - this.tempSphere = null; - this.requestCounter = 0; + this.contentUrl = "assets_web/mesh/"; + this.modelMap = {}; + this.readyList = []; // meshes that have data ready + this.meshesLoading = true; // indicates that no meshes have loaded or that they are still loading + this.postMeshLoadCallbackList = []; + this.tempSphere = null; + this.requestCounter = 0; }; /* @@ -62,7 +62,7 @@ RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) { meshStump.addr = this.contentUrl + meshStump.name + "_mesh.json"; meshStump.ctxID = RDGE.globals.engine.getContext().renderer.id; - // sets a temp mesh up in place of the final mesh to load + // sets a temp mesh up in place of the final mesh to load if (!tempMesh) { if (this.tempSphere == null) { this.tempSphere = RDGE.renderUtils.makeSphere(RDGE.globals.engine.getContext().renderer.ctx, 25, 5, 5); @@ -71,7 +71,7 @@ RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) { tempMesh = this.tempSphere; } - // add the temp mesh to the map of loaded meshes + // add the temp mesh to the map of loaded meshes this.modelMap[meshStump.name] = tempMesh; // update the request counter - we now have one more mesh to load @@ -86,15 +86,15 @@ RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) { * Deletes the passed mesh from the manager as well as all renderers */ RDGE.MeshManager.prototype.deleteMesh = function (name) { - var model = this.modelMap[name]; - + var model = this.modelMap[name]; + if (model) { RDGE.globals.engine.ctxMan.forEach(function (context) { - context.renderer.deletePrimitive(model.primitive); - }); + context.renderer.deletePrimitive(model.primitive); + }); - delete this.modelMap[name]; - } + delete this.modelMap[name]; + } }; RDGE.MeshManager.prototype.getModelByName = function (name) { @@ -113,7 +113,7 @@ RDGE.MeshManager.prototype.getModelNames = function () { RDGE.MeshManager.prototype.processMeshData = function () { var renderer = RDGE.globals.engine.getContext().renderer; - + // loop through meshes and load ready data for (var index in this.readyList) { // if item is ready load it @@ -128,7 +128,7 @@ RDGE.MeshManager.prototype.processMeshData = function () { primset.vertexDefinition = { - // this shows two ways to map this data to an attribute + // this shows two ways to map this data to an attribute "vert": { 'type': RDGE.rdgeConstants.VS_ELEMENT_POS, 'bufferIndex': 0, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC }, "a_pos": { 'type': RDGE.rdgeConstants.VS_ELEMENT_POS, 'bufferIndex': 0, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC }, "normal": { 'type': RDGE.rdgeConstants.VS_ELEMENT_FLOAT3, 'bufferIndex': 1, 'bufferUsage': RDGE.rdgeConstants.BUFFER_STATIC }, @@ -142,25 +142,25 @@ RDGE.MeshManager.prototype.processMeshData = function () { primset.bufferStreams = [ - model.root.data.coords, - model.root.data.normals, - model.root.data.uvs + model.root.data.coords, + model.root.data.normals, + model.root.data.uvs ]; primset.streamUsage = [ - RDGE.rdgeConstants.BUFFER_STATIC, - RDGE.rdgeConstants.BUFFER_STATIC, - RDGE.rdgeConstants.BUFFER_STATIC + RDGE.rdgeConstants.BUFFER_STATIC, + RDGE.rdgeConstants.BUFFER_STATIC, + RDGE.rdgeConstants.BUFFER_STATIC ]; primset.indexUsage = RDGE.rdgeConstants.BUFFER_STREAM; primset.indexBuffer = model.root.data.indices; - renderer.createPrimitive( primset ); - - model.root.primitive = primset; + renderer.createPrimitive( primset ); + + model.root.primitive = primset; // generate a bounding box for this mesh model.root.bbox = new RDGE.box(); @@ -185,7 +185,7 @@ RDGE.MeshManager.prototype.processMeshData = function () { }; RDGE.MeshManager.prototype.isReady = function () { - return this.readyList.length == 0; + return this.readyList.length == 0; }; RDGE.MeshManager.prototype.addOnLoadedCallback = function (callback) { @@ -201,29 +201,29 @@ RDGE.MeshManager.prototype.onLoaded = function (meshName) { RDGE.MeshManager.prototype.exportJSON = function () { for (var m in this.modelMap) { - this.modelMap[m].primitive.built = false; - } - - return JSON.stringify(this.modelMap); + this.modelMap[m].primitive.built = false; + } + + return JSON.stringify(this.modelMap); }; RDGE.MeshManager.prototype.importJSON = function (jsonMeshExport) { try { - var tempModelMap = JSON.parse(jsonMeshExport); - + var tempModelMap = JSON.parse(jsonMeshExport); + for (var m in tempModelMap) { if (!this.modelMap[m]) { - this.modelMap[m] = tempModelMap[m]; - } - } - window.console.log("meshes imported"); + this.modelMap[m] = tempModelMap[m]; + } + } + window.console.log("meshes imported"); } catch (e) { - window.console.error("error importing meshes: " + e.description ); - } + window.console.error("error importing meshes: " + e.description ); + } }; /* - * global function for the mesh manager to make mesh file requests + * global function for the mesh manager to make mesh file requests */ RDGE.requestMesh = function (mesh) { var request = new XMLHttpRequest(); diff --git a/js/helper-classes/RDGE/src/core/script/box.js b/js/helper-classes/RDGE/src/core/script/box.js index d33907a0..441ef6cf 100755 --- a/js/helper-classes/RDGE/src/core/script/box.js +++ b/js/helper-classes/RDGE/src/core/script/box.js @@ -115,48 +115,48 @@ RDGE.box.prototype.transform = function (mat) { /* RDGE.box.prototype.transform = function(mat) { - var newBox = new RDGE.box(); - var e, f; + var newBox = new RDGE.box(); + var e, f; - newBox.b[0] = mat[12]; newBox.b[1] = mat[13]; newBox.b[2] = mat[14]; - newBox.t[0] = mat[12]; newBox.t[1] = mat[13]; newBox.t[2] = mat[14]; + newBox.b[0] = mat[12]; newBox.b[1] = mat[13]; newBox.b[2] = mat[14]; + newBox.t[0] = mat[12]; newBox.t[1] = mat[13]; newBox.t[2] = mat[14]; - e = mat[0] * this.min[0]; f = mat[0] * this.max[0]; - newBox.b[0] += (e < f) ? e : f; - newBox.t[0] += (e < f) ? f : e; + e = mat[0] * this.min[0]; f = mat[0] * this.max[0]; + newBox.b[0] += (e < f) ? e : f; + newBox.t[0] += (e < f) ? f : e; - e = mat[4] * this.min[1]; f = mat[4] * this.max[1]; - newBox.b[0] += (e < f) ? e : f; - newBox.t[0] += (e < f) ? f : e; + e = mat[4] * this.min[1]; f = mat[4] * this.max[1]; + newBox.b[0] += (e < f) ? e : f; + newBox.t[0] += (e < f) ? f : e; - e = mat[8] * this.min[2]; f = mat[8] * this.max[2]; - newBox.b[0] += (e < f) ? e : f; - newBox.t[0] += (e < f) ? f : e; + e = mat[8] * this.min[2]; f = mat[8] * this.max[2]; + newBox.b[0] += (e < f) ? e : f; + newBox.t[0] += (e < f) ? f : e; - e = mat[1] * this.min[0]; f = mat[1] * this.max[0]; - newBox.b[1] += (e < f) ? e : f; - newBox.t[1] += (e < f) ? f : e; + e = mat[1] * this.min[0]; f = mat[1] * this.max[0]; + newBox.b[1] += (e < f) ? e : f; + newBox.t[1] += (e < f) ? f : e; - e = mat[5] * this.min[1]; f = mat[5] * this.max[1]; - newBox.b[1] += (e < f) ? e : f; - newBox.t[1] += (e < f) ? f : e; + e = mat[5] * this.min[1]; f = mat[5] * this.max[1]; + newBox.b[1] += (e < f) ? e : f; + newBox.t[1] += (e < f) ? f : e; - e = mat[9] * this.min[2]; f = mat[9] * this.max[2]; - newBox.b[1] += (e < f) ? e : f; - newBox.t[1] += (e < f) ? f : e; + e = mat[9] * this.min[2]; f = mat[9] * this.max[2]; + newBox.b[1] += (e < f) ? e : f; + newBox.t[1] += (e < f) ? f : e; - e = mat[2] * this.min[0]; f = mat[2] * this.max[0]; - newBox.b[2] += (e < f) ? e : f; - newBox.t[2] += (e < f) ? f : e; + e = mat[2] * this.min[0]; f = mat[2] * this.max[0]; + newBox.b[2] += (e < f) ? e : f; + newBox.t[2] += (e < f) ? f : e; - e = mat[6] * this.min[1]; f = mat[6] * this.max[1]; - newBox.b[2] += (e < f) ? e : f; - newBox.t[2] += (e < f) ? f : e; + e = mat[6] * this.min[1]; f = mat[6] * this.max[1]; + newBox.b[2] += (e < f) ? e : f; + newBox.t[2] += (e < f) ? f : e; - e = mat[10] * this.min[2]; f = mat[10] * this.max[2]; - newBox.b[2] += (e < f) ? e : f; - newBox.t[2] += (e < f) ? f : e; + e = mat[10] * this.min[2]; f = mat[10] * this.max[2]; + newBox.b[2] += (e < f) ? e : f; + newBox.t[2] += (e < f) ? f : e; - return newBox; + return newBox; }; */ diff --git a/js/helper-classes/RDGE/src/core/script/camera.js b/js/helper-classes/RDGE/src/core/script/camera.js index da9aff3d..e85fe593 100755 --- a/js/helper-classes/RDGE/src/core/script/camera.js +++ b/js/helper-classes/RDGE/src/core/script/camera.js @@ -208,9 +208,9 @@ RDGE.camera = function () { this.getFTR = function () { var fovyRad = (this.persp.fov * 0.5) * Math.PI / 180.0; return [ - Math.tan(fovyRad) * this.persp.far, - Math.tan(fovyRad / this.persp.aratio) * this.persp.far, - this.persp.far]; + Math.tan(fovyRad) * this.persp.far, + Math.tan(fovyRad / this.persp.aratio) * this.persp.far, + this.persp.far]; }; this.attachCameraToNode = function (node) { @@ -219,7 +219,7 @@ RDGE.camera = function () { }; -/** Camera Manager +/** Camera Manager * This class is used to manage the active camera. It provides functionality * for getting and setting the active camera, as well as providing stack operations * to switch to and from multiple cameras. diff --git a/js/helper-classes/RDGE/src/core/script/engine.js b/js/helper-classes/RDGE/src/core/script/engine.js index 36a34689..b2191197 100755 --- a/js/helper-classes/RDGE/src/core/script/engine.js +++ b/js/helper-classes/RDGE/src/core/script/engine.js @@ -31,72 +31,72 @@ POSSIBILITY OF SUCH DAMAGE. var RDGE = RDGE || {}; /* - * Manage state instances + * Manage state instances */ RDGE.stateManager = function () { - // a stack of states - this.stateStack = []; - - // number of states on the stack + // a stack of states + this.stateStack = []; + + // number of states on the stack this.stateTop = undefined; // the states of the context - this.RDGEInitState = null; - this.RDGERunState = null; + this.RDGEInitState = null; + this.RDGERunState = null; this.currentState = function () { - if(this.stateTop != undefined) - return this.stateStack[this.stateTop]; - - return null; + if(this.stateTop != undefined) + return this.stateStack[this.stateTop]; + + return null; }; - - /* - * Push new IRuntime state - engine executes the new state - */ + + /* + * Push new IRuntime state - engine executes the new state + */ this.PushState = function (state, flags) { if (state != null && typeof state.Init == 'function') { - if(this.stateTop != undefined) - this.stateStack[this.stateTop].LeaveState(); - - if(flags == undefined || flags != "noInit") - state.Init(); - - this.stateTop = this.stateStack.push(state) - 1; - } + if(this.stateTop != undefined) + this.stateStack[this.stateTop].LeaveState(); + + if(flags == undefined || flags != "noInit") + state.Init(); + + this.stateTop = this.stateStack.push(state) - 1; + } }; - /* - * Remove IRuntime state from stack, engine executes previous state - */ + /* + * Remove IRuntime state from stack, engine executes previous state + */ this.PopState = function () { - state = this.stateStack.pop(); + state = this.stateStack.pop(); if (state != null) { - state.Shutdown(); - } - - this.stateTop = this.stateTop > 0 ? this.stateTop - 1 : 0; - + state.Shutdown(); + } + + this.stateTop = this.stateTop > 0 ? this.stateTop - 1 : 0; + if (this.stateStack[this.stateTop]) { - this.stateStack[this.stateTop].ReInit(); - } + this.stateStack[this.stateTop].ReInit(); + } }; - /* - * Remove all states from the stack - */ + /* + * Remove all states from the stack + */ this.PopAll = function () { while (this.stateStack[this.stateTop] != null) { - this.PopState(); - } + this.PopState(); + } }; - + this.tick = function (dt) { if (this.stateStack[this.stateTop] != null) { - this.stateStack[this.stateTop].Update(dt); - this.stateStack[this.stateTop].Resize(); - this.stateStack[this.stateTop].Draw(); - } + this.stateStack[this.stateTop].Update(dt); + this.stateStack[this.stateTop].Resize(); + this.stateStack[this.stateTop].Draw(); + } }; }; @@ -124,22 +124,22 @@ RDGE.Engine = function () { this.RDGECanvas = null; /* - * a map of canvas names to renderer + * a map of canvas names to renderer */ this.canvasToRendererMap = {}; /* - * states to canvas map - maps a state stack to the canvas context it belongs to + * states to canvas map - maps a state stack to the canvas context it belongs to */ this.canvasNameToStateStack = {}; /* - * the list of context's that are active + * the list of context's that are active */ this.canvasCtxList = []; /* - * regex object to verify runtime object is not some sort of exploit + * regex object to verify runtime object is not some sort of exploit */ invalidObj = new RegExp("([()]|function)"); @@ -154,7 +154,7 @@ RDGE.Engine = function () { }; /* - * The context definition - every context shares these parameters + * The context definition - every context shares these parameters */ contextDef = function () { this.id = null; @@ -218,7 +218,7 @@ RDGE.Engine = function () { }; /* - * give the contextID (canvas id) of the context to set + * give the contextID (canvas id) of the context to set */ this.setContext = function (contextID) { contextManager.currentCtx = contextManager.contextMap[contextID]; @@ -254,38 +254,38 @@ RDGE.Engine.prototype.init = function (userInitState, userRunState, canvasObject this.GlInit(canvasObject); globalParamFuncSet = function (param) { - this.data = param.data; - this.type =param.type; - + this.data = param.data; + this.type =param.type; + this.set = function (v) { - var len = this.data ? this.data.length : 0; - for(var i=0;i -1) { - var curSceneReq = this.sceneLoadQueue[sceneLoadTop]; - - // check for completed mesh requests and load the data + var curSceneReq = this.sceneLoadQueue[sceneLoadTop]; + + // check for completed mesh requests and load the data RDGE.globals.meshMan.processMeshData(); if (curSceneReq.doSceneRequest) { - curSceneReq.requestScene(); - } + curSceneReq.requestScene(); + } else if (curSceneReq.requestComplete) { if (curSceneReq.sceneBeginProcessing) { - // Load meshes attached to the scene + // Load meshes attached to the scene curSceneReq.scene = new RDGE.SceneGraph(curSceneReq.rawData); - curSceneReq.scene.enableShadows( true ); + curSceneReq.scene.enableShadows( true ); RDGE.globals.engine.AddScene(curSceneReq.name, curSceneReq.scene); - // setup the scene and save a map of mesh names - // that will be check off as the meshes load - curSceneReq.scene.Traverse(curSceneReq.sceneProcessor, false); - - // processing is complete - curSceneReq.sceneBeginProcessing = false; - } - // if we are here than the scene is processed but meshes are still loading/processing asynchronously + // setup the scene and save a map of mesh names + // that will be check off as the meshes load + curSceneReq.scene.Traverse(curSceneReq.sceneProcessor, false); + + // processing is complete + curSceneReq.sceneBeginProcessing = false; + } + // if we are here than the scene is processed but meshes are still loading/processing asynchronously else if (curSceneReq.processingComplete()) { - // pop the head node - var sceneReq = this.sceneLoadQueue.shift(); - this.userRunState.onComplete(sceneReq.name, sceneReq.scene); - } - } - - } - - // load any waiting textures + // pop the head node + var sceneReq = this.sceneLoadQueue.shift(); + this.userRunState.onComplete(sceneReq.name, sceneReq.scene); + } + } + + } + + // load any waiting textures while (this.textureLoadQueue.length > 0) { - this.renderer.commitTexture( this.textureLoadQueue.shift() ); - } - - // if there is nothing left to load move back to the run state + this.renderer.commitTexture( this.textureLoadQueue.shift() ); + } + + // if there is nothing left to load move back to the run state if (this.sceneLoadQueue.length == 0 && this.textureLoadQueue.length == 0) { - // loaded... remove the state + // loaded... remove the state var stateMan = RDGE.globals.engine.getContext().ctxStateManager; - stateMan.PopState(); - } - + stateMan.PopState(); + } + if (RDGE.globals.engine.getContext().getScene() && RDGE.globals.engine.getContext().getScene() != "not-ready" && this.stateManager.RDGERunState.initialized) - this.userRunState.update(dt); + this.userRunState.update(dt); }; RDGE.LoadState.prototype.Draw = function () { - this.renderer._clear(); - + this.renderer._clear(); + if (RDGE.globals.engine.getContext().getScene() && RDGE.globals.engine.getContext().getScene() != "not-ready" && this.stateManager.RDGERunState.initialized) - this.userRunState.draw(); + this.userRunState.draw(); }; - + RDGE.LoadState.prototype.Shutdown = function () { }; RDGE.LoadState.prototype.LeaveState = function () { if (this.userRunState.onComplete != undefined) { - this.userRunState.onComplete(); - } + this.userRunState.onComplete(); + } }; RDGE.LoadState.prototype.MakeSceneRequest = function (addr, name) { - this.hasScene = true; - this.lastSceneName = name; + this.hasScene = true; + this.lastSceneName = name; var request = new XMLHttpRequest(); request.initState = this; RDGE.globals.engine.getContext().sceneGraphMap[name] = "not-ready"; @@ -174,141 +174,141 @@ RDGE.LoadState.prototype.MakeSceneRequest = function (addr, name) { // scene traversal functor to setup the scene RDGE.SetupScene = function () { - this.renderer = RDGE.globals.engine.getContext().renderer; - this.meshLoadingMap = []; - this.onMeshLoaded = function (meshName) { - // if the mesh was loading (and is defined) mark it as no longer loading - if(this.meshLoadingMap[meshName]) - this.meshLoadingMap[meshName].stillLoading = false; - }; - - // set a call back handler to notify us when a mesh is loaded - RDGE.globals.meshMan.addOnLoadedCallback( this ); + this.renderer = RDGE.globals.engine.getContext().renderer; + this.meshLoadingMap = []; + this.onMeshLoaded = function (meshName) { + // if the mesh was loading (and is defined) mark it as no longer loading + if(this.meshLoadingMap[meshName]) + this.meshLoadingMap[meshName].stillLoading = false; + }; + + // set a call back handler to notify us when a mesh is loaded + RDGE.globals.meshMan.addOnLoadedCallback( this ); }; RDGE.SetupScene.prototype.process = function (trNode, parent) { RDGE.verifyTransformNode(trNode); - // create and assign parent node - trNode.parent = parent; + // create and assign parent node + trNode.parent = parent; if (trNode.local !== undefined) { trNode.local = RDGE.mat4.transpose(trNode.local); - } + } if (((trNode.materialNode || {}).meshNode || {}) != 'undefined') { if (trNode.materialNode !== undefined) { var lookup = RDGE.globals.meshMan.loadMesh(trNode.materialNode.meshNode.mesh); - - //~~~~ Hack - the mesh node should be placed in an array of meshes under the transform when exported - trNode.meshes.push(trNode.materialNode.meshNode); + + //~~~~ Hack - the mesh node should be placed in an array of meshes under the transform when exported + trNode.meshes.push(trNode.materialNode.meshNode); - // if the mesh is not loaded add it to our map + // if the mesh is not loaded add it to our map if (lookup == null) { - // mark this mesh as loading - this.meshLoadingMap[trNode.materialNode.meshNode.mesh.name] = { 'stillLoading':true, 'remotelyLoading':false }; - } + // mark this mesh as loading + this.meshLoadingMap[trNode.materialNode.meshNode.mesh.name] = { 'stillLoading':true, 'remotelyLoading':false }; + } else { - // just because its in the mesh manager doesn't mean its ready, but - // if the primitive exists than it is ready to go + // just because its in the mesh manager doesn't mean its ready, but + // if the primitive exists than it is ready to go if (lookup.primitive) { - // create the buffer for this renderer - this.renderer.createPrimitive(lookup.primitive); - } - // first see if this scene is the scene already loading this mesh + // create the buffer for this renderer + this.renderer.createPrimitive(lookup.primitive); + } + // first see if this scene is the scene already loading this mesh else if (!this.meshLoadingMap[trNode.materialNode.meshNode.mesh.name]) { - // mark this mesh as loading - this.meshLoadingMap[trNode.materialNode.meshNode.mesh.name] = { 'stillLoading':true, 'remotelyLoading':true }; - } - - } - - //add set texture helper function + // mark this mesh as loading + this.meshLoadingMap[trNode.materialNode.meshNode.mesh.name] = { 'stillLoading':true, 'remotelyLoading':true }; + } + + } + + //add set texture helper function RDGE.verifyMaterialNode(trNode.materialNode); - var mapLookUp = []; - mapLookUp["TEX_DIF"] = {'slot':0, 'uni':"colMap"}; // type to texture slot look up - mapLookUp["TEX_SPEC"] = {'slot':1, 'uni':"envMap"}; - mapLookUp["TEX_NORM"] = {'slot':2, 'uni':"normalMap"}; - mapLookUp["TEX_GLOW"] = {'slot':3, 'uni':"glowMap"}; + var mapLookUp = []; + mapLookUp["TEX_DIF"] = {'slot':0, 'uni':"colMap"}; // type to texture slot look up + mapLookUp["TEX_SPEC"] = {'slot':1, 'uni':"envMap"}; + mapLookUp["TEX_NORM"] = {'slot':2, 'uni':"normalMap"}; + mapLookUp["TEX_GLOW"] = {'slot':3, 'uni':"glowMap"}; - // get handle and setup slot bindings - var texList = trNode.materialNode.textureList; - var extractedList = []; + // get handle and setup slot bindings + var texList = trNode.materialNode.textureList; + var extractedList = []; for (var i = 0; i < texList.length; ++i) { - var handle = this.renderer.getTextureByName(texList[i].name); + var handle = this.renderer.getTextureByName(texList[i].name); extractedList[i] = { 'name': mapLookUp[texList[i].type].uni, 'handle': handle, 'unit': mapLookUp[texList[i].type].slot, 'type': RDGE.UNIFORMTYPE.TEXTURE2D }; - } - - trNode.materialNode.textureList = extractedList; - } - } + } + + trNode.materialNode.textureList = extractedList; + } + } if ((trNode.lightNode || {}) != 'undefined') { if (trNode.lightNode !== undefined) { - trNode.lightNode.parent = trNode; + trNode.lightNode.parent = trNode; RDGE.globals.engine.lightManager.setMapping(trNode.lightNode, trNode.lightNode.links); - } + } } }; RDGE.sceneRequestDef = function (addr, sceneName) { - this.name = sceneName; - this.addr = addr; - this.sceneBeginProcessing = false; - this.requestComplete = false; + this.name = sceneName; + this.addr = addr; + this.sceneBeginProcessing = false; + this.requestComplete = false; this.sceneProcessor = new RDGE.SetupScene(); - this.doSceneRequest = false; - - /* - * @return - returns true when all meshes for the request are done - */ + this.doSceneRequest = false; + + /* + * @return - returns true when all meshes for the request are done + */ this.processingComplete = function () { for (var m in this.sceneProcessor.meshLoadingMap) { - // if a mesh is still loading than loading is not complete + // if a mesh is still loading than loading is not complete if (this.sceneProcessor.meshLoadingMap[m].stillLoading == false) { - + if (this.sceneProcessor.meshLoadingMap[m].remotelyLoading == true) { - // In this case we need to generate the buffers on our render device + // In this case we need to generate the buffers on our render device var mesh = RDGE.globals.meshMan.getModelByName(m); - this.sceneProcessor.renderer.createPrimitive(mesh.primitive); - } - } + this.sceneProcessor.renderer.createPrimitive(mesh.primitive); + } + } else { - return false; - } - } - - // loading done - return true; + return false; + } + } + + // loading done + return true; }; - + this.requestScene = function () { - this.doSceneRequest = false; - - var request = new XMLHttpRequest(); - request.handler = this; - - // set this scene as not-ready just in case anyone is looking for it + this.doSceneRequest = false; + + var request = new XMLHttpRequest(); + request.handler = this; + + // set this scene as not-ready just in case anyone is looking for it RDGE.globals.engine.getContext().sceneGraphMap[name] = "not-ready"; - - // on request complete - set the flags of this request to trigger the next step in loading + + // on request complete - set the flags of this request to trigger the next step in loading request.onreadystatechange = function () { - if (request.readyState == 4) { + if (request.readyState == 4) { if (request.status == 200 || window.location.href.indexOf("http") == -1) { - this.handler.rawData = eval("(" + request.responseText + ")"); //retrieve result as an JavaScript object - this.handler.requestComplete = true; - this.handler.sceneBeginProcessing = true; - } + this.handler.rawData = eval("(" + request.responseText + ")"); //retrieve result as an JavaScript object + this.handler.requestComplete = true; + this.handler.sceneBeginProcessing = true; + } else { - alert("An error has occured making the request"); - } - } - } - - request.open("GET", addr, true); - request.send(null); + alert("An error has occured making the request"); + } + } + } + + request.open("GET", addr, true); + request.send(null); }; }; diff --git a/js/helper-classes/RDGE/src/core/script/jpass.js b/js/helper-classes/RDGE/src/core/script/jpass.js index e3c5a342..934f0268 100755 --- a/js/helper-classes/RDGE/src/core/script/jpass.js +++ b/js/helper-classes/RDGE/src/core/script/jpass.js @@ -33,8 +33,8 @@ POSSIBILITY OF SUCH DAMAGE. var RDGE = RDGE || {}; /* -* jpass geometry set - determines the category(s) of geometry that a pass will render -* can be OR'ed together +* jpass geometry set - determines the category(s) of geometry that a pass will render +* can be OR'ed together */ RDGE.jpassGeoSet = { @@ -52,8 +52,8 @@ RDGE.jpassGeoSet = /* -* The abstract base class that defines a jpass -* a jpass represents a single render pass of the scene graph +* The abstract base class that defines a jpass +* a jpass represents a single render pass of the scene graph */ RDGE._jpassBaseClass = function () { this.context = RDGE.globals.engine.getContext(); @@ -74,18 +74,18 @@ RDGE._jpassBaseClass = function () { this.name = "renderPass_" + RDGE.nodeIdGen.getId(); /* - * if 0 this pass and children are culled from rendering + * if 0 this pass and children are culled from rendering */ this.visibility = 1; /* - * called when the pass is hidden - override for customication + * called when the pass is hidden - override for customication */ this.onHide = function () { }; /* - * Called by the system to hide the pass and its children + * Called by the system to hide the pass and its children */ this.hidePass = function () { this.onHide(); @@ -96,7 +96,7 @@ RDGE._jpassBaseClass = function () { }; /* - * the default output render targets that this pass will create + * the default output render targets that this pass will create */ this.defaultTargetOut = {}; @@ -104,87 +104,87 @@ RDGE._jpassBaseClass = function () { * All the outputs required by the pass */ this.outputs = - [ + [ // example // {'name':"u_mainRT", 'type':"target", 'width':1024, 'height':1024, 'mips':false} - ]; + ]; /* - * notifies the the renderer that the viewport was modified and needs to be reset + * notifies the the renderer that the viewport was modified and needs to be reset */ this.dirty = false; /* - * Index of the currently selected output target + * Index of the currently selected output target */ this.outputIndex = 0; /* - * outputs from the previous pass are set as inputs for this pass + * outputs from the previous pass are set as inputs for this pass */ this.inputs = []; /* - * other textures requested for this pass + * other textures requested for this pass */ this.textures = []; /* - * the flags that control how the pass is rendered + * the flags that control how the pass is rendered */ - this.frustum_culling = "enable"; // disable/enable frustum culling during the pass - this.clear = null; // flags to clear the output target with before rendering + this.frustum_culling = "enable"; // disable/enable frustum culling during the pass + this.clear = null; // flags to clear the output target with before rendering this.clearColor = null; /* - * Contains a list of geometry to be rendered, during a post process render pass this will usually by a screen quad + * Contains a list of geometry to be rendered, during a post process render pass this will usually by a screen quad */ this.renderList = - [ + [ // example // { 'name':'opaqeobjects', 'geo'{ 'OPAQUE':[ new renderObject(meshNode, transformNode, RenderContext)]} } - ]; + ]; /* - * The passes that will render after this pass + * The passes that will render after this pass */ this.children = []; /* - * This shader will override all other shaders + * This shader will override all other shaders */ this.shader = null; /* - * Technique of from shader to use, if null currently set technique is used + * Technique of from shader to use, if null currently set technique is used */ this.technique = null; /* - * determines the geometry that will be rendered during the pass + * determines the geometry that will be rendered during the pass */ this.geometrySet = "SCREEN_QUAD"; /* - * A camera set here will override any camera active in the scene + * A camera set here will override any camera active in the scene */ this.camera = null; /* - * Initialize the pass + * Initialize the pass */ this.init = function () { }; /* - * inserts a node into the child map using the pass name as the key + * inserts a node into the child map using the pass name as the key */ this.insertChildPass = function (jpassObj) { this.children[jpassObj.name] = jpassObj; }; /* - * the scene-graph to process + * the scene-graph to process */ this.process = function () { // pre-defined local variables to prevent allocation @@ -227,7 +227,7 @@ RDGE._jpassBaseClass = function () { RDGE.rdgeGlobalParameters.u_projMatrix.set(renderer.projectionMatrix); for (var bucketIdx = 0, bckCnt = this.renderList.length; bucketIdx < bckCnt; ++bucketIdx) { - //var curList = this.renderList[bucketIdx]; + //var curList = this.renderList[bucketIdx]; listCount = this.renderList[bucketIdx].length; for (nodeIdx = 0; nodeIdx < listCount; ++nodeIdx) { @@ -293,22 +293,22 @@ RDGE._jpassBaseClass = function () { }; /* - * handle any setup 'before' processing the geo/scenegraph - * the first step in the pass + * handle any setup 'before' processing the geo/scenegraph + * the first step in the pass */ this.preRender = function () { }; /* - * handle any setup 'after' processing the geo/scenegraph - * the last step in the pass + * handle any setup 'after' processing the geo/scenegraph + * the last step in the pass */ this.postRender = function () { }; /* - * Custom function to handle any processing in between jshader passes + * Custom function to handle any processing in between jshader passes */ this.onPassEnd = function () { if (this.outputIndex + 1 < this.outputs.length) @@ -316,22 +316,22 @@ RDGE._jpassBaseClass = function () { }; /* - * Set the list of objects to render + * Set the list of objects to render */ this.setRenderList = function (contextList) { this.renderList = contextList; }; /* - * Set the render targets to use as input for the next pass + * Set the render targets to use as input for the next pass */ this.setInputs = function (inputsArr) { this.inputs = inputsArr.slice(); }; /* - * Augment the textureList passed in with the input textures - * this will cause the textures to be bound to the jshader + * Augment the textureList passed in with the input textures + * this will cause the textures to be bound to the jshader */ this.updateTextureContext = function (textureList) { var inputs = this.inputs.slice(); @@ -346,7 +346,7 @@ RDGE._jpassBaseClass = function () { }; /* - * If there is an output surface this will bind it + * If there is an output surface this will bind it */ this.bindOutput = function () { this.outputIndex = 0; @@ -373,7 +373,7 @@ RDGE._jpassBaseClass = function () { }; /* - * If an output surface was bound this will unbind it + * If an output surface was bound this will unbind it */ this.unbindOutput = function () { if (this.dirty) { @@ -385,7 +385,7 @@ RDGE._jpassBaseClass = function () { }; /* -* The concrete class to be used when creating a scene pass +* The concrete class to be used when creating a scene pass */ RDGE.jpass = function (def) { // inherit from the base class @@ -431,8 +431,8 @@ RDGE.jpass = function (def) { else if ("renderList" == obj) { // put the items listed into their buckets var renderList = new Array(RDGE.rdgeConstants.categoryEnumeration.MAX_CAT); - renderList[RDGE.rdgeConstants.categoryEnumeration.BACKGROUND] = []; //BACKGROUND - renderList[RDGE.rdgeConstants.categoryEnumeration.OPAQUE] = []; //OPAQUE + renderList[RDGE.rdgeConstants.categoryEnumeration.BACKGROUND] = []; //BACKGROUND + renderList[RDGE.rdgeConstants.categoryEnumeration.OPAQUE] = []; //OPAQUE renderList[RDGE.rdgeConstants.categoryEnumeration.TRANSPARENT] = []; //TRANSPARENT renderList[RDGE.rdgeConstants.categoryEnumeration.ADDITIVE] = []; //ADDITIVE renderList[RDGE.rdgeConstants.categoryEnumeration.TRANSLUCENT] = []; //TRANSLUCENT @@ -504,7 +504,7 @@ RDGE.jpass = function (def) { }; /* -* a graph describing the hierarchy of scene pass objects to create the final composition +* a graph describing the hierarchy of scene pass objects to create the final composition */ RDGE.jpassGraph = function (def) { // the root pass @@ -532,7 +532,7 @@ RDGE.jpassGraph = function (def) { }; /* - * Helper function to generate the references to passes available as passGraph."passName" + * Helper function to generate the references to passes available as passGraph."passName" */ this._initHelper = function (node) { if (!node) @@ -547,8 +547,8 @@ RDGE.jpassGraph = function (def) { this._initHelper(this.root); /* - * @param parentName - the name of the parent object to insert under - * @param jpassObj - the jpass object to insert + * @param parentName - the name of the parent object to insert under + * @param jpassObj - the jpass object to insert */ this.insertAsChild = function (parentName, jpassObj) { this.find = parentName; @@ -564,7 +564,7 @@ RDGE.jpassGraph = function (def) { }; /* - * Recursive helper function for traversing the graph and insterting the node + * Recursive helper function for traversing the graph and insterting the node */ this._insertHelper = function (node) { if (!node) @@ -592,9 +592,9 @@ RDGE.jpassGraph = function (def) { } /* - * Traverse the render graph, breadth first to produce the final render output - * note: breadth first is used to allow generation of an entire level at once, - * the peers in one level could, in theory, be processed in parallel + * Traverse the render graph, breadth first to produce the final render output + * note: breadth first is used to allow generation of an entire level at once, + * the peers in one level could, in theory, be processed in parallel */ this.render = function (sceneGraph) { diff --git a/js/helper-classes/RDGE/src/core/script/jshader.js b/js/helper-classes/RDGE/src/core/script/jshader.js index b9170857..f8d79580 100755 --- a/js/helper-classes/RDGE/src/core/script/jshader.js +++ b/js/helper-classes/RDGE/src/core/script/jshader.js @@ -31,46 +31,46 @@ POSSIBILITY OF SUCH DAMAGE. // RDGE namespaces var RDGE = RDGE || {}; -/* +/* this API should be familiar to anyone who has worked with HLSL effect files. */ /* - * A map of types to uniform 'binding' functions + * A map of types to uniform 'binding' functions */ RDGE.bindMap={}; -RDGE.bindMap['int'] = function(ctx, a,b) { ctx.uniform1iv(a,b); }; -RDGE.bindMap['float'] = function(ctx, a,b) { ctx.uniform1fv(a,b); }; -RDGE.bindMap['vec2'] = function(ctx, a,b) { ctx.uniform2fv(a,b); }; -RDGE.bindMap['vec3'] = function(ctx, a,b) { ctx.uniform3fv(a,b); }; -RDGE.bindMap['vec4'] = function(ctx, a,b) { ctx.uniform4fv(a,b); }; -RDGE.bindMap['mat3'] = function(ctx, a,b) { ctx.uniformMatrix3fv(a,false,b); }; -RDGE.bindMap['mat4'] = function(ctx, a,b) +RDGE.bindMap['int'] = function(ctx, a,b) { ctx.uniform1iv(a,b); }; +RDGE.bindMap['float'] = function(ctx, a,b) { ctx.uniform1fv(a,b); }; +RDGE.bindMap['vec2'] = function(ctx, a,b) { ctx.uniform2fv(a,b); }; +RDGE.bindMap['vec3'] = function(ctx, a,b) { ctx.uniform3fv(a,b); }; +RDGE.bindMap['vec4'] = function(ctx, a,b) { ctx.uniform4fv(a,b); }; +RDGE.bindMap['mat3'] = function(ctx, a,b) { ctx.uniformMatrix3fv(a,false,b); }; +RDGE.bindMap['mat4'] = function(ctx, a,b) { - ctx.uniformMatrix4fv(a,false,b); - RDGE.globals.engine.getContext().debug.mat4CallCount++; + ctx.uniformMatrix4fv(a,false,b); + RDGE.globals.engine.getContext().debug.mat4CallCount++; }; -RDGE.bindMap['tex2d'] = function(ctx, a,b) +RDGE.bindMap['tex2d'] = function(ctx, a,b) { - ctx.activeTexture(ctx.TEXTURE0+b[0]); - ctx.bindTexture(ctx.TEXTURE_2D, b[1]); - ctx.uniform1iv(a,[b[0]]); + ctx.activeTexture(ctx.TEXTURE0+b[0]); + ctx.bindTexture(ctx.TEXTURE_2D, b[1]); + ctx.uniform1iv(a,[b[0]]); }; RDGE.bindMap['texCube']=function(ctx, a,b) { - ctx.activeTexture(ctx.TEXTURE0+b[0]); - ctx.bindTexture(ctx.TEXTURE_CUBE_MAP, b[1]); - ctx.uniform1iv(a,[b[0]]); + ctx.activeTexture(ctx.TEXTURE0+b[0]); + ctx.bindTexture(ctx.TEXTURE_CUBE_MAP, b[1]); + ctx.uniform1iv(a,[b[0]]); }; RDGE.lightDataMap = [ - function(ctx, loc, lightNode) { ctx.uniform3fv(loc, lightNode.position); }, - function(ctx, loc, lightNode) { ctx.uniform4fv(loc, lightNode.lightDiffuse); }, - function(ctx, loc, lightNode) { ctx.uniform4fv(loc, lightNode.lightAmbient); }, - function(ctx, loc, lightNode) { ctx.uniform4fv(loc, lightNode.lightSpecular); } + function(ctx, loc, lightNode) { ctx.uniform3fv(loc, lightNode.position); }, + function(ctx, loc, lightNode) { ctx.uniform4fv(loc, lightNode.lightDiffuse); }, + function(ctx, loc, lightNode) { ctx.uniform4fv(loc, lightNode.lightAmbient); }, + function(ctx, loc, lightNode) { ctx.uniform4fv(loc, lightNode.lightSpecular); } ]; RDGE.paramTypeNameMapping = null; @@ -120,7 +120,7 @@ RDGE.jshader = function (addr) { } /* - * private helper functions + * private helper functions */ this.bindParameters = function (pass) { var params = pass.defParamsList; // global parameters to start with @@ -177,7 +177,7 @@ RDGE.jshader = function (addr) { }; /* - * helper function for setting up a texture + * helper function for setting up a texture */ createJShaderTexture = function (ctx, param) { var texHandle = null; @@ -310,9 +310,9 @@ RDGE.jshader = function (addr) { defaultTech = t; var curTechnique = techniques[t]; this[t] = - { - 'passes': [] - }; + { + 'passes': [] + }; var numPasses = curTechnique.length; var i = 0; while (i < numPasses) { @@ -445,7 +445,7 @@ RDGE.jshader = function (addr) { }; /* - * Init a local parameter at any time during the life of the jshader. + * Init a local parameter at any time during the life of the jshader. * This will add the parameter to the list of parameters to be bound * before rendering */ @@ -587,7 +587,7 @@ RDGE.jshader = function (addr) { }; /* - * Set the light nodes used by this jshader + * Set the light nodes used by this jshader * array item 0 corresponds to light 0, item 1 tp light 1 and so on * place null for lights that are not there */ @@ -601,7 +601,7 @@ RDGE.jshader = function (addr) { }; /* - * Called by the system to add material textures settings to the jshader + * Called by the system to add material textures settings to the jshader */ this.setTextureContext = function (textureList) { var passCount = this.technique.passes.length; diff --git a/js/helper-classes/RDGE/src/core/script/lightmanager.js b/js/helper-classes/RDGE/src/core/script/lightmanager.js index e38418f5..2b20295c 100755 --- a/js/helper-classes/RDGE/src/core/script/lightmanager.js +++ b/js/helper-classes/RDGE/src/core/script/lightmanager.js @@ -71,12 +71,12 @@ RDGE.LightManager = function (lightUniformList) { this.typeDirLight = "dir_light"; this.defaultLights = - [ - RDGE.createLightNode("default0"), - RDGE.createLightNode("default1"), - RDGE.createLightNode("default2"), - RDGE.createLightNode("default3") - ]; + [ + RDGE.createLightNode("default0"), + RDGE.createLightNode("default1"), + RDGE.createLightNode("default2"), + RDGE.createLightNode("default3") + ]; }; /* diff --git a/js/helper-classes/RDGE/src/core/script/math/mat4.js b/js/helper-classes/RDGE/src/core/script/math/mat4.js index 32c7111c..e2907272 100755 --- a/js/helper-classes/RDGE/src/core/script/math/mat4.js +++ b/js/helper-classes/RDGE/src/core/script/math/mat4.js @@ -33,21 +33,21 @@ POSSIBILITY OF SUCH DAMAGE. * containing at least 16 numeric components can represent a 4x4 matrix. * * For example, all of these are valid matrix construction methods: -* ... -* var a = mat4.identity(); -* var b = mat4.perspective(90, aspectRatio, 0.1, 100.00); -* var c = mat4.lookAt( [0, 0, 0], [1, 0, 0], [ 0, 1, 0 ] ); -* var d = mat4.basis( [1, 0, 0], [0, 1, 0], [ 0, 0, 1 ] ); +* ... +* var a = mat4.identity(); +* var b = mat4.perspective(90, aspectRatio, 0.1, 100.00); +* var c = mat4.lookAt( [0, 0, 0], [1, 0, 0], [ 0, 1, 0 ] ); +* var d = mat4.basis( [1, 0, 0], [0, 1, 0], [ 0, 0, 1 ] ); * * This library is implemented assuming components are arranged * contiguously in memory as such: -* M = [ x0, x1, x2, x3, -* y0, y1, y2, y3, -* z0, z1, z2, z3, -* w0, w1, w2, w3 ]; +* M = [ x0, x1, x2, x3, +* y0, y1, y2, y3, +* z0, z1, z2, z3, +* w0, w1, w2, w3 ]; * The translation components of a transformation matrix would be stored in * w0, w1, w2, or at indices 12, 13, and 14 of the array, as is consistent -* with OpenGL. +* with OpenGL. */ // RDGE namespaces var RDGE = RDGE || {}; @@ -102,9 +102,9 @@ RDGE.mat4.verify = function (m) { */ RDGE.mat4.copy = function (m) { return [m[0], m[1], m[2], m[3], - m[4], m[5], m[6], m[7], - m[8], m[9], m[10], m[11], - m[12], m[13], m[14], m[15]]; + m[4], m[5], m[6], m[7], + m[8], m[9], m[10], m[11], + m[12], m[13], m[14], m[15]]; }; /** @@ -134,9 +134,9 @@ RDGE.mat4.inplace_copy = function (dst, src) { */ RDGE.mat4.identity = function () { return [1.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0]; + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0]; }; /** @@ -144,9 +144,9 @@ RDGE.mat4.identity = function () { */ RDGE.mat4.zero = function () { return [0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0]; + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0]; }; /** @@ -156,14 +156,14 @@ RDGE.mat4.zero = function () { RDGE.mat4.basis = function (rowx, rowy, rowz, roww) { if (roww == null || roww == undefined) { return [rowx[0], rowx[1], rowx[2], 0.0, - rowy[0], rowy[1], rowy[2], 0.0, - rowz[0], rowz[1], rowz[2], 0.0, - 0, 0, 0, 1.0]; + rowy[0], rowy[1], rowy[2], 0.0, + rowz[0], rowz[1], rowz[2], 0.0, + 0, 0, 0, 1.0]; } else { return [rowx[0], rowx[1], rowx[2], rowx.length == 4 ? rowx[3] : 0.0, - rowy[0], rowy[1], rowy[2], rowy.length == 4 ? rowy[3] : 0.0, - rowz[0], rowz[1], rowz[2], rowz.length == 4 ? rowz[3] : 0.0, - roww[0], roww[1], roww[2], roww.length == 4 ? roww[3] : 1.0]; + rowy[0], rowy[1], rowy[2], rowy.length == 4 ? rowy[3] : 0.0, + rowz[0], rowz[1], rowz[2], rowz.length == 4 ? rowz[3] : 0.0, + roww[0], roww[1], roww[2], roww.length == 4 ? roww[3] : 1.0]; } }; @@ -353,24 +353,24 @@ RDGE.mat4.mul = function (a, b) { var b15 = b[15]; return [a00 * b00 + a01 * b04 + a02 * b08 + a03 * b12, - a00 * b01 + a01 * b05 + a02 * b09 + a03 * b13, - a00 * b02 + a01 * b06 + a02 * b10 + a03 * b14, - a00 * b03 + a01 * b07 + a02 * b11 + a03 * b15, + a00 * b01 + a01 * b05 + a02 * b09 + a03 * b13, + a00 * b02 + a01 * b06 + a02 * b10 + a03 * b14, + a00 * b03 + a01 * b07 + a02 * b11 + a03 * b15, - a04 * b00 + a05 * b04 + a06 * b08 + a07 * b12, - a04 * b01 + a05 * b05 + a06 * b09 + a07 * b13, - a04 * b02 + a05 * b06 + a06 * b10 + a07 * b14, - a04 * b03 + a05 * b07 + a06 * b11 + a07 * b15, + a04 * b00 + a05 * b04 + a06 * b08 + a07 * b12, + a04 * b01 + a05 * b05 + a06 * b09 + a07 * b13, + a04 * b02 + a05 * b06 + a06 * b10 + a07 * b14, + a04 * b03 + a05 * b07 + a06 * b11 + a07 * b15, - a08 * b00 + a09 * b04 + a10 * b08 + a11 * b12, - a08 * b01 + a09 * b05 + a10 * b09 + a11 * b13, - a08 * b02 + a09 * b06 + a10 * b10 + a11 * b14, - a08 * b03 + a09 * b07 + a10 * b11 + a11 * b15, + a08 * b00 + a09 * b04 + a10 * b08 + a11 * b12, + a08 * b01 + a09 * b05 + a10 * b09 + a11 * b13, + a08 * b02 + a09 * b06 + a10 * b10 + a11 * b14, + a08 * b03 + a09 * b07 + a10 * b11 + a11 * b15, - a12 * b00 + a13 * b04 + a14 * b08 + a15 * b12, - a12 * b01 + a13 * b05 + a14 * b09 + a15 * b13, - a12 * b02 + a13 * b06 + a14 * b10 + a15 * b14, - a12 * b03 + a13 * b07 + a14 * b11 + a15 * b15]; + a12 * b00 + a13 * b04 + a14 * b08 + a15 * b12, + a12 * b01 + a13 * b05 + a14 * b09 + a15 * b13, + a12 * b02 + a13 * b06 + a14 * b10 + a15 * b14, + a12 * b03 + a13 * b07 + a14 * b11 + a15 * b15]; }; /** @@ -409,24 +409,24 @@ RDGE.mat4.mul4x3 = function (a, b) { var b14 = b[14]; return [a00 * b00 + a01 * b04 + a02 * b08, - a00 * b01 + a01 * b05 + a02 * b09, - a00 * b02 + a01 * b06 + a02 * b10, - 0, + a00 * b01 + a01 * b05 + a02 * b09, + a00 * b02 + a01 * b06 + a02 * b10, + 0, - a04 * b00 + a05 * b04 + a06 * b08, - a04 * b01 + a05 * b05 + a06 * b09, - a04 * b02 + a05 * b06 + a06 * b10, - 0, + a04 * b00 + a05 * b04 + a06 * b08, + a04 * b01 + a05 * b05 + a06 * b09, + a04 * b02 + a05 * b06 + a06 * b10, + 0, - a08 * b00 + a09 * b04 + a10 * b08, - a08 * b01 + a09 * b05 + a10 * b09, - a08 * b02 + a09 * b06 + a10 * b10, - 0, + a08 * b00 + a09 * b04 + a10 * b08, + a08 * b01 + a09 * b05 + a10 * b09, + a08 * b02 + a09 * b06 + a10 * b10, + 0, - a12 * b00 + a13 * b04 + a14 * b08 + b12, - a12 * b01 + a13 * b05 + a14 * b09 + b13, - a12 * b02 + a13 * b06 + a14 * b10 + b14, - 1.0]; + a12 * b00 + a13 * b04 + a14 * b08 + b12, + a12 * b01 + a13 * b05 + a14 * b09 + b13, + a12 * b02 + a13 * b06 + a14 * b10 + b14, + 1.0]; }; /** @@ -441,8 +441,8 @@ RDGE.mat4._det2x2 = function (a, b, c, d) { */ RDGE.mat4._det3x3 = function (a1, a2, a3, b1, b2, b3, c1, c2, c3) { return a1 * RDGE.mat4._det2x2(b2, b3, c2, c3) - - b1 * RDGE.mat4._det2x2(a2, a3, c2, c3) - + c1 * RDGE.mat4._det2x2(a2, a3, b2, b3); + - b1 * RDGE.mat4._det2x2(a2, a3, c2, c3) + + c1 * RDGE.mat4._det2x2(a2, a3, b2, b3); }; /** @@ -470,9 +470,9 @@ RDGE.mat4._det4x4 = function (m) { var d4 = m[15]; return a1 * RDGE.mat4._det3x3(b2, b3, b4, c2, c3, c4, d2, d3, d4) - - b1 * RDGE.mat4._det3x3(a2, a3, a4, c2, c3, c4, d2, d3, d4) - + c1 * RDGE.mat4._det3x3(a2, a3, a4, b2, b3, b4, d2, d3, d4) - - d1 * RDGE.mat4._det3x3(a2, a3, a4, b2, b3, b4, c2, c3, c4); + - b1 * RDGE.mat4._det3x3(a2, a3, a4, c2, c3, c4, d2, d3, d4) + + c1 * RDGE.mat4._det3x3(a2, a3, a4, b2, b3, b4, d2, d3, d4) + - d1 * RDGE.mat4._det