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

Method constructor

examples/hello_camera.js:95–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93
94export class HelloCameraApp extends App {
95 constructor() {
96 super("Hello Camera");
97
98 const vertices = [
99 [-0.0868241, 0.49240386, 0],
100 [-0.49513406, 0.06958647, 0],
101 [-0.21918549, -0.44939706, 0],
102 [0.35966998, -0.3473291, 0],
103 [0.44147372, 0.2347359, 0],
104 ];
105
106 const texCoords = [
107 [0.4131759, 0.00759614],
108 [0.0048659444, 0.43041354],
109 [0.28081453, 0.949397],
110 [0.85967, 0.84732914],
111 [0.9414737, 0.2652641],
112 ];
113
114 const indices = [
115 0, 1, 4,
116 1, 2, 4,
117 2, 3, 4,
118 0,
119 ];
120
121 this.vertices = new Float32Array(vertices.length * vertices[0].length + texCoords.length * texCoords[0].length);
122 for (let i = 0; i < vertices.length; i++) {
123 const vertex = vertices[i], texCoord = texCoords[i];
124 const offset = i * vertex.length + i * texCoord.length;
125 this.vertices.set(vertex, offset);
126 this.vertices.set(texCoord, offset + vertex.length);
127 }
128
129 this.indices = new Uint16Array(indices);
130
131 this.textureImage = decode(Deno.readFileSync(new URL("./extern/deno.png", import.meta.url)));
132
133 this.camera = new Camera(this.width, this.height);
134 this.cameraUniform = new Float32Array(4 * 4);
135 this.updateViewProjMatrix();
136 this.cameraController = new CameraController(0.2);
137 }
138
139 onEvent(event) {
140 this.cameraController.onEvent(event);

Callers

nothing calls this directly

Calls 3

updateViewProjMatrixMethod · 0.95
decodeFunction · 0.90
setMethod · 0.45

Tested by

no test coverage detected