@luma.gl/gltf 9.0.11 → 9.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +34 -0
- package/dist/dist.dev.js +99 -60
- package/dist/dist.min.js +46 -26
- package/dist/gltf/create-gltf-model.d.ts.map +1 -1
- package/dist/gltf/create-gltf-model.js +55 -30
- package/dist/gltf/create-gltf-objects.d.ts.map +1 -1
- package/dist/gltf/create-gltf-objects.js +3 -0
- package/dist/gltf/gl-utils.d.ts +12 -0
- package/dist/gltf/gl-utils.d.ts.map +1 -0
- package/dist/gltf/gl-utils.js +27 -0
- package/dist/gltf/gltf-animator.d.ts.map +1 -1
- package/dist/gltf/gltf-animator.js +5 -2
- package/dist/gltf/gltf-instantiator.d.ts +0 -11
- package/dist/gltf/gltf-instantiator.d.ts.map +1 -1
- package/dist/gltf/gltf-instantiator.js +4 -33
- package/dist/index.cjs +92 -71
- package/dist/index.cjs.map +4 -4
- package/dist/pbr/parse-pbr-material.d.ts.map +1 -1
- package/dist/pbr/parse-pbr-material.js +5 -3
- package/dist/pbr/pbr-environment.d.ts +5 -6
- package/dist/pbr/pbr-environment.d.ts.map +1 -1
- package/dist/pbr/pbr-environment.js +5 -2
- package/package.json +5 -5
- package/src/gltf/create-gltf-model.ts +66 -27
- package/src/gltf/create-gltf-objects.ts +4 -0
- package/src/gltf/gl-utils.ts +39 -0
- package/src/gltf/gltf-animator.ts +6 -2
- package/src/gltf/gltf-instantiator.ts +5 -43
- package/src/pbr/parse-pbr-material.ts +5 -3
- package/src/pbr/pbr-environment.ts +11 -9
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
luma.gl is provided under the MIT license
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 vis.gl contributors
|
|
4
|
+
|
|
5
|
+
This software includes parts initially developed by Uber and open sourced under MIT license.
|
|
6
|
+
Copyright (c) 2015 Uber Technologies, Inc.
|
|
7
|
+
|
|
8
|
+
This software includes parts of PhiloGL (https://github.com/philogb/philogl)
|
|
9
|
+
under MIT license. PhiloGL parts Copyright © 2013 Sencha Labs.
|
|
10
|
+
|
|
11
|
+
This software includes adaptations of some postprocessing code from
|
|
12
|
+
THREE.js (https://github.com/mrdoob/three.js/) under MIT license.
|
|
13
|
+
THREE.js parts Copyright © 2010-2018 three.js authors.
|
|
14
|
+
|
|
15
|
+
Additional attribution given in specific source files.
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in
|
|
25
|
+
all copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
33
|
+
THE SOFTWARE.
|
|
34
|
+
|
package/dist/dist.dev.js
CHANGED
|
@@ -85,9 +85,9 @@ var __exports__ = (() => {
|
|
|
85
85
|
parsedMaterial.defines.USE_TEX_LOD = 1;
|
|
86
86
|
const { imageBasedLightingEnvironment } = options;
|
|
87
87
|
if (imageBasedLightingEnvironment) {
|
|
88
|
-
parsedMaterial.bindings.u_DiffuseEnvSampler = imageBasedLightingEnvironment.diffuseEnvSampler;
|
|
89
|
-
parsedMaterial.bindings.u_SpecularEnvSampler = imageBasedLightingEnvironment.specularEnvSampler;
|
|
90
|
-
parsedMaterial.bindings.u_brdfLUT = imageBasedLightingEnvironment.brdfLutTexture;
|
|
88
|
+
parsedMaterial.bindings.u_DiffuseEnvSampler = imageBasedLightingEnvironment.diffuseEnvSampler.texture;
|
|
89
|
+
parsedMaterial.bindings.u_SpecularEnvSampler = imageBasedLightingEnvironment.specularEnvSampler.texture;
|
|
90
|
+
parsedMaterial.bindings.u_brdfLUT = imageBasedLightingEnvironment.brdfLutTexture.texture;
|
|
91
91
|
parsedMaterial.uniforms.u_ScaleIBLAmbient = [1, 1];
|
|
92
92
|
}
|
|
93
93
|
if (options?.pbrDebug) {
|
|
@@ -219,6 +219,9 @@ var __exports__ = (() => {
|
|
|
219
219
|
parsedMaterial.generatedTextures.push(texture);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
// src/pbr/pbr-environment.ts
|
|
223
|
+
var import_engine = __toESM(require_engine(), 1);
|
|
224
|
+
|
|
222
225
|
// ../../node_modules/@loaders.gl/loader-utils/dist/lib/env-utils/assert.js
|
|
223
226
|
function assert(condition, message) {
|
|
224
227
|
if (!condition) {
|
|
@@ -755,7 +758,7 @@ var __exports__ = (() => {
|
|
|
755
758
|
|
|
756
759
|
// src/pbr/pbr-environment.ts
|
|
757
760
|
function loadPBREnvironment(device, props) {
|
|
758
|
-
const brdfLutTexture =
|
|
761
|
+
const brdfLutTexture = new import_engine.AsyncTexture(device, {
|
|
759
762
|
id: "brdfLUT",
|
|
760
763
|
sampler: {
|
|
761
764
|
wrapS: "clamp-to-edge",
|
|
@@ -809,17 +812,18 @@ var __exports__ = (() => {
|
|
|
809
812
|
FACES.forEach((face) => {
|
|
810
813
|
data[String(face)] = getTextureForFace(face);
|
|
811
814
|
});
|
|
812
|
-
return
|
|
815
|
+
return new import_engine.AsyncTexture(device, {
|
|
813
816
|
id,
|
|
814
817
|
dimension: "cube",
|
|
815
818
|
mipmaps: false,
|
|
816
819
|
sampler,
|
|
820
|
+
// @ts-expect-error
|
|
817
821
|
data
|
|
818
822
|
});
|
|
819
823
|
}
|
|
820
824
|
|
|
821
825
|
// src/gltf/gltf-instantiator.ts
|
|
822
|
-
var
|
|
826
|
+
var import_engine3 = __toESM(require_engine(), 1);
|
|
823
827
|
|
|
824
828
|
// ../../node_modules/@math.gl/core/dist/lib/common.js
|
|
825
829
|
var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
|
|
@@ -3334,7 +3338,6 @@ var __exports__ = (() => {
|
|
|
3334
3338
|
import_core2.log.warn(`Bad animation path ${path}`)();
|
|
3335
3339
|
}
|
|
3336
3340
|
}
|
|
3337
|
-
(0, import_core2.assert)(target[path].length === output[previousIndex].length);
|
|
3338
3341
|
const previousTime = input[previousIndex];
|
|
3339
3342
|
const nextTime = input[nextIndex];
|
|
3340
3343
|
switch (interpolation) {
|
|
@@ -3923,34 +3926,79 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
3923
3926
|
defines: {
|
|
3924
3927
|
LIGHTING_FRAGMENT: 1
|
|
3925
3928
|
},
|
|
3926
|
-
dependencies: [lights]
|
|
3929
|
+
dependencies: [lights],
|
|
3930
|
+
getUniforms: (props) => props
|
|
3927
3931
|
};
|
|
3928
3932
|
|
|
3929
3933
|
// src/gltf/create-gltf-model.ts
|
|
3930
|
-
var
|
|
3931
|
-
var
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
#
|
|
3937
|
-
|
|
3934
|
+
var import_engine2 = __toESM(require_engine(), 1);
|
|
3935
|
+
var SHADER = (
|
|
3936
|
+
/* WGSL */
|
|
3937
|
+
`
|
|
3938
|
+
layout(0) positions: vec4; // in vec4 POSITION;
|
|
3939
|
+
|
|
3940
|
+
#ifdef HAS_NORMALS
|
|
3941
|
+
in vec4 normals; // in vec4 NORMAL;
|
|
3942
|
+
#endif
|
|
3943
|
+
|
|
3944
|
+
#ifdef HAS_TANGENTS
|
|
3945
|
+
in vec4 TANGENT;
|
|
3946
|
+
#endif
|
|
3947
|
+
|
|
3948
|
+
#ifdef HAS_UV
|
|
3949
|
+
// in vec2 TEXCOORD_0;
|
|
3950
|
+
in vec2 texCoords;
|
|
3951
|
+
#endif
|
|
3952
|
+
|
|
3953
|
+
@vertex
|
|
3954
|
+
void main(void) {
|
|
3955
|
+
vec4 _NORMAL = vec4(0.);
|
|
3956
|
+
vec4 _TANGENT = vec4(0.);
|
|
3957
|
+
vec2 _TEXCOORD_0 = vec2(0.);
|
|
3958
|
+
|
|
3959
|
+
#ifdef HAS_NORMALS
|
|
3960
|
+
_NORMAL = normals;
|
|
3961
|
+
#endif
|
|
3962
|
+
|
|
3963
|
+
#ifdef HAS_TANGENTS
|
|
3964
|
+
_TANGENT = TANGENT;
|
|
3965
|
+
#endif
|
|
3966
|
+
|
|
3967
|
+
#ifdef HAS_UV
|
|
3968
|
+
_TEXCOORD_0 = texCoords;
|
|
3969
|
+
#endif
|
|
3970
|
+
|
|
3971
|
+
pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
|
|
3972
|
+
gl_Position = u_MVPMatrix * positions;
|
|
3973
|
+
}
|
|
3974
|
+
|
|
3975
|
+
@fragment
|
|
3976
|
+
out vec4 fragmentColor;
|
|
3977
|
+
|
|
3978
|
+
void main(void) {
|
|
3979
|
+
vec3 pos = pbr_vPosition;
|
|
3980
|
+
fragmentColor = pbr_filterColor(vec4(1.0));
|
|
3981
|
+
}
|
|
3982
|
+
`
|
|
3983
|
+
);
|
|
3984
|
+
var vs2 = import_core4.glsl`\
|
|
3985
|
+
#version 300 es
|
|
3938
3986
|
|
|
3939
|
-
//
|
|
3940
|
-
|
|
3987
|
+
// in vec4 POSITION;
|
|
3988
|
+
in vec4 positions;
|
|
3941
3989
|
|
|
3942
3990
|
#ifdef HAS_NORMALS
|
|
3943
|
-
//
|
|
3944
|
-
|
|
3991
|
+
// in vec4 NORMAL;
|
|
3992
|
+
in vec4 normals;
|
|
3945
3993
|
#endif
|
|
3946
3994
|
|
|
3947
3995
|
#ifdef HAS_TANGENTS
|
|
3948
|
-
|
|
3996
|
+
in vec4 TANGENT;
|
|
3949
3997
|
#endif
|
|
3950
3998
|
|
|
3951
3999
|
#ifdef HAS_UV
|
|
3952
|
-
//
|
|
3953
|
-
|
|
4000
|
+
// in vec2 TEXCOORD_0;
|
|
4001
|
+
in vec2 texCoords;
|
|
3954
4002
|
#endif
|
|
3955
4003
|
|
|
3956
4004
|
void main(void) {
|
|
@@ -3974,13 +4022,9 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
3974
4022
|
gl_Position = u_MVPMatrix * positions;
|
|
3975
4023
|
}
|
|
3976
4024
|
`;
|
|
3977
|
-
var fs2 =
|
|
3978
|
-
#
|
|
3979
|
-
#if (__VERSION__ < 300)
|
|
3980
|
-
#define fragmentColor gl_FragColor
|
|
3981
|
-
#else
|
|
4025
|
+
var fs2 = import_core4.glsl`\
|
|
4026
|
+
#version 300 es
|
|
3982
4027
|
out vec4 fragmentColor;
|
|
3983
|
-
#endif
|
|
3984
4028
|
|
|
3985
4029
|
void main(void) {
|
|
3986
4030
|
vec3 pos = pbr_vPosition;
|
|
@@ -4000,24 +4044,39 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
4000
4044
|
};
|
|
4001
4045
|
const modelProps = {
|
|
4002
4046
|
id,
|
|
4047
|
+
source: SHADER,
|
|
4048
|
+
vs: vs2,
|
|
4049
|
+
fs: fs2,
|
|
4003
4050
|
geometry,
|
|
4004
4051
|
topology: geometry.topology,
|
|
4005
4052
|
vertexCount,
|
|
4006
4053
|
modules: [pbr],
|
|
4007
|
-
vs: addVersionToShader(device, vs2),
|
|
4008
|
-
fs: addVersionToShader(device, fs2),
|
|
4009
4054
|
...modelOptions,
|
|
4010
4055
|
bindings: { ...parsedMaterial.bindings, ...modelOptions.bindings },
|
|
4011
4056
|
defines: { ...parsedMaterial.defines, ...modelOptions.defines },
|
|
4012
4057
|
parameters: { ...parameters, ...parsedMaterial.parameters, ...modelOptions.parameters },
|
|
4013
4058
|
uniforms: { ...parsedMaterial.uniforms, ...modelOptions.uniforms }
|
|
4014
4059
|
};
|
|
4015
|
-
const model = new
|
|
4016
|
-
return new
|
|
4060
|
+
const model = new import_engine2.Model(device, modelProps);
|
|
4061
|
+
return new import_engine2.ModelNode({ managedResources, model });
|
|
4017
4062
|
}
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4063
|
+
|
|
4064
|
+
// src/gltf/gl-utils.ts
|
|
4065
|
+
function convertGLDrawModeToTopology(drawMode) {
|
|
4066
|
+
switch (drawMode) {
|
|
4067
|
+
case 0 /* POINTS */:
|
|
4068
|
+
return "point-list";
|
|
4069
|
+
case 1 /* LINES */:
|
|
4070
|
+
return "line-list";
|
|
4071
|
+
case 3 /* LINE_STRIP */:
|
|
4072
|
+
return "line-strip";
|
|
4073
|
+
case 4 /* TRIANGLES */:
|
|
4074
|
+
return "triangle-list";
|
|
4075
|
+
case 5 /* TRIANGLE_STRIP */:
|
|
4076
|
+
return "triangle-strip";
|
|
4077
|
+
default:
|
|
4078
|
+
throw new Error(String(drawMode));
|
|
4079
|
+
}
|
|
4021
4080
|
}
|
|
4022
4081
|
|
|
4023
4082
|
// src/gltf/gltf-instantiator.ts
|
|
@@ -4050,7 +4109,7 @@ ${source}`;
|
|
|
4050
4109
|
createScene(gltfScene) {
|
|
4051
4110
|
const gltfNodes = gltfScene.nodes || [];
|
|
4052
4111
|
const nodes = gltfNodes.map((node) => this.createNode(node));
|
|
4053
|
-
const scene = new
|
|
4112
|
+
const scene = new import_engine3.GroupNode({
|
|
4054
4113
|
id: gltfScene.name || gltfScene.id,
|
|
4055
4114
|
children: nodes
|
|
4056
4115
|
});
|
|
@@ -4063,7 +4122,7 @@ ${source}`;
|
|
|
4063
4122
|
if (gltfNode.mesh) {
|
|
4064
4123
|
children.push(this.createMesh(gltfNode.mesh));
|
|
4065
4124
|
}
|
|
4066
|
-
const node = new
|
|
4125
|
+
const node = new import_engine3.GroupNode({
|
|
4067
4126
|
id: gltfNode.name || gltfNode.id,
|
|
4068
4127
|
children
|
|
4069
4128
|
});
|
|
@@ -4092,7 +4151,7 @@ ${source}`;
|
|
|
4092
4151
|
const primitives = gltfPrimitives.map(
|
|
4093
4152
|
(gltfPrimitive, i) => this.createPrimitive(gltfPrimitive, i, gltfMesh)
|
|
4094
4153
|
);
|
|
4095
|
-
const mesh = new
|
|
4154
|
+
const mesh = new import_engine3.GroupNode({
|
|
4096
4155
|
id: gltfMesh.name || gltfMesh.id,
|
|
4097
4156
|
children: primitives
|
|
4098
4157
|
});
|
|
@@ -4127,7 +4186,7 @@ ${source}`;
|
|
|
4127
4186
|
const { components, size, value } = attribute;
|
|
4128
4187
|
attributes[attributeName] = { size: size ?? components, value };
|
|
4129
4188
|
}
|
|
4130
|
-
return new
|
|
4189
|
+
return new import_engine3.Geometry({
|
|
4131
4190
|
id,
|
|
4132
4191
|
topology,
|
|
4133
4192
|
indices: gltfPrimitive.indices.value,
|
|
@@ -4160,26 +4219,6 @@ ${source}`;
|
|
|
4160
4219
|
return false;
|
|
4161
4220
|
}
|
|
4162
4221
|
};
|
|
4163
|
-
function convertGLDrawModeToTopology(drawMode) {
|
|
4164
|
-
switch (drawMode) {
|
|
4165
|
-
case 0 /* POINTS */:
|
|
4166
|
-
return "point-list";
|
|
4167
|
-
case 1 /* LINES */:
|
|
4168
|
-
return "line-list";
|
|
4169
|
-
case 3 /* LINE_STRIP */:
|
|
4170
|
-
return "line-strip";
|
|
4171
|
-
case 2 /* LINE_LOOP */:
|
|
4172
|
-
return "line-loop-webgl";
|
|
4173
|
-
case 4 /* TRIANGLES */:
|
|
4174
|
-
return "triangle-list";
|
|
4175
|
-
case 5 /* TRIANGLE_STRIP */:
|
|
4176
|
-
return "triangle-strip";
|
|
4177
|
-
case 6 /* TRIANGLE_FAN */:
|
|
4178
|
-
return "triangle-fan-webgl";
|
|
4179
|
-
default:
|
|
4180
|
-
throw new Error(drawMode);
|
|
4181
|
-
}
|
|
4182
|
-
}
|
|
4183
4222
|
|
|
4184
4223
|
// src/gltf/create-gltf-objects.ts
|
|
4185
4224
|
function createScenegraphsFromGLTF(device, gltf, options) {
|
package/dist/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['luma'] = factory();
|
|
6
6
|
else root['luma'] = factory();})(globalThis, function () {
|
|
7
|
-
var __exports__=(()=>{var Ln=Object.create;var it=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var vn=Object.getPrototypeOf,Nn=Object.prototype.hasOwnProperty;var Kt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),bn=(e,t)=>{for(var n in t)it(e,n,{get:t[n],enumerable:!0})},ot=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of In(t))!Nn.call(e,s)&&s!==n&&it(e,s,{get:()=>t[s],enumerable:!(r=Rn(t,s))||r.enumerable});return e},ct=(e,t,n)=>(ot(e,t,"default"),n&&ot(n,t,"default")),D=(e,t,n)=>(n=e!=null?Ln(vn(e)):{},ot(t||!e||!e.__esModule?it(n,"default",{value:e,enumerable:!0}):n,e)),On=e=>ot(it({},"__esModule",{value:!0}),e);var $=Kt((Qr,Qt)=>{Qt.exports=globalThis.luma});var Pt=Kt((to,ge)=>{ge.exports=globalThis.luma});var st={};bn(st,{GLTFAnimator:()=>W,createScenegraphsFromGLTF:()=>Tn,loadPBREnvironment:()=>xe,parsePBRMaterial:()=>at});ct(st,D($(),1));var Zt=D($(),1),C;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(C||(C={}));function at(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=r;return o&&(s.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=o.specularEnvSampler,s.bindings.u_brdfLUT=o.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&wn(e,t,s),s}function wn(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Pn(e,t.pbrMetallicRoughness,n),t.normalTexture){K(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){K(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(K(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Zt.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=C.FUNC_ADD,n.glParameters.blendFunc=[C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA];break}}function Pn(e,t,n){t.baseColorTexture&&K(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&K(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function K(e,t,n,r=null,s){let o=t?.texture?.sampler?.parameters||{},i=t.texture.source.image,c,a={};i.compressed?(c=i,a={[C.TEXTURE_MIN_FILTER]:i.data.length>1?C.LINEAR_MIPMAP_NEAREST:C.LINEAR}):c={data:i};let f=e.createTexture({id:t.uniformName||t.id,parameters:{...o,...a},pixelStore:{[C.UNPACK_FLIP_Y_WEBGL]:!1},...c});s.bindings[n]=f,r&&(s.defines[r]=1),s.generatedTextures.push(f)}function q(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var B={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Cn=B.self||B.window||B.global||{},Bn=B.window||B.self||B.global||{},zn=B.global||B.self||B.window||{},kn=B.document||{};var Tt=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Jt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Fn=Jt&&parseFloat(Jt[1])||0;var Un="",te={};function Lt(e){for(let t in te)if(e.startsWith(t)){let n=te[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Un}${e}`),e}var ee="4.2.0-beta.2";var Vn=globalThis.loaders?.parseImageNode,Rt=typeof Image<"u",It=typeof ImageBitmap<"u",qn=Boolean(Vn),vt=Tt?!0:qn;function ne(e){switch(e){case"auto":return It||Rt||vt;case"imagebitmap":return It;case"image":return Rt;case"data":return vt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function re(){if(It)return"imagebitmap";if(Rt)return"image";if(vt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function se(e){let t=Dn(e);if(!t)throw new Error("Not an image");return t}function Nt(e){return ft(e)}function ft(e){switch(se(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Dn(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Yn=/^data:image\/svg\+xml/,Hn=/\.svg((\?|#).*)?$/;function lt(e){return e&&(Yn.test(e)||Hn.test(e))}function oe(e,t){if(lt(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return bt(e,t)}function bt(e,t){if(lt(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ht(e,t,n){let r=oe(e,n),s=self.URL||self.webkitURL,o=typeof r!="string"&&s.createObjectURL(r);try{return await Gn(o||r,t)}finally{o&&s.revokeObjectURL(o)}}async function Gn(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var Wn={},ie=!0;async function ce(e,t,n){let r;lt(n)?r=await ht(e,t,n):r=bt(e,n);let s=t&&t.imagebitmap;return await Xn(r,s)}async function Xn(e,t=null){if((jn(t)||!ie)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),ie=!1}return await createImageBitmap(e)}function jn(e){for(let t in e||Wn)return!1;return!0}function ae(e){return!Zn(e,"ftyp",4)||!(e[8]&96)?null:$n(e)}function $n(e){switch(Kn(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Kn(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Qn(e){return[...e].map(t=>t.charCodeAt(0))}function Zn(e,t,n=0){let r=Qn(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var z=!1,Q=!0;function pt(e){let t=Z(e);return tr(t)||rr(t)||er(t)||nr(t)||Jn(t)}function Jn(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=ae(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function tr(e){let t=Z(e);return t.byteLength>=24&&t.getUint32(0,z)===2303741511?{mimeType:"image/png",width:t.getUint32(16,z),height:t.getUint32(20,z)}:null}function er(e){let t=Z(e);return t.byteLength>=10&&t.getUint32(0,z)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Q),height:t.getUint16(8,Q)}:null}function nr(e){let t=Z(e);return t.byteLength>=14&&t.getUint16(0,z)===16973&&t.getUint32(2,Q)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Q),height:t.getUint32(22,Q)}:null}function rr(e){let t=Z(e);if(!(t.byteLength>=3&&t.getUint16(0,z)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=sr(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,z);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,z),width:t.getUint16(o+7,z)};if(!r.has(i))return null;o+=2,o+=t.getUint16(o,z)}return null}function sr(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Z(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function fe(e,t){let{mimeType:n}=pt(e)||{},r=globalThis.loaders?.parseImageNode;return q(r),await r(e,n)}async function le(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=n||{},i=or(s),c;switch(i){case"imagebitmap":c=await ce(e,t,o);break;case"image":c=await ht(e,t,o);break;case"data":c=await fe(e,t);break;default:q(!1)}return s==="data"&&(c=ft(c)),c}function or(e){switch(e){case"auto":case"data":return re();default:return ne(e),e}}var ir=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],cr=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ar={image:{type:"auto",decode:!0}},mt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:ee,mimeTypes:cr,extensions:ir,parse:le,tests:[e=>Boolean(pt(new DataView(e)))],options:ar};function xt(e,t,n){let r=typeof e=="function"?e({...t,...n}):e,s=t.baseUrl;return s&&(r=s[s.length-1]==="/"?`${s}${r}`:`${s}/${r}`),Lt(r)}var fr=e=>e&&typeof e=="object";async function he(e,t,n={}){return await Ot(e,t,n)}async function Ot(e,t,n){return Array.isArray(e)?await hr(e,t,n):fr(e)?await lr(e,t,n):await t(e,n)}async function lr(e,t,n){let r=[],s={};for(let o in e){let i=e[o],c=Ot(i,t,n).then(a=>{s[o]=a});r.push(c)}return await Promise.all(r),s}async function hr(e,t,n={}){let r=e.map(s=>Ot(s,t,n));return await Promise.all(r)}async function pe(e,t,n){return await he(e,r=>wt(r,t,n))}async function wt(e,t,n){let s=await(await fetch(e,n.fetch)).arrayBuffer();return await t(s,n)}async function J(e,t={}){let n=await pr(e,t);return await pe(n,mt.parse,t)}async function pr(e,t,n={}){let r=t&&t.image&&t.image.mipLevels||0;return r!==0?await mr(e,r,t,n):xt(e,t,n)}async function mr(e,t,n,r){let s=[];if(t==="auto"){let o=xt(e,n,{...r,lod:0}),i=await wt(o,mt.parse,n),{width:c,height:a}=Nt(i);t=xr({width:c,height:a}),s.push(o)}q(t>0);for(let o=s.length;o<t;++o){let i=xt(e,n,{...r,lod:o});s.push(i)}return s}function xr(e){return 1+Math.floor(Math.log2(Math.max(e.width,e.height)))}function xe(e,t){let n=e.createTexture({id:"brdfLUT",sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"},data:J(t.brdfLutUrl)}),r=me(e,{id:"DiffuseEnvSampler",getTextureForFace:o=>J(t.getTexUrl("diffuse",o,0)),sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}}),s=me(e,{id:"SpecularEnvSampler",getTextureForFace:o=>{let i=[];for(let c=0;c<=t.specularMipLevels-1;c++)i.push(J(t.getTexUrl("specular",o,c)));return i},sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}});return{brdfLutTexture:n,diffuseEnvSampler:r,specularEnvSampler:s}}var gr=[0,1,2,3,4,5];function me(e,{id:t,getTextureForFace:n,sampler:r}){let s={};return gr.forEach(o=>{s[String(o)]=n(o)}),e.createTexture({id:t,dimension:"cube",mipmaps:!1,sampler:r,data:s})}var X=D(Pt(),1);var eo=1/Math.PI*180,no=1/180*Math.PI,dr={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...dr}};var L=globalThis.mathgl.config;function de(e,{precision:t=L.precision}={}){return e=Mr(e),"".concat(parseFloat(e.toPrecision(t)))}function Y(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ct(e,t,n){let r=L.EPSILON;n&&(L.EPSILON=n);try{if(e===t)return!0;if(Y(e)&&Y(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Ct(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=L.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{L.EPSILON=r}}function Mr(e){return Math.round(e/L.EPSILON)*L.EPSILON}function ur(e){function t(){var n=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var V=class extends ur(Array){clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Y(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(L)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+de(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(n,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Ct(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof n=="number"?n:n[s];this[s]=o+r*(i-o)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(L.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function _r(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function y(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function H(e,t,n=""){if(L.debug&&!_r(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}function Bt(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var gt=class extends V{get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return y(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return y(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),y(this[t])}setComponent(t,n){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var R=typeof Float32Array<"u"?Float32Array:Array;var mo=Math.PI/180;function Ar(){let e=new R(2);return R!=Float32Array&&(e[0]=0,e[1]=0),e}function _e(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var xo=function(){let e=Ar();return function(t,n,r,s,o,i){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],o(e,e,i),t[c]=e[0],t[c+1]=e[1];return t}}();function Ae(e,t,n){let r=t[0],s=t[1],o=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/o,e[1]=(n[1]*r+n[5]*s)/o,e}function Se(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o||1;return e[0]=(n[0]*r+n[4]*s+n[8]*o)/i,e[1]=(n[1]*r+n[5]*s+n[9]*o)/i,e[2]=(n[2]*r+n[6]*s+n[10]*o)/i,e}function Ee(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function ye(e,t,n){let r=t[0],s=t[1],o=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*o,e[1]=n[1]*r+n[4]*s+n[7]*o,e[2]=n[2]*r+n[5]*s+n[8]*o,e[3]=t[3],e}function zt(){let e=new R(3);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Sr(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function kt(e,t,n){let r=new R(3);return r[0]=e,r[1]=t,r[2]=n,r}function Te(e,t){let n=t[0],r=t[1],s=t[2],o=n*n+r*r+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Le(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function dt(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2];return e[0]=s*a-o*c,e[1]=o*i-r*a,e[2]=r*c-s*i,e}function Mt(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*s+n[8]*o+n[12])/i,e[1]=(n[1]*r+n[5]*s+n[9]*o+n[13])/i,e[2]=(n[2]*r+n[6]*s+n[10]*o+n[14])/i,e}function Re(e,t,n){let r=n[0],s=n[1],o=n[2],i=n[3],c=t[0],a=t[1],f=t[2],l=s*f-o*a,h=o*c-r*f,p=r*a-s*c,m=s*p-o*h,x=o*l-r*p,g=r*h-s*l,d=i*2;return l*=d,h*=d,p*=d,m*=2,x*=2,g*=2,e[0]=c+l+m,e[1]=a+h+x,e[2]=f+p+g,e}var Ie=Sr;var uo=function(){let e=zt();return function(t,n,r,s,o,i){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var ut,G=class extends gt{static get ZERO(){return ut||(ut=new G(0,0,0,0),Object.freeze(ut)),ut}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Y(t)&&arguments.length===1?this.copy(t):(L.debug&&(y(t),y(n),y(r),y(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return L.debug&&(y(t.x),y(t.y),y(t.z),y(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}transform(t){return Mt(this,this,t),this.check()}transformByMatrix3(t){return ye(this,this,t),this.check()}transformByMatrix2(t){return Ee(this,this,t),this.check()}transformByQuaternion(t){return Re(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var _t=class extends V{toString(){let t="[";if(L.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+n])}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=" ".concat(this[n])}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=y(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function ve(){let e=new R(9);return R!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Tr(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ne(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],o=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=s,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function be(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=t[4],c=t[5],a=t[6],f=t[7],l=t[8],h=t[9],p=t[10],m=t[11],x=t[12],g=t[13],d=t[14],S=t[15],T=n*c-r*i,M=n*a-s*i,u=n*f-o*i,_=r*a-s*c,A=r*f-o*c,I=s*f-o*a,v=l*g-h*x,N=l*d-p*x,b=l*S-m*x,O=h*d-p*g,w=h*S-m*g,P=p*S-m*d,E=T*P-M*w+u*O+_*b-A*N+I*v;return E?(E=1/E,e[0]=(c*P-a*w+f*O)*E,e[1]=(s*w-r*P-o*O)*E,e[2]=(g*I-d*A+S*_)*E,e[3]=(p*A-h*I-m*_)*E,e[4]=(a*b-i*P-f*N)*E,e[5]=(n*P-s*b+o*N)*E,e[6]=(d*u-x*I-S*M)*E,e[7]=(l*I-p*u+m*M)*E,e[8]=(i*w-c*b+f*v)*E,e[9]=(r*b-n*w-o*v)*E,e[10]=(x*A-g*u+S*T)*E,e[11]=(h*u-l*A-m*T)*E,e[12]=(c*N-i*O-a*v)*E,e[13]=(n*O-r*N+s*v)*E,e[14]=(g*M-x*_-d*T)*E,e[15]=(l*_-h*M+p*T)*E,e):null}function Oe(e){let t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],i=e[5],c=e[6],a=e[7],f=e[8],l=e[9],h=e[10],p=e[11],m=e[12],x=e[13],g=e[14],d=e[15],S=t*i-n*o,T=t*c-r*o,M=n*c-r*i,u=f*x-l*m,_=f*g-h*m,A=l*g-h*x,I=t*A-n*_+r*u,v=o*A-i*_+c*u,N=f*M-l*T+h*S,b=m*M-x*T+g*S;return a*I-s*v+d*N-p*b}function Ft(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],p=t[9],m=t[10],x=t[11],g=t[12],d=t[13],S=t[14],T=t[15],M=n[0],u=n[1],_=n[2],A=n[3];return e[0]=M*r+u*c+_*h+A*g,e[1]=M*s+u*a+_*p+A*d,e[2]=M*o+u*f+_*m+A*S,e[3]=M*i+u*l+_*x+A*T,M=n[4],u=n[5],_=n[6],A=n[7],e[4]=M*r+u*c+_*h+A*g,e[5]=M*s+u*a+_*p+A*d,e[6]=M*o+u*f+_*m+A*S,e[7]=M*i+u*l+_*x+A*T,M=n[8],u=n[9],_=n[10],A=n[11],e[8]=M*r+u*c+_*h+A*g,e[9]=M*s+u*a+_*p+A*d,e[10]=M*o+u*f+_*m+A*S,e[11]=M*i+u*l+_*x+A*T,M=n[12],u=n[13],_=n[14],A=n[15],e[12]=M*r+u*c+_*h+A*g,e[13]=M*s+u*a+_*p+A*d,e[14]=M*o+u*f+_*m+A*S,e[15]=M*i+u*l+_*x+A*T,e}function we(e,t,n){let r=n[0],s=n[1],o=n[2],i,c,a,f,l,h,p,m,x,g,d,S;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*o+t[12],e[13]=t[1]*r+t[5]*s+t[9]*o+t[13],e[14]=t[2]*r+t[6]*s+t[10]*o+t[14],e[15]=t[3]*r+t[7]*s+t[11]*o+t[15]):(i=t[0],c=t[1],a=t[2],f=t[3],l=t[4],h=t[5],p=t[6],m=t[7],x=t[8],g=t[9],d=t[10],S=t[11],e[0]=i,e[1]=c,e[2]=a,e[3]=f,e[4]=l,e[5]=h,e[6]=p,e[7]=m,e[8]=x,e[9]=g,e[10]=d,e[11]=S,e[12]=i*r+l*s+x*o+t[12],e[13]=c*r+h*s+g*o+t[13],e[14]=a*r+p*s+d*o+t[14],e[15]=f*r+m*s+S*o+t[15]),e}function Pe(e,t,n){let r=n[0],s=n[1],o=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ce(e,t,n,r){let s=r[0],o=r[1],i=r[2],c=Math.sqrt(s*s+o*o+i*i),a,f,l,h,p,m,x,g,d,S,T,M,u,_,A,I,v,N,b,O,w,P,E,j;return c<1e-6?null:(c=1/c,s*=c,o*=c,i*=c,f=Math.sin(n),a=Math.cos(n),l=1-a,h=t[0],p=t[1],m=t[2],x=t[3],g=t[4],d=t[5],S=t[6],T=t[7],M=t[8],u=t[9],_=t[10],A=t[11],I=s*s*l+a,v=o*s*l+i*f,N=i*s*l-o*f,b=s*o*l-i*f,O=o*o*l+a,w=i*o*l+s*f,P=s*i*l+o*f,E=o*i*l-s*f,j=i*i*l+a,e[0]=h*I+g*v+M*N,e[1]=p*I+d*v+u*N,e[2]=m*I+S*v+_*N,e[3]=x*I+T*v+A*N,e[4]=h*b+g*O+M*w,e[5]=p*b+d*O+u*w,e[6]=m*b+S*O+_*w,e[7]=x*b+T*O+A*w,e[8]=h*P+g*E+M*j,e[9]=p*P+d*E+u*j,e[10]=m*P+S*E+_*j,e[11]=x*P+T*E+A*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Be(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[4],i=t[5],c=t[6],a=t[7],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*s+f*r,e[5]=i*s+l*r,e[6]=c*s+h*r,e[7]=a*s+p*r,e[8]=f*s-o*r,e[9]=l*s-i*r,e[10]=h*s-c*r,e[11]=p*s-a*r,e}function ze(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s-f*r,e[1]=i*s-l*r,e[2]=c*s-h*r,e[3]=a*s-p*r,e[8]=o*r+f*s,e[9]=i*r+l*s,e[10]=c*r+h*s,e[11]=a*r+p*s,e}function ke(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[4],l=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s+f*r,e[1]=i*s+l*r,e[2]=c*s+h*r,e[3]=a*s+p*r,e[4]=f*s-o*r,e[5]=l*s-i*r,e[6]=h*s-c*r,e[7]=p*s-a*r,e}function Fe(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n+n,c=r+r,a=s+s,f=n*i,l=r*i,h=r*c,p=s*i,m=s*c,x=s*a,g=o*i,d=o*c,S=o*a;return e[0]=1-h-x,e[1]=l+S,e[2]=p-d,e[3]=0,e[4]=l-S,e[5]=1-f-x,e[6]=m+g,e[7]=0,e[8]=p+d,e[9]=m-g,e[10]=1-f-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ue(e,t,n,r,s,o,i){let c=1/(n-t),a=1/(s-r),f=1/(o-i);return e[0]=o*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(i+o)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*o*2*f,e[15]=0,e}function Lr(e,t,n,r,s){let o=1/Math.tan(t/2);if(e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let i=1/(r-s);e[10]=(s+r)*i,e[14]=2*s*r*i}else e[10]=-1,e[14]=-2*r;return e}var Ve=Lr;function Rr(e,t,n,r,s,o,i){let c=1/(t-n),a=1/(r-s),f=1/(o-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*f,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(i+o)*f,e[15]=1,e}var qe=Rr;function De(e,t,n,r){let s,o,i,c,a,f,l,h,p,m,x=t[0],g=t[1],d=t[2],S=r[0],T=r[1],M=r[2],u=n[0],_=n[1],A=n[2];return Math.abs(x-u)<1e-6&&Math.abs(g-_)<1e-6&&Math.abs(d-A)<1e-6?Tr(e):(h=x-u,p=g-_,m=d-A,s=1/Math.sqrt(h*h+p*p+m*m),h*=s,p*=s,m*=s,o=T*m-M*p,i=M*h-S*m,c=S*p-T*h,s=Math.sqrt(o*o+i*i+c*c),s?(s=1/s,o*=s,i*=s,c*=s):(o=0,i=0,c=0),a=p*c-m*i,f=m*o-h*c,l=h*i-p*o,s=Math.sqrt(a*a+f*f+l*l),s?(s=1/s,a*=s,f*=s,l*=s):(a=0,f=0,l=0),e[0]=o,e[1]=a,e[2]=h,e[3]=0,e[4]=i,e[5]=f,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=m,e[11]=0,e[12]=-(o*x+i*g+c*d),e[13]=-(a*x+f*g+l*d),e[14]=-(h*x+p*g+m*d),e[15]=1,e)}function Ir(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Ye(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function He(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Ge(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function We(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Xe(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=r*i,e[2]=s*i,e[3]=o*i,e}function je(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function $e(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=o+r*(n[1]-o),e[2]=i+r*(n[2]-i),e[3]=c+r*(n[3]-c),e}function Ke(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*o+n[12]*i,e[1]=n[1]*r+n[5]*s+n[9]*o+n[13]*i,e[2]=n[2]*r+n[6]*s+n[10]*o+n[14]*i,e[3]=n[3]*r+n[7]*s+n[11]*o+n[15]*i,e}function Qe(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2],f=n[3],l=f*r+c*o-a*s,h=f*s+a*r-i*o,p=f*o+i*s-c*r,m=-i*r-c*s-a*o;return e[0]=l*f+m*-i+h*-a-p*-c,e[1]=h*f+m*-c+p*-i-l*-a,e[2]=p*f+m*-a+l*-c-h*-i,e[3]=t[3],e}var bo=function(){let e=Ir();return function(t,n,r,s,o,i){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var qt;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(qt||(qt={}));var Nr=45*Math.PI/180,br=1,Ut=.1,Vt=500,Or=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),F=class extends _t{static get IDENTITY(){return Pr()}static get ZERO(){return wr()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return qt}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,o,i,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=o,this[5]=i,this[6]=c,this[7]=a,this[8]=f,this[9]=l,this[10]=h,this[11]=p,this[12]=m,this[13]=x,this[14]=g,this[15]=d,this.check()}setRowMajor(t,n,r,s,o,i,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=o,this[2]=f,this[3]=m,this[4]=n,this[5]=i,this[6]=l,this[7]=x,this[8]=r,this[9]=c,this[10]=h,this[11]=g,this[12]=s,this[13]=a,this[14]=p,this[15]=d,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(Or)}fromObject(t){return this.check()}fromQuaternion(t){return Fe(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:o,near:i=Ut,far:c=Vt}=t;return c===1/0?Cr(this,n,r,s,o,i):Ue(this,n,r,s,o,i,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return De(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:o,near:i=Ut,far:c=Vt}=t;return qe(this,n,r,s,o,i,c),this.check()}orthographic(t){let{fovy:n=Nr,aspect:r=br,focalDistance:s=1,near:o=Ut,far:i=Vt}=t;Ze(n);let c=n/2,a=s*Math.tan(c),f=a*r;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:o,far:i})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:o=500}=t;return Ze(n),Ve(this,n,r,s,o),this.check()}determinant(){return Oe(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*o,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*o,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=this[4]*s,t[4]=this[5]*o,t[5]=this[6]*i,t[6]=this[8]*s,t[7]=this[9]*o,t[8]=this[10]*i,t}transpose(){return Ne(this,this),this.check()}invert(){return be(this,this),this.check()}multiplyLeft(t){return Ft(this,t,this),this.check()}multiplyRight(t){return Ft(this,this,t),this.check()}rotateX(t){return Be(this,this,t),this.check()}rotateY(t){return ze(this,this,t),this.check()}rotateZ(t){return ke(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Ce(this,this,t,n),this.check()}scale(t){return Pe(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return we(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Ke(n||[-0,-0,-0,-0],t,this),H(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=_e(n||[-0,-0],t,this);break;case 3:s=Mt(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return H(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=Ae(n||[-0,-0],t,this);break;case 3:r=Se(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return H(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},At,St;function wr(){return At||(At=new F([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(At)),At}function Pr(){return St||(St=new F,Object.freeze(St)),St}function Ze(e){if(e>Math.PI*2)throw Error("expected radians")}function Cr(e,t,n,r,s,o){let i=2*o/(n-t),c=2*o/(s-r),a=(n+t)/(n-t),f=(s+r)/(s-r),l=-1,h=-1,p=-2*o;return e[0]=i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=f,e[10]=l,e[11]=h,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Je(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function tn(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Dt(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Yt(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=n[0],a=n[1],f=n[2],l=n[3];return e[0]=r*l+i*c+s*f-o*a,e[1]=s*l+i*a+o*c-r*f,e[2]=o*l+i*f+r*a-s*c,e[3]=i*l-r*c-s*a-o*f,e}function en(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+i*c,e[1]=s*a+o*c,e[2]=o*a-s*c,e[3]=i*a-r*c,e}function nn(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-o*c,e[1]=s*a+i*c,e[2]=o*a+r*c,e[3]=i*a-s*c,e}function rn(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=o*a+i*c,e[3]=i*a-o*c,e}function sn(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function et(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3],a=n[0],f=n[1],l=n[2],h=n[3],p,m,x,g,d;return p=s*a+o*f+i*l+c*h,p<0&&(p=-p,a=-a,f=-f,l=-l,h=-h),1-p>1e-6?(m=Math.acos(p),d=Math.sin(m),x=Math.sin((1-r)*m)/d,g=Math.sin(r*m)/d):(x=1-r,g=r),e[0]=x*s+g*a,e[1]=x*o+g*f,e[2]=x*i+g*l,e[3]=x*c+g*h,e}function on(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o,c=i?1/i:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=o*c,e}function cn(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ht(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*r,r=.5/r,e[3]=(t[o*3+i]-t[i*3+o])*r,e[o]=(t[o*3+s]+t[s*3+o])*r,e[i]=(t[i*3+s]+t[s*3+i])*r}return e}var an=Ye;var fn=He,ln=je,hn=$e,pn=Ge;var mn=We;var xn=Xe;var gn=function(){let e=zt(),t=kt(1,0,0),n=kt(0,1,0);return function(r,s,o){let i=Le(s,o);return i<-.999999?(dt(e,t,s),Ie(e)<1e-6&&dt(e,n,s),Te(e,e),Dt(r,e,Math.PI),r):i>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(dt(e,s,o),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+i,xn(r,r))}}(),Ho=function(){let e=Je(),t=Je();return function(n,r,s,o,i,c){return et(e,r,i,c),et(t,s,o,c),et(n,e,t,2*c*(1-c)),n}}(),Go=function(){let e=ve();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],xn(t,Ht(t,e))}}();var Br=[0,0,0,1],nt=class extends V{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Ht(this,t),this.check()}fromAxisRotation(t,n){return Dt(this,t,n),this.check()}identity(){return tn(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}len(){return pn(this)}lengthSquared(){return mn(this)}dot(t){return ln(this,t)}rotationTo(t,n){return gn(this,t,n),this.check()}add(t){return an(this,this,t),this.check()}calculateW(){return sn(this,this),this.check()}conjugate(){return cn(this,this),this.check()}invert(){return on(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(hn(this,t,n,r),this.check())}multiplyRight(t){return Yt(this,this,t),this.check()}multiplyLeft(t){return Yt(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return en(this,this,t),this.check()}rotateY(t){return nn(this,this,t),this.check()}rotateZ(t){return rn(this,this,t),this.check()}scale(t){return fn(this,this,t),this.check()}slerp(t,n,r){let s,o,i;switch(arguments.length){case 1:({start:s=Br,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=n;break;default:s=t,o=n,i=r}return et(this,s,o,i),this.check()}transformVector4(t,n=new G){return Qe(n,t,this),H(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var rt=D($(),1);var zr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},kr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wt=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(t){Object.assign(this,t)}animate(t){if(!this.playing)return;let r=(t/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:s,target:o,path:i})=>{Yr(r,s,o,i),Ur(o,o._node)})}},W=class{animations;constructor(t){this.animations=t.animations.map((n,r)=>{let s=n.name||`Animation-${r}`,o=n.samplers.map(({input:c,interpolation:a="LINEAR",output:f})=>({input:dn(t.accessors[c]),interpolation:a,output:dn(t.accessors[f])})),i=n.channels.map(({sampler:c,target:a})=>({sampler:o[c],target:t.nodes[a.node],path:a.path}));return new Wt({name:s,channels:i})})}animate(t){this.setTime(t)}setTime(t){this.animations.forEach(n=>n.animate(t))}getAnimations(){return this.animations}};function dn(e){if(!e._animation){let t=kr[e.componentType],n=zr[e.type],r=n*e.count,{buffer:s,byteOffset:o}=e.bufferView.data,i=new t(s,o+(e.byteOffset||0),r);if(n===1)e._animation=Array.from(i);else{let c=[];for(let a=0;a<i.length;a+=n)c.push(Array.from(i.slice(a,a+n)));e._animation=c}}return e._animation}var Fr=new F;function Ur(e,t){if(t.matrix.identity(),e.translation&&t.matrix.translate(e.translation),e.rotation){let n=Fr.fromQuaternion(e.rotation);t.matrix.multiplyRight(n)}e.scale&&t.matrix.scale(e.scale)}var Gt=new nt;function Vr(e,t,n,r,s){if(t==="rotation"){Gt.slerp({start:n,target:r,ratio:s});for(let o=0;o<Gt.length;o++)e[t][o]=Gt[o]}else for(let o=0;o<n.length;o++)e[t][o]=s*r[o]+(1-s)*n[o]}function qr(e,t,{p0:n,outTangent0:r,inTangent1:s,p1:o,tDiff:i,ratio:c}){for(let a=0;a<e[t].length;a++){let f=r[a]*i,l=s[a]*i;e[t][a]=(2*Math.pow(c,3)-3*Math.pow(c,2)+1)*n[a]+(Math.pow(c,3)-2*Math.pow(c,2)+c)*f+(-2*Math.pow(c,3)+3*Math.pow(c,2))*o[a]+(Math.pow(c,3)-Math.pow(c,2))*l}}function Dr(e,t,n){for(let r=0;r<n.length;r++)e[t][r]=n[r]}function Yr(e,{input:t,interpolation:n,output:r},s,o){let i=t[t.length-1],c=e%i,a=t.findIndex(p=>p>=c),f=Math.max(0,a-1);if(!Array.isArray(s[o]))switch(o){case"translation":s[o]=[0,0,0];break;case"rotation":s[o]=[0,0,0,1];break;case"scale":s[o]=[1,1,1];break;default:rt.log.warn(`Bad animation path ${o}`)()}(0,rt.assert)(s[o].length===r[f].length);let l=t[f],h=t[a];switch(n){case"STEP":Dr(s,o,r[f]);break;case"LINEAR":if(h>l){let p=(c-l)/(h-l);Vr(s,o,r[f],r[a],p)}break;case"CUBICSPLINE":if(h>l){let p=(c-l)/(h-l),m=h-l,x=r[3*f+1],g=r[3*f+2],d=r[3*a+0],S=r[3*a+1];qr(s,o,{p0:x,outTangent0:g,inTangent1:d,p1:S,tDiff:m,ratio:p})}break;default:rt.log.warn(`Interpolation ${n} not supported`)();break}}var En=D($(),1);var Xt=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
7
|
+
var __exports__=(()=>{var Rn=Object.create;var ot=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var Nn=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var Qt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),On=(e,t)=>{for(var n in t)ot(e,n,{get:t[n],enumerable:!0})},st=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of In(t))!bn.call(e,s)&&s!==n&&ot(e,s,{get:()=>t[s],enumerable:!(r=vn(t,s))||r.enumerable});return e},it=(e,t,n)=>(st(e,t,"default"),n&&st(n,t,"default")),V=(e,t,n)=>(n=e!=null?Rn(Nn(e)):{},st(t||!e||!e.__esModule?ot(n,"default",{value:e,enumerable:!0}):n,e)),wn=e=>st(ot({},"__esModule",{value:!0}),e);var $=Qt((Zr,Zt)=>{Zt.exports=globalThis.luma});var at=Qt((ts,te)=>{te.exports=globalThis.luma});var rt={};On(rt,{GLTFAnimator:()=>W,createScenegraphsFromGLTF:()=>Ln,loadPBREnvironment:()=>de,parsePBRMaterial:()=>ct});it(rt,V($(),1));var Jt=V($(),1),C;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(C||(C={}));function ct(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:o}=r;return o&&(s.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler.texture,s.bindings.u_SpecularEnvSampler=o.specularEnvSampler.texture,s.bindings.u_brdfLUT=o.brdfLutTexture.texture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&Pn(e,t,s),s}function Pn(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&Cn(e,t.pbrMetallicRoughness,n),t.normalTexture){K(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){K(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(K(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Jt.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=C.FUNC_ADD,n.glParameters.blendFunc=[C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA];break}}function Cn(e,t,n){t.baseColorTexture&&K(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&K(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function K(e,t,n,r=null,s){let o=t?.texture?.sampler?.parameters||{},i=t.texture.source.image,c,a={};i.compressed?(c=i,a={[C.TEXTURE_MIN_FILTER]:i.data.length>1?C.LINEAR_MIPMAP_NEAREST:C.LINEAR}):c={data:i};let f=e.createTexture({id:t.uniformName||t.id,parameters:{...o,...a},pixelStore:{[C.UNPACK_FLIP_Y_WEBGL]:!1},...c});s.bindings[n]=f,r&&(s.defines[r]=1),s.generatedTextures.push(f)}var Pt=V(at(),1);function D(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var B={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Bn=B.self||B.window||B.global||{},zn=B.window||B.self||B.global||{},kn=B.global||B.self||B.window||{},Fn=B.document||{};var Tt=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ee=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Un=ee&&parseFloat(ee[1])||0;var Vn="",ne={};function Lt(e){for(let t in ne)if(e.startsWith(t)){let n=ne[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Vn}${e}`),e}var re="4.2.0-beta.2";var Dn=globalThis.loaders?.parseImageNode,Rt=typeof Image<"u",vt=typeof ImageBitmap<"u",qn=Boolean(Dn),It=Tt?!0:qn;function se(e){switch(e){case"auto":return vt||Rt||It;case"imagebitmap":return vt;case"image":return Rt;case"data":return It;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function oe(){if(vt)return"imagebitmap";if(Rt)return"image";if(It)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function ie(e){let t=Hn(e);if(!t)throw new Error("Not an image");return t}function Nt(e){return ft(e)}function ft(e){switch(ie(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Hn(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Gn=/^data:image\/svg\+xml/,Yn=/\.svg((\?|#).*)?$/;function lt(e){return e&&(Gn.test(e)||Yn.test(e))}function ce(e,t){if(lt(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return bt(e,t)}function bt(e,t){if(lt(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ht(e,t,n){let r=ce(e,n),s=self.URL||self.webkitURL,o=typeof r!="string"&&s.createObjectURL(r);try{return await Wn(o||r,t)}finally{o&&s.revokeObjectURL(o)}}async function Wn(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var Xn={},ae=!0;async function fe(e,t,n){let r;lt(n)?r=await ht(e,t,n):r=bt(e,n);let s=t&&t.imagebitmap;return await jn(r,s)}async function jn(e,t=null){if(($n(t)||!ae)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),ae=!1}return await createImageBitmap(e)}function $n(e){for(let t in e||Xn)return!1;return!0}function le(e){return!Jn(e,"ftyp",4)||!(e[8]&96)?null:Kn(e)}function Kn(e){switch(Qn(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Qn(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Zn(e){return[...e].map(t=>t.charCodeAt(0))}function Jn(e,t,n=0){let r=Zn(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var z=!1,Q=!0;function pt(e){let t=Z(e);return er(t)||sr(t)||nr(t)||rr(t)||tr(t)}function tr(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=le(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function er(e){let t=Z(e);return t.byteLength>=24&&t.getUint32(0,z)===2303741511?{mimeType:"image/png",width:t.getUint32(16,z),height:t.getUint32(20,z)}:null}function nr(e){let t=Z(e);return t.byteLength>=10&&t.getUint32(0,z)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Q),height:t.getUint16(8,Q)}:null}function rr(e){let t=Z(e);return t.byteLength>=14&&t.getUint16(0,z)===16973&&t.getUint32(2,Q)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Q),height:t.getUint32(22,Q)}:null}function sr(e){let t=Z(e);if(!(t.byteLength>=3&&t.getUint16(0,z)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=or(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,z);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,z),width:t.getUint16(o+7,z)};if(!r.has(i))return null;o+=2,o+=t.getUint16(o,z)}return null}function or(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Z(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function he(e,t){let{mimeType:n}=pt(e)||{},r=globalThis.loaders?.parseImageNode;return D(r),await r(e,n)}async function pe(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=n||{},i=ir(s),c;switch(i){case"imagebitmap":c=await fe(e,t,o);break;case"image":c=await ht(e,t,o);break;case"data":c=await he(e,t);break;default:D(!1)}return s==="data"&&(c=ft(c)),c}function ir(e){switch(e){case"auto":case"data":return oe();default:return se(e),e}}var cr=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],ar=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],fr={image:{type:"auto",decode:!0}},mt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:re,mimeTypes:ar,extensions:cr,parse:pe,tests:[e=>Boolean(pt(new DataView(e)))],options:fr};function xt(e,t,n){let r=typeof e=="function"?e({...t,...n}):e,s=t.baseUrl;return s&&(r=s[s.length-1]==="/"?`${s}${r}`:`${s}/${r}`),Lt(r)}var lr=e=>e&&typeof e=="object";async function me(e,t,n={}){return await Ot(e,t,n)}async function Ot(e,t,n){return Array.isArray(e)?await pr(e,t,n):lr(e)?await hr(e,t,n):await t(e,n)}async function hr(e,t,n){let r=[],s={};for(let o in e){let i=e[o],c=Ot(i,t,n).then(a=>{s[o]=a});r.push(c)}return await Promise.all(r),s}async function pr(e,t,n={}){let r=e.map(s=>Ot(s,t,n));return await Promise.all(r)}async function xe(e,t,n){return await me(e,r=>wt(r,t,n))}async function wt(e,t,n){let s=await(await fetch(e,n.fetch)).arrayBuffer();return await t(s,n)}async function J(e,t={}){let n=await mr(e,t);return await xe(n,mt.parse,t)}async function mr(e,t,n={}){let r=t&&t.image&&t.image.mipLevels||0;return r!==0?await xr(e,r,t,n):xt(e,t,n)}async function xr(e,t,n,r){let s=[];if(t==="auto"){let o=xt(e,n,{...r,lod:0}),i=await wt(o,mt.parse,n),{width:c,height:a}=Nt(i);t=gr({width:c,height:a}),s.push(o)}D(t>0);for(let o=s.length;o<t;++o){let i=xt(e,n,{...r,lod:o});s.push(i)}return s}function gr(e){return 1+Math.floor(Math.log2(Math.max(e.width,e.height)))}function de(e,t){let n=new Pt.AsyncTexture(e,{id:"brdfLUT",sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"},data:J(t.brdfLutUrl)}),r=ge(e,{id:"DiffuseEnvSampler",getTextureForFace:o=>J(t.getTexUrl("diffuse",o,0)),sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}}),s=ge(e,{id:"SpecularEnvSampler",getTextureForFace:o=>{let i=[];for(let c=0;c<=t.specularMipLevels-1;c++)i.push(J(t.getTexUrl("specular",o,c)));return i},sampler:{wrapS:"clamp-to-edge",wrapT:"clamp-to-edge",minFilter:"linear",maxFilter:"linear"}});return{brdfLutTexture:n,diffuseEnvSampler:r,specularEnvSampler:s}}var dr=[0,1,2,3,4,5];function ge(e,{id:t,getTextureForFace:n,sampler:r}){let s={};return dr.forEach(o=>{s[String(o)]=n(o)}),new Pt.AsyncTexture(e,{id:t,dimension:"cube",mipmaps:!1,sampler:r,data:s})}var X=V(at(),1);var no=1/Math.PI*180,ro=1/180*Math.PI,Mr={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Mr}};var L=globalThis.mathgl.config;function Me(e,{precision:t=L.precision}={}){return e=ur(e),"".concat(parseFloat(e.toPrecision(t)))}function H(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ct(e,t,n){let r=L.EPSILON;n&&(L.EPSILON=n);try{if(e===t)return!0;if(H(e)&&H(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Ct(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=L.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{L.EPSILON=r}}function ur(e){return Math.round(e/L.EPSILON)*L.EPSILON}function Ar(e){function t(){var n=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var U=class extends Ar(Array){clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:H(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(L)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Me(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(n,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Ct(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof n=="number"?n:n[s];this[s]=o+r*(i-o)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(L.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function _r(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function y(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function G(e,t,n=""){if(L.debug&&!_r(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}function Bt(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var gt=class extends U{get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return y(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return y(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),y(this[t])}setComponent(t,n){return Bt(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var R=typeof Float32Array<"u"?Float32Array:Array;var xo=Math.PI/180;function Sr(){let e=new R(2);return R!=Float32Array&&(e[0]=0,e[1]=0),e}function _e(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var go=function(){let e=Sr();return function(t,n,r,s,o,i){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],o(e,e,i),t[c]=e[0],t[c+1]=e[1];return t}}();function Se(e,t,n){let r=t[0],s=t[1],o=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/o,e[1]=(n[1]*r+n[5]*s)/o,e}function Ee(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o||1;return e[0]=(n[0]*r+n[4]*s+n[8]*o)/i,e[1]=(n[1]*r+n[5]*s+n[9]*o)/i,e[2]=(n[2]*r+n[6]*s+n[10]*o)/i,e}function ye(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function Te(e,t,n){let r=t[0],s=t[1],o=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*o,e[1]=n[1]*r+n[4]*s+n[7]*o,e[2]=n[2]*r+n[5]*s+n[8]*o,e[3]=t[3],e}function zt(){let e=new R(3);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Er(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function kt(e,t,n){let r=new R(3);return r[0]=e,r[1]=t,r[2]=n,r}function Le(e,t){let n=t[0],r=t[1],s=t[2],o=n*n+r*r+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function Re(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function dt(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2];return e[0]=s*a-o*c,e[1]=o*i-r*a,e[2]=r*c-s*i,e}function Mt(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[3]*r+n[7]*s+n[11]*o+n[15];return i=i||1,e[0]=(n[0]*r+n[4]*s+n[8]*o+n[12])/i,e[1]=(n[1]*r+n[5]*s+n[9]*o+n[13])/i,e[2]=(n[2]*r+n[6]*s+n[10]*o+n[14])/i,e}function ve(e,t,n){let r=n[0],s=n[1],o=n[2],i=n[3],c=t[0],a=t[1],f=t[2],l=s*f-o*a,h=o*c-r*f,p=r*a-s*c,m=s*p-o*h,x=o*l-r*p,g=r*h-s*l,d=i*2;return l*=d,h*=d,p*=d,m*=2,x*=2,g*=2,e[0]=c+l+m,e[1]=a+h+x,e[2]=f+p+g,e}var Ie=Er;var Ao=function(){let e=zt();return function(t,n,r,s,o,i){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var ut,Y=class extends gt{static get ZERO(){return ut||(ut=new Y(0,0,0,0),Object.freeze(ut)),ut}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),H(t)&&arguments.length===1?this.copy(t):(L.debug&&(y(t),y(n),y(r),y(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return L.debug&&(y(t.x),y(t.y),y(t.z),y(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}transform(t){return Mt(this,this,t),this.check()}transformByMatrix3(t){return Te(this,this,t),this.check()}transformByMatrix2(t){return ye(this,this,t),this.check()}transformByQuaternion(t){return ve(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var At=class extends U{toString(){let t="[";if(L.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+n])}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=" ".concat(this[n])}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=y(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function Ne(){let e=new R(9);return R!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Lr(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function be(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],o=t[6],i=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=s,e[13]=i,e[14]=c}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Oe(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=t[4],c=t[5],a=t[6],f=t[7],l=t[8],h=t[9],p=t[10],m=t[11],x=t[12],g=t[13],d=t[14],S=t[15],T=n*c-r*i,M=n*a-s*i,u=n*f-o*i,A=r*a-s*c,_=r*f-o*c,v=s*f-o*a,I=l*g-h*x,N=l*d-p*x,b=l*S-m*x,O=h*d-p*g,w=h*S-m*g,P=p*S-m*d,E=T*P-M*w+u*O+A*b-_*N+v*I;return E?(E=1/E,e[0]=(c*P-a*w+f*O)*E,e[1]=(s*w-r*P-o*O)*E,e[2]=(g*v-d*_+S*A)*E,e[3]=(p*_-h*v-m*A)*E,e[4]=(a*b-i*P-f*N)*E,e[5]=(n*P-s*b+o*N)*E,e[6]=(d*u-x*v-S*M)*E,e[7]=(l*v-p*u+m*M)*E,e[8]=(i*w-c*b+f*I)*E,e[9]=(r*b-n*w-o*I)*E,e[10]=(x*_-g*u+S*T)*E,e[11]=(h*u-l*_-m*T)*E,e[12]=(c*N-i*O-a*I)*E,e[13]=(n*O-r*N+s*I)*E,e[14]=(g*M-x*A-d*T)*E,e[15]=(l*A-h*M+p*T)*E,e):null}function we(e){let t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],i=e[5],c=e[6],a=e[7],f=e[8],l=e[9],h=e[10],p=e[11],m=e[12],x=e[13],g=e[14],d=e[15],S=t*i-n*o,T=t*c-r*o,M=n*c-r*i,u=f*x-l*m,A=f*g-h*m,_=l*g-h*x,v=t*_-n*A+r*u,I=o*_-i*A+c*u,N=f*M-l*T+h*S,b=m*M-x*T+g*S;return a*v-s*I+d*N-p*b}function Ft(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=t[4],a=t[5],f=t[6],l=t[7],h=t[8],p=t[9],m=t[10],x=t[11],g=t[12],d=t[13],S=t[14],T=t[15],M=n[0],u=n[1],A=n[2],_=n[3];return e[0]=M*r+u*c+A*h+_*g,e[1]=M*s+u*a+A*p+_*d,e[2]=M*o+u*f+A*m+_*S,e[3]=M*i+u*l+A*x+_*T,M=n[4],u=n[5],A=n[6],_=n[7],e[4]=M*r+u*c+A*h+_*g,e[5]=M*s+u*a+A*p+_*d,e[6]=M*o+u*f+A*m+_*S,e[7]=M*i+u*l+A*x+_*T,M=n[8],u=n[9],A=n[10],_=n[11],e[8]=M*r+u*c+A*h+_*g,e[9]=M*s+u*a+A*p+_*d,e[10]=M*o+u*f+A*m+_*S,e[11]=M*i+u*l+A*x+_*T,M=n[12],u=n[13],A=n[14],_=n[15],e[12]=M*r+u*c+A*h+_*g,e[13]=M*s+u*a+A*p+_*d,e[14]=M*o+u*f+A*m+_*S,e[15]=M*i+u*l+A*x+_*T,e}function Pe(e,t,n){let r=n[0],s=n[1],o=n[2],i,c,a,f,l,h,p,m,x,g,d,S;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*o+t[12],e[13]=t[1]*r+t[5]*s+t[9]*o+t[13],e[14]=t[2]*r+t[6]*s+t[10]*o+t[14],e[15]=t[3]*r+t[7]*s+t[11]*o+t[15]):(i=t[0],c=t[1],a=t[2],f=t[3],l=t[4],h=t[5],p=t[6],m=t[7],x=t[8],g=t[9],d=t[10],S=t[11],e[0]=i,e[1]=c,e[2]=a,e[3]=f,e[4]=l,e[5]=h,e[6]=p,e[7]=m,e[8]=x,e[9]=g,e[10]=d,e[11]=S,e[12]=i*r+l*s+x*o+t[12],e[13]=c*r+h*s+g*o+t[13],e[14]=a*r+p*s+d*o+t[14],e[15]=f*r+m*s+S*o+t[15]),e}function Ce(e,t,n){let r=n[0],s=n[1],o=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Be(e,t,n,r){let s=r[0],o=r[1],i=r[2],c=Math.sqrt(s*s+o*o+i*i),a,f,l,h,p,m,x,g,d,S,T,M,u,A,_,v,I,N,b,O,w,P,E,j;return c<1e-6?null:(c=1/c,s*=c,o*=c,i*=c,f=Math.sin(n),a=Math.cos(n),l=1-a,h=t[0],p=t[1],m=t[2],x=t[3],g=t[4],d=t[5],S=t[6],T=t[7],M=t[8],u=t[9],A=t[10],_=t[11],v=s*s*l+a,I=o*s*l+i*f,N=i*s*l-o*f,b=s*o*l-i*f,O=o*o*l+a,w=i*o*l+s*f,P=s*i*l+o*f,E=o*i*l-s*f,j=i*i*l+a,e[0]=h*v+g*I+M*N,e[1]=p*v+d*I+u*N,e[2]=m*v+S*I+A*N,e[3]=x*v+T*I+_*N,e[4]=h*b+g*O+M*w,e[5]=p*b+d*O+u*w,e[6]=m*b+S*O+A*w,e[7]=x*b+T*O+_*w,e[8]=h*P+g*E+M*j,e[9]=p*P+d*E+u*j,e[10]=m*P+S*E+A*j,e[11]=x*P+T*E+_*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ze(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[4],i=t[5],c=t[6],a=t[7],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*s+f*r,e[5]=i*s+l*r,e[6]=c*s+h*r,e[7]=a*s+p*r,e[8]=f*s-o*r,e[9]=l*s-i*r,e[10]=h*s-c*r,e[11]=p*s-a*r,e}function ke(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[8],l=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s-f*r,e[1]=i*s-l*r,e[2]=c*s-h*r,e[3]=a*s-p*r,e[8]=o*r+f*s,e[9]=i*r+l*s,e[10]=c*r+h*s,e[11]=a*r+p*s,e}function Fe(e,t,n){let r=Math.sin(n),s=Math.cos(n),o=t[0],i=t[1],c=t[2],a=t[3],f=t[4],l=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s+f*r,e[1]=i*s+l*r,e[2]=c*s+h*r,e[3]=a*s+p*r,e[4]=f*s-o*r,e[5]=l*s-i*r,e[6]=h*s-c*r,e[7]=p*s-a*r,e}function Ue(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n+n,c=r+r,a=s+s,f=n*i,l=r*i,h=r*c,p=s*i,m=s*c,x=s*a,g=o*i,d=o*c,S=o*a;return e[0]=1-h-x,e[1]=l+S,e[2]=p-d,e[3]=0,e[4]=l-S,e[5]=1-f-x,e[6]=m+g,e[7]=0,e[8]=p+d,e[9]=m-g,e[10]=1-f-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ve(e,t,n,r,s,o,i){let c=1/(n-t),a=1/(s-r),f=1/(o-i);return e[0]=o*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(i+o)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*o*2*f,e[15]=0,e}function Rr(e,t,n,r,s){let o=1/Math.tan(t/2);if(e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let i=1/(r-s);e[10]=(s+r)*i,e[14]=2*s*r*i}else e[10]=-1,e[14]=-2*r;return e}var De=Rr;function vr(e,t,n,r,s,o,i){let c=1/(t-n),a=1/(r-s),f=1/(o-i);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*f,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(i+o)*f,e[15]=1,e}var qe=vr;function He(e,t,n,r){let s,o,i,c,a,f,l,h,p,m,x=t[0],g=t[1],d=t[2],S=r[0],T=r[1],M=r[2],u=n[0],A=n[1],_=n[2];return Math.abs(x-u)<1e-6&&Math.abs(g-A)<1e-6&&Math.abs(d-_)<1e-6?Lr(e):(h=x-u,p=g-A,m=d-_,s=1/Math.sqrt(h*h+p*p+m*m),h*=s,p*=s,m*=s,o=T*m-M*p,i=M*h-S*m,c=S*p-T*h,s=Math.sqrt(o*o+i*i+c*c),s?(s=1/s,o*=s,i*=s,c*=s):(o=0,i=0,c=0),a=p*c-m*i,f=m*o-h*c,l=h*i-p*o,s=Math.sqrt(a*a+f*f+l*l),s?(s=1/s,a*=s,f*=s,l*=s):(a=0,f=0,l=0),e[0]=o,e[1]=a,e[2]=h,e[3]=0,e[4]=i,e[5]=f,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=m,e[11]=0,e[12]=-(o*x+i*g+c*d),e[13]=-(a*x+f*g+l*d),e[14]=-(h*x+p*g+m*d),e[15]=1,e)}function Ir(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Ge(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Ye(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function We(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Xe(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function je(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=n*i,e[1]=r*i,e[2]=s*i,e[3]=o*i,e}function $e(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ke(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=o+r*(n[1]-o),e[2]=i+r*(n[2]-i),e[3]=c+r*(n[3]-c),e}function Qe(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*o+n[12]*i,e[1]=n[1]*r+n[5]*s+n[9]*o+n[13]*i,e[2]=n[2]*r+n[6]*s+n[10]*o+n[14]*i,e[3]=n[3]*r+n[7]*s+n[11]*o+n[15]*i,e}function Ze(e,t,n){let r=t[0],s=t[1],o=t[2],i=n[0],c=n[1],a=n[2],f=n[3],l=f*r+c*o-a*s,h=f*s+a*r-i*o,p=f*o+i*s-c*r,m=-i*r-c*s-a*o;return e[0]=l*f+m*-i+h*-a-p*-c,e[1]=h*f+m*-c+p*-i-l*-a,e[2]=p*f+m*-a+l*-c-h*-i,e[3]=t[3],e}var Oo=function(){let e=Ir();return function(t,n,r,s,o,i){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],o(e,e,i),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Dt;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Dt||(Dt={}));var br=45*Math.PI/180,Or=1,Ut=.1,Vt=500,wr=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),F=class extends At{static get IDENTITY(){return Cr()}static get ZERO(){return Pr()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Dt}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,o,i,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=o,this[5]=i,this[6]=c,this[7]=a,this[8]=f,this[9]=l,this[10]=h,this[11]=p,this[12]=m,this[13]=x,this[14]=g,this[15]=d,this.check()}setRowMajor(t,n,r,s,o,i,c,a,f,l,h,p,m,x,g,d){return this[0]=t,this[1]=o,this[2]=f,this[3]=m,this[4]=n,this[5]=i,this[6]=l,this[7]=x,this[8]=r,this[9]=c,this[10]=h,this[11]=g,this[12]=s,this[13]=a,this[14]=p,this[15]=d,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(wr)}fromObject(t){return this.check()}fromQuaternion(t){return Ue(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:o,near:i=Ut,far:c=Vt}=t;return c===1/0?Br(this,n,r,s,o,i):Ve(this,n,r,s,o,i,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return He(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:o,near:i=Ut,far:c=Vt}=t;return qe(this,n,r,s,o,i,c),this.check()}orthographic(t){let{fovy:n=br,aspect:r=Or,focalDistance:s=1,near:o=Ut,far:i=Vt}=t;Je(n);let c=n/2,a=s*Math.tan(c),f=a*r;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:o,far:i})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:o=500}=t;return Je(n),De(this,n,r,s,o),this.check()}determinant(){return we(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*o,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*o,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],o=1/r[1],i=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=this[4]*s,t[4]=this[5]*o,t[5]=this[6]*i,t[6]=this[8]*s,t[7]=this[9]*o,t[8]=this[10]*i,t}transpose(){return be(this,this),this.check()}invert(){return Oe(this,this),this.check()}multiplyLeft(t){return Ft(this,t,this),this.check()}multiplyRight(t){return Ft(this,this,t),this.check()}rotateX(t){return ze(this,this,t),this.check()}rotateY(t){return ke(this,this,t),this.check()}rotateZ(t){return Fe(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Be(this,this,t,n),this.check()}scale(t){return Ce(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Pe(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Qe(n||[-0,-0,-0,-0],t,this),G(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=_e(n||[-0,-0],t,this);break;case 3:s=Mt(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return G(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=Se(n||[-0,-0],t,this);break;case 3:r=Ee(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return G(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},_t,St;function Pr(){return _t||(_t=new F([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(_t)),_t}function Cr(){return St||(St=new F,Object.freeze(St)),St}function Je(e){if(e>Math.PI*2)throw Error("expected radians")}function Br(e,t,n,r,s,o){let i=2*o/(n-t),c=2*o/(s-r),a=(n+t)/(n-t),f=(s+r)/(s-r),l=-1,h=-1,p=-2*o;return e[0]=i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=f,e[10]=l,e[11]=h,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function tn(){let e=new R(4);return R!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function en(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function qt(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Ht(e,t,n){let r=t[0],s=t[1],o=t[2],i=t[3],c=n[0],a=n[1],f=n[2],l=n[3];return e[0]=r*l+i*c+s*f-o*a,e[1]=s*l+i*a+o*c-r*f,e[2]=o*l+i*f+r*a-s*c,e[3]=i*l-r*c-s*a-o*f,e}function nn(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+i*c,e[1]=s*a+o*c,e[2]=o*a-s*c,e[3]=i*a-r*c,e}function rn(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-o*c,e[1]=s*a+i*c,e[2]=o*a+r*c,e[3]=i*a-s*c,e}function sn(e,t,n){n*=.5;let r=t[0],s=t[1],o=t[2],i=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=o*a+i*c,e[3]=i*a-o*c,e}function on(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function et(e,t,n,r){let s=t[0],o=t[1],i=t[2],c=t[3],a=n[0],f=n[1],l=n[2],h=n[3],p,m,x,g,d;return p=s*a+o*f+i*l+c*h,p<0&&(p=-p,a=-a,f=-f,l=-l,h=-h),1-p>1e-6?(m=Math.acos(p),d=Math.sin(m),x=Math.sin((1-r)*m)/d,g=Math.sin(r*m)/d):(x=1-r,g=r),e[0]=x*s+g*a,e[1]=x*o+g*f,e[2]=x*i+g*l,e[3]=x*c+g*h,e}function cn(e,t){let n=t[0],r=t[1],s=t[2],o=t[3],i=n*n+r*r+s*s+o*o,c=i?1/i:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=o*c,e}function an(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Gt(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*r,r=.5/r,e[3]=(t[o*3+i]-t[i*3+o])*r,e[o]=(t[o*3+s]+t[s*3+o])*r,e[i]=(t[i*3+s]+t[s*3+i])*r}return e}var fn=Ge;var ln=Ye,hn=$e,pn=Ke,mn=We;var xn=Xe;var gn=je;var dn=function(){let e=zt(),t=kt(1,0,0),n=kt(0,1,0);return function(r,s,o){let i=Re(s,o);return i<-.999999?(dt(e,t,s),Ie(e)<1e-6&&dt(e,n,s),Le(e,e),qt(r,e,Math.PI),r):i>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(dt(e,s,o),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+i,gn(r,r))}}(),Yo=function(){let e=tn(),t=tn();return function(n,r,s,o,i,c){return et(e,r,i,c),et(t,s,o,c),et(n,e,t,2*c*(1-c)),n}}(),Wo=function(){let e=Ne();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],gn(t,Gt(t,e))}}();var zr=[0,0,0,1],nt=class extends U{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Gt(this,t),this.check()}fromAxisRotation(t,n){return qt(this,t,n),this.check()}identity(){return en(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=y(t)}get y(){return this[1]}set y(t){this[1]=y(t)}get z(){return this[2]}set z(t){this[2]=y(t)}get w(){return this[3]}set w(t){this[3]=y(t)}len(){return mn(this)}lengthSquared(){return xn(this)}dot(t){return hn(this,t)}rotationTo(t,n){return dn(this,t,n),this.check()}add(t){return fn(this,this,t),this.check()}calculateW(){return on(this,this),this.check()}conjugate(){return an(this,this),this.check()}invert(){return cn(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(pn(this,t,n,r),this.check())}multiplyRight(t){return Ht(this,this,t),this.check()}multiplyLeft(t){return Ht(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return nn(this,this,t),this.check()}rotateY(t){return rn(this,this,t),this.check()}rotateZ(t){return sn(this,this,t),this.check()}scale(t){return ln(this,this,t),this.check()}slerp(t,n,r){let s,o,i;switch(arguments.length){case 1:({start:s=zr,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=n;break;default:s=t,o=n,i=r}return et(this,s,o,i),this.check()}transformVector4(t,n=new Y){return Ze(n,t,this),G(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Wt=V($(),1);var kr={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Fr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Xt=class{name;startTime=0;playing=!0;speed=1;channels=[];constructor(t){Object.assign(this,t)}animate(t){if(!this.playing)return;let r=(t/1e3-this.startTime)*this.speed;this.channels.forEach(({sampler:s,target:o,path:i})=>{Gr(r,s,o,i),Vr(o,o._node)})}},W=class{animations;constructor(t){this.animations=t.animations.map((n,r)=>{let s=n.name||`Animation-${r}`,o=n.samplers.map(({input:c,interpolation:a="LINEAR",output:f})=>({input:Mn(t.accessors[c]),interpolation:a,output:Mn(t.accessors[f])})),i=n.channels.map(({sampler:c,target:a})=>({sampler:o[c],target:t.nodes[a.node],path:a.path}));return new Xt({name:s,channels:i})})}animate(t){this.setTime(t)}setTime(t){this.animations.forEach(n=>n.animate(t))}getAnimations(){return this.animations}};function Mn(e){if(!e._animation){let t=Fr[e.componentType],n=kr[e.type],r=n*e.count,{buffer:s,byteOffset:o}=e.bufferView.data,i=new t(s,o+(e.byteOffset||0),r);if(n===1)e._animation=Array.from(i);else{let c=[];for(let a=0;a<i.length;a+=n)c.push(Array.from(i.slice(a,a+n)));e._animation=c}}return e._animation}var Ur=new F;function Vr(e,t){if(t.matrix.identity(),e.translation&&t.matrix.translate(e.translation),e.rotation){let n=Ur.fromQuaternion(e.rotation);t.matrix.multiplyRight(n)}e.scale&&t.matrix.scale(e.scale)}var Yt=new nt;function Dr(e,t,n,r,s){if(t==="rotation"){Yt.slerp({start:n,target:r,ratio:s});for(let o=0;o<Yt.length;o++)e[t][o]=Yt[o]}else for(let o=0;o<n.length;o++)e[t][o]=s*r[o]+(1-s)*n[o]}function qr(e,t,{p0:n,outTangent0:r,inTangent1:s,p1:o,tDiff:i,ratio:c}){for(let a=0;a<e[t].length;a++){let f=r[a]*i,l=s[a]*i;e[t][a]=(2*Math.pow(c,3)-3*Math.pow(c,2)+1)*n[a]+(Math.pow(c,3)-2*Math.pow(c,2)+c)*f+(-2*Math.pow(c,3)+3*Math.pow(c,2))*o[a]+(Math.pow(c,3)-Math.pow(c,2))*l}}function Hr(e,t,n){for(let r=0;r<n.length;r++)e[t][r]=n[r]}function Gr(e,{input:t,interpolation:n,output:r},s,o){let i=t[t.length-1],c=e%i,a=t.findIndex(p=>p>=c),f=Math.max(0,a-1);if(!Array.isArray(s[o]))switch(o){case"translation":s[o]=[0,0,0];break;case"rotation":s[o]=[0,0,0,1];break;case"scale":s[o]=[1,1,1];break;default:Wt.log.warn(`Bad animation path ${o}`)()}let l=t[f],h=t[a];switch(n){case"STEP":Hr(s,o,r[f]);break;case"LINEAR":if(h>l){let p=(c-l)/(h-l);Dr(s,o,r[f],r[a],p)}break;case"CUBICSPLINE":if(h>l){let p=(c-l)/(h-l),m=h-l,x=r[3*f+1],g=r[3*f+2],d=r[3*a+0],S=r[3*a+1];qr(s,o,{p0:x,outTangent0:g,inTangent1:d,p1:S,tDiff:m,ratio:p})}break;default:Wt.log.warn(`Interpolation ${n} not supported`)();break}}var En=V($(),1);var jt=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
8
8
|
struct AmbientLight {
|
|
9
9
|
vec3 color;
|
|
10
10
|
};
|
|
@@ -29,7 +29,7 @@ return pointLight.attenuation.x
|
|
|
29
29
|
+ pointLight.attenuation.z * distance * distance;
|
|
30
30
|
}
|
|
31
31
|
#endif
|
|
32
|
-
`;var
|
|
32
|
+
`;var Yr={lightSources:{}};function $t(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/255)}function Wr({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};return e?r["lighting_uAmbientLight.color"]=$t(e):r["lighting_uAmbientLight.color"]=[0,0,0],t.forEach((s,o)=>{r[`lighting_uPointLight[${o}].color`]=$t(s),r[`lighting_uPointLight[${o}].position`]=s.position,r[`lighting_uPointLight[${o}].attenuation`]=s.attenuation||[1,0,0]}),r.lighting_uPointLightCount=t.length,n.forEach((s,o)=>{r[`lighting_uDirectionalLight[${o}].color`]=$t(s),r[`lighting_uDirectionalLight[${o}].direction`]=s.direction}),r.lighting_uDirectionalLightCount=n.length,r}function un(e=Yr){if("lightSources"in e){let{ambientLight:t,pointLights:n,directionalLights:r}=e.lightSources||{};return t||n&&n.length>0||r&&r.length>0?Object.assign({},Wr({ambientLight:t,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){let t={pointLights:[],directionalLights:[]};for(let n of e.lights||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return un({lightSources:t})}return{}}var An={name:"lights",vs:jt,fs:jt,getUniforms:un,defines:{MAX_LIGHTS:3}};var _n=`uniform mat4 u_MVPMatrix;
|
|
33
33
|
uniform mat4 u_ModelMatrix;
|
|
34
34
|
uniform mat4 u_NormalMatrix;
|
|
35
35
|
out vec3 pbr_vPosition;
|
|
@@ -61,7 +61,7 @@ pbr_vUV = uv;
|
|
|
61
61
|
pbr_vUV = vec2(0.,0.);
|
|
62
62
|
#endif
|
|
63
63
|
}
|
|
64
|
-
`;var
|
|
64
|
+
`;var Sn=`precision highp float;
|
|
65
65
|
uniform bool pbr_uUnlit;
|
|
66
66
|
#ifdef USE_IBL
|
|
67
67
|
uniform samplerCube u_DiffuseEnvSampler;
|
|
@@ -330,31 +330,23 @@ color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
|
|
|
330
330
|
}
|
|
331
331
|
return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
|
|
332
332
|
}
|
|
333
|
-
`;var
|
|
334
|
-
|
|
335
|
-
#if (__VERSION__ < 300)
|
|
336
|
-
#define _attr attribute
|
|
337
|
-
#else
|
|
338
|
-
#define _attr in
|
|
339
|
-
#endif
|
|
340
|
-
|
|
341
|
-
// _attr vec4 POSITION;
|
|
342
|
-
_attr vec4 positions;
|
|
333
|
+
`;var Kt={name:"pbr",vs:_n,fs:Sn,defines:{LIGHTING_FRAGMENT:1},dependencies:[An],getUniforms:e=>e};var Et=V(at(),1);var Xr=`
|
|
334
|
+
layout(0) positions: vec4; // in vec4 POSITION;
|
|
343
335
|
|
|
344
336
|
#ifdef HAS_NORMALS
|
|
345
|
-
//
|
|
346
|
-
_attr vec4 normals;
|
|
337
|
+
in vec4 normals; // in vec4 NORMAL;
|
|
347
338
|
#endif
|
|
348
339
|
|
|
349
340
|
#ifdef HAS_TANGENTS
|
|
350
|
-
|
|
341
|
+
in vec4 TANGENT;
|
|
351
342
|
#endif
|
|
352
343
|
|
|
353
344
|
#ifdef HAS_UV
|
|
354
|
-
//
|
|
355
|
-
|
|
345
|
+
// in vec2 TEXCOORD_0;
|
|
346
|
+
in vec2 texCoords;
|
|
356
347
|
#endif
|
|
357
348
|
|
|
349
|
+
@vertex
|
|
358
350
|
void main(void) {
|
|
359
351
|
vec4 _NORMAL = vec4(0.);
|
|
360
352
|
vec4 _TANGENT = vec4(0.);
|
|
@@ -375,19 +367,47 @@ return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
|
|
|
375
367
|
pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
|
|
376
368
|
gl_Position = u_MVPMatrix * positions;
|
|
377
369
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
#if (__VERSION__ < 300)
|
|
381
|
-
#define fragmentColor gl_FragColor
|
|
382
|
-
#else
|
|
370
|
+
|
|
371
|
+
@fragment
|
|
383
372
|
out vec4 fragmentColor;
|
|
384
|
-
#endif
|
|
385
373
|
|
|
386
374
|
void main(void) {
|
|
387
375
|
vec3 pos = pbr_vPosition;
|
|
388
376
|
fragmentColor = pbr_filterColor(vec4(1.0));
|
|
389
377
|
}
|
|
390
|
-
|
|
391
|
-
|
|
378
|
+
`,jr=`#version 300 es
|
|
379
|
+
in vec4 positions;
|
|
380
|
+
#ifdef HAS_NORMALS
|
|
381
|
+
in vec4 normals;
|
|
382
|
+
#endif
|
|
383
|
+
#ifdef HAS_TANGENTS
|
|
384
|
+
in vec4 TANGENT;
|
|
385
|
+
#endif
|
|
386
|
+
#ifdef HAS_UV
|
|
387
|
+
in vec2 texCoords;
|
|
388
|
+
#endif
|
|
389
|
+
void main(void) {
|
|
390
|
+
vec4 _NORMAL = vec4(0.);
|
|
391
|
+
vec4 _TANGENT = vec4(0.);
|
|
392
|
+
vec2 _TEXCOORD_0 = vec2(0.);
|
|
393
|
+
#ifdef HAS_NORMALS
|
|
394
|
+
_NORMAL = normals;
|
|
395
|
+
#endif
|
|
396
|
+
#ifdef HAS_TANGENTS
|
|
397
|
+
_TANGENT = TANGENT;
|
|
398
|
+
#endif
|
|
399
|
+
#ifdef HAS_UV
|
|
400
|
+
_TEXCOORD_0 = texCoords;
|
|
401
|
+
#endif
|
|
402
|
+
pbr_setPositionNormalTangentUV(positions, _NORMAL, _TANGENT, _TEXCOORD_0);
|
|
403
|
+
gl_Position = u_MVPMatrix * positions;
|
|
404
|
+
}
|
|
405
|
+
`,$r=`#version 300 es
|
|
406
|
+
out vec4 fragmentColor;
|
|
407
|
+
void main(void) {
|
|
408
|
+
vec3 pos = pbr_vPosition;
|
|
409
|
+
fragmentColor = pbr_filterColor(vec4(1.0));
|
|
410
|
+
}
|
|
411
|
+
`;function yn(e,t){let{id:n,geometry:r,material:s,vertexCount:o,materialOptions:i,modelOptions:c}=t,a=ct(e,s,r.attributes,i);En.log.info(4,"createGLTFModel defines: ",a.defines)();let f=[],l={depthWriteEnabled:!0,depthCompare:"less",depthFormat:"depth24plus",cullMode:"back"},h={id:n,source:Xr,vs:jr,fs:$r,geometry:r,topology:r.topology,vertexCount:o,modules:[Kt],...c,bindings:{...a.bindings,...c.bindings},defines:{...a.defines,...c.defines},parameters:{...l,...a.parameters,...c.parameters},uniforms:{...a.uniforms,...c.uniforms}},p=new Et.Model(e,h);return new Et.ModelNode({managedResources:f,model:p})}var q;(function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(q||(q={}));function Tn(e){switch(e){case q.POINTS:return"point-list";case q.LINES:return"line-list";case q.LINE_STRIP:return"line-strip";case q.TRIANGLES:return"triangle-list";case q.TRIANGLE_STRIP:return"triangle-strip";default:throw new Error(String(e))}}var Kr={modelOptions:{},pbrDebug:!1,imageBasedLightingEnvironment:null,lights:!0,useTangents:!1},yt=class{device;options;gltf;constructor(t,n={}){this.device=t,this.options={...Kr,...n}}instantiate(t){return this.gltf=t,(t.scenes||[]).map(r=>this.createScene(r))}createAnimator(){return Array.isArray(this.gltf.animations)?new W(this.gltf):null}createScene(t){let r=(t.nodes||[]).map(o=>this.createNode(o));return new X.GroupNode({id:t.name||t.id,children:r})}createNode(t){if(!t._node){let r=(t.children||[]).map(o=>this.createNode(o));t.mesh&&r.push(this.createMesh(t.mesh));let s=new X.GroupNode({id:t.name||t.id,children:r});if(t.matrix)s.setMatrix(t.matrix);else{if(s.matrix.identity(),t.translation&&s.matrix.translate(t.translation),t.rotation){let o=new F().fromQuaternion(t.rotation);s.matrix.multiplyRight(o)}t.scale&&s.matrix.scale(t.scale)}t._node=s}return t._node}createMesh(t){if(!t._mesh){let r=(t.primitives||[]).map((o,i)=>this.createPrimitive(o,i,t)),s=new X.GroupNode({id:t.name||t.id,children:r});t._mesh=s}return t._mesh}createPrimitive(t,n,r){let s=t.name||`${r.name||r.id}-primitive-${n}`,o=Tn(t.mode||4),i=t.indices?t.indices.count:this.getVertexCount(t.attributes),c=yn(this.device,{id:s,geometry:this.createGeometry(s,t,o),material:t.material,materialOptions:this.options,modelOptions:this.options.modelOptions,vertexCount:i});return c.bounds=[t.attributes.POSITION.min,t.attributes.POSITION.max],c}getVertexCount(t){throw new Error("getVertexCount not implemented")}createGeometry(t,n,r){let s={};for(let[o,i]of Object.entries(n.attributes)){let{components:c,size:a,value:f}=i;s[o]={size:a??c,value:f}}return new X.Geometry({id:t,topology:r,indices:n.indices.value,attributes:s})}createBuffer(t,n){t.bufferView||(t.bufferView={});let{bufferView:r}=t;return r.lumaBuffers||(r.lumaBuffers={}),r.lumaBuffers[n]||(r.lumaBuffers[n]=this.device.createBuffer({id:`from-${r.id}`,data:r.data||t.value})),r.lumaBuffers[n]}createSampler(t){return t}needsPOT(){return!1}};function Ln(e,t,n){let r=new yt(e,n),s=r.instantiate(t),o=r.createAnimator();return{scenes:s,animator:o}}return wn(rt);})();
|
|
392
412
|
return __exports__;
|
|
393
413
|
});
|