From 04343eda8c2f870b0da55cfdc8003c99fe1cc4de Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:53:10 -0700 Subject: Remove trailing spaces --- js/lib/drawing/world.js | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'js/lib/drawing') diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index b20b0a5d..08f9d319 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js @@ -68,7 +68,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { { this._2DContext = canvas.getContext( "2d" ); } - + this._viewportWidth = canvas.width; this._viewportHeight = canvas.height; @@ -152,7 +152,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { // Flag to play/pause animation at authortime this._previewAnimation = true; - + //////////////////////////////////////////////////////////////////////////////////// // RDGE // local variables @@ -175,7 +175,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { var camMat = Matrix.I(4); camMat[14] = this.getViewDistance(); this.setCameraMat( camMat ); - + // post-load processing of the scene this.init = function() { @@ -184,13 +184,13 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { 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 RDGE.camera(); this._camera = cam; cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar()); cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], RDGE.vec3.up()); - + // make this camera the active camera this.renderer.cameraManager().setActiveCamera(cam); @@ -198,61 +198,61 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { //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 RDGE.SceneGraph(); - + // create some lights // light 1 // 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 = 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 = RDGE.createTransformNode("lightTr"); - + // create and attach a material - materials hold the light data lightTr.attachMaterial(RDGE.createMaterialNode("lights")); - + // enable light channels 1, 2 - channel 0 is used by the default shader // lightTr.materialNode.enableLightChannel(1, this.light); // lightTr.materialNode.enableLightChannel(2, this.light2); - + // all added objects are parented to the light node this._rootNode = lightTr; - + // add the light node to the scene this.myScene.addNode(lightTr); - + // Add the scene to the engine - necessary if you want the engine to draw for you //RDGE.globals.engine.AddScene("myScene" + this._canvas.id, this.myScene); - var name = this._canvas.getAttribute( "data-RDGE-id" ); + var name = this._canvas.getAttribute( "data-RDGE-id" ); RDGE.globals.engine.AddScene("myScene" + name, this.myScene); }; - - // main code for handling user interaction and updating the scene + + // main code for handling user interaction and updating the scene this.update = function(dt) { if (!dt) dt = 0.2; - + dt = 0.01; // use our own internal throttle this.elapsed += dt; - + if (this._useWebGL) { // changed the global position uniform of light 0, another way to change behavior of a light 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)]); // this.light2.setPosition([-1.2*Math.cos(this.elapsed*2.0), 1.2*Math.sin(this.elapsed*2.0), -1.2*Math.cos(this.elapsed)]); } - + this.updateMaterials( this.getGeomRoot(), this.elapsed ); // now update all the nodes in the scene @@ -260,7 +260,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { this.myScene.update(dt); }; - // defining the draw function to control how the scene is rendered + // defining the draw function to control how the scene is rendered this.draw = function() { if (this._useWebGL) @@ -306,12 +306,12 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { this.render(); } }; - + this.onRunState = function() { // console.log( "GLWorld.onRunState" ); this.restartRenderLoop(); }; - + this.onLoadState = function() { // console.log( "GLWorld.onLoadState" ); }; @@ -375,7 +375,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { world.textureMapLoaded( name ); } }; - + this.hasAnimatedMaterials = function() { var root = this.getGeomRoot(); var rtnVal = false; @@ -433,7 +433,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { { this._notifier.removeListener( obj ); } - + // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state // in the case of a procedurally built scene an init state is not needed for loading data this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" ); @@ -486,7 +486,7 @@ World.prototype.updateObject = function (obj) { ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[0]); ctrTrNode.attachMaterial(materialNodes[0]); } - + // delete all of the child nodes var i; var childTrNode; @@ -803,11 +803,11 @@ World.prototype.render = function() var ctx = this.get2DContext(); if (!ctx) return; ctx.clearRect(0, 0, this.getViewportWidth(), this.getViewportHeight()); - + // render the geometry var root = this.getGeomRoot(); this.hRender( root ); - } + } else { RDGE.globals.engine.setContext( this._canvas.rdgeid ); @@ -834,7 +834,7 @@ World.prototype.setViewportFromCanvas = function(canvas) { this._glContext.viewportHeight = canvas.height; this.getCamera().setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar()); - + this.renderer.setViewPort(0, 0, canvas.width, canvas.height); } }; @@ -863,7 +863,7 @@ World.prototype.getShapeFromPoint = function( offsetX, offsetY ) { World.prototype.exportJSON = function () { // world properties - var worldObj = + var worldObj = { 'version' : 1.1, 'id' : this.getCanvas().getAttribute( "data-RDGE-id" ), @@ -900,7 +900,7 @@ World.prototype.exportJSON = function () // and pre-JSON versions of fileIO. // the ending ';' in the version string is necessary jStr = "v1.0;" + jStr; - + return jStr; }; @@ -963,7 +963,7 @@ World.prototype.importJSON = function (jObj) { // start RDGE rdgeStarted = true; - var id = this._canvas.getAttribute( "data-RDGE-id" ); + var id = this._canvas.getAttribute( "data-RDGE-id" ); this._canvas.rdgeid = id; RDGE.globals.engine.registerCanvas(this._canvas, this); RDGE.RDGEStart(this._canvas); -- cgit v1.2.3