MCPcopy Create free account
hub / github.com/DjDeveloperr/deno_desktop / Camera

Class Camera

examples/hello_camera.js:72–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72export class Camera {
73 eye = new Vector3(0, 1, 2);
74 target = new Vector3(0, 0, 0);
75 up = Vector3.up();
76 aspect = 0;
77 fovy = 45.0;
78 znear = 0.1;
79 zfar = 100.0;
80
81 constructor(width, height) {
82 this.aspect = width / height;
83 }
84
85 buildViewProjMatrix() {
86 const view = Matrix4.lookAtRh(this.eye, this.target, this.up);
87 const proj = new PerspectiveFov(new Deg(this.fovy), this.aspect, this.znear, this.zfar)
88 .toPerspective()
89 .toMatrix4();
90 return OPENGL_TO_WGPU_MATRIX.mul(proj.mul(view)).toFloat32Array();
91 }
92}
93
94export class HelloCameraApp extends App {
95 constructor() {

Callers

nothing calls this directly

Calls 1

upMethod · 0.45

Tested by

no test coverage detected