diff --git a/index.html b/index.html
index e161ac6..4e35fe4 100644
--- a/index.html
+++ b/index.html
@@ -11,6 +11,7 @@
+
@@ -96,6 +97,7 @@
Player 2 ()
30
+
diff --git a/js/Gui.js b/js/Gui.js
index 7a042bf..94af6ad 100644
--- a/js/Gui.js
+++ b/js/Gui.js
@@ -3,7 +3,8 @@ var GameGui = function () {
btn_ball.onclick = function () {
eightballgame.hitButtonClicked(Number(document.getElementById('range_strength').value));
};
-}
+ if (debug) document.getElementById('fps_stats_container').appendChild( stats.domElement );
+};
GameGui.prototype.setupGameHud = function() {
this.hide(document.getElementById('mainMenu'));
diff --git a/js/Table.js b/js/Table.js
index 99a9071..ebc78dc 100644
--- a/js/Table.js
+++ b/js/Table.js
@@ -25,7 +25,7 @@ var Table = function () {
var mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({
color: new THREE.Color(TABLE_COLORS.cloth),
specular: 0x404040,
- shininess: 20,
+ shininess: 10,
shading: THREE.SmoothShading
}));
@@ -42,7 +42,7 @@ var Table = function () {
var mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({
color: new THREE.Color(0x7a5230),
specular: 0x404040,
- shininess: 20,
+ shininess: 100,
shading: THREE.SmoothShading
}));
diff --git a/js/main.js b/js/main.js
index 8c5d2ae..61724ff 100644
--- a/js/main.js
+++ b/js/main.js
@@ -7,6 +7,9 @@ var debug = false; // if true then collision wireframes are drawn
var progressBar;
+var stats = new Stats();
+stats.setMode( 0 ); // 0: fps, 1: ms, 2: mb
+
var textureLoader = new THREE.TextureLoader();
THREE.DefaultLoadingManager.onProgress = function (item, loaded, total) {
if (typeof progressBar !== 'undefined') {
@@ -123,8 +126,8 @@ function setCollisionBehaviour() {
}
function draw() {
- requestAnimationFrame(draw);
-
+ stats.begin();
+
// Controls
controls.target.copy(game.balls[0].mesh.position);
controls.update();
@@ -136,6 +139,8 @@ function draw() {
var dt = clock.getDelta();
game.tick(dt);
+ stats.end();
+ requestAnimationFrame(draw);
renderer.render(scene, camera); // We render our scene with our camera
}
diff --git a/lib/stats.min.js b/lib/stats.min.js
new file mode 100644
index 0000000..a2d1872
--- /dev/null
+++ b/lib/stats.min.js
@@ -0,0 +1,5 @@
+// stats.js - http://github.com/mrdoob/stats.js
+var Stats=function(){function f(a,e,b){a=document.createElement(a);a.id=e;a.style.cssText=b;return a}function l(a,e,b){var c=f("div",a,"padding:0 0 3px 3px;text-align:left;background:"+b),d=f("div",a+"Text","font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px;color:"+e);d.innerHTML=a.toUpperCase();c.appendChild(d);a=f("div",a+"Graph","width:74px;height:30px;background:"+e);c.appendChild(a);for(e=0;74>e;e++)a.appendChild(f("span","","width:1px;height:30px;float:left;opacity:0.9;background:"+
+b));return c}function m(a){for(var b=c.children,d=0;dr+1E3&&(d=Math.round(1E3*
+t/(a-r)),u=Math.min(u,d),v=Math.max(v,d),A.textContent=d+" FPS ("+u+"-"+v+")",p(B,d/100),r=a,t=0,void 0!==h)){var b=performance.memory.usedJSHeapSize,c=performance.memory.jsHeapSizeLimit;h=Math.round(9.54E-7*b);y=Math.min(y,h);z=Math.max(z,h);E.textContent=h+" MB ("+y+"-"+z+")";p(F,b/c)}return a},update:function(){k=this.end()}}};"object"===typeof module&&(module.exports=Stats);
diff --git a/styles.css b/styles.css
index 3838db9..0da9865 100644
--- a/styles.css
+++ b/styles.css
@@ -265,3 +265,11 @@
.player.unknown span:before {
content: '?';
}
+
+
+#stats {
+ position: absolute;
+ top: 420px;
+ left: 810px;
+ z-index: 1;
+}
\ No newline at end of file