fix projection
This commit is contained in:
parent
56ad7214c6
commit
50c88908b6
2 changed files with 5 additions and 3 deletions
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue