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

Method constructor

examples/hello_texture.js:5–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4export class HelloTextureApp extends App {
5 constructor() {
6 super("Hello Texture");
7
8 const vertices = [
9 [-0.0868241, 0.49240386, 0],
10 [-0.49513406, 0.06958647, 0],
11 [-0.21918549, -0.44939706, 0],
12 [0.35966998, -0.3473291, 0],
13 [0.44147372, 0.2347359, 0],
14 ];
15
16 const texCoords = [
17 [0.4131759, 0.00759614],
18 [0.0048659444, 0.43041354],
19 [0.28081453, 0.949397],
20 [0.85967, 0.84732914],
21 [0.9414737, 0.2652641],
22 ];
23
24 const indices = [
25 0, 1, 4,
26 1, 2, 4,
27 2, 3, 4,
28 0,
29 ];
30
31 this.vertices = new Float32Array(vertices.length * vertices[0].length + texCoords.length * texCoords[0].length);
32 for (let i = 0; i < vertices.length; i++) {
33 const vertex = vertices[i], texCoord = texCoords[i];
34 const offset = i * vertex.length + i * texCoord.length;
35 this.vertices.set(vertex, offset);
36 this.vertices.set(texCoord, offset + vertex.length);
37 }
38
39 this.indices = new Uint16Array(indices);
40
41 this.textureImage = decode(Deno.readFileSync(new URL("./extern/tree.png", import.meta.url)));
42 }
43
44 async init() {
45 const shaderModule = await this.loadShader("hello_texture");

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.90
setMethod · 0.45

Tested by

no test coverage detected