Still bugged camera.
1.1 --- a/scripts/machine.js Sun Apr 17 14:44:11 2011 +0200
1.2 +++ b/scripts/machine.js Mon Apr 18 15:30:47 2011 +0200
1.3 @@ -72,11 +72,15 @@
1.4 }
1.5 Camera.prototype.moveLeft = function()
1.6 {
1.7 - this.x -= this.speed.x;
1.8 + var d = 1 - Math.sin(this.yaw);
1.9 + this.x -= d * this.speed.x;
1.10 + this.z += (1 - d) * this.speed.z;
1.11 }
1.12 Camera.prototype.moveRight = function()
1.13 {
1.14 - this.x += this.speed.x;
1.15 + var d = 1 - Math.sin(this.yaw);
1.16 + this.x += d * this.speed.x;
1.17 + this.z -= (1 - d) * this.speed.z;
1.18 }
1.19 Camera.prototype.moveUp = function()
1.20 {
1.21 @@ -88,8 +92,9 @@
1.22 }
1.23 Camera.prototype.zoom = function(delta)
1.24 {
1.25 - this.x += this.speed.x * delta * Math.sin(this.yaw);
1.26 - this.z += this.speed.z * delta * Math.cos(this.yaw);
1.27 + this.x -= Math.sin(this.yaw) * this.speed.x * delta;
1.28 + this.y -= Math.sin(this.pitch) * this.speed.y * delta;
1.29 + this.z -= Math.cos(this.yaw) * Math.cos(this.pitch) * this.speed.z * delta;
1.30 }
1.31 Camera.prototype.changePitch = function(delta)
1.32 {
1.33 @@ -249,7 +254,7 @@
1.34
1.35 gl.viewport(0, 0, viewport.width, viewport.height);
1.36 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
1.37 - mat4.perspective(55, viewport.width / viewport.height, 0.1, 100.0, pMatrix);
1.38 + mat4.perspective(45, viewport.width / viewport.height, 0.1, 100.0, pMatrix);
1.39
1.40 mat4.identity(mvMatrix);
1.41 //mat4.multiply(mvMatrix, camera.rotMatrix);