@luma.gl/engine 9.0.0-alpha.44 → 9.0.0-alpha.46
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/dist/dist.dev.js +25 -9
- package/dist/index.cjs +27 -4
- package/dist/model/model.d.ts +8 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +11 -1
- package/dist/model/model.js.map +1 -1
- package/dist.min.js +6 -6
- package/package.json +5 -5
- package/src/model/model.ts +47 -8
- package/LICENSE +0 -34
package/dist/dist.dev.js
CHANGED
|
@@ -1308,10 +1308,10 @@ var __exports__ = (() => {
|
|
|
1308
1308
|
// Device loss
|
|
1309
1309
|
/** `true` if device is already lost */
|
|
1310
1310
|
/** Promise that resolves when device is lost */
|
|
1311
|
-
/**
|
|
1312
|
-
* Trigger device loss.
|
|
1313
|
-
* @returns `true` if context loss could actually be triggered.
|
|
1314
|
-
* @note primarily intended for testing how application reacts to device loss
|
|
1311
|
+
/**
|
|
1312
|
+
* Trigger device loss.
|
|
1313
|
+
* @returns `true` if context loss could actually be triggered.
|
|
1314
|
+
* @note primarily intended for testing how application reacts to device loss
|
|
1315
1315
|
*/
|
|
1316
1316
|
loseDevice() {
|
|
1317
1317
|
return false;
|
|
@@ -1340,9 +1340,10 @@ var __exports__ = (() => {
|
|
|
1340
1340
|
}
|
|
1341
1341
|
/** Create a temporary texture view of a video source */
|
|
1342
1342
|
/** Create a sampler */
|
|
1343
|
+
/** Create a Framebuffer. Must have at least one attachment. */
|
|
1343
1344
|
/** Create a shader */
|
|
1344
1345
|
/** Create a render pipeline (aka program) */
|
|
1345
|
-
/** Create a compute pipeline (aka program) */
|
|
1346
|
+
/** Create a compute pipeline (aka program). WebGPU only. */
|
|
1346
1347
|
createCommandEncoder(props = {}) {
|
|
1347
1348
|
throw new Error("not implemented");
|
|
1348
1349
|
}
|
|
@@ -1350,7 +1351,8 @@ var __exports__ = (() => {
|
|
|
1350
1351
|
/** Create a RenderPass */
|
|
1351
1352
|
/** Create a ComputePass */
|
|
1352
1353
|
/** Get a renderpass that is set up to render to the primary CanvasContext */
|
|
1353
|
-
|
|
1354
|
+
/** Create a transform feedback (immutable set of output buffer bindings). WebGL 2 only. */
|
|
1355
|
+
// Implementation
|
|
1354
1356
|
_getBufferProps(props) {
|
|
1355
1357
|
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
1356
1358
|
props = {
|
|
@@ -1446,10 +1448,10 @@ var __exports__ = (() => {
|
|
|
1446
1448
|
this.bufferLayout = this.props.bufferLayout || [];
|
|
1447
1449
|
}
|
|
1448
1450
|
/** Set bindings (stored on pipeline and set before each call) */
|
|
1449
|
-
/** Uniforms
|
|
1451
|
+
/** Uniforms
|
|
1450
1452
|
* @deprecated Only supported on WebGL devices.
|
|
1451
1453
|
* @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.
|
|
1452
|
-
* @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.
|
|
1454
|
+
* @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.
|
|
1453
1455
|
*/
|
|
1454
1456
|
/** Draw call */
|
|
1455
1457
|
};
|
|
@@ -5501,6 +5503,8 @@ ${stage === "fragment" ? FRAGMENT_SHADER_PROLOGUE : ""}
|
|
|
5501
5503
|
* @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!
|
|
5502
5504
|
* @todo - allow application to define multiple vertex arrays?
|
|
5503
5505
|
* */
|
|
5506
|
+
/** TransformFeedback, WebGL 2 only. */
|
|
5507
|
+
transformFeedback = null;
|
|
5504
5508
|
_pipelineNeedsUpdate = "newly created";
|
|
5505
5509
|
_attributeInfos = {};
|
|
5506
5510
|
_gpuGeometry = null;
|
|
@@ -5570,6 +5574,9 @@ ${stage === "fragment" ? FRAGMENT_SHADER_PROLOGUE : ""}
|
|
|
5570
5574
|
if (props.moduleSettings) {
|
|
5571
5575
|
this.updateModuleSettings(props.moduleSettings);
|
|
5572
5576
|
}
|
|
5577
|
+
if (props.transformFeedback) {
|
|
5578
|
+
this.transformFeedback = props.transformFeedback;
|
|
5579
|
+
}
|
|
5573
5580
|
this.setUniforms(this._getModuleUniforms());
|
|
5574
5581
|
Object.seal(this);
|
|
5575
5582
|
}
|
|
@@ -5585,7 +5592,8 @@ ${stage === "fragment" ? FRAGMENT_SHADER_PROLOGUE : ""}
|
|
|
5585
5592
|
renderPass,
|
|
5586
5593
|
vertexArray: this.vertexArray,
|
|
5587
5594
|
vertexCount: this.vertexCount,
|
|
5588
|
-
instanceCount: this.instanceCount
|
|
5595
|
+
instanceCount: this.instanceCount,
|
|
5596
|
+
transformFeedback: this.transformFeedback
|
|
5589
5597
|
});
|
|
5590
5598
|
}
|
|
5591
5599
|
// Update fixed fields (can trigger pipeline rebuild)
|
|
@@ -5675,6 +5683,12 @@ ${stage === "fragment" ? FRAGMENT_SHADER_PROLOGUE : ""}
|
|
|
5675
5683
|
Object.assign(this.bindings, bindings);
|
|
5676
5684
|
Object.assign(this.uniforms, uniforms);
|
|
5677
5685
|
}
|
|
5686
|
+
/**
|
|
5687
|
+
* Updates optional transform feedback. WebGL 2 only.
|
|
5688
|
+
*/
|
|
5689
|
+
setTransformFeedback(transformFeedback) {
|
|
5690
|
+
this.transformFeedback = transformFeedback;
|
|
5691
|
+
}
|
|
5678
5692
|
/**
|
|
5679
5693
|
* @deprecated Updates shader module settings (which results in uniforms being set)
|
|
5680
5694
|
*/
|
|
@@ -5715,6 +5729,7 @@ ${stage === "fragment" ? FRAGMENT_SHADER_PROLOGUE : ""}
|
|
|
5715
5729
|
for (const [bufferName, buffer] of Object.entries(buffers)) {
|
|
5716
5730
|
const bufferLayout = this.bufferLayout.find((layout) => layout.name === bufferName);
|
|
5717
5731
|
if (!bufferLayout) {
|
|
5732
|
+
log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
5718
5733
|
continue;
|
|
5719
5734
|
}
|
|
5720
5735
|
const attributeNames = bufferLayout.attributes ? bufferLayout.attributes?.map((layout) => layout.attribute) : [bufferLayout.name];
|
|
@@ -5795,6 +5810,7 @@ ${stage === "fragment" ? FRAGMENT_SHADER_PROLOGUE : ""}
|
|
|
5795
5810
|
attributes: {},
|
|
5796
5811
|
constantAttributes: {},
|
|
5797
5812
|
pipelineFactory: void 0,
|
|
5813
|
+
transformFeedback: void 0,
|
|
5798
5814
|
shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()
|
|
5799
5815
|
});
|
|
5800
5816
|
function mergeBufferLayouts(layouts1, layouts2) {
|
package/dist/index.cjs
CHANGED
|
@@ -833,6 +833,8 @@ var _Model = class {
|
|
|
833
833
|
this.bindings = {};
|
|
834
834
|
/** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/
|
|
835
835
|
this.uniforms = {};
|
|
836
|
+
/** TransformFeedback, WebGL 2 only. */
|
|
837
|
+
this.transformFeedback = null;
|
|
836
838
|
this._pipelineNeedsUpdate = "newly created";
|
|
837
839
|
this._attributeInfos = {};
|
|
838
840
|
this._gpuGeometry = null;
|
|
@@ -897,6 +899,9 @@ var _Model = class {
|
|
|
897
899
|
if (props.moduleSettings) {
|
|
898
900
|
this.updateModuleSettings(props.moduleSettings);
|
|
899
901
|
}
|
|
902
|
+
if (props.transformFeedback) {
|
|
903
|
+
this.transformFeedback = props.transformFeedback;
|
|
904
|
+
}
|
|
900
905
|
this.setUniforms(this._getModuleUniforms());
|
|
901
906
|
Object.seal(this);
|
|
902
907
|
}
|
|
@@ -912,7 +917,8 @@ var _Model = class {
|
|
|
912
917
|
renderPass,
|
|
913
918
|
vertexArray: this.vertexArray,
|
|
914
919
|
vertexCount: this.vertexCount,
|
|
915
|
-
instanceCount: this.instanceCount
|
|
920
|
+
instanceCount: this.instanceCount,
|
|
921
|
+
transformFeedback: this.transformFeedback
|
|
916
922
|
});
|
|
917
923
|
}
|
|
918
924
|
// Update fixed fields (can trigger pipeline rebuild)
|
|
@@ -999,6 +1005,12 @@ var _Model = class {
|
|
|
999
1005
|
Object.assign(this.bindings, bindings);
|
|
1000
1006
|
Object.assign(this.uniforms, uniforms);
|
|
1001
1007
|
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Updates optional transform feedback. WebGL 2 only.
|
|
1010
|
+
*/
|
|
1011
|
+
setTransformFeedback(transformFeedback) {
|
|
1012
|
+
this.transformFeedback = transformFeedback;
|
|
1013
|
+
}
|
|
1002
1014
|
/**
|
|
1003
1015
|
* @deprecated Updates shader module settings (which results in uniforms being set)
|
|
1004
1016
|
*/
|
|
@@ -1042,6 +1054,7 @@ var _Model = class {
|
|
|
1042
1054
|
for (const [bufferName, buffer] of Object.entries(buffers)) {
|
|
1043
1055
|
const bufferLayout = this.bufferLayout.find((layout) => layout.name === bufferName);
|
|
1044
1056
|
if (!bufferLayout) {
|
|
1057
|
+
import_core6.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
1045
1058
|
continue;
|
|
1046
1059
|
}
|
|
1047
1060
|
const attributeNames = bufferLayout.attributes ? (_a = bufferLayout.attributes) == null ? void 0 : _a.map((layout) => layout.attribute) : [bufferLayout.name];
|
|
@@ -1074,7 +1087,9 @@ var _Model = class {
|
|
|
1074
1087
|
if (attributeInfo) {
|
|
1075
1088
|
this.vertexArray.setConstant(attributeInfo.location, value);
|
|
1076
1089
|
} else {
|
|
1077
|
-
import_core6.log.warn(
|
|
1090
|
+
import_core6.log.warn(
|
|
1091
|
+
`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`
|
|
1092
|
+
)();
|
|
1078
1093
|
}
|
|
1079
1094
|
}
|
|
1080
1095
|
}
|
|
@@ -1084,7 +1099,10 @@ var _Model = class {
|
|
|
1084
1099
|
_updatePipeline() {
|
|
1085
1100
|
if (this._pipelineNeedsUpdate) {
|
|
1086
1101
|
if (this.pipeline) {
|
|
1087
|
-
import_core6.log.log(
|
|
1102
|
+
import_core6.log.log(
|
|
1103
|
+
1,
|
|
1104
|
+
`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
|
|
1105
|
+
)();
|
|
1088
1106
|
}
|
|
1089
1107
|
this._pipelineNeedsUpdate = false;
|
|
1090
1108
|
this.pipeline = this.device.createRenderPipeline(__spreadProps(__spreadValues({}, this.props), {
|
|
@@ -1092,7 +1110,11 @@ var _Model = class {
|
|
|
1092
1110
|
topology: this.topology,
|
|
1093
1111
|
parameters: this.parameters,
|
|
1094
1112
|
vs: this.device.createShader({ id: "{$this.id}-vertex", stage: "vertex", source: this.vs }),
|
|
1095
|
-
fs: this.fs ? this.device.createShader({
|
|
1113
|
+
fs: this.fs ? this.device.createShader({
|
|
1114
|
+
id: "{$this.id}-fragment",
|
|
1115
|
+
stage: "fragment",
|
|
1116
|
+
source: this.fs
|
|
1117
|
+
}) : null
|
|
1096
1118
|
}));
|
|
1097
1119
|
this._attributeInfos = (0, import_core7.getAttributeInfosFromLayouts)(
|
|
1098
1120
|
this.pipeline.shaderLayout,
|
|
@@ -1117,6 +1139,7 @@ Model.defaultProps = __spreadProps(__spreadValues({}, import_core6.RenderPipelin
|
|
|
1117
1139
|
attributes: {},
|
|
1118
1140
|
constantAttributes: {},
|
|
1119
1141
|
pipelineFactory: void 0,
|
|
1142
|
+
transformFeedback: void 0,
|
|
1120
1143
|
shaderAssembler: import_shadertools.ShaderAssembler.getDefaultShaderAssembler()
|
|
1121
1144
|
});
|
|
1122
1145
|
function mergeBufferLayouts(layouts1, layouts2) {
|
package/dist/model/model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TypedArray, RenderPipelineProps, RenderPipelineParameters, BufferLayout, VertexArray, AttributeInfo } from '@luma.gl/core';
|
|
1
|
+
import type { TypedArray, RenderPipelineProps, RenderPipelineParameters, BufferLayout, VertexArray, AttributeInfo, TransformFeedback } from '@luma.gl/core';
|
|
2
2
|
import type { Binding, UniformValue, PrimitiveTopology } from '@luma.gl/core';
|
|
3
3
|
import { Device, Buffer, RenderPipeline, RenderPass } from '@luma.gl/core';
|
|
4
4
|
import type { ShaderModule } from '@luma.gl/shadertools';
|
|
@@ -36,6 +36,7 @@ export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
|
36
36
|
attributes?: Record<string, Buffer>;
|
|
37
37
|
/** */
|
|
38
38
|
constantAttributes?: Record<string, TypedArray>;
|
|
39
|
+
transformFeedback?: TransformFeedback;
|
|
39
40
|
/** Mapped uniforms for shadertool modules */
|
|
40
41
|
moduleSettings?: Record<string, Record<string, any>>;
|
|
41
42
|
};
|
|
@@ -85,6 +86,8 @@ export declare class Model {
|
|
|
85
86
|
* @todo - allow application to define multiple vertex arrays?
|
|
86
87
|
* */
|
|
87
88
|
vertexArray: VertexArray;
|
|
89
|
+
/** TransformFeedback, WebGL 2 only. */
|
|
90
|
+
transformFeedback: TransformFeedback | null;
|
|
88
91
|
_pipelineNeedsUpdate: string | false;
|
|
89
92
|
_attributeInfos: Record<string, AttributeInfo>;
|
|
90
93
|
_gpuGeometry: GPUGeometry | null;
|
|
@@ -135,6 +138,10 @@ export declare class Model {
|
|
|
135
138
|
* Updates shader module settings (which results in bindings & uniforms being set)
|
|
136
139
|
*/
|
|
137
140
|
setShaderModuleProps(props: Record<string, any>): void;
|
|
141
|
+
/**
|
|
142
|
+
* Updates optional transform feedback. WebGL 2 only.
|
|
143
|
+
*/
|
|
144
|
+
setTransformFeedback(transformFeedback: TransformFeedback | null): void;
|
|
138
145
|
/**
|
|
139
146
|
* @deprecated Updates shader module settings (which results in uniforms being set)
|
|
140
147
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,aAAa,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAGA,OAAO,KAA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EAAE,MAAM,GAAG,IAAI;IAI7C;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMtD;;OAEG;IACH,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,GAAG,IAAI;IAIvE;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAItD;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIpD;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI;IAKzD;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIhD;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAiCpD;;;;;;;OAOG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAanE,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI7C,eAAe,IAAI,cAAc;CA8BlC"}
|
package/dist/model/model.js
CHANGED
|
@@ -23,6 +23,7 @@ export class Model {
|
|
|
23
23
|
this.uniforms = {};
|
|
24
24
|
this.pipeline = void 0;
|
|
25
25
|
this.vertexArray = void 0;
|
|
26
|
+
this.transformFeedback = null;
|
|
26
27
|
this._pipelineNeedsUpdate = 'newly created';
|
|
27
28
|
this._attributeInfos = {};
|
|
28
29
|
this._gpuGeometry = null;
|
|
@@ -93,6 +94,9 @@ export class Model {
|
|
|
93
94
|
if (props.moduleSettings) {
|
|
94
95
|
this.updateModuleSettings(props.moduleSettings);
|
|
95
96
|
}
|
|
97
|
+
if (props.transformFeedback) {
|
|
98
|
+
this.transformFeedback = props.transformFeedback;
|
|
99
|
+
}
|
|
96
100
|
this.setUniforms(this._getModuleUniforms());
|
|
97
101
|
Object.seal(this);
|
|
98
102
|
}
|
|
@@ -107,7 +111,8 @@ export class Model {
|
|
|
107
111
|
renderPass,
|
|
108
112
|
vertexArray: this.vertexArray,
|
|
109
113
|
vertexCount: this.vertexCount,
|
|
110
|
-
instanceCount: this.instanceCount
|
|
114
|
+
instanceCount: this.instanceCount,
|
|
115
|
+
transformFeedback: this.transformFeedback
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
118
|
setGeometry(geometry) {
|
|
@@ -161,6 +166,9 @@ export class Model {
|
|
|
161
166
|
Object.assign(this.bindings, bindings);
|
|
162
167
|
Object.assign(this.uniforms, uniforms);
|
|
163
168
|
}
|
|
169
|
+
setTransformFeedback(transformFeedback) {
|
|
170
|
+
this.transformFeedback = transformFeedback;
|
|
171
|
+
}
|
|
164
172
|
updateModuleSettings(props) {
|
|
165
173
|
this.setShaderModuleProps(props);
|
|
166
174
|
}
|
|
@@ -182,6 +190,7 @@ export class Model {
|
|
|
182
190
|
var _bufferLayout$attribu;
|
|
183
191
|
const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);
|
|
184
192
|
if (!bufferLayout) {
|
|
193
|
+
log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
185
194
|
continue;
|
|
186
195
|
}
|
|
187
196
|
const attributeNames = bufferLayout.attributes ? (_bufferLayout$attribu = bufferLayout.attributes) === null || _bufferLayout$attribu === void 0 ? void 0 : _bufferLayout$attribu.map(layout => layout.attribute) : [bufferLayout.name];
|
|
@@ -253,6 +262,7 @@ Model.defaultProps = {
|
|
|
253
262
|
attributes: {},
|
|
254
263
|
constantAttributes: {},
|
|
255
264
|
pipelineFactory: undefined,
|
|
265
|
+
transformFeedback: undefined,
|
|
256
266
|
shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()
|
|
257
267
|
};
|
|
258
268
|
function mergeBufferLayouts(layouts1, layouts2) {
|
package/dist/model/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":["RenderPipeline","log","uid","deepEqual","splitUniformsAndBindings","getAttributeInfosFromLayouts","ShaderAssembler","makeGPUGeometry","PipelineFactory","Model","constructor","device","props","id","vs","fs","pipelineFactory","userData","parameters","topology","bufferLayout","vertexCount","instanceCount","indexBuffer","bufferAttributes","constantAttributes","bindings","uniforms","pipeline","vertexArray","_pipelineNeedsUpdate","_attributeInfos","_gpuGeometry","_getModuleUniforms","defaultProps","Object","assign","platformInfo","type","info","shaderLanguage","shadingLanguages","gpu","features","getUniforms","shaderAssembler","assembleShaders","geometry","setGeometry","getDefaultPipelineFactory","_updatePipeline","createVertexArray","renderPipeline","_setGeometryAttributes","setVertexCount","setInstanceCount","indices","Error","setIndexBuffer","attributes","setAttributes","setConstantAttributes","setBindings","setUniforms","moduleSettings","updateModuleSettings","seal","destroy","release","draw","renderPass","gpuGeometry","setTopology","mergeBufferLayouts","_setPipelineNeedsUpdate","setBufferLayout","setParameters","setShaderModuleProps","buffers","warn","bufferName","buffer","entries","_bufferLayout$attribu","find","layout","name","attributeNames","map","attribute","set","attributeName","attributeInfo","setBuffer","location","value","setConstant","reason","createRenderPipeline","createShader","stage","source","shaderLayout","handle","undefined","defines","modules","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {\n TypedArray,\n RenderPipelineProps,\n RenderPipelineParameters,\n BufferLayout,\n VertexArray,\n AttributeInfo\n} from '@luma.gl/core';\nimport type {Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';\nimport {Device, Buffer, RenderPipeline, RenderPass, log, uid, deepEqual, splitUniformsAndBindings} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler} from '@luma.gl/shadertools';\nimport type {Geometry} from '../geometry/geometry';\nimport {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';\nimport {PipelineFactory} from '../lib/pipeline-factory';\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string shaders\n vs: {glsl?: string; wgsl?: string} | string | null;\n fs: {glsl?: string; wgsl?: string} | string | null;\n /** shadertool shader modules (added to shader code) */\n modules?: ShaderModule[];\n /** Shadertool module defines (configures shader code)*/\n defines?: Record<string, string | number | boolean>;\n // TODO - injections, hooks etc?\n\n /** pipeline factory to use to create render pipelines. Defaults to default factory for the device */\n pipelineFactory?: PipelineFactory;\n /** Shader assembler. Defaults to the ShaderAssembler.getShaderAssembler() */\n shaderAssembler?: ShaderAssembler;\n\n /** Parameters that are built into the pipeline */\n parameters?: RenderPipelineParameters;\n\n /** Geometry */\n geometry?: GPUGeometry | Geometry | null;\n\n /** Vertex count */\n vertexCount?: number;\n /** instance count */\n instanceCount?: number;\n\n indexBuffer?: Buffer | null;\n /** @note this is really a map of buffers, not a map of attributes */\n attributes?: Record<string, Buffer>;\n /** */\n constantAttributes?: Record<string, TypedArray>;\n\n /** Mapped uniforms for shadertool modules */\n moduleSettings?: Record<string, Record<string, any>>;\n};\n\n/**\n * v9 Model API\n * A model\n * - automatically reuses pipelines (programs) when possible\n * - automatically rebuilds pipelines if necessary to accommodate changed settings\n * shadertools integration\n * - accepts modules and performs shader transpilation\n */\nexport class Model {\n static defaultProps: Required<ModelProps> = {\n ...RenderPipeline.defaultProps,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: {},\n geometry: null,\n indexBuffer: null,\n attributes: {},\n constantAttributes: {},\n\n pipelineFactory: undefined!,\n shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()\n };\n\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string;\n readonly pipelineFactory: PipelineFactory;\n userData: {[key: string]: any} = {};\n\n // Fixed properties (change can trigger pipeline rebuild)\n\n /** The render pipeline GPU parameters, depth testing etc */\n parameters: RenderPipelineParameters;\n\n /** The primitive topology */\n topology: PrimitiveTopology;\n /** Buffer layout */\n bufferLayout: BufferLayout[];\n\n // Dynamic properties\n\n /** Vertex count */\n vertexCount: number;\n /** instance count */\n instanceCount: number = 0;\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Buffer-valued attributes */\n bufferAttributes: Record<string, Buffer> = {};\n /** Constant-valued attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Bindings (textures, samplers, uniform buffers) */\n bindings: Record<string, Binding> = {};\n /** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/\n uniforms: Record<string, UniformValue> = {};\n\n /** The underlying GPU \"program\". @note May be recreated if parameters change */\n pipeline: RenderPipeline;\n\n /**\n * VertexArray\n * @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!\n * @todo - allow application to define multiple vertex arrays?\n * */\n vertexArray: VertexArray;\n\n _pipelineNeedsUpdate: string | false = 'newly created';\n _attributeInfos: Record<string, AttributeInfo> = {};\n _gpuGeometry: GPUGeometry | null = null;\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n private props: Required<ModelProps>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...Model.defaultProps, ...props};\n props = this.props;\n this.id = props.id || uid('model');\n this.device = device;\n\n Object.assign(this.userData, props.userData);\n\n /** Create a shadertools platform info from the Device */\n const platformInfo: PlatformInfo = {\n type: device.info.type,\n shaderLanguage: device.info.shadingLanguages[0],\n gpu: device.info.gpu,\n features: device.features\n };\n\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders(\n platformInfo,\n this.props\n );\n this.vs = vs;\n this.fs = fs;\n this._getModuleUniforms = getUniforms;\n\n this.vertexCount = this.props.vertexCount;\n this.instanceCount = this.props.instanceCount;\n\n this.topology = this.props.topology;\n this.bufferLayout = this.props.bufferLayout;\n this.parameters = this.props.parameters;\n\n // Geometry, if provided, sets topology and vertex cound\n if (props.geometry) {\n this._gpuGeometry = this.setGeometry(props.geometry);\n }\n\n this.pipelineFactory =\n props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n\n // Create the pipeline\n // @note order is important\n this.pipeline = this._updatePipeline();\n\n this.vertexArray = device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Now we can apply geometry attributes\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n\n // Apply any dynamic settings that will not trigger pipeline change\n if (props.vertexCount) {\n this.setVertexCount(props.vertexCount);\n }\n if (props.instanceCount) {\n this.setInstanceCount(props.instanceCount);\n }\n // @ts-expect-error\n if (props.indices) {\n throw new Error('Model.props.indices removed. Use props.indexBuffer')\n }\n if (props.indexBuffer) {\n this.setIndexBuffer(props.indexBuffer);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.constantAttributes) {\n this.setConstantAttributes(props.constantAttributes);\n }\n if (props.bindings) {\n this.setBindings(props.bindings);\n }\n if (props.uniforms) {\n this.setUniforms(props.uniforms);\n }\n if (props.moduleSettings) {\n this.updateModuleSettings(props.moduleSettings);\n }\n\n this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms\n\n // Catch any access to non-standard props\n Object.seal(this);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n }\n\n // Draw call\n\n draw(renderPass: RenderPass): void {\n // Check if the pipeline is invalidated\n // TODO - this is likely the worst place to do this from performance perspective. Perhaps add a predraw()?\n this.pipeline = this._updatePipeline();\n\n // Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw\n // Any caching needs to be done inside the pipeline functions\n this.pipeline.setBindings(this.bindings);\n this.pipeline.setUniforms(this.uniforms);\n\n this.pipeline.draw({\n renderPass,\n vertexArray: this.vertexArray,\n vertexCount: this.vertexCount,\n instanceCount: this.instanceCount\n });\n }\n\n // Update fixed fields (can trigger pipeline rebuild)\n\n /**\n * Updates the optional geometry\n * Geometry, set topology and bufferLayout\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setGeometry(geometry: GPUGeometry | Geometry): GPUGeometry {\n const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);\n this.setTopology(gpuGeometry.topology || 'triangle-list');\n this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout);\n if (this.vertexArray) {\n this._setGeometryAttributes(gpuGeometry);\n }\n return gpuGeometry;\n }\n\n /**\n * Updates the optional geometry attributes\n * Geometry, sets several attributes, indexBuffer, and also vertex count\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n _setGeometryAttributes(gpuGeometry: GPUGeometry): void {\n // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setAttributes(gpuGeometry.attributes);\n this.setIndexBuffer(gpuGeometry.indices);\n }\n\n /**\n * Updates the primitive topology ('triangle-list', 'triangle-strip' etc).\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setTopology(topology: PrimitiveTopology): void {\n if (topology !== this.topology) {\n this.topology = topology;\n this._setPipelineNeedsUpdate('topology');\n }\n }\n\n /**\n * Updates the buffer layout.\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setBufferLayout(bufferLayout: BufferLayout[]): void {\n this.bufferLayout = this._gpuGeometry\n ? mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout)\n : bufferLayout;\n this._setPipelineNeedsUpdate('bufferLayout');\n\n // Recreate the pipeline\n this.pipeline = this._updatePipeline();\n \n // vertex array needs to be updated if we update buffer layout,\n // but not if we update parameters\n this.vertexArray = this.device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Reapply geometry attributes to the new vertex array\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n }\n\n /**\n * Set GPU parameters.\n * @note Can trigger a pipeline rebuild / pipeline cache fetch.\n * @param parameters\n */\n setParameters(parameters: RenderPipelineParameters) {\n if (!deepEqual(parameters, this.parameters, 2)) {\n this.parameters = parameters;\n this._setPipelineNeedsUpdate('parameters');\n }\n }\n\n // Update dynamic fields\n\n /**\n * Updates the vertex count (used in draw calls)\n * @note Any attributes with stepMode=vertex need to be at least this big\n */\n setVertexCount(vertexCount: number): void {\n this.vertexCount = vertexCount;\n }\n\n /**\n * Updates the instance count (used in draw calls)\n * @note Any attributes with stepMode=instance need to be at least this big\n */\n setInstanceCount(instanceCount: number): void {\n this.instanceCount = instanceCount;\n }\n\n /**\n * Updates shader module settings (which results in bindings & uniforms being set)\n */\n setShaderModuleProps(props: Record<string, any>): void {\n const {bindings, uniforms} = splitUniformsAndBindings(this._getModuleUniforms(props));\n Object.assign(this.bindings, bindings);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * @deprecated Updates shader module settings (which results in uniforms being set)\n */\n updateModuleSettings(props: Record<string, any>): void {\n this.setShaderModuleProps(props);\n }\n\n /**\n * Sets bindings (textures, samplers, uniform buffers)\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * Sets individual uniforms\n * @deprecated WebGL only, use uniform buffers for portability\n * @param uniforms\n * @returns self for chaining\n */\n setUniforms(uniforms: Record<string, UniformValue>): void {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets the index buffer\n * @todo - how to unset it if we change geometry?\n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n this.vertexArray.setIndexBuffer(indexBuffer);\n }\n\n /**\n * Sets attributes (buffers)\n * @note Overrides any attributes previously set with the same name\n */\n setAttributes(buffers: Record<string, Buffer>): void {\n if (buffers.indices) {\n log.warn(\n `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`\n );\n }\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);\n if (!bufferLayout) {\n continue; // eslint-disable-line no-continue\n }\n\n // For an interleaved attribute we may need to set multiple attributes\n const attributeNames = bufferLayout.attributes\n ? bufferLayout.attributes?.map(layout => layout.attribute)\n : [bufferLayout.name];\n let set = false;\n for (const attributeName of attributeNames) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setBuffer(attributeInfo.location, buffer);\n set = true;\n }\n }\n if (!set) {\n log.warn(\n `Model(${this.id}): Ignoring buffer \"${buffer.id}\" for unknown attribute \"${bufferName}\"`\n )();\n }\n }\n }\n\n /**\n * Sets constant attributes\n * @note Overrides any attributes previously set with the same name\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param constantAttributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [attributeName, value] of Object.entries(attributes)) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setConstant(attributeInfo.location, value);\n } else {\n log.warn(`Model \"${this.id}: Ignoring constant supplied for unknown attribute \"${attributeName}\"`)();\n }\n }\n }\n\n _setPipelineNeedsUpdate(reason: string): void {\n this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;\n }\n\n _updatePipeline(): RenderPipeline {\n if (this._pipelineNeedsUpdate) {\n if (this.pipeline) {\n log.log(1, `Model ${this.id}: Recreating pipeline because \"${this._pipelineNeedsUpdate}\".`)();\n }\n this._pipelineNeedsUpdate = false;\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs: this.device.createShader({id: '{$this.id}-vertex', stage: 'vertex', source: this.vs}),\n fs: this.fs ? this.device.createShader({id: '{$this.id}-fragment', stage: 'fragment', source: this.fs}) : null\n });\n this._attributeInfos = getAttributeInfosFromLayouts(\n this.pipeline.shaderLayout,\n this.bufferLayout\n );\n }\n return this.pipeline;\n }\n}\n\n/** TODO - move to core, document add tests */\nfunction mergeBufferLayouts(layouts1: BufferLayout[], layouts2: BufferLayout[]): BufferLayout[] {\n const layouts = [...layouts1];\n for (const attribute of layouts2) {\n const index = layouts.findIndex(attribute2 => attribute2.name === attribute.name);\n if (index < 0) {\n layouts.push(attribute);\n } else {\n layouts[index] = attribute;\n }\n }\n return layouts;\n}\n"],"mappings":"AAYA,SAAwBA,cAAc,EAAcC,GAAG,EAAEC,GAAG,EAAEC,SAAS,EAAEC,wBAAwB,QAAO,eAAe;AACvH,SAAQC,4BAA4B,QAAO,eAAe;AAE1D,SAAQC,eAAe,QAAO,sBAAsB;AAAC,SAEhCC,eAAe;AAAA,SAC5BC,eAAe;AA8CvB,OAAO,MAAMC,KAAK,CAAC;EAuEjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAA,KAnDtCD,MAAM;IAAA,KACNE,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,eAAe;IAAA,KACxBC,QAAQ,GAAyB,CAAC,CAAC;IAAA,KAKnCC,UAAU;IAAA,KAGVC,QAAQ;IAAA,KAERC,YAAY;IAAA,KAKZC,WAAW;IAAA,KAEXC,aAAa,GAAW,CAAC;IAAA,KAGzBC,WAAW,GAAkB,IAAI;IAAA,KAEjCC,gBAAgB,GAA2B,CAAC,CAAC;IAAA,KAE7CC,kBAAkB,GAA+B,CAAC,CAAC;IAAA,KAEnDC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAEtCC,QAAQ,GAAiC,CAAC,CAAC;IAAA,KAG3CC,QAAQ;IAAA,KAORC,WAAW;IAAA,KAEXC,oBAAoB,GAAmB,eAAe;IAAA,KACtDC,eAAe,GAAkC,CAAC,CAAC;IAAA,KACnDC,YAAY,GAAuB,IAAI;IAAA,KAC/BC,kBAAkB;IAAA,KAClBrB,KAAK;IAGX,IAAI,CAACA,KAAK,GAAG;MAAC,GAAGH,KAAK,CAACyB,YAAY;MAAE,G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;EACZwF,OAAO,EAAE,CAAC,CAAC;EACXC,OAAO,EAAE,EAAE;EACX1C,cAAc,EAAE,CAAC,CAAC;EAClBjB,QAAQ,EAAE,IAAI;EACdxB,WAAW,EAAE,IAAI;EACjBoC,UAAU,EAAE,CAAC,CAAC;EACdlC,kBAAkB,EAAE,CAAC,CAAC;EAEtBT,eAAe,EAAEwF,SAAU;EAC3B3D,eAAe,EAAEvC,eAAe,CAACqG,yBAAyB,CAAC;AAC7D,CAAC;AAiYH,SAASlC,kBAAkBA,CAACmC,QAAwB,EAAEC,QAAwB,EAAkB;EAC9F,MAAMC,OAAO,GAAG,CAAC,GAAGF,QAAQ,CAAC;EAC7B,KAAK,MAAMnB,SAAS,IAAIoB,QAAQ,EAAE;IAChC,MAAME,KAAK,GAAGD,OAAO,CAACE,SAAS,CAACC,UAAU,IAAIA,UAAU,CAAC3B,IAAI,KAAKG,SAAS,CAACH,IAAI,CAAC;IACjF,IAAIyB,KAAK,GAAG,CAAC,EAAE;MACbD,OAAO,CAACI,IAAI,CAACzB,SAAS,CAAC;IACzB,CAAC,MAAM;MACLqB,OAAO,CAACC,KAAK,CAAC,GAAGtB,SAAS;IAC5B;EACF;EACA,OAAOqB,OAAO;AAChB"}
|
|
1
|
+
{"version":3,"file":"model.js","names":["RenderPipeline","log","uid","deepEqual","splitUniformsAndBindings","getAttributeInfosFromLayouts","ShaderAssembler","makeGPUGeometry","PipelineFactory","Model","constructor","device","props","id","vs","fs","pipelineFactory","userData","parameters","topology","bufferLayout","vertexCount","instanceCount","indexBuffer","bufferAttributes","constantAttributes","bindings","uniforms","pipeline","vertexArray","transformFeedback","_pipelineNeedsUpdate","_attributeInfos","_gpuGeometry","_getModuleUniforms","defaultProps","Object","assign","platformInfo","type","info","shaderLanguage","shadingLanguages","gpu","features","getUniforms","shaderAssembler","assembleShaders","geometry","setGeometry","getDefaultPipelineFactory","_updatePipeline","createVertexArray","renderPipeline","_setGeometryAttributes","setVertexCount","setInstanceCount","indices","Error","setIndexBuffer","attributes","setAttributes","setConstantAttributes","setBindings","setUniforms","moduleSettings","updateModuleSettings","seal","destroy","release","draw","renderPass","gpuGeometry","setTopology","mergeBufferLayouts","_setPipelineNeedsUpdate","setBufferLayout","setParameters","setShaderModuleProps","setTransformFeedback","buffers","warn","bufferName","buffer","entries","_bufferLayout$attribu","find","layout","name","attributeNames","map","attribute","set","attributeName","attributeInfo","setBuffer","location","value","setConstant","reason","createRenderPipeline","createShader","stage","source","shaderLayout","handle","undefined","defines","modules","getDefaultShaderAssembler","layouts1","layouts2","layouts","index","findIndex","attribute2","push"],"sources":["../../src/model/model.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {\n TypedArray,\n RenderPipelineProps,\n RenderPipelineParameters,\n BufferLayout,\n VertexArray,\n AttributeInfo,\n TransformFeedback\n} from '@luma.gl/core';\nimport type {Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';\nimport {\n Device,\n Buffer,\n RenderPipeline,\n RenderPass,\n log,\n uid,\n deepEqual,\n splitUniformsAndBindings\n} from '@luma.gl/core';\nimport {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';\nimport {ShaderAssembler} from '@luma.gl/shadertools';\nimport type {Geometry} from '../geometry/geometry';\nimport {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';\nimport {PipelineFactory} from '../lib/pipeline-factory';\n\nexport type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {\n // Model also accepts a string shaders\n vs: {glsl?: string; wgsl?: string} | string | null;\n fs: {glsl?: string; wgsl?: string} | string | null;\n /** shadertool shader modules (added to shader code) */\n modules?: ShaderModule[];\n /** Shadertool module defines (configures shader code)*/\n defines?: Record<string, string | number | boolean>;\n // TODO - injections, hooks etc?\n\n /** pipeline factory to use to create render pipelines. Defaults to default factory for the device */\n pipelineFactory?: PipelineFactory;\n /** Shader assembler. Defaults to the ShaderAssembler.getShaderAssembler() */\n shaderAssembler?: ShaderAssembler;\n\n /** Parameters that are built into the pipeline */\n parameters?: RenderPipelineParameters;\n\n /** Geometry */\n geometry?: GPUGeometry | Geometry | null;\n\n /** Vertex count */\n vertexCount?: number;\n /** instance count */\n instanceCount?: number;\n\n indexBuffer?: Buffer | null;\n /** @note this is really a map of buffers, not a map of attributes */\n attributes?: Record<string, Buffer>;\n /** */\n constantAttributes?: Record<string, TypedArray>;\n\n transformFeedback?: TransformFeedback;\n\n /** Mapped uniforms for shadertool modules */\n moduleSettings?: Record<string, Record<string, any>>;\n};\n\n/**\n * v9 Model API\n * A model\n * - automatically reuses pipelines (programs) when possible\n * - automatically rebuilds pipelines if necessary to accommodate changed settings\n * shadertools integration\n * - accepts modules and performs shader transpilation\n */\nexport class Model {\n static defaultProps: Required<ModelProps> = {\n ...RenderPipeline.defaultProps,\n vs: null,\n fs: null,\n id: 'unnamed',\n handle: undefined,\n userData: {},\n defines: {},\n modules: [],\n moduleSettings: {},\n geometry: null,\n indexBuffer: null,\n attributes: {},\n constantAttributes: {},\n\n pipelineFactory: undefined!,\n transformFeedback: undefined,\n shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()\n };\n\n readonly device: Device;\n readonly id: string;\n readonly vs: string;\n readonly fs: string;\n readonly pipelineFactory: PipelineFactory;\n userData: {[key: string]: any} = {};\n\n // Fixed properties (change can trigger pipeline rebuild)\n\n /** The render pipeline GPU parameters, depth testing etc */\n parameters: RenderPipelineParameters;\n\n /** The primitive topology */\n topology: PrimitiveTopology;\n /** Buffer layout */\n bufferLayout: BufferLayout[];\n\n // Dynamic properties\n\n /** Vertex count */\n vertexCount: number;\n /** instance count */\n instanceCount: number = 0;\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Buffer-valued attributes */\n bufferAttributes: Record<string, Buffer> = {};\n /** Constant-valued attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Bindings (textures, samplers, uniform buffers) */\n bindings: Record<string, Binding> = {};\n /** Sets uniforms @deprecated Use uniform buffers and setBindings() for portability*/\n uniforms: Record<string, UniformValue> = {};\n\n /** The underlying GPU \"program\". @note May be recreated if parameters change */\n pipeline: RenderPipeline;\n\n /**\n * VertexArray\n * @note not implemented: if bufferLayout is updated, vertex array has to be rebuilt!\n * @todo - allow application to define multiple vertex arrays?\n * */\n vertexArray: VertexArray;\n\n /** TransformFeedback, WebGL 2 only. */\n transformFeedback: TransformFeedback | null = null;\n\n _pipelineNeedsUpdate: string | false = 'newly created';\n _attributeInfos: Record<string, AttributeInfo> = {};\n _gpuGeometry: GPUGeometry | null = null;\n private _getModuleUniforms: (props?: Record<string, Record<string, any>>) => Record<string, any>;\n private props: Required<ModelProps>;\n\n constructor(device: Device, props: ModelProps) {\n this.props = {...Model.defaultProps, ...props};\n props = this.props;\n this.id = props.id || uid('model');\n this.device = device;\n\n Object.assign(this.userData, props.userData);\n\n /** Create a shadertools platform info from the Device */\n const platformInfo: PlatformInfo = {\n type: device.info.type,\n shaderLanguage: device.info.shadingLanguages[0],\n gpu: device.info.gpu,\n features: device.features\n };\n\n const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders(\n platformInfo,\n this.props\n );\n this.vs = vs;\n this.fs = fs;\n this._getModuleUniforms = getUniforms;\n\n this.vertexCount = this.props.vertexCount;\n this.instanceCount = this.props.instanceCount;\n\n this.topology = this.props.topology;\n this.bufferLayout = this.props.bufferLayout;\n this.parameters = this.props.parameters;\n\n // Geometry, if provided, sets topology and vertex cound\n if (props.geometry) {\n this._gpuGeometry = this.setGeometry(props.geometry);\n }\n\n this.pipelineFactory =\n props.pipelineFactory || PipelineFactory.getDefaultPipelineFactory(this.device);\n\n // Create the pipeline\n // @note order is important\n this.pipeline = this._updatePipeline();\n\n this.vertexArray = device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Now we can apply geometry attributes\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n\n // Apply any dynamic settings that will not trigger pipeline change\n if (props.vertexCount) {\n this.setVertexCount(props.vertexCount);\n }\n if (props.instanceCount) {\n this.setInstanceCount(props.instanceCount);\n }\n // @ts-expect-error\n if (props.indices) {\n throw new Error('Model.props.indices removed. Use props.indexBuffer');\n }\n if (props.indexBuffer) {\n this.setIndexBuffer(props.indexBuffer);\n }\n if (props.attributes) {\n this.setAttributes(props.attributes);\n }\n if (props.constantAttributes) {\n this.setConstantAttributes(props.constantAttributes);\n }\n if (props.bindings) {\n this.setBindings(props.bindings);\n }\n if (props.uniforms) {\n this.setUniforms(props.uniforms);\n }\n if (props.moduleSettings) {\n this.updateModuleSettings(props.moduleSettings);\n }\n if (props.transformFeedback) {\n this.transformFeedback = props.transformFeedback;\n }\n\n this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms\n\n // Catch any access to non-standard props\n Object.seal(this);\n }\n\n destroy(): void {\n this.pipelineFactory.release(this.pipeline);\n }\n\n // Draw call\n\n draw(renderPass: RenderPass): void {\n // Check if the pipeline is invalidated\n // TODO - this is likely the worst place to do this from performance perspective. Perhaps add a predraw()?\n this.pipeline = this._updatePipeline();\n\n // Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw\n // Any caching needs to be done inside the pipeline functions\n this.pipeline.setBindings(this.bindings);\n this.pipeline.setUniforms(this.uniforms);\n\n this.pipeline.draw({\n renderPass,\n vertexArray: this.vertexArray,\n vertexCount: this.vertexCount,\n instanceCount: this.instanceCount,\n transformFeedback: this.transformFeedback\n });\n }\n\n // Update fixed fields (can trigger pipeline rebuild)\n\n /**\n * Updates the optional geometry\n * Geometry, set topology and bufferLayout\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setGeometry(geometry: GPUGeometry | Geometry): GPUGeometry {\n const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);\n this.setTopology(gpuGeometry.topology || 'triangle-list');\n this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout);\n if (this.vertexArray) {\n this._setGeometryAttributes(gpuGeometry);\n }\n return gpuGeometry;\n }\n\n /**\n * Updates the optional geometry attributes\n * Geometry, sets several attributes, indexBuffer, and also vertex count\n * @note Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n _setGeometryAttributes(gpuGeometry: GPUGeometry): void {\n // TODO - delete previous geometry?\n this.vertexCount = gpuGeometry.vertexCount;\n this.setAttributes(gpuGeometry.attributes);\n this.setIndexBuffer(gpuGeometry.indices);\n }\n\n /**\n * Updates the primitive topology ('triangle-list', 'triangle-strip' etc).\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setTopology(topology: PrimitiveTopology): void {\n if (topology !== this.topology) {\n this.topology = topology;\n this._setPipelineNeedsUpdate('topology');\n }\n }\n\n /**\n * Updates the buffer layout.\n * @note Triggers a pipeline rebuild / pipeline cache fetch on WebGPU\n */\n setBufferLayout(bufferLayout: BufferLayout[]): void {\n this.bufferLayout = this._gpuGeometry\n ? mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout)\n : bufferLayout;\n this._setPipelineNeedsUpdate('bufferLayout');\n\n // Recreate the pipeline\n this.pipeline = this._updatePipeline();\n\n // vertex array needs to be updated if we update buffer layout,\n // but not if we update parameters\n this.vertexArray = this.device.createVertexArray({\n renderPipeline: this.pipeline\n });\n\n // Reapply geometry attributes to the new vertex array\n if (this._gpuGeometry) {\n this._setGeometryAttributes(this._gpuGeometry);\n }\n }\n\n /**\n * Set GPU parameters.\n * @note Can trigger a pipeline rebuild / pipeline cache fetch.\n * @param parameters\n */\n setParameters(parameters: RenderPipelineParameters) {\n if (!deepEqual(parameters, this.parameters, 2)) {\n this.parameters = parameters;\n this._setPipelineNeedsUpdate('parameters');\n }\n }\n\n // Update dynamic fields\n\n /**\n * Updates the vertex count (used in draw calls)\n * @note Any attributes with stepMode=vertex need to be at least this big\n */\n setVertexCount(vertexCount: number): void {\n this.vertexCount = vertexCount;\n }\n\n /**\n * Updates the instance count (used in draw calls)\n * @note Any attributes with stepMode=instance need to be at least this big\n */\n setInstanceCount(instanceCount: number): void {\n this.instanceCount = instanceCount;\n }\n\n /**\n * Updates shader module settings (which results in bindings & uniforms being set)\n */\n setShaderModuleProps(props: Record<string, any>): void {\n const {bindings, uniforms} = splitUniformsAndBindings(this._getModuleUniforms(props));\n Object.assign(this.bindings, bindings);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Updates optional transform feedback. WebGL 2 only.\n */\n setTransformFeedback(transformFeedback: TransformFeedback | null): void {\n this.transformFeedback = transformFeedback;\n }\n\n /**\n * @deprecated Updates shader module settings (which results in uniforms being set)\n */\n updateModuleSettings(props: Record<string, any>): void {\n this.setShaderModuleProps(props);\n }\n\n /**\n * Sets bindings (textures, samplers, uniform buffers)\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this.bindings, bindings);\n }\n\n /**\n * Sets individual uniforms\n * @deprecated WebGL only, use uniform buffers for portability\n * @param uniforms\n * @returns self for chaining\n */\n setUniforms(uniforms: Record<string, UniformValue>): void {\n this.pipeline.setUniforms(uniforms);\n Object.assign(this.uniforms, uniforms);\n }\n\n /**\n * Sets the index buffer\n * @todo - how to unset it if we change geometry?\n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n this.vertexArray.setIndexBuffer(indexBuffer);\n }\n\n /**\n * Sets attributes (buffers)\n * @note Overrides any attributes previously set with the same name\n */\n setAttributes(buffers: Record<string, Buffer>): void {\n if (buffers.indices) {\n log.warn(\n `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`\n );\n }\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);\n if (!bufferLayout) {\n log.warn(`Model(${this.id}): Missing layout for buffer \"${bufferName}\".`)();\n continue; // eslint-disable-line no-continue\n }\n\n // For an interleaved attribute we may need to set multiple attributes\n const attributeNames = bufferLayout.attributes\n ? bufferLayout.attributes?.map(layout => layout.attribute)\n : [bufferLayout.name];\n let set = false;\n for (const attributeName of attributeNames) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setBuffer(attributeInfo.location, buffer);\n set = true;\n }\n }\n if (!set) {\n log.warn(\n `Model(${this.id}): Ignoring buffer \"${buffer.id}\" for unknown attribute \"${bufferName}\"`\n )();\n }\n }\n }\n\n /**\n * Sets constant attributes\n * @note Overrides any attributes previously set with the same name\n * Constant attributes are only supported in WebGL, not in WebGPU\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @param constantAttributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n for (const [attributeName, value] of Object.entries(attributes)) {\n const attributeInfo = this._attributeInfos[attributeName];\n if (attributeInfo) {\n this.vertexArray.setConstant(attributeInfo.location, value);\n } else {\n log.warn(\n `Model \"${this.id}: Ignoring constant supplied for unknown attribute \"${attributeName}\"`\n )();\n }\n }\n }\n\n _setPipelineNeedsUpdate(reason: string): void {\n this._pipelineNeedsUpdate = this._pipelineNeedsUpdate || reason;\n }\n\n _updatePipeline(): RenderPipeline {\n if (this._pipelineNeedsUpdate) {\n if (this.pipeline) {\n log.log(\n 1,\n `Model ${this.id}: Recreating pipeline because \"${this._pipelineNeedsUpdate}\".`\n )();\n }\n this._pipelineNeedsUpdate = false;\n this.pipeline = this.device.createRenderPipeline({\n ...this.props,\n bufferLayout: this.bufferLayout,\n topology: this.topology,\n parameters: this.parameters,\n vs: this.device.createShader({id: '{$this.id}-vertex', stage: 'vertex', source: this.vs}),\n fs: this.fs\n ? this.device.createShader({\n id: '{$this.id}-fragment',\n stage: 'fragment',\n source: this.fs\n })\n : null\n });\n this._attributeInfos = getAttributeInfosFromLayouts(\n this.pipeline.shaderLayout,\n this.bufferLayout\n );\n }\n return this.pipeline;\n }\n}\n\n/** TODO - move to core, document add tests */\nfunction mergeBufferLayouts(layouts1: BufferLayout[], layouts2: BufferLayout[]): BufferLayout[] {\n const layouts = [...layouts1];\n for (const attribute of layouts2) {\n const index = layouts.findIndex(attribute2 => attribute2.name === attribute.name);\n if (index < 0) {\n layouts.push(attribute);\n } else {\n layouts[index] = attribute;\n }\n }\n return layouts;\n}\n"],"mappings":"AAaA,SAGEA,cAAc,EAEdC,GAAG,EACHC,GAAG,EACHC,SAAS,EACTC,wBAAwB,QACnB,eAAe;AACtB,SAAQC,4BAA4B,QAAO,eAAe;AAE1D,SAAQC,eAAe,QAAO,sBAAsB;AAAC,SAEhCC,eAAe;AAAA,SAC5BC,eAAe;AAgDvB,OAAO,MAAMC,KAAK,CAAC;EA2EjBC,WAAWA,CAACC,MAAc,EAAEC,KAAiB,EAAE;IAAA,KAtDtCD,MAAM;IAAA,KACNE,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,EAAE;IAAA,KACFC,eAAe;IAAA,KACxBC,QAAQ,GAAyB,CAAC,CAAC;IAAA,KAKnCC,UAAU;IAAA,KAGVC,QAAQ;IAAA,KAERC,YAAY;IAAA,KAKZC,WAAW;IAAA,KAEXC,aAAa,GAAW,CAAC;IAAA,KAGzBC,WAAW,GAAkB,IAAI;IAAA,KAEjCC,gBAAgB,GAA2B,CAAC,CAAC;IAAA,KAE7CC,kBAAkB,GAA+B,CAAC,CAAC;IAAA,KAEnDC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAEtCC,QAAQ,GAAiC,CAAC,CAAC;IAAA,KAG3CC,QAAQ;IAAA,KAORC,WAAW;IAAA,KAGXC,iBAAiB,GAA6B,IAAI;IAAA,KAElDC,oBAAoB,GAAmB,eAAe;IAAA,KACtDC,eAAe,GAAkC,CAAC,CAAC;IAAA,KACnDC,YAAY,GAAuB,IAAI;IAAA,KAC/BC,kBAAkB;IAAA,KAClBtB,KAAK;IAGX,IAAI,CAACA,KAAK,GAAG;MAAC,GAAGH,KAAK,CAAC0B,YAAY;MAAE,GAAGvB;IAAK,CAAC;IAC9CA,KAAK,GAAG,IAAI,CAACA,KAAK;IAClB,IAAI,CAACC,EAAE,GAAGD,KAAK,CAACC,EAAE,IAAIX,GAA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anB,KAAK,CACT0B,YAAY,GAAyB;EAC1C,GAAGnC,cAAc,CAACmC,YAAY;EAC9BrB,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRF,EAAE,EAAE,SAAS;EACb4F,MAAM,EAAEC,SAAS;EACjBzF,QAAQ,EAAE,CAAC,CAAC;EACZ0F,OAAO,EAAE,CAAC,CAAC;EACXC,OAAO,EAAE,EAAE;EACX3C,cAAc,EAAE,CAAC,CAAC;EAClBjB,QAAQ,EAAE,IAAI;EACdzB,WAAW,EAAE,IAAI;EACjBqC,UAAU,EAAE,CAAC,CAAC;EACdnC,kBAAkB,EAAE,CAAC,CAAC;EAEtBT,eAAe,EAAE0F,SAAU;EAC3B5E,iBAAiB,EAAE4E,SAAS;EAC5B5D,eAAe,EAAExC,eAAe,CAACuG,yBAAyB,CAAC;AAC7D,CAAC;AA2ZH,SAASnC,kBAAkBA,CAACoC,QAAwB,EAAEC,QAAwB,EAAkB;EAC9F,MAAMC,OAAO,GAAG,CAAC,GAAGF,QAAQ,CAAC;EAC7B,KAAK,MAAMnB,SAAS,IAAIoB,QAAQ,EAAE;IAChC,MAAME,KAAK,GAAGD,OAAO,CAACE,SAAS,CAACC,UAAU,IAAIA,UAAU,CAAC3B,IAAI,KAAKG,SAAS,CAACH,IAAI,CAAC;IACjF,IAAIyB,KAAK,GAAG,CAAC,EAAE;MACbD,OAAO,CAACI,IAAI,CAACzB,SAAS,CAAC;IACzB,CAAC,MAAM;MACLqB,OAAO,CAACC,KAAK,CAAC,GAAGtB,SAAS;IAC5B;EACF;EACA,OAAOqB,OAAO;AAChB"}
|
package/dist.min.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
else root['luma'] = factory();})(globalThis, function () {
|
|
7
7
|
"use strict";var __exports__=(()=>{var Uo=Object.create;var he=Object.defineProperty;var Go=Object.getOwnPropertyDescriptor;var Bo=Object.getOwnPropertyNames;var zo=Object.getPrototypeOf,ko=Object.prototype.hasOwnProperty;var Ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vo=(e,t)=>{for(var r in t)he(e,r,{get:t[r],enumerable:!0})},Pr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bo(t))!ko.call(e,i)&&i!==r&&he(e,i,{get:()=>t[i],enumerable:!(n=Go(t,i))||n.enumerable});return e};var pe=(e,t,r)=>(r=e!=null?Uo(zo(e)):{},Pr(t||!e||!e.__esModule?he(r,"default",{value:e,enumerable:!0}):r,e)),Ho=e=>Pr(he({},"__esModule",{value:!0}),e);var Dr=Ge((Lc,gt)=>{function qe(e){return gt.exports=qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt.exports.__esModule=!0,gt.exports.default=gt.exports,qe(e)}gt.exports=qe,gt.exports.__esModule=!0,gt.exports.default=gt.exports});var jr=Ge((Dc,vt)=>{var Ir=Dr().default;function Nr(){"use strict";vt.exports=Nr=function(){return e},vt.exports.__esModule=!0,vt.exports.default=vt.exports;var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(g,p,d){g[p]=d.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function a(g,p,d){return Object.defineProperty(g,p,{value:d,enumerable:!0,configurable:!0,writable:!0}),g[p]}try{a({},"")}catch{a=function(d,_,E){return d[_]=E}}function f(g,p,d,_){var E=p&&p.prototype instanceof h?p:h,P=Object.create(E.prototype),D=new U(_||[]);return n(P,"_invoke",{value:w(g,d,D)}),P}function u(g,p,d){try{return{type:"normal",arg:g.call(p,d)}}catch(_){return{type:"throw",arg:_}}}e.wrap=f;var l={};function h(){}function v(){}function m(){}var y={};a(y,o,function(){return this});var b=Object.getPrototypeOf,O=b&&b(b(C([])));O&&O!==t&&r.call(O,o)&&(y=O);var R=m.prototype=h.prototype=Object.create(y);function x(g){["next","throw","return"].forEach(function(p){a(g,p,function(d){return this._invoke(p,d)})})}function S(g,p){function d(E,P,D,B){var I=u(g[E],g,P);if(I.type!=="throw"){var G=I.arg,k=G.value;return k&&Ir(k)=="object"&&r.call(k,"__await")?p.resolve(k.__await).then(function(V){d("next",V,D,B)},function(V){d("throw",V,D,B)}):p.resolve(k).then(function(V){G.value=V,D(G)},function(V){return d("throw",V,D,B)})}B(I.arg)}var _;n(this,"_invoke",{value:function(P,D){function B(){return new p(function(I,G){d(P,D,I,G)})}return _=_?_.then(B,B):B()}})}function w(g,p,d){var _="suspendedStart";return function(E,P){if(_==="executing")throw new Error("Generator is already running");if(_==="completed"){if(E==="throw")throw P;return{value:void 0,done:!0}}for(d.method=E,d.arg=P;;){var D=d.delegate;if(D){var B=M(D,d);if(B){if(B===l)continue;return B}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(_==="suspendedStart")throw _="completed",d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);_="executing";var I=u(g,p,d);if(I.type==="normal"){if(_=d.done?"completed":"suspendedYield",I.arg===l)continue;return{value:I.arg,done:d.done}}I.type==="throw"&&(_="completed",d.method="throw",d.arg=I.arg)}}}function M(g,p){var d=p.method,_=g.iterator[d];if(_===void 0)return p.delegate=null,d==="throw"&&g.iterator.return&&(p.method="return",p.arg=void 0,M(g,p),p.method==="throw")||d!=="return"&&(p.method="throw",p.arg=new TypeError("The iterator does not provide a '"+d+"' method")),l;var E=u(_,g.iterator,p.arg);if(E.type==="throw")return p.method="throw",p.arg=E.arg,p.delegate=null,l;var P=E.arg;return P?P.done?(p[g.resultName]=P.value,p.next=g.nextLoc,p.method!=="return"&&(p.method="next",p.arg=void 0),p.delegate=null,l):P:(p.method="throw",p.arg=new TypeError("iterator result is not an object"),p.delegate=null,l)}function j(g){var p={tryLoc:g[0]};1 in g&&(p.catchLoc=g[1]),2 in g&&(p.finallyLoc=g[2],p.afterLoc=g[3]),this.tryEntries.push(p)}function N(g){var p=g.completion||{};p.type="normal",delete p.arg,g.completion=p}function U(g){this.tryEntries=[{tryLoc:"root"}],g.forEach(j,this),this.reset(!0)}function C(g){if(g||g===""){var p=g[o];if(p)return p.call(g);if(typeof g.next=="function")return g;if(!isNaN(g.length)){var d=-1,_=function E(){for(;++d<g.length;)if(r.call(g,d))return E.value=g[d],E.done=!1,E;return E.value=void 0,E.done=!0,E};return _.next=_}}throw new TypeError(Ir(g)+" is not iterable")}return v.prototype=m,n(R,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:v,configurable:!0}),v.displayName=a(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(g){var p=typeof g=="function"&&g.constructor;return!!p&&(p===v||(p.displayName||p.name)==="GeneratorFunction")},e.mark=function(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,m):(g.__proto__=m,a(g,c,"GeneratorFunction")),g.prototype=Object.create(R),g},e.awrap=function(g){return{__await:g}},x(S.prototype),a(S.prototype,s,function(){return this}),e.AsyncIterator=S,e.async=function(g,p,d,_,E){E===void 0&&(E=Promise);var P=new S(f(g,p,d,_),E);return e.isGeneratorFunction(p)?P:P.next().then(function(D){return D.done?D.value:P.next()})},x(R),a(R,c,"Generator"),a(R,o,function(){return this}),a(R,"toString",function(){return"[object Generator]"}),e.keys=function(g){var p=Object(g),d=[];for(var _ in p)d.push(_);return d.reverse(),function E(){for(;d.length;){var P=d.pop();if(P in p)return E.value=P,E.done=!1,E}return E.done=!0,E}},e.values=C,U.prototype={constructor:U,reset:function(p){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(N),!p)for(var d in this)d.charAt(0)==="t"&&r.call(this,d)&&!isNaN(+d.slice(1))&&(this[d]=void 0)},stop:function(){this.done=!0;var p=this.tryEntries[0].completion;if(p.type==="throw")throw p.arg;return this.rval},dispatchException:function(p){if(this.done)throw p;var d=this;function _(G,k){return D.type="throw",D.arg=p,d.next=G,k&&(d.method="next",d.arg=void 0),!!k}for(var E=this.tryEntries.length-1;E>=0;--E){var P=this.tryEntries[E],D=P.completion;if(P.tryLoc==="root")return _("end");if(P.tryLoc<=this.prev){var B=r.call(P,"catchLoc"),I=r.call(P,"finallyLoc");if(B&&I){if(this.prev<P.catchLoc)return _(P.catchLoc,!0);if(this.prev<P.finallyLoc)return _(P.finallyLoc)}else if(B){if(this.prev<P.catchLoc)return _(P.catchLoc,!0)}else{if(!I)throw new Error("try statement without catch or finally");if(this.prev<P.finallyLoc)return _(P.finallyLoc)}}}},abrupt:function(p,d){for(var _=this.tryEntries.length-1;_>=0;--_){var E=this.tryEntries[_];if(E.tryLoc<=this.prev&&r.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var P=E;break}}P&&(p==="break"||p==="continue")&&P.tryLoc<=d&&d<=P.finallyLoc&&(P=null);var D=P?P.completion:{};return D.type=p,D.arg=d,P?(this.method="next",this.next=P.finallyLoc,l):this.complete(D)},complete:function(p,d){if(p.type==="throw")throw p.arg;return p.type==="break"||p.type==="continue"?this.next=p.arg:p.type==="return"?(this.rval=this.arg=p.arg,this.method="return",this.next="end"):p.type==="normal"&&d&&(this.next=d),l},finish:function(p){for(var d=this.tryEntries.length-1;d>=0;--d){var _=this.tryEntries[d];if(_.finallyLoc===p)return this.complete(_.completion,_.afterLoc),N(_),l}},catch:function(p){for(var d=this.tryEntries.length-1;d>=0;--d){var _=this.tryEntries[d];if(_.tryLoc===p){var E=_.completion;if(E.type==="throw"){var P=E.arg;N(_)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(p,d,_){return this.delegate={iterator:C(p),resultName:d,nextLoc:_},this.method==="next"&&(this.arg=void 0),l}},e}vt.exports=Nr,vt.exports.__esModule=!0,vt.exports.default=vt.exports});var Jt=Ge((Ic,Fr)=>{var de=jr()();Fr.exports=de;try{regeneratorRuntime=de}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=de:Function("r","regeneratorRuntime = r")(de)}});var rc={};Vo(rc,{AnimationLoop:()=>be,AnimationLoopTemplate:()=>Ur,ClipSpace:()=>ao,ConeGeometry:()=>mo,CubeGeometry:()=>vo,CylinderGeometry:()=>xo,GPUGeometry:()=>Le,Geometry:()=>st,GroupNode:()=>fo,IcoSphereGeometry:()=>Oo,KeyFrames:()=>Cr,Model:()=>ae,ModelNode:()=>uo,PipelineFactory:()=>se,PlaneGeometry:()=>Mo,ScenegraphNode:()=>It,ShaderModuleUniforms:()=>eo,SphereGeometry:()=>Po,Timeline:()=>Rr,Transform:()=>to,TruncatedConeGeometry:()=>Yt,makeAnimationLoop:()=>On});function Be(e){if(Array.isArray(e))return e}function ze(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,s,c=[],a=!0,f=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=o.call(r)).done)&&(c.push(n.value),c.length!==t);a=!0);}catch(u){f=!0,i=u}finally{try{if(!a&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(f)throw i}}return c}}function Nt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $t(e,t){if(e){if(typeof e=="string")return Nt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Nt(e,t)}}function ke(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
8
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z(e,t){return Be(e)||ze(e,t)||$t(e,t)||ke()}function tt(e){return tt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(e)}function Ve(e,t){if(tt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(tt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zt(e){var t=Ve(e,"string");return tt(t)==="symbol"?t:String(t)}function Ar(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Zt(n.key),n)}}function A(e,t,r){return t&&Ar(e.prototype,t),r&&Ar(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function He(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=qo(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function qo(e,t){if(e){if(typeof e=="string")return Tr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tr(e,t)}}function Tr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Wo=1,Ko=1,Rr=function(){function e(){T(this,e),this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}var t=e.prototype;return t.addChannel=function(n){var i=n.delay,o=i===void 0?0:i,s=n.duration,c=s===void 0?Number.POSITIVE_INFINITY:s,a=n.rate,f=a===void 0?1:a,u=n.repeat,l=u===void 0?1:u,h=Wo++,v={time:0,delay:o,duration:c,rate:f,repeat:l};return this._setChannelTime(v,this.time),this.channels.set(h,v),h},t.removeChannel=function(n){this.channels.delete(n);var i=He(this.animations),o;try{for(i.s();!(o=i.n()).done;){var s=z(o.value,2),c=s[0],a=s[1];a.channel===n&&this.detachAnimation(c)}}catch(f){i.e(f)}finally{i.f()}},t.isFinished=function(n){var i=this.channels.get(n);return i===void 0?!1:this.time>=i.delay+i.duration*i.repeat},t.getTime=function(n){if(n===void 0)return this.time;var i=this.channels.get(n);return i===void 0?-1:i.time},t.setTime=function(n){this.time=Math.max(0,n);var i=this.channels.values(),o=He(i),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;this._setChannelTime(c,this.time)}}catch(m){o.e(m)}finally{o.f()}var a=this.animations.values(),f=He(a),u;try{for(f.s();!(u=f.n()).done;){var l=u.value,h=l.animation,v=l.channel;h.setTime(this.getTime(v))}}catch(m){f.e(m)}finally{f.f()}},t.play=function(){this.playing=!0},t.pause=function(){this.playing=!1,this.lastEngineTime=-1},t.reset=function(){this.setTime(0)},t.attachAnimation=function(n,i){var o=Ko++;return this.animations.set(o,{animation:n,channel:i}),n.setTime(this.getTime(i)),o},t.detachAnimation=function(n){this.animations.delete(n)},t.update=function(n){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=n),this.setTime(this.time+(n-this.lastEngineTime)),this.lastEngineTime=n)},t._setChannelTime=function(n,i){var o=i-n.delay,s=n.duration*n.repeat;o>=s?n.time=n.duration*n.rate:(n.time=Math.max(0,o)%n.duration,n.time*=n.rate)},A(e)}();var Cr=function(){function e(r){T(this,e),this.startIndex=-1,this.endIndex=-1,this.factor=0,this.times=[],this.values=[],this._lastTime=-1,this.setKeyFrames(r),this.setTime(0)}var t=e.prototype;return t.setKeyFrames=function(n){var i=n.length;this.times.length=i,this.values.length=i;for(var o=0;o<i;++o)this.times[o]=n[o][0],this.values[o]=n[o][1];this._calculateKeys(this._lastTime)},t.setTime=function(n){n=Math.max(0,n),n!==this._lastTime&&(this._calculateKeys(n),this._lastTime=n)},t.getStartTime=function(){return this.times[this.startIndex]},t.getEndTime=function(){return this.times[this.endIndex]},t.getStartData=function(){return this.values[this.startIndex]},t.getEndData=function(){return this.values[this.endIndex]},t._calculateKeys=function(n){var i=0,o=this.times.length;for(i=0;i<o-2&&!(this.times[i+1]>n);++i);this.startIndex=i,this.endIndex=i+1;var s=this.times[this.startIndex],c=this.times[this.endIndex];this.factor=Math.min(Math.max(0,(n-s)/(c-s)),1)},A(e)}();function Lr(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(f){r(f);return}c.done?t(a):Promise.resolve(a).then(n,i)}function lt(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(a){Lr(o,n,i,s,c,"next",a)}function c(a){Lr(o,n,i,s,c,"throw",a)}s(void 0)})}}var We=pe(Jt(),1),Ur=function(){function e(r){T(this,e)}var t=e.prototype;return t.onInitialize=function(){var r=lt(We.default.mark(function i(o){return We.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",null);case 1:case"end":return c.stop()}},i)}));function n(i){return r.apply(this,arguments)}return n}(),A(e)}();function L(e,t,r){return t=Zt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yt=pe(Jt(),1);function Ke(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function ct(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Ke()}var Yo=globalThis.self||globalThis.window||globalThis.global,jt=globalThis.window||globalThis.self||globalThis.global,Xo=globalThis.document||{},Tt=globalThis.process||{},$o=globalThis.console,Hc=globalThis.navigator||{};var me=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Kc=ct();function Zo(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var ge=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=Zo(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Gr(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Br(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function ve(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let o=e.width*r,s=e.height*r,c=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),c]}var ye;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ye||(ye={}));var Jo=10;function zr(e){return typeof e!="string"?e:(e=e.toUpperCase(),ye[e]||ye.WHITE)}function kr(e,t,r){if(!ct&&typeof e=="string"){if(t){let n=zr(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=zr(r);e="\x1B[".concat(n+Jo,"m").concat(e,"\x1B[49m")}}return e}function Vr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(c=>o===c)||(i[o]=s.bind(e)))}}function Ft(e,t){if(!e)throw new Error(t||"Assertion failed")}function Rt(){let e;if(ct()&&jt.performance){var t,r;e=jt===null||jt===void 0||(t=jt.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Tt){var n;let i=Tt===null||Tt===void 0||(n=Tt.hrtime)===null||n===void 0?void 0:n.call(Tt);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var Ut={debug:ct()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Qo={enabled:!0,level:0};function ht(){}var Hr={},qr={once:!0},wt=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=me,this._startTs=Rt(),this._deltaTs=Rt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ge("__probe-".concat(this.id,"__"),Qo),this.timeStamp("".concat(this.id," started")),Vr(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Rt()-this._startTs).toPrecision(10))}getDelta(){return Number((Rt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Ft(t,r)}warn(t){return this._getLogFunction(0,t,Ut.warn,arguments,qr)}error(t){return this._getLogFunction(0,t,Ut.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Ut.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Ut.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Ut.debug||Ut.info,arguments,qr)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||ht,n&&[n],{tag:ns(r)}):ht}image(t){let{logLevel:r,priority:n,image:i,message:o="",scale:s=1}=t;return this._shouldLog(r||n)?ct()?rs({image:i,message:o,scale:s}):es({image:i,message:o,scale:s}):ht}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||ht)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=Wr({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||ht)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Kr(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=Wr({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,Ft(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Rt();let s=o.tag||o.message;if(o.once&&s)if(!Hr[s])Hr[s]=Rt();else return ht;return r=ts(this.id,o.message,o),n.bind(console,r,...o.args)}return ht}};wt.VERSION=me;function Kr(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Ft(Number.isFinite(t)&&t>=0),t}function Wr(e){let{logLevel:t,message:r}=e;e.logLevel=Kr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return Ft(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function ts(e,t,r){if(typeof t=="string"){let n=r.time?Br(Gr(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=kr(t,r.color,r.background)}return t}function es(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),ht}function rs(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let o=new Image;return o.onload=()=>{let s=ve(o,r,n);console.log(...s)},o.src=t,ht}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...ve(t,r,n)),ht;if(i.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...ve(o,r,n)),o.src=t.toDataURL(),ht}return ht}function ns(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var _f=new wt({id:"@probe.gl/log"});var K=new wt({id:"luma.gl"});function Qt(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Ct=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Qt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Qt()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Et=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof Ct?i=t:i=new Ct(r,n),this.stats[r]=i),i}};var is=function(){function e(){T(this,e),this.stats=new Map}var t=e.prototype;return t.getStats=function(n){return this.get(n)},t.get=function(n){return this.stats.has(n)||this.stats.set(n,new Et({id:n})),this.stats.get(n)},A(e)}(),Gt=new is;function os(){var e=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||(ct()&&K.log(1,"luma.gl ".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:K,stats:Gt}),e}var Yr=os();function Xr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)?e:null}function Mt(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number"?e:null:Xr(e)}var Je=pe(Jt(),1);var Ye={};function H(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Ye[e]=Ye[e]||1;var t=Ye[e]++;return"".concat(e,"-").concat(t)}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},te(e,t)}function q(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&te(e,t)}function Xe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(e,t){if(t&&(tt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xe(e)}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},F(e)}function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ss(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$r(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Lt=function(){function e(r,n,i){if(T(this,e),this.id=void 0,this.props=void 0,this.userData={},this.device=void 0,this._device=void 0,this.destroyed=!1,this.allocatedBytes=0,this._attachedResources=new Set,!r)throw new Error("no device");this._device=r,this.props=as(n,i);var o=this.props.id!=="undefined"?this.props.id:H(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}var t=e.prototype;return t.destroy=function(){this.destroyResource()},t.delete=function(){return this.destroy(),this},t.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},t.getProps=function(){return this.props},t.attachResource=function(n){this._attachedResources.add(n)},t.detachResource=function(n){this._attachedResources.delete(n)},t.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},t.destroyAttachedResources=function(){for(var n=0,i=Object.values(this._attachedResources);n<i.length;n++){var o=i[n];o.destroy()}this._attachedResources=new Set},t.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},t.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("".concat(i,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(n),o.get("".concat(i," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").subtractCount(this.allocatedBytes),i.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(i,"s Created")).incrementCount(),n.get("".concat(i,"s Active")).incrementCount()},A(e)}();Lt.defaultProps={id:"undefined",handle:void 0,userData:void 0};function as(e,t){var r=ss({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var Jr;function Zr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cs(e){var t=fs();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function fs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}Jr=Symbol.toStringTag;var X=function(e){q(r,e);var t=cs(r);function r(i,o){var s;T(this,r);var c=$e({},o);return(o.usage||0)&r.INDEX&&!o.indexType&&(o.data instanceof Uint32Array?c.indexType="uint32":o.data instanceof Uint16Array&&(c.indexType="uint16")),s=t.call(this,i,c,r.defaultProps),s.usage=void 0,s.indexType=void 0,s.byteLength=void 0,s.usage=o.usage||0,s.indexType=c.indexType,s}var n=r.prototype;return n.write=function(o,s){throw new Error("not implemented")},n.readAsync=function(o,s){throw new Error("not implemented")},n.getData=function(){throw new Error("not implemented")},A(r,[{key:Jr,get:function(){return"Buffer"}}]),r}(Lt);X.defaultProps=$e($e({},Lt.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});X.MAP_READ=1;X.MAP_WRITE=2;X.COPY_SRC=4;X.COPY_DST=8;X.INDEX=16;X.VERTEX=32;X.UNIFORM=64;X.STORAGE=128;X.INDIRECT=256;X.QUERY_RESOLVE=512;var tn;function Qr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var _e={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(K.get("debug")),break:[],gl:null};tn=Symbol.toStringTag;var us=function(){function e(r){T(this,e),this.id=void 0,this.statsManager=Gt,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=Ze(Ze({},_e),r),this.id=this.props.id||H(this[Symbol.toStringTag].toLowerCase())}var t=e.prototype;return t.loseDevice=function(){return!1},t.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},t.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},t.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},t._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var i=Ze({},n);return(n.usage||0)&X.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?i.indexType="uint32":n.data instanceof Uint16Array?i.indexType="uint16":K.warn("indices buffer content must be of integer type")()),i},A(e,[{key:tn,get:function(){return"Device"}}]),e}();us.VERSION=Yr;function en(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?en(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):en(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ls(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=hs(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
10
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function hs(e,t){if(e){if(typeof e=="string")return nn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nn(e,t)}}function nn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Bt=new Map,Dt=function(){function e(){T(this,e)}return e.registerDevices=function(r){var n=ls(r),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;rt(o.type&&o.isSupported&&o.create),Bt.set(o.type,o)}}catch(s){n.e(s)}finally{n.f()}},e.getAvailableDevices=function(){return Array.from(Bt).map(function(r){return r.type})},e.getSupportedDevices=function(){return Array.from(Bt).filter(function(r){return r.isSupported()}).map(function(r){return r.type})},e.setDefaultDeviceProps=function(r){Object.assign(_e,r)},e.createDevice=function(){var t=lt(Je.default.mark(function n(){var i,o,s=arguments;return Je.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:i=s.length>0&&s[0]!==void 0?s[0]:{},i=rn(rn({},_e),i),i.gl&&(i.type="webgl"),a.t0=i.type,a.next=a.t0==="webgpu"?6:a.t0==="webgl"||a.t0==="webgl1"||a.t0==="webgl2"?12:a.t0==="best-available"?18:24;break;case 6:if(o=Bt.get("webgpu"),!o){a.next=11;break}return a.next=10,o.create(i);case 10:return a.abrupt("return",a.sent);case 11:return a.abrupt("break",24);case 12:if(o=Bt.get("webgl"),!o){a.next=17;break}return a.next=16,o.create(i);case 16:return a.abrupt("return",a.sent);case 17:return a.abrupt("break",24);case 18:if(o=Bt.get("webgl"),!(o&&o.isSupported())){a.next=23;break}return a.next=22,o.create(i);case 22:return a.abrupt("return",a.sent);case 23:return a.abrupt("break",24);case 24:throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.");case 25:case"end":return a.stop()}},n)}));function r(){return t.apply(this,arguments)}return r}(),A(e)}();Dt.stats=Gt;Dt.log=
|
|
11
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function xs(e,t){if(e){if(typeof e=="string")return ln(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ln(e,t)}}function ln(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tr(e,t){var r={},n=ee(e.attributes),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;r[o.name]=bs(e,t,o.name)}}catch(s){n.e(s)}finally{n.f()}return r}function bs(e,t,r){var n=Os(e,r),i=ws(t,r);if(!n)return null;var o=cn(n.type),s=i?.vertexFormat||o.defaultVertexFormat,c=Qe(s);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:o.integer,stepMode:i?.stepMode||n.stepMode,byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function Os(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||K.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function ws(e,t){Es(e);var r=Ms(e,t);return r||(r=Ss(e,t),r)?r:(K.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function Es(e){var t=ee(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&K.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(i){t.e(i)}finally{t.f()}}function Ms(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.format&&i.name===t)return{attributeName:i.name,bufferName:t,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0}}}catch(o){r.e(o)}finally{r.f()}return null}function Ss(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i,o=n.value,s=o.byteStride;if(typeof o.byteStride!="number"){var c=ee(o.attributes||[]),a;try{for(c.s();!(a=c.n()).done;){var f=a.value,u=Qe(f.format);s+=u.byteLength}}catch(h){c.e(h)}finally{c.f()}}var l=(i=o.attributes)===null||i===void 0?void 0:i.find(function(h){return h.attribute===t});if(l)return{attributeName:l.attribute,bufferName:o.name,stepMode:o.stepMode,vertexFormat:l.format,byteOffset:l.byteOffset,byteStride:s}}}catch(h){r.e(h)}finally{r.f()}return null}function rt(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}var Ps={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function hn(e){var t=Ps[e];return rt(e),t}function pn(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}var xe;function dn(e){return(!xe||xe.byteLength<e)&&(xe=new ArrayBuffer(e)),xe}var mn=1024,er=function(){function e(r){T(this,e),this.layout={},this.byteLength=void 0;for(var n=0,i=0,o=Object.entries(r);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1],f=hn(a),u=f.type,l=f.components;n=pn(n,l);var h=n;n+=l,this.layout[c]={type:u,size:l,offset:h}}n+=(4-n%4)%4;var v=n*4;this.byteLength=Math.max(v,mn)}var t=e.prototype;return t.getData=function(n){for(var i=Math.max(this.byteLength,mn),o=dn(i),s={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)},c=0,a=Object.entries(n);c<a.length;c++){var f=z(a[c],2),u=f[0],l=f[1],h=this.layout[u];if(!h){K.warn("Supplied uniform value ".concat(u," not present in uniform block layout"))();continue}var v=h.type,m=h.size,y=h.offset,b=s[v];if(m===1){if(typeof l!="number"&&typeof l!="boolean"){K.warn("Supplied value for single component uniform ".concat(u," is not a number: ").concat(l))();continue}b[y]=Number(l)}else{var O=Mt(l);if(!O){K.warn("Supplied value for multi component / array uniform ".concat(u," is not a numeric array: ").concat(l))();continue}b.set(O,y)}}return new Uint8Array(o)},t.has=function(n){return Boolean(this.layout[n])},t.get=function(n){var i=this.layout[n];return i},A(e)}();function gn(e){return Mt(e)!==null||typeof e=="number"||typeof e=="boolean"}function rr(e){var t={bindings:{},uniforms:{}};return Object.keys(e).forEach(function(r){var n=e[r];gn(n)?t.uniforms[r]=n:t.bindings[r]=n}),t}function re(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!re(e[n],t[n],r-1))return!1;return!0}if(Array.isArray(t))return!1;if(tt(e)==="object"&&tt(t)==="object"){var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var s=0,c=i;s<c.length;s++){var a=c[s];if(!t.hasOwnProperty(a)||!re(e[a],t[a],r-1))return!1}return!0}return!1}function nr(e){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function ir(e){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}var vn=function(t){return"".concat(t)};function yn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var As=0,Ts={device:null,onAddHTML:function(){return""},onInitialize:function(){var e=lt(yt.default.mark(function r(){return yt.default.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",null);case 1:case"end":return i.stop()}},r)}));function t(){return e.apply(this,arguments)}return t}(),onRender:function(){},onFinalize:function(){},onError:function(t){return console.error(t)},stats:Dt.stats.get("animation-loop-".concat(As++)),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},be=function(){function e(r){if(T(this,e),this.device=null,this.canvas=null,this.props=void 0,this.animationProps=null,this.timeline=null,this.stats=void 0,this.cpuTime=void 0,this.gpuTime=void 0,this.frameRate=void 0,this.display=void 0,this.needsRedraw="initialized",this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.props=_n(_n({},Ts),r),r=this.props,!r.device)throw new Error("No device provided");var n=this.props.useDevicePixels,i=n===void 0?!0:n;this.stats=r.stats||new Et({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:r.autoResizeViewport,autoResizeDrawingBuffer:r.autoResizeDrawingBuffer,useDevicePixels:i}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}var t=e.prototype;return t.destroy=function(){this.stop(),this._setDisplay(null)},t.delete=function(){this.destroy()},t.setNeedsRedraw=function(n){return this.needsRedraw=this.needsRedraw||n,this},t.setProps=function(n){return"autoResizeViewport"in n&&(this.props.autoResizeViewport=n.autoResizeViewport||!1),"autoResizeDrawingBuffer"in n&&(this.props.autoResizeDrawingBuffer=n.autoResizeDrawingBuffer||!1),"useDevicePixels"in n&&(this.props.useDevicePixels=n.useDevicePixels||!1),this},t.start=function(){var r=lt(yt.default.mark(function i(){var o,s;return yt.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!this._running){a.next=2;break}return a.abrupt("return",this);case 2:if(this._running=!0,a.prev=3,this._running){a.next=6;break}return a.abrupt("return",null);case 6:if(this._initialized){a.next=13;break}return this._initialized=!0,a.next=10,this._initDevice();case 10:return this._initialize(),a.next=13,this.props.onInitialize(this._getAnimationProps());case 13:if(this._running){a.next=15;break}return a.abrupt("return",null);case 15:return o!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),a.abrupt("return",this);case 19:throw a.prev=19,a.t0=a.catch(3),s=a.t0 instanceof Error?a.t0:new Error("Unknown error"),this.props.onError(s),s;case 24:case"end":return a.stop()}},i,this,[[3,19]])}));function n(){return r.apply(this,arguments)}return n}(),t.redraw=function(){var n;return(n=this.device)!==null&&n!==void 0&&n.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)},t.stop=function(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this},t.attachTimeline=function(n){return this.timeline=n,this.timeline},t.detachTimeline=function(){this.timeline=null},t.waitForRender=function(){var n=this;return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(function(i){n._resolveNextFrame=i})),this._nextFramePromise},t.toDataURL=function(){var r=lt(yt.default.mark(function i(){return yt.default.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return this.setNeedsRedraw("toDataURL"),s.next=3,this.waitForRender();case 3:if(!(this.canvas instanceof HTMLCanvasElement)){s.next=5;break}return s.abrupt("return",this.canvas.toDataURL());case 5:throw new Error("OffscreenCanvas");case 6:case"end":return s.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._initialize=function(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._setDisplay=function(n){this.display&&(this.display.destroy(),this.display.animationLoop=null),n&&(n.animationLoop=this),this.display=n},t._requestAnimationFrame=function(){this._running&&(this._animationFrameId=nr(this._animationFrame.bind(this)))},t._cancelAnimationFrame=function(){this._animationFrameId===null&&(ir(this._animationFrameId),this._animationFrameId=null)},t._animationFrame=function(){this._running&&(this.redraw(),this._requestAnimationFrame())},t._renderFrame=function(n){if(this.display){this.display._renderFrame(n);return}this.props.onRender(this._getAnimationProps())},t._clearNeedsRedraw=function(){this.needsRedraw=!1},t._setupFrame=function(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._initializeAnimationProps=function(){var n;if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}},t._getAnimationProps=function(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps},t._updateAnimationProps=function(){if(this.animationProps){var n=this._getSizeAndAspect(),i=n.width,o=n.height,s=n.aspect;(i!==this.animationProps.width||o!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),s!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=i,this.animationProps.height=o,this.animationProps.aspect=s,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}},t._initDevice=function(){var r=lt(yt.default.mark(function i(){var o;return yt.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.props.device;case 2:if(this.device=c.sent,this.device){c.next=5;break}throw new Error("No device provided");case 5:this.canvas=((o=this.device.canvasContext)===null||o===void 0?void 0:o.canvas)||null;case 6:case"end":return c.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._createInfoDiv=function(){if(this.canvas&&this.props.onAddHTML){var n=document.createElement("div");document.body.appendChild(n),n.style.position="relative";var i=document.createElement("div");i.style.position="absolute",i.style.left="10px",i.style.bottom="10px",i.style.width="300px",i.style.background="white",this.canvas instanceof HTMLCanvasElement&&n.appendChild(this.canvas),n.appendChild(i);var o=this.props.onAddHTML(i);o&&(i.innerHTML=o)}},t._getSizeAndAspect=function(){var n,i;if(!this.device)return{width:1,height:1,aspect:1};var o=((n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.getPixelSize())||[1,1],s=z(o,2),c=s[0],a=s[1],f=1,u=(i=this.device)===null||i===void 0||(i=i.canvasContext)===null||i===void 0?void 0:i.canvas;return u&&u.clientHeight?f=u.clientWidth/u.clientHeight:c>0&&a>0&&(f=c/a),{width:c,height:a,aspect:f}},t._resizeViewport=function(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)},t._resizeCanvasDrawingBuffer=function(){if(this.props.autoResizeDrawingBuffer){var n;(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0||n.resize({useDevicePixels:this.props.useDevicePixels})}},t._beginFrameTimers=function(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()},t._endFrameTimers=function(){this.cpuTime.timeEnd()},t._startEventHandling=function(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))},t._onMousemove=function(n){n instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[n.offsetX,n.offsetY])},t._onMouseleave=function(n){this._getAnimationProps()._mousePosition=null},A(e)}();var or=pe(Jt(),1);function xn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function On(e,t){var r=this,n=null,i=t?.device||Dt.createDevice(),o=new be(bn(bn({},t),{},{device:i,onInitialize:function(c){return lt(or.default.mark(function a(){var f;return or.default.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=new e(c),l.next=3,(f=n)===null||f===void 0?void 0:f.onInitialize(c);case 3:return l.abrupt("return",l.sent);case 4:case"end":return l.stop()}},a)}))()},onRender:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onRender(c)},onFinalize:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onFinalize(c)}}));return o.getInfo=function(){return r.AnimationLoopTemplateCtor.info},o}function sr(e){if(Array.isArray(e))return Nt(e)}function ar(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function qo(e,t){if(e){if(typeof e=="string")return Tr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tr(e,t)}}function Tr(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Wo=1,Ko=1,Rr=function(){function e(){T(this,e),this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}var t=e.prototype;return t.addChannel=function(n){var i=n.delay,o=i===void 0?0:i,s=n.duration,c=s===void 0?Number.POSITIVE_INFINITY:s,a=n.rate,f=a===void 0?1:a,u=n.repeat,l=u===void 0?1:u,h=Wo++,v={time:0,delay:o,duration:c,rate:f,repeat:l};return this._setChannelTime(v,this.time),this.channels.set(h,v),h},t.removeChannel=function(n){this.channels.delete(n);var i=He(this.animations),o;try{for(i.s();!(o=i.n()).done;){var s=z(o.value,2),c=s[0],a=s[1];a.channel===n&&this.detachAnimation(c)}}catch(f){i.e(f)}finally{i.f()}},t.isFinished=function(n){var i=this.channels.get(n);return i===void 0?!1:this.time>=i.delay+i.duration*i.repeat},t.getTime=function(n){if(n===void 0)return this.time;var i=this.channels.get(n);return i===void 0?-1:i.time},t.setTime=function(n){this.time=Math.max(0,n);var i=this.channels.values(),o=He(i),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;this._setChannelTime(c,this.time)}}catch(m){o.e(m)}finally{o.f()}var a=this.animations.values(),f=He(a),u;try{for(f.s();!(u=f.n()).done;){var l=u.value,h=l.animation,v=l.channel;h.setTime(this.getTime(v))}}catch(m){f.e(m)}finally{f.f()}},t.play=function(){this.playing=!0},t.pause=function(){this.playing=!1,this.lastEngineTime=-1},t.reset=function(){this.setTime(0)},t.attachAnimation=function(n,i){var o=Ko++;return this.animations.set(o,{animation:n,channel:i}),n.setTime(this.getTime(i)),o},t.detachAnimation=function(n){this.animations.delete(n)},t.update=function(n){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=n),this.setTime(this.time+(n-this.lastEngineTime)),this.lastEngineTime=n)},t._setChannelTime=function(n,i){var o=i-n.delay,s=n.duration*n.repeat;o>=s?n.time=n.duration*n.rate:(n.time=Math.max(0,o)%n.duration,n.time*=n.rate)},A(e)}();var Cr=function(){function e(r){T(this,e),this.startIndex=-1,this.endIndex=-1,this.factor=0,this.times=[],this.values=[],this._lastTime=-1,this.setKeyFrames(r),this.setTime(0)}var t=e.prototype;return t.setKeyFrames=function(n){var i=n.length;this.times.length=i,this.values.length=i;for(var o=0;o<i;++o)this.times[o]=n[o][0],this.values[o]=n[o][1];this._calculateKeys(this._lastTime)},t.setTime=function(n){n=Math.max(0,n),n!==this._lastTime&&(this._calculateKeys(n),this._lastTime=n)},t.getStartTime=function(){return this.times[this.startIndex]},t.getEndTime=function(){return this.times[this.endIndex]},t.getStartData=function(){return this.values[this.startIndex]},t.getEndData=function(){return this.values[this.endIndex]},t._calculateKeys=function(n){var i=0,o=this.times.length;for(i=0;i<o-2&&!(this.times[i+1]>n);++i);this.startIndex=i,this.endIndex=i+1;var s=this.times[this.startIndex],c=this.times[this.endIndex];this.factor=Math.min(Math.max(0,(n-s)/(c-s)),1)},A(e)}();function Lr(e,t,r,n,i,o,s){try{var c=e[o](s),a=c.value}catch(f){r(f);return}c.done?t(a):Promise.resolve(a).then(n,i)}function lt(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(a){Lr(o,n,i,s,c,"next",a)}function c(a){Lr(o,n,i,s,c,"throw",a)}s(void 0)})}}var We=pe(Jt(),1),Ur=function(){function e(r){T(this,e)}var t=e.prototype;return t.onInitialize=function(){var r=lt(We.default.mark(function i(o){return We.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",null);case 1:case"end":return c.stop()}},i)}));function n(i){return r.apply(this,arguments)}return n}(),A(e)}();function L(e,t,r){return t=Zt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yt=pe(Jt(),1);function Ke(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function ct(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Ke()}var Yo=globalThis.self||globalThis.window||globalThis.global,jt=globalThis.window||globalThis.self||globalThis.global,Xo=globalThis.document||{},Tt=globalThis.process||{},$o=globalThis.console,Hc=globalThis.navigator||{};var me=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Kc=ct();function Zo(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var ge=class{constructor(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=Zo(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Gr(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Br(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function ve(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let o=e.width*r,s=e.height*r,c=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),c]}var ye;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ye||(ye={}));var Jo=10;function zr(e){return typeof e!="string"?e:(e=e.toUpperCase(),ye[e]||ye.WHITE)}function kr(e,t,r){if(!ct&&typeof e=="string"){if(t){let n=zr(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=zr(r);e="\x1B[".concat(n+Jo,"m").concat(e,"\x1B[49m")}}return e}function Vr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(c=>o===c)||(i[o]=s.bind(e)))}}function Ft(e,t){if(!e)throw new Error(t||"Assertion failed")}function Rt(){let e;if(ct()&&jt.performance){var t,r;e=jt===null||jt===void 0||(t=jt.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Tt){var n;let i=Tt===null||Tt===void 0||(n=Tt.hrtime)===null||n===void 0?void 0:n.call(Tt);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var Ut={debug:ct()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Qo={enabled:!0,level:0};function ht(){}var Hr={},qr={once:!0},wt=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=me,this._startTs=Rt(),this._deltaTs=Rt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new ge("__probe-".concat(this.id,"__"),Qo),this.timeStamp("".concat(this.id," started")),Vr(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Rt()-this._startTs).toPrecision(10))}getDelta(){return Number((Rt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){Ft(t,r)}warn(t){return this._getLogFunction(0,t,Ut.warn,arguments,qr)}error(t){return this._getLogFunction(0,t,Ut.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,Ut.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Ut.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Ut.debug||Ut.info,arguments,qr)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||ht,n&&[n],{tag:ns(r)}):ht}image(t){let{logLevel:r,priority:n,image:i,message:o="",scale:s=1}=t;return this._shouldLog(r||n)?ct()?rs({image:i,message:o,scale:s}):es({image:i,message:o,scale:s}):ht}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||ht)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=Wr({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||ht)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Kr(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=Wr({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,Ft(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Rt();let s=o.tag||o.message;if(o.once&&s)if(!Hr[s])Hr[s]=Rt();else return ht;return r=ts(this.id,o.message,o),n.bind(console,r,...o.args)}return ht}};wt.VERSION=me;function Kr(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Ft(Number.isFinite(t)&&t>=0),t}function Wr(e){let{logLevel:t,message:r}=e;e.logLevel=Kr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return Ft(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function ts(e,t,r){if(typeof t=="string"){let n=r.time?Br(Gr(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=kr(t,r.color,r.background)}return t}function es(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),ht}function rs(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let o=new Image;return o.onload=()=>{let s=ve(o,r,n);console.log(...s)},o.src=t,ht}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...ve(t,r,n)),ht;if(i.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...ve(o,r,n)),o.src=t.toDataURL(),ht}return ht}function ns(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var _f=new wt({id:"@probe.gl/log"});var q=new wt({id:"luma.gl"});function Qt(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Ct=class{constructor(t,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Qt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Qt()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Et=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof Ct?i=t:i=new Ct(r,n),this.stats[r]=i),i}};var is=function(){function e(){T(this,e),this.stats=new Map}var t=e.prototype;return t.getStats=function(n){return this.get(n)},t.get=function(n){return this.stats.has(n)||this.stats.set(n,new Et({id:n})),this.stats.get(n)},A(e)}(),Gt=new is;function os(){var e=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||(ct()&&q.log(1,"luma.gl ".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:q,stats:Gt}),e}var Yr=os();function Xr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)?e:null}function Mt(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number"?e:null:Xr(e)}var Je=pe(Jt(),1);var Ye={};function H(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Ye[e]=Ye[e]||1;var t=Ye[e]++;return"".concat(e,"-").concat(t)}function te(e,t){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},te(e,t)}function W(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&te(e,t)}function Xe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e,t){if(t&&(tt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xe(e)}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},F(e)}function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ss(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$r(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Lt=function(){function e(r,n,i){if(T(this,e),this.id=void 0,this.props=void 0,this.userData={},this.device=void 0,this._device=void 0,this.destroyed=!1,this.allocatedBytes=0,this._attachedResources=new Set,!r)throw new Error("no device");this._device=r,this.props=as(n,i);var o=this.props.id!=="undefined"?this.props.id:H(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}var t=e.prototype;return t.destroy=function(){this.destroyResource()},t.delete=function(){return this.destroy(),this},t.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},t.getProps=function(){return this.props},t.attachResource=function(n){this._attachedResources.add(n)},t.detachResource=function(n){this._attachedResources.delete(n)},t.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},t.destroyAttachedResources=function(){for(var n=0,i=Object.values(this._attachedResources);n<i.length;n++){var o=i[n];o.destroy()}this._attachedResources=new Set},t.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},t.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("".concat(i,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(n),o.get("".concat(i," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").subtractCount(this.allocatedBytes),i.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(i,"s Created")).incrementCount(),n.get("".concat(i,"s Active")).incrementCount()},A(e)}();Lt.defaultProps={id:"undefined",handle:void 0,userData:void 0};function as(e,t){var r=ss({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var Jr;function Zr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cs(e){var t=fs();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function fs(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}Jr=Symbol.toStringTag;var X=function(e){W(r,e);var t=cs(r);function r(i,o){var s;T(this,r);var c=$e({},o);return(o.usage||0)&r.INDEX&&!o.indexType&&(o.data instanceof Uint32Array?c.indexType="uint32":o.data instanceof Uint16Array&&(c.indexType="uint16")),s=t.call(this,i,c,r.defaultProps),s.usage=void 0,s.indexType=void 0,s.byteLength=void 0,s.usage=o.usage||0,s.indexType=c.indexType,s}var n=r.prototype;return n.write=function(o,s){throw new Error("not implemented")},n.readAsync=function(o,s){throw new Error("not implemented")},n.getData=function(){throw new Error("not implemented")},A(r,[{key:Jr,get:function(){return"Buffer"}}]),r}(Lt);X.defaultProps=$e($e({},Lt.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});X.MAP_READ=1;X.MAP_WRITE=2;X.COPY_SRC=4;X.COPY_DST=8;X.INDEX=16;X.VERTEX=32;X.UNIFORM=64;X.STORAGE=128;X.INDIRECT=256;X.QUERY_RESOLVE=512;var tn;function Qr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qr(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var _e={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(q.get("debug")),break:[],gl:null};tn=Symbol.toStringTag;var us=function(){function e(r){T(this,e),this.id=void 0,this.statsManager=Gt,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=Ze(Ze({},_e),r),this.id=this.props.id||H(this[Symbol.toStringTag].toLowerCase())}var t=e.prototype;return t.loseDevice=function(){return!1},t.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},t.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},t.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},t._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var i=Ze({},n);return(n.usage||0)&X.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?i.indexType="uint32":n.data instanceof Uint16Array?i.indexType="uint16":q.warn("indices buffer content must be of integer type")()),i},A(e,[{key:tn,get:function(){return"Device"}}]),e}();us.VERSION=Yr;function en(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?en(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):en(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ls(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=hs(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function hs(e,t){if(e){if(typeof e=="string")return nn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nn(e,t)}}function nn(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Bt=new Map,Dt=function(){function e(){T(this,e)}return e.registerDevices=function(r){var n=ls(r),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;rt(o.type&&o.isSupported&&o.create),Bt.set(o.type,o)}}catch(s){n.e(s)}finally{n.f()}},e.getAvailableDevices=function(){return Array.from(Bt).map(function(r){return r.type})},e.getSupportedDevices=function(){return Array.from(Bt).filter(function(r){return r.isSupported()}).map(function(r){return r.type})},e.setDefaultDeviceProps=function(r){Object.assign(_e,r)},e.createDevice=function(){var t=lt(Je.default.mark(function n(){var i,o,s=arguments;return Je.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:i=s.length>0&&s[0]!==void 0?s[0]:{},i=rn(rn({},_e),i),i.gl&&(i.type="webgl"),a.t0=i.type,a.next=a.t0==="webgpu"?6:a.t0==="webgl"||a.t0==="webgl1"||a.t0==="webgl2"?12:a.t0==="best-available"?18:24;break;case 6:if(o=Bt.get("webgpu"),!o){a.next=11;break}return a.next=10,o.create(i);case 10:return a.abrupt("return",a.sent);case 11:return a.abrupt("break",24);case 12:if(o=Bt.get("webgl"),!o){a.next=17;break}return a.next=16,o.create(i);case 16:return a.abrupt("return",a.sent);case 17:return a.abrupt("break",24);case 18:if(o=Bt.get("webgl"),!(o&&o.isSupported())){a.next=23;break}return a.next=22,o.create(i);case 22:return a.abrupt("return",a.sent);case 23:return a.abrupt("break",24);case 24:throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.");case 25:case"end":return a.stop()}},n)}));function r(){return t.apply(this,arguments)}return r}(),A(e)}();Dt.stats=Gt;Dt.log=q;var an;function on(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function sn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?on(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):on(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ps(e){var t=ds();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function ds(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}an=Symbol.toStringTag;var zt=function(e){W(r,e);var t=ps(r);function r(n,i){var o;return T(this,r),o=t.call(this,n,i,r.defaultProps),o.hash="",o.vs=void 0,o.fs=void 0,o.shaderLayout=void 0,o.bufferLayout=void 0,o.shaderLayout=o.props.shaderLayout,o.bufferLayout=o.props.bufferLayout||[],o}return A(r,[{key:an,get:function(){return"RenderPipeline"}}]),r}(Lt);zt.defaultProps=sn(sn({},Lt.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function cn(e){var t=z(gs[e],2),r=t[0],n=t[1],i=r==="i32"||r==="u32",o=r!=="u32",s=vs[r]*n,c=ms(r,n);return{dataType:r,components:n,defaultVertexFormat:c,byteLength:s,integer:i,signed:o}}function ms(e,t){var r;switch(e){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?r:"".concat(r,"x").concat(t)}var gs={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},vs={f32:4,f16:2,i32:4,u32:4};function un(e){var t=fn[e],r=ys(t),n=e.includes("norm"),i=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:fn[e],byteLength:r,integer:i,signed:o,normalized:n}}function ys(e){var t=_s[e];return t}var fn={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},_s={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Qe(e){var t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);var r=e.split("x"),n=z(r,2),i=n[0],o=n[1],s=i,c=o?parseInt(o):1,a=un(s),f={type:s,components:c,byteLength:a.byteLength*c,integer:a.integer,signed:a.signed,normalized:a.normalized};return t&&(f.webglOnly=!0),f}function ee(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=xs(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
11
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function xs(e,t){if(e){if(typeof e=="string")return ln(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ln(e,t)}}function ln(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tr(e,t){var r={},n=ee(e.attributes),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;r[o.name]=bs(e,t,o.name)}}catch(s){n.e(s)}finally{n.f()}return r}function bs(e,t,r){var n=Os(e,r),i=ws(t,r);if(!n)return null;var o=cn(n.type),s=i?.vertexFormat||o.defaultVertexFormat,c=Qe(s);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:o.integer,stepMode:i?.stepMode||n.stepMode,byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function Os(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||q.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function ws(e,t){Es(e);var r=Ms(e,t);return r||(r=Ss(e,t),r)?r:(q.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function Es(e){var t=ee(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&q.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(i){t.e(i)}finally{t.f()}}function Ms(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.format&&i.name===t)return{attributeName:i.name,bufferName:t,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0}}}catch(o){r.e(o)}finally{r.f()}return null}function Ss(e,t){var r=ee(e),n;try{for(r.s();!(n=r.n()).done;){var i,o=n.value,s=o.byteStride;if(typeof o.byteStride!="number"){var c=ee(o.attributes||[]),a;try{for(c.s();!(a=c.n()).done;){var f=a.value,u=Qe(f.format);s+=u.byteLength}}catch(h){c.e(h)}finally{c.f()}}var l=(i=o.attributes)===null||i===void 0?void 0:i.find(function(h){return h.attribute===t});if(l)return{attributeName:l.attribute,bufferName:o.name,stepMode:o.stepMode,vertexFormat:l.format,byteOffset:l.byteOffset,byteStride:s}}}catch(h){r.e(h)}finally{r.f()}return null}function rt(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}var Ps={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function hn(e){var t=Ps[e];return rt(e),t}function pn(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}var xe;function dn(e){return(!xe||xe.byteLength<e)&&(xe=new ArrayBuffer(e)),xe}var mn=1024,er=function(){function e(r){T(this,e),this.layout={},this.byteLength=void 0;for(var n=0,i=0,o=Object.entries(r);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1],f=hn(a),u=f.type,l=f.components;n=pn(n,l);var h=n;n+=l,this.layout[c]={type:u,size:l,offset:h}}n+=(4-n%4)%4;var v=n*4;this.byteLength=Math.max(v,mn)}var t=e.prototype;return t.getData=function(n){for(var i=Math.max(this.byteLength,mn),o=dn(i),s={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)},c=0,a=Object.entries(n);c<a.length;c++){var f=z(a[c],2),u=f[0],l=f[1],h=this.layout[u];if(!h){q.warn("Supplied uniform value ".concat(u," not present in uniform block layout"))();continue}var v=h.type,m=h.size,y=h.offset,b=s[v];if(m===1){if(typeof l!="number"&&typeof l!="boolean"){q.warn("Supplied value for single component uniform ".concat(u," is not a number: ").concat(l))();continue}b[y]=Number(l)}else{var O=Mt(l);if(!O){q.warn("Supplied value for multi component / array uniform ".concat(u," is not a numeric array: ").concat(l))();continue}b.set(O,y)}}return new Uint8Array(o)},t.has=function(n){return Boolean(this.layout[n])},t.get=function(n){var i=this.layout[n];return i},A(e)}();function gn(e){return Mt(e)!==null||typeof e=="number"||typeof e=="boolean"}function rr(e){var t={bindings:{},uniforms:{}};return Object.keys(e).forEach(function(r){var n=e[r];gn(n)?t.uniforms[r]=n:t.bindings[r]=n}),t}function re(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!re(e[n],t[n],r-1))return!1;return!0}if(Array.isArray(t))return!1;if(tt(e)==="object"&&tt(t)==="object"){var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var s=0,c=i;s<c.length;s++){var a=c[s];if(!t.hasOwnProperty(a)||!re(e[a],t[a],r-1))return!1}return!0}return!1}function nr(e){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function ir(e){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}var vn=function(t){return"".concat(t)};function yn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var As=0,Ts={device:null,onAddHTML:function(){return""},onInitialize:function(){var e=lt(yt.default.mark(function r(){return yt.default.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",null);case 1:case"end":return i.stop()}},r)}));function t(){return e.apply(this,arguments)}return t}(),onRender:function(){},onFinalize:function(){},onError:function(t){return console.error(t)},stats:Dt.stats.get("animation-loop-".concat(As++)),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},be=function(){function e(r){if(T(this,e),this.device=null,this.canvas=null,this.props=void 0,this.animationProps=null,this.timeline=null,this.stats=void 0,this.cpuTime=void 0,this.gpuTime=void 0,this.frameRate=void 0,this.display=void 0,this.needsRedraw="initialized",this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.props=_n(_n({},Ts),r),r=this.props,!r.device)throw new Error("No device provided");var n=this.props.useDevicePixels,i=n===void 0?!0:n;this.stats=r.stats||new Et({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:r.autoResizeViewport,autoResizeDrawingBuffer:r.autoResizeDrawingBuffer,useDevicePixels:i}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}var t=e.prototype;return t.destroy=function(){this.stop(),this._setDisplay(null)},t.delete=function(){this.destroy()},t.setNeedsRedraw=function(n){return this.needsRedraw=this.needsRedraw||n,this},t.setProps=function(n){return"autoResizeViewport"in n&&(this.props.autoResizeViewport=n.autoResizeViewport||!1),"autoResizeDrawingBuffer"in n&&(this.props.autoResizeDrawingBuffer=n.autoResizeDrawingBuffer||!1),"useDevicePixels"in n&&(this.props.useDevicePixels=n.useDevicePixels||!1),this},t.start=function(){var r=lt(yt.default.mark(function i(){var o,s;return yt.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!this._running){a.next=2;break}return a.abrupt("return",this);case 2:if(this._running=!0,a.prev=3,this._running){a.next=6;break}return a.abrupt("return",null);case 6:if(this._initialized){a.next=13;break}return this._initialized=!0,a.next=10,this._initDevice();case 10:return this._initialize(),a.next=13,this.props.onInitialize(this._getAnimationProps());case 13:if(this._running){a.next=15;break}return a.abrupt("return",null);case 15:return o!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),a.abrupt("return",this);case 19:throw a.prev=19,a.t0=a.catch(3),s=a.t0 instanceof Error?a.t0:new Error("Unknown error"),this.props.onError(s),s;case 24:case"end":return a.stop()}},i,this,[[3,19]])}));function n(){return r.apply(this,arguments)}return n}(),t.redraw=function(){var n;return(n=this.device)!==null&&n!==void 0&&n.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)},t.stop=function(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this},t.attachTimeline=function(n){return this.timeline=n,this.timeline},t.detachTimeline=function(){this.timeline=null},t.waitForRender=function(){var n=this;return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(function(i){n._resolveNextFrame=i})),this._nextFramePromise},t.toDataURL=function(){var r=lt(yt.default.mark(function i(){return yt.default.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return this.setNeedsRedraw("toDataURL"),s.next=3,this.waitForRender();case 3:if(!(this.canvas instanceof HTMLCanvasElement)){s.next=5;break}return s.abrupt("return",this.canvas.toDataURL());case 5:throw new Error("OffscreenCanvas");case 6:case"end":return s.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._initialize=function(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._setDisplay=function(n){this.display&&(this.display.destroy(),this.display.animationLoop=null),n&&(n.animationLoop=this),this.display=n},t._requestAnimationFrame=function(){this._running&&(this._animationFrameId=nr(this._animationFrame.bind(this)))},t._cancelAnimationFrame=function(){this._animationFrameId===null&&(ir(this._animationFrameId),this._animationFrameId=null)},t._animationFrame=function(){this._running&&(this.redraw(),this._requestAnimationFrame())},t._renderFrame=function(n){if(this.display){this.display._renderFrame(n);return}this.props.onRender(this._getAnimationProps())},t._clearNeedsRedraw=function(){this.needsRedraw=!1},t._setupFrame=function(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()},t._initializeAnimationProps=function(){var n;if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}},t._getAnimationProps=function(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps},t._updateAnimationProps=function(){if(this.animationProps){var n=this._getSizeAndAspect(),i=n.width,o=n.height,s=n.aspect;(i!==this.animationProps.width||o!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),s!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=i,this.animationProps.height=o,this.animationProps.aspect=s,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}},t._initDevice=function(){var r=lt(yt.default.mark(function i(){var o;return yt.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.props.device;case 2:if(this.device=c.sent,this.device){c.next=5;break}throw new Error("No device provided");case 5:this.canvas=((o=this.device.canvasContext)===null||o===void 0?void 0:o.canvas)||null;case 6:case"end":return c.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),t._createInfoDiv=function(){if(this.canvas&&this.props.onAddHTML){var n=document.createElement("div");document.body.appendChild(n),n.style.position="relative";var i=document.createElement("div");i.style.position="absolute",i.style.left="10px",i.style.bottom="10px",i.style.width="300px",i.style.background="white",this.canvas instanceof HTMLCanvasElement&&n.appendChild(this.canvas),n.appendChild(i);var o=this.props.onAddHTML(i);o&&(i.innerHTML=o)}},t._getSizeAndAspect=function(){var n,i;if(!this.device)return{width:1,height:1,aspect:1};var o=((n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.getPixelSize())||[1,1],s=z(o,2),c=s[0],a=s[1],f=1,u=(i=this.device)===null||i===void 0||(i=i.canvasContext)===null||i===void 0?void 0:i.canvas;return u&&u.clientHeight?f=u.clientWidth/u.clientHeight:c>0&&a>0&&(f=c/a),{width:c,height:a,aspect:f}},t._resizeViewport=function(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)},t._resizeCanvasDrawingBuffer=function(){if(this.props.autoResizeDrawingBuffer){var n;(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0||n.resize({useDevicePixels:this.props.useDevicePixels})}},t._beginFrameTimers=function(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()},t._endFrameTimers=function(){this.cpuTime.timeEnd()},t._startEventHandling=function(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))},t._onMousemove=function(n){n instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[n.offsetX,n.offsetY])},t._onMouseleave=function(n){this._getAnimationProps()._mousePosition=null},A(e)}();var or=pe(Jt(),1);function xn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function On(e,t){var r=this,n=null,i=t?.device||Dt.createDevice(),o=new be(bn(bn({},t),{},{device:i,onInitialize:function(c){return lt(or.default.mark(function a(){var f;return or.default.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=new e(c),l.next=3,(f=n)===null||f===void 0?void 0:f.onInitialize(c);case 3:return l.abrupt("return",l.sent);case 4:case"end":return l.stop()}},a)}))()},onRender:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onRender(c)},onFinalize:function(c){var a;return(a=n)===null||a===void 0?void 0:a.onFinalize(c)}}));return o.getInfo=function(){return r.AnimationLoopTemplateCtor.info},o}function sr(e){if(Array.isArray(e))return Nt(e)}function ar(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
12
12
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e){return sr(e)||ar(e)||$t(e)||cr()}var nt=function(t){return"".concat(t)};function dt(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}function wn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function St(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wn(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var fr={number:{type:"number",validate:function(t,r){return Number.isFinite(t)&&tt(r)==="object"&&(r.max===void 0||t<=r.max)&&(r.min===void 0||t>=r.min)}},array:{type:"array",validate:function(t,r){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function Mn(e){for(var t={},r=0,n=Object.entries(e);r<n.length;r++){var i=z(n[r],2),o=i[0],s=i[1];t[o]=Rs(s)}return t}function Sn(e,t,r){for(var n={},i=0,o=Object.entries(t);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1];e&&c in e&&!a.private?(a.validate&&dt(a.validate(e[c],a),"".concat(r,": invalid ").concat(c)),n[c]=e[c]):n[c]=a.value}return n}function Rs(e){var t=En(e);if(t!=="object")return St(St({value:e},fr[t]),{},{type:t});if(tt(e)==="object")return e?e.type!==void 0?St(St(St({},e),fr[e.type]),{},{type:e.type}):e.value===void 0?{type:"object",value:e}:(t=En(e.value),St(St(St({},e),fr[t]),{},{type:t})):{type:"object",value:null};throw new Error("props")}function En(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":tt(e)}function $(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Pn,An,Tn=nt(Pn||(Pn=$([`#ifdef MODULE_LOGDEPTH
|
|
13
13
|
logdepth_adjustPosition(gl_Position);
|
|
14
14
|
#endif
|
|
@@ -224,7 +224,7 @@ precision highp float;
|
|
|
224
224
|
`),t++;var i=e[n];(i||Number.isFinite(i))&&(r+="#define ".concat(n.toUpperCase()," ").concat(e[n],`
|
|
225
225
|
`))}return t===0&&(r+=`
|
|
226
226
|
`),r}function li(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function hi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?li(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):li(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function di(e,t){if(!t.vs)throw new Error("no vertex shader");var r=pi(e,t.vs),n;return t.fs&&(n=pi(e,t.fs)),hi(hi({},t),{},{vs:r,fs:n})}function pi(e,t){if(typeof t=="string")return t;switch(e.type){case"webgpu":if(t!=null&&t.wgsl)return t.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(t!=null&&t.glsl)return t.glsl;throw new Error("WebGL does not support WGSL shaders")}}function mi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var we=function(){function e(){T(this,e),this._hookFunctions=[],this._defaultModules=[]}e.getDefaultShaderAssembler=function(){return e.defaultShaderAssembler=e.defaultShaderAssembler||new e,e.defaultShaderAssembler};var t=e.prototype;return t.addDefaultModule=function(n){this._defaultModules.find(function(i){return i.name===(typeof n=="string"?n:n.name)})||this._defaultModules.push(n)},t.removeDefaultModule=function(n){var i=typeof n=="string"?n:n.name;this._defaultModules=this._defaultModules.filter(function(o){return o.name!==i})},t.addShaderHook=function(n,i){i&&(n=Object.assign(i,{hook:n})),this._hookFunctions.push(n)},t.assembleShaders=function(n,i){var o=this._getModuleList(i.modules),s=this._hookFunctions,c=di(n,i),a=ui(n,gi(gi({},c),{},{modules:o,hookFunctions:s}));return a},t._getModuleList=function(){for(var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],i=new Array(this._defaultModules.length+n.length),o={},s=0,c=0,a=this._defaultModules.length;c<a;++c){var f=this._defaultModules[c],u=f.name;i[s++]=f,o[u]=!0}for(var l=0,h=n.length;l<h;++l){var v=n[l],m=v.name;o[m]||(i[s++]=v,o[m]=!0)}return i.length=s,i},A(e)}();we.defaultShaderAssembler=void 0;var zh=1/Math.PI*180,kh=1/180*Math.PI,Xs={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Xs}};var et=globalThis.mathgl.config;function vi(e,{precision:t=et.precision}={}){return e=$s(e),"".concat(parseFloat(e.toPrecision(t)))}function Vt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gr(e,t,r){let n=et.EPSILON;r&&(et.EPSILON=r);try{if(e===t)return!0;if(Vt(e)&&Vt(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!gr(e[i],t[i]))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)<=et.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{et.EPSILON=n}}function $s(e){return Math.round(e/et.EPSILON)*et.EPSILON}function Zs(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}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 Ht=class extends Zs(Array){clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Vt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(et)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+vi(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!gr(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let i=0;i<this.ELEMENTS;++i){let o=t[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(et.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 r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),r);return this.check()}get elements(){return this}};function Js(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function it(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function Ee(e,t,r=""){if(et.debug&&!Js(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}function vr(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Me=class extends Ht{get x(){return this[0]}set x(t){this[0]=it(t)}get y(){return this[1]}set y(t){this[1]=it(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-t[n];r+=i*i}return it(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return it(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return vr(t>=0&&t<this.ELEMENTS,"index is out of range"),it(this[t])}setComponent(t,r){return vr(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}};var _t=typeof Float32Array<"u"?Float32Array:Array;var Qh=Math.PI/180;function Qs(){let e=new _t(2);return _t!=Float32Array&&(e[0]=0,e[1]=0),e}function xi(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var tp=function(){let e=Qs();return function(t,r,n,i,o,s){let c,a;for(r||(r=2),n||(n=0),i?a=Math.min(i*r+n,t.length):a=t.length,c=n;c<a;c+=r)e[0]=t[c],e[1]=t[c+1],o(e,e,s),t[c]=e[0],t[c+1]=e[1];return t}}();function bi(e,t,r){let n=t[0],i=t[1],o=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/o,e[1]=(r[1]*n+r[5]*i)/o,e}function Se(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o||1;return e[0]=(r[0]*n+r[4]*i+r[8]*o)/s,e[1]=(r[1]*n+r[5]*i+r[9]*o)/s,e[2]=(r[2]*n+r[6]*i+r[10]*o)/s,e}function Oi(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function ta(){let e=new _t(3);return _t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function ea(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function wi(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[0],c=r[1],a=r[2];return e[0]=i*a-o*c,e[1]=o*s-n*a,e[2]=n*c-i*s,e}function Pe(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,e}function Ei(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=n*r[0]+i*r[3]+o*r[6],e[1]=n*r[1]+i*r[4]+o*r[7],e[2]=n*r[2]+i*r[5]+o*r[8],e}function Mi(e,t,r){let n=r[0],i=r[1],o=r[2],s=r[3],c=t[0],a=t[1],f=t[2],u=i*f-o*a,l=o*c-n*f,h=n*a-i*c,v=i*h-o*l,m=o*u-n*h,y=n*l-i*u,b=s*2;return u*=b,l*=b,h*=b,v*=2,m*=2,y*=2,e[0]=c+u+v,e[1]=a+l+m,e[2]=f+h+y,e}function Si(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Pi(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Ai(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function Ti(e,t){let r=e[0],n=e[1],i=e[2],o=t[0],s=t[1],c=t[2],a=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+c*c)),f=a&&ea(e,t)/a;return Math.acos(Math.min(Math.max(f,-1),1))}var np=function(){let e=ta();return function(t,r,n,i,o,s){let c,a;for(r||(r=3),n||(n=0),i?a=Math.min(i*r+n,t.length):a=t.length,c=n;c<a;c+=r)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],o(e,e,s),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var _r=[0,0,0],Ae,ot=class extends Me{static get ZERO(){return Ae||(Ae=new ot(0,0,0),Object.freeze(Ae)),Ae}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&Vt(t)?this.copy(t):(et.debug&&(it(t),it(r),it(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return et.debug&&(it(t.x),it(t.y),it(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=it(t)}angle(t){return Ti(this,t)}cross(t){return wi(this,this,t),this.check()}rotateX({radians:t,origin:r=_r}){return Si(this,this,r,t),this.check()}rotateY({radians:t,origin:r=_r}){return Pi(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=_r}){return Ai(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Pe(this,this,t),this.check()}transformAsVector(t){return Se(this,this,t),this.check()}transformByMatrix3(t){return Ei(this,this,t),this.check()}transformByMatrix2(t){return Oi(this,this,t),this.check()}transformByQuaternion(t){return Mi(this,this,t),this.check()}};var Te=class extends Ht{toString(){let t="[";if(et.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=" ".concat(this[n*this.RANK+r])}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=" ".concat(this[r])}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=it(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function ra(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 Ri(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],o=t[6],s=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=s,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 Ci(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],c=t[5],a=t[6],f=t[7],u=t[8],l=t[9],h=t[10],v=t[11],m=t[12],y=t[13],b=t[14],O=t[15],R=r*c-n*s,x=r*a-i*s,S=r*f-o*s,w=n*a-i*c,M=n*f-o*c,j=i*f-o*a,N=u*y-l*m,U=u*b-h*m,C=u*O-v*m,g=l*b-h*y,p=l*O-v*y,d=h*O-v*b,_=R*d-x*p+S*g+w*C-M*U+j*N;return _?(_=1/_,e[0]=(c*d-a*p+f*g)*_,e[1]=(i*p-n*d-o*g)*_,e[2]=(y*j-b*M+O*w)*_,e[3]=(h*M-l*j-v*w)*_,e[4]=(a*C-s*d-f*U)*_,e[5]=(r*d-i*C+o*U)*_,e[6]=(b*S-m*j-O*x)*_,e[7]=(u*j-h*S+v*x)*_,e[8]=(s*p-c*C+f*N)*_,e[9]=(n*C-r*p-o*N)*_,e[10]=(m*M-y*S+O*R)*_,e[11]=(l*S-u*M-v*R)*_,e[12]=(c*U-s*g-a*N)*_,e[13]=(r*g-n*U+i*N)*_,e[14]=(y*x-m*w-b*R)*_,e[15]=(u*w-l*x+h*R)*_,e):null}function Li(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],c=e[6],a=e[7],f=e[8],u=e[9],l=e[10],h=e[11],v=e[12],m=e[13],y=e[14],b=e[15],O=t*s-r*o,R=t*c-n*o,x=r*c-n*s,S=f*m-u*v,w=f*y-l*v,M=u*y-l*m,j=t*M-r*w+n*S,N=o*M-s*w+c*S,U=f*x-u*R+l*O,C=v*x-m*R+y*O;return a*j-i*N+b*U-h*C}function xr(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],c=t[4],a=t[5],f=t[6],u=t[7],l=t[8],h=t[9],v=t[10],m=t[11],y=t[12],b=t[13],O=t[14],R=t[15],x=r[0],S=r[1],w=r[2],M=r[3];return e[0]=x*n+S*c+w*l+M*y,e[1]=x*i+S*a+w*h+M*b,e[2]=x*o+S*f+w*v+M*O,e[3]=x*s+S*u+w*m+M*R,x=r[4],S=r[5],w=r[6],M=r[7],e[4]=x*n+S*c+w*l+M*y,e[5]=x*i+S*a+w*h+M*b,e[6]=x*o+S*f+w*v+M*O,e[7]=x*s+S*u+w*m+M*R,x=r[8],S=r[9],w=r[10],M=r[11],e[8]=x*n+S*c+w*l+M*y,e[9]=x*i+S*a+w*h+M*b,e[10]=x*o+S*f+w*v+M*O,e[11]=x*s+S*u+w*m+M*R,x=r[12],S=r[13],w=r[14],M=r[15],e[12]=x*n+S*c+w*l+M*y,e[13]=x*i+S*a+w*h+M*b,e[14]=x*o+S*f+w*v+M*O,e[15]=x*s+S*u+w*m+M*R,e}function Di(e,t,r){let n=r[0],i=r[1],o=r[2],s,c,a,f,u,l,h,v,m,y,b,O;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(s=t[0],c=t[1],a=t[2],f=t[3],u=t[4],l=t[5],h=t[6],v=t[7],m=t[8],y=t[9],b=t[10],O=t[11],e[0]=s,e[1]=c,e[2]=a,e[3]=f,e[4]=u,e[5]=l,e[6]=h,e[7]=v,e[8]=m,e[9]=y,e[10]=b,e[11]=O,e[12]=s*n+u*i+m*o+t[12],e[13]=c*n+l*i+y*o+t[13],e[14]=a*n+h*i+b*o+t[14],e[15]=f*n+v*i+O*o+t[15]),e}function Ii(e,t,r){let n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,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 Ni(e,t,r,n){let i=n[0],o=n[1],s=n[2],c=Math.sqrt(i*i+o*o+s*s),a,f,u,l,h,v,m,y,b,O,R,x,S,w,M,j,N,U,C,g,p,d,_,E;return c<1e-6?null:(c=1/c,i*=c,o*=c,s*=c,f=Math.sin(r),a=Math.cos(r),u=1-a,l=t[0],h=t[1],v=t[2],m=t[3],y=t[4],b=t[5],O=t[6],R=t[7],x=t[8],S=t[9],w=t[10],M=t[11],j=i*i*u+a,N=o*i*u+s*f,U=s*i*u-o*f,C=i*o*u-s*f,g=o*o*u+a,p=s*o*u+i*f,d=i*s*u+o*f,_=o*s*u-i*f,E=s*s*u+a,e[0]=l*j+y*N+x*U,e[1]=h*j+b*N+S*U,e[2]=v*j+O*N+w*U,e[3]=m*j+R*N+M*U,e[4]=l*C+y*g+x*p,e[5]=h*C+b*g+S*p,e[6]=v*C+O*g+w*p,e[7]=m*C+R*g+M*p,e[8]=l*d+y*_+x*E,e[9]=h*d+b*_+S*E,e[10]=v*d+O*_+w*E,e[11]=m*d+R*_+M*E,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ji(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[4],s=t[5],c=t[6],a=t[7],f=t[8],u=t[9],l=t[10],h=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*i+f*n,e[5]=s*i+u*n,e[6]=c*i+l*n,e[7]=a*i+h*n,e[8]=f*i-o*n,e[9]=u*i-s*n,e[10]=l*i-c*n,e[11]=h*i-a*n,e}function Fi(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],c=t[2],a=t[3],f=t[8],u=t[9],l=t[10],h=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*i-f*n,e[1]=s*i-u*n,e[2]=c*i-l*n,e[3]=a*i-h*n,e[8]=o*n+f*i,e[9]=s*n+u*i,e[10]=c*n+l*i,e[11]=a*n+h*i,e}function Ui(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],c=t[2],a=t[3],f=t[4],u=t[5],l=t[6],h=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*i+f*n,e[1]=s*i+u*n,e[2]=c*i+l*n,e[3]=a*i+h*n,e[4]=f*i-o*n,e[5]=u*i-s*n,e[6]=l*i-c*n,e[7]=h*i-a*n,e}function Gi(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,c=n+n,a=i+i,f=r*s,u=n*s,l=n*c,h=i*s,v=i*c,m=i*a,y=o*s,b=o*c,O=o*a;return e[0]=1-l-m,e[1]=u+O,e[2]=h-b,e[3]=0,e[4]=u-O,e[5]=1-f-m,e[6]=v+y,e[7]=0,e[8]=h+b,e[9]=v-y,e[10]=1-f-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Bi(e,t,r,n,i,o,s){let c=1/(r-t),a=1/(i-n),f=1/(o-s);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]=(r+t)*c,e[9]=(i+n)*a,e[10]=(s+o)*f,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*f,e[15]=0,e}function na(e,t,r,n,i){let o=1/Math.tan(t/2);if(e[0]=o/r,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,i!=null&&i!==1/0){let s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e}var zi=na;function ia(e,t,r,n,i,o,s){let c=1/(t-r),a=1/(n-i),f=1/(o-s);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+r)*c,e[13]=(i+n)*a,e[14]=(s+o)*f,e[15]=1,e}var ki=ia;function Vi(e,t,r,n){let i,o,s,c,a,f,u,l,h,v,m=t[0],y=t[1],b=t[2],O=n[0],R=n[1],x=n[2],S=r[0],w=r[1],M=r[2];return Math.abs(m-S)<1e-6&&Math.abs(y-w)<1e-6&&Math.abs(b-M)<1e-6?ra(e):(l=m-S,h=y-w,v=b-M,i=1/Math.sqrt(l*l+h*h+v*v),l*=i,h*=i,v*=i,o=R*v-x*h,s=x*l-O*v,c=O*h-R*l,i=Math.sqrt(o*o+s*s+c*c),i?(i=1/i,o*=i,s*=i,c*=i):(o=0,s=0,c=0),a=h*c-v*s,f=v*o-l*c,u=l*s-h*o,i=Math.sqrt(a*a+f*f+u*u),i?(i=1/i,a*=i,f*=i,u*=i):(a=0,f=0,u=0),e[0]=o,e[1]=a,e[2]=l,e[3]=0,e[4]=s,e[5]=f,e[6]=h,e[7]=0,e[8]=c,e[9]=u,e[10]=v,e[11]=0,e[12]=-(o*m+s*y+c*b),e[13]=-(a*m+f*y+u*b),e[14]=-(l*m+h*y+v*b),e[15]=1,e)}function oa(){let e=new _t(4);return _t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Hi(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}var gp=function(){let e=oa();return function(t,r,n,i,o,s){let c,a;for(r||(r=4),n||(n=0),i?a=Math.min(i*r+n,t.length):a=t.length,c=n;c<a;c+=r)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],o(e,e,s),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var wr;(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"})(wr||(wr={}));var sa=45*Math.PI/180,aa=1,br=.1,Or=500,ca=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),mt=class extends Te{static get IDENTITY(){return ua()}static get ZERO(){return fa()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return wr}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,r,n,i,o,s,c,a,f,u,l,h,v,m,y,b){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=c,this[7]=a,this[8]=f,this[9]=u,this[10]=l,this[11]=h,this[12]=v,this[13]=m,this[14]=y,this[15]=b,this.check()}setRowMajor(t,r,n,i,o,s,c,a,f,u,l,h,v,m,y,b){return this[0]=t,this[1]=o,this[2]=f,this[3]=v,this[4]=r,this[5]=s,this[6]=u,this[7]=m,this[8]=n,this[9]=c,this[10]=l,this[11]=y,this[12]=i,this[13]=a,this[14]=h,this[15]=b,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(ca)}fromObject(t){return this.check()}fromQuaternion(t){return Gi(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:i,top:o,near:s=br,far:c=Or}=t;return c===1/0?la(this,r,n,i,o,s):Bi(this,r,n,i,o,s,c),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return Vi(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:o,near:s=br,far:c=Or}=t;return ki(this,r,n,i,o,s,c),this.check()}orthographic(t){let{fovy:r=sa,aspect:n=aa,focalDistance:i=1,near:o=br,far:s=Or}=t;qi(r);let c=r/2,a=i*Math.tan(c),f=a*n;return this.ortho({left:-f,right:f,bottom:-a,top:a,near:o,far:s})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=t;return qi(r),zi(this,r,n,i,o),this.check()}determinant(){return Li(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,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*o,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*o,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=this[4]*i,t[4]=this[5]*o,t[5]=this[6]*s,t[6]=this[8]*i,t[7]=this[9]*o,t[8]=this[10]*s,t}transpose(){return Ri(this,this),this.check()}invert(){return Ci(this,this),this.check()}multiplyLeft(t){return xr(this,t,this),this.check()}multiplyRight(t){return xr(this,this,t),this.check()}rotateX(t){return ji(this,this,t),this.check()}rotateY(t){return Fi(this,this,t),this.check()}rotateZ(t){return Ui(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return Ni(this,this,t,r),this.check()}scale(t){return Ii(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Di(this,this,t),this.check()}transform(t,r){return t.length===4?(r=Hi(r||[-0,-0,-0,-0],t,this),Ee(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=xi(r||[-0,-0],t,this);break;case 3:i=Pe(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=bi(r||[-0,-0],t,this);break;case 3:n=Se(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},Re,Ce;function fa(){return Re||(Re=new mt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Re)),Re}function ua(){return Ce||(Ce=new mt,Object.freeze(Ce)),Ce}function qi(e){if(e>Math.PI*2)throw Error("expected radians")}function la(e,t,r,n,i,o){let s=2*o/(r-t),c=2*o/(i-n),a=(r+t)/(r-t),f=(i+n)/(i-n),u=-1,l=-1,h=-2*o;return e[0]=s,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]=u,e[11]=l,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}var Le=function(){function e(r){T(this,e),this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=r.id||H("geometry"),this.topology=r.topology,this.indices=r.indices||null,this.attributes=r.attributes,this.vertexCount=r.vertexCount,this.bufferLayout=r.bufferLayout||[],this.indices&&rt(this.indices.usage===X.INDEX)}var t=e.prototype;return t.destroy=function(){var n;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(n=this.attributes.colors)===null||n===void 0||n.destroy()},t.getVertexCount=function(){return this.vertexCount},t.getAttributes=function(){return this.attributes},t.getIndexes=function(){return this.indices},t._calculateVertexCount=function(n){var i=n.byteLength/12;return i},A(e)}();function Wi(e,t){if(t instanceof Le)return t;var r=ha(e,t),n=pa(e,t),i=n.attributes,o=n.bufferLayout;return new Le({topology:t.topology||"triangle-list",bufferLayout:o,vertexCount:t.vertexCount,indices:r,attributes:i})}function ha(e,t){if(t.indices){var r=t.indices.value;return e.createBuffer({usage:X.INDEX,data:r})}}function pa(e,t){for(var r=[],n={},i=0,o=Object.entries(t.attributes);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1],f=c;switch(c){case"POSITION":f="positions";break;case"NORMAL":f="normals";break;case"TEXCOORD_0":f="texCoords";break}n[f]=e.createBuffer({data:a.value,id:"".concat(c,"-buffer")}),r.push({name:f,format:"float32x".concat(a.size)})}var u=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:u}}function Ki(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ki(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ki(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var se=function(){e.getDefaultPipelineFactory=function(n){return n._lumaData.defaultPipelineFactory=n._lumaData.defaultPipelineFactory||new e(n),n._lumaData.defaultPipelineFactory};function e(r){T(this,e),this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=r}var t=e.prototype;return t.createRenderPipeline=function(n){var i=xt(xt({},e.defaultProps),n),o=this._hashRenderPipeline(xt({},i));if(!this._pipelineCache[o]){var s=this.device.createRenderPipeline(xt(xt({},i),{},{vs:this.device.createShader({stage:"vertex",source:i.vs}),fs:i.fs?this.device.createShader({stage:"fragment",source:i.fs}):null}));s.hash=o,this._pipelineCache[o]=s,this._useCounts[o]=0}return this._useCounts[o]++,this._pipelineCache[o]},t.release=function(n){var i=n.hash;this._useCounts[i]--,this._useCounts[i]===0&&(this._pipelineCache[i].destroy(),delete this._pipelineCache[i],delete this._useCounts[i])},t._createRenderPipeline=function(n){if(!n.fs)throw new Error("fs");var i=this.device.createRenderPipeline(xt(xt({},n),{},{vs:this.device.createShader({stage:"vertex",source:n.vs}),fs:n.fs?this.device.createShader({stage:"fragment",source:n.fs}):null}));return i},t._hashRenderPipeline=function(n){var i=this._getHash(n.vs),o=n.fs?this._getHash(n.fs):0,s="-";switch(this.device.info.type){case"webgpu":var c=this._getHash(JSON.stringify(n.parameters)),a=this._getHash(JSON.stringify(n.bufferLayout));return"".concat(i,"/").concat(o,"V").concat(s,"T").concat(n.topology,"P").concat(c,"BL").concat(a,"}");default:return"".concat(i,"/").concat(o,"V").concat(s)}},t._getHash=function(n){return this._hashes[n]===void 0&&(this._hashes[n]=this._hashCounter++),this._hashes[n]},A(e)}();se.defaultProps=xt(xt({},zt.defaultProps),{},{vs:void 0,fs:void 0});function Zi(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=da(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
227
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function da(e,t){if(e){if(typeof e=="string")return Yi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yi(e,t)}}function Yi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Wt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ae=function(){function e(r,n){T(this,e),this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.pipeline=void 0,this.vertexArray=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this.props=Wt(Wt({},e.defaultProps),n),n=this.props,this.id=n.id||H("model"),this.device=r,Object.assign(this.userData,n.userData);var i={type:r.info.type,shaderLanguage:r.info.shadingLanguages[0],gpu:r.info.gpu,features:r.features},o=this.props.shaderAssembler.assembleShaders(i,this.props),s=o.vs,c=o.fs,a=o.getUniforms;if(this.vs=s,this.fs=c,this._getModuleUniforms=a,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,n.geometry&&(this._gpuGeometry=this.setGeometry(n.geometry)),this.pipelineFactory=n.pipelineFactory||se.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=r.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),n.vertexCount&&this.setVertexCount(n.vertexCount),n.instanceCount&&this.setInstanceCount(n.instanceCount),n.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");n.indexBuffer&&this.setIndexBuffer(n.indexBuffer),n.attributes&&this.setAttributes(n.attributes),n.constantAttributes&&this.setConstantAttributes(n.constantAttributes),n.bindings&&this.setBindings(n.bindings),n.uniforms&&this.setUniforms(n.uniforms),n.moduleSettings&&this.updateModuleSettings(n.moduleSettings),this.setUniforms(this._getModuleUniforms()),Object.seal(this)}var t=e.prototype;return t.destroy=function(){this.pipelineFactory.release(this.pipeline)},t.draw=function(n){this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:n,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount})},t.setGeometry=function(n){var i=n&&Wi(this.device,n);return this.setTopology(i.topology||"triangle-list"),this.bufferLayout=$i(this.bufferLayout,i.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i),i},t._setGeometryAttributes=function(n){this.vertexCount=n.vertexCount,this.setAttributes(n.attributes),this.setIndexBuffer(n.indices)},t.setTopology=function(n){n!==this.topology&&(this.topology=n,this._setPipelineNeedsUpdate("topology"))},t.setBufferLayout=function(n){this.bufferLayout=this._gpuGeometry?$i(n,this._gpuGeometry.bufferLayout):n,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)},t.setParameters=function(n){re(n,this.parameters,2)||(this.parameters=n,this._setPipelineNeedsUpdate("parameters"))},t.setVertexCount=function(n){this.vertexCount=n},t.setInstanceCount=function(n){this.instanceCount=n},t.setShaderModuleProps=function(n){var i=rr(this._getModuleUniforms(n)),o=i.bindings,s=i.uniforms;Object.assign(this.bindings,o),Object.assign(this.uniforms,s)},t.updateModuleSettings=function(n){this.setShaderModuleProps(n)},t.setBindings=function(n){Object.assign(this.bindings,n)},t.setUniforms=function(n){this.pipeline.setUniforms(n),Object.assign(this.uniforms,n)},t.setIndexBuffer=function(n){this.vertexArray.setIndexBuffer(n)},t.setAttributes=function(n){var i=this;n.indices&&K.warn("Model:".concat(this.id," setAttributes() - indexBuffer should be set using setIndexBuffer()"));for(var o=function(){var u,l=z(c[s],2),h=l[0],v=l[1],m=i.bufferLayout.find(function(w){return w.name===h});if(!m)return"continue";var y=m.attributes?(u=m.attributes)===null||u===void 0?void 0:u.map(function(w){return w.attribute}):[m.name],b=!1,O=Zi(y),R;try{for(O.s();!(R=O.n()).done;){var x=R.value,S=i._attributeInfos[x];S&&(i.vertexArray.setBuffer(S.location,v),b=!0)}}catch(w){O.e(w)}finally{O.f()}b||K.warn("Model(".concat(i.id,'): Ignoring buffer "').concat(v.id,'" for unknown attribute "').concat(h,'"'))()},s=0,c=Object.entries(n);s<c.length;s++)var a=o()},t.setConstantAttributes=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1],f=this._attributeInfos[c];f?this.vertexArray.setConstant(f.location,a):K.warn('Model "'.concat(this.id,': Ignoring constant supplied for unknown attribute "').concat(c,'"'))()}},t._setPipelineNeedsUpdate=function(n){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||n},t._updatePipeline=function(){return this._pipelineNeedsUpdate&&(this.pipeline&&K.log(1,"Model ".concat(this.id,': Recreating pipeline because "').concat(this._pipelineNeedsUpdate,'".'))(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline(Wt(Wt({},this.props),{},{bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null})),this._attributeInfos=tr(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline},A(e)}();ae.defaultProps=Wt(Wt({},zt.defaultProps),{},{vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:{},geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},pipelineFactory:void 0,shaderAssembler:we.getDefaultShaderAssembler()});function $i(e,t){var r=ne(e),n=Zi(t),i;try{var o=function(){var c=i.value,a=r.findIndex(function(f){return f.name===c.name});a<0?r.push(c):r[a]=c};for(n.s();!(i=n.n()).done;)o()}catch(s){n.e(s)}finally{n.f()}return r}function Ji(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Qi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ji(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ji(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var to=function(){e.isSupported=function(n){return!1};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,e),this.device=void 0,this.gl=void 0,this.elementCount=0,this.elementIDBuffer=null}var t=e.prototype;return t.destroy=function(){},t.delete=function(){this.destroy()},t.run=function(n){var i=n||{},o=i.clearRenderTarget,s=o===void 0?!0:o,c=this._updateDrawOptions(n);s&&c.framebuffer},t.swap=function(){},t.getBuffer=function(n){return null},t.getData=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}},t.getFramebuffer=function(){return null},t.update=function(n){},t._updateModelProps=function(n){var i=Qi({},n);return i},t._buildResourceTransforms=function(n){},t._updateDrawOptions=function(n){var i=Qi({},n);return i},A(e)}();var eo=function(){function e(r){T(this,e),this.device=void 0,this.shaderModule=void 0,this.useUniformBuffers=void 0,this.uniformBufferLayout=void 0,this.uniformBuffer=null,this.uniforms={},this.modifiedUniforms={},this.modified=!0,this.needsRedraw="initialized",this.device=r.device,this.shaderModule=r.shaderModule,this.useUniformBuffers=this.device.info.type!=="webgl";for(var n={},i=0,o=Object.entries(r.shaderModule.uniformPropTypes||{});i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1].format;n[c]=a}this.uniformBufferLayout=new er(n),this.useUniformBuffers&&(this.uniformBuffer=this.device.createBuffer({usage:X.UNIFORM,byteLength:this.uniformBufferLayout.byteLength}))}var t=e.prototype;return t.setUniforms=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1];this._setUniform(c,a),this.setNeedsRedraw(c)}},t.setNeedsRedraw=function(n){this.needsRedraw=this.needsRedraw||n},t.getUniformBuffer=function(){if(this.needsRedraw){var n=this.getModifiedUniforms(),i=this.uniformBufferLayout.getData(n);this.uniformBuffer.write(i)}return this.uniformBuffer},t.getUniforms=function(n){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms[n]||{}},t.getModifiedUniforms=function(){var n=this.modifiedUniforms;return this.modifiedUniforms={},this.needsRedraw=!1,n},t._setUniform=function(n,i){ma(this.uniforms[n],i)||(this.uniforms[n]=i,this.modifiedUniforms[n]=!0,this.modified=!0)},A(e)}();function ma(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16;if(e!==t)return!1;var n=Mt(e);if(!n)return!1;var i=Mt(t);if(i&&n.length===i.length){for(var o=0;o<n.length;++o)if(i[o]!==n[o])return!1}return!0}function ro(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ga(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ro(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ro(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var st=function(){function e(r){T(this,e),this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};var n=r.attributes,i=n===void 0?{}:n,o=r.indices,s=o===void 0?null:o,c=r.vertexCount,a=c===void 0?null:c;this.id=r.id||H("geometry"),this.topology=r.topology,s&&(this.indices=ArrayBuffer.isView(s)?{value:s,size:1}:s),this.attributes={};for(var f=0,u=Object.entries(i);f<u.length;f++){var l=z(u[f],2),h=l[0],v=l[1],m=ArrayBuffer.isView(v)?{value:v}:v;rt(ArrayBuffer.isView(m.value),"".concat(this._print(h),": must be typed array or object with value as typed array")),(h==="POSITION"||h==="positions")&&!m.size&&(m.size=3),h==="indices"?(rt(!this.indices),this.indices=m):this.attributes[h]=m}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}var t=e.prototype;return t.getVertexCount=function(){return this.vertexCount},t.getAttributes=function(){return this.indices?ga({indices:this.indices},this.attributes):this.attributes},t._print=function(n){return"Geometry ".concat(this.id," attribute ").concat(n)},t._setAttributes=function(n,i){return this},t._calculateVertexCount=function(n,i){if(i)return i.value.length;for(var o=1/0,s=0,c=Object.values(n);s<c.length;s++){var a=c[s],f=a.value,u=a.size,l=a.constant;!l&&f&&u>=1&&(o=Math.min(o,f.length/u))}return rt(Number.isFinite(o)),o},A(e)}();var no;function io(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function oo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?io(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):io(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function va(e){var t=ya();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function ya(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var _a=vn(no||(no=$([`attribute vec2 aClipSpacePosition;
|
|
227
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function da(e,t){if(e){if(typeof e=="string")return Yi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yi(e,t)}}function Yi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Wt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xi(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ae=function(){function e(r,n){T(this,e),this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.pipeline=void 0,this.vertexArray=void 0,this.transformFeedback=null,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this.props=Wt(Wt({},e.defaultProps),n),n=this.props,this.id=n.id||H("model"),this.device=r,Object.assign(this.userData,n.userData);var i={type:r.info.type,shaderLanguage:r.info.shadingLanguages[0],gpu:r.info.gpu,features:r.features},o=this.props.shaderAssembler.assembleShaders(i,this.props),s=o.vs,c=o.fs,a=o.getUniforms;if(this.vs=s,this.fs=c,this._getModuleUniforms=a,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,n.geometry&&(this._gpuGeometry=this.setGeometry(n.geometry)),this.pipelineFactory=n.pipelineFactory||se.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=r.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),n.vertexCount&&this.setVertexCount(n.vertexCount),n.instanceCount&&this.setInstanceCount(n.instanceCount),n.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");n.indexBuffer&&this.setIndexBuffer(n.indexBuffer),n.attributes&&this.setAttributes(n.attributes),n.constantAttributes&&this.setConstantAttributes(n.constantAttributes),n.bindings&&this.setBindings(n.bindings),n.uniforms&&this.setUniforms(n.uniforms),n.moduleSettings&&this.updateModuleSettings(n.moduleSettings),n.transformFeedback&&(this.transformFeedback=n.transformFeedback),this.setUniforms(this._getModuleUniforms()),Object.seal(this)}var t=e.prototype;return t.destroy=function(){this.pipelineFactory.release(this.pipeline)},t.draw=function(n){this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:n,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,transformFeedback:this.transformFeedback})},t.setGeometry=function(n){var i=n&&Wi(this.device,n);return this.setTopology(i.topology||"triangle-list"),this.bufferLayout=$i(this.bufferLayout,i.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i),i},t._setGeometryAttributes=function(n){this.vertexCount=n.vertexCount,this.setAttributes(n.attributes),this.setIndexBuffer(n.indices)},t.setTopology=function(n){n!==this.topology&&(this.topology=n,this._setPipelineNeedsUpdate("topology"))},t.setBufferLayout=function(n){this.bufferLayout=this._gpuGeometry?$i(n,this._gpuGeometry.bufferLayout):n,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)},t.setParameters=function(n){re(n,this.parameters,2)||(this.parameters=n,this._setPipelineNeedsUpdate("parameters"))},t.setVertexCount=function(n){this.vertexCount=n},t.setInstanceCount=function(n){this.instanceCount=n},t.setShaderModuleProps=function(n){var i=rr(this._getModuleUniforms(n)),o=i.bindings,s=i.uniforms;Object.assign(this.bindings,o),Object.assign(this.uniforms,s)},t.setTransformFeedback=function(n){this.transformFeedback=n},t.updateModuleSettings=function(n){this.setShaderModuleProps(n)},t.setBindings=function(n){Object.assign(this.bindings,n)},t.setUniforms=function(n){this.pipeline.setUniforms(n),Object.assign(this.uniforms,n)},t.setIndexBuffer=function(n){this.vertexArray.setIndexBuffer(n)},t.setAttributes=function(n){var i=this;n.indices&&q.warn("Model:".concat(this.id," setAttributes() - indexBuffer should be set using setIndexBuffer()"));for(var o=function(){var u,l=z(c[s],2),h=l[0],v=l[1],m=i.bufferLayout.find(function(w){return w.name===h});if(!m)return q.warn("Model(".concat(i.id,'): Missing layout for buffer "').concat(h,'".'))(),"continue";var y=m.attributes?(u=m.attributes)===null||u===void 0?void 0:u.map(function(w){return w.attribute}):[m.name],b=!1,O=Zi(y),R;try{for(O.s();!(R=O.n()).done;){var x=R.value,S=i._attributeInfos[x];S&&(i.vertexArray.setBuffer(S.location,v),b=!0)}}catch(w){O.e(w)}finally{O.f()}b||q.warn("Model(".concat(i.id,'): Ignoring buffer "').concat(v.id,'" for unknown attribute "').concat(h,'"'))()},s=0,c=Object.entries(n);s<c.length;s++)var a=o()},t.setConstantAttributes=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1],f=this._attributeInfos[c];f?this.vertexArray.setConstant(f.location,a):q.warn('Model "'.concat(this.id,': Ignoring constant supplied for unknown attribute "').concat(c,'"'))()}},t._setPipelineNeedsUpdate=function(n){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||n},t._updatePipeline=function(){return this._pipelineNeedsUpdate&&(this.pipeline&&q.log(1,"Model ".concat(this.id,': Recreating pipeline because "').concat(this._pipelineNeedsUpdate,'".'))(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline(Wt(Wt({},this.props),{},{bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null})),this._attributeInfos=tr(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline},A(e)}();ae.defaultProps=Wt(Wt({},zt.defaultProps),{},{vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:{},geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:we.getDefaultShaderAssembler()});function $i(e,t){var r=ne(e),n=Zi(t),i;try{var o=function(){var c=i.value,a=r.findIndex(function(f){return f.name===c.name});a<0?r.push(c):r[a]=c};for(n.s();!(i=n.n()).done;)o()}catch(s){n.e(s)}finally{n.f()}return r}function Ji(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Qi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ji(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ji(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var to=function(){e.isSupported=function(n){return!1};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};T(this,e),this.device=void 0,this.gl=void 0,this.elementCount=0,this.elementIDBuffer=null}var t=e.prototype;return t.destroy=function(){},t.delete=function(){this.destroy()},t.run=function(n){var i=n||{},o=i.clearRenderTarget,s=o===void 0?!0:o,c=this._updateDrawOptions(n);s&&c.framebuffer},t.swap=function(){},t.getBuffer=function(n){return null},t.getData=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}},t.getFramebuffer=function(){return null},t.update=function(n){},t._updateModelProps=function(n){var i=Qi({},n);return i},t._buildResourceTransforms=function(n){},t._updateDrawOptions=function(n){var i=Qi({},n);return i},A(e)}();var eo=function(){function e(r){T(this,e),this.device=void 0,this.shaderModule=void 0,this.useUniformBuffers=void 0,this.uniformBufferLayout=void 0,this.uniformBuffer=null,this.uniforms={},this.modifiedUniforms={},this.modified=!0,this.needsRedraw="initialized",this.device=r.device,this.shaderModule=r.shaderModule,this.useUniformBuffers=this.device.info.type!=="webgl";for(var n={},i=0,o=Object.entries(r.shaderModule.uniformPropTypes||{});i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1].format;n[c]=a}this.uniformBufferLayout=new er(n),this.useUniformBuffers&&(this.uniformBuffer=this.device.createBuffer({usage:X.UNIFORM,byteLength:this.uniformBufferLayout.byteLength}))}var t=e.prototype;return t.setUniforms=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var s=z(o[i],2),c=s[0],a=s[1];this._setUniform(c,a),this.setNeedsRedraw(c)}},t.setNeedsRedraw=function(n){this.needsRedraw=this.needsRedraw||n},t.getUniformBuffer=function(){if(this.needsRedraw){var n=this.getModifiedUniforms(),i=this.uniformBufferLayout.getData(n);this.uniformBuffer.write(i)}return this.uniformBuffer},t.getUniforms=function(n){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms[n]||{}},t.getModifiedUniforms=function(){var n=this.modifiedUniforms;return this.modifiedUniforms={},this.needsRedraw=!1,n},t._setUniform=function(n,i){ma(this.uniforms[n],i)||(this.uniforms[n]=i,this.modifiedUniforms[n]=!0,this.modified=!0)},A(e)}();function ma(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16;if(e!==t)return!1;var n=Mt(e);if(!n)return!1;var i=Mt(t);if(i&&n.length===i.length){for(var o=0;o<n.length;++o)if(i[o]!==n[o])return!1}return!0}function ro(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ga(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ro(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ro(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var st=function(){function e(r){T(this,e),this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};var n=r.attributes,i=n===void 0?{}:n,o=r.indices,s=o===void 0?null:o,c=r.vertexCount,a=c===void 0?null:c;this.id=r.id||H("geometry"),this.topology=r.topology,s&&(this.indices=ArrayBuffer.isView(s)?{value:s,size:1}:s),this.attributes={};for(var f=0,u=Object.entries(i);f<u.length;f++){var l=z(u[f],2),h=l[0],v=l[1],m=ArrayBuffer.isView(v)?{value:v}:v;rt(ArrayBuffer.isView(m.value),"".concat(this._print(h),": must be typed array or object with value as typed array")),(h==="POSITION"||h==="positions")&&!m.size&&(m.size=3),h==="indices"?(rt(!this.indices),this.indices=m):this.attributes[h]=m}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}var t=e.prototype;return t.getVertexCount=function(){return this.vertexCount},t.getAttributes=function(){return this.indices?ga({indices:this.indices},this.attributes):this.attributes},t._print=function(n){return"Geometry ".concat(this.id," attribute ").concat(n)},t._setAttributes=function(n,i){return this},t._calculateVertexCount=function(n,i){if(i)return i.value.length;for(var o=1/0,s=0,c=Object.values(n);s<c.length;s++){var a=c[s],f=a.value,u=a.size,l=a.constant;!l&&f&&u>=1&&(o=Math.min(o,f.length/u))}return rt(Number.isFinite(o)),o},A(e)}();var no;function io(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function oo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?io(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):io(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function va(e){var t=ya();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function ya(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var _a=vn(no||(no=$([`attribute vec2 aClipSpacePosition;
|
|
228
228
|
attribute vec2 aTexCoord;
|
|
229
229
|
attribute vec2 aCoordinate;
|
|
230
230
|
|
|
@@ -253,8 +253,8 @@ void main(void) {
|
|
|
253
253
|
coordinate = aCoordinate;
|
|
254
254
|
uv = aTexCoord;
|
|
255
255
|
}
|
|
256
|
-
`]))),so=[-1,-1,1,-1,-1,1,1,1],ao=function(e){
|
|
257
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function ba(e,t){if(e){if(typeof e=="string")return co(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return co(e,t)}}function co(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Oa(e){var t=wa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function wa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var fo=function(e){q(r,e);var t=Oa(r);function r(){var i,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r),o=Array.isArray(o)?{children:o}:o;var s=o,c=s.children,a=c===void 0?[]:c;return K.assert(a.every(function(f){return f instanceof It}),"every child must an instance of ScenegraphNode"),i=t.call(this,o),i.children=void 0,i.children=a,i}var n=r.prototype;return n.getBounds=function(){var o=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse(function(s,c){var a=c.worldMatrix,f=s.getBounds();if(f){var u=z(f,2),l=u[0],h=u[1],v=new ot(l).add(h).divide([2,2,2]);a.transformAsPoint(v,v);var m=new ot(h).subtract(l).divide([2,2,2]);a.transformAsVector(m,m);for(var y=0;y<8;y++)for(var b=new ot(y&1?-1:1,y&2?-1:1,y&4?-1:1).multiply(m).add(v),O=0;O<3;O++)o[0][O]=Math.min(o[0][O],b[O]),o[1][O]=Math.max(o[1][O],b[O])}}),Number.isFinite(o[0][0])?o:null},n.destroy=function(){this.children.forEach(function(o){return o.destroy()}),this.removeAll(),Kt(F(r.prototype),"destroy",this).call(this)},n.add=function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];for(var a=0,f=s;a<f.length;a++){var u=f[a];Array.isArray(u)?this.add.apply(this,ne(u)):this.children.push(u)}return this},n.remove=function(o){var s=this.children,c=s.indexOf(o);return c>-1&&s.splice(c,1),this},n.removeAll=function(){return this.children=[],this},n.traverse=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=s.worldMatrix,a=c===void 0?new mt:c,f=new mt(a).multiplyRight(this.matrix),u=xa(this.children),l;try{for(u.s();!(l=u.n()).done;){var h=l.value;h instanceof r?h.traverse(o,{worldMatrix:f}):o(h,{worldMatrix:f})}}catch(v){u.e(v)}finally{u.f()}},A(r)}(It);function Ea(e){var t=Ma();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ma(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var uo=function(e){q(r,e);var t=Ea(r);function r(i){var o;return T(this,r),o=t.call(this,i),o.model=void 0,o.bounds=null,o.managedResources=void 0,o.model=i.model,o.managedResources=i.managedResources||[],o.bounds=i.bounds||null,o.setProps(i),o}var n=r.prototype;return n.getBounds=function(){return this.bounds},n.destroy=function(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(function(o){return o.destroy()}),this.managedResources=[]},n.draw=function(o){return this.model.draw(o)},A(r)}(It);function lo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sa(e){var t=Pa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Pa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Aa={x:[2,0,1],y:[0,1,2],z:[1,2,0]},Yt=function(e){q(r,e);var t=Sa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("truncated-code-geometry"):i,s=Ta(n),c=s.indices,a=s.attributes;return t.call(this,Mr(Mr({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Mr({POSITION:{size:3,value:a.POSITION},NORMAL:{size:3,value:a.NORMAL},TEXCOORD_0:{size:2,value:a.TEXCOORD_0}},n.attributes)}))}return A(r)}(st);function Ta(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.bottomRadius,r=t===void 0?0:t,n=e.topRadius,i=n===void 0?0:n,o=e.height,s=o===void 0?1:o,c=e.nradial,a=c===void 0?10:c,f=e.nvertical,u=f===void 0?10:f,l=e.verticalAxis,h=l===void 0?"y":l,v=e.topCap,m=v===void 0?!1:v,y=e.bottomCap,b=y===void 0?!1:y,O=(m?2:0)+(b?2:0),R=(a+1)*(u+1+O),x=Math.atan2(r-i,s),S=Math.sin,w=Math.cos,M=Math.PI,j=w(x),N=S(x),U=m?-2:0,C=u+(b?2:0),g=a+1,p=new Uint16Array(a*(u+O)*6),d=Aa[h],_=new Float32Array(R*3),E=new Float32Array(R*3),P=new Float32Array(R*2),D=0,B=0,I=U;I<=C;I++){var G=I/u,k=s*G,V=void 0;I<0?(k=0,G=1,V=r):I>u?(k=s,G=1,V=i):V=r+(i-r)*(I/u),(I===-2||I===u+2)&&(V=0,G=0),k-=s/2;for(var pt=0;pt<g;pt++){var ft=S(pt*M*2/a),Z=w(pt*M*2/a);_[D+d[0]]=ft*V,_[D+d[1]]=k,_[D+d[2]]=Z*V,E[D+d[0]]=I<0||I>u?0:ft*j,E[D+d[1]]=I<0?-1:I>u?1:N,E[D+d[2]]=I<0||I>u?0:Z*j,P[B+0]=pt/a,P[B+1]=G,B+=2,D+=3}}for(var J=0;J<u+O;J++)for(var Q=0;Q<a;Q++){var at=(J*a+Q)*6;p[at+0]=g*(J+0)+0+Q,p[at+1]=g*(J+0)+1+Q,p[at+2]=g*(J+1)+1+Q,p[at+3]=g*(J+0)+0+Q,p[at+4]=g*(J+1)+1+Q,p[at+5]=g*(J+1)+0+Q}return{indices:p,attributes:{POSITION:_,NORMAL:E,TEXCOORD_0:P}}}function ho(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function po(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ho(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ho(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ra(e){var t=Ca();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ca(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var mo=function(e){q(r,e);var t=Ra(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cone-geometry"):i,s=n.radius,c=s===void 0?1:s,a=n.cap,f=a===void 0?!0:a;return t.call(this,po(po({},n),{},{id:o,topRadius:0,topCap:Boolean(f),bottomCap:Boolean(f),bottomRadius:c}))}return A(r)}(Yt);function go(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function At(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?go(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):go(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function La(e){var t=Da();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Da(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var vo=function(e){q(r,e);var t=La(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cube-geometry"):i,s=n.indices,c=s===void 0?!0:s;return t.call(this,c?At(At({},n),{},{id:o,topology:"triangle-list",indices:{size:1,value:Ia},attributes:At(At({},za),n.attributes)}):At(At({},n),{},{id:o,topology:"triangle-list",indices:void 0,attributes:At(At({},ka),n.attributes)}))}return A(r)}(st),Ia=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Na=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),ja=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0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_0:{size:2,value:Ga},COLOR_0:{size:3,value:Ba}};function yo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _o(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Va(e){var t=Ha();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Ha(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var xo=function(e){q(r,e);var t=Va(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cylinder-geometry"):i,s=n.radius,c=s===void 0?1:s;return t.call(this,_o(_o({},n),{},{id:o,bottomRadius:c,topRadius:c}))}return A(r)}(Yt);function bo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function De(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qa(e){var t=Wa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Wa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ka=[-1,0,0,0,1,0,0,0,-1,0,0,1,0,-1,0,1,0,0],Ya=[3,4,5,3,5,1,3,1,0,3,0,4,4,0,2,4,2,5,2,0,1,5,2,1],Oo=function(e){q(r,e);var t=qa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("ico-sphere-geometry"):i,s=Xa(n),c=s.indices,a=s.attributes;return t.call(this,De(De({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:De(De({},a),n.attributes)}))}return A(r)}(st);function Xa(e){var t=e.iterations,r=t===void 0?0:t,n=Math.PI,i=n*2,o=[].concat(Ka),s=[].concat(Ya);o.push(),s.push();for(var c=function(){var je={};return function(bt,Ot){bt*=3,Ot*=3;var Ro=bt<Ot?bt:Ot,Co=bt>Ot?bt:Ot,Fe="".concat(Ro,"|").concat(Co);if(Fe in je)return je[Fe];var Lo=o[bt],Do=o[bt+1],Io=o[bt+2],No=o[Ot],jo=o[Ot+1],Fo=o[Ot+2],fe=(Lo+No)/2,ue=(Do+jo)/2,le=(Io+Fo)/2,Ue=Math.sqrt(fe*fe+ue*ue+le*le);return fe/=Ue,ue/=Ue,le/=Ue,o.push(fe,ue,le),je[Fe]=o.length/3-1}}(),a=0;a<r;a++){for(var f=[],u=0;u<s.length;u+=3){var l=c(s[u+0],s[u+1]),h=c(s[u+1],s[u+2]),v=c(s[u+2],s[u+0]);f.push(v,s[u+0],l,l,s[u+1],h,h,s[u+2],v,l,h,v)}s=f}for(var m=new Array(o.length),y=new Array(o.length/3*2),b=s.length,O=b-3;O>=0;O-=3){var R=s[O+0],x=s[O+1],S=s[O+2],w=R*3,M=x*3,j=S*3,N=R*2,U=x*2,C=S*2,g=o[w+0],p=o[w+1],d=o[w+2],_=Math.acos(d/Math.sqrt(g*g+p*p+d*d)),E=Math.atan2(p,g)+n,P=_/n,D=1-E/i,B=o[M+0],I=o[M+1],G=o[M+2],k=Math.acos(G/Math.sqrt(B*B+I*I+G*G)),V=Math.atan2(I,B)+n,pt=k/n,ft=1-V/i,Z=o[j+0],J=o[j+1],Q=o[j+2],at=Math.acos(Q/Math.sqrt(Z*Z+J*J+Q*Q)),Xt=Math.atan2(J,Z)+n,Sr=at/n,ce=1-Xt/i,Ao=[Z-B,J-I,Q-G],To=[g-B,p-I,d-G],ut=new ot(Ao).cross(To).normalize(),Y=void 0;(D===0||ft===0||ce===0)&&(D===0||D>.5)&&(ft===0||ft>.5)&&(ce===0||ce>.5)&&(o.push(o[w+0],o[w+1],o[w+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=P,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[M+0],o[M+1],o[M+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=pt,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[j+0],o[j+1],o[j+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=Sr,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z),m[w+0]=m[M+0]=m[j+0]=ut.x,m[w+1]=m[M+1]=m[j+1]=ut.y,m[w+2]=m[M+2]=m[j+2]=ut.z,y[N+0]=D,y[N+1]=P,y[U+0]=ft,y[U+1]=pt,y[C+0]=ce,y[C+1]=Sr}return{indices:{size:1,value:new Uint16Array(s)},attributes:{POSITION:{size:3,value:new Float32Array(o)},NORMAL:{size:3,value:new Float32Array(m)},TEXCOORD_0:{size:2,value:new Float32Array(y)}}}}function wo(e){var t=e.indices,r=e.attributes;if(!t)return e;var n=t.value.length,i={};for(var o in r){var s=r[o],c=s.constant,a=s.value,f=s.size;if(!(c||!f)){for(var u=new a.constructor(n*f),l=0;l<n;++l)for(var h=t.value[l],v=0;v<f;v++)u[l*f+v]=a[h*f+v];i[o]={size:f,value:u}}}return{attributes:Object.assign({},r,i)}}function Eo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Eo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Eo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $a(e){var t=Za();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function Za(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Mo=function(e){q(r,e);var t=$a(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("plane-geometry"):i,s=Ja(n),c=s.indices,a=s.attributes;return t.call(this,Ie(Ie({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Ie(Ie({},a),n.attributes)}))}return A(r)}(st);function Ja(e){var t=e.type,r=t===void 0?"x,y":t,n=e.offset,i=n===void 0?0:n,o=e.flipCull,s=o===void 0?!1:o,c=e.unpack,a=c===void 0?!1:c,f=r.split(","),u=e["".concat(f[0],"len")]||1,l=e["".concat(f[1],"len")]||1,h=e["n".concat(f[0])]||1,v=e["n".concat(f[1])]||1,m=(h+1)*(v+1),y=new Float32Array(m*3),b=new Float32Array(m*3),O=new Float32Array(m*2);s&&(u=-u);for(var R=0,x=0,S=0;S<=v;S++)for(var w=0;w<=h;w++){var M=w/h,j=S/v;switch(O[R+0]=s?1-M:M,O[R+1]=j,r){case"x,y":y[x+0]=u*M-u*.5,y[x+1]=l*j-l*.5,y[x+2]=i,b[x+0]=0,b[x+1]=0,b[x+2]=s?1:-1;break;case"x,z":y[x+0]=u*M-u*.5,y[x+1]=i,y[x+2]=l*j-l*.5,b[x+0]=0,b[x+1]=s?1:-1,b[x+2]=0;break;case"y,z":y[x+0]=i,y[x+1]=u*M-u*.5,y[x+2]=l*j-l*.5,b[x+0]=s?1:-1,b[x+1]=0,b[x+2]=0;break;default:throw new Error("PlaneGeometry: unknown type")}R+=2,x+=3}for(var N=h+1,U=new Uint16Array(h*v*6),C=0;C<v;C++)for(var g=0;g<h;g++){var p=(C*h+g)*6;U[p+0]=(C+0)*N+g,U[p+1]=(C+1)*N+g,U[p+2]=(C+0)*N+g+1,U[p+3]=(C+1)*N+g,U[p+4]=(C+1)*N+g+1,U[p+5]=(C+0)*N+g+1}var d={indices:{size:1,value:U},attributes:{POSITION:{size:3,value:y},NORMAL:{size:3,value:b},TEXCOORD_0:{size:2,value:O}}};return a?wo(d):d}function So(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?So(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):So(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qa(e){var t=tc();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return W(this,i)}}function tc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Po=function(e){q(r,e);var t=Qa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("sphere-geometry"):i,s=ec(n),c=s.indices,a=s.attributes;return t.call(this,Ne(Ne({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Ne(Ne({},a),n.attributes)}))}return A(r)}(st);function ec(e){for(var t=e.nlat,r=t===void 0?10:t,n=e.nlong,i=n===void 0?10:n,o=0,s=Math.PI,c=s-o,a=0,f=2*Math.PI,u=f-a,l=(r+1)*(i+1),h=function(ft,Z,J,Q,at){return e.radius||1},v=new Float32Array(l*3),m=new Float32Array(l*3),y=new Float32Array(l*2),b=l>65535?Uint32Array:Uint16Array,O=new b(r*i*6),R=0;R<=r;R++)for(var x=0;x<=i;x++){var S=x/i,w=R/r,M=x+R*(i+1),j=M*2,N=M*3,U=u*S,C=c*w,g=Math.sin(U),p=Math.cos(U),d=Math.sin(C),_=Math.cos(C),E=p*d,P=_,D=g*d,B=h(E,P,D,S,w);v[N+0]=B*E,v[N+1]=B*P,v[N+2]=B*D,m[N+0]=E,m[N+1]=P,m[N+2]=D,y[j+0]=S,y[j+1]=1-w}for(var I=i+1,G=0;G<i;G++)for(var k=0;k<r;k++){var V=(G*r+k)*6;O[V+0]=k*I+G,O[V+1]=k*I+G+1,O[V+2]=(k+1)*I+G,O[V+3]=(k+1)*I+G,O[V+4]=k*I+G+1,O[V+5]=(k+1)*I+G+1}return{indices:{size:1,value:O},attributes:{POSITION:{size:3,value:v},NORMAL:{size:3,value:m},TEXCOORD_0:{size:2,value:y}}}}return Ho(rc);})();
|
|
256
|
+
`]))),so=[-1,-1,1,-1,-1,1,1,1],ao=function(e){W(r,e);var t=va(r);function r(n,i){T(this,r);var o=so.map(function(s){return s===-1?0:s});return t.call(this,n,oo(oo({},i),{},{vs:_a,vertexCount:4,geometry:new st({topology:"triangle-strip",vertexCount:4,attributes:{aClipSpacePosition:{size:2,value:new Float32Array(so)},aTexCoord:{size:2,value:new Float32Array(o)},aCoordinate:{size:2,value:new Float32Array(o)}}})}))}return A(r)}(ae);var It=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,e),this.id=void 0,this.matrix=new mt,this.display=!0,this.position=new ot,this.rotation=new ot,this.scale=new ot(1,1,1),this.userData={},this.props={};var n=r.id;this.id=n||H(this.constructor.name),this._setScenegraphNodeProps(r)}var t=e.prototype;return t.getBounds=function(){return null},t.destroy=function(){},t.delete=function(){this.destroy()},t.setProps=function(n){return this._setScenegraphNodeProps(n),this},t.toString=function(){return"{type: ScenegraphNode, id: ".concat(this.id,")}")},t.setPosition=function(n){return rt(n.length===3,"setPosition requires vector argument"),this.position=n,this},t.setRotation=function(n){return rt(n.length===3,"setRotation requires vector argument"),this.rotation=n,this},t.setScale=function(n){return rt(n.length===3,"setScale requires vector argument"),this.scale=n,this},t.setMatrix=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i?this.matrix.copy(n):this.matrix=n},t.setMatrixComponents=function(n){var i=n.position,o=n.rotation,s=n.scale,c=n.update,a=c===void 0?!0:c;return i&&this.setPosition(i),o&&this.setRotation(o),s&&this.setScale(s),a&&this.updateMatrix(),this},t.updateMatrix=function(){var n=this.position,i=this.rotation,o=this.scale;return this.matrix.identity(),this.matrix.translate(n),this.matrix.rotateXYZ(i),this.matrix.scale(o),this},t.update=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.position,o=n.rotation,s=n.scale;return i&&this.setPosition(i),o&&this.setRotation(o),s&&this.setScale(s),this.updateMatrix(),this},t.getCoordinateUniforms=function(n,i){rt(n),i=i||this.matrix;var o=new mt(n).multiplyRight(i),s=o.invert(),c=s.transpose();return{viewMatrix:n,modelMatrix:i,objectMatrix:i,worldMatrix:o,worldInverseMatrix:s,worldInverseTransposeMatrix:c}},t._setScenegraphNodeProps=function(n){"display"in n&&(this.display=n.display),"position"in n&&this.setPosition(n.position),"rotation"in n&&this.setRotation(n.rotation),"scale"in n&&this.setScale(n.scale),"matrix"in n&&this.setMatrix(n.matrix),Object.assign(this.props,n)},A(e)}();function Er(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=F(e),e!==null););return e}function Kt(){return typeof Reflect<"u"&&Reflect.get?Kt=Reflect.get.bind():Kt=function(t,r,n){var i=Er(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Kt.apply(this,arguments)}function xa(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ba(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
257
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,c;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){s=!0,c=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw c}}}}function ba(e,t){if(e){if(typeof e=="string")return co(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return co(e,t)}}function co(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Oa(e){var t=wa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function wa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var fo=function(e){W(r,e);var t=Oa(r);function r(){var i,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r),o=Array.isArray(o)?{children:o}:o;var s=o,c=s.children,a=c===void 0?[]:c;return q.assert(a.every(function(f){return f instanceof It}),"every child must an instance of ScenegraphNode"),i=t.call(this,o),i.children=void 0,i.children=a,i}var n=r.prototype;return n.getBounds=function(){var o=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse(function(s,c){var a=c.worldMatrix,f=s.getBounds();if(f){var u=z(f,2),l=u[0],h=u[1],v=new ot(l).add(h).divide([2,2,2]);a.transformAsPoint(v,v);var m=new ot(h).subtract(l).divide([2,2,2]);a.transformAsVector(m,m);for(var y=0;y<8;y++)for(var b=new ot(y&1?-1:1,y&2?-1:1,y&4?-1:1).multiply(m).add(v),O=0;O<3;O++)o[0][O]=Math.min(o[0][O],b[O]),o[1][O]=Math.max(o[1][O],b[O])}}),Number.isFinite(o[0][0])?o:null},n.destroy=function(){this.children.forEach(function(o){return o.destroy()}),this.removeAll(),Kt(F(r.prototype),"destroy",this).call(this)},n.add=function(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];for(var a=0,f=s;a<f.length;a++){var u=f[a];Array.isArray(u)?this.add.apply(this,ne(u)):this.children.push(u)}return this},n.remove=function(o){var s=this.children,c=s.indexOf(o);return c>-1&&s.splice(c,1),this},n.removeAll=function(){return this.children=[],this},n.traverse=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=s.worldMatrix,a=c===void 0?new mt:c,f=new mt(a).multiplyRight(this.matrix),u=xa(this.children),l;try{for(u.s();!(l=u.n()).done;){var h=l.value;h instanceof r?h.traverse(o,{worldMatrix:f}):o(h,{worldMatrix:f})}}catch(v){u.e(v)}finally{u.f()}},A(r)}(It);function Ea(e){var t=Ma();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function Ma(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var uo=function(e){W(r,e);var t=Ea(r);function r(i){var o;return T(this,r),o=t.call(this,i),o.model=void 0,o.bounds=null,o.managedResources=void 0,o.model=i.model,o.managedResources=i.managedResources||[],o.bounds=i.bounds||null,o.setProps(i),o}var n=r.prototype;return n.getBounds=function(){return this.bounds},n.destroy=function(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(function(o){return o.destroy()}),this.managedResources=[]},n.draw=function(o){return this.model.draw(o)},A(r)}(It);function lo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sa(e){var t=Pa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function Pa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Aa={x:[2,0,1],y:[0,1,2],z:[1,2,0]},Yt=function(e){W(r,e);var t=Sa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("truncated-code-geometry"):i,s=Ta(n),c=s.indices,a=s.attributes;return t.call(this,Mr(Mr({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Mr({POSITION:{size:3,value:a.POSITION},NORMAL:{size:3,value:a.NORMAL},TEXCOORD_0:{size:2,value:a.TEXCOORD_0}},n.attributes)}))}return A(r)}(st);function Ta(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.bottomRadius,r=t===void 0?0:t,n=e.topRadius,i=n===void 0?0:n,o=e.height,s=o===void 0?1:o,c=e.nradial,a=c===void 0?10:c,f=e.nvertical,u=f===void 0?10:f,l=e.verticalAxis,h=l===void 0?"y":l,v=e.topCap,m=v===void 0?!1:v,y=e.bottomCap,b=y===void 0?!1:y,O=(m?2:0)+(b?2:0),R=(a+1)*(u+1+O),x=Math.atan2(r-i,s),S=Math.sin,w=Math.cos,M=Math.PI,j=w(x),N=S(x),U=m?-2:0,C=u+(b?2:0),g=a+1,p=new Uint16Array(a*(u+O)*6),d=Aa[h],_=new Float32Array(R*3),E=new Float32Array(R*3),P=new Float32Array(R*2),D=0,B=0,I=U;I<=C;I++){var G=I/u,k=s*G,V=void 0;I<0?(k=0,G=1,V=r):I>u?(k=s,G=1,V=i):V=r+(i-r)*(I/u),(I===-2||I===u+2)&&(V=0,G=0),k-=s/2;for(var pt=0;pt<g;pt++){var ft=S(pt*M*2/a),Z=w(pt*M*2/a);_[D+d[0]]=ft*V,_[D+d[1]]=k,_[D+d[2]]=Z*V,E[D+d[0]]=I<0||I>u?0:ft*j,E[D+d[1]]=I<0?-1:I>u?1:N,E[D+d[2]]=I<0||I>u?0:Z*j,P[B+0]=pt/a,P[B+1]=G,B+=2,D+=3}}for(var J=0;J<u+O;J++)for(var Q=0;Q<a;Q++){var at=(J*a+Q)*6;p[at+0]=g*(J+0)+0+Q,p[at+1]=g*(J+0)+1+Q,p[at+2]=g*(J+1)+1+Q,p[at+3]=g*(J+0)+0+Q,p[at+4]=g*(J+1)+1+Q,p[at+5]=g*(J+1)+0+Q}return{indices:p,attributes:{POSITION:_,NORMAL:E,TEXCOORD_0:P}}}function ho(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function po(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ho(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ho(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ra(e){var t=Ca();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function Ca(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var mo=function(e){W(r,e);var t=Ra(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cone-geometry"):i,s=n.radius,c=s===void 0?1:s,a=n.cap,f=a===void 0?!0:a;return t.call(this,po(po({},n),{},{id:o,topRadius:0,topCap:Boolean(f),bottomCap:Boolean(f),bottomRadius:c}))}return A(r)}(Yt);function go(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function At(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?go(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):go(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function La(e){var t=Da();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function Da(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var vo=function(e){W(r,e);var t=La(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cube-geometry"):i,s=n.indices,c=s===void 0?!0:s;return t.call(this,c?At(At({},n),{},{id:o,topology:"triangle-list",indices:{size:1,value:Ia},attributes:At(At({},za),n.attributes)}):At(At({},n),{},{id:o,topology:"triangle-list",indices:void 0,attributes:At(At({},ka),n.attributes)}))}return A(r)}(st),Ia=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Na=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),ja=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),Fa=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),Ua=new Float32Array([1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1]),Ga=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),Ba=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),za={POSITION:{size:3,value:Na},NORMAL:{size:3,value:ja},TEXCOORD_0:{size:2,value:Fa}},ka={POSITION:{size:4,value:Ua},TEXCOORD_0:{size:2,value:Ga},COLOR_0:{size:3,value:Ba}};function yo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _o(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Va(e){var t=Ha();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function Ha(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var xo=function(e){W(r,e);var t=Va(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("cylinder-geometry"):i,s=n.radius,c=s===void 0?1:s;return t.call(this,_o(_o({},n),{},{id:o,bottomRadius:c,topRadius:c}))}return A(r)}(Yt);function bo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function De(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qa(e){var t=Wa();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function Wa(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ka=[-1,0,0,0,1,0,0,0,-1,0,0,1,0,-1,0,1,0,0],Ya=[3,4,5,3,5,1,3,1,0,3,0,4,4,0,2,4,2,5,2,0,1,5,2,1],Oo=function(e){W(r,e);var t=qa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("ico-sphere-geometry"):i,s=Xa(n),c=s.indices,a=s.attributes;return t.call(this,De(De({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:De(De({},a),n.attributes)}))}return A(r)}(st);function Xa(e){var t=e.iterations,r=t===void 0?0:t,n=Math.PI,i=n*2,o=[].concat(Ka),s=[].concat(Ya);o.push(),s.push();for(var c=function(){var je={};return function(bt,Ot){bt*=3,Ot*=3;var Ro=bt<Ot?bt:Ot,Co=bt>Ot?bt:Ot,Fe="".concat(Ro,"|").concat(Co);if(Fe in je)return je[Fe];var Lo=o[bt],Do=o[bt+1],Io=o[bt+2],No=o[Ot],jo=o[Ot+1],Fo=o[Ot+2],fe=(Lo+No)/2,ue=(Do+jo)/2,le=(Io+Fo)/2,Ue=Math.sqrt(fe*fe+ue*ue+le*le);return fe/=Ue,ue/=Ue,le/=Ue,o.push(fe,ue,le),je[Fe]=o.length/3-1}}(),a=0;a<r;a++){for(var f=[],u=0;u<s.length;u+=3){var l=c(s[u+0],s[u+1]),h=c(s[u+1],s[u+2]),v=c(s[u+2],s[u+0]);f.push(v,s[u+0],l,l,s[u+1],h,h,s[u+2],v,l,h,v)}s=f}for(var m=new Array(o.length),y=new Array(o.length/3*2),b=s.length,O=b-3;O>=0;O-=3){var R=s[O+0],x=s[O+1],S=s[O+2],w=R*3,M=x*3,j=S*3,N=R*2,U=x*2,C=S*2,g=o[w+0],p=o[w+1],d=o[w+2],_=Math.acos(d/Math.sqrt(g*g+p*p+d*d)),E=Math.atan2(p,g)+n,P=_/n,D=1-E/i,B=o[M+0],I=o[M+1],G=o[M+2],k=Math.acos(G/Math.sqrt(B*B+I*I+G*G)),V=Math.atan2(I,B)+n,pt=k/n,ft=1-V/i,Z=o[j+0],J=o[j+1],Q=o[j+2],at=Math.acos(Q/Math.sqrt(Z*Z+J*J+Q*Q)),Xt=Math.atan2(J,Z)+n,Sr=at/n,ce=1-Xt/i,Ao=[Z-B,J-I,Q-G],To=[g-B,p-I,d-G],ut=new ot(Ao).cross(To).normalize(),Y=void 0;(D===0||ft===0||ce===0)&&(D===0||D>.5)&&(ft===0||ft>.5)&&(ce===0||ce>.5)&&(o.push(o[w+0],o[w+1],o[w+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=P,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[M+0],o[M+1],o[M+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=pt,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z,o.push(o[j+0],o[j+1],o[j+2]),Y=o.length/3-1,s.push(Y),y[Y*2+0]=1,y[Y*2+1]=Sr,m[Y*3+0]=ut.x,m[Y*3+1]=ut.y,m[Y*3+2]=ut.z),m[w+0]=m[M+0]=m[j+0]=ut.x,m[w+1]=m[M+1]=m[j+1]=ut.y,m[w+2]=m[M+2]=m[j+2]=ut.z,y[N+0]=D,y[N+1]=P,y[U+0]=ft,y[U+1]=pt,y[C+0]=ce,y[C+1]=Sr}return{indices:{size:1,value:new Uint16Array(s)},attributes:{POSITION:{size:3,value:new Float32Array(o)},NORMAL:{size:3,value:new Float32Array(m)},TEXCOORD_0:{size:2,value:new Float32Array(y)}}}}function wo(e){var t=e.indices,r=e.attributes;if(!t)return e;var n=t.value.length,i={};for(var o in r){var s=r[o],c=s.constant,a=s.value,f=s.size;if(!(c||!f)){for(var u=new a.constructor(n*f),l=0;l<n;++l)for(var h=t.value[l],v=0;v<f;v++)u[l*f+v]=a[h*f+v];i[o]={size:f,value:u}}}return{attributes:Object.assign({},r,i)}}function Eo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Eo(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Eo(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $a(e){var t=Za();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function Za(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Mo=function(e){W(r,e);var t=$a(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("plane-geometry"):i,s=Ja(n),c=s.indices,a=s.attributes;return t.call(this,Ie(Ie({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Ie(Ie({},a),n.attributes)}))}return A(r)}(st);function Ja(e){var t=e.type,r=t===void 0?"x,y":t,n=e.offset,i=n===void 0?0:n,o=e.flipCull,s=o===void 0?!1:o,c=e.unpack,a=c===void 0?!1:c,f=r.split(","),u=e["".concat(f[0],"len")]||1,l=e["".concat(f[1],"len")]||1,h=e["n".concat(f[0])]||1,v=e["n".concat(f[1])]||1,m=(h+1)*(v+1),y=new Float32Array(m*3),b=new Float32Array(m*3),O=new Float32Array(m*2);s&&(u=-u);for(var R=0,x=0,S=0;S<=v;S++)for(var w=0;w<=h;w++){var M=w/h,j=S/v;switch(O[R+0]=s?1-M:M,O[R+1]=j,r){case"x,y":y[x+0]=u*M-u*.5,y[x+1]=l*j-l*.5,y[x+2]=i,b[x+0]=0,b[x+1]=0,b[x+2]=s?1:-1;break;case"x,z":y[x+0]=u*M-u*.5,y[x+1]=i,y[x+2]=l*j-l*.5,b[x+0]=0,b[x+1]=s?1:-1,b[x+2]=0;break;case"y,z":y[x+0]=i,y[x+1]=u*M-u*.5,y[x+2]=l*j-l*.5,b[x+0]=s?1:-1,b[x+1]=0,b[x+2]=0;break;default:throw new Error("PlaneGeometry: unknown type")}R+=2,x+=3}for(var N=h+1,U=new Uint16Array(h*v*6),C=0;C<v;C++)for(var g=0;g<h;g++){var p=(C*h+g)*6;U[p+0]=(C+0)*N+g,U[p+1]=(C+1)*N+g,U[p+2]=(C+0)*N+g+1,U[p+3]=(C+1)*N+g,U[p+4]=(C+1)*N+g+1,U[p+5]=(C+0)*N+g+1}var d={indices:{size:1,value:U},attributes:{POSITION:{size:3,value:y},NORMAL:{size:3,value:b},TEXCOORD_0:{size:2,value:O}}};return a?wo(d):d}function So(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?So(Object(r),!0).forEach(function(n){L(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):So(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qa(e){var t=tc();return function(){var n=F(e),i;if(t){var o=F(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K(this,i)}}function tc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Po=function(e){W(r,e);var t=Qa(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};T(this,r);var i=n.id,o=i===void 0?H("sphere-geometry"):i,s=ec(n),c=s.indices,a=s.attributes;return t.call(this,Ne(Ne({},n),{},{id:o,topology:"triangle-list",indices:c,attributes:Ne(Ne({},a),n.attributes)}))}return A(r)}(st);function ec(e){for(var t=e.nlat,r=t===void 0?10:t,n=e.nlong,i=n===void 0?10:n,o=0,s=Math.PI,c=s-o,a=0,f=2*Math.PI,u=f-a,l=(r+1)*(i+1),h=function(ft,Z,J,Q,at){return e.radius||1},v=new Float32Array(l*3),m=new Float32Array(l*3),y=new Float32Array(l*2),b=l>65535?Uint32Array:Uint16Array,O=new b(r*i*6),R=0;R<=r;R++)for(var x=0;x<=i;x++){var S=x/i,w=R/r,M=x+R*(i+1),j=M*2,N=M*3,U=u*S,C=c*w,g=Math.sin(U),p=Math.cos(U),d=Math.sin(C),_=Math.cos(C),E=p*d,P=_,D=g*d,B=h(E,P,D,S,w);v[N+0]=B*E,v[N+1]=B*P,v[N+2]=B*D,m[N+0]=E,m[N+1]=P,m[N+2]=D,y[j+0]=S,y[j+1]=1-w}for(var I=i+1,G=0;G<i;G++)for(var k=0;k<r;k++){var V=(G*r+k)*6;O[V+0]=k*I+G,O[V+1]=k*I+G+1,O[V+2]=(k+1)*I+G,O[V+3]=(k+1)*I+G,O[V+4]=k*I+G+1,O[V+5]=(k+1)*I+G+1}return{indices:{size:1,value:O},attributes:{POSITION:{size:3,value:v},NORMAL:{size:3,value:m},TEXCOORD_0:{size:2,value:y}}}}return Ho(rc);})();
|
|
258
258
|
/*! Bundled license information:
|
|
259
259
|
|
|
260
260
|
@babel/runtime/helpers/regeneratorRuntime.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/engine",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.46",
|
|
4
4
|
"description": "WebGL2 Components for High Performance Rendering and Computation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
|
-
"@luma.gl/constants": "9.0.0-alpha.
|
|
44
|
-
"@luma.gl/core": "9.0.0-alpha.
|
|
45
|
-
"@luma.gl/shadertools": "9.0.0-alpha.
|
|
43
|
+
"@luma.gl/constants": "9.0.0-alpha.46",
|
|
44
|
+
"@luma.gl/core": "9.0.0-alpha.46",
|
|
45
|
+
"@luma.gl/shadertools": "9.0.0-alpha.46",
|
|
46
46
|
"@math.gl/core": "^4.0.0",
|
|
47
47
|
"@probe.gl/log": "^4.0.2",
|
|
48
48
|
"@probe.gl/stats": "^4.0.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "c1e0602fd739f8d08e6532034a02e8cf658e188a"
|
|
51
51
|
}
|
package/src/model/model.ts
CHANGED
|
@@ -7,10 +7,20 @@ import type {
|
|
|
7
7
|
RenderPipelineParameters,
|
|
8
8
|
BufferLayout,
|
|
9
9
|
VertexArray,
|
|
10
|
-
AttributeInfo
|
|
10
|
+
AttributeInfo,
|
|
11
|
+
TransformFeedback
|
|
11
12
|
} from '@luma.gl/core';
|
|
12
13
|
import type {Binding, UniformValue, PrimitiveTopology} from '@luma.gl/core';
|
|
13
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
Device,
|
|
16
|
+
Buffer,
|
|
17
|
+
RenderPipeline,
|
|
18
|
+
RenderPass,
|
|
19
|
+
log,
|
|
20
|
+
uid,
|
|
21
|
+
deepEqual,
|
|
22
|
+
splitUniformsAndBindings
|
|
23
|
+
} from '@luma.gl/core';
|
|
14
24
|
import {getAttributeInfosFromLayouts} from '@luma.gl/core';
|
|
15
25
|
import type {ShaderModule, PlatformInfo} from '@luma.gl/shadertools';
|
|
16
26
|
import {ShaderAssembler} from '@luma.gl/shadertools';
|
|
@@ -50,6 +60,8 @@ export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
|
50
60
|
/** */
|
|
51
61
|
constantAttributes?: Record<string, TypedArray>;
|
|
52
62
|
|
|
63
|
+
transformFeedback?: TransformFeedback;
|
|
64
|
+
|
|
53
65
|
/** Mapped uniforms for shadertool modules */
|
|
54
66
|
moduleSettings?: Record<string, Record<string, any>>;
|
|
55
67
|
};
|
|
@@ -79,6 +91,7 @@ export class Model {
|
|
|
79
91
|
constantAttributes: {},
|
|
80
92
|
|
|
81
93
|
pipelineFactory: undefined!,
|
|
94
|
+
transformFeedback: undefined,
|
|
82
95
|
shaderAssembler: ShaderAssembler.getDefaultShaderAssembler()
|
|
83
96
|
};
|
|
84
97
|
|
|
@@ -127,6 +140,9 @@ export class Model {
|
|
|
127
140
|
* */
|
|
128
141
|
vertexArray: VertexArray;
|
|
129
142
|
|
|
143
|
+
/** TransformFeedback, WebGL 2 only. */
|
|
144
|
+
transformFeedback: TransformFeedback | null = null;
|
|
145
|
+
|
|
130
146
|
_pipelineNeedsUpdate: string | false = 'newly created';
|
|
131
147
|
_attributeInfos: Record<string, AttributeInfo> = {};
|
|
132
148
|
_gpuGeometry: GPUGeometry | null = null;
|
|
@@ -194,7 +210,7 @@ export class Model {
|
|
|
194
210
|
}
|
|
195
211
|
// @ts-expect-error
|
|
196
212
|
if (props.indices) {
|
|
197
|
-
throw new Error('Model.props.indices removed. Use props.indexBuffer')
|
|
213
|
+
throw new Error('Model.props.indices removed. Use props.indexBuffer');
|
|
198
214
|
}
|
|
199
215
|
if (props.indexBuffer) {
|
|
200
216
|
this.setIndexBuffer(props.indexBuffer);
|
|
@@ -214,6 +230,9 @@ export class Model {
|
|
|
214
230
|
if (props.moduleSettings) {
|
|
215
231
|
this.updateModuleSettings(props.moduleSettings);
|
|
216
232
|
}
|
|
233
|
+
if (props.transformFeedback) {
|
|
234
|
+
this.transformFeedback = props.transformFeedback;
|
|
235
|
+
}
|
|
217
236
|
|
|
218
237
|
this.setUniforms(this._getModuleUniforms()); // Get all default module uniforms
|
|
219
238
|
|
|
@@ -241,7 +260,8 @@ export class Model {
|
|
|
241
260
|
renderPass,
|
|
242
261
|
vertexArray: this.vertexArray,
|
|
243
262
|
vertexCount: this.vertexCount,
|
|
244
|
-
instanceCount: this.instanceCount
|
|
263
|
+
instanceCount: this.instanceCount,
|
|
264
|
+
transformFeedback: this.transformFeedback
|
|
245
265
|
});
|
|
246
266
|
}
|
|
247
267
|
|
|
@@ -297,7 +317,7 @@ export class Model {
|
|
|
297
317
|
|
|
298
318
|
// Recreate the pipeline
|
|
299
319
|
this.pipeline = this._updatePipeline();
|
|
300
|
-
|
|
320
|
+
|
|
301
321
|
// vertex array needs to be updated if we update buffer layout,
|
|
302
322
|
// but not if we update parameters
|
|
303
323
|
this.vertexArray = this.device.createVertexArray({
|
|
@@ -349,6 +369,13 @@ export class Model {
|
|
|
349
369
|
Object.assign(this.uniforms, uniforms);
|
|
350
370
|
}
|
|
351
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Updates optional transform feedback. WebGL 2 only.
|
|
374
|
+
*/
|
|
375
|
+
setTransformFeedback(transformFeedback: TransformFeedback | null): void {
|
|
376
|
+
this.transformFeedback = transformFeedback;
|
|
377
|
+
}
|
|
378
|
+
|
|
352
379
|
/**
|
|
353
380
|
* @deprecated Updates shader module settings (which results in uniforms being set)
|
|
354
381
|
*/
|
|
@@ -395,6 +422,7 @@ export class Model {
|
|
|
395
422
|
for (const [bufferName, buffer] of Object.entries(buffers)) {
|
|
396
423
|
const bufferLayout = this.bufferLayout.find(layout => layout.name === bufferName);
|
|
397
424
|
if (!bufferLayout) {
|
|
425
|
+
log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
|
|
398
426
|
continue; // eslint-disable-line no-continue
|
|
399
427
|
}
|
|
400
428
|
|
|
@@ -432,7 +460,9 @@ export class Model {
|
|
|
432
460
|
if (attributeInfo) {
|
|
433
461
|
this.vertexArray.setConstant(attributeInfo.location, value);
|
|
434
462
|
} else {
|
|
435
|
-
log.warn(
|
|
463
|
+
log.warn(
|
|
464
|
+
`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`
|
|
465
|
+
)();
|
|
436
466
|
}
|
|
437
467
|
}
|
|
438
468
|
}
|
|
@@ -444,7 +474,10 @@ export class Model {
|
|
|
444
474
|
_updatePipeline(): RenderPipeline {
|
|
445
475
|
if (this._pipelineNeedsUpdate) {
|
|
446
476
|
if (this.pipeline) {
|
|
447
|
-
log.log(
|
|
477
|
+
log.log(
|
|
478
|
+
1,
|
|
479
|
+
`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
|
|
480
|
+
)();
|
|
448
481
|
}
|
|
449
482
|
this._pipelineNeedsUpdate = false;
|
|
450
483
|
this.pipeline = this.device.createRenderPipeline({
|
|
@@ -453,7 +486,13 @@ export class Model {
|
|
|
453
486
|
topology: this.topology,
|
|
454
487
|
parameters: this.parameters,
|
|
455
488
|
vs: this.device.createShader({id: '{$this.id}-vertex', stage: 'vertex', source: this.vs}),
|
|
456
|
-
fs: this.fs
|
|
489
|
+
fs: this.fs
|
|
490
|
+
? this.device.createShader({
|
|
491
|
+
id: '{$this.id}-fragment',
|
|
492
|
+
stage: 'fragment',
|
|
493
|
+
source: this.fs
|
|
494
|
+
})
|
|
495
|
+
: null
|
|
457
496
|
});
|
|
458
497
|
this._attributeInfos = getAttributeInfosFromLayouts(
|
|
459
498
|
this.pipeline.shaderLayout,
|
package/LICENSE
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
|