From 4f291f4f5028caa16f72c7f9ec2435295b3bc0ee Mon Sep 17 00:00:00 2001 From: noe Date: Sun, 5 May 2024 13:43:54 -0400 Subject: [PATCH] 006: add note --- html/003-scene/main.js | 75 +- html/004-a-new-leaf/main.js | 142 +- html/005-thoughtform-hidenoe/main.js | 339 +-- html/006-the-edge/main.js | 201 +- html/chunk-0ef35489d83e6289.js | 5 + html/chunk-13ea4b456137d650.js | 5 + html/chunk-652b721da622b7d9.js | 3366 -------------------------- html/chunk-701c22b55952babe.js | 89 - html/chunk-a6d990db9d9ec9c3.js | 16 - html/chunk-d24458ad0a4be457.js | 2 + src/006-the-edge/shaders/rail.frag | 5 + 11 files changed, 28 insertions(+), 4217 deletions(-) create mode 100644 html/chunk-0ef35489d83e6289.js create mode 100644 html/chunk-13ea4b456137d650.js delete mode 100644 html/chunk-652b721da622b7d9.js delete mode 100644 html/chunk-701c22b55952babe.js delete mode 100644 html/chunk-a6d990db9d9ec9c3.js create mode 100644 html/chunk-d24458ad0a4be457.js diff --git a/html/003-scene/main.js b/html/003-scene/main.js index 2c02291..ffb5fab 100644 --- a/html/003-scene/main.js +++ b/html/003-scene/main.js @@ -1,74 +1 @@ -import { -Texture, -basic_vertex_rounding_default -} from "../chunk-701c22b55952babe.js"; -import { -Mesh, -MeshRenderer, -Renderable, -Shader, -Transform, -WebGLApp, -basic, -basic_default, -etoq, -exports_quat, -v3 -} from "../chunk-652b721da622b7d9.js"; - -// src/meshes/trianglething/trianglething.ts -var trianglething_default = new Mesh({ - colors: null, - faces: new Uint8Array([0, 1, 2, 1, 0, 3, 0, 2, 4, 0, 4, 5, 0, 5, 3, 1, 3, 6, 2, 1, 7, 4, 2, 8, 9, 10, 11, 12, 9, 13, 1, 6, 7, 2, 7, 8, 10, 8, 11, 9, 11, 13, 12, 13, 6, 7, 6, 14, 8, 7, 14, 11, 8, 14, 13, 11, 14, 6, 13, 14, 15, 16, 17, 17, 16, 18, 19, 20, 21, 18, 16, 22, 22, 16, 15, 23, 24, 25]), - name: "src/meshes/trianglething/trianglething.ply", - normals: new Float32Array([0, -1, 0.00000083803394, -0.5257306, -0.44721383, 0.723607, -0.8506533, -0.44721213, -0.2763879, 0.5257306, -0.4472139, 0.723607, 0, -0.44721153, -0.89442825, 0.8506533, -0.4472122, -0.27638793, 0, 0.44721153, 0.89442825, -0.8506533, 0.44721216, 0.27638793, -0.5257306, 0.4472139, -0.72360694, 0.8506533, -0.4472122, -0.27638793, 0, -0.44721153, -0.89442825, 0.5257306, 0.4472139, -0.72360694, 0.5257306, -0.4472139, 0.723607, 0.85065323, 0.4472122, 0.2763879, 0, 1, -0.0000008165459, 0.8999471, -0.43599886, 0.00000024163015, -0.00000005150958, 1, 0, -0.000000030203772, -0.4359989, 0.8999472, -0.8999471, -0.4359989, -0.00000024291313, -0.000000030203772, -0.4359989, 0.8999472, 0, -0.43599886, -0.8999471, 0.8999471, -0.43599886, 0.00000024163015, 0, -0.43599886, -0.8999471, -0.000000030203772, -0.4359989, 0.8999472, -0.8999471, -0.4359989, -0.00000024291313, 0, -0.43599886, -0.8999471]), - positions: new Float32Array([0, 2.6090002, 0, -0.36800402, 2.9959497, 0.50652003, -0.5954481, 2.9959497, -0.19346952, 0.36800402, 2.9959497, 0.50652003, 0, 2.9959497, -0.62609756, 0.5954481, 2.9959497, -0.19346952, 0, 3.6220508, 0.62609756, -0.5954481, 3.6220508, 0.19346952, -0.36800402, 3.6220508, -0.50652003, 0.5954481, 2.9959497, -0.19346952, 0, 2.9959497, -0.62609756, 0.36800402, 3.6220508, -0.50652003, 0.36800402, 2.9959497, 0.50652003, 0.5954481, 3.6220508, 0.19346952, 0, 4.0090003, 0, 1.0000001, 0, 0, 0, 2.5000002, 0, -0.000000043711395, 0, 1.0000001, -1.0000001, 0, -0.00000008742279, -0.000000043711395, 0, 1.0000001, 0.000000011924882, 0, -1.0000001, 1.0000001, 0, 0, 0.000000011924882, 0, -1.0000001, -0.000000043711395, 0, 1.0000001, -1.0000001, 0, -0.00000008742279, 0.000000011924882, 0, -1.0000001]), - uvs: new Float32Array([0.7660872, 0.5526656, 0.6449925, 0.52286637, 0.8418907, 0.33128682, 0.60803074, 0.79587877, 0.96344936, 0.40123126, 0.8416727, 0.64077806, 0.50600564, 0.49428308, 0.704352, 0.31297976, 0.79145527, 0.046412975, 0.35179207, 0.26814616, 0.47356877, 0.028599411, 0.5382167, 0.15491244, 0.118150145, 0.42324704, 0.40614995, 0.39580685, 0.5992601, 0.26365823, 0.4984935, 0.5027367, 0.24900003, 0.7522302, -0.00049349666, 0.50273675, -0.00049346685, 1.0017238, 0.7633698, 0.99398905, 0.99752307, 0.7598357, 0.9975231, 0.99398893, 0.49849355, 1.0017238, 0.99646366, 0.7612665, 0.99646366, 0.9954198, 0.7623104, 0.9954198]), - vertexCount: 26 -}); - -// src/meshes/trianglething/textures/texture0.png -var texture0_default = "../texture0-577d5216cdab32bc.png"; - -// src/meshes/trianglething/textures/texture1.png -var texture1_default = "../texture1-e472a46c91711e86.png"; - -// src/common-shaders/basic-vertex-rounding.ts -var basicShaderConfig = { - attributes: { - vertex: "a_vertex", - uv0: "a_uv0", - normal: "a_normal", - vertexColor: "a_vertex_color" - }, - uniforms: { - view: "u_view", - projection: "u_projection", - objectToWorld: "u_object_to_world", - objectToWorldInv: "u_object_to_world_inv", - light0: "u_light_0", - light0Color: "u_light_0_color", - time: "u_time", - albedo: "u_albedo", - texture0: "u_texture_0", - texture1: "u_texture_1", - texture2: "u_texture_2" - } -}; -var basicVertexRounding = (app) => new Shader(basicShaderConfig).vertex(basic_vertex_rounding_default).fragment(basic_default).app(app); - -// src/003-scene/main.ts -var app = new WebGLApp({ fov: 45 }); -var camera = new Transform([2, 3, 3], etoq([-15, 40, 0])); -var light = new Transform([2, 2, 0]); -var transform2 = new Transform(v3(0), etoq([0, 0, 0])); -var transform22 = new Transform([-3, 0, 1], etoq([0, 0, 0])); -var trithingTexture = new Texture(app, texture0_default); -var trithingTextureNormals = new Texture(app, texture1_default); -app.onUpdate(() => { - exports_quat.rotateY(transform2.rotation, transform2.rotation, 0.001); - exports_quat.rotateY(transform22.rotation, transform22.rotation, 0.001); -}); -new Renderable(app, transform2, new MeshRenderer(app, trianglething_default, basicVertexRounding(app).addTexture("texture0", trithingTexture).addTexture("texture1", trithingTextureNormals), camera, light).configure({})); -new Renderable(app, transform22, new MeshRenderer(app, trianglething_default, basic(app).addTexture("texture0", trithingTexture).addTexture("texture1", trithingTextureNormals), camera, light).configure({})); -app.start(); +import{a as N,b as U} from"../chunk-13ea4b456137d650.js";import{d as k,e as I,f as J,g as c,h as S,i as R,j as p,k as q,m as Y,n as w,o as f} from"../chunk-0ef35489d83e6289.js";var s=new k({colors:null,faces:new Uint8Array([0,1,2,1,0,3,0,2,4,0,4,5,0,5,3,1,3,6,2,1,7,4,2,8,9,10,11,12,9,13,1,6,7,2,7,8,10,8,11,9,11,13,12,13,6,7,6,14,8,7,14,11,8,14,13,11,14,6,13,14,15,16,17,17,16,18,19,20,21,18,16,22,22,16,15,23,24,25]),name:"src/meshes/trianglething/trianglething.ply",normals:new Float32Array([0,-1,0.00000083803394,-0.5257306,-0.44721383,0.723607,-0.8506533,-0.44721213,-0.2763879,0.5257306,-0.4472139,0.723607,0,-0.44721153,-0.89442825,0.8506533,-0.4472122,-0.27638793,0,0.44721153,0.89442825,-0.8506533,0.44721216,0.27638793,-0.5257306,0.4472139,-0.72360694,0.8506533,-0.4472122,-0.27638793,0,-0.44721153,-0.89442825,0.5257306,0.4472139,-0.72360694,0.5257306,-0.4472139,0.723607,0.85065323,0.4472122,0.2763879,0,1,-0.0000008165459,0.8999471,-0.43599886,0.00000024163015,-0.00000005150958,1,0,-0.000000030203772,-0.4359989,0.8999472,-0.8999471,-0.4359989,-0.00000024291313,-0.000000030203772,-0.4359989,0.8999472,0,-0.43599886,-0.8999471,0.8999471,-0.43599886,0.00000024163015,0,-0.43599886,-0.8999471,-0.000000030203772,-0.4359989,0.8999472,-0.8999471,-0.4359989,-0.00000024291313,0,-0.43599886,-0.8999471]),positions:new Float32Array([0,2.6090002,0,-0.36800402,2.9959497,0.50652003,-0.5954481,2.9959497,-0.19346952,0.36800402,2.9959497,0.50652003,0,2.9959497,-0.62609756,0.5954481,2.9959497,-0.19346952,0,3.6220508,0.62609756,-0.5954481,3.6220508,0.19346952,-0.36800402,3.6220508,-0.50652003,0.5954481,2.9959497,-0.19346952,0,2.9959497,-0.62609756,0.36800402,3.6220508,-0.50652003,0.36800402,2.9959497,0.50652003,0.5954481,3.6220508,0.19346952,0,4.0090003,0,1.0000001,0,0,0,2.5000002,0,-0.000000043711395,0,1.0000001,-1.0000001,0,-0.00000008742279,-0.000000043711395,0,1.0000001,0.000000011924882,0,-1.0000001,1.0000001,0,0,0.000000011924882,0,-1.0000001,-0.000000043711395,0,1.0000001,-1.0000001,0,-0.00000008742279,0.000000011924882,0,-1.0000001]),uvs:new Float32Array([0.7660872,0.5526656,0.6449925,0.52286637,0.8418907,0.33128682,0.60803074,0.79587877,0.96344936,0.40123126,0.8416727,0.64077806,0.50600564,0.49428308,0.704352,0.31297976,0.79145527,0.046412975,0.35179207,0.26814616,0.47356877,0.028599411,0.5382167,0.15491244,0.118150145,0.42324704,0.40614995,0.39580685,0.5992601,0.26365823,0.4984935,0.5027367,0.24900003,0.7522302,-0.00049349666,0.50273675,-0.00049346685,1.0017238,0.7633698,0.99398905,0.99752307,0.7598357,0.9975231,0.99398893,0.49849355,1.0017238,0.99646366,0.7612665,0.99646366,0.9954198,0.7623104,0.9954198]),vertexCount:26});var V="../texture0-577d5216cdab32bc.png";var g="../texture1-e472a46c91711e86.png";var Q={attributes:{vertex:"a_vertex",uv0:"a_uv0",normal:"a_normal",vertexColor:"a_vertex_color"},uniforms:{view:"u_view",projection:"u_projection",objectToWorld:"u_object_to_world",objectToWorldInv:"u_object_to_world_inv",light0:"u_light_0",light0Color:"u_light_0_color",time:"u_time",albedo:"u_albedo",texture0:"u_texture_0",texture1:"u_texture_1",texture2:"u_texture_2"}},W=(b)=>new p(Q).vertex(U).fragment(q).app(b);var B=new f({fov:45}),X=new J([2,3,3],c([-15,40,0])),l=new J([2,2,0]),a=new J(S(0),c([0,0,0])),L=new J([-3,0,1],c([0,0,0])),F=new N(B,V),y=new N(B,g);B.onUpdate(()=>{I.rotateY(a.rotation,a.rotation,0.001),I.rotateY(L.rotation,L.rotation,0.001)});new w(B,a,new R(B,s,W(B).addTexture("texture0",F).addTexture("texture1",y),X,l).configure({}));new w(B,L,new R(B,s,Y(B).addTexture("texture0",F).addTexture("texture1",y),X,l).configure({}));B.start(); diff --git a/html/004-a-new-leaf/main.js b/html/004-a-new-leaf/main.js index 740806d..979cf4c 100644 --- a/html/004-a-new-leaf/main.js +++ b/html/004-a-new-leaf/main.js @@ -1,140 +1,2 @@ -import { -Texture, -basic_vertex_rounding_default -} from "../chunk-701c22b55952babe.js"; -import { -Mesh, -MeshRenderer, -Renderable, -Shader, -Transform, -WebGLApp, -etoq, -v3 -} from "../chunk-652b721da622b7d9.js"; - -// src/common-shaders/toon-shading.frag -var toon_shading_default = `#version 300 es -precision highp float; - -uniform vec4 u_light_0_color; -uniform vec4 u_albedo; // ambient color - -uniform sampler2D u_texture_0; -uniform sampler2D u_texture_1; -uniform sampler2D u_texture_2; - -in vec2 uv0; -in vec3 normal; -in vec3 light_pos; - -out vec4 fragColor; - -void main() { - // vec4 normalTex = texture(u_texture_1, uv0); - // vec3 normal = normalize(normal * normalTex.rgb); - vec3 normal = normalize(normal); - - float light = clamp(dot(normal, light_pos), 0.0, 1.0); - - vec3 ramp = texture(u_texture_2, vec2(light, 0.0)).rgb; - - fragColor = vec4(1.0); - fragColor.rgb = texture(u_texture_0, uv0).rgb; - fragColor.rgb *= ramp; - fragColor.a = 1.0; -} -`; - -// src/common-shaders/sonya.ts -var basicShaderConfig = { - attributes: { - vertex: "a_vertex", - uv0: "a_uv0", - normal: "a_normal", - vertexColor: "a_vertex_color" - }, - uniforms: { - view: "u_view", - projection: "u_projection", - objectToWorld: "u_object_to_world", - objectToWorldInv: "u_object_to_world_inv", - light0: "u_light_0", - light0Color: "u_light_0_color", - time: "u_time", - albedo: "u_albedo", - texture0: "u_texture_0", - texture1: "u_texture_1", - texture2: "u_texture_2" - } -}; -var sonya = (app, ambientLight = [0.1, 0.1, 0.1, 1]) => new Shader(basicShaderConfig).vertex(basic_vertex_rounding_default).fragment(toon_shading_default).app(app).prerenderHook(({ gl }, shader2) => { - gl.uniform4fv(shader2.mappings.uniforms.albedo, ambientLight); -}); - -// src/meshes/cube-backdrop/cube-backdrop.ts -var cube_backdrop_default = new Mesh({ - colors: null, - faces: new Uint8Array([0, 1, 2, 3, 4, 0, 0, 5, 3, 0, 4, 1, 3, 6, 4, 0, 7, 5]), - name: "src/meshes/cube-backdrop/cube-backdrop.ply", - normals: new Float32Array([0.5773503, 0.5773503, 0.5773503, 1, 0, 0, 0.70710677, 0.70710677, 0, 0, 0.70710677, 0.70710677, 0.70710677, 0, 0.70710677, 0, 1, 0, 0, 0, 1, 0.70710677, 0.70710677, 0]), - positions: new Float32Array([-0.10000001, -0.0025735903, -0.10000001, -0.10000001, 0.19742644, 0.10000001, -0.10000001, -0.0025735903, 0.10000001, 0.10000001, -0.0025735903, -0.10000001, -0.10000001, 0.19742644, -0.10000001, 0.10000001, -0.0025735903, 0.10000001, 0.10000001, 0.19742644, -0.10000001, -0.10000001, -0.0025735903, 0.10000001]), - uvs: new Float32Array([0.5, 0.5, -0.000000059604645, 1, 0, 0.49999997, 1, 0.50000006, 0.49999997, 1, 1, 0, 1, 1, 0.50000006, 0]), - vertexCount: 8 -}); - -// src/meshes/cube-backdrop/index.ts -var defaultTransform = new Transform(v3(0), etoq([0, -45, 0]), v3(20)); - -// src/renderer/color-utils.ts -var rgbToFloat = (r, g, b, a = 255) => [r / 255, g / 255, b / 255, a / 255]; - -// src/004-a-new-leaf/textures/ramp.png -var ramp_default = "../ramp-aa773f5148819e95.png"; - -// src/meshes/fox/fox.ts -var fox_default = new Mesh({ - colors: null, - faces: new Uint16Array([0, 1, 2, 0, 3, 4, 2, 3, 0, 5, 3, 2, 6, 7, 8, 8, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 27, 32, 18, 17, 33, 34, 35, 36, 37, 38, 39, 40, 13, 41, 42, 43, 44, 45, 46, 47, 15, 14, 48, 18, 32, 49, 26, 50, 33, 35, 51, 52, 53, 54, 54, 47, 14, 55, 48, 56, 11, 10, 57, 13, 58, 59, 40, 14, 13, 53, 47, 54, 60, 61, 62, 44, 63, 64, 6, 60, 65, 65, 7, 6, 66, 67, 54, 60, 68, 61, 38, 37, 69, 26, 49, 70, 67, 10, 12, 55, 71, 48, 72, 22, 23, 9, 68, 8, 68, 60, 6, 73, 17, 74, 75, 10, 67, 76, 26, 77, 1, 26, 76, 78, 47, 79, 0, 80, 81, 82, 50, 83, 84, 85, 86, 39, 13, 59, 87, 27, 29, 87, 20, 88, 29, 21, 87, 20, 89, 88, 90, 17, 16, 29, 72, 91, 40, 84, 86, 58, 92, 59, 21, 11, 19, 73, 87, 88, 27, 31, 2, 31, 5, 2, 52, 49, 53, 61, 68, 9, 93, 48, 94, 88, 93, 94, 51, 35, 95, 37, 96, 69, 33, 51, 41, 77, 52, 54, 67, 12, 77, 26, 1, 0, 76, 77, 12, 97, 49, 82, 46, 98, 99, 79, 53, 97, 23, 76, 72, 25, 50, 26, 0, 24, 26, 100, 37, 36, 52, 70, 49, 36, 101, 102, 64, 45, 44, 86, 66, 40, 11, 21, 91, 12, 72, 76, 82, 49, 50, 72, 11, 91, 75, 103, 89, 19, 89, 20, 32, 88, 94, 87, 21, 20, 79, 47, 53, 2, 1, 22, 22, 72, 29, 22, 29, 28, 27, 2, 28, 51, 95, 42, 50, 25, 83, 26, 70, 77, 0, 81, 24, 91, 21, 29, 23, 1, 76, 53, 49, 97, 77, 54, 67, 104, 105, 106, 52, 77, 70, 101, 36, 38, 4, 80, 0, 66, 54, 14, 62, 107, 60, 44, 46, 108, 41, 51, 42, 86, 109, 66, 57, 10, 75, 71, 16, 18, 55, 16, 71, 35, 110, 95, 32, 17, 73, 111, 3, 5, 40, 39, 84, 112, 75, 67, 72, 12, 11, 75, 89, 19, 75, 19, 57, 88, 89, 93, 74, 27, 73, 94, 48, 32, 19, 11, 57, 71, 18, 48, 40, 66, 14, 73, 88, 32, 113, 62, 61, 22, 28, 2, 35, 114, 110, 73, 27, 87, 115, 93, 89, 115, 89, 103, 116, 117, 118, 119, 120, 121, 122, 30, 74, 123, 124, 122, 125, 126, 127, 128, 129, 130, 131, 132, 133, 4, 132, 134, 135, 121, 136, 137, 112, 86, 138, 128, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 122, 124, 30, 123, 136, 121, 56, 48, 93, 58, 13, 15, 121, 141, 140, 123, 121, 124, 30, 27, 74, 149, 150, 151, 152, 122, 74, 145, 153, 154, 120, 141, 121, 100, 36, 102, 155, 156, 153, 157, 151, 118, 152, 74, 17, 121, 135, 119, 144, 119, 145, 119, 144, 120, 158, 159, 160, 4, 159, 132, 100, 161, 162, 163, 98, 164, 138, 98, 45, 15, 165, 149, 166, 34, 33, 154, 153, 167, 153, 145, 155, 93, 115, 56, 154, 167, 164, 116, 168, 117, 150, 168, 116, 92, 157, 118, 136, 123, 169, 109, 112, 67, 3, 111, 160, 170, 171, 127, 132, 131, 34, 165, 150, 149, 148, 147, 172, 115, 85, 173, 158, 139, 159, 159, 4, 160, 149, 151, 157, 126, 125, 148, 45, 174, 129, 128, 133, 159, 156, 163, 167, 92, 58, 157, 175, 5, 142, 140, 31, 124, 144, 141, 120, 86, 85, 137, 8, 68, 6, 45, 98, 46, 34, 176, 35, 64, 176, 174, 176, 34, 177, 64, 174, 45, 64, 63, 176, 132, 34, 166, 162, 96, 100, 58, 149, 157, 125, 127, 171, 178, 179, 180, 181, 125, 171, 147, 182, 172, 126, 148, 172, 129, 128, 138, 130, 133, 128, 179, 178, 183, 177, 34, 131, 132, 166, 134, 159, 139, 128, 159, 133, 132, 160, 111, 175, 154, 143, 145, 137, 85, 115, 138, 45, 129, 35, 176, 114, 100, 102, 161, 100, 96, 37, 139, 98, 138, 164, 98, 158, 99, 98, 184, 98, 163, 184, 165, 47, 78, 160, 4, 3, 17, 90, 152, 167, 153, 156, 75, 112, 103, 142, 144, 143, 113, 107, 62, 151, 150, 116, 124, 31, 30, 142, 5, 140, 5, 31, 140, 125, 146, 148, 176, 63, 114, 139, 158, 98, 5, 175, 111, 164, 158, 160, 143, 164, 160, 15, 149, 58, 118, 151, 116, 112, 137, 103, 163, 164, 167, 175, 142, 143, 164, 143, 154, 175, 143, 160, 142, 141, 144, 121, 140, 124, 103, 137, 115, 80, 4, 134, 67, 66, 109, 109, 86, 112, 47, 165, 15, 181, 171, 170, 185, 186, 187, 188, 189, 190, 191, 192, 193, 191, 194, 192, 195, 196, 197, 198, 199, 200, 201, 199, 198, 202, 203, 204, 205, 201, 206, 207, 201, 205, 208, 185, 209, 210, 185, 208, 211, 185, 210, 212, 185, 211, 194, 189, 213, 194, 190, 189, 214, 215, 216, 192, 212, 217, 218, 219, 220, 221, 219, 218, 213, 192, 194, 198, 206, 201, 187, 209, 185, 217, 193, 192, 193, 222, 191, 193, 223, 222, 193, 224, 223, 193, 225, 224, 193, 226, 225, 193, 203, 226, 193, 204, 203, 218, 227, 221, 218, 199, 227, 218, 200, 199, 204, 215, 202, 204, 216, 215, 216, 219, 214, 216, 220, 219, 211, 217, 212, 228, 229, 85, 228, 85, 84, 230, 231, 84, 230, 84, 39, 232, 230, 39, 232, 39, 59, 233, 234, 90, 233, 90, 16, 235, 236, 55, 235, 55, 56, 237, 238, 173, 239, 240, 16, 239, 16, 55, 241, 232, 59, 241, 59, 92, 242, 241, 92, 231, 228, 84, 240, 233, 16, 243, 244, 122, 243, 122, 152, 245, 246, 119, 245, 119, 135, 247, 248, 136, 247, 136, 169, 246, 249, 119, 250, 251, 168, 234, 252, 152, 234, 152, 90, 244, 253, 122, 254, 255, 118, 253, 256, 123, 253, 123, 122, 257, 258, 145, 256, 259, 169, 256, 169, 123, 260, 261, 262, 248, 135, 136, 263, 237, 173, 263, 173, 85, 238, 264, 115, 238, 115, 173, 265, 254, 118, 265, 118, 117, 264, 235, 56, 264, 56, 115, 255, 242, 92, 255, 92, 118, 258, 266, 155, 258, 155, 145, 252, 243, 152, 259, 247, 169, 249, 257, 145, 249, 145, 119, 251, 265, 117, 251, 117, 168, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 236, 239, 55, 229, 263, 85, 279, 280, 281, 282, 283, 284]), - name: "src/meshes/fox/fox.ply", - normals: new Float32Array([0.3475203, -0.1423119, -0.92681, 0.5162422, 0.12797521, -0.8468272, 0.15832935, 0.05530619, -0.98583627, -0.34248725, 0.027904412, -0.9391081, -0.5169309, -0.31768712, -0.7948945, -0.48697895, -0.1626665, -0.85813236, 0.979832, 0.13666466, -0.14578043, 0.9031805, 0.21487509, -0.37160963, 0.66321534, 0.26724067, -0.6990907, 0.6848186, 0.23503296, -0.68977004, 0.50283414, 0.37262148, -0.779943, 0.23640795, 0.47815725, -0.84585875, 0.3647613, 0.40136182, -0.8401535, 0.3046436, 0.23757984, 0.92236, 0.31008115, 0.576068, 0.7563038, -0.22806334, 0.32389933, 0.91819185, 0.17951295, -0.316014, -0.931617, -0.17395478, -0.060770363, -0.9828767, 0.3371145, -0.028111659, -0.94104385, 0.5286752, 0.36182427, -0.76784486, 0.37282482, 0.34924614, -0.8596678, 0.04436654, 0.3120137, -0.9490411, 0.1748497, -0.08175629, -0.981195, 0.4760932, 0.18387188, -0.8599573, 0.77194935, -0.10489054, -0.6269707, 0.8878576, 0.018637033, -0.45974046, 0.8233882, 0.00536109, -0.5674533, 0.50706327, 0.2949509, -0.8098708, 0.5776023, 0.024086185, -0.8159629, 0.20082258, 0.4428197, -0.8738313, -0.3673268, -0.008583662, -0.9300523, -0.23037066, -0.14419852, -0.9623597, 0.10130113, 0.55220604, -0.82753044, -0.30028316, 0.6138469, -0.7300836, -0.42857707, 0.59847176, -0.67687017, 0.2310956, 0.77802414, -0.5841861, 0.40507296, -0.59645694, -0.69293207, 0.018303465, 0.44150117, -0.8970739, 0.77194935, -0.10489054, -0.6269707, 0.6770759, -0.15234865, 0.71997094, 0.5551748, 0.09818922, 0.82591754, 0.5862696, 0.275684, -0.7617652, 0.8878576, 0.018637033, -0.45974046, 0.77194935, -0.10489054, -0.6269707, 0.3452935, 0.52275664, 0.7794215, -0.037781123, 0.40868607, 0.9118927, 0.47639555, 0.22756127, 0.8492721, 0.038687505, 0.4890638, 0.87138975, 0.4779266, 0.31795877, -0.8188335, 0.9412043, 0.3062575, 0.14262189, 0.985557, -0.050912835, -0.16150954, 0.41709664, 0.43660966, -0.79712135, 0.65320575, 0.7567542, -0.025403246, 0.5102622, 0.5121896, 0.6908649, 0.5327677, 0.8339708, 0.14370571, 0.50982845, -0.2752561, -0.81505156, 0.9362124, 0.034893714, -0.34969804, 0.49277383, 0.474742, -0.729242, -0.10767815, 0.15382154, 0.98221403, 0.53157943, -0.18795584, 0.825891, 0.3452935, 0.52275664, 0.7794215, 0.73606163, 0.6634644, -0.13426952, -0.17794462, 0.9747583, -0.13484038, -0.38528097, 0.9081675, 0.1636775, 0.03706524, 0.8542405, 0.51855505, 0.90783143, 0.11600388, 0.40297043, 0.8010637, 0.5264299, 0.2849009, 0.6885465, 0.57700217, -0.43928608, 0.95855004, 0.10577212, 0.26456407, 0.5862696, 0.275684, -0.7617652, 0.78829354, 0.5408408, -0.2934015, 0.21502984, 0.04666299, -0.97549206, 0.102968186, 0.09595936, -0.9900452, -0.42321405, 0.5065525, -0.7511954, -0.69715625, -0.08602459, -0.71173936, 0.82457936, 0.081235796, -0.5598835, 0.4377959, 0.26956058, -0.85771316, 0.6155783, 0.5745703, -0.5393813, 0.07019434, 0.24138543, 0.9678872, 0.3541473, 0.25355586, 0.9001605, -0.29064578, -0.724498, -0.62500215, 0.375913, -0.73612595, -0.56285685, 0.90783143, 0.11600388, 0.40297043, 0.9031805, 0.21487509, -0.37160963, 0.5472127, -0.29103354, 0.7847661, 0.87695193, -0.2072897, 0.4335738, 0.8803676, 0.14394727, 0.45192042, 0.15257555, 0.7520019, -0.64125955, 0.073696144, 0.91218823, -0.40308988, 0.48116767, 0.69189876, -0.5382877, -0.38885155, -0.2292497, -0.8923223, -0.08802483, 0.3184032, -0.94385976, -0.16566989, -0.31949857, 0.9329921, 0.4088575, 0.88988423, -0.20234066, 0.23401263, 0.7841241, -0.5747935, 0.9031805, 0.21487509, -0.37160963, -0.30028316, 0.6138469, -0.7300836, 0.47639555, 0.22756127, 0.8492721, -0.13893181, 0.08481444, 0.98666334, 0.3541473, 0.25355586, 0.9001605, -0.6594078, -0.34964943, -0.6655273, 0.375913, -0.73612595, -0.56285685, -0.29064578, -0.724498, -0.62500215, 0.7611686, 0.58185023, -0.28648314, -0.04397583, 0.70420456, -0.7086339, 0.73606163, 0.6634644, -0.13426952, 0.6848186, 0.23503296, -0.68977004, -0.38528097, 0.9081675, 0.1636775, 0.90783143, 0.11600388, 0.40297043, 0.9180944, 0.3928391, 0.052727237, 0.6848186, 0.23503296, -0.68977004, -0.75246775, 0.008946161, -0.6585683, 0.93610126, 0.23180684, -0.26453748, -0.04397583, 0.70420456, -0.7086339, -0.04397583, 0.70420456, -0.7086339, 0.92324126, 0.38289523, 0.03188642, -0.8208653, 0.15153797, 0.55065095, -0.6847748, 0.31241915, 0.6583902, -0.44955286, -0.170653, 0.87680095, -0.69434595, 0.69967836, -0.16832665, -0.64949834, 0.59640735, -0.47164628, -0.72120667, 0.6666094, -0.18839571, -0.44213012, -0.017088598, -0.8967881, -0.16689667, 0.37004504, -0.9138995, -0.32365012, -0.16409263, -0.93183917, -0.81858766, 0.5451293, -0.18096499, -0.992983, 0.08945896, 0.07734239, -0.21252948, 0.5347677, 0.81783545, -0.7021046, -0.14130145, 0.6979133, -0.992983, 0.08945896, 0.07734239, -0.9546164, 0.028929858, -0.2964296, -0.7311533, 0.36524838, -0.5762018, -0.9617006, -0.03754102, -0.27151904, -0.9879483, 0.08645398, -0.1283894, -0.78725094, -0.2752617, -0.5517852, -0.74839973, -0.49738073, -0.4387599, -0.6237263, 0.711984, -0.32255915, 0.9198568, 0.38913035, -0.049406413, -0.44723478, 0.13983466, 0.883418, -0.6689012, -0.23592637, 0.7049185, -0.8903412, -0.15419926, -0.42838684, -0.92482555, 0.016368585, -0.3800392, -0.8165544, -0.1464694, -0.55837774, -0.87178856, -0.35990623, -0.3323434, -0.517776, 0.4540006, -0.7251148, -0.8433312, 0.09983585, 0.52803904, -0.47634494, -0.05045076, -0.87780994, -0.7311533, 0.36524838, -0.5762018, -0.6984636, -0.017294424, -0.71543664, -0.64312565, 0.17802551, 0.7447794, -0.66986597, -0.026210472, 0.7420193, -0.90760005, 0.06683492, 0.41448176, -0.71550065, -0.2610496, -0.6480061, -0.48163462, -0.16273934, 0.86112946, -0.9447443, -0.18422589, 0.271144, -0.84864473, -0.16340141, 0.5030924, -0.66986597, -0.026210472, 0.7420193, -0.44133595, 0.045067813, 0.8962095, -0.84305483, -0.09319865, 0.52969086, -0.96471584, -0.253683, 0.070486, -0.90281165, -0.30579108, -0.30236223, -0.78725094, -0.2752617, -0.5517852, -0.747842, 0.21194589, -0.6291353, -0.38904643, 0.09032617, 0.9167791, -0.8832008, -0.12243323, 0.45273212, -0.38904643, 0.09032617, 0.9167791, -0.747842, 0.21194589, -0.6291353, -0.4839415, -0.097555116, 0.86964566, -0.84864473, -0.16340141, 0.5030924, -0.05462312, 0.1690641, -0.9840902, 0.075866185, 0.9794647, -0.18679745, 0.02688641, 0.9635681, -0.26610863, -0.9546164, 0.028929858, -0.2964296, 0.94705594, -0.2590572, -0.18966934, -0.21252948, 0.5347677, 0.81783545, -0.6675564, -0.59708816, -0.444808, 0.075866185, 0.9794647, -0.18679745, -0.23479536, 0.67432845, -0.7001088, -0.23479536, 0.67432845, -0.7001088, -0.47634494, -0.05045076, -0.87780994, -0.81858766, 0.5451293, -0.18096499, -0.23479536, 0.67432845, -0.7001088, -0.9879483, 0.08645398, -0.1283894, -0.7311533, 0.36524838, -0.5762018, 0.07019434, 0.24138543, 0.9678872, -0.40643814, -0.8098558, -0.42301488, -0.19065972, -0.720445, -0.66678923, 0.075374685, -0.7676886, -0.6363747, 0.41129172, -0.60820895, -0.6789117, 0.3633369, -0.6630077, -0.65452826, -0.52704555, -0.58184344, -0.6194199, -0.017521787, -0.99930537, 0.032890607, -0.021521537, -0.94214505, -0.3345139, 0.6121442, -0.6924734, -0.38178536, -0.70010203, -0.5537167, -0.45083794, -0.7312984, -0.6671969, -0.14160144, -0.70010203, -0.5537167, -0.45083794, -0.017521787, -0.99930537, 0.032890607, 0.3288468, -0.8804425, 0.34158558, -0.1467376, -0.75445783, 0.63973546, 0.24385142, -0.7973807, 0.55201495, -0.23899291, -0.84482497, 0.4786994, -0.80877304, -0.50211614, 0.3062115, -0.847515, -0.42922866, -0.3122198, 0.5623081, -0.8260273, -0.03858204, 0.04242061, -0.8742375, 0.4836417, 0.407, -0.7800877, 0.47519907, -0.12836032, -0.80886763, 0.57380897, 0.16910498, -0.7943238, -0.5834837, 0.12811182, -0.79456544, -0.59350926, 0.40930107, -0.86440027, -0.29203552, 0.48217154, -0.858188, -0.17613666, -0.57233065, -0.7097642, -0.41069746, 0.22967121, -0.49633533, -0.83719915, -0.27430204, -0.8970687, 0.34644783, -0.62714297, -0.48046845, 0.6130593, 0.5038301, -0.8556301, 0.1185428, 0.42636088, -0.8999785, -0.09085657, 0.39348367, -0.810439, 0.4340037, -0.38334632, -0.9040218, 0.18918258, 0.4810456, -0.8009131, 0.35655776, -0.68955994, -0.7188539, 0.0880689, -0.0558253, -0.9859457, 0.15746342, -0.0028608302, -0.9999959, -0.000106975036, -0.011426341, -0.9991058, -0.04070532, -0.011439374, -0.9991109, -0.04057865, -0.58131546, -0.51583326, -0.6292762, -0.58025545, -0.63782334, 0.5064435, 0.39348367, -0.810439, 0.4340037, 0.4810456, -0.8009131, 0.35655776, 0.3288468, -0.8804425, 0.34158558, 0.24385142, -0.7973807, 0.55201495, 0.407, -0.7800877, 0.47519907, 0.075374685, -0.7676886, -0.6363747, -0.19065972, -0.720445, -0.66678923, 0.48217154, -0.858188, -0.17613666, 0.40930107, -0.86440027, -0.29203552, 0.5623081, -0.8260273, -0.03858204, 0.6121442, -0.6924734, -0.38178536, 0.16910498, -0.7943238, -0.5834837, 0.12811182, -0.79456544, -0.59350926, 0.04242061, -0.8742375, 0.4836417, -0.12836032, -0.80886763, 0.57380897, -0.57233065, -0.7097642, -0.41069746, -0.021521537, -0.94214505, -0.3345139, -0.58131546, -0.51583326, -0.6292762, -0.847515, -0.42922866, -0.3122198, -0.52704555, -0.58184344, -0.6194199, -0.70010203, -0.5537167, -0.45083794, -0.80877304, -0.50211614, 0.3062115, -0.38334632, -0.9040218, 0.18918258, -0.68955994, -0.7188539, 0.0880689, -0.40643814, -0.8098558, -0.42301488, 0.22967121, -0.49633533, -0.83719915, -0.1467376, -0.75445783, 0.63973546, -0.23899291, -0.84482497, 0.4786994, 0.3633369, -0.6630077, -0.65452826, -0.62714297, -0.48046845, 0.6130593, -0.27430204, -0.8970687, 0.34644783, 0.41129172, -0.60820895, -0.6789117, -0.70010203, -0.5537167, -0.45083794, -0.7312984, -0.6671969, -0.14160144, -0.74839973, -0.49738073, -0.4387599, 0.5038301, -0.8556301, 0.1185428, 0.42636088, -0.8999785, -0.09085657, -0.58025545, -0.63782334, 0.5064435, -0.38334632, -0.9040218, 0.18918258, -0.7312984, -0.6671969, -0.14160144, -0.017521787, -0.99930537, 0.032890607, -0.74839973, -0.49738073, -0.4387599, -0.0028608302, -0.9999959, -0.000106975036, -0.011426341, -0.9991058, -0.04070532, -0.74839973, -0.49738073, -0.4387599, -0.017521787, -0.99930537, 0.032890607, -0.0558253, -0.9859457, 0.15746342, -0.74839973, -0.49738073, -0.4387599, -0.0558253, -0.9859457, 0.15746342, -0.0028608302, -0.9999959, -0.000106975036, -0.74839973, -0.49738073, -0.4387599, -0.011439374, -0.9991109, -0.04057865, -0.58131546, -0.51583326, -0.6292762, -0.74839973, -0.49738073, -0.4387599, -0.011426341, -0.9991058, -0.04070532, -0.011439374, -0.9991109, -0.04057865, -0.74839973, -0.49738073, -0.4387599]), - positions: new Float32Array([-0.6999253, 6.443001, -0.82603, 0.07097474, 5.343301, -0.52663046, -0.76262593, 4.472701, -1.15393, -1.7783258, 5.520501, -0.86433035, -2.2427258, 6.713101, -0.82603, -1.5250261, 4.4763007, -0.9856301, 0.29497454, 9.249201, 0.16336976, 0.06327439, 8.8725, -0.28472978, -0.035225682, 9.543601, 0.14946976, -0.30342564, 9.674201, -0.23032992, 2.4808748, 3.6319008, -0.11143037, 2.0297747, 3.2159004, -0.4459305, 1.5565743, 4.603301, -0.21123049, 2.1004748, 3.2381003, 3.2929707, 1.8371744, 4.748301, 2.81227, 0.20437472, 4.420901, 2.9141703, 1.8253747, 0.4645001, -1.7956301, 0.91437465, 0.9539002, -2.1209302, 2.4374743, 1.0497, -1.8992304, 2.5767748, 2.7875004, -0.6003304, 1.7599748, 1.8992002, -1.1086301, 1.5595742, 2.5219004, -1.29143, 0.24357454, 3.5395007, -0.67183006, 0.24817431, 4.333201, -0.45933002, -0.3960259, 7.7391005, -1.2657304, 0.05687409, 8.074501, -0.67993015, -0.12432557, 6.748201, -0.34603044, -0.06132584, 2.9543004, -0.8707303, -0.20062563, 3.4773006, -0.68853, 0.43317416, 2.5253003, -0.46623006, -0.4904259, 2.1981003, -0.90393, -1.0552258, 3.1734004, -1.06763, 1.4597749, 1.4790002, -2.0267305, -1.8893259, 8.729101, -1.7110304, -2.2624261, 9.345001, -1.37473, -0.97242594, 9.702102, -0.89533013, -1.2870256, 7.527001, -2.5206306, -1.5926256, 8.311801, -2.8306303, -0.3960259, 7.7391005, -1.2657304, 2.5549746, 1.4319001, 2.9302707, 2.773675, 2.7475002, 3.0280704, -0.94812554, 8.5809, -1.5055304, 0.05687409, 8.074501, -0.67993015, -0.3960259, 7.7391005, -1.2657304, -0.40532535, 9.700401, 0.84696966, -1.540426, 8.934701, 1.6871705, -0.62042546, 7.995201, 1.7714701, -0.15842591, 5.3485007, 2.2917705, 3.3480747, 1.1927001, -1.4741304, 0.23047411, 6.9421005, 0.8096703, 0.17777406, 7.816401, -0.13533022, -0.80692565, 9.159501, -1.4650301, 0.73637474, 6.182101, 0.90636986, 0.16357423, 6.238301, 1.5856699, 2.0266747, 5.562201, 1.4546701, 3.4768748, 0.57150006, -1.4508302, 4.1452746, 0.9685002, -0.7070302, 2.576082, 3.1560004, -0.31358007, 0.7198746, 2.4339004, 3.54267, 2.288975, 1.3705001, 3.4610705, -0.40532535, 9.700401, 0.84696966, 0.14267427, 10.748201, 0.011170197, -0.35632557, 10.885501, -0.026630403, -1.0288259, 10.067701, 0.053869635, -1.2105256, 9.758201, 0.87647027, 0.09657441, 8.901701, 0.59447026, 3.0635746, 4.299401, 1.8075701, 2.5929751, 4.772801, 0.5979699, 0.16167451, 9.942601, 0.37547, -0.94812554, 8.5809, -1.5055304, 0.47697452, 6.306901, 0.39987034, 3.0665743, 0.73340005, -1.42483, 0.6858742, 3.7022007, -0.62512976, 0.044074252, 1.8123003, -1.5475305, -0.053825382, 1.2451001, -1.5953302, 3.2380748, 2.4352005, -0.08572999, 0.5252747, 5.1989007, -0.29223025, 0.8465745, 5.738801, 0.27866977, -0.7709256, 5.724101, 2.2065706, -0.619426, 6.356501, 1.9183702, -1.9789258, 7.178801, -1.18583, -0.91182566, 7.3815007, -1.4608301, 0.09657441, 8.901701, 0.59447026, 0.06327439, 8.8725, -0.28472978, 3.0936747, 0.6671002, 2.4830706, 4.0453753, 0.52309996, 1.4920702, 3.6563747, 2.4587002, 2.1933703, 0.5219742, 1.8811003, -1.0851305, 1.1984742, 1.6896003, -1.65813, 2.625175, 1.7991003, -0.6557297, 0.67027444, 0.5334, -1.9347303, 1.2843744, 3.0958004, -0.5304299, 0.77727437, 1.2146001, 3.4750705, 3.4174747, 1.7396003, -0.85813, 2.3443742, 1.5199003, -1.5742303, 0.06327439, 8.8725, -0.28472978, -1.8893259, 8.729101, -1.7110304, -0.62042546, 7.995201, 1.7714701, -1.219426, 6.696401, 2.0643702, -0.619426, 6.356501, 1.9183702, -2.161226, 7.667401, -2.4847305, -0.91182566, 7.3815007, -1.4608301, -1.9789258, 7.178801, -1.18583, 3.1734743, 1.5024002, 0.15137026, -0.7888257, 10.067701, -0.3484299, 0.14267427, 10.748201, 0.011170197, -0.30342564, 9.674201, -0.23032992, -1.0288259, 10.067701, 0.053869635, 0.09657441, 8.901701, 0.59447026, 3.387675, 3.7165008, 1.58967, -0.30342564, 9.674201, -0.23032992, -2.2445261, 4.9454007, -0.66073006, 3.6162753, 2.8629005, 0.8747697, -0.7888257, 10.067701, -0.3484299, -0.7888257, 10.067701, -0.3484299, 4.364375, 1.0550001, 0.5702698, -0.61192554, 1.0255002, 2.04657, -1.0520257, 0.52869993, 2.4247699, -0.0897255, 0.5721001, 2.6455705, -2.517626, 0.78980017, 0.25796968, -1.337726, 0.8835, 0.28996965, -1.4268259, 0.95919997, -0.43353048, -0.44272542, 1.0345002, -0.70443004, -1.0315259, 1.0731, -0.7273301, -1.0638257, 2.0252004, -0.7415303, -3.471126, 10.565201, 0.1122696, -3.4521263, 9.519001, 0.46967015, -2.878626, 9.963901, 0.81987005, -2.741226, 7.508901, 1.3471704, -3.4521263, 9.519001, 0.46967015, -3.433826, 9.038601, 0.28866962, -2.882526, 9.084501, -0.10313035, -3.3896263, 8.113201, -0.3605301, -3.3058262, 8.5403, 0.07176972, -2.7694259, 7.7350006, -1.0115304, -2.230626, 0.22640002, -0.41983035, -1.868326, 0.75070006, -0.9546304, 3.880675, 1.3958001, 1.1265702, -2.327826, 8.2278, 1.5766702, -2.5213258, 6.882601, 1.3467698, -1.4618257, 2.4264002, -0.6133301, -1.2621258, 1.7734003, 0.17966996, -1.4422258, 3.0290003, 0.4318703, -1.9845258, 3.6388009, 0.69077003, -1.890426, 1.0817002, 0.44496998, -2.0575259, 0.9955001, 0.9599702, -2.964326, 9.822501, -0.10223008, -2.882526, 9.084501, -0.10313035, -3.092126, 9.502201, 0.2502701, -0.087125406, 3.1274004, 2.8989704, -0.8196259, 2.3198001, 1.7973703, -0.8748258, 2.0967002, 2.7634706, 0.02887421, 0.7540002, -1.4195303, -1.665426, 1.8197002, 1.62437, -2.1923258, 3.5194008, 1.3925699, -1.186226, 0.55610013, 1.5514703, -0.8196259, 2.3198001, 1.7973703, -0.029425815, 2.1513002, 3.4381702, -2.5888262, 6.208601, 0.9756699, -3.112326, 7.3445005, 0.3178696, -2.667426, 4.758001, 0.018969728, -2.7694259, 7.7350006, -1.0115304, -2.392026, 8.487902, -1.3364304, -0.8792256, 4.817401, 2.3403704, -2.6100261, 4.707801, 1.3596704, -0.8792256, 4.817401, 2.3403704, -2.392026, 8.487902, -1.3364304, -1.8001261, 4.085301, 1.9035699, -1.186226, 0.55610013, 1.5514703, -1.569626, 0.3742001, -1.4788301, -1.9930261, 9.862201, -0.003130341, -3.0411263, 10.770401, 0.043869786, -3.433826, 9.038601, 0.28866962, 4.2867746, 0.52519995, 0.41017002, -2.878626, 9.963901, 0.81987005, -1.9710261, 3.9114006, 0.01537018, -1.9930261, 9.862201, -0.003130341, -2.2901258, 9.714901, -0.21963045, -2.2901258, 9.714901, -0.21963045, -2.964326, 9.822501, -0.10223008, -3.471126, 10.565201, 0.1122696, -2.2901258, 9.714901, -0.21963045, -3.3058262, 8.5403, 0.07176972, -2.882526, 9.084501, -0.10313035, -0.7709256, 5.724101, 2.2065706, 0.58418125, 0.22400019, -1.7113466, 0.7487328, 0.22400019, -1.869269, 1.2752382, 0.22400019, -1.8116388, -1.4210848, 0.22400019, -1.3924581, -1.2286401, 0.22400019, -1.2118917, -1.7548681, 0.22400019, -1.3470285, -2.2161448, 0.22400019, -0.43305972, -0.5065232, 0.22400019, -0.5854172, 3.6921923, 0.22400019, -0.5356896, -1.9521799, 0.22400019, -1.126045, -2.2274122, 0.22400019, -0.4297089, -1.9521799, 0.22400019, -1.126045, -2.2161448, 0.22400019, -0.43305972, 2.2313638, 0.22400019, 2.680494, -0.6810555, 0.22400019, 2.4642336, 2.4538667, 0.22400019, 2.5940027, 0.41850665, 0.22400019, 2.7519977, -2.6425998, 0.22400019, 0.70022744, -2.7626433, 0.22400019, 0.07626649, 4.1131854, 0.22400019, 0.46040884, 1.955617, 0.22400019, 2.7750673, 2.1960154, 0.22400019, 2.7574801, 0.7445824, 0.22400019, 2.9373279, 2.7569857, 0.22400019, -1.5163606, 2.100773, 0.22400019, -1.6653436, 3.4797022, 0.22400019, -1.0087174, 3.5642383, 0.22400019, -0.8515244, -0.37594378, 0.22400019, -0.7854573, -1.1313287, 0.22400019, -1.2045778, -1.2935071, 0.22400019, 1.0919343, -2.5766528, 0.22400019, 0.8374413, 4.0127363, 0.22400019, 0.9127198, 3.5815594, 0.22400019, -0.7074967, 3.4810352, 0.22400019, 1.8996607, -1.11559, 0.22400019, 1.3025575, 3.8143253, 0.22400019, 1.5762239, -1.0991356, 0.22400019, 2.0397234, -2.209373, 0.22400019, -0.42154086, -2.1618967, 0.22400019, -0.40970844, -2.1749234, 0.22400019, -0.40605244, -2.1937947, 0.22400019, -0.40073627, -2.2783449, 0.22400019, -0.37692034, -1.0468484, 0.22400019, 2.382645, 3.4810352, 0.22400019, 1.8996607, 3.8143253, 0.22400019, 1.5762239, 2.2313638, 0.22400019, 2.680494, 2.4538667, 0.22400019, 2.5940027, 2.1960154, 0.22400019, 2.7574801, 1.2752382, 0.22400019, -1.8116388, 0.7487328, 0.22400019, -1.869269, 3.5642383, 0.22400019, -0.8515244, 3.4797022, 0.22400019, -1.0087174, 4.1131854, 0.22400019, 0.46040884, 3.6921923, 0.22400019, -0.5356896, 2.7569857, 0.22400019, -1.5163606, 2.100773, 0.22400019, -1.6653436, 1.955617, 0.22400019, 2.7750673, 0.7445824, 0.22400019, 2.9373279, -0.37594378, 0.22400019, -0.7854573, -0.5065232, 0.22400019, -0.5854172, -2.2783449, 0.22400019, -0.37692034, -2.7626433, 0.22400019, 0.07626649, -1.7548681, 0.22400019, -1.3470285, -1.9521799, 0.22400019, -1.126045, -2.6425998, 0.22400019, 0.70022744, -1.11559, 0.22400019, 1.3025575, -1.0991356, 0.22400019, 2.0397234, 0.58418125, 0.22400019, -1.7113466, -1.1313287, 0.22400019, -1.2045778, -0.6810555, 0.22400019, 2.4642336, 0.41850665, 0.22400019, 2.7519977, -1.2286401, 0.22400019, -1.2118917, -2.5766528, 0.22400019, 0.8374413, -1.2935071, 0.22400019, 1.0919343, -1.4210848, 0.22400019, -1.3924581, -1.9521799, 0.22400019, -1.126045, -2.2274122, 0.22400019, -0.4297089, -2.230626, 0.22640002, -0.41983035, 4.0127363, 0.22400019, 0.9127198, 3.5815594, 0.22400019, -0.7074967, -1.0468484, 0.22400019, 2.382645, -1.11559, 0.22400019, 1.3025575, -2.2274122, 0.22400019, -0.4297089, -2.2161448, 0.22400019, -0.43305972, -2.230626, 0.22640002, -0.41983035, -2.1618967, 0.22400019, -0.40970844, -2.1749234, 0.22400019, -0.40605244, -2.230626, 0.22640002, -0.41983035, -2.2161448, 0.22400019, -0.43305972, -2.209373, 0.22400019, -0.42154086, -2.230626, 0.22640002, -0.41983035, -2.209373, 0.22400019, -0.42154086, -2.1618967, 0.22400019, -0.40970844, -2.230626, 0.22640002, -0.41983035, -2.1937947, 0.22400019, -0.40073627, -2.2783449, 0.22400019, -0.37692034, -2.230626, 0.22640002, -0.41983035, -2.1749234, 0.22400019, -0.40605244, -2.1937947, 0.22400019, -0.40073627, -2.230626, 0.22640002, -0.41983035]), - uvs: new Float32Array([0.21851481, 0.38709354, 0.25122124, 0.29925498, 0.33613995, 0.31277353, 0.31780326, 0.41546077, 0.26634175, 0.49754715, 0.36926088, 0.35428312, 0.8862014, 0.7660378, 0.96414614, 0.65773886, 0.9142767, 0.82184976, 0.96414614, 0.8656495, 0.24378048, 0.15517116, 0.27324826, 0.1538348, 0.24071635, 0.21034758, 0.12782207, 0.13377228, 0.13686845, 0.17050092, 0.097095504, 0.18026535, 0.3456612, 0.015984222, 0.38372317, 0.05219409, 0.3173124, 0.03967564, 0.2669188, 0.12665303, 0.3150151, 0.10144508, 0.312529, 0.12937495, 0.32927862, 0.22344446, 0.2904697, 0.2528519, 0.13747068, 0.42125323, 0.1110152, 0.38961607, 0.17645767, 0.34971166, 0.37940347, 0.20685007, 0.3529383, 0.23464157, 0.35064337, 0.17517665, 0.43924242, 0.18647039, 0.41530237, 0.2674248, 0.34998143, 0.06725915, 0.12322961, 0.6801839, 0.1720783, 0.6964544, 0.16144735, 0.7933706, 0.8861246, 0.52512723, 0.84557533, 0.5134298, 0.9878913, 0.42880467, 0.12832226, 0.086800925, 0.14096868, 0.11748978, 0.074313566, 0.7435197, 0.020883663, 0.84153533, 0.00000001081579, 0.77996564, 0.32931674, 0.8416559, 0.35599756, 0.7471563, 0.4352468, 0.76457715, 0.09890157, 0.21372627, 0.28071728, 0.038383927, 0.12732372, 0.2965882, 0.11473294, 0.36185902, 0.110673696, 0.76611084, 0.1568792, 0.258202, 0.11916661, 0.24799357, 0.1670033, 0.20147358, 0.27564877, 0.017370421, 0.24627076, 0.033188876, 0.25064924, 0.13463129, 0.09065693, 0.12818988, 0.11538713, 0.09199737, 0.8276462, 0.8879465, 0.8977165, 0.9073449, 0.8979689, 0.9335955, 0.24703515, 0.8216678, 0.30523577, 0.7905776, 0.8020745, 0.7431329, 0.17493051, 0.15400115, 0.20319703, 0.1803566, 0.89068747, 0.8602873, 0.8669603, 0.42128757, 0.1696568, 0.2862294, 0.29085746, 0.022808408, 0.30401754, 0.21331184, 0.4063384, 0.124203816, 0.4319168, 0.09517003, 0.24068871, 0.10983848, 0.2422915, 0.26877972, 0.19642983, 0.2589539, 0.084621415, 0.22762483, 0.08997824, 0.2432744, 0.21659407, 0.49825695, 0.16409814, 0.4431432, 0.06007273, 0.3584054, 0.077401064, 0.3881148, 0.13976377, 0.06055675, 0.1772671, 0.045047924, 0.1689892, 0.10318307, 0.36747235, 0.13334484, 0.35129, 0.09048066, 0.27406374, 0.088201545, 0.40481266, 0.033736143, 0.3024185, 0.17043002, 0.080950305, 0.101946086, 0.26399732, 0.060749806, 0.3123137, 0.06264582, 0.08229262, 0.8732247, 0.78262734, 0.48695683, 0.054573745, 0.28939876, 0.4784059, 0.67288846, 0.52534187, 0.6902852, 0.843693, 0.54919225, 0.967211, 0.5381632, 0.8863765, 0.6507956, 0.23814057, 0.07682296, 0.52430856, 0.78790325, 0.5076637, 0.9781552, 0.42495766, 0.8044593, 0.88358545, 0.94791806, 0.39027283, 0.865766, 0.18311635, 0.13782379, 0.15227878, 0.86758876, 0.37036988, 0.41615537, 0.20584682, 0.11498356, 0.935007, 0.9301176, 0.19761893, 0.83779246, 0.20950294, 0.045586396, 0.0322884, 0.11481223, 0.02451134, 0.09802288, 0.048454616, 0.09665558, 0.6460075, 0.21836895, 0.5963892, 0.2274105, 0.5771463, 0.1884031, 0.5055221, 0.114784405, 0.5447714, 0.15467297, 0.48357084, 0.21026236, 0.75558704, 0.9432239, 0.8020744, 0.9034289, 0.7897775, 0.96688294, 0.36300594, 0.6462114, 0.27383736, 0.69182056, 0.27248618, 0.6792056, 0.2478923, 0.6867268, 0.25436208, 0.6271816, 0.26854706, 0.6570603, 0.2133645, 0.5806204, 0.637635, 0.17406993, 0.60493344, 0.1558058, 0.19796096, 0.06852602, 0.35857934, 0.69122976, 0.3951752, 0.6194137, 0.48257515, 0.25476277, 0.5577472, 0.2591085, 0.5101766, 0.3366432, 0.50301826, 0.39985734, 0.6224612, 0.2508355, 0.65923995, 0.27131322, 0.7339221, 0.92058545, 0.667627, 0.84930974, 0.75460386, 0.8875665, 0.07549074, 0.15373975, 0.036297202, 0.14856292, 0.053295545, 0.13493255, 0.45089763, 0.06624607, 0.65852106, 0.35673973, 0.5478699, 0.43424743, 0.734133, 0.3012958, 0.69251174, 0.422131, 0.07396352, 0.1281145, 0.4061021, 0.5678618, 0.31435022, 0.5997315, 0.4114268, 0.44731957, 0.75763285, 0.6744133, 0.734765, 0.56230044, 0.5902533, 0.5873184, 0.48538992, 0.4962032, 0.07417127, 0.20548928, 0.16459617, 0.6398786, 0.5627961, 0.49731115, 0.010203981, 0.1122183, 0.61384606, 0.11812159, 0.7293909, 0.98951745, 0.753717, 0.961225, 0.8020744, 0.78846765, 0.20760685, 0.029241929, 0.27992412, 0.7168905, 0.45012152, 0.3856737, 0.2468168, 0.7547342, 0.23586477, 0.728986, 0.52842814, 0.74081594, 0.58254737, 0.8386313, 0.5380133, 0.9808106, 0.69757915, 0.9635888, 0.70988774, 0.65773886, 0.6677008, 0.75300074, 0.5507923, 0.6433447, 0.9718312, 0.020504208, 0.97220457, 0.021100836, 0.9716987, 0.022655101, 0.9721315, 0.014245303, 0.9714647, 0.014712902, 0.97220457, 0.013208317, 0.96973413, 0.01123883, 0.96911705, 0.01649964, 0.96632093, 0.029152708, 0.9716613, 0.012472974, 0.80359983, 1.0238159, 0.80359983, 0.95338476, 0.8044696, 1.023133, 0.95752156, 0.022717984, 0.96000504, 0.01405433, 0.95764303, 0.02344461, 0.95844465, 0.017195703, 0.9665674, 0.0092362035, 0.96852803, 0.009265589, 0.9630468, 0.029798763, 0.9574091, 0.02182542, 0.95731115, 0.022562819, 0.9576798, 0.018064456, 0.9698729, 0.026945414, 0.9707365, 0.02505687, 0.9678838, 0.028808849, 0.96735567, 0.028965177, 0.9696391, 0.017020183, 0.9713813, 0.015002267, 0.96453613, 0.013066204, 0.96611136, 0.009349244, 0.9617433, 0.029211031, 0.96690965, 0.028926747, 0.9590955, 0.02698438, 0.963788, 0.013471412, 0.95986325, 0.028194623, 0.96155035, 0.013057904, 0.9696951, 0.011252033, 0.9696294, 0.011387991, 0.96961904, 0.011344941, 0.9696118, 0.01128404, 0.969593, 0.011013629, 0.9604814, 0.013000401, 0.15420465, 0.04102335, 0.16792865, 0.037144165, 0.110636964, 0.05624038, 0.117879316, 0.05280347, 0.1069449, 0.059347447, 0.37604672, 0.008110086, 0.4070614, 0.013023422, 0.25538462, 0.0031148791, 0.2648711, 0.000000008450675, 0.20259783, 0.019268692, 0.23897217, 0.0057812533, 0.3031835, 0.0016587148, 0.3331248, 0.0026185757, 0.09809749, 0.06282124, 0.068156235, 0.07761529, 0.52157223, 0.044851843, 0.5435285, 0.046751596, 0.63853747, 0.17621852, 0.66334546, 0.19258852, 0.62489164, 0.1247898, 0.6287393, 0.14086775, 0.68118423, 0.21481499, -0.0000000033102134, 0.10996528, 0.013690739, 0.09781893, 0.42186216, 0.014245739, 0.6017828, 0.094806425, 0.030619193, 0.091465615, 0.057839744, 0.08235605, 0.59865737, 0.10087764, 0.67908764, 0.21657859, 0.7325371, 0.2680749, 0.614245, 0.10814548, 0.43263742, 0.92657316, 0.43597075, 0.8869815, 0.43614823, 0.88644433, 0.18772343, 0.02667462, 0.24657853, 0.0037103465, 0.021488441, 0.09233946, 0.7439689, 0.2791134, 0.67494655, 0.99038863, 0.67444944, 0.9913764, 0.67444944, 0.98951757, 0.80714715, 0.95338464, 0.8076674, 0.95454615, 0.80714715, 0.9599234, 0.67331666, 0.9900621, 0.6744493, 0.98951745, 0.67444944, 0.99153584, 0.80814487, 0.9553456, 0.8076674, 0.95992327, 0.8076674, 0.9533845, 0.8044694, 0.9616473, 0.8044694, 0.95338464, 0.807147, 0.9587995, 0.67240256, 0.98951757, 0.6733167, 0.9911193, 0.67240256, 0.9949199]), - vertexCount: 285 -}); - -// src/meshes/fox/fox-tex.png -var fox_tex_default = "../fox-tex-03f042508a92e722.png"; - -// src/meshes/fox/fox-normal.png -var fox_normal_default = "../fox-normal-7ce4a77b1285eb7a.png"; - -// src/004-a-new-leaf/textures/backdrop.png -var backdrop_default = "../backdrop-0e5863d39a0305cf.png"; - -// src/004-a-new-leaf/textures/backdrop-normals.png -var backdrop_normals_default = "../backdrop-normals-6ba4b06676f112b6.png"; - -// src/renderer/helper-textures/white.png -var white_default = "../white-532695823c58790a.png"; - -// src/renderer/helper-textures/white.ts -var createWhiteTexture = (app) => new Texture(app, white_default); - -// src/004-a-new-leaf/main.ts -var useAlt = location.search.includes("alt1"); -var app = new WebGLApp({ fov: 45 }); -var camera = new Transform([0, 2, 4], etoq([-15, 0, 0])); -var light = new Transform([10, !useAlt ? 10 : -2, 10]); -var transform3 = new Transform(v3(0), etoq([0, 225, 0]), v3(0.1)); -var ramp2 = new Texture(app, ramp_default, { uvClamp: true }); -var backdropTex = !useAlt ? new Texture(app, backdrop_default) : createWhiteTexture(app); -var backdropNormalsTex = new Texture(app, backdrop_normals_default); -var foxTex = !useAlt ? new Texture(app, fox_tex_default) : createWhiteTexture(app); -var foxNormalTex = new Texture(app, fox_normal_default); -var ambientLight = rgbToFloat(35, 76, 37); -app.onUpdate((time, app2) => { -}); -new Renderable(app, transform3, new MeshRenderer(app, fox_default, sonya(app, ambientLight).addTexture("texture0", foxTex).addTexture("texture1", foxNormalTex).addTexture("texture2", ramp2), camera, light).configure({})); -new Renderable(app, defaultTransform, new MeshRenderer(app, cube_backdrop_default, sonya(app, ambientLight).addTexture("texture0", backdropTex).addTexture("texture1", backdropNormalsTex).addTexture("texture2", ramp2), camera, light).configure({})); -app.start(); +import{a as $,b as D} from"../chunk-13ea4b456137d650.js";import{d as i,f as Y,g as R,h as q,i as Q,j as C,n as B,o as G} from"../chunk-0ef35489d83e6289.js";var x=`#version 300 es +precision highp float;uniform vec4 u_light_0_color;uniform vec4 u_albedo;uniform sampler2D u_texture_0;uniform sampler2D u_texture_1;uniform sampler2D u_texture_2;in vec2 uv0;in vec3 normal;in vec3 light_pos;out vec4 fragColor;void main(){vec3 normal=normalize(normal);float light=clamp(dot(normal,light_pos),0.0,1.0);vec3 ramp=texture(u_texture_2,vec2(light,0.0)).rgb;fragColor=vec4(1.0);fragColor.rgb=texture(u_texture_0,uv0).rgb;fragColor.rgb*=ramp;fragColor.a=1.0;}`;var K={attributes:{vertex:"a_vertex",uv0:"a_uv0",normal:"a_normal",vertexColor:"a_vertex_color"},uniforms:{view:"u_view",projection:"u_projection",objectToWorld:"u_object_to_world",objectToWorldInv:"u_object_to_world_inv",light0:"u_light_0",light0Color:"u_light_0_color",time:"u_time",albedo:"u_albedo",texture0:"u_texture_0",texture1:"u_texture_1",texture2:"u_texture_2"}},H=(c,y=[0.1,0.1,0.1,1])=>new C(K).vertex(D).fragment(x).app(c).prerenderHook(({gl:s},A)=>{s.uniform4fv(A.mappings.uniforms.albedo,y)});var J=new i({colors:null,faces:new Uint8Array([0,1,2,3,4,0,0,5,3,0,4,1,3,6,4,0,7,5]),name:"src/meshes/cube-backdrop/cube-backdrop.ply",normals:new Float32Array([0.5773503,0.5773503,0.5773503,1,0,0,0.70710677,0.70710677,0,0,0.70710677,0.70710677,0.70710677,0,0.70710677,0,1,0,0,0,1,0.70710677,0.70710677,0]),positions:new Float32Array([-0.10000001,-0.0025735903,-0.10000001,-0.10000001,0.19742644,0.10000001,-0.10000001,-0.0025735903,0.10000001,0.10000001,-0.0025735903,-0.10000001,-0.10000001,0.19742644,-0.10000001,0.10000001,-0.0025735903,0.10000001,0.10000001,0.19742644,-0.10000001,-0.10000001,-0.0025735903,0.10000001]),uvs:new Float32Array([0.5,0.5,-0.000000059604645,1,0,0.49999997,1,0.50000006,0.49999997,1,1,0,1,1,0.50000006,0]),vertexCount:8});var d=new Y(q(0),R([0,-45,0]),q(20));var X=(c,y,s,A=255)=>[c/255,y/255,s/255,A/255];var F="../ramp-aa773f5148819e95.png";var _=new i({colors:null,faces:new Uint16Array([0,1,2,0,3,4,2,3,0,5,3,2,6,7,8,8,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,1,23,24,25,26,27,28,29,30,31,27,32,18,17,33,34,35,36,37,38,39,40,13,41,42,43,44,45,46,47,15,14,48,18,32,49,26,50,33,35,51,52,53,54,54,47,14,55,48,56,11,10,57,13,58,59,40,14,13,53,47,54,60,61,62,44,63,64,6,60,65,65,7,6,66,67,54,60,68,61,38,37,69,26,49,70,67,10,12,55,71,48,72,22,23,9,68,8,68,60,6,73,17,74,75,10,67,76,26,77,1,26,76,78,47,79,0,80,81,82,50,83,84,85,86,39,13,59,87,27,29,87,20,88,29,21,87,20,89,88,90,17,16,29,72,91,40,84,86,58,92,59,21,11,19,73,87,88,27,31,2,31,5,2,52,49,53,61,68,9,93,48,94,88,93,94,51,35,95,37,96,69,33,51,41,77,52,54,67,12,77,26,1,0,76,77,12,97,49,82,46,98,99,79,53,97,23,76,72,25,50,26,0,24,26,100,37,36,52,70,49,36,101,102,64,45,44,86,66,40,11,21,91,12,72,76,82,49,50,72,11,91,75,103,89,19,89,20,32,88,94,87,21,20,79,47,53,2,1,22,22,72,29,22,29,28,27,2,28,51,95,42,50,25,83,26,70,77,0,81,24,91,21,29,23,1,76,53,49,97,77,54,67,104,105,106,52,77,70,101,36,38,4,80,0,66,54,14,62,107,60,44,46,108,41,51,42,86,109,66,57,10,75,71,16,18,55,16,71,35,110,95,32,17,73,111,3,5,40,39,84,112,75,67,72,12,11,75,89,19,75,19,57,88,89,93,74,27,73,94,48,32,19,11,57,71,18,48,40,66,14,73,88,32,113,62,61,22,28,2,35,114,110,73,27,87,115,93,89,115,89,103,116,117,118,119,120,121,122,30,74,123,124,122,125,126,127,128,129,130,131,132,133,4,132,134,135,121,136,137,112,86,138,128,139,140,141,142,143,144,145,146,147,148,122,124,30,123,136,121,56,48,93,58,13,15,121,141,140,123,121,124,30,27,74,149,150,151,152,122,74,145,153,154,120,141,121,100,36,102,155,156,153,157,151,118,152,74,17,121,135,119,144,119,145,119,144,120,158,159,160,4,159,132,100,161,162,163,98,164,138,98,45,15,165,149,166,34,33,154,153,167,153,145,155,93,115,56,154,167,164,116,168,117,150,168,116,92,157,118,136,123,169,109,112,67,3,111,160,170,171,127,132,131,34,165,150,149,148,147,172,115,85,173,158,139,159,159,4,160,149,151,157,126,125,148,45,174,129,128,133,159,156,163,167,92,58,157,175,5,142,140,31,124,144,141,120,86,85,137,8,68,6,45,98,46,34,176,35,64,176,174,176,34,177,64,174,45,64,63,176,132,34,166,162,96,100,58,149,157,125,127,171,178,179,180,181,125,171,147,182,172,126,148,172,129,128,138,130,133,128,179,178,183,177,34,131,132,166,134,159,139,128,159,133,132,160,111,175,154,143,145,137,85,115,138,45,129,35,176,114,100,102,161,100,96,37,139,98,138,164,98,158,99,98,184,98,163,184,165,47,78,160,4,3,17,90,152,167,153,156,75,112,103,142,144,143,113,107,62,151,150,116,124,31,30,142,5,140,5,31,140,125,146,148,176,63,114,139,158,98,5,175,111,164,158,160,143,164,160,15,149,58,118,151,116,112,137,103,163,164,167,175,142,143,164,143,154,175,143,160,142,141,144,121,140,124,103,137,115,80,4,134,67,66,109,109,86,112,47,165,15,181,171,170,185,186,187,188,189,190,191,192,193,191,194,192,195,196,197,198,199,200,201,199,198,202,203,204,205,201,206,207,201,205,208,185,209,210,185,208,211,185,210,212,185,211,194,189,213,194,190,189,214,215,216,192,212,217,218,219,220,221,219,218,213,192,194,198,206,201,187,209,185,217,193,192,193,222,191,193,223,222,193,224,223,193,225,224,193,226,225,193,203,226,193,204,203,218,227,221,218,199,227,218,200,199,204,215,202,204,216,215,216,219,214,216,220,219,211,217,212,228,229,85,228,85,84,230,231,84,230,84,39,232,230,39,232,39,59,233,234,90,233,90,16,235,236,55,235,55,56,237,238,173,239,240,16,239,16,55,241,232,59,241,59,92,242,241,92,231,228,84,240,233,16,243,244,122,243,122,152,245,246,119,245,119,135,247,248,136,247,136,169,246,249,119,250,251,168,234,252,152,234,152,90,244,253,122,254,255,118,253,256,123,253,123,122,257,258,145,256,259,169,256,169,123,260,261,262,248,135,136,263,237,173,263,173,85,238,264,115,238,115,173,265,254,118,265,118,117,264,235,56,264,56,115,255,242,92,255,92,118,258,266,155,258,155,145,252,243,152,259,247,169,249,257,145,249,145,119,251,265,117,251,117,168,267,268,269,270,271,272,273,274,275,276,277,278,236,239,55,229,263,85,279,280,281,282,283,284]),name:"src/meshes/fox/fox.ply",normals:new Float32Array([0.3475203,-0.1423119,-0.92681,0.5162422,0.12797521,-0.8468272,0.15832935,0.05530619,-0.98583627,-0.34248725,0.027904412,-0.9391081,-0.5169309,-0.31768712,-0.7948945,-0.48697895,-0.1626665,-0.85813236,0.979832,0.13666466,-0.14578043,0.9031805,0.21487509,-0.37160963,0.66321534,0.26724067,-0.6990907,0.6848186,0.23503296,-0.68977004,0.50283414,0.37262148,-0.779943,0.23640795,0.47815725,-0.84585875,0.3647613,0.40136182,-0.8401535,0.3046436,0.23757984,0.92236,0.31008115,0.576068,0.7563038,-0.22806334,0.32389933,0.91819185,0.17951295,-0.316014,-0.931617,-0.17395478,-0.060770363,-0.9828767,0.3371145,-0.028111659,-0.94104385,0.5286752,0.36182427,-0.76784486,0.37282482,0.34924614,-0.8596678,0.04436654,0.3120137,-0.9490411,0.1748497,-0.08175629,-0.981195,0.4760932,0.18387188,-0.8599573,0.77194935,-0.10489054,-0.6269707,0.8878576,0.018637033,-0.45974046,0.8233882,0.00536109,-0.5674533,0.50706327,0.2949509,-0.8098708,0.5776023,0.024086185,-0.8159629,0.20082258,0.4428197,-0.8738313,-0.3673268,-0.008583662,-0.9300523,-0.23037066,-0.14419852,-0.9623597,0.10130113,0.55220604,-0.82753044,-0.30028316,0.6138469,-0.7300836,-0.42857707,0.59847176,-0.67687017,0.2310956,0.77802414,-0.5841861,0.40507296,-0.59645694,-0.69293207,0.018303465,0.44150117,-0.8970739,0.77194935,-0.10489054,-0.6269707,0.6770759,-0.15234865,0.71997094,0.5551748,0.09818922,0.82591754,0.5862696,0.275684,-0.7617652,0.8878576,0.018637033,-0.45974046,0.77194935,-0.10489054,-0.6269707,0.3452935,0.52275664,0.7794215,-0.037781123,0.40868607,0.9118927,0.47639555,0.22756127,0.8492721,0.038687505,0.4890638,0.87138975,0.4779266,0.31795877,-0.8188335,0.9412043,0.3062575,0.14262189,0.985557,-0.050912835,-0.16150954,0.41709664,0.43660966,-0.79712135,0.65320575,0.7567542,-0.025403246,0.5102622,0.5121896,0.6908649,0.5327677,0.8339708,0.14370571,0.50982845,-0.2752561,-0.81505156,0.9362124,0.034893714,-0.34969804,0.49277383,0.474742,-0.729242,-0.10767815,0.15382154,0.98221403,0.53157943,-0.18795584,0.825891,0.3452935,0.52275664,0.7794215,0.73606163,0.6634644,-0.13426952,-0.17794462,0.9747583,-0.13484038,-0.38528097,0.9081675,0.1636775,0.03706524,0.8542405,0.51855505,0.90783143,0.11600388,0.40297043,0.8010637,0.5264299,0.2849009,0.6885465,0.57700217,-0.43928608,0.95855004,0.10577212,0.26456407,0.5862696,0.275684,-0.7617652,0.78829354,0.5408408,-0.2934015,0.21502984,0.04666299,-0.97549206,0.102968186,0.09595936,-0.9900452,-0.42321405,0.5065525,-0.7511954,-0.69715625,-0.08602459,-0.71173936,0.82457936,0.081235796,-0.5598835,0.4377959,0.26956058,-0.85771316,0.6155783,0.5745703,-0.5393813,0.07019434,0.24138543,0.9678872,0.3541473,0.25355586,0.9001605,-0.29064578,-0.724498,-0.62500215,0.375913,-0.73612595,-0.56285685,0.90783143,0.11600388,0.40297043,0.9031805,0.21487509,-0.37160963,0.5472127,-0.29103354,0.7847661,0.87695193,-0.2072897,0.4335738,0.8803676,0.14394727,0.45192042,0.15257555,0.7520019,-0.64125955,0.073696144,0.91218823,-0.40308988,0.48116767,0.69189876,-0.5382877,-0.38885155,-0.2292497,-0.8923223,-0.08802483,0.3184032,-0.94385976,-0.16566989,-0.31949857,0.9329921,0.4088575,0.88988423,-0.20234066,0.23401263,0.7841241,-0.5747935,0.9031805,0.21487509,-0.37160963,-0.30028316,0.6138469,-0.7300836,0.47639555,0.22756127,0.8492721,-0.13893181,0.08481444,0.98666334,0.3541473,0.25355586,0.9001605,-0.6594078,-0.34964943,-0.6655273,0.375913,-0.73612595,-0.56285685,-0.29064578,-0.724498,-0.62500215,0.7611686,0.58185023,-0.28648314,-0.04397583,0.70420456,-0.7086339,0.73606163,0.6634644,-0.13426952,0.6848186,0.23503296,-0.68977004,-0.38528097,0.9081675,0.1636775,0.90783143,0.11600388,0.40297043,0.9180944,0.3928391,0.052727237,0.6848186,0.23503296,-0.68977004,-0.75246775,0.008946161,-0.6585683,0.93610126,0.23180684,-0.26453748,-0.04397583,0.70420456,-0.7086339,-0.04397583,0.70420456,-0.7086339,0.92324126,0.38289523,0.03188642,-0.8208653,0.15153797,0.55065095,-0.6847748,0.31241915,0.6583902,-0.44955286,-0.170653,0.87680095,-0.69434595,0.69967836,-0.16832665,-0.64949834,0.59640735,-0.47164628,-0.72120667,0.6666094,-0.18839571,-0.44213012,-0.017088598,-0.8967881,-0.16689667,0.37004504,-0.9138995,-0.32365012,-0.16409263,-0.93183917,-0.81858766,0.5451293,-0.18096499,-0.992983,0.08945896,0.07734239,-0.21252948,0.5347677,0.81783545,-0.7021046,-0.14130145,0.6979133,-0.992983,0.08945896,0.07734239,-0.9546164,0.028929858,-0.2964296,-0.7311533,0.36524838,-0.5762018,-0.9617006,-0.03754102,-0.27151904,-0.9879483,0.08645398,-0.1283894,-0.78725094,-0.2752617,-0.5517852,-0.74839973,-0.49738073,-0.4387599,-0.6237263,0.711984,-0.32255915,0.9198568,0.38913035,-0.049406413,-0.44723478,0.13983466,0.883418,-0.6689012,-0.23592637,0.7049185,-0.8903412,-0.15419926,-0.42838684,-0.92482555,0.016368585,-0.3800392,-0.8165544,-0.1464694,-0.55837774,-0.87178856,-0.35990623,-0.3323434,-0.517776,0.4540006,-0.7251148,-0.8433312,0.09983585,0.52803904,-0.47634494,-0.05045076,-0.87780994,-0.7311533,0.36524838,-0.5762018,-0.6984636,-0.017294424,-0.71543664,-0.64312565,0.17802551,0.7447794,-0.66986597,-0.026210472,0.7420193,-0.90760005,0.06683492,0.41448176,-0.71550065,-0.2610496,-0.6480061,-0.48163462,-0.16273934,0.86112946,-0.9447443,-0.18422589,0.271144,-0.84864473,-0.16340141,0.5030924,-0.66986597,-0.026210472,0.7420193,-0.44133595,0.045067813,0.8962095,-0.84305483,-0.09319865,0.52969086,-0.96471584,-0.253683,0.070486,-0.90281165,-0.30579108,-0.30236223,-0.78725094,-0.2752617,-0.5517852,-0.747842,0.21194589,-0.6291353,-0.38904643,0.09032617,0.9167791,-0.8832008,-0.12243323,0.45273212,-0.38904643,0.09032617,0.9167791,-0.747842,0.21194589,-0.6291353,-0.4839415,-0.097555116,0.86964566,-0.84864473,-0.16340141,0.5030924,-0.05462312,0.1690641,-0.9840902,0.075866185,0.9794647,-0.18679745,0.02688641,0.9635681,-0.26610863,-0.9546164,0.028929858,-0.2964296,0.94705594,-0.2590572,-0.18966934,-0.21252948,0.5347677,0.81783545,-0.6675564,-0.59708816,-0.444808,0.075866185,0.9794647,-0.18679745,-0.23479536,0.67432845,-0.7001088,-0.23479536,0.67432845,-0.7001088,-0.47634494,-0.05045076,-0.87780994,-0.81858766,0.5451293,-0.18096499,-0.23479536,0.67432845,-0.7001088,-0.9879483,0.08645398,-0.1283894,-0.7311533,0.36524838,-0.5762018,0.07019434,0.24138543,0.9678872,-0.40643814,-0.8098558,-0.42301488,-0.19065972,-0.720445,-0.66678923,0.075374685,-0.7676886,-0.6363747,0.41129172,-0.60820895,-0.6789117,0.3633369,-0.6630077,-0.65452826,-0.52704555,-0.58184344,-0.6194199,-0.017521787,-0.99930537,0.032890607,-0.021521537,-0.94214505,-0.3345139,0.6121442,-0.6924734,-0.38178536,-0.70010203,-0.5537167,-0.45083794,-0.7312984,-0.6671969,-0.14160144,-0.70010203,-0.5537167,-0.45083794,-0.017521787,-0.99930537,0.032890607,0.3288468,-0.8804425,0.34158558,-0.1467376,-0.75445783,0.63973546,0.24385142,-0.7973807,0.55201495,-0.23899291,-0.84482497,0.4786994,-0.80877304,-0.50211614,0.3062115,-0.847515,-0.42922866,-0.3122198,0.5623081,-0.8260273,-0.03858204,0.04242061,-0.8742375,0.4836417,0.407,-0.7800877,0.47519907,-0.12836032,-0.80886763,0.57380897,0.16910498,-0.7943238,-0.5834837,0.12811182,-0.79456544,-0.59350926,0.40930107,-0.86440027,-0.29203552,0.48217154,-0.858188,-0.17613666,-0.57233065,-0.7097642,-0.41069746,0.22967121,-0.49633533,-0.83719915,-0.27430204,-0.8970687,0.34644783,-0.62714297,-0.48046845,0.6130593,0.5038301,-0.8556301,0.1185428,0.42636088,-0.8999785,-0.09085657,0.39348367,-0.810439,0.4340037,-0.38334632,-0.9040218,0.18918258,0.4810456,-0.8009131,0.35655776,-0.68955994,-0.7188539,0.0880689,-0.0558253,-0.9859457,0.15746342,-0.0028608302,-0.9999959,-0.000106975036,-0.011426341,-0.9991058,-0.04070532,-0.011439374,-0.9991109,-0.04057865,-0.58131546,-0.51583326,-0.6292762,-0.58025545,-0.63782334,0.5064435,0.39348367,-0.810439,0.4340037,0.4810456,-0.8009131,0.35655776,0.3288468,-0.8804425,0.34158558,0.24385142,-0.7973807,0.55201495,0.407,-0.7800877,0.47519907,0.075374685,-0.7676886,-0.6363747,-0.19065972,-0.720445,-0.66678923,0.48217154,-0.858188,-0.17613666,0.40930107,-0.86440027,-0.29203552,0.5623081,-0.8260273,-0.03858204,0.6121442,-0.6924734,-0.38178536,0.16910498,-0.7943238,-0.5834837,0.12811182,-0.79456544,-0.59350926,0.04242061,-0.8742375,0.4836417,-0.12836032,-0.80886763,0.57380897,-0.57233065,-0.7097642,-0.41069746,-0.021521537,-0.94214505,-0.3345139,-0.58131546,-0.51583326,-0.6292762,-0.847515,-0.42922866,-0.3122198,-0.52704555,-0.58184344,-0.6194199,-0.70010203,-0.5537167,-0.45083794,-0.80877304,-0.50211614,0.3062115,-0.38334632,-0.9040218,0.18918258,-0.68955994,-0.7188539,0.0880689,-0.40643814,-0.8098558,-0.42301488,0.22967121,-0.49633533,-0.83719915,-0.1467376,-0.75445783,0.63973546,-0.23899291,-0.84482497,0.4786994,0.3633369,-0.6630077,-0.65452826,-0.62714297,-0.48046845,0.6130593,-0.27430204,-0.8970687,0.34644783,0.41129172,-0.60820895,-0.6789117,-0.70010203,-0.5537167,-0.45083794,-0.7312984,-0.6671969,-0.14160144,-0.74839973,-0.49738073,-0.4387599,0.5038301,-0.8556301,0.1185428,0.42636088,-0.8999785,-0.09085657,-0.58025545,-0.63782334,0.5064435,-0.38334632,-0.9040218,0.18918258,-0.7312984,-0.6671969,-0.14160144,-0.017521787,-0.99930537,0.032890607,-0.74839973,-0.49738073,-0.4387599,-0.0028608302,-0.9999959,-0.000106975036,-0.011426341,-0.9991058,-0.04070532,-0.74839973,-0.49738073,-0.4387599,-0.017521787,-0.99930537,0.032890607,-0.0558253,-0.9859457,0.15746342,-0.74839973,-0.49738073,-0.4387599,-0.0558253,-0.9859457,0.15746342,-0.0028608302,-0.9999959,-0.000106975036,-0.74839973,-0.49738073,-0.4387599,-0.011439374,-0.9991109,-0.04057865,-0.58131546,-0.51583326,-0.6292762,-0.74839973,-0.49738073,-0.4387599,-0.011426341,-0.9991058,-0.04070532,-0.011439374,-0.9991109,-0.04057865,-0.74839973,-0.49738073,-0.4387599]),positions:new Float32Array([-0.6999253,6.443001,-0.82603,0.07097474,5.343301,-0.52663046,-0.76262593,4.472701,-1.15393,-1.7783258,5.520501,-0.86433035,-2.2427258,6.713101,-0.82603,-1.5250261,4.4763007,-0.9856301,0.29497454,9.249201,0.16336976,0.06327439,8.8725,-0.28472978,-0.035225682,9.543601,0.14946976,-0.30342564,9.674201,-0.23032992,2.4808748,3.6319008,-0.11143037,2.0297747,3.2159004,-0.4459305,1.5565743,4.603301,-0.21123049,2.1004748,3.2381003,3.2929707,1.8371744,4.748301,2.81227,0.20437472,4.420901,2.9141703,1.8253747,0.4645001,-1.7956301,0.91437465,0.9539002,-2.1209302,2.4374743,1.0497,-1.8992304,2.5767748,2.7875004,-0.6003304,1.7599748,1.8992002,-1.1086301,1.5595742,2.5219004,-1.29143,0.24357454,3.5395007,-0.67183006,0.24817431,4.333201,-0.45933002,-0.3960259,7.7391005,-1.2657304,0.05687409,8.074501,-0.67993015,-0.12432557,6.748201,-0.34603044,-0.06132584,2.9543004,-0.8707303,-0.20062563,3.4773006,-0.68853,0.43317416,2.5253003,-0.46623006,-0.4904259,2.1981003,-0.90393,-1.0552258,3.1734004,-1.06763,1.4597749,1.4790002,-2.0267305,-1.8893259,8.729101,-1.7110304,-2.2624261,9.345001,-1.37473,-0.97242594,9.702102,-0.89533013,-1.2870256,7.527001,-2.5206306,-1.5926256,8.311801,-2.8306303,-0.3960259,7.7391005,-1.2657304,2.5549746,1.4319001,2.9302707,2.773675,2.7475002,3.0280704,-0.94812554,8.5809,-1.5055304,0.05687409,8.074501,-0.67993015,-0.3960259,7.7391005,-1.2657304,-0.40532535,9.700401,0.84696966,-1.540426,8.934701,1.6871705,-0.62042546,7.995201,1.7714701,-0.15842591,5.3485007,2.2917705,3.3480747,1.1927001,-1.4741304,0.23047411,6.9421005,0.8096703,0.17777406,7.816401,-0.13533022,-0.80692565,9.159501,-1.4650301,0.73637474,6.182101,0.90636986,0.16357423,6.238301,1.5856699,2.0266747,5.562201,1.4546701,3.4768748,0.57150006,-1.4508302,4.1452746,0.9685002,-0.7070302,2.576082,3.1560004,-0.31358007,0.7198746,2.4339004,3.54267,2.288975,1.3705001,3.4610705,-0.40532535,9.700401,0.84696966,0.14267427,10.748201,0.011170197,-0.35632557,10.885501,-0.026630403,-1.0288259,10.067701,0.053869635,-1.2105256,9.758201,0.87647027,0.09657441,8.901701,0.59447026,3.0635746,4.299401,1.8075701,2.5929751,4.772801,0.5979699,0.16167451,9.942601,0.37547,-0.94812554,8.5809,-1.5055304,0.47697452,6.306901,0.39987034,3.0665743,0.73340005,-1.42483,0.6858742,3.7022007,-0.62512976,0.044074252,1.8123003,-1.5475305,-0.053825382,1.2451001,-1.5953302,3.2380748,2.4352005,-0.08572999,0.5252747,5.1989007,-0.29223025,0.8465745,5.738801,0.27866977,-0.7709256,5.724101,2.2065706,-0.619426,6.356501,1.9183702,-1.9789258,7.178801,-1.18583,-0.91182566,7.3815007,-1.4608301,0.09657441,8.901701,0.59447026,0.06327439,8.8725,-0.28472978,3.0936747,0.6671002,2.4830706,4.0453753,0.52309996,1.4920702,3.6563747,2.4587002,2.1933703,0.5219742,1.8811003,-1.0851305,1.1984742,1.6896003,-1.65813,2.625175,1.7991003,-0.6557297,0.67027444,0.5334,-1.9347303,1.2843744,3.0958004,-0.5304299,0.77727437,1.2146001,3.4750705,3.4174747,1.7396003,-0.85813,2.3443742,1.5199003,-1.5742303,0.06327439,8.8725,-0.28472978,-1.8893259,8.729101,-1.7110304,-0.62042546,7.995201,1.7714701,-1.219426,6.696401,2.0643702,-0.619426,6.356501,1.9183702,-2.161226,7.667401,-2.4847305,-0.91182566,7.3815007,-1.4608301,-1.9789258,7.178801,-1.18583,3.1734743,1.5024002,0.15137026,-0.7888257,10.067701,-0.3484299,0.14267427,10.748201,0.011170197,-0.30342564,9.674201,-0.23032992,-1.0288259,10.067701,0.053869635,0.09657441,8.901701,0.59447026,3.387675,3.7165008,1.58967,-0.30342564,9.674201,-0.23032992,-2.2445261,4.9454007,-0.66073006,3.6162753,2.8629005,0.8747697,-0.7888257,10.067701,-0.3484299,-0.7888257,10.067701,-0.3484299,4.364375,1.0550001,0.5702698,-0.61192554,1.0255002,2.04657,-1.0520257,0.52869993,2.4247699,-0.0897255,0.5721001,2.6455705,-2.517626,0.78980017,0.25796968,-1.337726,0.8835,0.28996965,-1.4268259,0.95919997,-0.43353048,-0.44272542,1.0345002,-0.70443004,-1.0315259,1.0731,-0.7273301,-1.0638257,2.0252004,-0.7415303,-3.471126,10.565201,0.1122696,-3.4521263,9.519001,0.46967015,-2.878626,9.963901,0.81987005,-2.741226,7.508901,1.3471704,-3.4521263,9.519001,0.46967015,-3.433826,9.038601,0.28866962,-2.882526,9.084501,-0.10313035,-3.3896263,8.113201,-0.3605301,-3.3058262,8.5403,0.07176972,-2.7694259,7.7350006,-1.0115304,-2.230626,0.22640002,-0.41983035,-1.868326,0.75070006,-0.9546304,3.880675,1.3958001,1.1265702,-2.327826,8.2278,1.5766702,-2.5213258,6.882601,1.3467698,-1.4618257,2.4264002,-0.6133301,-1.2621258,1.7734003,0.17966996,-1.4422258,3.0290003,0.4318703,-1.9845258,3.6388009,0.69077003,-1.890426,1.0817002,0.44496998,-2.0575259,0.9955001,0.9599702,-2.964326,9.822501,-0.10223008,-2.882526,9.084501,-0.10313035,-3.092126,9.502201,0.2502701,-0.087125406,3.1274004,2.8989704,-0.8196259,2.3198001,1.7973703,-0.8748258,2.0967002,2.7634706,0.02887421,0.7540002,-1.4195303,-1.665426,1.8197002,1.62437,-2.1923258,3.5194008,1.3925699,-1.186226,0.55610013,1.5514703,-0.8196259,2.3198001,1.7973703,-0.029425815,2.1513002,3.4381702,-2.5888262,6.208601,0.9756699,-3.112326,7.3445005,0.3178696,-2.667426,4.758001,0.018969728,-2.7694259,7.7350006,-1.0115304,-2.392026,8.487902,-1.3364304,-0.8792256,4.817401,2.3403704,-2.6100261,4.707801,1.3596704,-0.8792256,4.817401,2.3403704,-2.392026,8.487902,-1.3364304,-1.8001261,4.085301,1.9035699,-1.186226,0.55610013,1.5514703,-1.569626,0.3742001,-1.4788301,-1.9930261,9.862201,-0.003130341,-3.0411263,10.770401,0.043869786,-3.433826,9.038601,0.28866962,4.2867746,0.52519995,0.41017002,-2.878626,9.963901,0.81987005,-1.9710261,3.9114006,0.01537018,-1.9930261,9.862201,-0.003130341,-2.2901258,9.714901,-0.21963045,-2.2901258,9.714901,-0.21963045,-2.964326,9.822501,-0.10223008,-3.471126,10.565201,0.1122696,-2.2901258,9.714901,-0.21963045,-3.3058262,8.5403,0.07176972,-2.882526,9.084501,-0.10313035,-0.7709256,5.724101,2.2065706,0.58418125,0.22400019,-1.7113466,0.7487328,0.22400019,-1.869269,1.2752382,0.22400019,-1.8116388,-1.4210848,0.22400019,-1.3924581,-1.2286401,0.22400019,-1.2118917,-1.7548681,0.22400019,-1.3470285,-2.2161448,0.22400019,-0.43305972,-0.5065232,0.22400019,-0.5854172,3.6921923,0.22400019,-0.5356896,-1.9521799,0.22400019,-1.126045,-2.2274122,0.22400019,-0.4297089,-1.9521799,0.22400019,-1.126045,-2.2161448,0.22400019,-0.43305972,2.2313638,0.22400019,2.680494,-0.6810555,0.22400019,2.4642336,2.4538667,0.22400019,2.5940027,0.41850665,0.22400019,2.7519977,-2.6425998,0.22400019,0.70022744,-2.7626433,0.22400019,0.07626649,4.1131854,0.22400019,0.46040884,1.955617,0.22400019,2.7750673,2.1960154,0.22400019,2.7574801,0.7445824,0.22400019,2.9373279,2.7569857,0.22400019,-1.5163606,2.100773,0.22400019,-1.6653436,3.4797022,0.22400019,-1.0087174,3.5642383,0.22400019,-0.8515244,-0.37594378,0.22400019,-0.7854573,-1.1313287,0.22400019,-1.2045778,-1.2935071,0.22400019,1.0919343,-2.5766528,0.22400019,0.8374413,4.0127363,0.22400019,0.9127198,3.5815594,0.22400019,-0.7074967,3.4810352,0.22400019,1.8996607,-1.11559,0.22400019,1.3025575,3.8143253,0.22400019,1.5762239,-1.0991356,0.22400019,2.0397234,-2.209373,0.22400019,-0.42154086,-2.1618967,0.22400019,-0.40970844,-2.1749234,0.22400019,-0.40605244,-2.1937947,0.22400019,-0.40073627,-2.2783449,0.22400019,-0.37692034,-1.0468484,0.22400019,2.382645,3.4810352,0.22400019,1.8996607,3.8143253,0.22400019,1.5762239,2.2313638,0.22400019,2.680494,2.4538667,0.22400019,2.5940027,2.1960154,0.22400019,2.7574801,1.2752382,0.22400019,-1.8116388,0.7487328,0.22400019,-1.869269,3.5642383,0.22400019,-0.8515244,3.4797022,0.22400019,-1.0087174,4.1131854,0.22400019,0.46040884,3.6921923,0.22400019,-0.5356896,2.7569857,0.22400019,-1.5163606,2.100773,0.22400019,-1.6653436,1.955617,0.22400019,2.7750673,0.7445824,0.22400019,2.9373279,-0.37594378,0.22400019,-0.7854573,-0.5065232,0.22400019,-0.5854172,-2.2783449,0.22400019,-0.37692034,-2.7626433,0.22400019,0.07626649,-1.7548681,0.22400019,-1.3470285,-1.9521799,0.22400019,-1.126045,-2.6425998,0.22400019,0.70022744,-1.11559,0.22400019,1.3025575,-1.0991356,0.22400019,2.0397234,0.58418125,0.22400019,-1.7113466,-1.1313287,0.22400019,-1.2045778,-0.6810555,0.22400019,2.4642336,0.41850665,0.22400019,2.7519977,-1.2286401,0.22400019,-1.2118917,-2.5766528,0.22400019,0.8374413,-1.2935071,0.22400019,1.0919343,-1.4210848,0.22400019,-1.3924581,-1.9521799,0.22400019,-1.126045,-2.2274122,0.22400019,-0.4297089,-2.230626,0.22640002,-0.41983035,4.0127363,0.22400019,0.9127198,3.5815594,0.22400019,-0.7074967,-1.0468484,0.22400019,2.382645,-1.11559,0.22400019,1.3025575,-2.2274122,0.22400019,-0.4297089,-2.2161448,0.22400019,-0.43305972,-2.230626,0.22640002,-0.41983035,-2.1618967,0.22400019,-0.40970844,-2.1749234,0.22400019,-0.40605244,-2.230626,0.22640002,-0.41983035,-2.2161448,0.22400019,-0.43305972,-2.209373,0.22400019,-0.42154086,-2.230626,0.22640002,-0.41983035,-2.209373,0.22400019,-0.42154086,-2.1618967,0.22400019,-0.40970844,-2.230626,0.22640002,-0.41983035,-2.1937947,0.22400019,-0.40073627,-2.2783449,0.22400019,-0.37692034,-2.230626,0.22640002,-0.41983035,-2.1749234,0.22400019,-0.40605244,-2.1937947,0.22400019,-0.40073627,-2.230626,0.22640002,-0.41983035]),uvs:new Float32Array([0.21851481,0.38709354,0.25122124,0.29925498,0.33613995,0.31277353,0.31780326,0.41546077,0.26634175,0.49754715,0.36926088,0.35428312,0.8862014,0.7660378,0.96414614,0.65773886,0.9142767,0.82184976,0.96414614,0.8656495,0.24378048,0.15517116,0.27324826,0.1538348,0.24071635,0.21034758,0.12782207,0.13377228,0.13686845,0.17050092,0.097095504,0.18026535,0.3456612,0.015984222,0.38372317,0.05219409,0.3173124,0.03967564,0.2669188,0.12665303,0.3150151,0.10144508,0.312529,0.12937495,0.32927862,0.22344446,0.2904697,0.2528519,0.13747068,0.42125323,0.1110152,0.38961607,0.17645767,0.34971166,0.37940347,0.20685007,0.3529383,0.23464157,0.35064337,0.17517665,0.43924242,0.18647039,0.41530237,0.2674248,0.34998143,0.06725915,0.12322961,0.6801839,0.1720783,0.6964544,0.16144735,0.7933706,0.8861246,0.52512723,0.84557533,0.5134298,0.9878913,0.42880467,0.12832226,0.086800925,0.14096868,0.11748978,0.074313566,0.7435197,0.020883663,0.84153533,0.00000001081579,0.77996564,0.32931674,0.8416559,0.35599756,0.7471563,0.4352468,0.76457715,0.09890157,0.21372627,0.28071728,0.038383927,0.12732372,0.2965882,0.11473294,0.36185902,0.110673696,0.76611084,0.1568792,0.258202,0.11916661,0.24799357,0.1670033,0.20147358,0.27564877,0.017370421,0.24627076,0.033188876,0.25064924,0.13463129,0.09065693,0.12818988,0.11538713,0.09199737,0.8276462,0.8879465,0.8977165,0.9073449,0.8979689,0.9335955,0.24703515,0.8216678,0.30523577,0.7905776,0.8020745,0.7431329,0.17493051,0.15400115,0.20319703,0.1803566,0.89068747,0.8602873,0.8669603,0.42128757,0.1696568,0.2862294,0.29085746,0.022808408,0.30401754,0.21331184,0.4063384,0.124203816,0.4319168,0.09517003,0.24068871,0.10983848,0.2422915,0.26877972,0.19642983,0.2589539,0.084621415,0.22762483,0.08997824,0.2432744,0.21659407,0.49825695,0.16409814,0.4431432,0.06007273,0.3584054,0.077401064,0.3881148,0.13976377,0.06055675,0.1772671,0.045047924,0.1689892,0.10318307,0.36747235,0.13334484,0.35129,0.09048066,0.27406374,0.088201545,0.40481266,0.033736143,0.3024185,0.17043002,0.080950305,0.101946086,0.26399732,0.060749806,0.3123137,0.06264582,0.08229262,0.8732247,0.78262734,0.48695683,0.054573745,0.28939876,0.4784059,0.67288846,0.52534187,0.6902852,0.843693,0.54919225,0.967211,0.5381632,0.8863765,0.6507956,0.23814057,0.07682296,0.52430856,0.78790325,0.5076637,0.9781552,0.42495766,0.8044593,0.88358545,0.94791806,0.39027283,0.865766,0.18311635,0.13782379,0.15227878,0.86758876,0.37036988,0.41615537,0.20584682,0.11498356,0.935007,0.9301176,0.19761893,0.83779246,0.20950294,0.045586396,0.0322884,0.11481223,0.02451134,0.09802288,0.048454616,0.09665558,0.6460075,0.21836895,0.5963892,0.2274105,0.5771463,0.1884031,0.5055221,0.114784405,0.5447714,0.15467297,0.48357084,0.21026236,0.75558704,0.9432239,0.8020744,0.9034289,0.7897775,0.96688294,0.36300594,0.6462114,0.27383736,0.69182056,0.27248618,0.6792056,0.2478923,0.6867268,0.25436208,0.6271816,0.26854706,0.6570603,0.2133645,0.5806204,0.637635,0.17406993,0.60493344,0.1558058,0.19796096,0.06852602,0.35857934,0.69122976,0.3951752,0.6194137,0.48257515,0.25476277,0.5577472,0.2591085,0.5101766,0.3366432,0.50301826,0.39985734,0.6224612,0.2508355,0.65923995,0.27131322,0.7339221,0.92058545,0.667627,0.84930974,0.75460386,0.8875665,0.07549074,0.15373975,0.036297202,0.14856292,0.053295545,0.13493255,0.45089763,0.06624607,0.65852106,0.35673973,0.5478699,0.43424743,0.734133,0.3012958,0.69251174,0.422131,0.07396352,0.1281145,0.4061021,0.5678618,0.31435022,0.5997315,0.4114268,0.44731957,0.75763285,0.6744133,0.734765,0.56230044,0.5902533,0.5873184,0.48538992,0.4962032,0.07417127,0.20548928,0.16459617,0.6398786,0.5627961,0.49731115,0.010203981,0.1122183,0.61384606,0.11812159,0.7293909,0.98951745,0.753717,0.961225,0.8020744,0.78846765,0.20760685,0.029241929,0.27992412,0.7168905,0.45012152,0.3856737,0.2468168,0.7547342,0.23586477,0.728986,0.52842814,0.74081594,0.58254737,0.8386313,0.5380133,0.9808106,0.69757915,0.9635888,0.70988774,0.65773886,0.6677008,0.75300074,0.5507923,0.6433447,0.9718312,0.020504208,0.97220457,0.021100836,0.9716987,0.022655101,0.9721315,0.014245303,0.9714647,0.014712902,0.97220457,0.013208317,0.96973413,0.01123883,0.96911705,0.01649964,0.96632093,0.029152708,0.9716613,0.012472974,0.80359983,1.0238159,0.80359983,0.95338476,0.8044696,1.023133,0.95752156,0.022717984,0.96000504,0.01405433,0.95764303,0.02344461,0.95844465,0.017195703,0.9665674,0.0092362035,0.96852803,0.009265589,0.9630468,0.029798763,0.9574091,0.02182542,0.95731115,0.022562819,0.9576798,0.018064456,0.9698729,0.026945414,0.9707365,0.02505687,0.9678838,0.028808849,0.96735567,0.028965177,0.9696391,0.017020183,0.9713813,0.015002267,0.96453613,0.013066204,0.96611136,0.009349244,0.9617433,0.029211031,0.96690965,0.028926747,0.9590955,0.02698438,0.963788,0.013471412,0.95986325,0.028194623,0.96155035,0.013057904,0.9696951,0.011252033,0.9696294,0.011387991,0.96961904,0.011344941,0.9696118,0.01128404,0.969593,0.011013629,0.9604814,0.013000401,0.15420465,0.04102335,0.16792865,0.037144165,0.110636964,0.05624038,0.117879316,0.05280347,0.1069449,0.059347447,0.37604672,0.008110086,0.4070614,0.013023422,0.25538462,0.0031148791,0.2648711,0.000000008450675,0.20259783,0.019268692,0.23897217,0.0057812533,0.3031835,0.0016587148,0.3331248,0.0026185757,0.09809749,0.06282124,0.068156235,0.07761529,0.52157223,0.044851843,0.5435285,0.046751596,0.63853747,0.17621852,0.66334546,0.19258852,0.62489164,0.1247898,0.6287393,0.14086775,0.68118423,0.21481499,-0.0000000033102134,0.10996528,0.013690739,0.09781893,0.42186216,0.014245739,0.6017828,0.094806425,0.030619193,0.091465615,0.057839744,0.08235605,0.59865737,0.10087764,0.67908764,0.21657859,0.7325371,0.2680749,0.614245,0.10814548,0.43263742,0.92657316,0.43597075,0.8869815,0.43614823,0.88644433,0.18772343,0.02667462,0.24657853,0.0037103465,0.021488441,0.09233946,0.7439689,0.2791134,0.67494655,0.99038863,0.67444944,0.9913764,0.67444944,0.98951757,0.80714715,0.95338464,0.8076674,0.95454615,0.80714715,0.9599234,0.67331666,0.9900621,0.6744493,0.98951745,0.67444944,0.99153584,0.80814487,0.9553456,0.8076674,0.95992327,0.8076674,0.9533845,0.8044694,0.9616473,0.8044694,0.95338464,0.807147,0.9587995,0.67240256,0.98951757,0.6733167,0.9911193,0.67240256,0.9949199]),vertexCount:285});var b="../fox-tex-03f042508a92e722.png";var a="../fox-normal-7ce4a77b1285eb7a.png";var f="../backdrop-0e5863d39a0305cf.png";var O="../backdrop-normals-6ba4b06676f112b6.png";var N="../white-532695823c58790a.png";var E=(c)=>new $(c,N);var g=location.search.includes("alt1"),I=new G({fov:45}),L=new Y([0,2,4],R([-15,0,0])),e=new Y([10,!g?10:-2,10]),u=new Y(q(0),R([0,225,0]),q(0.1)),V=new $(I,F,{uvClamp:!0}),r=!g?new $(I,f):E(I),M=new $(I,O),U=!g?new $(I,b):E(I),n=new $(I,a),h=X(35,76,37);I.onUpdate((c,y)=>{});new B(I,u,new Q(I,_,H(I,h).addTexture("texture0",U).addTexture("texture1",n).addTexture("texture2",V),L,e).configure({}));new B(I,d,new Q(I,J,H(I,h).addTexture("texture0",r).addTexture("texture1",M).addTexture("texture2",V),L,e).configure({}));I.start(); diff --git a/html/005-thoughtform-hidenoe/main.js b/html/005-thoughtform-hidenoe/main.js index 7185c5b..aa2cf84 100644 --- a/html/005-thoughtform-hidenoe/main.js +++ b/html/005-thoughtform-hidenoe/main.js @@ -1,333 +1,6 @@ -import { -plane_default -} from "../chunk-a6d990db9d9ec9c3.js"; -import { -MeshRenderer, -Renderable, -Shader, -Transform, -WebGLApp, -basic_default1 as basic_default, -etoq, -v3 -} from "../chunk-652b721da622b7d9.js"; - -// src/005-thoughtform-hidenoe/shaders/outer.frag -var outer_default = `#version 300 es -precision highp float; - -uniform float u_time; - -in vec2 uv0; - -out vec4 fragColor; - -vec2 squareImaginary(vec2 number, float mod){ - return vec2( - pow(number.x * mod,2.0) - pow(number.y * mod, 2.0), - 2.0 * number.x * number.y - ); -} - -float iterateMandelbrot(vec2 coord){ - vec2 z = vec2(0,0); - float maxIterations = 100.0; - - for (float i = 0.0; i < maxIterations; i++) { - float factor = 2.6 + (1.3 * sin(u_time * 0.0001)); - z = squareImaginary(z, factor + 1.0) + (coord / factor); - if (length(z) > 2.0) return i / float(maxIterations); - } - - return maxIterations; -} - -void main() { - // uv0 is 0..1, we want to denormalize this to -1..1 - vec2 uvMirror = abs(uv0 * 2.0 - 1.0); - fragColor = vec4(0.0); - float mandelbrot = iterateMandelbrot((uvMirror.xy + vec2(0.14, -0.525)) * 0.9); - fragColor.r = mandelbrot; - - vec2 outerNoise = (mandelbrot) * (1.0 - uvMirror * 0.5); - fragColor.gb += (1.0 - mandelbrot) * outerNoise; - - fragColor.r += pow(1.0 - length(uvMirror), 8.0); - - fragColor.a = 1.0; -} -`; - -// src/005-thoughtform-hidenoe/shaders/outer-alt3.frag -var outer_alt3_default = `#version 300 es -precision highp float; - -uniform float u_time; - -in vec2 uv0; - -out vec4 fragColor; - -vec2 squareImaginary(vec2 number, float mod){ - return vec2( - pow(number.x * mod,2.0) - pow(number.y * mod, 2.0), - 2.0 * number.x * number.y - ); -} - -float iterateMandelbrot(vec2 coord){ - vec2 z = vec2(0,0); - float maxIterations = 69.0; - - for (float i = 0.0; i < maxIterations; i++) { - // float factor = cos((1.3*6.0) * sin(u_time * 0.0005)); - float mod = u_time * 0.0003; - // mod = 0.5; - z = squareImaginary(z, 1.0/mod) + coord; - if (length(z) > 100.0) return i / float(maxIterations); - } - - return maxIterations; -} - -void main() { - // uv0 is 0..1, we want to denormalize this to -1..1 - vec2 uvMirror = abs(uv0 * 2.0 - 1.0); - fragColor = vec4(0.0); - float mandelbrot = iterateMandelbrot((uvMirror.yx - vec2(-1.075, 1.0)) * 0.9); - fragColor.r = mandelbrot; - - vec2 outerNoise = (mandelbrot) * (1.0 - uvMirror * 0.5); - fragColor.gb += (1.0 - mandelbrot) * outerNoise; - - // fragColor.r += pow(1.0 - length(uvMirror), 18.0); - - fragColor.a = 1.0; -} -`; - -// src/005-thoughtform-hidenoe/shaders/outer.ts -var basicShaderConfig = { - attributes: { - vertex: "a_vertex", - uv0: "a_uv0", - normal: "a_normal", - vertexColor: "a_vertex_color" - }, - uniforms: { - view: "u_view", - projection: "u_projection", - objectToWorld: "u_object_to_world", - objectToWorldInv: "u_object_to_world_inv", - light0: "u_light_0", - light0Color: "u_light_0_color", - time: "u_time", - albedo: "u_albedo", - texture0: "u_texture_0", - texture1: "u_texture_1", - texture2: "u_texture_2" - } -}; -var outerFrags = { - normal: outer_default, - alt3: outer_alt3_default -}; -var outer2 = (app, fragShader = outer_default) => new Shader(basicShaderConfig).vertex(basic_default).fragment(fragShader).app(app); - -// src/005-thoughtform-hidenoe/shaders/noe.frag -var noe_default = `#version 300 es -precision highp float; - -// uniform mat4 u_view; -// uniform mat4 u_projection; -// uniform mat4 u_object_to_world; -// uniform mat4 u_object_to_world_inv; -// uniform vec3 u_light_0; -// uniform vec4 u_light_0_color; -uniform float u_time; -// uniform vec4 u_albedo; - -in vec2 uv0; -in vec3 light_pos; - -out vec4 fragColor; - -const float margin = 0.5; - -vec3 hsv2rgb(vec3 c) { - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} - -void main() { - // 0..1 to -1..1 - vec2 cUV = uv0 * 2.0 - 1.0; - float circleDistance = length(cUV); - if (circleDistance > margin) { - discard; - } - - float theta = atan(cUV.y, cUV.x) ; - float spiral = sin(100.0 * (sqrt(circleDistance*20.0) - 10.0 * theta - 0.01 * u_time * 0.001)); - - float edgeLightZone = pow(clamp(abs(dot(cUV.xyx, light_pos)), 0.0, 1.0) * 2.0, 4.0); - - float colorSpiral = sin(100.0 * (sqrt(circleDistance * 10.0) - 0.001 * theta - 0.3 * u_time * 0.00005)); - vec3 hueRotation = hsv2rgb(vec3(colorSpiral, 1.0, 0.5)); - - fragColor = vec4(hueRotation * spiral * edgeLightZone, 1.0); - fragColor.rgb += min(spiral, 0.0041666); -}`; - -// src/005-thoughtform-hidenoe/shaders/noe-debug.frag -var noe_debug_default = `#version 300 es -precision highp float; - -// uniform mat4 u_view; -// uniform mat4 u_projection; -// uniform mat4 u_object_to_world; -// uniform mat4 u_object_to_world_inv; -// uniform vec3 u_light_0; -// uniform vec4 u_light_0_color; -uniform float u_time; -// uniform vec4 u_albedo; - -in vec2 uv0; -in vec3 light_pos; - -out vec4 fragColor; - -const float margin = 0.5; - -vec3 hsv2rgb(vec3 c) { - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} - -void main() { - // 0..1 to -1..1 - vec2 cUV = uv0 * 2.0 - 1.0; - float circleDistance = length(cUV); - if (circleDistance > margin) { - discard; - } - - float theta = atan(cUV.y, cUV.x) ; - float spiral = sin(100.0 * (sqrt(circleDistance*20.0) - 10.0 * theta - 0.01 * u_time * 0.001)); - - float edgeLightZone = pow(clamp(abs(dot(cUV.xyx, light_pos)), 0.0, 1.0) * 2.0, 4.0); - - float colorSpiral = sin(100.0 * (sqrt(circleDistance * 10.0) - 0.001 * theta - 0.3 * u_time * 0.00005)); - vec3 hueRotation = hsv2rgb(vec3(colorSpiral, 1.0, 0.5)); - - fragColor = vec4(colorSpiral, spiral, 1.0, 1.0); -}`; - -// src/005-thoughtform-hidenoe/shaders/noe-alt2.frag -var noe_alt2_default = `#version 300 es -precision highp float; - -// uniform mat4 u_view; -// uniform mat4 u_projection; -// uniform mat4 u_object_to_world; -// uniform mat4 u_object_to_world_inv; -// uniform vec3 u_light_0; -// uniform vec4 u_light_0_color; -uniform float u_time; -// uniform vec4 u_albedo; - -in vec2 uv0; -in vec3 light_pos; - -out vec4 fragColor; - -const float margin = 0.9; - -vec3 hsv2rgb(vec3 c) { - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} - -void main() { - // 0..1 to -1..1 - vec2 cUV = uv0 * 2.0 - 1.0; - float circleDistance = length(cUV); - if (circleDistance > margin) { - discard; - } - - float theta = atan(cUV.y, cUV.x) ; - float spiral = sin(100.0 * (sqrt(circleDistance*13.0) - (u_time * 0.0001) * theta - 0.01 * u_time * 0.001)); - - // float edgeLightZone = pow(clamp(abs(dot(cUV.xyx, light_pos)), 0.0, 1.0) * 2.0, 4.0); - - float colorSpiral = sin(100.0 * (sqrt(circleDistance * 10.0) - 0.001 * theta - 0.3 * u_time * 0.00005)); - // vec3 hueRotation = hsv2rgb(vec3(colorSpiral, 1.0, 0.5)); - - fragColor = vec4(0, spiral, 0, 1.0); -}`; - -// src/005-thoughtform-hidenoe/shaders/noe.ts -var basicShaderConfig2 = { - attributes: { - vertex: "a_vertex", - uv0: "a_uv0", - normal: "a_normal", - vertexColor: "a_vertex_color" - }, - uniforms: { - view: "u_view", - projection: "u_projection", - objectToWorld: "u_object_to_world", - objectToWorldInv: "u_object_to_world_inv", - light0: "u_light_0", - light0Color: "u_light_0_color", - time: "u_time", - albedo: "u_albedo", - texture0: "u_texture_0", - texture1: "u_texture_1", - texture2: "u_texture_2" - } -}; -var frags = { - normal: noe_default, - debug: noe_debug_default, - alt2: noe_alt2_default -}; -var noe2 = (app, fragShader = noe_default) => new Shader(basicShaderConfig2).vertex(basic_default).fragment(fragShader).app(app); - -// src/005-thoughtform-hidenoe/main.ts -var app = new WebGLApp({ fov: 45 }); -var camera = new Transform([0, 0, 2], etoq([0, 0, 0])); -var light = new Transform([1, -1, 0], etoq([0, 0, 0])); -var transformPlane = new Transform(v3(0), etoq([0, 180, 0]), v3(1.8)); -var transformSphere = new Transform(v3(0), etoq([0, 180, 180]), v3(0.6)); -document.body.addEventListener("mousemove", (event) => { - const { clientX, clientY } = event; - const { clientWidth, clientHeight } = document.body; - const screenX = clientX / clientWidth; - const screenY = clientY / clientHeight; - const centeredX = screenX * 2 - 1; - const centeredY = screenY * 2 - 1; - light.position[1] = centeredX; - light.position[0] = centeredY; -}); -app.onUpdate((time, app2) => { -}); -var noeShader = frags.normal; -var hShader = outerFrags.normal; -if (location.search.includes("alt1")) { - noeShader = frags.debug; -} -if (location.search.includes("alt2")) { - noeShader = frags.alt2; -} -if (location.search.includes("alt3")) { - hShader = outerFrags.alt3; -} -new Renderable(app, transformPlane, new MeshRenderer(app, plane_default, outer2(app, hShader), camera).configure({})); -new Renderable(app, transformSphere, new MeshRenderer(app, plane_default, noe2(app, noeShader), camera, light).configure({})); -app.start(); +import{c as N} from"../chunk-d24458ad0a4be457.js";import{f as D,g as I,h as j,i as O,j as k,l as y,n as Q,o as z} from"../chunk-0ef35489d83e6289.js";var C=`#version 300 es +precision highp float;uniform float u_time;in vec2 uv0;out vec4 fragColor;vec2 squareImaginary(vec2 number,float mod){return vec2(pow(number.x*mod,2.0)-pow(number.y*mod,2.0),2.0*number.x*number.y);}float iterateMandelbrot(vec2 coord){vec2 z=vec2(0,0);float maxIterations=100.0;for(float i=0.0;i2.0)return i/float(maxIterations);}return maxIterations;}void main(){vec2 uvMirror=abs(uv0*2.0-1.0);fragColor=vec4(0.0);float mandelbrot=iterateMandelbrot((uvMirror.xy+vec2(0.14,-0.525))*0.9);fragColor.r=mandelbrot;vec2 outerNoise=(mandelbrot)*(1.0-uvMirror*0.5);fragColor.gb+=(1.0-mandelbrot)*outerNoise;fragColor.r+=pow(1.0-length(uvMirror),8.0);fragColor.a=1.0;}`;var V=`#version 300 es +precision highp float;uniform float u_time;in vec2 uv0;out vec4 fragColor;vec2 squareImaginary(vec2 number,float mod){return vec2(pow(number.x*mod,2.0)-pow(number.y*mod,2.0),2.0*number.x*number.y);}float iterateMandelbrot(vec2 coord){vec2 z=vec2(0,0);float maxIterations=69.0;for(float i=0.0;i100.0)return i/float(maxIterations);}return maxIterations;}void main(){vec2 uvMirror=abs(uv0*2.0-1.0);fragColor=vec4(0.0);float mandelbrot=iterateMandelbrot((uvMirror.yx-vec2(-1.075,1.0))*0.9);fragColor.r=mandelbrot;vec2 outerNoise=(mandelbrot)*(1.0-uvMirror*0.5);fragColor.gb+=(1.0-mandelbrot)*outerNoise;fragColor.a=1.0;}`;var R={attributes:{vertex:"a_vertex",uv0:"a_uv0",normal:"a_normal",vertexColor:"a_vertex_color"},uniforms:{view:"u_view",projection:"u_projection",objectToWorld:"u_object_to_world",objectToWorldInv:"u_object_to_world_inv",light0:"u_light_0",light0Color:"u_light_0_color",time:"u_time",albedo:"u_albedo",texture0:"u_texture_0",texture1:"u_texture_1",texture2:"u_texture_2"}},E={normal:C,alt3:V},Z=(_,x=C)=>new k(R).vertex(y).fragment(x).app(_);var J=`#version 300 es +precision highp float;uniform float u_time;in vec2 uv0;in vec3 light_pos;out vec4 fragColor;const float margin=0.5;vec3 hsv2rgb(vec3 c){vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(c.xxx+K.xyz)*6.0-K.www);return c.z*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),c.y);}void main(){vec2 cUV=uv0*2.0-1.0;float circleDistance=length(cUV);if(circleDistance>margin){discard;}float theta=atan(cUV.y,cUV.x);float spiral=sin(100.0*(sqrt(circleDistance*20.0)-10.0*theta-0.01*u_time*0.001));float edgeLightZone=pow(clamp(abs(dot(cUV.xyx,light_pos)),0.0,1.0)*2.0,4.0);float colorSpiral=sin(100.0*(sqrt(circleDistance*10.0)-0.001*theta-0.3*u_time*0.00005));vec3 hueRotation=hsv2rgb(vec3(colorSpiral,1.0,0.5));fragColor=vec4(hueRotation*spiral*edgeLightZone,1.0);fragColor.rgb+=min(spiral,0.0041666);}`;var $=`#version 300 es +precision highp float;uniform float u_time;in vec2 uv0;in vec3 light_pos;out vec4 fragColor;const float margin=0.5;vec3 hsv2rgb(vec3 c){vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(c.xxx+K.xyz)*6.0-K.www);return c.z*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),c.y);}void main(){vec2 cUV=uv0*2.0-1.0;float circleDistance=length(cUV);if(circleDistance>margin){discard;}float theta=atan(cUV.y,cUV.x);float spiral=sin(100.0*(sqrt(circleDistance*20.0)-10.0*theta-0.01*u_time*0.001));float edgeLightZone=pow(clamp(abs(dot(cUV.xyx,light_pos)),0.0,1.0)*2.0,4.0);float colorSpiral=sin(100.0*(sqrt(circleDistance*10.0)-0.001*theta-0.3*u_time*0.00005));vec3 hueRotation=hsv2rgb(vec3(colorSpiral,1.0,0.5));fragColor=vec4(colorSpiral,spiral,1.0,1.0);}`;var q=`#version 300 es +precision highp float;uniform float u_time;in vec2 uv0;in vec3 light_pos;out vec4 fragColor;const float margin=0.9;vec3 hsv2rgb(vec3 c){vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(c.xxx+K.xyz)*6.0-K.www);return c.z*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),c.y);}void main(){vec2 cUV=uv0*2.0-1.0;float circleDistance=length(cUV);if(circleDistance>margin){discard;}float theta=atan(cUV.y,cUV.x);float spiral=sin(100.0*(sqrt(circleDistance*13.0)-(u_time*0.0001)*theta-0.01*u_time*0.001));float colorSpiral=sin(100.0*(sqrt(circleDistance*10.0)-0.001*theta-0.3*u_time*0.00005));fragColor=vec4(0,spiral,0,1.0);}`;var v={attributes:{vertex:"a_vertex",uv0:"a_uv0",normal:"a_normal",vertexColor:"a_vertex_color"},uniforms:{view:"u_view",projection:"u_projection",objectToWorld:"u_object_to_world",objectToWorldInv:"u_object_to_world_inv",light0:"u_light_0",light0Color:"u_light_0_color",time:"u_time",albedo:"u_albedo",texture0:"u_texture_0",texture1:"u_texture_1",texture2:"u_texture_2"}},B={normal:J,debug:$,alt2:q},w=(_,x=J)=>new k(v).vertex(y).fragment(x).app(_);var i=new z({fov:45}),G=new D([0,0,2],I([0,0,0])),K=new D([1,-1,0],I([0,0,0])),b=new D(j(0),I([0,180,0]),j(1.8)),m=new D(j(0),I([0,180,180]),j(0.6));document.body.addEventListener("mousemove",(_)=>{const{clientX:x,clientY:L}=_,{clientWidth:M,clientHeight:P}=document.body,c=x/M,F=L/P,W=c*2-1,A=F*2-1;K.position[1]=W,K.position[0]=A});i.onUpdate((_,x)=>{});var U=B.normal,H=E.normal;if(location.search.includes("alt1"))U=B.debug;if(location.search.includes("alt2"))U=B.alt2;if(location.search.includes("alt3"))H=E.alt3;new Q(i,b,new O(i,N,Z(i,H),G).configure({}));new Q(i,m,new O(i,N,w(i,U),G,K).configure({}));i.start(); diff --git a/html/006-the-edge/main.js b/html/006-the-edge/main.js index 0175d0b..1f4f49d 100644 --- a/html/006-the-edge/main.js +++ b/html/006-the-edge/main.js @@ -1,199 +1,2 @@ -import { -plane_default -} from "../chunk-a6d990db9d9ec9c3.js"; -import { -MeshRenderer, -Renderable, -Shader, -Transform, -WebGLApp, -basic_default1 as basic_default, -etoq, -v3 -} from "../chunk-652b721da622b7d9.js"; - -// src/006-the-edge/shaders/rail.frag -var rail_default = `#version 300 es -precision highp float; - -uniform float u_time; - -in vec2 uv0; - -out vec4 fragColor; - -const float railWidth = 0.041666; -const float railWiggle = 0.0015; - -vec3 mod289(vec3 x) { - return x - floor(x * (1.0 / 289.0)) * 289.0; -} - -vec4 mod289(vec4 x) { - return x - floor(x * (1.0 / 289.0)) * 289.0; -} - -vec4 permute(vec4 x) { - return mod289(((x*34.0)+1.0)*x); -} - -vec4 taylorInvSqrt(vec4 r) -{ - return 1.79284291400159 - 0.85373472095314 * r; -} - -float snoise(vec3 v) { - const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; - const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); - - // First corner - vec3 i = floor(v + dot(v, C.yyy) ); - vec3 x0 = v - i + dot(i, C.xxx) ; - - // Other corners - vec3 g = step(x0.yzx, x0.xyz); - vec3 l = 1.0 - g; - vec3 i1 = min( g.xyz, l.zxy ); - vec3 i2 = max( g.xyz, l.zxy ); - - // x0 = x0 - 0.0 + 0.0 * C.xxx; - // x1 = x0 - i1 + 1.0 * C.xxx; - // x2 = x0 - i2 + 2.0 * C.xxx; - // x3 = x0 - 1.0 + 3.0 * C.xxx; - vec3 x1 = x0 - i1 + C.xxx; - vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y - vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y - - // Permutations - i = mod289(i); - vec4 p = permute( permute( permute( - i.z + vec4(0.0, i1.z, i2.z, 1.0 )) - + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) - + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); - - // Gradients: 7x7 points over a square, mapped onto an octahedron. - // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) - const float n_ = 0.142857142857; // 1.0/7.0 - vec3 ns = n_ * D.wyz - D.xzx; - - vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7) - - vec4 x_ = floor(j * ns.z); - vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) - - vec4 x = x_ *ns.x + ns.yyyy; - vec4 y = y_ *ns.x + ns.yyyy; - vec4 h = 1.0 - abs(x) - abs(y); - - vec4 b0 = vec4( x.xy, y.xy ); - vec4 b1 = vec4( x.zw, y.zw ); - - //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0; - //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0; - vec4 s0 = floor(b0)*2.0 + 1.0; - vec4 s1 = floor(b1)*2.0 + 1.0; - vec4 sh = -step(h, vec4(0, 0, 0, 0)); - - vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; - vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; - - vec3 p0 = vec3(a0.xy,h.x); - vec3 p1 = vec3(a0.zw,h.y); - vec3 p2 = vec3(a1.xy,h.z); - vec3 p3 = vec3(a1.zw,h.w); - - //Normalise gradients - vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); - p0 *= norm.x; - p1 *= norm.y; - p2 *= norm.z; - p3 *= norm.w; - - // Mix final noise value - vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); - m = m * m; - return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), - dot(p2,x2), dot(p3,x3) ) ); -} - -void main() { - vec2 cUV = uv0 * 2.0 - 1.0; - float sintime = sin(u_time * 0.0001); - - // wiggle - float vY = cos(uv0.y * sintime); - float vX = sin(uv0.x * sintime * 10000.0); - float vibes = railWiggle * snoise(vec3(vY, vX, u_time)); - - // smoothly calculate the wiggle - float rail = 1.0 - step(abs(pow(abs(cUV.y) - railWidth + vibes, 30.0)), 1.0); - - // snip out wrapping - // if (abs(cUV.y) > railWidth * 2.0) { - // discard; - // } - - vec4 railColor = vec4(rail); - - // albedo (staticy colorful <333) - float noise = abs(sin(snoise(uv0.xxy * 10000. * u_time))); - float noise2 = abs(sin(snoise(uv0.yxy * 10000.* u_time))); - float noise3 = abs(sin(snoise(uv0.xyx * 10000. * u_time))); - railColor.rgb -= (vec3(noise, noise2, noise3) * 0.3); - - // simplex noise based on 3 moire spirals - float theta = atan(cUV.y, uv0.x); - float spiral = sin(10.0 * (sqrt(19.0 + (15.0 * sintime * 0.05))) - 1000.0 * theta - 0.01 * u_time * 0.0001); - - float theta2 = atan(1.0-(cUV.y / 1000.0), uv0.x - (railWidth / 20.)); - float spiral2 = sin(10.0 * (sqrt(20.0 + u_time * 0.00001) - 10000.0 * theta2 - 0.01 * u_time * 0.0001)); - - float theta3 = atan(1.0 - uv0.y/10.0, uv0.x); - float spiral3 = sin(100.0 * (sqrt(100.0 + uv0.y) - 100000.0 * theta3 - 0.01 * sintime * 0.0001)); - - float sparkleNoise = snoise(vec3(spiral, spiral2, u_time * 0.00001)); - fragColor.r = step(abs(spiral2 * spiral * sparkleNoise), mix(0.0333, 0.0666, abs(uv0.y + sin(u_time * 0.00001)))); - fragColor.r *= pow(1.0 - abs(cUV.y), 3.0) * abs(spiral3); - fragColor.r *= 10.0; - - if (cUV.y > 0.0) { - fragColor.r = 0.0; - } - - // fragColor.g = spiral3; - - // keep within 0-1 - fragColor = clamp(vec4(fragColor + railColor), vec4(0), vec4(1)); -} -`; - -// src/006-the-edge/shaders/rail.ts -var basicShaderConfig = { - attributes: { - vertex: "a_vertex", - uv0: "a_uv0", - normal: "a_normal", - vertexColor: "a_vertex_color" - }, - uniforms: { - view: "u_view", - projection: "u_projection", - objectToWorld: "u_object_to_world", - objectToWorldInv: "u_object_to_world_inv", - light0: "u_light_0", - light0Color: "u_light_0_color", - time: "u_time", - albedo: "u_albedo", - texture0: "u_texture_0", - texture1: "u_texture_1", - texture2: "u_texture_2" - } -}; -var rail2 = (app, fragShader = rail_default) => new Shader(basicShaderConfig).vertex(basic_default).fragment(fragShader).app(app); - -// src/006-the-edge/main.ts -var app = new WebGLApp({ fov: 45 }); -var camera = new Transform([0, 0, 2], etoq([0, 0, 0])); -var transformRail = new Transform(v3(0), etoq(v3(0)), [1000, 1, 1]); -new Renderable(app, transformRail, new MeshRenderer(app, plane_default, rail2(app), camera).configure({})); -app.start(); +import{c as E} from"../chunk-d24458ad0a4be457.js";import{f as j,g as k,h as z,i as F,j as y,l as B,n as H,o as I} from"../chunk-0ef35489d83e6289.js";var t=`#version 300 es +precision highp float;uniform float u_time;in vec2 uv0;out vec4 fragColor;const float railWidth=0.041666;const float railWiggle=0.0015;vec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float snoise(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));const float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0,0,0,0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}void main(){vec2 cUV=uv0*2.0-1.0;float sintime=sin(u_time*0.0001);float vY=cos(uv0.y*sintime);float vX=sin(uv0.x*sintime*10000.0);float vibes=railWiggle*snoise(vec3(vY,vX,u_time));float rail=1.0-step(abs(pow(abs(cUV.y)-railWidth+vibes,30.0)),1.0);vec4 railColor=vec4(rail);float noise=abs(sin(snoise(uv0.xxy*10000.*u_time)));float noise2=abs(sin(snoise(uv0.yxy*10000.*u_time)));float noise3=abs(sin(snoise(uv0.xyx*10000.*u_time)));railColor.rgb-=(vec3(noise,noise2,noise3)*0.3);float theta=atan(cUV.y,uv0.x);float spiral=sin(10.0*(sqrt(19.0+(15.0*sintime*0.05)))-1000.0*theta-0.01*u_time*0.0001);float theta2=atan(1.0-(cUV.y/1000.0),uv0.x-(railWidth/20.));float spiral2=sin(10.0*(sqrt(20.0+u_time*0.00001)-10000.0*theta2-0.01*u_time*0.0001));float theta3=atan(1.0-uv0.y/10.0,uv0.x);float spiral3=sin(100.0*(sqrt(100.0+uv0.y)-100000.0*theta3-0.01*sintime*0.0001));float sparkleNoise=snoise(vec3(spiral,spiral2,u_time*0.00001));fragColor.r=step(abs(spiral2*spiral*sparkleNoise),mix(0.0333,0.0666,abs(uv0.y+sin(u_time*0.00001))));fragColor.r*=pow(1.0-abs(cUV.y),3.0)*abs(spiral3);fragColor.r*=10.0;if(cUV.y>0.0){fragColor.r=0.0;}fragColor=clamp(vec4(fragColor+railColor),vec4(0),vec4(1));}`;var O={attributes:{vertex:"a_vertex",uv0:"a_uv0",normal:"a_normal",vertexColor:"a_vertex_color"},uniforms:{view:"u_view",projection:"u_projection",objectToWorld:"u_object_to_world",objectToWorldInv:"u_object_to_world_inv",light0:"u_light_0",light0Color:"u_light_0_color",time:"u_time",albedo:"u_albedo",texture0:"u_texture_0",texture1:"u_texture_1",texture2:"u_texture_2"}},D=(J,K=t)=>new y(O).vertex(B).fragment(K).app(J);var x=new I({fov:45}),P=new j([0,0,2],k([0,0,0])),Q=new j(z(0),k(z(0)),[1000,1,1]);new H(x,Q,new F(x,E,D(x),P).configure({}));x.start(); diff --git a/html/chunk-0ef35489d83e6289.js b/html/chunk-0ef35489d83e6289.js new file mode 100644 index 0000000..d8bf369 --- /dev/null +++ b/html/chunk-0ef35489d83e6289.js @@ -0,0 +1,5 @@ +var u0=Object.defineProperty;var u=(C,M)=>{for(var N in M)u0(C,N,{get:M[N],enumerable:!0,configurable:!0,set:(I)=>M[N]=()=>I})};var f={};u(f,{str:()=>{{return mC}},squaredLength:()=>{{return d0}},sqrLen:()=>{{return NM}},sqlerp:()=>{{return WM}},slerp:()=>{{return e}},setAxisAngle:()=>{{return h0}},setAxes:()=>{{return AM}},set:()=>{{return oC}},scale:()=>{{return g0}},rotationTo:()=>{{return QM}},rotateZ:()=>{{return lC}},rotateY:()=>{{return iC}},rotateX:()=>{{return dC}},random:()=>{{return yC}},pow:()=>{{return zC}},normalize:()=>{{return C0}},multiply:()=>{{return q0}},mul:()=>{{return aC}},ln:()=>{{return w0}},lerp:()=>{{return CM}},length:()=>{{return f0}},len:()=>{{return MM}},invert:()=>{{return rC}},identity:()=>{{return gC}},getAxisAngle:()=>{{return nC}},getAngle:()=>{{return fC}},fromValues:()=>{{return bC}},fromMat3:()=>{{return v0}},fromEuler:()=>{{return sC}},exp:()=>{{return p0}},exactEquals:()=>{{return IM}},equals:()=>{{return VM}},dot:()=>{{return n0}},create:()=>{{return a}},copy:()=>{{return uC}},conjugate:()=>{{return xC}},clone:()=>{{return eC}},calculateW:()=>{{return cC}},add:()=>{{return tC}}});var F=0.000001,k=typeof Float32Array!=="undefined"?Float32Array:Array,n=Math.random,QN=Math.PI/180;if(!Math.hypot)Math.hypot=function(){var C=0,M=arguments.length;while(M--)C+=arguments[M]*arguments[M];return Math.sqrt(C)};function X0(){var C=new k(9);if(k!=Float32Array)C[1]=0,C[2]=0,C[3]=0,C[5]=0,C[6]=0,C[7]=0;return C[0]=1,C[4]=1,C[8]=1,C}var i={};u(i,{zero:()=>{{return FC}},transformQuat:()=>{{return HC}},transformMat4:()=>{{return LC}},transformMat3:()=>{{return PC}},subtract:()=>{{return Z0}},sub:()=>{{return _C}},str:()=>{{return OC}},squaredLength:()=>{{return P0}},squaredDistance:()=>{{return L0}},sqrLen:()=>{{return qC}},sqrDist:()=>{{return hC}},set:()=>{{return CC}},scaleAndAdd:()=>{{return EC}},scale:()=>{{return AC}},round:()=>{{return WC}},rotateZ:()=>{{return GC}},rotateY:()=>{{return DC}},rotateX:()=>{{return JC}},random:()=>{{return KC}},normalize:()=>{{return o}},negate:()=>{{return XC}},multiply:()=>{{return $0}},mul:()=>{{return TC}},min:()=>{{return VC}},max:()=>{{return QC}},lerp:()=>{{return ZC}},length:()=>{{return Y0}},len:()=>{{return t}},inverse:()=>{{return YC}},hermite:()=>{{return $C}},fromValues:()=>{{return s}},forEach:()=>{{return pC}},floor:()=>{{return IC}},exactEquals:()=>{{return RC}},equals:()=>{{return kC}},dot:()=>{{return m}},divide:()=>{{return B0}},div:()=>{{return jC}},distance:()=>{{return K0}},dist:()=>{{return SC}},cross:()=>{{return r}},create:()=>{{return x}},copy:()=>{{return a0}},clone:()=>{{return t0}},ceil:()=>{{return NC}},bezier:()=>{{return BC}},angle:()=>{{return UC}},add:()=>{{return MC}}});function x(){var C=new k(3);if(k!=Float32Array)C[0]=0,C[1]=0,C[2]=0;return C}function t0(C){var M=new k(3);return M[0]=C[0],M[1]=C[1],M[2]=C[2],M}function Y0(C){var M=C[0],N=C[1],I=C[2];return Math.hypot(M,N,I)}function s(C,M,N){var I=new k(3);return I[0]=C,I[1]=M,I[2]=N,I}function a0(C,M){return C[0]=M[0],C[1]=M[1],C[2]=M[2],C}function CC(C,M,N,I){return C[0]=M,C[1]=N,C[2]=I,C}function MC(C,M,N){return C[0]=M[0]+N[0],C[1]=M[1]+N[1],C[2]=M[2]+N[2],C}function Z0(C,M,N){return C[0]=M[0]-N[0],C[1]=M[1]-N[1],C[2]=M[2]-N[2],C}function $0(C,M,N){return C[0]=M[0]*N[0],C[1]=M[1]*N[1],C[2]=M[2]*N[2],C}function B0(C,M,N){return C[0]=M[0]/N[0],C[1]=M[1]/N[1],C[2]=M[2]/N[2],C}function NC(C,M){return C[0]=Math.ceil(M[0]),C[1]=Math.ceil(M[1]),C[2]=Math.ceil(M[2]),C}function IC(C,M){return C[0]=Math.floor(M[0]),C[1]=Math.floor(M[1]),C[2]=Math.floor(M[2]),C}function VC(C,M,N){return C[0]=Math.min(M[0],N[0]),C[1]=Math.min(M[1],N[1]),C[2]=Math.min(M[2],N[2]),C}function QC(C,M,N){return C[0]=Math.max(M[0],N[0]),C[1]=Math.max(M[1],N[1]),C[2]=Math.max(M[2],N[2]),C}function WC(C,M){return C[0]=Math.round(M[0]),C[1]=Math.round(M[1]),C[2]=Math.round(M[2]),C}function AC(C,M,N){return C[0]=M[0]*N,C[1]=M[1]*N,C[2]=M[2]*N,C}function EC(C,M,N,I){return C[0]=M[0]+N[0]*I,C[1]=M[1]+N[1]*I,C[2]=M[2]+N[2]*I,C}function K0(C,M){var N=M[0]-C[0],I=M[1]-C[1],V=M[2]-C[2];return Math.hypot(N,I,V)}function L0(C,M){var N=M[0]-C[0],I=M[1]-C[1],V=M[2]-C[2];return N*N+I*I+V*V}function P0(C){var M=C[0],N=C[1],I=C[2];return M*M+N*N+I*I}function XC(C,M){return C[0]=-M[0],C[1]=-M[1],C[2]=-M[2],C}function YC(C,M){return C[0]=1/M[0],C[1]=1/M[1],C[2]=1/M[2],C}function o(C,M){var N=M[0],I=M[1],V=M[2],Q=N*N+I*I+V*V;if(Q>0)Q=1/Math.sqrt(Q);return C[0]=M[0]*Q,C[1]=M[1]*Q,C[2]=M[2]*Q,C}function m(C,M){return C[0]*M[0]+C[1]*M[1]+C[2]*M[2]}function r(C,M,N){var I=M[0],V=M[1],Q=M[2],W=N[0],A=N[1],E=N[2];return C[0]=V*E-Q*A,C[1]=Q*W-I*E,C[2]=I*A-V*W,C}function ZC(C,M,N,I){var V=M[0],Q=M[1],W=M[2];return C[0]=V+I*(N[0]-V),C[1]=Q+I*(N[1]-Q),C[2]=W+I*(N[2]-W),C}function $C(C,M,N,I,V,Q){var W=Q*Q,A=W*(2*Q-3)+1,E=W*(Q-2)+Q,X=W*(Q-1),Y=W*(3-2*Q);return C[0]=M[0]*A+N[0]*E+I[0]*X+V[0]*Y,C[1]=M[1]*A+N[1]*E+I[1]*X+V[1]*Y,C[2]=M[2]*A+N[2]*E+I[2]*X+V[2]*Y,C}function BC(C,M,N,I,V,Q){var W=1-Q,A=W*W,E=Q*Q,X=A*W,Y=3*Q*A,$=3*E*W,K=E*Q;return C[0]=M[0]*X+N[0]*Y+I[0]*$+V[0]*K,C[1]=M[1]*X+N[1]*Y+I[1]*$+V[1]*K,C[2]=M[2]*X+N[2]*Y+I[2]*$+V[2]*K,C}function KC(C,M){M=M||1;var N=n()*2*Math.PI,I=n()*2-1,V=Math.sqrt(1-I*I)*M;return C[0]=Math.cos(N)*V,C[1]=Math.sin(N)*V,C[2]=I*M,C}function LC(C,M,N){var I=M[0],V=M[1],Q=M[2],W=N[3]*I+N[7]*V+N[11]*Q+N[15];return W=W||1,C[0]=(N[0]*I+N[4]*V+N[8]*Q+N[12])/W,C[1]=(N[1]*I+N[5]*V+N[9]*Q+N[13])/W,C[2]=(N[2]*I+N[6]*V+N[10]*Q+N[14])/W,C}function PC(C,M,N){var I=M[0],V=M[1],Q=M[2];return C[0]=I*N[0]+V*N[3]+Q*N[6],C[1]=I*N[1]+V*N[4]+Q*N[7],C[2]=I*N[2]+V*N[5]+Q*N[8],C}function HC(C,M,N){var I=N[0],V=N[1],Q=N[2],W=N[3],A=M[0],E=M[1],X=M[2],Y=V*X-Q*E,$=Q*A-I*X,K=I*E-V*A,B=V*K-Q*$,P=Q*Y-I*K,L=I*$-V*Y,Z=W*2;return Y*=Z,$*=Z,K*=Z,B*=2,P*=2,L*=2,C[0]=A+Y+B,C[1]=E+$+P,C[2]=X+K+L,C}function JC(C,M,N,I){var V=[],Q=[];return V[0]=M[0]-N[0],V[1]=M[1]-N[1],V[2]=M[2]-N[2],Q[0]=V[0],Q[1]=V[1]*Math.cos(I)-V[2]*Math.sin(I),Q[2]=V[1]*Math.sin(I)+V[2]*Math.cos(I),C[0]=Q[0]+N[0],C[1]=Q[1]+N[1],C[2]=Q[2]+N[2],C}function DC(C,M,N,I){var V=[],Q=[];return V[0]=M[0]-N[0],V[1]=M[1]-N[1],V[2]=M[2]-N[2],Q[0]=V[2]*Math.sin(I)+V[0]*Math.cos(I),Q[1]=V[1],Q[2]=V[2]*Math.cos(I)-V[0]*Math.sin(I),C[0]=Q[0]+N[0],C[1]=Q[1]+N[1],C[2]=Q[2]+N[2],C}function GC(C,M,N,I){var V=[],Q=[];return V[0]=M[0]-N[0],V[1]=M[1]-N[1],V[2]=M[2]-N[2],Q[0]=V[0]*Math.cos(I)-V[1]*Math.sin(I),Q[1]=V[0]*Math.sin(I)+V[1]*Math.cos(I),Q[2]=V[2],C[0]=Q[0]+N[0],C[1]=Q[1]+N[1],C[2]=Q[2]+N[2],C}function UC(C,M){var N=C[0],I=C[1],V=C[2],Q=M[0],W=M[1],A=M[2],E=Math.sqrt(N*N+I*I+V*V),X=Math.sqrt(Q*Q+W*W+A*A),Y=E*X,$=Y&&m(C,M)/Y;return Math.acos(Math.min(Math.max($,-1),1))}function FC(C){return C[0]=0,C[1]=0,C[2]=0,C}function OC(C){return"vec3("+C[0]+", "+C[1]+", "+C[2]+")"}function RC(C,M){return C[0]===M[0]&&C[1]===M[1]&&C[2]===M[2]}function kC(C,M){var N=C[0],I=C[1],V=C[2],Q=M[0],W=M[1],A=M[2];return Math.abs(N-Q)<=F*Math.max(1,Math.abs(N),Math.abs(Q))&&Math.abs(I-W)<=F*Math.max(1,Math.abs(I),Math.abs(W))&&Math.abs(V-A)<=F*Math.max(1,Math.abs(V),Math.abs(A))}var _C=Z0,TC=$0,jC=B0,SC=K0,hC=L0,t=Y0,qC=P0,pC=function(){var C=x();return function(M,N,I,V,Q,W){var A,E;if(!N)N=3;if(!I)I=0;if(V)E=Math.min(V*N+I,M.length);else E=M.length;for(A=I;A0)W=1/Math.sqrt(W);return C[0]=N*W,C[1]=I*W,C[2]=V*W,C[3]=Q*W,C}function _0(C,M){return C[0]*M[0]+C[1]*M[1]+C[2]*M[2]+C[3]*M[3]}function T0(C,M,N,I){var V=M[0],Q=M[1],W=M[2],A=M[3];return C[0]=V+I*(N[0]-V),C[1]=Q+I*(N[1]-Q),C[2]=W+I*(N[2]-W),C[3]=A+I*(N[3]-A),C}function j0(C,M){return C[0]===M[0]&&C[1]===M[1]&&C[2]===M[2]&&C[3]===M[3]}function S0(C,M){var N=C[0],I=C[1],V=C[2],Q=C[3],W=M[0],A=M[1],E=M[2],X=M[3];return Math.abs(N-W)<=F*Math.max(1,Math.abs(N),Math.abs(W))&&Math.abs(I-A)<=F*Math.max(1,Math.abs(I),Math.abs(A))&&Math.abs(V-E)<=F*Math.max(1,Math.abs(V),Math.abs(E))&&Math.abs(Q-X)<=F*Math.max(1,Math.abs(Q),Math.abs(X))}var WN=function(){var C=wC();return function(M,N,I,V,Q,W){var A,E;if(!N)N=4;if(!I)I=0;if(V)E=Math.min(V*N+I,M.length);else E=M.length;for(A=I;AF)C[0]=M[0]/I,C[1]=M[1]/I,C[2]=M[2]/I;else C[0]=1,C[1]=0,C[2]=0;return N}function fC(C,M){var N=n0(C,M);return Math.acos(2*N*N-1)}function q0(C,M,N){var I=M[0],V=M[1],Q=M[2],W=M[3],A=N[0],E=N[1],X=N[2],Y=N[3];return C[0]=I*Y+W*A+V*X-Q*E,C[1]=V*Y+W*E+Q*A-I*X,C[2]=Q*Y+W*X+I*E-V*A,C[3]=W*Y-I*A-V*E-Q*X,C}function dC(C,M,N){N*=0.5;var I=M[0],V=M[1],Q=M[2],W=M[3],A=Math.sin(N),E=Math.cos(N);return C[0]=I*E+W*A,C[1]=V*E+Q*A,C[2]=Q*E-V*A,C[3]=W*E-I*A,C}function iC(C,M,N){N*=0.5;var I=M[0],V=M[1],Q=M[2],W=M[3],A=Math.sin(N),E=Math.cos(N);return C[0]=I*E-Q*A,C[1]=V*E+W*A,C[2]=Q*E+I*A,C[3]=W*E-V*A,C}function lC(C,M,N){N*=0.5;var I=M[0],V=M[1],Q=M[2],W=M[3],A=Math.sin(N),E=Math.cos(N);return C[0]=I*E+V*A,C[1]=V*E-I*A,C[2]=Q*E+W*A,C[3]=W*E-Q*A,C}function cC(C,M){var N=M[0],I=M[1],V=M[2];return C[0]=N,C[1]=I,C[2]=V,C[3]=Math.sqrt(Math.abs(1-N*N-I*I-V*V)),C}function p0(C,M){var N=M[0],I=M[1],V=M[2],Q=M[3],W=Math.sqrt(N*N+I*I+V*V),A=Math.exp(Q),E=W>0?A*Math.sin(W)/W:0;return C[0]=N*E,C[1]=I*E,C[2]=V*E,C[3]=A*Math.cos(W),C}function w0(C,M){var N=M[0],I=M[1],V=M[2],Q=M[3],W=Math.sqrt(N*N+I*I+V*V),A=W>0?Math.atan2(W,Q)/W:0;return C[0]=N*A,C[1]=I*A,C[2]=V*A,C[3]=0.5*Math.log(N*N+I*I+V*V+Q*Q),C}function zC(C,M,N){return w0(C,M),g0(C,C,N),p0(C,C),C}function e(C,M,N,I){var V=M[0],Q=M[1],W=M[2],A=M[3],E=N[0],X=N[1],Y=N[2],$=N[3],K,B,P,L,Z;if(B=V*E+Q*X+W*Y+A*$,B<0)B=-B,E=-E,X=-X,Y=-Y,$=-$;if(1-B>F)K=Math.acos(B),P=Math.sin(K),L=Math.sin((1-I)*K)/P,Z=Math.sin(I*K)/P;else L=1-I,Z=I;return C[0]=L*V+Z*E,C[1]=L*Q+Z*X,C[2]=L*W+Z*Y,C[3]=L*A+Z*$,C}function yC(C){var M=n(),N=n(),I=n(),V=Math.sqrt(1-M),Q=Math.sqrt(M);return C[0]=V*Math.sin(2*Math.PI*N),C[1]=V*Math.cos(2*Math.PI*N),C[2]=Q*Math.sin(2*Math.PI*I),C[3]=Q*Math.cos(2*Math.PI*I),C}function rC(C,M){var N=M[0],I=M[1],V=M[2],Q=M[3],W=N*N+I*I+V*V+Q*Q,A=W?1/W:0;return C[0]=-N*A,C[1]=-I*A,C[2]=-V*A,C[3]=Q*A,C}function xC(C,M){return C[0]=-M[0],C[1]=-M[1],C[2]=-M[2],C[3]=M[3],C}function v0(C,M){var N=M[0]+M[4]+M[8],I;if(N>0)I=Math.sqrt(N+1),C[3]=0.5*I,I=0.5/I,C[0]=(M[5]-M[7])*I,C[1]=(M[6]-M[2])*I,C[2]=(M[1]-M[3])*I;else{var V=0;if(M[4]>M[0])V=1;if(M[8]>M[V*3+V])V=2;var Q=(V+1)%3,W=(V+2)%3;I=Math.sqrt(M[V*3+V]-M[Q*3+Q]-M[W*3+W]+1),C[V]=0.5*I,I=0.5/I,C[3]=(M[Q*3+W]-M[W*3+Q])*I,C[Q]=(M[Q*3+V]+M[V*3+Q])*I,C[W]=(M[W*3+V]+M[V*3+W])*I}return C}function sC(C,M,N,I){var V=0.5*Math.PI/180;M*=V,N*=V,I*=V;var Q=Math.sin(M),W=Math.cos(M),A=Math.sin(N),E=Math.cos(N),X=Math.sin(I),Y=Math.cos(I);return C[0]=Q*E*Y-W*A*X,C[1]=W*A*Y+Q*E*X,C[2]=W*E*X-Q*A*Y,C[3]=W*E*Y+Q*A*X,C}function mC(C){return"quat("+C[0]+", "+C[1]+", "+C[2]+", "+C[3]+")"}var eC=H0,bC=J0,uC=D0,oC=G0,tC=U0,aC=q0,g0=F0,n0=_0,CM=T0,f0=O0,MM=f0,d0=R0,NM=d0,C0=k0,IM=j0,VM=S0,QM=function(){var C=x(),M=s(1,0,0),N=s(0,1,0);return function(I,V,Q){var W=m(V,Q);if(W<-0.999999){if(r(C,M,V),t(C)<0.000001)r(C,N,V);return o(C,C),h0(I,C,Math.PI),I}else if(W>0.999999)return I[0]=0,I[1]=0,I[2]=0,I[3]=1,I;else return r(C,V,Q),I[0]=C[0],I[1]=C[1],I[2]=C[2],I[3]=1+W,C0(I,I)}}(),WM=function(){var C=a(),M=a();return function(N,I,V,Q,W,A){return e(C,I,W,A),e(M,V,Q,A),e(N,C,M,2*A*(1-A)),N}}(),AM=function(){var C=X0();return function(M,N,I,V){return C[0]=I[0],C[3]=I[1],C[6]=I[2],C[1]=V[0],C[4]=V[1],C[7]=V[2],C[2]=-N[0],C[5]=-N[1],C[8]=-N[2],C0(M,v0(M,C))}}();var w={};u(w,{transpose:()=>{{return BM}},translate:()=>{{return HM}},targetTo:()=>{{return zM}},subtract:()=>{{return x0}},sub:()=>{{return oM}},str:()=>{{return yM}},set:()=>{{return $M}},scale:()=>{{return JM}},rotateZ:()=>{{return FM}},rotateY:()=>{{return UM}},rotateX:()=>{{return GM}},rotate:()=>{{return DM}},perspectiveZO:()=>{{return fM}},perspectiveNO:()=>{{return y0}},perspectiveFromFieldOfView:()=>{{return dM}},perspective:()=>{{return nM}},orthoZO:()=>{{return lM}},orthoNO:()=>{{return r0}},ortho:()=>{{return iM}},multiplyScalarAndAdd:()=>{{return mM}},multiplyScalar:()=>{{return sM}},multiply:()=>{{return l0}},mul:()=>{{return uM}},lookAt:()=>{{return cM}},invert:()=>{{return KM}},identity:()=>{{return i0}},getTranslation:()=>{{return hM}},getScaling:()=>{{return z0}},getRotation:()=>{{return qM}},frustum:()=>{{return gM}},fromZRotation:()=>{{return jM}},fromYRotation:()=>{{return TM}},fromXRotation:()=>{{return _M}},fromValues:()=>{{return ZM}},fromTranslation:()=>{{return OM}},fromScaling:()=>{{return RM}},fromRotationTranslationScaleOrigin:()=>{{return wM}},fromRotationTranslationScale:()=>{{return pM}},fromRotationTranslation:()=>{{return c0}},fromRotation:()=>{{return kM}},fromQuat2:()=>{{return SM}},fromQuat:()=>{{return vM}},frob:()=>{{return rM}},exactEquals:()=>{{return eM}},equals:()=>{{return bM}},determinant:()=>{{return PM}},create:()=>{{return EM}},copy:()=>{{return YM}},clone:()=>{{return XM}},adjoint:()=>{{return LM}},add:()=>{{return xM}}});function EM(){var C=new k(16);if(k!=Float32Array)C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[11]=0,C[12]=0,C[13]=0,C[14]=0;return C[0]=1,C[5]=1,C[10]=1,C[15]=1,C}function XM(C){var M=new k(16);return M[0]=C[0],M[1]=C[1],M[2]=C[2],M[3]=C[3],M[4]=C[4],M[5]=C[5],M[6]=C[6],M[7]=C[7],M[8]=C[8],M[9]=C[9],M[10]=C[10],M[11]=C[11],M[12]=C[12],M[13]=C[13],M[14]=C[14],M[15]=C[15],M}function YM(C,M){return C[0]=M[0],C[1]=M[1],C[2]=M[2],C[3]=M[3],C[4]=M[4],C[5]=M[5],C[6]=M[6],C[7]=M[7],C[8]=M[8],C[9]=M[9],C[10]=M[10],C[11]=M[11],C[12]=M[12],C[13]=M[13],C[14]=M[14],C[15]=M[15],C}function ZM(C,M,N,I,V,Q,W,A,E,X,Y,$,K,B,P,L){var Z=new k(16);return Z[0]=C,Z[1]=M,Z[2]=N,Z[3]=I,Z[4]=V,Z[5]=Q,Z[6]=W,Z[7]=A,Z[8]=E,Z[9]=X,Z[10]=Y,Z[11]=$,Z[12]=K,Z[13]=B,Z[14]=P,Z[15]=L,Z}function $M(C,M,N,I,V,Q,W,A,E,X,Y,$,K,B,P,L,Z){return C[0]=M,C[1]=N,C[2]=I,C[3]=V,C[4]=Q,C[5]=W,C[6]=A,C[7]=E,C[8]=X,C[9]=Y,C[10]=$,C[11]=K,C[12]=B,C[13]=P,C[14]=L,C[15]=Z,C}function i0(C){return C[0]=1,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=1,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[10]=1,C[11]=0,C[12]=0,C[13]=0,C[14]=0,C[15]=1,C}function BM(C,M){if(C===M){var N=M[1],I=M[2],V=M[3],Q=M[6],W=M[7],A=M[11];C[1]=M[4],C[2]=M[8],C[3]=M[12],C[4]=N,C[6]=M[9],C[7]=M[13],C[8]=I,C[9]=Q,C[11]=M[14],C[12]=V,C[13]=W,C[14]=A}else C[0]=M[0],C[1]=M[4],C[2]=M[8],C[3]=M[12],C[4]=M[1],C[5]=M[5],C[6]=M[9],C[7]=M[13],C[8]=M[2],C[9]=M[6],C[10]=M[10],C[11]=M[14],C[12]=M[3],C[13]=M[7],C[14]=M[11],C[15]=M[15];return C}function KM(C,M){var N=M[0],I=M[1],V=M[2],Q=M[3],W=M[4],A=M[5],E=M[6],X=M[7],Y=M[8],$=M[9],K=M[10],B=M[11],P=M[12],L=M[13],Z=M[14],H=M[15],O=N*A-I*W,U=N*E-V*W,G=N*X-Q*W,J=I*E-V*A,D=I*X-Q*A,S=V*X-Q*E,_=Y*L-$*P,T=Y*Z-K*P,j=Y*H-B*P,h=$*Z-K*L,q=$*H-B*L,p=K*H-B*Z,R=O*p-U*q+G*h+J*j-D*T+S*_;if(!R)return null;return R=1/R,C[0]=(A*p-E*q+X*h)*R,C[1]=(V*q-I*p-Q*h)*R,C[2]=(L*S-Z*D+H*J)*R,C[3]=(K*D-$*S-B*J)*R,C[4]=(E*j-W*p-X*T)*R,C[5]=(N*p-V*j+Q*T)*R,C[6]=(Z*G-P*S-H*U)*R,C[7]=(Y*S-K*G+B*U)*R,C[8]=(W*q-A*j+X*_)*R,C[9]=(I*j-N*q-Q*_)*R,C[10]=(P*D-L*G+H*O)*R,C[11]=($*G-Y*D-B*O)*R,C[12]=(A*T-W*h-E*_)*R,C[13]=(N*h-I*T+V*_)*R,C[14]=(L*U-P*J-Z*O)*R,C[15]=(Y*J-$*U+K*O)*R,C}function LM(C,M){var N=M[0],I=M[1],V=M[2],Q=M[3],W=M[4],A=M[5],E=M[6],X=M[7],Y=M[8],$=M[9],K=M[10],B=M[11],P=M[12],L=M[13],Z=M[14],H=M[15];return C[0]=A*(K*H-B*Z)-$*(E*H-X*Z)+L*(E*B-X*K),C[1]=-(I*(K*H-B*Z)-$*(V*H-Q*Z)+L*(V*B-Q*K)),C[2]=I*(E*H-X*Z)-A*(V*H-Q*Z)+L*(V*X-Q*E),C[3]=-(I*(E*B-X*K)-A*(V*B-Q*K)+$*(V*X-Q*E)),C[4]=-(W*(K*H-B*Z)-Y*(E*H-X*Z)+P*(E*B-X*K)),C[5]=N*(K*H-B*Z)-Y*(V*H-Q*Z)+P*(V*B-Q*K),C[6]=-(N*(E*H-X*Z)-W*(V*H-Q*Z)+P*(V*X-Q*E)),C[7]=N*(E*B-X*K)-W*(V*B-Q*K)+Y*(V*X-Q*E),C[8]=W*($*H-B*L)-Y*(A*H-X*L)+P*(A*B-X*$),C[9]=-(N*($*H-B*L)-Y*(I*H-Q*L)+P*(I*B-Q*$)),C[10]=N*(A*H-X*L)-W*(I*H-Q*L)+P*(I*X-Q*A),C[11]=-(N*(A*B-X*$)-W*(I*B-Q*$)+Y*(I*X-Q*A)),C[12]=-(W*($*Z-K*L)-Y*(A*Z-E*L)+P*(A*K-E*$)),C[13]=N*($*Z-K*L)-Y*(I*Z-V*L)+P*(I*K-V*$),C[14]=-(N*(A*Z-E*L)-W*(I*Z-V*L)+P*(I*E-V*A)),C[15]=N*(A*K-E*$)-W*(I*K-V*$)+Y*(I*E-V*A),C}function PM(C){var M=C[0],N=C[1],I=C[2],V=C[3],Q=C[4],W=C[5],A=C[6],E=C[7],X=C[8],Y=C[9],$=C[10],K=C[11],B=C[12],P=C[13],L=C[14],Z=C[15],H=M*W-N*Q,O=M*A-I*Q,U=M*E-V*Q,G=N*A-I*W,J=N*E-V*W,D=I*E-V*A,S=X*P-Y*B,_=X*L-$*B,T=X*Z-K*B,j=Y*L-$*P,h=Y*Z-K*P,q=$*Z-K*L;return H*q-O*h+U*j+G*T-J*_+D*S}function l0(C,M,N){var I=M[0],V=M[1],Q=M[2],W=M[3],A=M[4],E=M[5],X=M[6],Y=M[7],$=M[8],K=M[9],B=M[10],P=M[11],L=M[12],Z=M[13],H=M[14],O=M[15],U=N[0],G=N[1],J=N[2],D=N[3];return C[0]=U*I+G*A+J*$+D*L,C[1]=U*V+G*E+J*K+D*Z,C[2]=U*Q+G*X+J*B+D*H,C[3]=U*W+G*Y+J*P+D*O,U=N[4],G=N[5],J=N[6],D=N[7],C[4]=U*I+G*A+J*$+D*L,C[5]=U*V+G*E+J*K+D*Z,C[6]=U*Q+G*X+J*B+D*H,C[7]=U*W+G*Y+J*P+D*O,U=N[8],G=N[9],J=N[10],D=N[11],C[8]=U*I+G*A+J*$+D*L,C[9]=U*V+G*E+J*K+D*Z,C[10]=U*Q+G*X+J*B+D*H,C[11]=U*W+G*Y+J*P+D*O,U=N[12],G=N[13],J=N[14],D=N[15],C[12]=U*I+G*A+J*$+D*L,C[13]=U*V+G*E+J*K+D*Z,C[14]=U*Q+G*X+J*B+D*H,C[15]=U*W+G*Y+J*P+D*O,C}function HM(C,M,N){var I=N[0],V=N[1],Q=N[2],W,A,E,X,Y,$,K,B,P,L,Z,H;if(M===C)C[12]=M[0]*I+M[4]*V+M[8]*Q+M[12],C[13]=M[1]*I+M[5]*V+M[9]*Q+M[13],C[14]=M[2]*I+M[6]*V+M[10]*Q+M[14],C[15]=M[3]*I+M[7]*V+M[11]*Q+M[15];else W=M[0],A=M[1],E=M[2],X=M[3],Y=M[4],$=M[5],K=M[6],B=M[7],P=M[8],L=M[9],Z=M[10],H=M[11],C[0]=W,C[1]=A,C[2]=E,C[3]=X,C[4]=Y,C[5]=$,C[6]=K,C[7]=B,C[8]=P,C[9]=L,C[10]=Z,C[11]=H,C[12]=W*I+Y*V+P*Q+M[12],C[13]=A*I+$*V+L*Q+M[13],C[14]=E*I+K*V+Z*Q+M[14],C[15]=X*I+B*V+H*Q+M[15];return C}function JM(C,M,N){var I=N[0],V=N[1],Q=N[2];return C[0]=M[0]*I,C[1]=M[1]*I,C[2]=M[2]*I,C[3]=M[3]*I,C[4]=M[4]*V,C[5]=M[5]*V,C[6]=M[6]*V,C[7]=M[7]*V,C[8]=M[8]*Q,C[9]=M[9]*Q,C[10]=M[10]*Q,C[11]=M[11]*Q,C[12]=M[12],C[13]=M[13],C[14]=M[14],C[15]=M[15],C}function DM(C,M,N,I){var V=I[0],Q=I[1],W=I[2],A=Math.hypot(V,Q,W),E,X,Y,$,K,B,P,L,Z,H,O,U,G,J,D,S,_,T,j,h,q,p,R,v;if(A0)N[0]=(A*W+Y*I+E*Q-X*V)*2/$,N[1]=(E*W+Y*V+X*I-A*Q)*2/$,N[2]=(X*W+Y*Q+A*V-E*I)*2/$;else N[0]=(A*W+Y*I+E*Q-X*V)*2,N[1]=(E*W+Y*V+X*I-A*Q)*2,N[2]=(X*W+Y*Q+A*V-E*I)*2;return c0(C,M,N),C}function hM(C,M){return C[0]=M[12],C[1]=M[13],C[2]=M[14],C}function z0(C,M){var N=M[0],I=M[1],V=M[2],Q=M[4],W=M[5],A=M[6],E=M[8],X=M[9],Y=M[10];return C[0]=Math.hypot(N,I,V),C[1]=Math.hypot(Q,W,A),C[2]=Math.hypot(E,X,Y),C}function qM(C,M){var N=new k(3);z0(N,M);var I=1/N[0],V=1/N[1],Q=1/N[2],W=M[0]*I,A=M[1]*V,E=M[2]*Q,X=M[4]*I,Y=M[5]*V,$=M[6]*Q,K=M[8]*I,B=M[9]*V,P=M[10]*Q,L=W+Y+P,Z=0;if(L>0)Z=Math.sqrt(L+1)*2,C[3]=0.25*Z,C[0]=($-B)/Z,C[1]=(K-E)/Z,C[2]=(A-X)/Z;else if(W>Y&&W>P)Z=Math.sqrt(1+W-Y-P)*2,C[3]=($-B)/Z,C[0]=0.25*Z,C[1]=(A+X)/Z,C[2]=(K+E)/Z;else if(Y>P)Z=Math.sqrt(1+Y-W-P)*2,C[3]=(K-E)/Z,C[0]=(A+X)/Z,C[1]=0.25*Z,C[2]=($+B)/Z;else Z=Math.sqrt(1+P-W-Y)*2,C[3]=(A-X)/Z,C[0]=(K+E)/Z,C[1]=($+B)/Z,C[2]=0.25*Z;return C}function pM(C,M,N,I){var V=M[0],Q=M[1],W=M[2],A=M[3],E=V+V,X=Q+Q,Y=W+W,$=V*E,K=V*X,B=V*Y,P=Q*X,L=Q*Y,Z=W*Y,H=A*E,O=A*X,U=A*Y,G=I[0],J=I[1],D=I[2];return C[0]=(1-(P+Z))*G,C[1]=(K+U)*G,C[2]=(B-O)*G,C[3]=0,C[4]=(K-U)*J,C[5]=(1-($+Z))*J,C[6]=(L+H)*J,C[7]=0,C[8]=(B+O)*D,C[9]=(L-H)*D,C[10]=(1-($+P))*D,C[11]=0,C[12]=N[0],C[13]=N[1],C[14]=N[2],C[15]=1,C}function wM(C,M,N,I,V){var Q=M[0],W=M[1],A=M[2],E=M[3],X=Q+Q,Y=W+W,$=A+A,K=Q*X,B=Q*Y,P=Q*$,L=W*Y,Z=W*$,H=A*$,O=E*X,U=E*Y,G=E*$,J=I[0],D=I[1],S=I[2],_=V[0],T=V[1],j=V[2],h=(1-(L+H))*J,q=(B+G)*J,p=(P-U)*J,R=(B-G)*D,v=(1-(K+H))*D,c=(Z+O)*D,z=(P+U)*S,A0=(Z-O)*S,E0=(1-(K+L))*S;return C[0]=h,C[1]=q,C[2]=p,C[3]=0,C[4]=R,C[5]=v,C[6]=c,C[7]=0,C[8]=z,C[9]=A0,C[10]=E0,C[11]=0,C[12]=N[0]+_-(h*_+R*T+z*j),C[13]=N[1]+T-(q*_+v*T+A0*j),C[14]=N[2]+j-(p*_+c*T+E0*j),C[15]=1,C}function vM(C,M){var N=M[0],I=M[1],V=M[2],Q=M[3],W=N+N,A=I+I,E=V+V,X=N*W,Y=I*W,$=I*A,K=V*W,B=V*A,P=V*E,L=Q*W,Z=Q*A,H=Q*E;return C[0]=1-$-P,C[1]=Y+H,C[2]=K-Z,C[3]=0,C[4]=Y-H,C[5]=1-X-P,C[6]=B+L,C[7]=0,C[8]=K+Z,C[9]=B-L,C[10]=1-X-$,C[11]=0,C[12]=0,C[13]=0,C[14]=0,C[15]=1,C}function gM(C,M,N,I,V,Q,W){var A=1/(N-M),E=1/(V-I),X=1/(Q-W);return C[0]=Q*2*A,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=Q*2*E,C[6]=0,C[7]=0,C[8]=(N+M)*A,C[9]=(V+I)*E,C[10]=(W+Q)*X,C[11]=-1,C[12]=0,C[13]=0,C[14]=W*Q*2*X,C[15]=0,C}function y0(C,M,N,I,V){var Q=1/Math.tan(M/2),W;if(C[0]=Q/N,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=Q,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[11]=-1,C[12]=0,C[13]=0,C[15]=0,V!=null&&V!==Infinity)W=1/(I-V),C[10]=(V+I)*W,C[14]=2*V*I*W;else C[10]=-1,C[14]=-2*I;return C}function fM(C,M,N,I,V){var Q=1/Math.tan(M/2),W;if(C[0]=Q/N,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=Q,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[11]=-1,C[12]=0,C[13]=0,C[15]=0,V!=null&&V!==Infinity)W=1/(I-V),C[10]=V*W,C[14]=V*I*W;else C[10]=-1,C[14]=-I;return C}function dM(C,M,N,I){var V=Math.tan(M.upDegrees*Math.PI/180),Q=Math.tan(M.downDegrees*Math.PI/180),W=Math.tan(M.leftDegrees*Math.PI/180),A=Math.tan(M.rightDegrees*Math.PI/180),E=2/(W+A),X=2/(V+Q);return C[0]=E,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=X,C[6]=0,C[7]=0,C[8]=-((W-A)*E*0.5),C[9]=(V-Q)*X*0.5,C[10]=I/(N-I),C[11]=-1,C[12]=0,C[13]=0,C[14]=I*N/(N-I),C[15]=0,C}function r0(C,M,N,I,V,Q,W){var A=1/(M-N),E=1/(I-V),X=1/(Q-W);return C[0]=-2*A,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=-2*E,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[10]=2*X,C[11]=0,C[12]=(M+N)*A,C[13]=(V+I)*E,C[14]=(W+Q)*X,C[15]=1,C}function lM(C,M,N,I,V,Q,W){var A=1/(M-N),E=1/(I-V),X=1/(Q-W);return C[0]=-2*A,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=-2*E,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[10]=X,C[11]=0,C[12]=(M+N)*A,C[13]=(V+I)*E,C[14]=Q*X,C[15]=1,C}function cM(C,M,N,I){var V,Q,W,A,E,X,Y,$,K,B,P=M[0],L=M[1],Z=M[2],H=I[0],O=I[1],U=I[2],G=N[0],J=N[1],D=N[2];if(Math.abs(P-G)0)B=1/Math.sqrt(B),Y*=B,$*=B,K*=B;var P=E*K-X*$,L=X*Y-A*K,Z=A*$-E*Y;if(B=P*P+L*L+Z*Z,B>0)B=1/Math.sqrt(B),P*=B,L*=B,Z*=B;return C[0]=P,C[1]=L,C[2]=Z,C[3]=0,C[4]=$*Z-K*L,C[5]=K*P-Y*Z,C[6]=Y*L-$*P,C[7]=0,C[8]=Y,C[9]=$,C[10]=K,C[11]=0,C[12]=V,C[13]=Q,C[14]=W,C[15]=1,C}function yM(C){return"mat4("+C[0]+", "+C[1]+", "+C[2]+", "+C[3]+", "+C[4]+", "+C[5]+", "+C[6]+", "+C[7]+", "+C[8]+", "+C[9]+", "+C[10]+", "+C[11]+", "+C[12]+", "+C[13]+", "+C[14]+", "+C[15]+")"}function rM(C){return Math.hypot(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],C[8],C[9],C[10],C[11],C[12],C[13],C[14],C[15])}function xM(C,M,N){return C[0]=M[0]+N[0],C[1]=M[1]+N[1],C[2]=M[2]+N[2],C[3]=M[3]+N[3],C[4]=M[4]+N[4],C[5]=M[5]+N[5],C[6]=M[6]+N[6],C[7]=M[7]+N[7],C[8]=M[8]+N[8],C[9]=M[9]+N[9],C[10]=M[10]+N[10],C[11]=M[11]+N[11],C[12]=M[12]+N[12],C[13]=M[13]+N[13],C[14]=M[14]+N[14],C[15]=M[15]+N[15],C}function x0(C,M,N){return C[0]=M[0]-N[0],C[1]=M[1]-N[1],C[2]=M[2]-N[2],C[3]=M[3]-N[3],C[4]=M[4]-N[4],C[5]=M[5]-N[5],C[6]=M[6]-N[6],C[7]=M[7]-N[7],C[8]=M[8]-N[8],C[9]=M[9]-N[9],C[10]=M[10]-N[10],C[11]=M[11]-N[11],C[12]=M[12]-N[12],C[13]=M[13]-N[13],C[14]=M[14]-N[14],C[15]=M[15]-N[15],C}function sM(C,M,N){return C[0]=M[0]*N,C[1]=M[1]*N,C[2]=M[2]*N,C[3]=M[3]*N,C[4]=M[4]*N,C[5]=M[5]*N,C[6]=M[6]*N,C[7]=M[7]*N,C[8]=M[8]*N,C[9]=M[9]*N,C[10]=M[10]*N,C[11]=M[11]*N,C[12]=M[12]*N,C[13]=M[13]*N,C[14]=M[14]*N,C[15]=M[15]*N,C}function mM(C,M,N,I){return C[0]=M[0]+N[0]*I,C[1]=M[1]+N[1]*I,C[2]=M[2]+N[2]*I,C[3]=M[3]+N[3]*I,C[4]=M[4]+N[4]*I,C[5]=M[5]+N[5]*I,C[6]=M[6]+N[6]*I,C[7]=M[7]+N[7]*I,C[8]=M[8]+N[8]*I,C[9]=M[9]+N[9]*I,C[10]=M[10]+N[10]*I,C[11]=M[11]+N[11]*I,C[12]=M[12]+N[12]*I,C[13]=M[13]+N[13]*I,C[14]=M[14]+N[14]*I,C[15]=M[15]+N[15]*I,C}function eM(C,M){return C[0]===M[0]&&C[1]===M[1]&&C[2]===M[2]&&C[3]===M[3]&&C[4]===M[4]&&C[5]===M[5]&&C[6]===M[6]&&C[7]===M[7]&&C[8]===M[8]&&C[9]===M[9]&&C[10]===M[10]&&C[11]===M[11]&&C[12]===M[12]&&C[13]===M[13]&&C[14]===M[14]&&C[15]===M[15]}function bM(C,M){var N=C[0],I=C[1],V=C[2],Q=C[3],W=C[4],A=C[5],E=C[6],X=C[7],Y=C[8],$=C[9],K=C[10],B=C[11],P=C[12],L=C[13],Z=C[14],H=C[15],O=M[0],U=M[1],G=M[2],J=M[3],D=M[4],S=M[5],_=M[6],T=M[7],j=M[8],h=M[9],q=M[10],p=M[11],R=M[12],v=M[13],c=M[14],z=M[15];return Math.abs(N-O)<=F*Math.max(1,Math.abs(N),Math.abs(O))&&Math.abs(I-U)<=F*Math.max(1,Math.abs(I),Math.abs(U))&&Math.abs(V-G)<=F*Math.max(1,Math.abs(V),Math.abs(G))&&Math.abs(Q-J)<=F*Math.max(1,Math.abs(Q),Math.abs(J))&&Math.abs(W-D)<=F*Math.max(1,Math.abs(W),Math.abs(D))&&Math.abs(A-S)<=F*Math.max(1,Math.abs(A),Math.abs(S))&&Math.abs(E-_)<=F*Math.max(1,Math.abs(E),Math.abs(_))&&Math.abs(X-T)<=F*Math.max(1,Math.abs(X),Math.abs(T))&&Math.abs(Y-j)<=F*Math.max(1,Math.abs(Y),Math.abs(j))&&Math.abs($-h)<=F*Math.max(1,Math.abs($),Math.abs(h))&&Math.abs(K-q)<=F*Math.max(1,Math.abs(K),Math.abs(q))&&Math.abs(B-p)<=F*Math.max(1,Math.abs(B),Math.abs(p))&&Math.abs(P-R)<=F*Math.max(1,Math.abs(P),Math.abs(R))&&Math.abs(L-v)<=F*Math.max(1,Math.abs(L),Math.abs(v))&&Math.abs(Z-c)<=F*Math.max(1,Math.abs(Z),Math.abs(c))&&Math.abs(H-z)<=F*Math.max(1,Math.abs(H),Math.abs(z))}var nM=y0,iM=r0,uM=l0,oM=x0;class l{C;M;N;constructor(C=i.create(),M=f.create(),N=i.fromValues(1,1,1)){this.position=C;this.rotation=M;this.scale=N}rotateEuler(C,M,N){return f.fromEuler(this.rotation,C,M,N),this}toMat4(){const C=w.create();return w.fromRotationTranslationScale(C,this.rotation,this.position,this.scale),C}}var XN=(C)=>f.fromEuler(f.create(),C[0],C[1],C[2]),YN=(C)=>[C,C,C];class g{C;constructor(C){this.app=C;this.onStart&&C.onStart(this.onStart.bind(this)),this.onUpdate&&C.onUpdate(this.onUpdate.bind(this)),this.onAfterUpdate&&C.onAfterUpdate(this.onAfterUpdate.bind(this)),this.onBeforeUpdate&&C.onBeforeUpdate(this.onBeforeUpdate.bind(this)),this.onDraw&&C.onDraw(this.onDraw.bind(this))}}class M0 extends g{C;M;N;I;V;Q;projectionMatrix=w.create();buffers={textures:{}};faceDataType;colorDataType;constructor(C,M,N,I=new l([0,0,-6]),V=new l([100,100,0]),Q={}){super(C);this.app=C;this.mesh=M;this.shader=N;this.camera=I;this.light=V;this.config=Q;this.faceDataType=this.getDataType(M.config.faces),this.colorDataType=M.config.colors?this.getDataType(M.config.colors):null}getDataType(C){switch(C.BYTES_PER_ELEMENT){case 1:return 5121;case 2:return 5123;case 4:return 5125;default:return 5126}}configure(C){return this.config=C,this}makeBuffer(C,M=34962){const N=this.app.gl,I=N.createBuffer();if(!I)throw new Error("failed to create a buffer");return N.bindBuffer(M,I),N.bufferData(M,C,N.STATIC_DRAW),N.bindBuffer(M,null),I}initializeBuffers(){const C=this.app.gl.createVertexArray();if(!C)throw new Error("VAO creation failed");this.buffers.vao=C,this.app.gl.bindVertexArray(C),this.buffers.faces=this.makeBuffer(this.mesh.config.faces,this.app.gl.ELEMENT_ARRAY_BUFFER);const M=this.shader.mappings;if(this.buffers.position=this.makeBuffer(this.mesh.config.positions),this.bindAttrib(this.buffers.position,M.attributes.vertex,3,this.app.gl.FLOAT),this.mesh.config.normals)this.buffers.normal=this.makeBuffer(this.mesh.config.normals),this.bindAttrib(this.buffers.normal,M.attributes.normal,3,this.app.gl.FLOAT,!0);if(this.mesh.config.colors)this.buffers.color=this.makeBuffer(this.mesh.config.colors),this.bindAttrib(this.buffers.color,M.attributes.vertexColor,4,this.colorDataType||this.app.gl.UNSIGNED_BYTE);if(this.mesh.config.uvs)this.buffers.uv=this.makeBuffer(this.mesh.config.uvs),this.bindAttrib(this.buffers.uv,M.attributes.uv0,2,this.app.gl.FLOAT);this.app.gl.bindVertexArray(null)}async initializeTextures(){const{gl:C}=this.app;for(let[M,N]of Object.entries(this.shader.textures)){await N.loadImage();const I=C.createTexture();if(!I)throw new Error("failed to allocate texture");const V=N.texture;C.bindTexture(C.TEXTURE_2D,I),C.texImage2D(C.TEXTURE_2D,0,C.RGBA,N.width,N.height,0,C.RGBA,C.UNSIGNED_BYTE,V);const Q=N.config.uvClamp?C.CLAMP_TO_EDGE:C.REPEAT;C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_S,Q),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_T,Q),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_MAG_FILTER,C.NEAREST),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_MIN_FILTER,C.NEAREST),this.buffers.textures[M]=I}}bindTextures(){const{gl:C}=this.app,M=this.app.gl.TEXTURE0,N=Object.entries(this.buffers.textures),I=[];return N.forEach(([V,Q],W)=>{const A=this.shader.mappings.uniforms[V];if(!A)return;C.activeTexture(M+W),C.bindTexture(C.TEXTURE_2D,Q),C.uniform1i(A,W),I.push(()=>{C.activeTexture(M+W),C.bindTexture(C.TEXTURE_2D,null)})}),I}bindAttrib(C,M,N,I,V=!1){const Q=this.app.gl;Q.bindBuffer(Q.ARRAY_BUFFER,C);const W=Number.isSafeInteger(M)?M:this.shader.attrib(M);if(W!==-1)Q.vertexAttribPointer(W,N,I,V,0,0),Q.enableVertexAttribArray(W);Q.bindBuffer(Q.ARRAY_BUFFER,null)}initializeShader(C,M){const N=w.invert(w.create(),this.camera.toMat4()),I=this.app.gl,{uniforms:V}=this.shader.mappings;this.shader.use(),I.uniform1f(V.time,C),I.uniform4fv(V.light0Color,[1,1,1,1]),I.uniformMatrix4fv(V.view,!1,N),I.uniformMatrix4fv(V.projection,!1,this.projectionMatrix),I.uniform3fv(V.light0,this.light.position),I.uniformMatrix4fv(V.objectToWorld,!1,M.toMat4()),I.uniformMatrix4fv(V.objectToWorldInv,!1,w.invert(w.create(),M.toMat4())),this.shader.onPrerender(this.app,C)}async onStart(C,M){M.loading("baking vectors"),M.telemetry?.addRenderers(1),M.telemetry?.addTriangles(this.mesh.config.faces.length),M.telemetry?.addVertexes(this.mesh.config.vertexCount),w.perspective(this.projectionMatrix,this.app.config.fov||45,this.app.aspect,this.app.config.zNear||0.1,this.app.config.zFar||100),this.shader.compile(),this.shader.link(),this.initializeBuffers(),this.shader.link(),await this.initializeTextures()}onRenderableUpdate(C,M){const N=this.app.gl;N.bindVertexArray(this.buffers.vao||null),N.bindBuffer(N.ELEMENT_ARRAY_BUFFER,this.buffers.faces||null),N.bindBuffer(N.ARRAY_BUFFER,this.buffers.position||null),this.initializeShader(C,M);const I=this.bindTextures();N.drawElements(this.config.drawMode??N.TRIANGLES,this.mesh.config.faces.length,this.faceDataType,0);const V=N.getError();if(V!==0)throw console.log({err:V}),new Error(`(MeshRenderer) webgl failure: ${V}`);N.bindVertexArray(null),N.bindBuffer(N.ELEMENT_ARRAY_BUFFER,null),N.bindBuffer(N.ARRAY_BUFFER,null),I.forEach((Q)=>Q())}}class d{C;static VERTEX=35633;static FRAGMENT=35632;constructor(C){this.config=C}vertexCode="";fragmentCode="";_app;program=null;mappings={};textures={};materialValues={};prerenderHooks=[];get gl(){const C=this._app?.gl;if(!C)throw new Error("GL context not defined at shader compile time.");return C}app(C){return this._app=C,this.program=C.gl.createProgram(),this}vertex(C){return this.vertexCode=C,this}fragment(C){return this.fragmentCode=C,this}prerenderHook(C){return this.prerenderHooks.push(C),this}attrib(C){return this.gl.getAttribLocation(this.program,C)}uniform(C){return this.gl.getUniformLocation(this.program,C)}generateMappings(C){return{attributes:{normal:this.attrib(C.attributes.normal),uv0:this.attrib(C.attributes.uv0),vertex:this.attrib(C.attributes.vertex),vertexColor:this.attrib(C.attributes.vertexColor)},uniforms:{albedo:this.uniform(C.uniforms.albedo),light0:this.uniform(C.uniforms.light0),light0Color:this.uniform(C.uniforms.light0Color),objectToWorld:this.uniform(C.uniforms.objectToWorld),objectToWorldInv:this.uniform(C.uniforms.objectToWorldInv),projection:this.uniform(C.uniforms.projection),texture0:this.uniform(C.uniforms.texture0),texture1:this.uniform(C.uniforms.texture1),texture2:this.uniform(C.uniforms.texture2),time:this.uniform(C.uniforms.time),view:this.uniform(C.uniforms.view)}}}attach(C,M){const N=this.gl,I=N.createShader(C);if(!I)throw new Error(`failed to init ${tM(C)} shader`);N.shaderSource(I,M),N.compileShader(I),N.attachShader(this.program,I)}addTexture(C,M){return this.textures[C]=M,this}compile(){const C=this.gl;this.attach(C.FRAGMENT_SHADER,this.fragmentCode),this.attach(C.VERTEX_SHADER,this.vertexCode)}link(){if(this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))throw new Error("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(this.program));this.mappings=this.generateMappings(this.config)}bindAttrib(C,M){this.gl.bindAttribLocation(this.program,C,M)}use(){this._app?.gl.useProgram(this.program)}onPrerender(C,M){for(let N of this.prerenderHooks)N(C,this,M)}}var tM=(C)=>{switch(C){case d.FRAGMENT:return"fragment";case d.VERTEX:return"vertex";default:return"some unknown type of"}};var s0=`#version 300 es +precision highp float;uniform sampler2D u_texture_0;uniform sampler2D u_texture_1;in vec2 uv0;in vec3 normal;in vec3 light_pos;out vec4 fragColor;void main(){vec4 normalTex=texture(u_texture_1,uv0);vec3 normal=normalize(normal*normalTex.xyz);float light=dot(normal,light_pos);fragColor=vec4(1.0);fragColor.rgb=texture(u_texture_0,uv0).rgb;fragColor.rgb*=max(light,0.1);fragColor.a=1.0;}`;var b=`#version 300 es +uniform mat4 u_view;uniform mat4 u_projection;uniform mat4 u_object_to_world;uniform mat4 u_object_to_world_inv;uniform vec3 u_light_0;in vec4 a_vertex;in vec2 a_uv0;in vec3 a_normal;in vec4 a_vertex_color;out vec2 uv0;out vec3 normal;out vec4 vertex_color;out vec3 light_pos;void main(){mat4 worldInv=inverse(u_view);mat4 MVW=u_projection*u_view*u_object_to_world;gl_Position=MVW*a_vertex;uv0=a_uv0;normal=normalize(mat3(worldInv)*a_normal);vertex_color=a_vertex_color;light_pos=normalize(mat3(u_object_to_world_inv)*u_light_0);}`;var N0={attributes:{vertex:"a_vertex",uv0:"a_uv0",normal:"a_normal",vertexColor:"a_vertex_color"},uniforms:{view:"u_view",projection:"u_projection",objectToWorld:"u_object_to_world",objectToWorldInv:"u_object_to_world_inv",light0:"u_light_0",light0Color:"u_light_0_color",time:"u_time",albedo:"u_albedo",texture0:"u_texture_0",texture1:"u_texture_1",texture2:"u_texture_2"}},TN=(C)=>new d(N0).vertex(b).fragment(s0).app(C);var m0=`#version 300 es +precision highp float;in vec4 vertex_color;out vec4 fragColor;void main(){fragColor=vertex_color;}`;class I0{C;constructor(C){this.config=C}get name(){return this.config.name}}var e0=new I0({colors:new Uint8Array([0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,0,254,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,254,0,0,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255,0,0,254,255]),faces:new Uint8Array([0,1,2,3,4,1,5,6,4,7,8,6,4,9,10,11,7,5,0,3,1,3,5,4,5,7,6,7,12,8,4,6,9,11,13,7,14,15,16,17,18,15,19,20,18,21,22,20,18,23,24,25,21,19,14,17,15,17,19,18,19,21,20,21,26,22,18,20,23,25,27,21,28,29,30,31,32,29,33,34,32,35,36,34,32,37,38,39,35,33,28,31,29,31,33,32,33,35,34,35,40,36,32,34,37,39,41,35]),name:"src/meshes/gizmo.ply",normals:new Float32Array([-0.057735033,0.5773503,-0.5773503,0.057735033,-0.5773503,-0.5773503,-0.057735033,-0.5773503,-0.5773503,0.057735033,0.5773503,-0.5773503,0.057735033,-0.5773503,0.5773503,0.057735033,0.5773503,0.5773503,-0.057735033,-0.5773503,0.5773503,-0.057735033,0.5773503,0.5773503,-0.057735033,-0.5773503,-0.5773503,-0.057735033,-0.5773503,-0.5773503,0.057735033,-0.5773503,-0.5773503,0.057735033,0.5773503,-0.5773503,-0.057735033,0.5773503,-0.5773503,-0.057735033,0.5773503,-0.5773503,-0.5773503,0.5773503,-0.057735033,0.5773503,-0.5773503,-0.057735033,-0.5773503,-0.5773503,-0.057735033,0.5773503,0.5773503,-0.057735033,0.5773503,-0.5773503,0.057735033,0.5773503,0.5773503,0.057735033,-0.5773503,-0.5773503,0.057735033,-0.5773503,0.5773503,0.057735033,-0.5773503,-0.5773503,-0.057735033,-0.5773503,-0.5773503,-0.057735033,0.5773503,-0.5773503,-0.057735033,0.5773503,0.5773503,-0.057735033,-0.5773503,0.5773503,-0.057735033,-0.5773503,0.5773503,-0.057735033,-0.5773503,0.057735033,-0.5773503,0.5773503,-0.057735033,-0.5773503,-0.5773503,-0.057735033,-0.5773503,0.5773503,0.057735033,-0.5773503,0.5773503,-0.057735033,0.5773503,0.5773503,0.057735033,0.5773503,-0.5773503,-0.057735033,0.5773503,-0.5773503,0.057735033,0.5773503,-0.5773503,-0.057735033,-0.5773503,-0.5773503,-0.057735033,-0.5773503,0.5773503,-0.057735033,-0.5773503,0.5773503,0.057735033,-0.5773503,-0.5773503,0.057735033,-0.5773503,-0.5773503,0.057735033,-0.5773503]),positions:new Float32Array([0,0.05,-0.05,1,-0.05,-0.05,0,-0.05,-0.05,1,0.05,-0.05,1,-0.05,0.05,1,0.05,0.05,0,-0.05,0.05,0,0.05,0.05,0,-0.05,-0.05,0,-0.05,-0.05,1,-0.05,-0.05,1,0.05,-0.05,0,0.05,-0.05,0,0.05,-0.05,-0.05,0.05,0,0.05,-0.05,0,-0.05,-0.05,0,0.05,0.05,0,0.05,-0.05,1,0.05,0.05,1,-0.05,-0.05,1,-0.05,0.05,1,-0.05,-0.05,0,-0.05,-0.05,0,0.05,-0.05,0,0.05,0.05,0,-0.05,0.05,0,-0.05,0.05,0,-0.05,1,-0.05,0.05,0,-0.05,-0.05,0,-0.05,0.05,1,-0.05,0.05,0,0.05,0.05,1,0.05,-0.05,0,0.05,-0.05,1,0.05,-0.05,0,-0.05,-0.05,0,-0.05,0.05,0,-0.05,0.05,1,-0.05,-0.05,1,-0.05,-0.05,1,-0.05]),uvs:new Float32Array([0.625,0,0.375,0.25,0.375,0,0.625,0.25,0.375,0.5,0.625,0.5,0.375,0.75,0.625,0.75,0.375,1,0.125,0.75,0.125,0.5,0.875,0.5,0.625,1,0.875,0.75,0.625,0,0.375,0.25,0.375,0,0.625,0.25,0.375,0.5,0.625,0.5,0.375,0.75,0.625,0.75,0.375,1,0.125,0.75,0.125,0.5,0.875,0.5,0.625,1,0.875,0.75,0.625,0,0.375,0.25,0.375,0,0.625,0.25,0.375,0.5,0.625,0.5,0.375,0.75,0.625,0.75,0.375,1,0.125,0.75,0.125,0.5,0.875,0.5,0.625,1,0.875,0.75]),vertexCount:42});var NN=(C)=>new d(N0).vertex(b).fragment(m0).app(C),b0=(C,M,N)=>{const I=new l(N?.position,N?.rotation),V=new M0(C,e0,NN(C),M).configure({});new V0(C,I,V)};class V0 extends g{C;M;N;constructor(C,M,N,I=!1){super(C);this.app=C;this.transform=M;this.renderer=N;if(I)b0(C,N.camera,M)}onDraw(C){this.renderer.onRenderableUpdate(C,this.transform)}}class Q0 extends g{constructor(){super(...arguments)}panes=[];addTransform(C,M){this.panes.push({name:C,type:"transform",onChange:M})}}class W0 extends g{C;el;frameTimes=[];maxFrameTimes=100;lastFrameTime=0;activeTriangles=0;activeVertexes=0;activeRenderers=0;activeTextures=0;constructor(C,M="#telemetry"){super(C);this.app=C;if(this.el=document.querySelector(M),this.el&&location.search.includes("telemetry"))this.el.style.display="block"}insertTime(C){if(this.frameTimes.push(C),this.frameTimes.length>this.maxFrameTimes)this.frameTimes.shift()}async onStart(){this.lastFrameTime=0,this.frameTimes=[],setTimeout(()=>this.setText(),0),setInterval(()=>{this.setText()},1001)}setText(){const C=this.frameTimes.reduce((N,I)=>N+I,0)/this.frameTimes.length,M=1000/C;this.el.innerHTML=`${M.toFixed(1)} FPS (${C.toFixed(3)} ms)
update :: b: ${this.app.registry.onBeforeUpdate.length} | u: ${this.app.registry.onUpdate.length} | a: ${this.app.registry.onAfterUpdate.length} | d: ${this.app.registry.onDraw.length}
render :: mr: ${this.activeRenderers} | v: ${this.activeVertexes} | t: ${this.activeTriangles}
others :: tex: ${this.activeTextures}`}onAfterUpdate(C){const M=C-this.lastFrameTime;this.insertTime(M),this.lastFrameTime=C}addTriangles(C){this.activeTriangles+=C}addVertexes(C){this.activeVertexes+=C}addRenderers(C){this.activeRenderers+=C}addTextures(C){this.activeTextures+=C}}class IN{C;canvas;telemetry;gl;editor;loadingMessages=new Set(["[noeidelon] [stage 2]"]);registry={onBeforeUpdate:[],onAfterUpdate:[],onUpdate:[],onStart:[],onDraw:[]};constructor(C={}){this.config=C;try{this.canvas=document.querySelector("canvas"),this.canvas.width=window.innerWidth,this.canvas.height=window.innerHeight;const M=this.canvas.getContext("webgl2");if(!M)throw new Error("Canvas was unable to get a webgl2 context");const N=this.gl=M;if(N.viewport(0,0,N.drawingBufferWidth,N.drawingBufferHeight),this.gl.getExtension("EXT_texture_filter_anisotropic"),location.search.includes("telemetry")||C.telemetry)this.telemetry=new W0(this);if(location.search.includes("editor")||C.editor)this.editor=new Q0(this)}catch(M){const N=document.querySelector("main");if(N)N.innerHTML="
your browser didn't let me set up webgl.
";throw new Error(`Unable to initialize WebGL. Your browser or machine may not support it.\n -> ${M}`)}}get aspect(){return this.canvas.clientWidth/this.canvas.clientHeight}clear(){const C=this.gl;C.clearColor(0,0,0,1),C.clearDepth(1),C.enable(C.DEPTH_TEST),C.depthFunc(C.LEQUAL),C.clear(C.COLOR_BUFFER_BIT|C.DEPTH_BUFFER_BIT)}loading(C){this.loadingMessages.add(C.toLowerCase()),document.querySelector("#loading-text").innerHTML=[...this.loadingMessages].join("
")}ready(){document.querySelector("#loading")?.classList.remove("loading-active")}onBeforeUpdate(C){this.registry.onBeforeUpdate.push(C)}onAfterUpdate(C){this.registry.onAfterUpdate.push(C)}onUpdate(C){this.registry.onUpdate.push(C)}onStart(C){this.registry.onStart.push(C)}onDraw(C){this.registry.onDraw.push(C)}doUpdate(C){this.registry.onBeforeUpdate.forEach((M)=>M(C,this)),this.registry.onUpdate.forEach((M)=>M(C,this)),this.registry.onAfterUpdate.forEach((M)=>M(C,this)),this.registry.onDraw.forEach((M)=>M(C,this))}async doStart(C=0){this.loading("setting launch parameters"),this.clear();try{for(let M of this.registry.onStart)await M(C,this)}catch(M){if(this.loading('[panic] failed to start noeidelon'),this.telemetry)this.loading(`${M}`);return}this.ready()}async oneShot(C=0){await this.doStart(C),this.doUpdate(C)}async start(){await this.doStart();const C=(M)=>{this.doUpdate(M),requestAnimationFrame(C)};requestAnimationFrame(C)}} +export{I0 as d,f as e,l as f,XN as g,YN as h,M0 as i,d as j,s0 as k,b as l,TN as m,V0 as n,IN as o}; diff --git a/html/chunk-13ea4b456137d650.js b/html/chunk-13ea4b456137d650.js new file mode 100644 index 0000000..cea0e87 --- /dev/null +++ b/html/chunk-13ea4b456137d650.js @@ -0,0 +1,5 @@ +class n{_;u;y;texture=null;width=0;height=0;constructor(_,u,y={}){this.app=_;this.url=u;this.config=y}setImage(_,u,y){return this.texture=_,this.width=u,this.height=y,this}async loadImage(){if(this.url==="manual"){if(this.texture===null)throw new Error("manual specified, but texture was not ready...");return}if(this.texture!==null)return;this.app.telemetry?.addTextures(-1),this.app.loading("Fetching textures...");const _=new Image;return new Promise((u,y)=>{_.onload=async()=>{this.texture=await createImageBitmap(_,{imageOrientation:"flipY"}),this.width=this.texture.width,this.height=this.texture.height,this.app.telemetry?.addTextures(2),u(void 0)},_.onerror=(f)=>{this.app.telemetry?.addTextures(1),y(new Error(`texture load of ${this.url} failed: ${f.toString()}`))},_.src=this.url})}}var q=`#version 300 es +uniform mat4 u_view;uniform mat4 u_projection;uniform mat4 u_object_to_world;uniform mat4 u_object_to_world_inv;uniform vec3 u_light_0;in vec4 a_vertex;in vec2 a_uv0;in vec3 a_normal;in vec4 a_vertex_color;out vec2 uv0;out vec3 normal;out vec4 vertex_color;out vec3 light_pos; +#define ROUNDING_FACTOR 230.0f +void main(){mat4 worldInv=inverse(u_view);mat4 MVW=u_projection*u_view*u_object_to_world;vec4 realPosition=MVW*a_vertex;realPosition.xyz=round(vec3(realPosition.xyz*ROUNDING_FACTOR))/ROUNDING_FACTOR;gl_Position=realPosition;uv0=a_uv0;normal=normalize(mat3(worldInv)*a_normal);vertex_color=a_vertex_color;light_pos=normalize(mat3(u_object_to_world_inv)*u_light_0);}`; +export{n as a,q as b}; diff --git a/html/chunk-652b721da622b7d9.js b/html/chunk-652b721da622b7d9.js deleted file mode 100644 index fca4509..0000000 --- a/html/chunk-652b721da622b7d9.js +++ /dev/null @@ -1,3366 +0,0 @@ -var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// node_modules/gl-matrix/esm/quat.js -var exports_quat = {}; -__export(exports_quat, { - str: () => { - { - return str2; - } - }, - squaredLength: () => { - { - return squaredLength3; - } - }, - sqrLen: () => { - { - return sqrLen2; - } - }, - sqlerp: () => { - { - return sqlerp; - } - }, - slerp: () => { - { - return slerp; - } - }, - setAxisAngle: () => { - { - return setAxisAngle; - } - }, - setAxes: () => { - { - return setAxes; - } - }, - set: () => { - { - return set3; - } - }, - scale: () => { - { - return scale3; - } - }, - rotationTo: () => { - { - return rotationTo; - } - }, - rotateZ: () => { - { - return rotateZ2; - } - }, - rotateY: () => { - { - return rotateY2; - } - }, - rotateX: () => { - { - return rotateX2; - } - }, - random: () => { - { - return random2; - } - }, - pow: () => { - { - return pow; - } - }, - normalize: () => { - { - return normalize3; - } - }, - multiply: () => { - { - return multiply2; - } - }, - mul: () => { - { - return mul2; - } - }, - ln: () => { - { - return ln; - } - }, - lerp: () => { - { - return lerp3; - } - }, - length: () => { - { - return length3; - } - }, - len: () => { - { - return len2; - } - }, - invert: () => { - { - return invert; - } - }, - identity: () => { - { - return identity; - } - }, - getAxisAngle: () => { - { - return getAxisAngle; - } - }, - getAngle: () => { - { - return getAngle; - } - }, - fromValues: () => { - { - return fromValues3; - } - }, - fromMat3: () => { - { - return fromMat3; - } - }, - fromEuler: () => { - { - return fromEuler; - } - }, - exp: () => { - { - return exp; - } - }, - exactEquals: () => { - { - return exactEquals3; - } - }, - equals: () => { - { - return equals3; - } - }, - dot: () => { - { - return dot3; - } - }, - create: () => { - { - return create4; - } - }, - copy: () => { - { - return copy3; - } - }, - conjugate: () => { - { - return conjugate; - } - }, - clone: () => { - { - return clone3; - } - }, - calculateW: () => { - { - return calculateW; - } - }, - add: () => { - { - return add3; - } - } -}); - -// node_modules/gl-matrix/esm/common.js -var EPSILON = 0.000001; -var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; -var RANDOM = Math.random; -var degree = Math.PI / 180; -if (!Math.hypot) - Math.hypot = function() { - var y = 0, i = arguments.length; - while (i--) { - y += arguments[i] * arguments[i]; - } - return Math.sqrt(y); - }; - -// node_modules/gl-matrix/esm/mat3.js -function create() { - var out = new ARRAY_TYPE(9); - if (ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; - } - out[0] = 1; - out[4] = 1; - out[8] = 1; - return out; -} - -// node_modules/gl-matrix/esm/vec3.js -var exports_vec3 = {}; -__export(exports_vec3, { - zero: () => { - { - return zero; - } - }, - transformQuat: () => { - { - return transformQuat; - } - }, - transformMat4: () => { - { - return transformMat4; - } - }, - transformMat3: () => { - { - return transformMat3; - } - }, - subtract: () => { - { - return subtract; - } - }, - sub: () => { - { - return sub; - } - }, - str: () => { - { - return str; - } - }, - squaredLength: () => { - { - return squaredLength; - } - }, - squaredDistance: () => { - { - return squaredDistance; - } - }, - sqrLen: () => { - { - return sqrLen; - } - }, - sqrDist: () => { - { - return sqrDist; - } - }, - set: () => { - { - return set; - } - }, - scaleAndAdd: () => { - { - return scaleAndAdd; - } - }, - scale: () => { - { - return scale; - } - }, - round: () => { - { - return round; - } - }, - rotateZ: () => { - { - return rotateZ; - } - }, - rotateY: () => { - { - return rotateY; - } - }, - rotateX: () => { - { - return rotateX; - } - }, - random: () => { - { - return random; - } - }, - normalize: () => { - { - return normalize; - } - }, - negate: () => { - { - return negate; - } - }, - multiply: () => { - { - return multiply; - } - }, - mul: () => { - { - return mul; - } - }, - min: () => { - { - return min; - } - }, - max: () => { - { - return max; - } - }, - lerp: () => { - { - return lerp; - } - }, - length: () => { - { - return length; - } - }, - len: () => { - { - return len; - } - }, - inverse: () => { - { - return inverse; - } - }, - hermite: () => { - { - return hermite; - } - }, - fromValues: () => { - { - return fromValues; - } - }, - forEach: () => { - { - return forEach; - } - }, - floor: () => { - { - return floor; - } - }, - exactEquals: () => { - { - return exactEquals; - } - }, - equals: () => { - { - return equals; - } - }, - dot: () => { - { - return dot; - } - }, - divide: () => { - { - return divide; - } - }, - div: () => { - { - return div; - } - }, - distance: () => { - { - return distance; - } - }, - dist: () => { - { - return dist; - } - }, - cross: () => { - { - return cross; - } - }, - create: () => { - { - return create2; - } - }, - copy: () => { - { - return copy; - } - }, - clone: () => { - { - return clone; - } - }, - ceil: () => { - { - return ceil; - } - }, - bezier: () => { - { - return bezier; - } - }, - angle: () => { - { - return angle; - } - }, - add: () => { - { - return add; - } - } -}); -function create2() { - var out = new ARRAY_TYPE(3); - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - return out; -} -function clone(a) { - var out = new ARRAY_TYPE(3); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return Math.hypot(x, y, z); -} -function fromValues(x, y, z) { - var out = new ARRAY_TYPE(3); - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function set(out, x, y, z) { - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - return out; -} -function scaleAndAdd(out, a, b, scale2) { - out[0] = a[0] + b[0] * scale2; - out[1] = a[1] + b[1] * scale2; - out[2] = a[2] + b[2] * scale2; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return Math.hypot(x, y, z); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return x * x + y * y + z * z; -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return x * x + y * y + z * z; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - return out; -} -function inverse(out, a) { - out[0] = 1 / a[0]; - out[1] = 1 / a[1]; - out[2] = 1 / a[2]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var len = x * x + y * y + z * z; - if (len > 0) { - len = 1 / Math.sqrt(len); - } - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cross(out, a, b) { - var ax = a[0], ay = a[1], az = a[2]; - var bx = b[0], by = b[1], bz = b[2]; - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - return out; -} -function hermite(out, a, b, c, d, t) { - var factorTimes2 = t * t; - var factor1 = factorTimes2 * (2 * t - 3) + 1; - var factor2 = factorTimes2 * (t - 2) + t; - var factor3 = factorTimes2 * (t - 1); - var factor4 = factorTimes2 * (3 - 2 * t); - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function bezier(out, a, b, c, d, t) { - var inverseFactor = 1 - t; - var inverseFactorTimesTwo = inverseFactor * inverseFactor; - var factorTimes2 = t * t; - var factor1 = inverseFactorTimesTwo * inverseFactor; - var factor2 = 3 * t * inverseFactorTimesTwo; - var factor3 = 3 * factorTimes2 * inverseFactor; - var factor4 = factorTimes2 * t; - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function random(out, scale2) { - scale2 = scale2 || 1; - var r = RANDOM() * 2 * Math.PI; - var z = RANDOM() * 2 - 1; - var zScale = Math.sqrt(1 - z * z) * scale2; - out[0] = Math.cos(r) * zScale; - out[1] = Math.sin(r) * zScale; - out[2] = z * scale2; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - var w = m[3] * x + m[7] * y + m[11] * z + m[15]; - w = w || 1; - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x * m[0] + y * m[3] + z * m[6]; - out[1] = x * m[1] + y * m[4] + z * m[7]; - out[2] = x * m[2] + y * m[5] + z * m[8]; - return out; -} -function transformQuat(out, a, q) { - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; - var x = a[0], y = a[1], z = a[2]; - var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x; - var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx; - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; - return out; -} -function rotateX(out, a, b, rad) { - var p = [], r = []; - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateY(out, a, b, rad) { - var p = [], r = []; - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateZ(out, a, b, rad) { - var p = [], r = []; - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function angle(a, b) { - var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b) / mag; - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - return out; -} -function str(a) { - return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2]; - var b0 = b[0], b1 = b[1], b2 = b[2]; - return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create2(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) { - stride = 3; - } - if (!offset) { - offset = 0; - } - if (count) { - l = Math.min(count * stride + offset, a.length); - } else { - l = a.length; - } - for (i = offset;i < l; i += stride) { - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - } - return a; - }; -}(); - -// node_modules/gl-matrix/esm/vec4.js -function create3() { - var out = new ARRAY_TYPE(4); - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - } - return out; -} -function clone2(a) { - var out = new ARRAY_TYPE(4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function fromValues2(x, y, z, w) { - var out = new ARRAY_TYPE(4); - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function copy2(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function set2(out, x, y, z, w) { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function add2(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - return out; -} -function scale2(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - return out; -} -function length2(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return Math.hypot(x, y, z, w); -} -function squaredLength2(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return x * x + y * y + z * z + w * w; -} -function normalize2(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - var len2 = x * x + y * y + z * z + w * w; - if (len2 > 0) { - len2 = 1 / Math.sqrt(len2); - } - out[0] = x * len2; - out[1] = y * len2; - out[2] = z * len2; - out[3] = w * len2; - return out; -} -function dot2(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; -} -function lerp2(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - var aw = a[3]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - out[3] = aw + t * (b[3] - aw); - return out; -} -function exactEquals2(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; -} -function equals2(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)); -} -var forEach2 = function() { - var vec = create3(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) { - stride = 4; - } - if (!offset) { - offset = 0; - } - if (count) { - l = Math.min(count * stride + offset, a.length); - } else { - l = a.length; - } - for (i = offset;i < l; i += stride) { - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - vec[3] = a[i + 3]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - a[i + 3] = vec[3]; - } - return a; - }; -}(); - -// node_modules/gl-matrix/esm/quat.js -function create4() { - var out = new ARRAY_TYPE(4); - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - out[3] = 1; - return out; -} -function identity(out) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; -} -function setAxisAngle(out, axis, rad) { - rad = rad * 0.5; - var s = Math.sin(rad); - out[0] = s * axis[0]; - out[1] = s * axis[1]; - out[2] = s * axis[2]; - out[3] = Math.cos(rad); - return out; -} -function getAxisAngle(out_axis, q) { - var rad = Math.acos(q[3]) * 2; - var s = Math.sin(rad / 2); - if (s > EPSILON) { - out_axis[0] = q[0] / s; - out_axis[1] = q[1] / s; - out_axis[2] = q[2] / s; - } else { - out_axis[0] = 1; - out_axis[1] = 0; - out_axis[2] = 0; - } - return rad; -} -function getAngle(a, b) { - var dotproduct = dot3(a, b); - return Math.acos(2 * dotproduct * dotproduct - 1); -} -function multiply2(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - out[0] = ax * bw + aw * bx + ay * bz - az * by; - out[1] = ay * bw + aw * by + az * bx - ax * bz; - out[2] = az * bw + aw * bz + ax * by - ay * bx; - out[3] = aw * bw - ax * bx - ay * by - az * bz; - return out; -} -function rotateX2(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + aw * bx; - out[1] = ay * bw + az * bx; - out[2] = az * bw - ay * bx; - out[3] = aw * bw - ax * bx; - return out; -} -function rotateY2(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var by = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw - az * by; - out[1] = ay * bw + aw * by; - out[2] = az * bw + ax * by; - out[3] = aw * bw - ay * by; - return out; -} -function rotateZ2(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bz = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + ay * bz; - out[1] = ay * bw - ax * bz; - out[2] = az * bw + aw * bz; - out[3] = aw * bw - az * bz; - return out; -} -function calculateW(out, a) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = Math.sqrt(Math.abs(1 - x * x - y * y - z * z)); - return out; -} -function exp(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var et = Math.exp(w); - var s = r > 0 ? et * Math.sin(r) / r : 0; - out[0] = x * s; - out[1] = y * s; - out[2] = z * s; - out[3] = et * Math.cos(r); - return out; -} -function ln(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var t = r > 0 ? Math.atan2(r, w) / r : 0; - out[0] = x * t; - out[1] = y * t; - out[2] = z * t; - out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); - return out; -} -function pow(out, a, b) { - ln(out, a); - scale3(out, out, b); - exp(out, out); - return out; -} -function slerp(out, a, b, t) { - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - var omega, cosom, sinom, scale0, scale1; - cosom = ax * bx + ay * by + az * bz + aw * bw; - if (cosom < 0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } - if (1 - cosom > EPSILON) { - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } else { - scale0 = 1 - t; - scale1 = t; - } - out[0] = scale0 * ax + scale1 * bx; - out[1] = scale0 * ay + scale1 * by; - out[2] = scale0 * az + scale1 * bz; - out[3] = scale0 * aw + scale1 * bw; - return out; -} -function random2(out) { - var u1 = RANDOM(); - var u2 = RANDOM(); - var u3 = RANDOM(); - var sqrt1MinusU1 = Math.sqrt(1 - u1); - var sqrtU1 = Math.sqrt(u1); - out[0] = sqrt1MinusU1 * Math.sin(2 * Math.PI * u2); - out[1] = sqrt1MinusU1 * Math.cos(2 * Math.PI * u2); - out[2] = sqrtU1 * Math.sin(2 * Math.PI * u3); - out[3] = sqrtU1 * Math.cos(2 * Math.PI * u3); - return out; -} -function invert(out, a) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var dot3 = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = dot3 ? 1 / dot3 : 0; - out[0] = -a0 * invDot; - out[1] = -a1 * invDot; - out[2] = -a2 * invDot; - out[3] = a3 * invDot; - return out; -} -function conjugate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a[3]; - return out; -} -function fromMat3(out, m) { - var fTrace = m[0] + m[4] + m[8]; - var fRoot; - if (fTrace > 0) { - fRoot = Math.sqrt(fTrace + 1); - out[3] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[0] = (m[5] - m[7]) * fRoot; - out[1] = (m[6] - m[2]) * fRoot; - out[2] = (m[1] - m[3]) * fRoot; - } else { - var i = 0; - if (m[4] > m[0]) - i = 1; - if (m[8] > m[i * 3 + i]) - i = 2; - var j = (i + 1) % 3; - var k = (i + 2) % 3; - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; - out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; - } - return out; -} -function fromEuler(out, x, y, z) { - var halfToRad = 0.5 * Math.PI / 180; - x *= halfToRad; - y *= halfToRad; - z *= halfToRad; - var sx = Math.sin(x); - var cx = Math.cos(x); - var sy = Math.sin(y); - var cy = Math.cos(y); - var sz = Math.sin(z); - var cz = Math.cos(z); - out[0] = sx * cy * cz - cx * sy * sz; - out[1] = cx * sy * cz + sx * cy * sz; - out[2] = cx * cy * sz - sx * sy * cz; - out[3] = cx * cy * cz + sx * sy * sz; - return out; -} -function str2(a) { - return "quat(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -var clone3 = clone2; -var fromValues3 = fromValues2; -var copy3 = copy2; -var set3 = set2; -var add3 = add2; -var mul2 = multiply2; -var scale3 = scale2; -var dot3 = dot2; -var lerp3 = lerp2; -var length3 = length2; -var len2 = length3; -var squaredLength3 = squaredLength2; -var sqrLen2 = squaredLength3; -var normalize3 = normalize2; -var exactEquals3 = exactEquals2; -var equals3 = equals2; -var rotationTo = function() { - var tmpvec3 = create2(); - var xUnitVec3 = fromValues(1, 0, 0); - var yUnitVec3 = fromValues(0, 1, 0); - return function(out, a, b) { - var dot4 = dot(a, b); - if (dot4 < -0.999999) { - cross(tmpvec3, xUnitVec3, a); - if (len(tmpvec3) < 0.000001) - cross(tmpvec3, yUnitVec3, a); - normalize(tmpvec3, tmpvec3); - setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot4 > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; - } else { - cross(tmpvec3, a, b); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot4; - return normalize3(out, out); - } - }; -}(); -var sqlerp = function() { - var temp1 = create4(); - var temp2 = create4(); - return function(out, a, b, c, d, t) { - slerp(temp1, a, d, t); - slerp(temp2, b, c, t); - slerp(out, temp1, temp2, 2 * t * (1 - t)); - return out; - }; -}(); -var setAxes = function() { - var matr = create(); - return function(out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - return normalize3(out, fromMat3(out, matr)); - }; -}(); - -// node_modules/gl-matrix/esm/mat4.js -var exports_mat4 = {}; -__export(exports_mat4, { - transpose: () => { - { - return transpose; - } - }, - translate: () => { - { - return translate; - } - }, - targetTo: () => { - { - return targetTo; - } - }, - subtract: () => { - { - return subtract2; - } - }, - sub: () => { - { - return sub2; - } - }, - str: () => { - { - return str3; - } - }, - set: () => { - { - return set4; - } - }, - scale: () => { - { - return scale4; - } - }, - rotateZ: () => { - { - return rotateZ3; - } - }, - rotateY: () => { - { - return rotateY3; - } - }, - rotateX: () => { - { - return rotateX3; - } - }, - rotate: () => { - { - return rotate; - } - }, - perspectiveZO: () => { - { - return perspectiveZO; - } - }, - perspectiveNO: () => { - { - return perspectiveNO; - } - }, - perspectiveFromFieldOfView: () => { - { - return perspectiveFromFieldOfView; - } - }, - perspective: () => { - { - return perspective; - } - }, - orthoZO: () => { - { - return orthoZO; - } - }, - orthoNO: () => { - { - return orthoNO; - } - }, - ortho: () => { - { - return ortho; - } - }, - multiplyScalarAndAdd: () => { - { - return multiplyScalarAndAdd; - } - }, - multiplyScalar: () => { - { - return multiplyScalar; - } - }, - multiply: () => { - { - return multiply3; - } - }, - mul: () => { - { - return mul3; - } - }, - lookAt: () => { - { - return lookAt; - } - }, - invert: () => { - { - return invert2; - } - }, - identity: () => { - { - return identity2; - } - }, - getTranslation: () => { - { - return getTranslation; - } - }, - getScaling: () => { - { - return getScaling; - } - }, - getRotation: () => { - { - return getRotation; - } - }, - frustum: () => { - { - return frustum; - } - }, - fromZRotation: () => { - { - return fromZRotation; - } - }, - fromYRotation: () => { - { - return fromYRotation; - } - }, - fromXRotation: () => { - { - return fromXRotation; - } - }, - fromValues: () => { - { - return fromValues4; - } - }, - fromTranslation: () => { - { - return fromTranslation; - } - }, - fromScaling: () => { - { - return fromScaling; - } - }, - fromRotationTranslationScaleOrigin: () => { - { - return fromRotationTranslationScaleOrigin; - } - }, - fromRotationTranslationScale: () => { - { - return fromRotationTranslationScale; - } - }, - fromRotationTranslation: () => { - { - return fromRotationTranslation; - } - }, - fromRotation: () => { - { - return fromRotation; - } - }, - fromQuat2: () => { - { - return fromQuat2; - } - }, - fromQuat: () => { - { - return fromQuat; - } - }, - frob: () => { - { - return frob; - } - }, - exactEquals: () => { - { - return exactEquals4; - } - }, - equals: () => { - { - return equals4; - } - }, - determinant: () => { - { - return determinant; - } - }, - create: () => { - { - return create5; - } - }, - copy: () => { - { - return copy4; - } - }, - clone: () => { - { - return clone4; - } - }, - adjoint: () => { - { - return adjoint; - } - }, - add: () => { - { - return add4; - } - } -}); -function create5() { - var out = new ARRAY_TYPE(16); - if (ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - } - out[0] = 1; - out[5] = 1; - out[10] = 1; - out[15] = 1; - return out; -} -function clone4(a) { - var out = new ARRAY_TYPE(16); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function copy4(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function fromValues4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - var out = new ARRAY_TYPE(16); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; -} -function set4(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; -} -function identity2(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function transpose(out, a) { - if (out === a) { - var a01 = a[1], a02 = a[2], a03 = a[3]; - var a12 = a[6], a13 = a[7]; - var a23 = a[11]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a01; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a02; - out[9] = a12; - out[11] = a[14]; - out[12] = a03; - out[13] = a13; - out[14] = a23; - } else { - out[0] = a[0]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a[1]; - out[5] = a[5]; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a[2]; - out[9] = a[6]; - out[10] = a[10]; - out[11] = a[14]; - out[12] = a[3]; - out[13] = a[7]; - out[14] = a[11]; - out[15] = a[15]; - } - return out; -} -function invert2(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) { - return null; - } - det = 1 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); - out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); - out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); - out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); - out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); - out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); - out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); - out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -} -function multiply3(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - return out; -} -function translate(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - if (a === out) { - out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - } else { - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a03; - out[4] = a10; - out[5] = a11; - out[6] = a12; - out[7] = a13; - out[8] = a20; - out[9] = a21; - out[10] = a22; - out[11] = a23; - out[12] = a00 * x + a10 * y + a20 * z + a[12]; - out[13] = a01 * x + a11 * y + a21 * z + a[13]; - out[14] = a02 * x + a12 * y + a22 * z + a[14]; - out[15] = a03 * x + a13 * y + a23 * z + a[15]; - } - return out; -} -function scale4(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - out[0] = a[0] * x; - out[1] = a[1] * x; - out[2] = a[2] * x; - out[3] = a[3] * x; - out[4] = a[4] * y; - out[5] = a[5] * y; - out[6] = a[6] * y; - out[7] = a[7] * y; - out[8] = a[8] * z; - out[9] = a[9] * z; - out[10] = a[10] * z; - out[11] = a[11] * z; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function rotate(out, a, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len3 = Math.hypot(x, y, z); - var s, c, t; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - var b00, b01, b02; - var b10, b11, b12; - var b20, b21, b22; - if (len3 < EPSILON) { - return null; - } - len3 = 1 / len3; - x *= len3; - y *= len3; - z *= len3; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; - b00 = x * x * t + c; - b01 = y * x * t + z * s; - b02 = z * x * t - y * s; - b10 = x * y * t - z * s; - b11 = y * y * t + c; - b12 = z * y * t + x * s; - b20 = x * z * t + y * s; - b21 = y * z * t - x * s; - b22 = z * z * t + c; - out[0] = a00 * b00 + a10 * b01 + a20 * b02; - out[1] = a01 * b00 + a11 * b01 + a21 * b02; - out[2] = a02 * b00 + a12 * b01 + a22 * b02; - out[3] = a03 * b00 + a13 * b01 + a23 * b02; - out[4] = a00 * b10 + a10 * b11 + a20 * b12; - out[5] = a01 * b10 + a11 * b11 + a21 * b12; - out[6] = a02 * b10 + a12 * b11 + a22 * b12; - out[7] = a03 * b10 + a13 * b11 + a23 * b12; - out[8] = a00 * b20 + a10 * b21 + a20 * b22; - out[9] = a01 * b20 + a11 * b21 + a21 * b22; - out[10] = a02 * b20 + a12 * b21 + a22 * b22; - out[11] = a03 * b20 + a13 * b21 + a23 * b22; - if (a !== out) { - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - return out; -} -function rotateX3(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - out[4] = a10 * c + a20 * s; - out[5] = a11 * c + a21 * s; - out[6] = a12 * c + a22 * s; - out[7] = a13 * c + a23 * s; - out[8] = a20 * c - a10 * s; - out[9] = a21 * c - a11 * s; - out[10] = a22 * c - a12 * s; - out[11] = a23 * c - a13 * s; - return out; -} -function rotateY3(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - out[0] = a00 * c - a20 * s; - out[1] = a01 * c - a21 * s; - out[2] = a02 * c - a22 * s; - out[3] = a03 * c - a23 * s; - out[8] = a00 * s + a20 * c; - out[9] = a01 * s + a21 * c; - out[10] = a02 * s + a22 * c; - out[11] = a03 * s + a23 * c; - return out; -} -function rotateZ3(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - if (a !== out) { - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - out[0] = a00 * c + a10 * s; - out[1] = a01 * c + a11 * s; - out[2] = a02 * c + a12 * s; - out[3] = a03 * c + a13 * s; - out[4] = a10 * c - a00 * s; - out[5] = a11 * c - a01 * s; - out[6] = a12 * c - a02 * s; - out[7] = a13 * c - a03 * s; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = v[1]; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = v[2]; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotation(out, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len3 = Math.hypot(x, y, z); - var s, c, t; - if (len3 < EPSILON) { - return null; - } - len3 = 1 / len3; - x *= len3; - y *= len3; - z *= len3; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; - out[0] = x * x * t + c; - out[1] = y * x * t + z * s; - out[2] = z * x * t - y * s; - out[3] = 0; - out[4] = x * y * t - z * s; - out[5] = y * y * t + c; - out[6] = z * y * t + x * s; - out[7] = 0; - out[8] = x * z * t + y * s; - out[9] = y * z * t - x * s; - out[10] = z * z * t + c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromXRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = c; - out[6] = s; - out[7] = 0; - out[8] = 0; - out[9] = -s; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromYRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - out[0] = c; - out[1] = 0; - out[2] = -s; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = s; - out[9] = 0; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromZRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = 0; - out[4] = -s; - out[5] = c; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotationTranslation(out, q, v) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromQuat2(out, a) { - var translation = new ARRAY_TYPE(3); - var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7]; - var magnitude = bx * bx + by * by + bz * bz + bw * bw; - if (magnitude > 0) { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; - } else { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; - } - fromRotationTranslation(out, a, translation); - return out; -} -function getTranslation(out, mat) { - out[0] = mat[12]; - out[1] = mat[13]; - out[2] = mat[14]; - return out; -} -function getScaling(out, mat) { - var m11 = mat[0]; - var m12 = mat[1]; - var m13 = mat[2]; - var m21 = mat[4]; - var m22 = mat[5]; - var m23 = mat[6]; - var m31 = mat[8]; - var m32 = mat[9]; - var m33 = mat[10]; - out[0] = Math.hypot(m11, m12, m13); - out[1] = Math.hypot(m21, m22, m23); - out[2] = Math.hypot(m31, m32, m33); - return out; -} -function getRotation(out, mat) { - var scaling = new ARRAY_TYPE(3); - getScaling(scaling, mat); - var is1 = 1 / scaling[0]; - var is2 = 1 / scaling[1]; - var is3 = 1 / scaling[2]; - var sm11 = mat[0] * is1; - var sm12 = mat[1] * is2; - var sm13 = mat[2] * is3; - var sm21 = mat[4] * is1; - var sm22 = mat[5] * is2; - var sm23 = mat[6] * is3; - var sm31 = mat[8] * is1; - var sm32 = mat[9] * is2; - var sm33 = mat[10] * is3; - var trace = sm11 + sm22 + sm33; - var S = 0; - if (trace > 0) { - S = Math.sqrt(trace + 1) * 2; - out[3] = 0.25 * S; - out[0] = (sm23 - sm32) / S; - out[1] = (sm31 - sm13) / S; - out[2] = (sm12 - sm21) / S; - } else if (sm11 > sm22 && sm11 > sm33) { - S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; - out[3] = (sm23 - sm32) / S; - out[0] = 0.25 * S; - out[1] = (sm12 + sm21) / S; - out[2] = (sm31 + sm13) / S; - } else if (sm22 > sm33) { - S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; - out[3] = (sm31 - sm13) / S; - out[0] = (sm12 + sm21) / S; - out[1] = 0.25 * S; - out[2] = (sm23 + sm32) / S; - } else { - S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; - out[3] = (sm12 - sm21) / S; - out[0] = (sm31 + sm13) / S; - out[1] = (sm23 + sm32) / S; - out[2] = 0.25 * S; - } - return out; -} -function fromRotationTranslationScale(out, q, v, s) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - out[0] = (1 - (yy + zz)) * sx; - out[1] = (xy + wz) * sx; - out[2] = (xz - wy) * sx; - out[3] = 0; - out[4] = (xy - wz) * sy; - out[5] = (1 - (xx + zz)) * sy; - out[6] = (yz + wx) * sy; - out[7] = 0; - out[8] = (xz + wy) * sz; - out[9] = (yz - wx) * sz; - out[10] = (1 - (xx + yy)) * sz; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromRotationTranslationScaleOrigin(out, q, v, s, o) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - var ox = o[0]; - var oy = o[1]; - var oz = o[2]; - var out0 = (1 - (yy + zz)) * sx; - var out1 = (xy + wz) * sx; - var out2 = (xz - wy) * sx; - var out4 = (xy - wz) * sy; - var out5 = (1 - (xx + zz)) * sy; - var out6 = (yz + wx) * sy; - var out8 = (xz + wy) * sz; - var out9 = (yz - wx) * sz; - var out10 = (1 - (xx + yy)) * sz; - out[0] = out0; - out[1] = out1; - out[2] = out2; - out[3] = 0; - out[4] = out4; - out[5] = out5; - out[6] = out6; - out[7] = 0; - out[8] = out8; - out[9] = out9; - out[10] = out10; - out[11] = 0; - out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); - out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); - out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); - out[15] = 1; - return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - yy - zz; - out[1] = yx + wz; - out[2] = zx - wy; - out[3] = 0; - out[4] = yx - wz; - out[5] = 1 - xx - zz; - out[6] = zy + wx; - out[7] = 0; - out[8] = zx + wy; - out[9] = zy - wx; - out[10] = 1 - xx - yy; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function frustum(out, left, right, bottom, top, near, far) { - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - out[0] = near * 2 * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = near * 2 * tb; - out[6] = 0; - out[7] = 0; - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = far * near * 2 * nf; - out[15] = 0; - return out; -} -function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = (far + near) * nf; - out[14] = 2 * far * near * nf; - } else { - out[10] = -1; - out[14] = -2 * near; - } - return out; -} -function perspectiveZO(out, fovy, aspect, near, far) { - var f = 1 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = far * nf; - out[14] = far * near * nf; - } else { - out[10] = -1; - out[14] = -near; - } - return out; -} -function perspectiveFromFieldOfView(out, fov, near, far) { - var upTan = Math.tan(fov.upDegrees * Math.PI / 180); - var downTan = Math.tan(fov.downDegrees * Math.PI / 180); - var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); - var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); - var xScale = 2 / (leftTan + rightTan); - var yScale = 2 / (upTan + downTan); - out[0] = xScale; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = yScale; - out[6] = 0; - out[7] = 0; - out[8] = -((leftTan - rightTan) * xScale * 0.5); - out[9] = (upTan - downTan) * yScale * 0.5; - out[10] = far / (near - far); - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = far * near / (near - far); - out[15] = 0; - return out; -} -function orthoNO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - return out; -} -function orthoZO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = near * nf; - out[15] = 1; - return out; -} -function lookAt(out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len3; - var eyex = eye[0]; - var eyey = eye[1]; - var eyez = eye[2]; - var upx = up[0]; - var upy = up[1]; - var upz = up[2]; - var centerx = center[0]; - var centery = center[1]; - var centerz = center[2]; - if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) { - return identity2(out); - } - z0 = eyex - centerx; - z1 = eyey - centery; - z2 = eyez - centerz; - len3 = 1 / Math.hypot(z0, z1, z2); - z0 *= len3; - z1 *= len3; - z2 *= len3; - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len3 = Math.hypot(x0, x1, x2); - if (!len3) { - x0 = 0; - x1 = 0; - x2 = 0; - } else { - len3 = 1 / len3; - x0 *= len3; - x1 *= len3; - x2 *= len3; - } - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - len3 = Math.hypot(y0, y1, y2); - if (!len3) { - y0 = 0; - y1 = 0; - y2 = 0; - } else { - len3 = 1 / len3; - y0 *= len3; - y1 *= len3; - y2 *= len3; - } - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - return out; -} -function targetTo(out, eye, target, up) { - var eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2]; - var z0 = eyex - target[0], z1 = eyey - target[1], z2 = eyez - target[2]; - var len3 = z0 * z0 + z1 * z1 + z2 * z2; - if (len3 > 0) { - len3 = 1 / Math.sqrt(len3); - z0 *= len3; - z1 *= len3; - z2 *= len3; - } - var x0 = upy * z2 - upz * z1, x1 = upz * z0 - upx * z2, x2 = upx * z1 - upy * z0; - len3 = x0 * x0 + x1 * x1 + x2 * x2; - if (len3 > 0) { - len3 = 1 / Math.sqrt(len3); - x0 *= len3; - x1 *= len3; - x2 *= len3; - } - out[0] = x0; - out[1] = x1; - out[2] = x2; - out[3] = 0; - out[4] = z1 * x2 - z2 * x1; - out[5] = z2 * x0 - z0 * x2; - out[6] = z0 * x1 - z1 * x0; - out[7] = 0; - out[8] = z0; - out[9] = z1; - out[10] = z2; - out[11] = 0; - out[12] = eyex; - out[13] = eyey; - out[14] = eyez; - out[15] = 1; - return out; -} -function str3(a) { - return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); -} -function add4(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - out[9] = a[9] + b[9]; - out[10] = a[10] + b[10]; - out[11] = a[11] + b[11]; - out[12] = a[12] + b[12]; - out[13] = a[13] + b[13]; - out[14] = a[14] + b[14]; - out[15] = a[15] + b[15]; - return out; -} -function subtract2(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - out[9] = a[9] - b[9]; - out[10] = a[10] - b[10]; - out[11] = a[11] - b[11]; - out[12] = a[12] - b[12]; - out[13] = a[13] - b[13]; - out[14] = a[14] - b[14]; - out[15] = a[15] - b[15]; - return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - out[9] = a[9] * b; - out[10] = a[10] * b; - out[11] = a[11] * b; - out[12] = a[12] * b; - out[13] = a[13] * b; - out[14] = a[14] * b; - out[15] = a[15] * b; - return out; -} -function multiplyScalarAndAdd(out, a, b, scale5) { - out[0] = a[0] + b[0] * scale5; - out[1] = a[1] + b[1] * scale5; - out[2] = a[2] + b[2] * scale5; - out[3] = a[3] + b[3] * scale5; - out[4] = a[4] + b[4] * scale5; - out[5] = a[5] + b[5] * scale5; - out[6] = a[6] + b[6] * scale5; - out[7] = a[7] + b[7] * scale5; - out[8] = a[8] + b[8] * scale5; - out[9] = a[9] + b[9] * scale5; - out[10] = a[10] + b[10] * scale5; - out[11] = a[11] + b[11] * scale5; - out[12] = a[12] + b[12] * scale5; - out[13] = a[13] + b[13] * scale5; - out[14] = a[14] + b[14] * scale5; - out[15] = a[15] + b[15] * scale5; - return out; -} -function exactEquals4(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; -} -function equals4(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7]; - var a8 = a[8], a9 = a[9], a10 = a[10], a11 = a[11]; - var a12 = a[12], a13 = a[13], a14 = a[14], a15 = a[15]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - var b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7]; - var b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11]; - var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; - return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); -} -var perspective = perspectiveNO; -var ortho = orthoNO; -var mul3 = multiply3; -var sub2 = subtract2; - -// src/renderer/transform.ts -class Transform { - position; - rotation; - scale5; - constructor(position = exports_vec3.create(), rotation = exports_quat.create(), scale5 = exports_vec3.fromValues(1, 1, 1)) { - this.position = position; - this.rotation = rotation; - this.scale = scale5; - } - rotateEuler(x, y, z) { - exports_quat.fromEuler(this.rotation, x, y, z); - return this; - } - toMat4() { - const mat = exports_mat4.create(); - exports_mat4.fromRotationTranslationScale(mat, this.rotation, this.position, this.scale); - return mat; - } -} -var etoq = (v3) => exports_quat.fromEuler(exports_quat.create(), v3[0], v3[1], v3[2]); -var v3 = (v) => [v, v, v]; - -// src/renderer/behavior.ts -class Behavior { - app; - constructor(app) { - this.app = app; - this.onStart && app.onStart(this.onStart.bind(this)); - this.onUpdate && app.onUpdate(this.onUpdate.bind(this)); - this.onAfterUpdate && app.onAfterUpdate(this.onAfterUpdate.bind(this)); - this.onBeforeUpdate && app.onBeforeUpdate(this.onBeforeUpdate.bind(this)); - this.onDraw && app.onDraw(this.onDraw.bind(this)); - } -} - -// src/renderer/mesh-renderer.ts -class MeshRenderer extends Behavior { - app; - mesh; - shader; - camera; - light; - config; - projectionMatrix = exports_mat4.create(); - buffers = { textures: {} }; - faceDataType; - colorDataType; - constructor(app, mesh, shader, camera = new Transform([0, 0, -6]), light = new Transform([100, 100, 0]), config = {}) { - super(app); - this.app = app; - this.mesh = mesh; - this.shader = shader; - this.camera = camera; - this.light = light; - this.config = config; - this.faceDataType = this.getDataType(mesh.config.faces); - this.colorDataType = mesh.config.colors ? this.getDataType(mesh.config.colors) : null; - } - getDataType(array) { - switch (array.BYTES_PER_ELEMENT) { - case 1: - return 5121; - case 2: - return 5123; - case 4: - return 5125; - default: - return 5126; - } - } - configure(config) { - this.config = config; - return this; - } - makeBuffer(data, target = 34962) { - const gl = this.app.gl; - const buffer = gl.createBuffer(); - if (!buffer) { - throw new Error("failed to create a buffer"); - } - gl.bindBuffer(target, buffer); - gl.bufferData(target, data, gl.STATIC_DRAW); - gl.bindBuffer(target, null); - return buffer; - } - initializeBuffers() { - const vao = this.app.gl.createVertexArray(); - if (!vao) { - throw new Error("VAO creation failed"); - } - this.buffers.vao = vao; - this.app.gl.bindVertexArray(vao); - this.buffers.faces = this.makeBuffer(this.mesh.config.faces, this.app.gl.ELEMENT_ARRAY_BUFFER); - const shaderMap = this.shader.mappings; - this.buffers.position = this.makeBuffer(this.mesh.config.positions); - this.bindAttrib(this.buffers.position, shaderMap.attributes.vertex, 3, this.app.gl.FLOAT); - if (this.mesh.config.normals) { - this.buffers.normal = this.makeBuffer(this.mesh.config.normals); - this.bindAttrib(this.buffers.normal, shaderMap.attributes.normal, 3, this.app.gl.FLOAT, true); - } - if (this.mesh.config.colors) { - this.buffers.color = this.makeBuffer(this.mesh.config.colors); - this.bindAttrib(this.buffers.color, shaderMap.attributes.vertexColor, 4, this.colorDataType || this.app.gl.UNSIGNED_BYTE); - } - if (this.mesh.config.uvs) { - this.buffers.uv = this.makeBuffer(this.mesh.config.uvs); - this.bindAttrib(this.buffers.uv, shaderMap.attributes.uv0, 2, this.app.gl.FLOAT); - } - this.app.gl.bindVertexArray(null); - } - async initializeTextures() { - const { gl } = this.app; - for (const [name, textureObject] of Object.entries(this.shader.textures)) { - await textureObject.loadImage(); - const glTex = gl.createTexture(); - if (!glTex) { - throw new Error("failed to allocate texture"); - } - const tex = textureObject.texture; - gl.bindTexture(gl.TEXTURE_2D, glTex); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, textureObject.width, textureObject.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, tex); - const uvOverflow = textureObject.config.uvClamp ? gl.CLAMP_TO_EDGE : gl.REPEAT; - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, uvOverflow); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, uvOverflow); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - this.buffers.textures[name] = glTex; - } - } - bindTextures() { - const { gl } = this.app; - const intStart = this.app.gl.TEXTURE0; - const textures = Object.entries(this.buffers.textures); - const destructors = []; - textures.forEach(([key, tex], index) => { - const uniform = this.shader.mappings.uniforms[key]; - if (!uniform) { - return; - } - gl.activeTexture(intStart + index); - gl.bindTexture(gl.TEXTURE_2D, tex); - gl.uniform1i(uniform, index); - destructors.push(() => { - gl.activeTexture(intStart + index); - gl.bindTexture(gl.TEXTURE_2D, null); - }); - }); - return destructors; - } - bindAttrib(buffer, attribute, elements, glType, normalized = false) { - const gl = this.app.gl; - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - const attributePosition = Number.isSafeInteger(attribute) ? attribute : this.shader.attrib(attribute); - if (attributePosition !== -1) { - gl.vertexAttribPointer(attributePosition, elements, glType, normalized, 0, 0); - gl.enableVertexAttribArray(attributePosition); - } - gl.bindBuffer(gl.ARRAY_BUFFER, null); - } - initializeShader(time, transform2) { - const view = exports_mat4.invert(exports_mat4.create(), this.camera.toMat4()); - const gl = this.app.gl; - const { uniforms } = this.shader.mappings; - this.shader.use(); - gl.uniform1f(uniforms.time, time); - gl.uniform4fv(uniforms.light0Color, [1, 1, 1, 1]); - gl.uniformMatrix4fv(uniforms.view, false, view); - gl.uniformMatrix4fv(uniforms.projection, false, this.projectionMatrix); - gl.uniform3fv(uniforms.light0, this.light.position); - gl.uniformMatrix4fv(uniforms.objectToWorld, false, transform2.toMat4()); - gl.uniformMatrix4fv(uniforms.objectToWorldInv, false, exports_mat4.invert(exports_mat4.create(), transform2.toMat4())); - this.shader.onPrerender(this.app, time); - } - async onStart(_, app) { - app.loading("baking vectors"); - app.telemetry?.addRenderers(1); - app.telemetry?.addTriangles(this.mesh.config.faces.length); - app.telemetry?.addVertexes(this.mesh.config.vertexCount); - exports_mat4.perspective(this.projectionMatrix, this.app.config.fov || 45, this.app.aspect, this.app.config.zNear || 0.1, this.app.config.zFar || 100); - this.shader.compile(); - this.shader.link(); - this.initializeBuffers(); - this.shader.link(); - await this.initializeTextures(); - } - onRenderableUpdate(time, transform2) { - const gl = this.app.gl; - gl.bindVertexArray(this.buffers.vao || null); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.buffers.faces || null); - gl.bindBuffer(gl.ARRAY_BUFFER, this.buffers.position || null); - this.initializeShader(time, transform2); - const textureDestructors = this.bindTextures(); - gl.drawElements(this.config.drawMode ?? gl.TRIANGLES, this.mesh.config.faces.length, this.faceDataType, 0); - const err = gl.getError(); - if (err !== 0) { - console.log({ err }); - throw new Error(`(MeshRenderer) webgl failure: ${err}`); - } - gl.bindVertexArray(null); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); - gl.bindBuffer(gl.ARRAY_BUFFER, null); - textureDestructors.forEach((i) => i()); - } -} - -// src/renderer/shader.ts -class Shader { - config; - static VERTEX = 35633; - static FRAGMENT = 35632; - constructor(config) { - this.config = config; - } - vertexCode = ""; - fragmentCode = ""; - _app; - program = null; - mappings = {}; - textures = {}; - materialValues = {}; - prerenderHooks = []; - get gl() { - const gl = this._app?.gl; - if (!gl) { - throw new Error("GL context not defined at shader compile time."); - } - return gl; - } - app(app) { - this._app = app; - this.program = app.gl.createProgram(); - return this; - } - vertex(code) { - this.vertexCode = code; - return this; - } - fragment(code) { - this.fragmentCode = code; - return this; - } - prerenderHook(fn) { - this.prerenderHooks.push(fn); - return this; - } - attrib(name) { - return this.gl.getAttribLocation(this.program, name); - } - uniform(name) { - return this.gl.getUniformLocation(this.program, name); - } - generateMappings(config) { - return { - attributes: { - normal: this.attrib(config.attributes.normal), - uv0: this.attrib(config.attributes.uv0), - vertex: this.attrib(config.attributes.vertex), - vertexColor: this.attrib(config.attributes.vertexColor) - }, - uniforms: { - albedo: this.uniform(config.uniforms.albedo), - light0: this.uniform(config.uniforms.light0), - light0Color: this.uniform(config.uniforms.light0Color), - objectToWorld: this.uniform(config.uniforms.objectToWorld), - objectToWorldInv: this.uniform(config.uniforms.objectToWorldInv), - projection: this.uniform(config.uniforms.projection), - texture0: this.uniform(config.uniforms.texture0), - texture1: this.uniform(config.uniforms.texture1), - texture2: this.uniform(config.uniforms.texture2), - time: this.uniform(config.uniforms.time), - view: this.uniform(config.uniforms.view) - } - }; - } - attach(which, source) { - const gl = this.gl; - const shader = gl.createShader(which); - if (!shader) { - throw new Error(`failed to init ${humanShaderType(which)} shader`); - } - gl.shaderSource(shader, source); - gl.compileShader(shader); - gl.attachShader(this.program, shader); - } - addTexture(slot, texture) { - this.textures[slot] = texture; - return this; - } - compile() { - const gl = this.gl; - this.attach(gl.FRAGMENT_SHADER, this.fragmentCode); - this.attach(gl.VERTEX_SHADER, this.vertexCode); - } - link() { - this.gl.linkProgram(this.program); - if (!this.gl.getProgramParameter(this.program, this.gl.LINK_STATUS)) { - throw new Error("Unable to initialize the shader program: " + this.gl.getProgramInfoLog(this.program)); - } - this.mappings = this.generateMappings(this.config); - } - bindAttrib(attribLocation, name) { - this.gl.bindAttribLocation(this.program, attribLocation, name); - } - use() { - this._app?.gl.useProgram(this.program); - } - onPrerender(app, time) { - for (const fn of this.prerenderHooks) { - fn(app, this, time); - } - } -} -var humanShaderType = (which) => { - switch (which) { - case Shader.FRAGMENT: - return "fragment"; - case Shader.VERTEX: - return "vertex"; - default: - return "some unknown type of"; - } -}; - -// src/common-shaders/basic.frag -var basic_default = `#version 300 es -precision highp float; - -// uniform mat4 u_view; -// uniform mat4 u_projection; -// uniform mat4 u_object_to_world; -// uniform mat4 u_object_to_world_inv; -// uniform vec3 u_light_0; -// uniform vec4 u_light_0_color; -// uniform float u_time; -// uniform vec4 u_albedo; - -uniform sampler2D u_texture_0; -uniform sampler2D u_texture_1; - -in vec2 uv0; -in vec3 normal; -in vec3 light_pos; - -out vec4 fragColor; - -void main() { - vec4 normalTex = texture(u_texture_1, uv0); - vec3 normal = normalize(normal * normalTex.xyz); - - float light = dot(normal, light_pos); - - fragColor = vec4(1.0); - fragColor.rgb = texture(u_texture_0, uv0).rgb; - fragColor.rgb *= max(light, 0.1); - fragColor.a = 1.0; -} -`; - -// src/common-shaders/basic.vert -var basic_default2 = `#version 300 es -uniform mat4 u_view; -uniform mat4 u_projection; -uniform mat4 u_object_to_world; -uniform mat4 u_object_to_world_inv; -uniform vec3 u_light_0; -// uniform vec4 u_light_0_color; -// uniform float u_time; -// uniform vec4 u_albedo; - -in vec4 a_vertex; -in vec2 a_uv0; -in vec3 a_normal; -in vec4 a_vertex_color; - -out vec2 uv0; -out vec3 normal; -out vec4 vertex_color; -out vec3 light_pos; - -// injection point 1 - -void main() { - mat4 worldInv = inverse(u_view); - mat4 MVW = u_projection * u_view * u_object_to_world; - gl_Position = MVW * a_vertex; - - uv0 = a_uv0; - normal = normalize(mat3(worldInv) * a_normal); - vertex_color = a_vertex_color; - light_pos = normalize(mat3(u_object_to_world_inv) * u_light_0); - - // injection point 2 -}`; - -// src/common-shaders/basic.ts -var basicShaderConfig = { - attributes: { - vertex: "a_vertex", - uv0: "a_uv0", - normal: "a_normal", - vertexColor: "a_vertex_color" - }, - uniforms: { - view: "u_view", - projection: "u_projection", - objectToWorld: "u_object_to_world", - objectToWorldInv: "u_object_to_world_inv", - light0: "u_light_0", - light0Color: "u_light_0_color", - time: "u_time", - albedo: "u_albedo", - texture0: "u_texture_0", - texture1: "u_texture_1", - texture2: "u_texture_2" - } -}; -var basic3 = (app) => new Shader(basicShaderConfig).vertex(basic_default2).fragment(basic_default).app(app); - -// src/common-shaders/vertex-colors.frag -var vertex_colors_default = `#version 300 es -precision highp float; - -in vec4 vertex_color; - -out vec4 fragColor; - - -void main() { - fragColor = vertex_color; -} -`; - -// src/renderer/mesh.ts -class Mesh { - config; - constructor(config) { - this.config = config; - } - get name() { - return this.config.name; - } -} - -// src/meshes/gizmo.ts -var gizmo_default = new Mesh({ - colors: new Uint8Array([0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 0, 254, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 254, 0, 0, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255, 0, 0, 254, 255]), - faces: new Uint8Array([0, 1, 2, 3, 4, 1, 5, 6, 4, 7, 8, 6, 4, 9, 10, 11, 7, 5, 0, 3, 1, 3, 5, 4, 5, 7, 6, 7, 12, 8, 4, 6, 9, 11, 13, 7, 14, 15, 16, 17, 18, 15, 19, 20, 18, 21, 22, 20, 18, 23, 24, 25, 21, 19, 14, 17, 15, 17, 19, 18, 19, 21, 20, 21, 26, 22, 18, 20, 23, 25, 27, 21, 28, 29, 30, 31, 32, 29, 33, 34, 32, 35, 36, 34, 32, 37, 38, 39, 35, 33, 28, 31, 29, 31, 33, 32, 33, 35, 34, 35, 40, 36, 32, 34, 37, 39, 41, 35]), - name: "src/meshes/gizmo.ply", - normals: new Float32Array([-0.057735033, 0.5773503, -0.5773503, 0.057735033, -0.5773503, -0.5773503, -0.057735033, -0.5773503, -0.5773503, 0.057735033, 0.5773503, -0.5773503, 0.057735033, -0.5773503, 0.5773503, 0.057735033, 0.5773503, 0.5773503, -0.057735033, -0.5773503, 0.5773503, -0.057735033, 0.5773503, 0.5773503, -0.057735033, -0.5773503, -0.5773503, -0.057735033, -0.5773503, -0.5773503, 0.057735033, -0.5773503, -0.5773503, 0.057735033, 0.5773503, -0.5773503, -0.057735033, 0.5773503, -0.5773503, -0.057735033, 0.5773503, -0.5773503, -0.5773503, 0.5773503, -0.057735033, 0.5773503, -0.5773503, -0.057735033, -0.5773503, -0.5773503, -0.057735033, 0.5773503, 0.5773503, -0.057735033, 0.5773503, -0.5773503, 0.057735033, 0.5773503, 0.5773503, 0.057735033, -0.5773503, -0.5773503, 0.057735033, -0.5773503, 0.5773503, 0.057735033, -0.5773503, -0.5773503, -0.057735033, -0.5773503, -0.5773503, -0.057735033, 0.5773503, -0.5773503, -0.057735033, 0.5773503, 0.5773503, -0.057735033, -0.5773503, 0.5773503, -0.057735033, -0.5773503, 0.5773503, -0.057735033, -0.5773503, 0.057735033, -0.5773503, 0.5773503, -0.057735033, -0.5773503, -0.5773503, -0.057735033, -0.5773503, 0.5773503, 0.057735033, -0.5773503, 0.5773503, -0.057735033, 0.5773503, 0.5773503, 0.057735033, 0.5773503, -0.5773503, -0.057735033, 0.5773503, -0.5773503, 0.057735033, 0.5773503, -0.5773503, -0.057735033, -0.5773503, -0.5773503, -0.057735033, -0.5773503, 0.5773503, -0.057735033, -0.5773503, 0.5773503, 0.057735033, -0.5773503, -0.5773503, 0.057735033, -0.5773503, -0.5773503, 0.057735033, -0.5773503]), - positions: new Float32Array([0, 0.05, -0.05, 1, -0.05, -0.05, 0, -0.05, -0.05, 1, 0.05, -0.05, 1, -0.05, 0.05, 1, 0.05, 0.05, 0, -0.05, 0.05, 0, 0.05, 0.05, 0, -0.05, -0.05, 0, -0.05, -0.05, 1, -0.05, -0.05, 1, 0.05, -0.05, 0, 0.05, -0.05, 0, 0.05, -0.05, -0.05, 0.05, 0, 0.05, -0.05, 0, -0.05, -0.05, 0, 0.05, 0.05, 0, 0.05, -0.05, 1, 0.05, 0.05, 1, -0.05, -0.05, 1, -0.05, 0.05, 1, -0.05, -0.05, 0, -0.05, -0.05, 0, 0.05, -0.05, 0, 0.05, 0.05, 0, -0.05, 0.05, 0, -0.05, 0.05, 0, -0.05, 1, -0.05, 0.05, 0, -0.05, -0.05, 0, -0.05, 0.05, 1, -0.05, 0.05, 0, 0.05, 0.05, 1, 0.05, -0.05, 0, 0.05, -0.05, 1, 0.05, -0.05, 0, -0.05, -0.05, 0, -0.05, 0.05, 0, -0.05, 0.05, 1, -0.05, -0.05, 1, -0.05, -0.05, 1, -0.05]), - uvs: new Float32Array([0.625, 0, 0.375, 0.25, 0.375, 0, 0.625, 0.25, 0.375, 0.5, 0.625, 0.5, 0.375, 0.75, 0.625, 0.75, 0.375, 1, 0.125, 0.75, 0.125, 0.5, 0.875, 0.5, 0.625, 1, 0.875, 0.75, 0.625, 0, 0.375, 0.25, 0.375, 0, 0.625, 0.25, 0.375, 0.5, 0.625, 0.5, 0.375, 0.75, 0.625, 0.75, 0.375, 1, 0.125, 0.75, 0.125, 0.5, 0.875, 0.5, 0.625, 1, 0.875, 0.75, 0.625, 0, 0.375, 0.25, 0.375, 0, 0.625, 0.25, 0.375, 0.5, 0.625, 0.5, 0.375, 0.75, 0.625, 0.75, 0.375, 1, 0.125, 0.75, 0.125, 0.5, 0.875, 0.5, 0.625, 1, 0.875, 0.75]), - vertexCount: 42 -}); - -// src/renderer/gizmo.ts -var gizmoShader = (app) => new Shader(basicShaderConfig).vertex(basic_default2).fragment(vertex_colors_default).app(app); -var createGizmo = (app, camera, transform3) => { - const localTransform = new Transform(transform3?.position, transform3?.rotation); - const mr = new MeshRenderer(app, gizmo_default, gizmoShader(app), camera).configure({}); - new Renderable(app, localTransform, mr); -}; - -// src/renderer/renderable.ts -class Renderable extends Behavior { - app; - transform3; - renderer; - constructor(app, transform3, renderer, enableGizmo = false) { - super(app); - this.app = app; - this.transform = transform3; - this.renderer = renderer; - if (enableGizmo) - createGizmo(app, renderer.camera, transform3); - } - onDraw(time) { - this.renderer.onRenderableUpdate(time, this.transform); - } -} - -// src/renderer/editor.ts -class Editor extends Behavior { - constructor() { - super(...arguments); - } - panes = []; - addTransform(name, onChange) { - this.panes.push({ name, type: "transform", onChange }); - } -} - -// src/renderer/telemetry.ts -class Telemetry extends Behavior { - app; - el; - frameTimes = []; - maxFrameTimes = 100; - lastFrameTime = 0; - activeTriangles = 0; - activeVertexes = 0; - activeRenderers = 0; - activeTextures = 0; - constructor(app, selector = "#telemetry") { - super(app); - this.app = app; - this.el = document.querySelector(selector); - if (this.el && location.search.includes("telemetry")) { - this.el.style.display = "block"; - } - } - insertTime(time) { - this.frameTimes.push(time); - if (this.frameTimes.length > this.maxFrameTimes) { - this.frameTimes.shift(); - } - } - async onStart() { - this.lastFrameTime = 0; - this.frameTimes = []; - setTimeout(() => this.setText(), 0); - setInterval(() => { - this.setText(); - }, 1001); - } - setText() { - const averageFrameTime = this.frameTimes.reduce((a, b) => a + b, 0) / this.frameTimes.length; - const framesPerSecond = 1000 / averageFrameTime; - this.el.innerHTML = `${framesPerSecond.toFixed(1)} FPS (${averageFrameTime.toFixed(3)} ms)
update :: b: ${this.app.registry.onBeforeUpdate.length} | u: ${this.app.registry.onUpdate.length} | a: ${this.app.registry.onAfterUpdate.length} | d: ${this.app.registry.onDraw.length}
render :: mr: ${this.activeRenderers} | v: ${this.activeVertexes} | t: ${this.activeTriangles}
others :: tex: ${this.activeTextures}`; - } - onAfterUpdate(time) { - const frameTime = time - this.lastFrameTime; - this.insertTime(frameTime); - this.lastFrameTime = time; - } - addTriangles(n) { - this.activeTriangles += n; - } - addVertexes(n) { - this.activeVertexes += n; - } - addRenderers(n) { - this.activeRenderers += n; - } - addTextures(n) { - this.activeTextures += n; - } -} - -// src/renderer/webgl.ts -class WebGLApp { - config; - canvas; - telemetry; - gl; - editor; - loadingMessages = new Set(["[noeidelon] [stage 2]"]); - registry = { - onBeforeUpdate: [], - onAfterUpdate: [], - onUpdate: [], - onStart: [], - onDraw: [] - }; - constructor(config = {}) { - this.config = config; - try { - this.canvas = document.querySelector("canvas"); - this.canvas.width = window.innerWidth; - this.canvas.height = window.innerHeight; - const context = this.canvas.getContext("webgl2"); - if (!context) { - throw new Error("Canvas was unable to get a webgl2 context"); - } - const gl = this.gl = context; - gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); - this.gl.getExtension("EXT_texture_filter_anisotropic"); - if (location.search.includes("telemetry") || config.telemetry) { - this.telemetry = new Telemetry(this); - } - if (location.search.includes("editor") || config.editor) { - this.editor = new Editor(this); - } - } catch (e) { - const main = document.querySelector("main"); - if (main) { - main.innerHTML = `
your browser didn't let me set up webgl.
`; - } - throw new Error(`Unable to initialize WebGL. Your browser or machine may not support it.\n -> ${e}`); - } - } - get aspect() { - return this.canvas.clientWidth / this.canvas.clientHeight; - } - clear() { - const gl = this.gl; - gl.clearColor(0, 0, 0, 1); - gl.clearDepth(1); - gl.enable(gl.DEPTH_TEST); - gl.depthFunc(gl.LEQUAL); - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); - } - loading(message) { - this.loadingMessages.add(message.toLowerCase()); - document.querySelector("#loading-text").innerHTML = [ - ...this.loadingMessages - ].join("
"); - } - ready() { - document.querySelector("#loading")?.classList.remove("loading-active"); - } - onBeforeUpdate(handle) { - this.registry.onBeforeUpdate.push(handle); - } - onAfterUpdate(handle) { - this.registry.onAfterUpdate.push(handle); - } - onUpdate(handle) { - this.registry.onUpdate.push(handle); - } - onStart(handle) { - this.registry.onStart.push(handle); - } - onDraw(handle) { - this.registry.onDraw.push(handle); - } - doUpdate(time) { - this.registry.onBeforeUpdate.forEach((handle) => handle(time, this)); - this.registry.onUpdate.forEach((handle) => handle(time, this)); - this.registry.onAfterUpdate.forEach((handle) => handle(time, this)); - this.registry.onDraw.forEach((handle) => handle(time, this)); - } - async doStart(time = 0) { - this.loading("setting launch parameters"); - this.clear(); - try { - for (const fn of this.registry.onStart) { - await fn(time, this); - } - } catch (e) { - this.loading(`[panic] failed to start noeidelon`); - if (this.telemetry) { - this.loading(`${e}`); - } - return; - } - this.ready(); - } - async oneShot(time = 0) { - await this.doStart(time); - this.doUpdate(time); - } - async start() { - await this.doStart(); - const run = (time) => { - this.doUpdate(time); - requestAnimationFrame(run); - }; - requestAnimationFrame(run); - } -} - -export { Mesh, exports_quat, Transform, etoq, v3, MeshRenderer, Shader, basic_default, basic_default2 as basic_default1, basic3 as basic, Renderable, WebGLApp }; diff --git a/html/chunk-701c22b55952babe.js b/html/chunk-701c22b55952babe.js deleted file mode 100644 index 93130bd..0000000 --- a/html/chunk-701c22b55952babe.js +++ /dev/null @@ -1,89 +0,0 @@ -// src/renderer/texture.ts -class Texture { - app; - url; - config; - texture = null; - width = 0; - height = 0; - constructor(app, url, config = {}) { - this.app = app; - this.url = url; - this.config = config; - } - setImage(data, width, height) { - this.texture = data; - this.width = width; - this.height = height; - return this; - } - async loadImage() { - if (this.url === "manual") { - if (this.texture === null) { - throw new Error("manual specified, but texture was not ready..."); - } - return; - } - if (this.texture !== null) { - return; - } - this.app.telemetry?.addTextures(-1); - this.app.loading("Fetching textures..."); - const image = new Image; - return new Promise((resolve, reject) => { - image.onload = async () => { - this.texture = await createImageBitmap(image, { - imageOrientation: "flipY" - }); - this.width = this.texture.width; - this.height = this.texture.height; - this.app.telemetry?.addTextures(2); - resolve(undefined); - }; - image.onerror = (e) => { - this.app.telemetry?.addTextures(1); - reject(new Error(`texture load of ${this.url} failed: ${e.toString()}`)); - }; - image.src = this.url; - }); - } -} - -// src/common-shaders/basic-vertex-rounding.vert -var basic_vertex_rounding_default = `#version 300 es -uniform mat4 u_view; -uniform mat4 u_projection; -uniform mat4 u_object_to_world; -uniform mat4 u_object_to_world_inv; -uniform vec3 u_light_0; -// uniform vec4 u_light_0_color; -// uniform float u_time; -// uniform vec4 u_albedo; - -in vec4 a_vertex; -in vec2 a_uv0; -in vec3 a_normal; -in vec4 a_vertex_color; - -out vec2 uv0; -out vec3 normal; -out vec4 vertex_color; -out vec3 light_pos; - -#define ROUNDING_FACTOR 230.0f - -void main() { - mat4 worldInv = inverse(u_view); - mat4 MVW = u_projection * u_view * u_object_to_world; - vec4 realPosition = MVW * a_vertex; - realPosition.xyz = round(vec3(realPosition.xyz * ROUNDING_FACTOR)) / ROUNDING_FACTOR; - gl_Position = realPosition; - - uv0 = a_uv0; - normal = normalize(mat3(worldInv) * a_normal); - vertex_color = a_vertex_color; - light_pos = normalize(mat3(u_object_to_world_inv) * u_light_0); - -}`; - -export { Texture, basic_vertex_rounding_default }; diff --git a/html/chunk-a6d990db9d9ec9c3.js b/html/chunk-a6d990db9d9ec9c3.js deleted file mode 100644 index e9dc135..0000000 --- a/html/chunk-a6d990db9d9ec9c3.js +++ /dev/null @@ -1,16 +0,0 @@ -import { -Mesh -} from "./chunk-652b721da622b7d9.js"; - -// src/meshes/plane.ts -var plane_default = new Mesh({ - colors: null, - faces: new Uint8Array([0, 1, 2, 0, 3, 1]), - name: "src/meshes/plane.ply", - normals: null, - positions: new Float32Array([1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0]), - uvs: new Float32Array([1, 0, 0, 1, 0, 0, 1, 1]), - vertexCount: 4 -}); - -export { plane_default }; diff --git a/html/chunk-d24458ad0a4be457.js b/html/chunk-d24458ad0a4be457.js new file mode 100644 index 0000000..4220563 --- /dev/null +++ b/html/chunk-d24458ad0a4be457.js @@ -0,0 +1,2 @@ +import{d as o} from"./chunk-0ef35489d83e6289.js";var u=new o({colors:null,faces:new Uint8Array([0,1,2,0,3,1]),name:"src/meshes/plane.ply",normals:null,positions:new Float32Array([1,-1,0,-1,1,0,-1,-1,0,1,1,0]),uvs:new Float32Array([1,0,0,1,0,0,1,1]),vertexCount:4}); +export{u as c}; diff --git a/src/006-the-edge/shaders/rail.frag b/src/006-the-edge/shaders/rail.frag index ab7ee33..293f454 100644 --- a/src/006-the-edge/shaders/rail.frag +++ b/src/006-the-edge/shaders/rail.frag @@ -1,6 +1,11 @@ #version 300 es precision highp float; +/* + This one is weird... We ran into engine limitations that won't exist in future iterations + Namely that we don't have a way to get screen space pixel location yet. +*/ + uniform float u_time; in vec2 uv0;