diff --git a/public/cube.js b/public/cube.js index 631591d..0f25fb6 100644 --- a/public/cube.js +++ b/public/cube.js @@ -14,10 +14,12 @@ const main = () => { var Mesh = GL.Cube() var Cube = new GL.Entity(Mesh) - Cube.position.z = 3; + Cube.position.z = 10 Scene.add(Material, Cube) - + + Renderer.FOV = 70 + GL.Loop(() => { Renderer.draw(Scene, Camera) Cube.rotation.add(new GL.Vec3(1,1,1)) diff --git a/public/gl/core/Renderer.js b/public/gl/core/Renderer.js index 7c96379..38a7974 100644 --- a/public/gl/core/Renderer.js +++ b/public/gl/core/Renderer.js @@ -67,7 +67,7 @@ export class Renderer { const tanHalfFovy = Math.tan((this.FOV * (Math.PI/180))/ 2.0); const aspect = canvas.width / canvas.height - d[0] = 1.0 / (aspect / tanHalfFovy) + d[0] = 1.0 / (aspect * tanHalfFovy) d[5] = 1.0 / tanHalfFovy d[10] = this.FAR / (this.FAR - this.NEAR) d[11] = 1.0