From fb0a659c9ca3479fd6799325498b11f074689936 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Mon, 2 Apr 2012 14:57:31 -0700 Subject: -Namespaced all RDGE javascript. -Removed the following unused files from the build script /core/script/fx/blur.js /core/script/fx/ssao.js /core/script/animation.js - Fully removed the following from the build and from source control as they are unused or no longer needed /core/script/util/dbgpanel.js /core/script/util/fpsTracker.js /core/script/util/statTracker.js /core/script/input.js /core/script/TextureManager.js /core/script/ubershader.js --- js/lib/drawing/world.js | 58 ++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'js/lib/drawing') diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 3d6c6fc4..7c5fb136 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js @@ -141,45 +141,45 @@ var World = function GLWorld( canvas, use3D ) { // post-load processing of the scene this.init = function() { - var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle), - ctx2 = g_Engine.getContext(); + var ctx1 = RDGE.globals.engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle), + ctx2 = RDGE.globals.engine.getContext(); if (ctx1 != ctx2) console.log( "***** different contexts *****" ); this.renderer = ctx1.renderer; this.renderer._world = this; // create a camera, set its perspective, and then point it at the origin - var cam = new camera(); + var cam = new RDGE.camera(); this._camera = cam; cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar()); - cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], vec3.up()); + cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], RDGE.vec3.up()); // make this camera the active camera this.renderer.cameraManager().setActiveCamera(cam); // change clear color - //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); + //this.renderer.setClearFlags(RDGE.globals.engine.getContext().DEPTH_BUFFER_BIT); this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]); //this.renderer.NinjaWorld = this; // create an empty scene graph - this.myScene = new SceneGraph(); + this.myScene = new RDGE.SceneGraph(); // create some lights // light 1 - this.light = createLightNode("myLight"); + this.light = RDGE.createLightNode("myLight"); this.light.setPosition([0,0,1.2]); this.light.setDiffuseColor([0.75,0.9,1.0,1.0]); // light 2 - this.light2 = createLightNode("myLight2"); + this.light2 = RDGE.createLightNode("myLight2"); this.light2.setPosition([-0.5,0,1.2]); this.light2.setDiffuseColor([1.0,0.9,0.75,1.0]); // create a light transform - var lightTr = createTransformNode("lightTr"); + var lightTr = RDGE.createTransformNode("lightTr"); // create and attach a material - materials hold the light data - lightTr.attachMaterial(createMaterialNode("lights")); + lightTr.attachMaterial(RDGE.createMaterialNode("lights")); // enable light channels 1, 2 - channel 0 is used by the default shader lightTr.materialNode.enableLightChannel(1, this.light); @@ -192,9 +192,9 @@ var World = function GLWorld( canvas, use3D ) { this.myScene.addNode(lightTr); // Add the scene to the engine - necessary if you want the engine to draw for you - //g_Engine.AddScene("myScene" + this._canvas.id, this.myScene); + //RDGE.globals.engine.AddScene("myScene" + this._canvas.id, this.myScene); var name = this._canvas.getAttribute( "data-RDGE-id" ); - g_Engine.AddScene("myScene" + name, this.myScene); + RDGE.globals.engine.AddScene("myScene" + name, this.myScene); }; // main code for handling user interaction and updating the scene @@ -206,7 +206,7 @@ var World = function GLWorld( canvas, use3D ) { if (this._useWebGL) { // changed the global position uniform of light 0, another way to change behavior of a light - rdgeGlobalParameters.u_light0Pos.set( [5*Math.cos(this.elapsed), 5*Math.sin(this.elapsed), 20]); + RDGE.rdgeGlobalParameters.u_light0Pos.set([5 * Math.cos(this.elapsed), 5 * Math.sin(this.elapsed), 20]); // orbit the light nodes around the boxes this.light.setPosition([1.2*Math.cos(this.elapsed*2.0), 1.2*Math.sin(this.elapsed*2.0), 1.2*Math.cos(this.elapsed*2.0)]); @@ -223,8 +223,8 @@ var World = function GLWorld( canvas, use3D ) { // defining the draw function to control how the scene is rendered this.draw = function() { if (this._useWebGL) { - g_Engine.setContext( this._canvas.rdgeid ); - var ctx = g_Engine.getContext(); + RDGE.globals.engine.setContext( this._canvas.rdgeid ); + var ctx = RDGE.globals.engine.getContext(); var renderer = ctx.renderer; if (renderer.unloadedTextureCount <= 0) { renderer.disableCulling(); @@ -361,8 +361,8 @@ var World = function GLWorld( canvas, use3D ) { rdgeStarted = true; var id = this._canvas.getAttribute( "data-RDGE-id" ); this._canvas.rdgeid = id; - g_Engine.registerCanvas(this._canvas, this); - RDGEStart( this._canvas ); + RDGE.globals.engine.registerCanvas(this._canvas, this); + RDGE.RDGEStart( this._canvas ); this._canvas.task.stop() } }; @@ -391,13 +391,13 @@ World.prototype.updateObject = function (obj) { if (nPrims > 0) { ctrTrNode = obj.getTransformNode(); if (ctrTrNode == null) { - ctrTrNode = createTransformNode("objRootNode_" + nodeCounter++); + ctrTrNode = RDGE.createTransformNode("objRootNode_" + nodeCounter++); this._rootNode.insertAsChild( ctrTrNode ); obj.setTransformNode( ctrTrNode ); } ctrTrNode.meshes.forEach(function(thisMesh) { - g_meshMan.deleteMesh(thisMesh.mesh.name); + RDGE.globals.meshMan.deleteMesh(thisMesh.mesh.name); }); ctrTrNode.meshes = []; @@ -416,11 +416,11 @@ World.prototype.updateObject = function (obj) { childTrNode = children[i-1].transformNode; childTrNode.meshes.forEach(function(thisMesh) { - g_meshMan.deleteMesh(thisMesh.mesh.name); + RDGE.globals.meshMan.deleteMesh(thisMesh.mesh.name); }); childTrNode.meshes = []; } else { - childTrNode = createTransformNode("objNode_" + nodeCounter++); + childTrNode = RDGE.createTransformNode("objNode_" + nodeCounter++); ctrTrNode.insertAsChild(childTrNode); } @@ -522,7 +522,7 @@ World.prototype.clearTree = function() { if (this._useWebGL) { var root = this._rootNode; root.children = new Array(); - g_Engine.unregisterCanvas( this._canvas.rdgeid ) + RDGE.globals.engine.unregisterCanvas( this._canvas.rdgeid ) this.update( 0 ); this.draw(); @@ -657,9 +657,9 @@ World.prototype.setMVMatrix = function() { gl.uniformMatrix4fv(this._shaderProgram.mvMatrixUniform, false, new Float32Array(mvMatrix)); var normalMatrix = mat3.create(); - // mat4.toInverseMat3(mvMatrix, normalMatrix); - // mat4.toInverseMat3(new Float32Array(mvMatrix.flatten()), normalMatrix); - mat4.toInverseMat3(new Float32Array(mvMatrix), normalMatrix); + // RDGE.mat4.toInverseMat3(mvMatrix, normalMatrix); + // RDGE.mat4.toInverseMat3(new Float32Array(mvMatrix.flatten()), normalMatrix); + RDGE.mat4.toInverseMat3(new Float32Array(mvMatrix), normalMatrix); mat3.transpose(normalMatrix); gl.uniformMatrix3fv(this._shaderProgram.nMatrixUniform, false, normalMatrix); } @@ -680,7 +680,7 @@ World.prototype.render = function() { var root = this.getGeomRoot(); this.hRender( root ); } else { - g_Engine.setContext( this._canvas.rdgeId ); + RDGE.globals.engine.setContext( this._canvas.rdgeId ); //this.draw(); this.restartRenderLoop(); } @@ -895,16 +895,16 @@ World.prototype.importSubObject = function( objStr, parentNode ) { i0 += 10; var matText = objStr.substr( i0, i1 - i0 ); var shaderDef = JSON.parse( matText ); - var shader = new jshader(); + var shader = new RDGE.jshader(); shader.def = shaderDef; shader.init(); // set the shader for this material - var matNode = createMaterialNode("objMat") + var matNode = RDGE.createMaterialNode("objMat") matNode.setShader(shader); // create the transformation node - var trNode = createTransformNode("subObjNode_" ); + var trNode = RDGE.createTransformNode("subObjNode_"); trNode.attachMeshNode(this.renderer.id + "_prim_", meshObj); trNode.attachMaterial(matNode); parentNode.insertAsChild(trNode); -- cgit v1.2.3 From b4ba63045158e108356e065c1237fb72b56473a5 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 09:39:38 -0700 Subject: fixed remaining namespace bugs ensuring the use of the RDGE namespace everywhere it is required --- js/lib/drawing/world.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/lib/drawing') diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 436853bd..801c199a 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js @@ -901,8 +901,8 @@ World.prototype.importJSON = function( jObj ) rdgeStarted = true; var id = this._canvas.getAttribute( "data-RDGE-id" ); this._canvas.rdgeid = id; - g_Engine.registerCanvas(this._canvas, this); - RDGEStart( this._canvas ); + RDGE.globals.engine.registerCanvas(this._canvas, this); + RDGE.RDGEStart( this._canvas ); this._canvas.task.stop() } @@ -992,8 +992,8 @@ World.prototype.import = function( importStr ) { rdgeStarted = true; var id = this._canvas.getAttribute( "data-RDGE-id" ); this._canvas.rdgeid = id; - g_Engine.registerCanvas(this._canvas, this); - RDGEStart( this._canvas ); + RDGE.globals.engine.registerCanvas(this._canvas, this); + RDGE.RDGEStart( this._canvas ); this._canvas.task.stop() } -- cgit v1.2.3 From 18609d375e7aab9cb48c9b3f5b291f85cbd28683 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 13:39:32 -0700 Subject: removed old unused import and export functions. --- js/lib/drawing/world.js | 400 ++++++++++++------------------------------------ 1 file changed, 101 insertions(+), 299 deletions(-) (limited to 'js/lib/drawing') diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 801c199a..ae8c2cce 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js @@ -435,38 +435,38 @@ World.prototype.updateObject = function (obj) { } }; -World.prototype.addObject = function( obj ) { - if (!obj) return; +World.prototype.addObject = function (obj) { + if (!obj) return; try { // undefine all the links of the object - obj.setChild( undefined ); - obj.setNext( undefined ); - obj.setPrev( undefined ); - obj.setParent( undefined ); + obj.setChild(undefined); + obj.setNext(undefined); + obj.setPrev(undefined); + obj.setParent(undefined); - obj.setWorld( this ); + obj.setWorld(this); if (this._geomRoot == null) { this._geomRoot = obj; } else { var go = this._geomRoot; - while (go.getNext()) go = go.getNext(); - go.setNext( obj ); - obj.setPrev( go ); + while (go.getNext()) go = go.getNext(); + go.setNext(obj); + obj.setPrev(go); } - // build the WebGL buffers - if (this._useWebGL) { - obj.buildBuffers(); - this.restartRenderLoop(); - } + // build the WebGL buffers + if (this._useWebGL) { + obj.buildBuffers(); + this.restartRenderLoop(); + } } - catch(e) { - alert( "Exception in GLWorld.addObject " + e ); + catch (e) { + alert("Exception in GLWorld.addObject " + e); } -} +}; World.prototype.restartRenderLoop = function() { //console.log( "restartRenderLoop" ); @@ -734,146 +734,76 @@ World.prototype.getShapeFromPoint = function( offsetX, offsetY ) { -World.prototype.exportJSON = function() -{ - // world properties - var worldObj = +World.prototype.exportJSON = function () { + // world properties + var worldObj = { - 'version' : 1.1, - 'id' : this.getCanvas().getAttribute( "data-RDGE-id" ), - 'fov' : this._fov, - 'zNear' : this._zNear, - 'zFar' : this._zFar, - 'viewDist' : this._viewDist, - 'webGL' : this._useWebGL + 'version': 1.1, + 'id': this.getCanvas().getAttribute("data-RDGE-id"), + 'fov': this._fov, + 'zNear': this._zNear, + 'zFar': this._zFar, + 'viewDist': this._viewDist, + 'webGL': this._useWebGL }; - // RDGE scenegraph - if (this._useWebGL) - worldObj.scenedata = this.myScene.exportJSON(); + // RDGE scenegraph + if (this._useWebGL) + worldObj.scenedata = this.myScene.exportJSON(); - // object data - var strArray = []; - this.exportObjectsJSON( this._geomRoot, worldObj ); + // object data + var strArray = []; + this.exportObjectsJSON(this._geomRoot, worldObj); - // You would think that the RDGE export function - // would not be destructive of the data. You would be wrong... - // We need to rebuild everything - if (this._useWebGL) - { - if (worldObj.children && (worldObj.children.length === 1)) - { + // You would think that the RDGE export function + // would not be destructive of the data. You would be wrong... + // We need to rebuild everything + if (this._useWebGL) { + if (worldObj.children && (worldObj.children.length === 1)) { this.rebuildTree(this._geomRoot); this.restartRenderLoop(); - } - } - - // convert the object to a string - var jStr = JSON.stringify( worldObj ); - - // prepend some version information to the string. - // this string is also used to differentiate between JSON - // and pre-JSON versions of fileIO. - // the ending ';' in the version string is necessary - jStr = "v1.0;" + jStr; - - return jStr; -} - -World.prototype.rebuildTree = function( obj ) -{ - if (!obj) return; - - obj.buildBuffers(); - - if (obj.getChild()) { - this.rebuildTree( obj.getChild () ); + } } - if (obj.getNext()) - this.rebuildTree( obj.getNext() ); -} - -World.prototype.exportObjectsJSON = function( obj, parentObj ) -{ - if (!obj) return; - - var jObj = obj.exportJSON(); - if (!parentObj.children) parentObj.children = []; - parentObj.children.push( jObj ); + // convert the object to a string + var jStr = JSON.stringify(worldObj); - if (obj.getChild()) { - this.exportObjectsJSON( obj.getChild (), jObj ); - } + // prepend some version information to the string. + // this string is also used to differentiate between JSON + // and pre-JSON versions of fileIO. + // the ending ';' in the version string is necessary + jStr = "v1.0;" + jStr; - if (obj.getNext()) - this.exportObjectsJSON( obj.getNext(), parentObj ); -} + return jStr; +}; -/* -World.prototype.export = function() -{ - var exportStr = "GLWorld 1.0\n"; - var id = this.getCanvas().getAttribute( "data-RDGE-id" ); - exportStr += "id: " + id + "\n"; - //exportStr += "id: " + this._canvas.rdgeid + "\n"; - exportStr += "fov: " + this._fov + "\n"; - exportStr += "zNear: " + this._zNear + "\n"; - exportStr += "zFar: " + this._zFar + "\n"; - exportStr += "viewDist: " + this._viewDist + "\n"; - if (this._useWebGL) - exportStr += "webGL: true\n"; - - // we need 2 export modes: One for save/restore, one for publish. - // hardcoding for now - //var exportForPublish = false; - //if (!exportForPublish) exportForPublish = false; - var exportForPublish = true; - exportStr += "publish: " + exportForPublish + "\n"; - - if (exportForPublish && this._useWebGL) - { - exportStr += "scenedata: " + this.myScene.exportJSON() + "endscene\n"; +World.prototype.rebuildTree = function (obj) { + if (!obj) return; - // write out all of the objects - exportStr += "tree\n"; - exportStr += this.exportObjects( this._geomRoot ); - exportStr += "endtree\n"; - } - else - { - // output the material library - //exportStr += MaterialsLibrary.export(); // THIS NEEDS TO BE DONE AT THE DOC LEVEL + obj.buildBuffers(); - // write out all of the objects - exportStr += "tree\n"; - exportStr += this.exportObjects( this._geomRoot ); - exportStr += "endtree\n"; - } + if (obj.getChild()) { + this.rebuildTree(obj.getChild()); + } - return exportStr; + if (obj.getNext()) + this.rebuildTree(obj.getNext()); }; -World.prototype.exportObjects = function( obj ) { - if (!obj) return; +World.prototype.exportObjectsJSON = function (obj, parentObj) { + if (!obj) return; - var rtnStr = "OBJECT\n"; - rtnStr += obj.export(); + var jObj = obj.exportJSON(); + if (!parentObj.children) parentObj.children = []; + parentObj.children.push(jObj); - if (obj.getChild()) { - rtnStr += this.exportObjects( obj.getChild () ); + if (obj.getChild()) { + this.exportObjectsJSON(obj.getChild(), jObj); } - // the end object goes outside the children - rtnStr += "ENDOBJECT\n"; - - if (obj.getNext()) { - rtnStr += this.exportObjects( obj.getNext() ); - } - - return rtnStr; + if (obj.getNext()) + this.exportObjectsJSON(obj.getNext(), parentObj); }; -*/ World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) { //if (trNode == null) trNode = this._ctrNode; @@ -893,51 +823,45 @@ World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) return rtnNode; }; -World.prototype.importJSON = function( jObj ) -{ - if (jObj.webGL) - { - // start RDGE - rdgeStarted = true; - var id = this._canvas.getAttribute( "data-RDGE-id" ); - this._canvas.rdgeid = id; - RDGE.globals.engine.registerCanvas(this._canvas, this); - RDGE.RDGEStart( this._canvas ); - this._canvas.task.stop() - } +World.prototype.importJSON = function (jObj) { + if (jObj.webGL) { + // start RDGE + rdgeStarted = true; + var id = this._canvas.getAttribute("data-RDGE-id"); + this._canvas.rdgeid = id; + RDGE.globals.engine.registerCanvas(this._canvas, this); + RDGE.RDGEStart(this._canvas); + this._canvas.task.stop() + } - // import the objects - // there should be exactly one child of the parent object - if (jObj.children && (jObj.children.length === 1)) - this.importObjectsJSON( jObj.children[0] ); - else - throw new Error ("unrecoverable canvas import error - inconsistent root object: " + jObj.children ); + // import the objects + // there should be exactly one child of the parent object + if (jObj.children && (jObj.children.length === 1)) + this.importObjectsJSON(jObj.children[0]); + else + throw new Error("unrecoverable canvas import error - inconsistent root object: " + jObj.children); - if (!this._useWebGL) - { - // render using canvas 2D - this.render(); - } - else - this.restartRenderLoop(); -} + if (!this._useWebGL) { + // render using canvas 2D + this.render(); + } + else + this.restartRenderLoop(); +}; -World.prototype.importObjectsJSON = function( jObj, parentGeomObj ) -{ - // read the next object - var gObj = this.importObjectJSON( jObj, parentGeomObj ); +World.prototype.importObjectsJSON = function (jObj, parentGeomObj) { + // read the next object + var gObj = this.importObjectJSON(jObj, parentGeomObj); - // determine if we have children - if (jObj.children) - { - var nKids = ojObjbj.chilodren.length; - for (var i=0; i= 0) - if (this._useWebGL) - { - // start RDGE - rdgeStarted = true; - var id = this._canvas.getAttribute( "data-RDGE-id" ); - this._canvas.rdgeid = id; - RDGE.globals.engine.registerCanvas(this._canvas, this); - RDGE.RDGEStart( this._canvas ); - this._canvas.task.stop() - } - - this.importObjects( importStr, this._rootNode ); - - if (!this._useWebGL) - { - // render using canvas 2D - this.render(); - } -}; - -World.prototype.importObjects = function( importStr, parentNode ) { - var index = importStr.indexOf( "OBJECT\n", 0 ); - while (index >= 0) { - // update the string to the current object - importStr = importStr.substr( index+7 ); - - // read the next object - this.importObject( importStr, parentNode ); - - // determine if we have children - var endIndex = importStr.indexOf( "ENDOBJECT\n" ), - childIndex = importStr.indexOf( "OBJECT\n" ); - if (endIndex < 0) throw new Error( "ill-formed object data" ); - if ((childIndex >= 0) && (childIndex < endIndex)) { - importStr = importStr.substr( childIndex + 7 ); - importStr = this.importObjects( importStr, node ); - endIndex = importStr.indexOf( "ENDOBJECT\n" ) - } - - // remove the string for the object(s) just created - importStr = importStr.substr( endIndex ); - - // get the location of the next object - index = importStr.indexOf( "OBJECT\n", endIndex ); - } - - return importStr; -}; - -World.prototype.importObject = function( objStr, parentNode ) { - var go = new GeomObj(); - var type = Number( go.getPropertyFromString( "type: ", objStr ) ); - - var obj; - switch (type) - { - case 1: - obj = new Rectangle(); - obj.import( objStr ); - break; - - case 2: // circle - obj = new Circle(); - obj.import( objStr ); - break; - - case 3: // line - obj = new Line(); - obj.import( objStr ); - break; - - default: - throw new Error( "Unrecognized object type: " + type ); - break; - } - - if (obj) { - this.addObject( obj ); - } -}; - -World.prototype.importSubObject = function( objStr, parentNode ) { - // get the mesh text - var i0 = objStr.indexOf( "mesh: " ), - i1 = objStr.indexOf( "endMesh\n" ); - if ((i0 < 0) || (i1 < 0)) throw new Error( "ill-formed sub object" ); - i0 += 6; - var meshText = objStr.substr( i0, i1 - i0 ); - var meshObj = JSON.parse(meshText); - - // get the material text - var i0 = objStr.indexOf( "material: " ), - i1 = objStr.indexOf( "endMat\n" ); - if ((i0 < 0) || (i1 < 0)) throw new Error( "ill-formed sub object" ); - i0 += 10; - var matText = objStr.substr( i0, i1 - i0 ); - var shaderDef = JSON.parse( matText ); - var shader = new RDGE.jshader(); - shader.def = shaderDef; - shader.init(); - - // set the shader for this material - var matNode = RDGE.createMaterialNode("objMat") - matNode.setShader(shader); - - // create the transformation node - var trNode = RDGE.createTransformNode("subObjNode_"); - trNode.attachMeshNode(this.renderer.id + "_prim_", meshObj); - trNode.attachMaterial(matNode); - parentNode.insertAsChild(trNode); - - return trNode; -}; - if (typeof exports === "object") { exports.World = World; } \ No newline at end of file -- cgit v1.2.3 From a11ef2eed7049835c8bdfa50a2b893632c46eaa0 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 4 Apr 2012 11:11:58 -0700 Subject: Squashed commit of Preparing for the montage undo-manager: Architecture changes Reworked the add and remove elements into 1 function which can take 1 or more elements. Removed the _element from the selection array Many other changes related to those 2 changes Undo/Redo shortcuts are now using montage undo/redo manager. Signed-off-by: Valerio Virgillito --- js/lib/drawing/world.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'js/lib/drawing') diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 5a054224..e348f5e8 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js @@ -527,7 +527,7 @@ World.prototype.clearTree = function() { if (this._useWebGL) { var root = this._rootNode; root.children = new Array(); - g_Engine.unregisterCanvas( this._canvas.rdgeid ) + g_Engine.unregisterCanvas( this._canvas.rdgeid ); this.update( 0 ); this.draw(); @@ -540,8 +540,9 @@ World.prototype.updateMaterials = function( obj, time ) { var matArray = obj.getMaterialArray(); if (matArray) { var n = matArray.length; - for (var i=0; i