feat: terrain
This commit is contained in:
parent
f86b4ada13
commit
81474b6bca
13 changed files with 251 additions and 279 deletions
|
|
@ -25,11 +25,12 @@ export namespace Camera {
|
|||
}
|
||||
|
||||
/** Combined projection * view matrix for the given viewport aspect ratio.
|
||||
* Near/far are fixed for now; far only needs to exceed the fog distance. */
|
||||
* Near/far are fixed; far only needs to exceed the fog distance, and is set
|
||||
* wide enough to reach the outdoor world's distant peaks. */
|
||||
export function viewProjection(cam: Camera, aspect: number): Mat4 {
|
||||
const eye = cam.position
|
||||
const view = Mat4.lookAt(eye, Vec3.add(eye, forward(cam)), { x: 0, y: 1, z: 0 })
|
||||
const proj = Mat4.perspective(cam.fov, aspect, 0.05, 100)
|
||||
const proj = Mat4.perspective(cam.fov, aspect, 0.05, 260)
|
||||
return Mat4.multiply(proj, view)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue