diff --git a/src/client/Loop.js b/src/client/Loop.js index e3dab8d..99ccbd1 100644 --- a/src/client/Loop.js +++ b/src/client/Loop.js @@ -23,6 +23,8 @@ }; VIZI.Loop.prototype.tick = function() { + this.publish("fpsTickStart", "Main Loop"); + this.publish("update"); this.publish("render"); @@ -31,5 +33,7 @@ // http://stackoverflow.com/questions/6065169/requestanimationframe-with-this-keyword window.requestAnimationFrame( this.tick.bind(this) ); } + + this.publish("fpsTickEnd", "Main Loop"); }; }()); \ No newline at end of file diff --git a/src/client/debug/FPS.js b/src/client/debug/FPS.js index 6b8e2dd..2d7ea41 100644 --- a/src/client/debug/FPS.js +++ b/src/client/debug/FPS.js @@ -28,12 +28,18 @@ return container; }; - VIZI.FPS.prototype.createDOMElement = function(name) { + VIZI.FPS.prototype.createDOMElement = function() { VIZI.Log("Creating FPS meter DOM element"); var element = document.createElement("div"); element.style.float = "left"; + this.domContainer.appendChild(element); + + return element; + }; + + VIZI.FPS.prototype.createDOMTitle = function(name) { var title = document.createElement("p"); // Style copied from FPSMeter @@ -41,18 +47,14 @@ title.style.fontFamily = "sans-serif"; title.style.fontSize = "10px"; title.style.fontWeight = "bold"; - title.style.margin = "5px 5px 0 5px"; + title.style.margin = "0 5px 5px 5px"; title.style.textAlign = "left"; title.style.textTransform = "uppercase"; title.innerHTML = name; - element.appendChild(title); - - this.domContainer.appendChild(element); - - return element; - }; + return title; + }; VIZI.FPS.prototype.createMeter = function(name) { VIZI.Log("Creating FPS meter: " + name); @@ -71,6 +73,8 @@ margin: "5px 0 5px 5px" }); + domElement.appendChild(this.createDOMTitle(name)); + this.meters[name] = meter; return meter; diff --git a/src/client/webgl/Camera.js b/src/client/webgl/Camera.js index bb2ec9a..4463a8c 100644 --- a/src/client/webgl/Camera.js +++ b/src/client/webgl/Camera.js @@ -7,11 +7,11 @@ _.extend(this, VIZI.Mediator); - this.cameraRadius = 6000; + this.cameraRadius = 4100; this.theta = 45; // Horizontal orbit this.onMouseDownTheta = 45; - this.phi = 60; // Vertical oribt - this.onMouseDownPhi = 60; + this.phi = 80; // Vertical oribt + this.onMouseDownPhi = 80; this.target = new THREE.Object3D(); @@ -20,7 +20,7 @@ this.lookAtTarget(); this.publish("addToScene", this.camera); - this.publish("addToDat", this, {name: "Camera", properties: ["theta", "phi", "lookAtTarget", "updatePosition"]}); + this.publish("addToDat", this, {name: "Camera", properties: ["cameraRadius", "theta", "phi", "lookAtTarget", "updatePosition"]}); this.subscribe("resize", this.resize); }; @@ -72,5 +72,6 @@ VIZI.Camera.prototype.datChange = function() { this.updatePosition(); + this.lookAtTarget(); }; }()); \ No newline at end of file diff --git a/src/client/webgl/Renderer.js b/src/client/webgl/Renderer.js index e4e4f5a..caeb0c5 100644 --- a/src/client/webgl/Renderer.js +++ b/src/client/webgl/Renderer.js @@ -42,10 +42,8 @@ VIZI.Renderer.prototype.render = function() { this.publish("fpsTickStart", "render"); - this.publish("fpsTickStart", "render2"); this.renderer.render( this.scene, this.camera ); this.publish("fpsTickEnd", "render"); - this.publish("fpsTickEnd", "render2"); }; VIZI.Renderer.prototype.resize = function() {