Mercurial > hg > Members > e105716
diff fps/fps.html @ 3:aa7abf13d3f5 draft default tip
fix bug
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 16 May 2012 21:56:12 +0900 |
parents | 47399f2f3a80 |
children |
line wrap: on
line diff
--- a/fps/fps.html Wed May 16 17:53:54 2012 +0900 +++ b/fps/fps.html Wed May 16 21:56:12 2012 +0900 @@ -136,35 +136,34 @@ function setCamera(ctx){ - ctx.viewport(0, 0, width, height); + ctx.viewport(0, 0, width, height); var t = width/height; ctx.perspectiveMatrix.makeIdentity(); ctx.perspectiveMatrix.frustum(-0.5, 0.5, -0.5 / t, 0.5 / t, 1, 100000); - ctx.perspectiveMatrix.translate(-xPos,-yPos,-zPos); - ctx.perspectiveMatrix.rotate(xRool,0,1,0); - - ctx.perspectiveMatrix.multiply(cameraMatrix); - + var x = Math.cos((angle+90)*Math.PI/180 ); + var z = Math.sin((angle+90)*Math.PI/180 ); - cameraMatrix.translate(-xPos,-yPos,-zPos); - cameraMatrix.rotate(xRool,0,1,0); + cameraX += x * speedZ; + cameraZ += z * speedZ; - if(countX < 10) - countX += 0.01; + ctx.perspectiveMatrix.rotate(angle,0,1,0); + ctx.perspectiveMatrix.translate(cameraX,0,cameraZ); + } -countRool = 0; -countX = 0; +angle = 0; +cameraX = 0; +cameraZ = 0; FILPCOUNT = 0; function loop(ctx, ortho) { ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT); - setCamera(ctx); + setCamera(ctx); PutSpriteV(ctx, cube_X, cube_Y, cube_Z, 1, matrix, object); PutSpriteV(ctx, cube_X2, cube_Y2, cube_Z2, 1, matrix, object2); @@ -199,8 +198,6 @@ var ortho = {left:0, right:200, bottom:140, top:0} matrix = new J3DIMatrix4(); // global variable matrix2 = new J3DIMatrix4(); // global variable - cameraMatrix = new J3DIMatrix4(); // global variable - cameraMatrix.makeIdentity(); cube_X = 0;