@luma.gl/engine 10.0.0-alpha.2 → 10.0.0-alpha.4
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/compute/computation.d.ts +2 -0
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +5 -1
- package/dist/compute/computation.js.map +1 -1
- package/dist/dist.dev.js +1033 -1320
- package/dist/dist.min.js +23 -23
- package/dist/geometry/edge-geometry.d.ts +17 -0
- package/dist/geometry/edge-geometry.d.ts.map +1 -0
- package/dist/geometry/edge-geometry.js +160 -0
- package/dist/geometry/edge-geometry.js.map +1 -0
- package/dist/geometry/geometry-primitives.d.ts +54 -0
- package/dist/geometry/geometry-primitives.d.ts.map +1 -0
- package/dist/geometry/geometry-primitives.js +153 -0
- package/dist/geometry/geometry-primitives.js.map +1 -0
- package/dist/geometry/geometry-utils.d.ts +7 -15
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +9 -55
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/geometry/geometry.d.ts +9 -69
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +27 -93
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts +4 -2
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +3 -3
- package/dist/geometry/gpu-geometry.js.map +1 -1
- package/dist/geometry/stroke-geometry.d.ts +15 -0
- package/dist/geometry/stroke-geometry.d.ts.map +1 -0
- package/dist/geometry/stroke-geometry.js +168 -0
- package/dist/geometry/stroke-geometry.js.map +1 -0
- package/dist/index.cjs +554 -1309
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +17 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/model/model.d.ts +6 -1
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +11 -4
- package/dist/model/model.js.map +1 -1
- package/dist/models/clip-space.d.ts +4 -1
- package/dist/models/clip-space.d.ts.map +1 -1
- package/dist/models/clip-space.js +16 -13
- package/dist/models/clip-space.js.map +1 -1
- package/dist/models/directional-light-model.js +1 -1
- package/dist/models/directional-light-model.js.map +1 -1
- package/dist/models/point-light-model.js +1 -1
- package/dist/models/point-light-model.js.map +1 -1
- package/dist/models/spot-light-model.js +1 -1
- package/dist/models/spot-light-model.js.map +1 -1
- package/package.json +7 -6
- package/src/compute/computation.ts +7 -0
- package/src/geometry/edge-geometry.ts +208 -0
- package/src/geometry/geometry-primitives.ts +215 -0
- package/src/geometry/geometry-utils.ts +16 -71
- package/src/geometry/geometry.ts +36 -163
- package/src/geometry/gpu-geometry.ts +9 -4
- package/src/geometry/stroke-geometry.ts +236 -0
- package/src/index.ts +21 -14
- package/src/model/model.ts +19 -6
- package/src/models/clip-space.ts +21 -14
- package/src/models/directional-light-model.ts +1 -1
- package/src/models/point-light-model.ts +1 -1
- package/src/models/spot-light-model.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts +0 -12
- package/dist/geometries/cone-geometry.d.ts.map +0 -1
- package/dist/geometries/cone-geometry.js +0 -19
- package/dist/geometries/cone-geometry.js.map +0 -1
- package/dist/geometries/cube-geometry.d.ts +0 -14
- package/dist/geometries/cube-geometry.d.ts.map +0 -1
- package/dist/geometries/cube-geometry.js +0 -222
- package/dist/geometries/cube-geometry.js.map +0 -1
- package/dist/geometries/cylinder-geometry.d.ts +0 -11
- package/dist/geometries/cylinder-geometry.d.ts.map +0 -1
- package/dist/geometries/cylinder-geometry.js +0 -17
- package/dist/geometries/cylinder-geometry.js.map +0 -1
- package/dist/geometries/ico-sphere-geometry.d.ts +0 -11
- package/dist/geometries/ico-sphere-geometry.d.ts.map +0 -1
- package/dist/geometries/ico-sphere-geometry.js +0 -158
- package/dist/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/geometries/plane-geometry.d.ts +0 -20
- package/dist/geometries/plane-geometry.d.ts.map +0 -1
- package/dist/geometries/plane-geometry.js +0 -106
- package/dist/geometries/plane-geometry.js.map +0 -1
- package/dist/geometries/sphere-geometry.d.ts +0 -12
- package/dist/geometries/sphere-geometry.d.ts.map +0 -1
- package/dist/geometries/sphere-geometry.js +0 -88
- package/dist/geometries/sphere-geometry.js.map +0 -1
- package/dist/geometries/truncated-cone-geometry.d.ts +0 -23
- package/dist/geometries/truncated-cone-geometry.d.ts.map +0 -1
- package/dist/geometries/truncated-cone-geometry.js +0 -112
- package/dist/geometries/truncated-cone-geometry.js.map +0 -1
- package/src/geometries/cone-geometry.ts +0 -31
- package/src/geometries/cube-geometry.ts +0 -258
- package/src/geometries/cylinder-geometry.ts +0 -28
- package/src/geometries/ico-sphere-geometry.ts +0 -193
- package/src/geometries/plane-geometry.ts +0 -142
- package/src/geometries/sphere-geometry.ts +0 -113
- package/src/geometries/truncated-cone-geometry.ts +0 -145
package/dist/index.cjs
CHANGED
|
@@ -79,8 +79,11 @@ __export(index_exports, {
|
|
|
79
79
|
loadImage: () => loadImage,
|
|
80
80
|
loadImageBitmap: () => loadImageBitmap,
|
|
81
81
|
makeAnimationLoop: () => makeAnimationLoop,
|
|
82
|
+
makeEdgeGeometry: () => makeEdgeGeometry,
|
|
83
|
+
makeEdgeGeometryFromGeometries: () => makeEdgeGeometryFromGeometries,
|
|
82
84
|
makeInterleavedGeometry: () => makeInterleavedGeometry,
|
|
83
85
|
makeRandomGenerator: () => makeRandomGenerator,
|
|
86
|
+
makeStrokeGeometry: () => makeStrokeGeometry,
|
|
84
87
|
picking: () => picking4,
|
|
85
88
|
requestAnimationFramePolyfill: () => requestAnimationFramePolyfill,
|
|
86
89
|
resolvePickingBackend: () => resolvePickingBackend,
|
|
@@ -549,101 +552,32 @@ var AnimationMixer = class {
|
|
|
549
552
|
};
|
|
550
553
|
|
|
551
554
|
// dist/geometry/geometry.js
|
|
555
|
+
var import_geometry = require("@math.gl/geometry");
|
|
552
556
|
var import_core2 = require("@luma.gl/core");
|
|
553
|
-
|
|
554
|
-
// dist/utils/uid.js
|
|
555
|
-
var uidCounters = {};
|
|
556
|
-
function uid(id = "id") {
|
|
557
|
-
uidCounters[id] = uidCounters[id] || 1;
|
|
558
|
-
const count = uidCounters[id]++;
|
|
559
|
-
return `${id}-${count}`;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// dist/geometry/geometry.js
|
|
563
|
-
var Geometry = class {
|
|
564
|
-
/** Application-provided or generated identifier. */
|
|
565
|
-
id;
|
|
566
|
-
/** Determines how vertices are assembled into primitives. */
|
|
567
|
-
topology;
|
|
568
|
-
/** Resolved draw vertex count. */
|
|
569
|
-
vertexCount;
|
|
570
|
-
/** Optional index attribute. */
|
|
571
|
-
indices;
|
|
572
|
-
/** CPU attributes, keyed by caller-provided source attribute name. */
|
|
573
|
-
attributes;
|
|
574
|
-
/** Buffer layout matching the geometry attributes. Always populated. */
|
|
557
|
+
var Geometry = class extends import_geometry.Geometry {
|
|
575
558
|
bufferLayout;
|
|
576
|
-
/** Application-owned metadata. */
|
|
577
|
-
userData = {};
|
|
578
|
-
/** Creates a CPU geometry and wraps raw typed arrays into attribute records. */
|
|
579
559
|
constructor(props) {
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
throw new Error("Multiple indices detected");
|
|
598
|
-
}
|
|
599
|
-
this.indices = attribute;
|
|
600
|
-
} else {
|
|
601
|
-
const shaderAttributeName = getGeometryShaderAttributeName(attributeName);
|
|
602
|
-
const storedAttributeName = Object.keys(this.attributes).find((name) => getGeometryShaderAttributeName(name) === shaderAttributeName);
|
|
603
|
-
if (storedAttributeName) {
|
|
604
|
-
delete this.attributes[storedAttributeName];
|
|
605
|
-
}
|
|
606
|
-
this.attributes[attributeName] = attribute;
|
|
560
|
+
const attributes = {};
|
|
561
|
+
const sourceNames = /* @__PURE__ */ new Map();
|
|
562
|
+
for (const [name, attribute] of Object.entries(props.attributes)) {
|
|
563
|
+
const shaderName = getGeometryShaderAttributeName(name);
|
|
564
|
+
const previousName = sourceNames.get(shaderName);
|
|
565
|
+
if (previousName)
|
|
566
|
+
delete attributes[previousName];
|
|
567
|
+
sourceNames.set(shaderName, name);
|
|
568
|
+
attributes[name] = attribute;
|
|
569
|
+
}
|
|
570
|
+
const sourceIndices = props.indices;
|
|
571
|
+
const indices = sourceIndices instanceof Uint8Array ? new Uint16Array(sourceIndices) : sourceIndices && !ArrayBuffer.isView(sourceIndices) && sourceIndices.value instanceof Uint8Array ? { ...sourceIndices, value: new Uint16Array(sourceIndices.value) } : sourceIndices;
|
|
572
|
+
super({ ...props, attributes, indices });
|
|
573
|
+
for (const [name, input] of Object.entries(attributes)) {
|
|
574
|
+
if (!ArrayBuffer.isView(input) && Object.isExtensible(input) && name !== "indices") {
|
|
575
|
+
Object.assign(input, this.attributes[name]);
|
|
576
|
+
this.attributes[name] = input;
|
|
607
577
|
}
|
|
608
578
|
}
|
|
609
|
-
if (this.indices && this.indices["isIndexed"] !== void 0) {
|
|
610
|
-
this.indices = Object.assign({}, this.indices);
|
|
611
|
-
delete this.indices["isIndexed"];
|
|
612
|
-
}
|
|
613
|
-
this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);
|
|
614
579
|
this.bufferLayout = props.bufferLayout || getBufferLayoutFromGeometryAttributes(this.attributes);
|
|
615
580
|
}
|
|
616
|
-
/** Returns the resolved draw vertex count. */
|
|
617
|
-
getVertexCount() {
|
|
618
|
-
return this.vertexCount;
|
|
619
|
-
}
|
|
620
|
-
/** Returns all attributes, including `indices` when index data is present. */
|
|
621
|
-
getAttributes() {
|
|
622
|
-
return this.indices ? { indices: this.indices, ...this.attributes } : this.attributes;
|
|
623
|
-
}
|
|
624
|
-
// PRIVATE
|
|
625
|
-
_print(attributeName) {
|
|
626
|
-
return `Geometry ${this.id} attribute ${attributeName}`;
|
|
627
|
-
}
|
|
628
|
-
_setAttributes(attributes, indices) {
|
|
629
|
-
return this;
|
|
630
|
-
}
|
|
631
|
-
_calculateVertexCount(attributes, indices) {
|
|
632
|
-
if (indices) {
|
|
633
|
-
return indices.value.length;
|
|
634
|
-
}
|
|
635
|
-
let vertexCount = Infinity;
|
|
636
|
-
for (const attribute of Object.values(attributes)) {
|
|
637
|
-
if (!attribute) {
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
const { value, size, constant } = attribute;
|
|
641
|
-
if (!constant && value && size !== void 0 && size >= 1) {
|
|
642
|
-
vertexCount = Math.min(vertexCount, value.length / size);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
return vertexCount;
|
|
646
|
-
}
|
|
647
581
|
};
|
|
648
582
|
function getGeometryShaderAttributeName(attributeName) {
|
|
649
583
|
switch (attributeName) {
|
|
@@ -681,37 +615,7 @@ function getBufferLayoutFromGeometryAttributes(attributes) {
|
|
|
681
615
|
|
|
682
616
|
// dist/geometry/geometry-utils.js
|
|
683
617
|
var import_core3 = require("@luma.gl/core");
|
|
684
|
-
|
|
685
|
-
const { indices, attributes } = geometry;
|
|
686
|
-
if (!indices) {
|
|
687
|
-
return geometry;
|
|
688
|
-
}
|
|
689
|
-
const vertexCount = indices.value.length;
|
|
690
|
-
const unpackedAttributes = {};
|
|
691
|
-
for (const attributeName in attributes) {
|
|
692
|
-
const attribute = attributes[attributeName];
|
|
693
|
-
if (!attribute) {
|
|
694
|
-
continue;
|
|
695
|
-
}
|
|
696
|
-
const { value, size } = attribute;
|
|
697
|
-
const constant = attribute["constant"];
|
|
698
|
-
if (constant || !size) {
|
|
699
|
-
continue;
|
|
700
|
-
}
|
|
701
|
-
const ArrayType = value.constructor;
|
|
702
|
-
const unpackedValue = new ArrayType(vertexCount * size);
|
|
703
|
-
for (let x = 0; x < vertexCount; ++x) {
|
|
704
|
-
const index = indices.value[x];
|
|
705
|
-
for (let i = 0; i < size; i++) {
|
|
706
|
-
unpackedValue[x * size + i] = value[index * size + i];
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
unpackedAttributes[attributeName] = { size, value: unpackedValue };
|
|
710
|
-
}
|
|
711
|
-
return {
|
|
712
|
-
attributes: Object.assign({}, attributes, unpackedAttributes)
|
|
713
|
-
};
|
|
714
|
-
}
|
|
618
|
+
var import_geometry2 = require("@math.gl/geometry");
|
|
715
619
|
function makeInterleavedGeometry(geometry, options = {}) {
|
|
716
620
|
const bufferName = options.bufferName || "geometry";
|
|
717
621
|
if (isInterleavedGeometry(geometry, bufferName)) {
|
|
@@ -790,18 +694,22 @@ function makeInterleavedGeometry(geometry, options = {}) {
|
|
|
790
694
|
});
|
|
791
695
|
}
|
|
792
696
|
function isInterleavedGeometry(geometry, bufferName) {
|
|
793
|
-
var _a;
|
|
794
|
-
if (geometry.bufferLayout.length !== 1) {
|
|
697
|
+
var _a, _b;
|
|
698
|
+
if (((_a = geometry.bufferLayout) == null ? void 0 : _a.length) !== 1) {
|
|
795
699
|
return false;
|
|
796
700
|
}
|
|
797
701
|
const bufferLayout = geometry.bufferLayout[0];
|
|
798
|
-
return bufferLayout.name === bufferName && Boolean((
|
|
702
|
+
return bufferLayout.name === bufferName && Boolean((_b = bufferLayout.attributes) == null ? void 0 : _b.length) && Boolean(geometry.attributes[bufferName]);
|
|
799
703
|
}
|
|
800
704
|
function getInterleavedSourceAttributes(geometry, attributeNames) {
|
|
801
|
-
|
|
802
|
-
|
|
705
|
+
const attributes = /* @__PURE__ */ new Map();
|
|
706
|
+
const sourceNames = attributeNames || Object.keys(geometry.attributes);
|
|
707
|
+
for (const name of sourceNames) {
|
|
708
|
+
const attribute = geometry.attributes[name];
|
|
709
|
+
if (attribute)
|
|
710
|
+
attributes.set(getGeometryShaderAttributeName(name), [name, attribute]);
|
|
803
711
|
}
|
|
804
|
-
return
|
|
712
|
+
return Array.from(attributes.values());
|
|
805
713
|
}
|
|
806
714
|
function writeInterleavedAttribute(arrayBuffer, vertexCount, byteStride, attribute) {
|
|
807
715
|
const ArrayType = attribute.value.constructor;
|
|
@@ -1982,6 +1890,16 @@ var import_shadertools3 = require("@luma.gl/shadertools");
|
|
|
1982
1890
|
|
|
1983
1891
|
// dist/geometry/gpu-geometry.js
|
|
1984
1892
|
var import_core7 = require("@luma.gl/core");
|
|
1893
|
+
|
|
1894
|
+
// dist/utils/uid.js
|
|
1895
|
+
var uidCounters = {};
|
|
1896
|
+
function uid(id = "id") {
|
|
1897
|
+
uidCounters[id] = uidCounters[id] || 1;
|
|
1898
|
+
const count = uidCounters[id]++;
|
|
1899
|
+
return `${id}-${count}`;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
// dist/geometry/gpu-geometry.js
|
|
1985
1903
|
var GPUGeometry = class {
|
|
1986
1904
|
/** Application-provided or generated identifier. */
|
|
1987
1905
|
id;
|
|
@@ -2059,10 +1977,10 @@ function getIndexBufferFromGeometry(device, geometry) {
|
|
|
2059
1977
|
return device.createBuffer({ usage: import_core7.Buffer.INDEX, data });
|
|
2060
1978
|
}
|
|
2061
1979
|
function getAttributeBuffersFromGeometry(device, geometry) {
|
|
2062
|
-
var _a;
|
|
1980
|
+
var _a, _b;
|
|
2063
1981
|
const attributes = {};
|
|
2064
1982
|
for (const [attributeName, attribute] of Object.entries(geometry.attributes)) {
|
|
2065
|
-
const name = ((_a = geometry.bufferLayout.find((bufferLayout) => bufferLayout.name === attributeName)) == null ? void 0 :
|
|
1983
|
+
const name = ((_b = (_a = geometry.bufferLayout) == null ? void 0 : _a.find((bufferLayout) => bufferLayout.name === attributeName)) == null ? void 0 : _b.name) || getGeometryShaderAttributeName(attributeName);
|
|
2066
1984
|
if (attribute) {
|
|
2067
1985
|
attributes[name] = device.createBuffer({
|
|
2068
1986
|
data: attribute.value,
|
|
@@ -2072,7 +1990,7 @@ function getAttributeBuffersFromGeometry(device, geometry) {
|
|
|
2072
1990
|
}
|
|
2073
1991
|
return {
|
|
2074
1992
|
attributes,
|
|
2075
|
-
bufferLayout: geometry.bufferLayout,
|
|
1993
|
+
bufferLayout: geometry.bufferLayout || getBufferLayoutFromGeometryAttributes(geometry.attributes),
|
|
2076
1994
|
vertexCount: geometry.vertexCount
|
|
2077
1995
|
};
|
|
2078
1996
|
}
|
|
@@ -2955,6 +2873,7 @@ var Model = class _Model {
|
|
|
2955
2873
|
static defaultProps = {
|
|
2956
2874
|
...import_core13.RenderPipeline.defaultProps,
|
|
2957
2875
|
source: void 0,
|
|
2876
|
+
sourceLanguage: void 0,
|
|
2958
2877
|
vs: null,
|
|
2959
2878
|
fs: null,
|
|
2960
2879
|
id: "unnamed",
|
|
@@ -3104,7 +3023,7 @@ var Model = class _Model {
|
|
|
3104
3023
|
if (isWebGPU && this.props.source) {
|
|
3105
3024
|
const shaderAssembler = this.props.shaderAssembler;
|
|
3106
3025
|
(0, import_core13.assert)(isShaderAssemblerForLanguage(shaderAssembler, "wgsl"));
|
|
3107
|
-
const { source: source4, getUniforms: getUniforms2, bindingTable, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
|
|
3026
|
+
const { source: source4, getUniforms: getUniforms2, bindingTable, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
|
|
3108
3027
|
platformInfo,
|
|
3109
3028
|
...this.props,
|
|
3110
3029
|
modules,
|
|
@@ -3114,6 +3033,8 @@ var Model = class _Model {
|
|
|
3114
3033
|
pluginVaryings: resolvedPlugins.varyings
|
|
3115
3034
|
});
|
|
3116
3035
|
this.source = source4;
|
|
3036
|
+
this.props.vertexEntryPoint = entryPoints.vertex || this.props.vertexEntryPoint;
|
|
3037
|
+
this.props.fragmentEntryPoint = entryPoints.fragment || this.props.fragmentEntryPoint;
|
|
3117
3038
|
this._getModuleUniforms = getUniforms2;
|
|
3118
3039
|
this._bindingTable = bindingTable;
|
|
3119
3040
|
const scannedOrReflectedShaderLayout = assembledShaderLayout ?? ((_a = device.getShaderLayout) == null ? void 0 : _a.call(device, this.source));
|
|
@@ -3478,9 +3399,12 @@ var Model = class _Model {
|
|
|
3478
3399
|
}
|
|
3479
3400
|
/**
|
|
3480
3401
|
* Sets attributes (buffers)
|
|
3402
|
+
* @param options.byteOffsets Optional byte offsets, keyed by buffer name, where each buffer's
|
|
3403
|
+
* vertex data starts. Buffers without an entry are bound at offset 0.
|
|
3481
3404
|
* @note Overrides any attributes previously set with the same name
|
|
3482
3405
|
*/
|
|
3483
3406
|
setAttributes(buffers, options) {
|
|
3407
|
+
var _a;
|
|
3484
3408
|
this._drawBlockedReason = false;
|
|
3485
3409
|
const disableWarnings = (options == null ? void 0 : options.disableWarnings) ?? this.props.disableWarnings;
|
|
3486
3410
|
if (buffers["indices"]) {
|
|
@@ -3509,11 +3433,13 @@ var Model = class _Model {
|
|
|
3509
3433
|
}
|
|
3510
3434
|
continue;
|
|
3511
3435
|
}
|
|
3512
|
-
|
|
3436
|
+
const byteOffset = ((_a = options == null ? void 0 : options.byteOffsets) == null ? void 0 : _a[bufferName]) ?? 0;
|
|
3437
|
+
this.vertexArray.setBuffer(bufferSlot, resolvedBuffer, byteOffset);
|
|
3513
3438
|
if (buffer instanceof DynamicBuffer) {
|
|
3514
3439
|
this._dynamicAttributeBufferSources[bufferSlot] = {
|
|
3515
3440
|
source: buffer,
|
|
3516
|
-
generation: buffer.generation
|
|
3441
|
+
generation: buffer.generation,
|
|
3442
|
+
byteOffset
|
|
3517
3443
|
};
|
|
3518
3444
|
} else {
|
|
3519
3445
|
delete this._dynamicAttributeBufferSources[bufferSlot];
|
|
@@ -3826,7 +3752,7 @@ var Model = class _Model {
|
|
|
3826
3752
|
}
|
|
3827
3753
|
for (const [locationKey, entry] of Object.entries(this._dynamicAttributeBufferSources)) {
|
|
3828
3754
|
if (entry.generation !== entry.source.generation) {
|
|
3829
|
-
this.vertexArray.setBuffer(Number(locationKey), entry.source.buffer);
|
|
3755
|
+
this.vertexArray.setBuffer(Number(locationKey), entry.source.buffer, entry.byteOffset);
|
|
3830
3756
|
entry.generation = entry.source.generation;
|
|
3831
3757
|
this.setNeedsRedraw("dynamic attribute buffer");
|
|
3832
3758
|
}
|
|
@@ -4418,26 +4344,30 @@ void main(void) {
|
|
|
4418
4344
|
}
|
|
4419
4345
|
`
|
|
4420
4346
|
);
|
|
4421
|
-
var
|
|
4347
|
+
var QUAD_POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];
|
|
4348
|
+
var TRIANGLE_POSITIONS = [-1, -1, 3, -1, -1, 3];
|
|
4422
4349
|
var ClipSpace = class extends Model {
|
|
4423
4350
|
constructor(device, props) {
|
|
4424
|
-
const
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4351
|
+
const { geometryType = "quad", ...modelProps } = props;
|
|
4352
|
+
const positions = geometryType === "triangle" ? TRIANGLE_POSITIONS : QUAD_POSITIONS;
|
|
4353
|
+
const textureCoordinates = positions.map((position) => (position + 1) / 2);
|
|
4354
|
+
const vertexCount = positions.length / 2;
|
|
4355
|
+
if (modelProps.source) {
|
|
4356
|
+
modelProps.source = `${CLIPSPACE_VERTEX_SHADER_WGSL}
|
|
4357
|
+
${modelProps.source}`;
|
|
4428
4358
|
}
|
|
4429
4359
|
super(device, {
|
|
4430
|
-
id:
|
|
4431
|
-
...
|
|
4360
|
+
id: modelProps.id || uid("clip-space"),
|
|
4361
|
+
...modelProps,
|
|
4432
4362
|
vs: CLIPSPACE_VERTEX_SHADER,
|
|
4433
|
-
vertexCount
|
|
4363
|
+
vertexCount,
|
|
4434
4364
|
geometry: new Geometry({
|
|
4435
|
-
topology: "triangle-strip",
|
|
4436
|
-
vertexCount
|
|
4365
|
+
topology: geometryType === "triangle" ? "triangle-list" : "triangle-strip",
|
|
4366
|
+
vertexCount,
|
|
4437
4367
|
attributes: {
|
|
4438
|
-
clipSpacePositions: { size: 2, value: new Float32Array(
|
|
4439
|
-
texCoords: { size: 2, value: new Float32Array(
|
|
4440
|
-
coordinates: { size: 2, value: new Float32Array(
|
|
4368
|
+
clipSpacePositions: { size: 2, value: new Float32Array(positions) },
|
|
4369
|
+
texCoords: { size: 2, value: new Float32Array(textureCoordinates) },
|
|
4370
|
+
coordinates: { size: 2, value: new Float32Array(textureCoordinates) }
|
|
4441
4371
|
}
|
|
4442
4372
|
})
|
|
4443
4373
|
});
|
|
@@ -5252,82 +5182,147 @@ var BackgroundTextureModel = class extends ClipSpace {
|
|
|
5252
5182
|
}
|
|
5253
5183
|
};
|
|
5254
5184
|
|
|
5255
|
-
// dist/
|
|
5256
|
-
var
|
|
5185
|
+
// dist/geometry/geometry-primitives.js
|
|
5186
|
+
var import_geometry7 = require("@math.gl/geometry");
|
|
5187
|
+
var CubeGeometry = class extends Geometry {
|
|
5257
5188
|
constructor(props = {}) {
|
|
5258
|
-
const
|
|
5259
|
-
const
|
|
5189
|
+
const source4 = new import_geometry7.CubeGeometry({ size: 2 });
|
|
5190
|
+
const faceIndices = new Uint32Array(24);
|
|
5191
|
+
const faceOrder = [4, 5, 2, 3, 0, 1];
|
|
5192
|
+
for (let vertexIndex = 0; vertexIndex < faceIndices.length; vertexIndex++) {
|
|
5193
|
+
faceIndices[vertexIndex] = faceOrder[Math.floor(vertexIndex / 4)];
|
|
5194
|
+
}
|
|
5195
|
+
source4.attributes["faceIndex"] = { size: 1, value: faceIndices };
|
|
5196
|
+
if (props.indices === false) {
|
|
5197
|
+
source4.attributes["COLOR_0"] = {
|
|
5198
|
+
size: 3,
|
|
5199
|
+
value: new Float32Array(Array.from(source4.attributes["POSITION"].value, (value) => (value + 1) / 2))
|
|
5200
|
+
};
|
|
5201
|
+
}
|
|
5202
|
+
const data = props.indices === false ? (0, import_geometry7.unpackIndexedGeometry)(source4) : source4;
|
|
5260
5203
|
super({
|
|
5204
|
+
id: props.id,
|
|
5205
|
+
topology: source4.topology,
|
|
5206
|
+
indices: props.indices === false ? void 0 : source4.indices,
|
|
5207
|
+
attributes: mergeAttributes(data.attributes, props.attributes)
|
|
5208
|
+
});
|
|
5209
|
+
}
|
|
5210
|
+
};
|
|
5211
|
+
var SphereGeometry = class extends Geometry {
|
|
5212
|
+
constructor(props = {}) {
|
|
5213
|
+
var _a;
|
|
5214
|
+
const source4 = new import_geometry7.SphereGeometry({
|
|
5261
5215
|
...props,
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5216
|
+
attributes: void 0,
|
|
5217
|
+
radius: props.radius ?? 1
|
|
5218
|
+
});
|
|
5219
|
+
for (const name of ["POSITION", "NORMAL"]) {
|
|
5220
|
+
const values = source4.attributes[name].value;
|
|
5221
|
+
for (let index = 0; index < values.length; index += 3) {
|
|
5222
|
+
const horizontal = values[index];
|
|
5223
|
+
values[index] = values[index + 2];
|
|
5224
|
+
values[index + 2] = horizontal;
|
|
5225
|
+
}
|
|
5226
|
+
}
|
|
5227
|
+
const indices = (_a = source4.indices) == null ? void 0 : _a.value;
|
|
5228
|
+
if (indices) {
|
|
5229
|
+
for (let index = 0; index < indices.length; index += 3) {
|
|
5230
|
+
const second = indices[index + 1];
|
|
5231
|
+
indices[index + 1] = indices[index + 2];
|
|
5232
|
+
indices[index + 2] = second;
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5235
|
+
super({ ...source4, attributes: { ...source4.attributes, ...props.attributes } });
|
|
5236
|
+
}
|
|
5237
|
+
};
|
|
5238
|
+
var IcoSphereGeometry = class extends Geometry {
|
|
5239
|
+
constructor(props = {}) {
|
|
5240
|
+
const source4 = new import_geometry7.IcoSphereGeometry({ ...props, radius: props.radius ?? 1 });
|
|
5241
|
+
super({ ...source4, attributes: source4.attributes });
|
|
5242
|
+
}
|
|
5243
|
+
};
|
|
5244
|
+
var TruncatedConeGeometry = class extends Geometry {
|
|
5245
|
+
constructor(props = {}) {
|
|
5246
|
+
const source4 = new import_geometry7.TruncatedConeGeometry({ ...props, bottomRadius: props.bottomRadius ?? 1 });
|
|
5247
|
+
super({ ...source4, attributes: source4.attributes });
|
|
5248
|
+
}
|
|
5249
|
+
};
|
|
5250
|
+
var CylinderGeometry = class extends TruncatedConeGeometry {
|
|
5251
|
+
constructor(props = {}) {
|
|
5252
|
+
const radius = props.radius ?? 1;
|
|
5253
|
+
super({ ...props, topRadius: radius, bottomRadius: radius });
|
|
5254
|
+
}
|
|
5255
|
+
};
|
|
5256
|
+
var ConeGeometry = class extends TruncatedConeGeometry {
|
|
5257
|
+
constructor(props = {}) {
|
|
5258
|
+
const cap = props.cap ?? true;
|
|
5259
|
+
super({ ...props, topRadius: 0, bottomRadius: props.radius ?? 1, topCap: cap, bottomCap: cap });
|
|
5260
|
+
}
|
|
5261
|
+
};
|
|
5262
|
+
var PlaneGeometry = class extends Geometry {
|
|
5263
|
+
constructor(props = {}) {
|
|
5264
|
+
const { type = "x,y", offset = 0, flipCull = false } = props;
|
|
5265
|
+
const planeAxes = {
|
|
5266
|
+
"x,y": { sizeX: props.xlen, sizeZ: props.ylen, nx: props.nx, nz: props.ny },
|
|
5267
|
+
"x,z": { sizeX: props.xlen, sizeZ: props.zlen, nx: props.nx, nz: props.nz },
|
|
5268
|
+
"y,z": { sizeX: props.ylen, sizeZ: props.zlen, nx: props.ny, nz: props.nz }
|
|
5269
|
+
}[type];
|
|
5270
|
+
if (!planeAxes)
|
|
5271
|
+
throw new Error("Invalid plane axes");
|
|
5272
|
+
const source4 = new import_geometry7.PlaneGeometry({
|
|
5273
|
+
sizeX: planeAxes.sizeX || 1,
|
|
5274
|
+
sizeZ: planeAxes.sizeZ || 1,
|
|
5275
|
+
nx: planeAxes.nx || 1,
|
|
5276
|
+
nz: planeAxes.nz || 1
|
|
5277
|
+
});
|
|
5278
|
+
orientPlane(source4, type, offset, flipCull);
|
|
5279
|
+
const data = props.unpack ? (0, import_geometry7.unpackIndexedGeometry)(source4) : source4;
|
|
5280
|
+
super({
|
|
5281
|
+
id: props.id,
|
|
5282
|
+
topology: source4.topology,
|
|
5283
|
+
indices: props.unpack ? void 0 : source4.indices,
|
|
5284
|
+
attributes: mergeAttributes(data.attributes, props.attributes)
|
|
5266
5285
|
});
|
|
5267
5286
|
}
|
|
5268
5287
|
};
|
|
5269
|
-
function
|
|
5270
|
-
const
|
|
5271
|
-
const
|
|
5272
|
-
const
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
const v = y / nlat;
|
|
5288
|
-
const index = x + y * (nlong + 1);
|
|
5289
|
-
const i2 = index * 2;
|
|
5290
|
-
const i3 = index * 3;
|
|
5291
|
-
const theta = longRange * u;
|
|
5292
|
-
const phi = latRange * v;
|
|
5293
|
-
const sinTheta = Math.sin(theta);
|
|
5294
|
-
const cosTheta = Math.cos(theta);
|
|
5295
|
-
const sinPhi = Math.sin(phi);
|
|
5296
|
-
const cosPhi = Math.cos(phi);
|
|
5297
|
-
const ux = cosTheta * sinPhi;
|
|
5298
|
-
const uy = cosPhi;
|
|
5299
|
-
const uz = sinTheta * sinPhi;
|
|
5300
|
-
const r = radius(ux, uy, uz, u, v);
|
|
5301
|
-
positions[i3 + 0] = r * ux;
|
|
5302
|
-
positions[i3 + 1] = r * uy;
|
|
5303
|
-
positions[i3 + 2] = r * uz;
|
|
5304
|
-
normals[i3 + 0] = ux;
|
|
5305
|
-
normals[i3 + 1] = uy;
|
|
5306
|
-
normals[i3 + 2] = uz;
|
|
5307
|
-
texCoords[i2 + 0] = u;
|
|
5308
|
-
texCoords[i2 + 1] = 1 - v;
|
|
5309
|
-
}
|
|
5310
|
-
}
|
|
5311
|
-
const numVertsAround = nlong + 1;
|
|
5312
|
-
for (let x = 0; x < nlong; x++) {
|
|
5313
|
-
for (let y = 0; y < nlat; y++) {
|
|
5314
|
-
const index = (x * nlat + y) * 6;
|
|
5315
|
-
indices[index + 0] = y * numVertsAround + x;
|
|
5316
|
-
indices[index + 1] = y * numVertsAround + x + 1;
|
|
5317
|
-
indices[index + 2] = (y + 1) * numVertsAround + x;
|
|
5318
|
-
indices[index + 3] = (y + 1) * numVertsAround + x;
|
|
5319
|
-
indices[index + 4] = y * numVertsAround + x + 1;
|
|
5320
|
-
indices[index + 5] = (y + 1) * numVertsAround + x + 1;
|
|
5288
|
+
function orientPlane(geometry, type, offset, flipCull) {
|
|
5289
|
+
const positions = geometry.attributes["POSITION"].value;
|
|
5290
|
+
const normals = geometry.attributes["NORMAL"].value;
|
|
5291
|
+
const texCoords = geometry.attributes["TEXCOORD_0"].value;
|
|
5292
|
+
for (let vertexIndex = 0; vertexIndex < positions.length / 3; vertexIndex++) {
|
|
5293
|
+
const positionIndex = vertexIndex * 3;
|
|
5294
|
+
const horizontal = Number(positions[positionIndex]) * (flipCull ? -1 : 1);
|
|
5295
|
+
const vertical = -Number(positions[positionIndex + 2]);
|
|
5296
|
+
const normal = flipCull ? 1 : -1;
|
|
5297
|
+
if (type === "x,y") {
|
|
5298
|
+
positions.set([horizontal, vertical, offset], positionIndex);
|
|
5299
|
+
normals.set([0, 0, normal], positionIndex);
|
|
5300
|
+
} else if (type === "x,z") {
|
|
5301
|
+
positions.set([horizontal, offset, vertical], positionIndex);
|
|
5302
|
+
normals.set([0, normal, 0], positionIndex);
|
|
5303
|
+
} else {
|
|
5304
|
+
positions.set([offset, horizontal, vertical], positionIndex);
|
|
5305
|
+
normals.set([normal, 0, 0], positionIndex);
|
|
5321
5306
|
}
|
|
5307
|
+
if (flipCull)
|
|
5308
|
+
texCoords[vertexIndex * 2] = 1 - Number(texCoords[vertexIndex * 2]);
|
|
5322
5309
|
}
|
|
5323
|
-
|
|
5324
|
-
indices
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5310
|
+
if (type !== "x,z" && geometry.indices) {
|
|
5311
|
+
const indices = geometry.indices.value;
|
|
5312
|
+
for (let index = 0; index < indices.length; index += 3) {
|
|
5313
|
+
const second = indices[index + 1];
|
|
5314
|
+
indices[index + 1] = indices[index + 2];
|
|
5315
|
+
indices[index + 2] = second;
|
|
5329
5316
|
}
|
|
5330
|
-
}
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
function mergeAttributes(source4, overrides = {}) {
|
|
5320
|
+
const attributes = {};
|
|
5321
|
+
for (const [name, attribute] of Object.entries(source4)) {
|
|
5322
|
+
if (attribute)
|
|
5323
|
+
attributes[name] = attribute;
|
|
5324
|
+
}
|
|
5325
|
+
return { ...attributes, ...overrides };
|
|
5331
5326
|
}
|
|
5332
5327
|
|
|
5333
5328
|
// dist/models/light-model-utils.js
|
|
@@ -5730,121 +5725,6 @@ var PointLightModel = class extends BaseLightModel {
|
|
|
5730
5725
|
}
|
|
5731
5726
|
};
|
|
5732
5727
|
|
|
5733
|
-
// dist/geometries/truncated-cone-geometry.js
|
|
5734
|
-
var INDEX_OFFSETS = {
|
|
5735
|
-
x: [2, 0, 1],
|
|
5736
|
-
y: [0, 1, 2],
|
|
5737
|
-
z: [1, 2, 0]
|
|
5738
|
-
};
|
|
5739
|
-
var TruncatedConeGeometry = class extends Geometry {
|
|
5740
|
-
constructor(props = {}) {
|
|
5741
|
-
const { id = uid("truncated-code-geometry") } = props;
|
|
5742
|
-
const { indices, attributes } = tesselateTruncatedCone(props);
|
|
5743
|
-
super({
|
|
5744
|
-
...props,
|
|
5745
|
-
id,
|
|
5746
|
-
topology: "triangle-list",
|
|
5747
|
-
indices,
|
|
5748
|
-
attributes: {
|
|
5749
|
-
POSITION: { size: 3, value: attributes.POSITION },
|
|
5750
|
-
NORMAL: { size: 3, value: attributes.NORMAL },
|
|
5751
|
-
TEXCOORD_0: { size: 2, value: attributes.TEXCOORD_0 },
|
|
5752
|
-
...props.attributes
|
|
5753
|
-
}
|
|
5754
|
-
});
|
|
5755
|
-
}
|
|
5756
|
-
};
|
|
5757
|
-
function tesselateTruncatedCone(props = {}) {
|
|
5758
|
-
const { bottomRadius = 0, topRadius = 0, height = 1, nradial = 10, nvertical = 10, verticalAxis = "y", topCap = false, bottomCap = false } = props;
|
|
5759
|
-
const extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0);
|
|
5760
|
-
const numVertices = (nradial + 1) * (nvertical + 1 + extra);
|
|
5761
|
-
const slant = Math.atan2(bottomRadius - topRadius, height);
|
|
5762
|
-
const msin = Math.sin;
|
|
5763
|
-
const mcos = Math.cos;
|
|
5764
|
-
const mpi = Math.PI;
|
|
5765
|
-
const cosSlant = mcos(slant);
|
|
5766
|
-
const sinSlant = msin(slant);
|
|
5767
|
-
const start = topCap ? -2 : 0;
|
|
5768
|
-
const end = nvertical + (bottomCap ? 2 : 0);
|
|
5769
|
-
const vertsAroundEdge = nradial + 1;
|
|
5770
|
-
const indices = new Uint16Array(nradial * (nvertical + extra) * 6);
|
|
5771
|
-
const indexOffset = INDEX_OFFSETS[verticalAxis];
|
|
5772
|
-
const positions = new Float32Array(numVertices * 3);
|
|
5773
|
-
const normals = new Float32Array(numVertices * 3);
|
|
5774
|
-
const texCoords = new Float32Array(numVertices * 2);
|
|
5775
|
-
let i3 = 0;
|
|
5776
|
-
let i2 = 0;
|
|
5777
|
-
for (let i = start; i <= end; i++) {
|
|
5778
|
-
let v = i / nvertical;
|
|
5779
|
-
let y = height * v;
|
|
5780
|
-
let ringRadius;
|
|
5781
|
-
if (i < 0) {
|
|
5782
|
-
y = 0;
|
|
5783
|
-
v = 1;
|
|
5784
|
-
ringRadius = bottomRadius;
|
|
5785
|
-
} else if (i > nvertical) {
|
|
5786
|
-
y = height;
|
|
5787
|
-
v = 1;
|
|
5788
|
-
ringRadius = topRadius;
|
|
5789
|
-
} else {
|
|
5790
|
-
ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical);
|
|
5791
|
-
}
|
|
5792
|
-
if (i === -2 || i === nvertical + 2) {
|
|
5793
|
-
ringRadius = 0;
|
|
5794
|
-
v = 0;
|
|
5795
|
-
}
|
|
5796
|
-
y -= height / 2;
|
|
5797
|
-
for (let j = 0; j < vertsAroundEdge; j++) {
|
|
5798
|
-
const sin = msin(j * mpi * 2 / nradial);
|
|
5799
|
-
const cos = mcos(j * mpi * 2 / nradial);
|
|
5800
|
-
positions[i3 + indexOffset[0]] = sin * ringRadius;
|
|
5801
|
-
positions[i3 + indexOffset[1]] = y;
|
|
5802
|
-
positions[i3 + indexOffset[2]] = cos * ringRadius;
|
|
5803
|
-
normals[i3 + indexOffset[0]] = i < 0 || i > nvertical ? 0 : sin * cosSlant;
|
|
5804
|
-
normals[i3 + indexOffset[1]] = i < 0 ? -1 : i > nvertical ? 1 : sinSlant;
|
|
5805
|
-
normals[i3 + indexOffset[2]] = i < 0 || i > nvertical ? 0 : cos * cosSlant;
|
|
5806
|
-
texCoords[i2 + 0] = j / nradial;
|
|
5807
|
-
texCoords[i2 + 1] = v;
|
|
5808
|
-
i2 += 2;
|
|
5809
|
-
i3 += 3;
|
|
5810
|
-
}
|
|
5811
|
-
}
|
|
5812
|
-
for (let i = 0; i < nvertical + extra; i++) {
|
|
5813
|
-
for (let j = 0; j < nradial; j++) {
|
|
5814
|
-
const index = (i * nradial + j) * 6;
|
|
5815
|
-
indices[index + 0] = vertsAroundEdge * (i + 0) + 0 + j;
|
|
5816
|
-
indices[index + 1] = vertsAroundEdge * (i + 0) + 1 + j;
|
|
5817
|
-
indices[index + 2] = vertsAroundEdge * (i + 1) + 1 + j;
|
|
5818
|
-
indices[index + 3] = vertsAroundEdge * (i + 0) + 0 + j;
|
|
5819
|
-
indices[index + 4] = vertsAroundEdge * (i + 1) + 1 + j;
|
|
5820
|
-
indices[index + 5] = vertsAroundEdge * (i + 1) + 0 + j;
|
|
5821
|
-
}
|
|
5822
|
-
}
|
|
5823
|
-
return {
|
|
5824
|
-
indices,
|
|
5825
|
-
attributes: {
|
|
5826
|
-
POSITION: positions,
|
|
5827
|
-
NORMAL: normals,
|
|
5828
|
-
TEXCOORD_0: texCoords
|
|
5829
|
-
}
|
|
5830
|
-
};
|
|
5831
|
-
}
|
|
5832
|
-
|
|
5833
|
-
// dist/geometries/cone-geometry.js
|
|
5834
|
-
var ConeGeometry = class extends TruncatedConeGeometry {
|
|
5835
|
-
constructor(props = {}) {
|
|
5836
|
-
const { id = uid("cone-geometry"), radius = 1, cap = true } = props;
|
|
5837
|
-
super({
|
|
5838
|
-
...props,
|
|
5839
|
-
id,
|
|
5840
|
-
topRadius: 0,
|
|
5841
|
-
topCap: Boolean(cap),
|
|
5842
|
-
bottomCap: Boolean(cap),
|
|
5843
|
-
bottomRadius: radius
|
|
5844
|
-
});
|
|
5845
|
-
}
|
|
5846
|
-
};
|
|
5847
|
-
|
|
5848
5728
|
// dist/models/spot-light-model.js
|
|
5849
5729
|
var SPOT_LIGHT_GEOMETRY = new ConeGeometry({
|
|
5850
5730
|
cap: true,
|
|
@@ -6210,13 +6090,303 @@ function getInstancedScenegraphBounds(bounds, instanceMatrices) {
|
|
|
6210
6090
|
return areScenegraphBoundsDefined(instancedBounds) ? instancedBounds : null;
|
|
6211
6091
|
}
|
|
6212
6092
|
|
|
6213
|
-
// dist/geometry/
|
|
6093
|
+
// dist/geometry/edge-geometry.js
|
|
6214
6094
|
var import_core23 = require("@luma.gl/core");
|
|
6095
|
+
function makeEdgeGeometry(geometry, options = {}) {
|
|
6096
|
+
var _a;
|
|
6097
|
+
const { angleThreshold = 30, weldTolerance = 0, positionAttribute = "POSITION" } = options;
|
|
6098
|
+
const positions = getTrianglePositions(geometry, positionAttribute);
|
|
6099
|
+
(0, import_core23.assert)(Number.isFinite(weldTolerance) && weldTolerance >= 0);
|
|
6100
|
+
(0, import_core23.assert)(Number.isFinite(angleThreshold) && angleThreshold >= 0 && angleThreshold <= 180);
|
|
6101
|
+
const sourceIndices = (_a = geometry.indices) == null ? void 0 : _a.value;
|
|
6102
|
+
const sourceCount = positions.value.length / 3;
|
|
6103
|
+
const representatives = /* @__PURE__ */ new Map();
|
|
6104
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
6105
|
+
const faces = /* @__PURE__ */ new Set();
|
|
6106
|
+
const edges = /* @__PURE__ */ new Map();
|
|
6107
|
+
const cosineThreshold = Math.cos(angleThreshold * Math.PI / 180);
|
|
6108
|
+
const toleranceSquared = weldTolerance * weldTolerance;
|
|
6109
|
+
function readPosition(index) {
|
|
6110
|
+
return [
|
|
6111
|
+
positions.value[index * 3],
|
|
6112
|
+
positions.value[index * 3 + 1],
|
|
6113
|
+
positions.value[index * 3 + 2]
|
|
6114
|
+
];
|
|
6115
|
+
}
|
|
6116
|
+
function weldPosition(index) {
|
|
6117
|
+
const cached = representatives.get(index);
|
|
6118
|
+
if (cached !== void 0)
|
|
6119
|
+
return cached;
|
|
6120
|
+
(0, import_core23.assert)(Number.isInteger(index) && index >= 0 && index < sourceCount);
|
|
6121
|
+
const position = readPosition(index);
|
|
6122
|
+
(0, import_core23.assert)(position.every(Number.isFinite));
|
|
6123
|
+
const cell = weldTolerance > 0 ? position.map((value) => Math.floor(value / weldTolerance)) : position;
|
|
6124
|
+
const radius = weldTolerance > 0 ? 1 : 0;
|
|
6125
|
+
for (let east = -radius; east <= radius; east++) {
|
|
6126
|
+
for (let north = -radius; north <= radius; north++) {
|
|
6127
|
+
for (let up = -radius; up <= radius; up++) {
|
|
6128
|
+
const candidates = buckets.get(`${cell[0] + east},${cell[1] + north},${cell[2] + up}`);
|
|
6129
|
+
for (const candidate of candidates || []) {
|
|
6130
|
+
const other = readPosition(candidate);
|
|
6131
|
+
const distanceSquared = (position[0] - other[0]) ** 2 + (position[1] - other[1]) ** 2 + (position[2] - other[2]) ** 2;
|
|
6132
|
+
if (distanceSquared <= toleranceSquared) {
|
|
6133
|
+
representatives.set(index, candidate);
|
|
6134
|
+
return candidate;
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
}
|
|
6138
|
+
}
|
|
6139
|
+
}
|
|
6140
|
+
const key = cell.join(",");
|
|
6141
|
+
const bucket = buckets.get(key) || [];
|
|
6142
|
+
bucket.push(index);
|
|
6143
|
+
buckets.set(key, bucket);
|
|
6144
|
+
representatives.set(index, index);
|
|
6145
|
+
return index;
|
|
6146
|
+
}
|
|
6147
|
+
function addEdge(first, second, normal) {
|
|
6148
|
+
const start = Math.min(first, second);
|
|
6149
|
+
const end = Math.max(first, second);
|
|
6150
|
+
const key = `${start},${end}`;
|
|
6151
|
+
const edge = edges.get(key);
|
|
6152
|
+
if (edge) {
|
|
6153
|
+
edge.faceCount++;
|
|
6154
|
+
const cosine = normal[0] * edge.normal[0] + normal[1] * edge.normal[1] + normal[2] * edge.normal[2];
|
|
6155
|
+
edge.crease ||= cosine < 1 - 1e-7 && cosine <= cosineThreshold + 1e-7;
|
|
6156
|
+
} else {
|
|
6157
|
+
edges.set(key, { start, end, normal, faceCount: 1, crease: false });
|
|
6158
|
+
}
|
|
6159
|
+
}
|
|
6160
|
+
for (let offset = 0; offset < geometry.vertexCount; offset += 3) {
|
|
6161
|
+
const first = weldPosition((sourceIndices == null ? void 0 : sourceIndices[offset]) ?? offset);
|
|
6162
|
+
const second = weldPosition((sourceIndices == null ? void 0 : sourceIndices[offset + 1]) ?? offset + 1);
|
|
6163
|
+
const third = weldPosition((sourceIndices == null ? void 0 : sourceIndices[offset + 2]) ?? offset + 2);
|
|
6164
|
+
if (first === second || second === third || third === first)
|
|
6165
|
+
continue;
|
|
6166
|
+
const faceKey = [first, second, third].sort((left, right) => left - right).join(",");
|
|
6167
|
+
if (faces.has(faceKey))
|
|
6168
|
+
continue;
|
|
6169
|
+
faces.add(faceKey);
|
|
6170
|
+
const start = readPosition(first);
|
|
6171
|
+
const end = readPosition(second);
|
|
6172
|
+
const corner = readPosition(third);
|
|
6173
|
+
const firstDirection = end.map((value, axis) => value - start[axis]);
|
|
6174
|
+
const secondDirection = corner.map((value, axis) => value - start[axis]);
|
|
6175
|
+
const normal = [
|
|
6176
|
+
firstDirection[1] * secondDirection[2] - firstDirection[2] * secondDirection[1],
|
|
6177
|
+
firstDirection[2] * secondDirection[0] - firstDirection[0] * secondDirection[2],
|
|
6178
|
+
firstDirection[0] * secondDirection[1] - firstDirection[1] * secondDirection[0]
|
|
6179
|
+
];
|
|
6180
|
+
const magnitude = Math.hypot(...normal);
|
|
6181
|
+
if (magnitude === 0)
|
|
6182
|
+
continue;
|
|
6183
|
+
normal[0] /= magnitude;
|
|
6184
|
+
normal[1] /= magnitude;
|
|
6185
|
+
normal[2] /= magnitude;
|
|
6186
|
+
addEdge(first, second, normal);
|
|
6187
|
+
addEdge(second, third, normal);
|
|
6188
|
+
addEdge(third, first, normal);
|
|
6189
|
+
}
|
|
6190
|
+
const selected = [...edges.values()].filter((edge) => options.includeCoplanarEdges || edge.faceCount !== 2 || edge.crease).sort((left, right) => left.start - right.start || left.end - right.end);
|
|
6191
|
+
return new Geometry({
|
|
6192
|
+
id: `${geometry.id}-edges`,
|
|
6193
|
+
topology: "line-list",
|
|
6194
|
+
attributes: { [positionAttribute]: positions },
|
|
6195
|
+
indices: new Uint32Array(selected.flatMap((edge) => [edge.start, edge.end]))
|
|
6196
|
+
});
|
|
6197
|
+
}
|
|
6198
|
+
function makeEdgeGeometryFromGeometries(geometries, options = {}) {
|
|
6199
|
+
var _a;
|
|
6200
|
+
(0, import_core23.assert)(geometries.length > 0);
|
|
6201
|
+
const positionAttribute = options.positionAttribute ?? "POSITION";
|
|
6202
|
+
const attributes = geometries.map((geometry) => getTrianglePositions(geometry, positionAttribute));
|
|
6203
|
+
const firstAttribute = attributes[0];
|
|
6204
|
+
(0, import_core23.assert)(attributes.every((attribute) => attribute.value.constructor === firstAttribute.value.constructor && Boolean(attribute["normalized"]) === Boolean(firstAttribute["normalized"])));
|
|
6205
|
+
const PositionArray = firstAttribute.value.constructor;
|
|
6206
|
+
const positions = new PositionArray(attributes.reduce((count, attribute) => count + attribute.value.length, 0));
|
|
6207
|
+
const indices = new Uint32Array(geometries.reduce((count, geometry) => count + geometry.vertexCount, 0));
|
|
6208
|
+
let positionOffset = 0;
|
|
6209
|
+
let indexOffset = 0;
|
|
6210
|
+
for (const [geometryIndex, geometry] of geometries.entries()) {
|
|
6211
|
+
const attribute = attributes[geometryIndex];
|
|
6212
|
+
positions.set(attribute.value, positionOffset);
|
|
6213
|
+
for (let offset = 0; offset < geometry.vertexCount; offset++) {
|
|
6214
|
+
const index = ((_a = geometry.indices) == null ? void 0 : _a.value[offset]) ?? offset;
|
|
6215
|
+
(0, import_core23.assert)(Number.isInteger(index) && index >= 0 && index < attribute.value.length / 3);
|
|
6216
|
+
indices[indexOffset++] = index + positionOffset / 3;
|
|
6217
|
+
}
|
|
6218
|
+
positionOffset += attribute.value.length;
|
|
6219
|
+
}
|
|
6220
|
+
return makeEdgeGeometry(new Geometry({
|
|
6221
|
+
id: `${geometries[0].id}-batch`,
|
|
6222
|
+
topology: "triangle-list",
|
|
6223
|
+
attributes: { [positionAttribute]: { ...firstAttribute, value: positions } },
|
|
6224
|
+
indices
|
|
6225
|
+
}), options);
|
|
6226
|
+
}
|
|
6227
|
+
function getTrianglePositions(geometry, positionAttribute) {
|
|
6228
|
+
var _a;
|
|
6229
|
+
const positions = geometry.attributes[positionAttribute];
|
|
6230
|
+
(0, import_core23.assert)(geometry.topology === "triangle-list" && (positions == null ? void 0 : positions.size) === 3);
|
|
6231
|
+
(0, import_core23.assert)(positions.value.length % 3 === 0 && geometry.vertexCount % 3 === 0);
|
|
6232
|
+
(0, import_core23.assert)(!positions["byteStride"] || positions["byteStride"] === positions.value.BYTES_PER_ELEMENT * 3);
|
|
6233
|
+
(0, import_core23.assert)(geometry.vertexCount >= 0 && geometry.vertexCount <= (((_a = geometry.indices) == null ? void 0 : _a.value.length) ?? positions.value.length / 3));
|
|
6234
|
+
return positions;
|
|
6235
|
+
}
|
|
6236
|
+
|
|
6237
|
+
// dist/geometry/stroke-geometry.js
|
|
6238
|
+
var import_core24 = require("@luma.gl/core");
|
|
6239
|
+
function makeStrokeGeometry(path, options = {}) {
|
|
6240
|
+
const { width = 1, cap = "butt", join = "miter", miterLimit = 4, roundSegments = 16 } = options;
|
|
6241
|
+
(0, import_core24.assert)(Number.isFinite(width) && width >= 0 && Number.isFinite(miterLimit) && miterLimit >= 1);
|
|
6242
|
+
(0, import_core24.assert)(Number.isInteger(roundSegments) && roundSegments >= 2 && roundSegments <= 256);
|
|
6243
|
+
const points = [];
|
|
6244
|
+
for (const position of path) {
|
|
6245
|
+
(0, import_core24.assert)(Number.isFinite(position[0]) && Number.isFinite(position[1]) && Number.isFinite(position[2] ?? 0));
|
|
6246
|
+
const previous = points.at(-1);
|
|
6247
|
+
if (!previous || previous[0] !== position[0] || previous[1] !== position[1])
|
|
6248
|
+
points.push([position[0], position[1], position[2] ?? 0]);
|
|
6249
|
+
}
|
|
6250
|
+
if (options.closed && points.length > 1 && points[0][0] === points.at(-1)[0] && points[0][1] === points.at(-1)[1])
|
|
6251
|
+
points.pop();
|
|
6252
|
+
const closed = Boolean(options.closed && points.length > 2);
|
|
6253
|
+
const positions = [];
|
|
6254
|
+
const coordinates = [];
|
|
6255
|
+
const halfWidth = width / 2;
|
|
6256
|
+
if (points.length > 1 && width > 0) {
|
|
6257
|
+
const segments = [];
|
|
6258
|
+
const distances = [0];
|
|
6259
|
+
for (let index = 0; index < points.length - (closed ? 0 : 1); index++) {
|
|
6260
|
+
const start = points[index];
|
|
6261
|
+
const end = points[(index + 1) % points.length];
|
|
6262
|
+
const horizontal = end[0] - start[0];
|
|
6263
|
+
const vertical = end[1] - start[1];
|
|
6264
|
+
const length = Math.hypot(horizontal, vertical);
|
|
6265
|
+
segments.push({ direction: [horizontal / length, vertical / length], length });
|
|
6266
|
+
distances.push(distances.at(-1) + length);
|
|
6267
|
+
}
|
|
6268
|
+
const corners = points.map((point, index) => {
|
|
6269
|
+
const previous = segments[(index - 1 + segments.length) % segments.length];
|
|
6270
|
+
const next = segments[index % segments.length];
|
|
6271
|
+
const distance = distances[index];
|
|
6272
|
+
if (!closed && (index === 0 || index === points.length - 1)) {
|
|
6273
|
+
const direction = index === 0 ? next.direction : previous.direction;
|
|
6274
|
+
const extension = cap === "square" ? index === 0 ? -halfWidth : halfWidth : 0;
|
|
6275
|
+
const left = createVertex(point, direction, halfWidth, extension, distance + extension);
|
|
6276
|
+
const right = createVertex(point, direction, -halfWidth, extension, distance + extension);
|
|
6277
|
+
if (cap === "round")
|
|
6278
|
+
appendCap(point, direction, distance, index === 0);
|
|
6279
|
+
return { incomingLeft: left, outgoingLeft: left, incomingRight: right, outgoingRight: right };
|
|
6280
|
+
}
|
|
6281
|
+
const incoming = previous.direction;
|
|
6282
|
+
const outgoing = next.direction;
|
|
6283
|
+
const turn = incoming[0] * outgoing[1] - incoming[1] * outgoing[0];
|
|
6284
|
+
const cosine = incoming[0] * outgoing[0] + incoming[1] * outgoing[1];
|
|
6285
|
+
const result = {
|
|
6286
|
+
incomingLeft: createVertex(point, incoming, halfWidth, 0, distance),
|
|
6287
|
+
incomingRight: createVertex(point, incoming, -halfWidth, 0, distance),
|
|
6288
|
+
outgoingLeft: createVertex(point, outgoing, halfWidth, 0, distance),
|
|
6289
|
+
outgoingRight: createVertex(point, outgoing, -halfWidth, 0, distance)
|
|
6290
|
+
};
|
|
6291
|
+
if (1 + cosine < 1e-8) {
|
|
6292
|
+
if (join === "round") {
|
|
6293
|
+
appendCap(point, incoming, distance, false);
|
|
6294
|
+
appendCap(point, outgoing, distance, true);
|
|
6295
|
+
}
|
|
6296
|
+
return result;
|
|
6297
|
+
}
|
|
6298
|
+
const miter = [
|
|
6299
|
+
-(incoming[1] + outgoing[1]) * halfWidth / (1 + cosine),
|
|
6300
|
+
(incoming[0] + outgoing[0]) * halfWidth / (1 + cosine)
|
|
6301
|
+
];
|
|
6302
|
+
const miterLength = Math.hypot(...miter);
|
|
6303
|
+
if (Math.abs(turn) < 1e-8 || join === "miter" && miterLength <= miterLimit * halfWidth) {
|
|
6304
|
+
const left = offsetVertex(point, miter, distance, halfWidth);
|
|
6305
|
+
const right = offsetVertex(point, [-miter[0], -miter[1]], distance, -halfWidth);
|
|
6306
|
+
return { incomingLeft: left, outgoingLeft: left, incomingRight: right, outgoingRight: right };
|
|
6307
|
+
}
|
|
6308
|
+
const innerSide = Math.sign(turn);
|
|
6309
|
+
const innerScale = Math.min(1, Math.min(previous.length, next.length) / (2 * miterLength));
|
|
6310
|
+
const inner = offsetVertex(point, [miter[0] * innerSide * innerScale, miter[1] * innerSide * innerScale], distance, halfWidth * innerSide);
|
|
6311
|
+
if (innerSide > 0) {
|
|
6312
|
+
result.incomingLeft = inner;
|
|
6313
|
+
result.outgoingLeft = inner;
|
|
6314
|
+
} else {
|
|
6315
|
+
result.incomingRight = inner;
|
|
6316
|
+
result.outgoingRight = inner;
|
|
6317
|
+
}
|
|
6318
|
+
const outerStart = innerSide > 0 ? result.incomingRight : result.incomingLeft;
|
|
6319
|
+
const outerEnd = innerSide > 0 ? result.outgoingRight : result.outgoingLeft;
|
|
6320
|
+
if (join === "round") {
|
|
6321
|
+
const sweep = Math.atan2(turn, cosine);
|
|
6322
|
+
const startAngle = Math.atan2(outerStart.position[1] - point[1], outerStart.position[0] - point[0]);
|
|
6323
|
+
const steps = Math.max(1, Math.ceil(Math.abs(sweep) / Math.PI * roundSegments));
|
|
6324
|
+
let previousOuter = outerStart;
|
|
6325
|
+
for (let step = 1; step <= steps; step++) {
|
|
6326
|
+
const angle = startAngle + sweep * step / steps;
|
|
6327
|
+
const currentOuter = step === steps ? outerEnd : offsetVertex(point, [Math.cos(angle) * halfWidth, Math.sin(angle) * halfWidth], distance, -halfWidth * innerSide);
|
|
6328
|
+
appendTriangle(inner, previousOuter, currentOuter);
|
|
6329
|
+
previousOuter = currentOuter;
|
|
6330
|
+
}
|
|
6331
|
+
} else
|
|
6332
|
+
appendTriangle(inner, outerStart, outerEnd);
|
|
6333
|
+
return result;
|
|
6334
|
+
});
|
|
6335
|
+
segments.forEach((_segment, index) => {
|
|
6336
|
+
const start = corners[index];
|
|
6337
|
+
const end = corners[(index + 1) % corners.length];
|
|
6338
|
+
const closing = closed && index === segments.length - 1;
|
|
6339
|
+
const endLeft = closing ? { ...end.incomingLeft, distance: distances.at(-1) } : end.incomingLeft;
|
|
6340
|
+
const endRight = closing ? { ...end.incomingRight, distance: distances.at(-1) } : end.incomingRight;
|
|
6341
|
+
appendTriangle(start.outgoingLeft, start.outgoingRight, endLeft);
|
|
6342
|
+
appendTriangle(start.outgoingRight, endRight, endLeft);
|
|
6343
|
+
});
|
|
6344
|
+
}
|
|
6345
|
+
return new Geometry({
|
|
6346
|
+
id: options.id,
|
|
6347
|
+
topology: "triangle-list",
|
|
6348
|
+
attributes: {
|
|
6349
|
+
POSITION: { size: 3, value: new Float32Array(positions) },
|
|
6350
|
+
TEXCOORD_0: { size: 2, value: new Float32Array(coordinates) }
|
|
6351
|
+
}
|
|
6352
|
+
});
|
|
6353
|
+
function appendTriangle(first, second, third) {
|
|
6354
|
+
const area = (second.position[0] - first.position[0]) * (third.position[1] - first.position[1]) - (second.position[1] - first.position[1]) * (third.position[0] - first.position[0]);
|
|
6355
|
+
if (area === 0)
|
|
6356
|
+
return;
|
|
6357
|
+
for (const vertex of area > 0 ? [first, second, third] : [first, third, second]) {
|
|
6358
|
+
positions.push(...vertex.position);
|
|
6359
|
+
coordinates.push(vertex.distance, vertex.across);
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
function offsetVertex(point, offset, distance, across) {
|
|
6363
|
+
return { position: [point[0] + offset[0], point[1] + offset[1], point[2]], distance, across };
|
|
6364
|
+
}
|
|
6365
|
+
function createVertex(point, direction, across, along, distance) {
|
|
6366
|
+
return offsetVertex(point, [-direction[1] * across + direction[0] * along, direction[0] * across + direction[1] * along], distance, across);
|
|
6367
|
+
}
|
|
6368
|
+
function appendCap(point, direction, distance, start) {
|
|
6369
|
+
const center = { position: point, distance, across: 0 };
|
|
6370
|
+
const startAngle = Math.atan2(direction[1], direction[0]) + (start ? -Math.PI / 2 : Math.PI / 2);
|
|
6371
|
+
let previous;
|
|
6372
|
+
for (let step = 0; step <= roundSegments; step++) {
|
|
6373
|
+
const angle = startAngle - Math.PI * step / roundSegments;
|
|
6374
|
+
const offset = [Math.cos(angle) * halfWidth, Math.sin(angle) * halfWidth];
|
|
6375
|
+
const current = offsetVertex(point, offset, distance + offset[0] * direction[0] + offset[1] * direction[1], -offset[0] * direction[1] + offset[1] * direction[0]);
|
|
6376
|
+
if (previous)
|
|
6377
|
+
appendTriangle(center, previous, current);
|
|
6378
|
+
previous = current;
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
|
|
6383
|
+
// dist/geometry/mesh-simplification.js
|
|
6384
|
+
var import_core25 = require("@luma.gl/core");
|
|
6215
6385
|
var QUADRIC_COMPONENTS = 10;
|
|
6216
6386
|
var BOUNDARY_COLLINEAR_TOLERANCE = 1e-10;
|
|
6217
6387
|
function simplifyMesh(options) {
|
|
6218
6388
|
const { positions, indices, attributes = [], preserveBoundary = true } = options;
|
|
6219
|
-
(0,
|
|
6389
|
+
(0, import_core25.assert)(indices.length % 3 === 0 && positions.length % 3 === 0);
|
|
6220
6390
|
const targetIndexCount = Math.max(0, Math.min(indices.length, Math.floor((options.targetIndexCount ?? indices.length * (options.targetRatio ?? 0.5)) / 3) * 3));
|
|
6221
6391
|
if (indices.length === 0 || targetIndexCount >= indices.length) {
|
|
6222
6392
|
return { indices: indices.slice(), geometricError: 0 };
|
|
@@ -6303,7 +6473,7 @@ function simplifyMesh(options) {
|
|
|
6303
6473
|
const firstVertex = indices[indexOffset2];
|
|
6304
6474
|
const secondVertex = indices[indexOffset2 + 1];
|
|
6305
6475
|
const thirdVertex = indices[indexOffset2 + 2];
|
|
6306
|
-
(0,
|
|
6476
|
+
(0, import_core25.assert)(firstVertex < vertexCount && secondVertex < vertexCount && thirdVertex < vertexCount);
|
|
6307
6477
|
const triangle = {
|
|
6308
6478
|
vertices: [firstVertex, secondVertex, thirdVertex],
|
|
6309
6479
|
active: false
|
|
@@ -6571,935 +6741,6 @@ function compareCollapses(first, second) {
|
|
|
6571
6741
|
return first.cost - second.cost || first.retainedVertex - second.retainedVertex || first.removedVertex - second.removedVertex;
|
|
6572
6742
|
}
|
|
6573
6743
|
|
|
6574
|
-
// dist/geometries/cube-geometry.js
|
|
6575
|
-
var CubeGeometry = class extends Geometry {
|
|
6576
|
-
constructor(props = {}) {
|
|
6577
|
-
const { id = uid("cube-geometry"), indices = true } = props;
|
|
6578
|
-
super(indices ? {
|
|
6579
|
-
...props,
|
|
6580
|
-
id,
|
|
6581
|
-
topology: "triangle-list",
|
|
6582
|
-
indices: { size: 1, value: CUBE_INDICES },
|
|
6583
|
-
attributes: { ...ATTRIBUTES, ...props.attributes }
|
|
6584
|
-
} : {
|
|
6585
|
-
...props,
|
|
6586
|
-
id,
|
|
6587
|
-
topology: "triangle-list",
|
|
6588
|
-
indices: void 0,
|
|
6589
|
-
attributes: { ...NON_INDEXED_ATTRIBUTES, ...props.attributes }
|
|
6590
|
-
});
|
|
6591
|
-
}
|
|
6592
|
-
};
|
|
6593
|
-
var CUBE_INDICES = new Uint16Array([
|
|
6594
|
-
0,
|
|
6595
|
-
1,
|
|
6596
|
-
2,
|
|
6597
|
-
0,
|
|
6598
|
-
2,
|
|
6599
|
-
3,
|
|
6600
|
-
4,
|
|
6601
|
-
5,
|
|
6602
|
-
6,
|
|
6603
|
-
4,
|
|
6604
|
-
6,
|
|
6605
|
-
7,
|
|
6606
|
-
8,
|
|
6607
|
-
9,
|
|
6608
|
-
10,
|
|
6609
|
-
8,
|
|
6610
|
-
10,
|
|
6611
|
-
11,
|
|
6612
|
-
12,
|
|
6613
|
-
13,
|
|
6614
|
-
14,
|
|
6615
|
-
12,
|
|
6616
|
-
14,
|
|
6617
|
-
15,
|
|
6618
|
-
16,
|
|
6619
|
-
17,
|
|
6620
|
-
18,
|
|
6621
|
-
16,
|
|
6622
|
-
18,
|
|
6623
|
-
19,
|
|
6624
|
-
20,
|
|
6625
|
-
21,
|
|
6626
|
-
22,
|
|
6627
|
-
20,
|
|
6628
|
-
22,
|
|
6629
|
-
23
|
|
6630
|
-
]);
|
|
6631
|
-
var CUBE_POSITIONS = new Float32Array([
|
|
6632
|
-
-1,
|
|
6633
|
-
-1,
|
|
6634
|
-
1,
|
|
6635
|
-
1,
|
|
6636
|
-
-1,
|
|
6637
|
-
1,
|
|
6638
|
-
1,
|
|
6639
|
-
1,
|
|
6640
|
-
1,
|
|
6641
|
-
-1,
|
|
6642
|
-
1,
|
|
6643
|
-
1,
|
|
6644
|
-
-1,
|
|
6645
|
-
-1,
|
|
6646
|
-
-1,
|
|
6647
|
-
-1,
|
|
6648
|
-
1,
|
|
6649
|
-
-1,
|
|
6650
|
-
1,
|
|
6651
|
-
1,
|
|
6652
|
-
-1,
|
|
6653
|
-
1,
|
|
6654
|
-
-1,
|
|
6655
|
-
-1,
|
|
6656
|
-
-1,
|
|
6657
|
-
1,
|
|
6658
|
-
-1,
|
|
6659
|
-
-1,
|
|
6660
|
-
1,
|
|
6661
|
-
1,
|
|
6662
|
-
1,
|
|
6663
|
-
1,
|
|
6664
|
-
1,
|
|
6665
|
-
1,
|
|
6666
|
-
1,
|
|
6667
|
-
-1,
|
|
6668
|
-
-1,
|
|
6669
|
-
-1,
|
|
6670
|
-
-1,
|
|
6671
|
-
1,
|
|
6672
|
-
-1,
|
|
6673
|
-
-1,
|
|
6674
|
-
1,
|
|
6675
|
-
-1,
|
|
6676
|
-
1,
|
|
6677
|
-
-1,
|
|
6678
|
-
-1,
|
|
6679
|
-
1,
|
|
6680
|
-
1,
|
|
6681
|
-
-1,
|
|
6682
|
-
-1,
|
|
6683
|
-
1,
|
|
6684
|
-
1,
|
|
6685
|
-
-1,
|
|
6686
|
-
1,
|
|
6687
|
-
1,
|
|
6688
|
-
1,
|
|
6689
|
-
1,
|
|
6690
|
-
-1,
|
|
6691
|
-
1,
|
|
6692
|
-
-1,
|
|
6693
|
-
-1,
|
|
6694
|
-
-1,
|
|
6695
|
-
-1,
|
|
6696
|
-
-1,
|
|
6697
|
-
1,
|
|
6698
|
-
-1,
|
|
6699
|
-
1,
|
|
6700
|
-
1,
|
|
6701
|
-
-1,
|
|
6702
|
-
1,
|
|
6703
|
-
-1
|
|
6704
|
-
]);
|
|
6705
|
-
var CUBE_NORMALS = new Float32Array([
|
|
6706
|
-
// Front face
|
|
6707
|
-
0,
|
|
6708
|
-
0,
|
|
6709
|
-
1,
|
|
6710
|
-
0,
|
|
6711
|
-
0,
|
|
6712
|
-
1,
|
|
6713
|
-
0,
|
|
6714
|
-
0,
|
|
6715
|
-
1,
|
|
6716
|
-
0,
|
|
6717
|
-
0,
|
|
6718
|
-
1,
|
|
6719
|
-
// Back face
|
|
6720
|
-
0,
|
|
6721
|
-
0,
|
|
6722
|
-
-1,
|
|
6723
|
-
0,
|
|
6724
|
-
0,
|
|
6725
|
-
-1,
|
|
6726
|
-
0,
|
|
6727
|
-
0,
|
|
6728
|
-
-1,
|
|
6729
|
-
0,
|
|
6730
|
-
0,
|
|
6731
|
-
-1,
|
|
6732
|
-
// Top face
|
|
6733
|
-
0,
|
|
6734
|
-
1,
|
|
6735
|
-
0,
|
|
6736
|
-
0,
|
|
6737
|
-
1,
|
|
6738
|
-
0,
|
|
6739
|
-
0,
|
|
6740
|
-
1,
|
|
6741
|
-
0,
|
|
6742
|
-
0,
|
|
6743
|
-
1,
|
|
6744
|
-
0,
|
|
6745
|
-
// Bottom face
|
|
6746
|
-
0,
|
|
6747
|
-
-1,
|
|
6748
|
-
0,
|
|
6749
|
-
0,
|
|
6750
|
-
-1,
|
|
6751
|
-
0,
|
|
6752
|
-
0,
|
|
6753
|
-
-1,
|
|
6754
|
-
0,
|
|
6755
|
-
0,
|
|
6756
|
-
-1,
|
|
6757
|
-
0,
|
|
6758
|
-
// Right face
|
|
6759
|
-
1,
|
|
6760
|
-
0,
|
|
6761
|
-
0,
|
|
6762
|
-
1,
|
|
6763
|
-
0,
|
|
6764
|
-
0,
|
|
6765
|
-
1,
|
|
6766
|
-
0,
|
|
6767
|
-
0,
|
|
6768
|
-
1,
|
|
6769
|
-
0,
|
|
6770
|
-
0,
|
|
6771
|
-
// Left face
|
|
6772
|
-
-1,
|
|
6773
|
-
0,
|
|
6774
|
-
0,
|
|
6775
|
-
-1,
|
|
6776
|
-
0,
|
|
6777
|
-
0,
|
|
6778
|
-
-1,
|
|
6779
|
-
0,
|
|
6780
|
-
0,
|
|
6781
|
-
-1,
|
|
6782
|
-
0,
|
|
6783
|
-
0
|
|
6784
|
-
]);
|
|
6785
|
-
var CUBE_TEX_COORDS = new Float32Array([
|
|
6786
|
-
// Front face
|
|
6787
|
-
0,
|
|
6788
|
-
0,
|
|
6789
|
-
1,
|
|
6790
|
-
0,
|
|
6791
|
-
1,
|
|
6792
|
-
1,
|
|
6793
|
-
0,
|
|
6794
|
-
1,
|
|
6795
|
-
// Back face
|
|
6796
|
-
1,
|
|
6797
|
-
0,
|
|
6798
|
-
1,
|
|
6799
|
-
1,
|
|
6800
|
-
0,
|
|
6801
|
-
1,
|
|
6802
|
-
0,
|
|
6803
|
-
0,
|
|
6804
|
-
// Top face
|
|
6805
|
-
0,
|
|
6806
|
-
1,
|
|
6807
|
-
0,
|
|
6808
|
-
0,
|
|
6809
|
-
1,
|
|
6810
|
-
0,
|
|
6811
|
-
1,
|
|
6812
|
-
1,
|
|
6813
|
-
// Bottom face
|
|
6814
|
-
1,
|
|
6815
|
-
1,
|
|
6816
|
-
0,
|
|
6817
|
-
1,
|
|
6818
|
-
0,
|
|
6819
|
-
0,
|
|
6820
|
-
1,
|
|
6821
|
-
0,
|
|
6822
|
-
// Right face
|
|
6823
|
-
1,
|
|
6824
|
-
0,
|
|
6825
|
-
1,
|
|
6826
|
-
1,
|
|
6827
|
-
0,
|
|
6828
|
-
1,
|
|
6829
|
-
0,
|
|
6830
|
-
0,
|
|
6831
|
-
// Left face
|
|
6832
|
-
0,
|
|
6833
|
-
0,
|
|
6834
|
-
1,
|
|
6835
|
-
0,
|
|
6836
|
-
1,
|
|
6837
|
-
1,
|
|
6838
|
-
0,
|
|
6839
|
-
1
|
|
6840
|
-
]);
|
|
6841
|
-
var CUBE_FACE_INDICES = new Uint32Array([
|
|
6842
|
-
0,
|
|
6843
|
-
0,
|
|
6844
|
-
0,
|
|
6845
|
-
0,
|
|
6846
|
-
1,
|
|
6847
|
-
1,
|
|
6848
|
-
1,
|
|
6849
|
-
1,
|
|
6850
|
-
2,
|
|
6851
|
-
2,
|
|
6852
|
-
2,
|
|
6853
|
-
2,
|
|
6854
|
-
3,
|
|
6855
|
-
3,
|
|
6856
|
-
3,
|
|
6857
|
-
3,
|
|
6858
|
-
4,
|
|
6859
|
-
4,
|
|
6860
|
-
4,
|
|
6861
|
-
4,
|
|
6862
|
-
5,
|
|
6863
|
-
5,
|
|
6864
|
-
5,
|
|
6865
|
-
5
|
|
6866
|
-
]);
|
|
6867
|
-
var CUBE_NON_INDEXED_POSITIONS = new Float32Array([
|
|
6868
|
-
1,
|
|
6869
|
-
-1,
|
|
6870
|
-
1,
|
|
6871
|
-
-1,
|
|
6872
|
-
-1,
|
|
6873
|
-
1,
|
|
6874
|
-
-1,
|
|
6875
|
-
-1,
|
|
6876
|
-
-1,
|
|
6877
|
-
1,
|
|
6878
|
-
-1,
|
|
6879
|
-
-1,
|
|
6880
|
-
1,
|
|
6881
|
-
-1,
|
|
6882
|
-
1,
|
|
6883
|
-
-1,
|
|
6884
|
-
-1,
|
|
6885
|
-
-1,
|
|
6886
|
-
1,
|
|
6887
|
-
1,
|
|
6888
|
-
1,
|
|
6889
|
-
1,
|
|
6890
|
-
-1,
|
|
6891
|
-
1,
|
|
6892
|
-
1,
|
|
6893
|
-
-1,
|
|
6894
|
-
-1,
|
|
6895
|
-
1,
|
|
6896
|
-
1,
|
|
6897
|
-
-1,
|
|
6898
|
-
1,
|
|
6899
|
-
1,
|
|
6900
|
-
1,
|
|
6901
|
-
1,
|
|
6902
|
-
-1,
|
|
6903
|
-
-1,
|
|
6904
|
-
-1,
|
|
6905
|
-
1,
|
|
6906
|
-
1,
|
|
6907
|
-
1,
|
|
6908
|
-
1,
|
|
6909
|
-
1,
|
|
6910
|
-
1,
|
|
6911
|
-
1,
|
|
6912
|
-
-1,
|
|
6913
|
-
-1,
|
|
6914
|
-
1,
|
|
6915
|
-
-1,
|
|
6916
|
-
-1,
|
|
6917
|
-
1,
|
|
6918
|
-
1,
|
|
6919
|
-
1,
|
|
6920
|
-
1,
|
|
6921
|
-
-1,
|
|
6922
|
-
-1,
|
|
6923
|
-
-1,
|
|
6924
|
-
1,
|
|
6925
|
-
-1,
|
|
6926
|
-
1,
|
|
6927
|
-
1,
|
|
6928
|
-
-1,
|
|
6929
|
-
1,
|
|
6930
|
-
-1,
|
|
6931
|
-
-1,
|
|
6932
|
-
-1,
|
|
6933
|
-
-1,
|
|
6934
|
-
-1,
|
|
6935
|
-
-1,
|
|
6936
|
-
1,
|
|
6937
|
-
-1,
|
|
6938
|
-
1,
|
|
6939
|
-
-1,
|
|
6940
|
-
1,
|
|
6941
|
-
1,
|
|
6942
|
-
1,
|
|
6943
|
-
-1,
|
|
6944
|
-
1,
|
|
6945
|
-
1,
|
|
6946
|
-
-1,
|
|
6947
|
-
-1,
|
|
6948
|
-
1,
|
|
6949
|
-
-1,
|
|
6950
|
-
-1,
|
|
6951
|
-
1,
|
|
6952
|
-
1,
|
|
6953
|
-
-1,
|
|
6954
|
-
1,
|
|
6955
|
-
1,
|
|
6956
|
-
1,
|
|
6957
|
-
1,
|
|
6958
|
-
1,
|
|
6959
|
-
-1,
|
|
6960
|
-
-1,
|
|
6961
|
-
-1,
|
|
6962
|
-
-1,
|
|
6963
|
-
-1,
|
|
6964
|
-
-1,
|
|
6965
|
-
1,
|
|
6966
|
-
-1,
|
|
6967
|
-
1,
|
|
6968
|
-
1,
|
|
6969
|
-
-1,
|
|
6970
|
-
1,
|
|
6971
|
-
-1,
|
|
6972
|
-
-1,
|
|
6973
|
-
-1,
|
|
6974
|
-
1,
|
|
6975
|
-
-1
|
|
6976
|
-
]);
|
|
6977
|
-
var CUBE_NON_INDEXED_TEX_COORDS = new Float32Array([
|
|
6978
|
-
1,
|
|
6979
|
-
1,
|
|
6980
|
-
0,
|
|
6981
|
-
1,
|
|
6982
|
-
0,
|
|
6983
|
-
0,
|
|
6984
|
-
1,
|
|
6985
|
-
0,
|
|
6986
|
-
1,
|
|
6987
|
-
1,
|
|
6988
|
-
0,
|
|
6989
|
-
0,
|
|
6990
|
-
1,
|
|
6991
|
-
1,
|
|
6992
|
-
0,
|
|
6993
|
-
1,
|
|
6994
|
-
0,
|
|
6995
|
-
0,
|
|
6996
|
-
1,
|
|
6997
|
-
0,
|
|
6998
|
-
1,
|
|
6999
|
-
1,
|
|
7000
|
-
0,
|
|
7001
|
-
0,
|
|
7002
|
-
1,
|
|
7003
|
-
1,
|
|
7004
|
-
0,
|
|
7005
|
-
1,
|
|
7006
|
-
0,
|
|
7007
|
-
0,
|
|
7008
|
-
1,
|
|
7009
|
-
0,
|
|
7010
|
-
1,
|
|
7011
|
-
1,
|
|
7012
|
-
0,
|
|
7013
|
-
0,
|
|
7014
|
-
1,
|
|
7015
|
-
1,
|
|
7016
|
-
0,
|
|
7017
|
-
1,
|
|
7018
|
-
0,
|
|
7019
|
-
0,
|
|
7020
|
-
1,
|
|
7021
|
-
0,
|
|
7022
|
-
1,
|
|
7023
|
-
1,
|
|
7024
|
-
0,
|
|
7025
|
-
0,
|
|
7026
|
-
1,
|
|
7027
|
-
1,
|
|
7028
|
-
0,
|
|
7029
|
-
1,
|
|
7030
|
-
0,
|
|
7031
|
-
0,
|
|
7032
|
-
0,
|
|
7033
|
-
0,
|
|
7034
|
-
1,
|
|
7035
|
-
0,
|
|
7036
|
-
1,
|
|
7037
|
-
1,
|
|
7038
|
-
1,
|
|
7039
|
-
1,
|
|
7040
|
-
0,
|
|
7041
|
-
1,
|
|
7042
|
-
0,
|
|
7043
|
-
0,
|
|
7044
|
-
1,
|
|
7045
|
-
0,
|
|
7046
|
-
1,
|
|
7047
|
-
1,
|
|
7048
|
-
0,
|
|
7049
|
-
0
|
|
7050
|
-
]);
|
|
7051
|
-
var CUBE_NON_INDEXED_COLORS = new Float32Array([
|
|
7052
|
-
1,
|
|
7053
|
-
0,
|
|
7054
|
-
1,
|
|
7055
|
-
1,
|
|
7056
|
-
0,
|
|
7057
|
-
0,
|
|
7058
|
-
1,
|
|
7059
|
-
1,
|
|
7060
|
-
0,
|
|
7061
|
-
0,
|
|
7062
|
-
0,
|
|
7063
|
-
1,
|
|
7064
|
-
1,
|
|
7065
|
-
0,
|
|
7066
|
-
0,
|
|
7067
|
-
1,
|
|
7068
|
-
1,
|
|
7069
|
-
0,
|
|
7070
|
-
1,
|
|
7071
|
-
1,
|
|
7072
|
-
0,
|
|
7073
|
-
0,
|
|
7074
|
-
0,
|
|
7075
|
-
1,
|
|
7076
|
-
1,
|
|
7077
|
-
1,
|
|
7078
|
-
1,
|
|
7079
|
-
1,
|
|
7080
|
-
1,
|
|
7081
|
-
0,
|
|
7082
|
-
1,
|
|
7083
|
-
1,
|
|
7084
|
-
1,
|
|
7085
|
-
0,
|
|
7086
|
-
0,
|
|
7087
|
-
1,
|
|
7088
|
-
1,
|
|
7089
|
-
1,
|
|
7090
|
-
0,
|
|
7091
|
-
1,
|
|
7092
|
-
1,
|
|
7093
|
-
1,
|
|
7094
|
-
1,
|
|
7095
|
-
1,
|
|
7096
|
-
1,
|
|
7097
|
-
0,
|
|
7098
|
-
0,
|
|
7099
|
-
1,
|
|
7100
|
-
0,
|
|
7101
|
-
1,
|
|
7102
|
-
1,
|
|
7103
|
-
1,
|
|
7104
|
-
1,
|
|
7105
|
-
1,
|
|
7106
|
-
1,
|
|
7107
|
-
1,
|
|
7108
|
-
1,
|
|
7109
|
-
1,
|
|
7110
|
-
0,
|
|
7111
|
-
1,
|
|
7112
|
-
0,
|
|
7113
|
-
1,
|
|
7114
|
-
0,
|
|
7115
|
-
1,
|
|
7116
|
-
0,
|
|
7117
|
-
1,
|
|
7118
|
-
1,
|
|
7119
|
-
1,
|
|
7120
|
-
1,
|
|
7121
|
-
1,
|
|
7122
|
-
0,
|
|
7123
|
-
1,
|
|
7124
|
-
0,
|
|
7125
|
-
0,
|
|
7126
|
-
1,
|
|
7127
|
-
1,
|
|
7128
|
-
0,
|
|
7129
|
-
1,
|
|
7130
|
-
1,
|
|
7131
|
-
1,
|
|
7132
|
-
0,
|
|
7133
|
-
1,
|
|
7134
|
-
0,
|
|
7135
|
-
1,
|
|
7136
|
-
0,
|
|
7137
|
-
0,
|
|
7138
|
-
0,
|
|
7139
|
-
1,
|
|
7140
|
-
0,
|
|
7141
|
-
0,
|
|
7142
|
-
1,
|
|
7143
|
-
1,
|
|
7144
|
-
0,
|
|
7145
|
-
1,
|
|
7146
|
-
0,
|
|
7147
|
-
1,
|
|
7148
|
-
1,
|
|
7149
|
-
1,
|
|
7150
|
-
1,
|
|
7151
|
-
1,
|
|
7152
|
-
0,
|
|
7153
|
-
1,
|
|
7154
|
-
1,
|
|
7155
|
-
1,
|
|
7156
|
-
0,
|
|
7157
|
-
0,
|
|
7158
|
-
1,
|
|
7159
|
-
1,
|
|
7160
|
-
0,
|
|
7161
|
-
0,
|
|
7162
|
-
1,
|
|
7163
|
-
1,
|
|
7164
|
-
1,
|
|
7165
|
-
0,
|
|
7166
|
-
1,
|
|
7167
|
-
1,
|
|
7168
|
-
1,
|
|
7169
|
-
1,
|
|
7170
|
-
1,
|
|
7171
|
-
1,
|
|
7172
|
-
1,
|
|
7173
|
-
0,
|
|
7174
|
-
0,
|
|
7175
|
-
1,
|
|
7176
|
-
0,
|
|
7177
|
-
0,
|
|
7178
|
-
0,
|
|
7179
|
-
1,
|
|
7180
|
-
0,
|
|
7181
|
-
1,
|
|
7182
|
-
0,
|
|
7183
|
-
1,
|
|
7184
|
-
1,
|
|
7185
|
-
1,
|
|
7186
|
-
0,
|
|
7187
|
-
1,
|
|
7188
|
-
1,
|
|
7189
|
-
0,
|
|
7190
|
-
0,
|
|
7191
|
-
1,
|
|
7192
|
-
0,
|
|
7193
|
-
1,
|
|
7194
|
-
0,
|
|
7195
|
-
1
|
|
7196
|
-
]);
|
|
7197
|
-
var CUBE_NON_INDEXED_FACE_INDICES = new Uint32Array([
|
|
7198
|
-
3,
|
|
7199
|
-
3,
|
|
7200
|
-
3,
|
|
7201
|
-
3,
|
|
7202
|
-
3,
|
|
7203
|
-
3,
|
|
7204
|
-
4,
|
|
7205
|
-
4,
|
|
7206
|
-
4,
|
|
7207
|
-
4,
|
|
7208
|
-
4,
|
|
7209
|
-
4,
|
|
7210
|
-
2,
|
|
7211
|
-
2,
|
|
7212
|
-
2,
|
|
7213
|
-
2,
|
|
7214
|
-
2,
|
|
7215
|
-
2,
|
|
7216
|
-
5,
|
|
7217
|
-
5,
|
|
7218
|
-
5,
|
|
7219
|
-
5,
|
|
7220
|
-
5,
|
|
7221
|
-
5,
|
|
7222
|
-
0,
|
|
7223
|
-
0,
|
|
7224
|
-
0,
|
|
7225
|
-
0,
|
|
7226
|
-
0,
|
|
7227
|
-
0,
|
|
7228
|
-
1,
|
|
7229
|
-
1,
|
|
7230
|
-
1,
|
|
7231
|
-
1,
|
|
7232
|
-
1,
|
|
7233
|
-
1
|
|
7234
|
-
]);
|
|
7235
|
-
var ATTRIBUTES = {
|
|
7236
|
-
POSITION: { size: 3, value: CUBE_POSITIONS },
|
|
7237
|
-
NORMAL: { size: 3, value: CUBE_NORMALS },
|
|
7238
|
-
TEXCOORD_0: { size: 2, value: CUBE_TEX_COORDS },
|
|
7239
|
-
faceIndex: { size: 1, value: CUBE_FACE_INDICES }
|
|
7240
|
-
};
|
|
7241
|
-
var NON_INDEXED_ATTRIBUTES = {
|
|
7242
|
-
POSITION: { size: 3, value: CUBE_NON_INDEXED_POSITIONS },
|
|
7243
|
-
// NORMAL: {size: 3, value: CUBE_NON_INDEXED_NORMALS},
|
|
7244
|
-
TEXCOORD_0: { size: 2, value: CUBE_NON_INDEXED_TEX_COORDS },
|
|
7245
|
-
COLOR_0: { size: 3, value: CUBE_NON_INDEXED_COLORS },
|
|
7246
|
-
faceIndex: { size: 1, value: CUBE_NON_INDEXED_FACE_INDICES }
|
|
7247
|
-
};
|
|
7248
|
-
|
|
7249
|
-
// dist/geometries/cylinder-geometry.js
|
|
7250
|
-
var CylinderGeometry = class extends TruncatedConeGeometry {
|
|
7251
|
-
constructor(props = {}) {
|
|
7252
|
-
const { id = uid("cylinder-geometry"), radius = 1 } = props;
|
|
7253
|
-
super({
|
|
7254
|
-
...props,
|
|
7255
|
-
id,
|
|
7256
|
-
bottomRadius: radius,
|
|
7257
|
-
topRadius: radius
|
|
7258
|
-
});
|
|
7259
|
-
}
|
|
7260
|
-
};
|
|
7261
|
-
|
|
7262
|
-
// dist/geometries/ico-sphere-geometry.js
|
|
7263
|
-
var import_core24 = require("@math.gl/core");
|
|
7264
|
-
var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
|
|
7265
|
-
var ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1];
|
|
7266
|
-
var IcoSphereGeometry = class extends Geometry {
|
|
7267
|
-
constructor(props = {}) {
|
|
7268
|
-
const { id = uid("ico-sphere-geometry") } = props;
|
|
7269
|
-
const { indices, attributes } = tesselateIcosaHedron(props);
|
|
7270
|
-
super({
|
|
7271
|
-
...props,
|
|
7272
|
-
id,
|
|
7273
|
-
topology: "triangle-list",
|
|
7274
|
-
indices,
|
|
7275
|
-
attributes: { ...attributes, ...props.attributes }
|
|
7276
|
-
});
|
|
7277
|
-
}
|
|
7278
|
-
};
|
|
7279
|
-
function tesselateIcosaHedron(props) {
|
|
7280
|
-
const { iterations = 0 } = props;
|
|
7281
|
-
const PI = Math.PI;
|
|
7282
|
-
const PI2 = PI * 2;
|
|
7283
|
-
const positions = [...ICO_POSITIONS];
|
|
7284
|
-
let indices = [...ICO_INDICES];
|
|
7285
|
-
positions.push();
|
|
7286
|
-
indices.push();
|
|
7287
|
-
const getMiddlePoint = /* @__PURE__ */ (() => {
|
|
7288
|
-
const pointMemo = {};
|
|
7289
|
-
return (i1, i2) => {
|
|
7290
|
-
i1 *= 3;
|
|
7291
|
-
i2 *= 3;
|
|
7292
|
-
const mini = i1 < i2 ? i1 : i2;
|
|
7293
|
-
const maxi = i1 > i2 ? i1 : i2;
|
|
7294
|
-
const key = `${mini}|${maxi}`;
|
|
7295
|
-
if (key in pointMemo) {
|
|
7296
|
-
return pointMemo[key];
|
|
7297
|
-
}
|
|
7298
|
-
const x1 = positions[i1];
|
|
7299
|
-
const y1 = positions[i1 + 1];
|
|
7300
|
-
const z1 = positions[i1 + 2];
|
|
7301
|
-
const x2 = positions[i2];
|
|
7302
|
-
const y2 = positions[i2 + 1];
|
|
7303
|
-
const z2 = positions[i2 + 2];
|
|
7304
|
-
let xm = (x1 + x2) / 2;
|
|
7305
|
-
let ym = (y1 + y2) / 2;
|
|
7306
|
-
let zm = (z1 + z2) / 2;
|
|
7307
|
-
const len = Math.sqrt(xm * xm + ym * ym + zm * zm);
|
|
7308
|
-
xm /= len;
|
|
7309
|
-
ym /= len;
|
|
7310
|
-
zm /= len;
|
|
7311
|
-
positions.push(xm, ym, zm);
|
|
7312
|
-
const pointIndex = positions.length / 3 - 1;
|
|
7313
|
-
pointMemo[key] = pointIndex;
|
|
7314
|
-
return pointIndex;
|
|
7315
|
-
};
|
|
7316
|
-
})();
|
|
7317
|
-
for (let i = 0; i < iterations; i++) {
|
|
7318
|
-
const indices2 = [];
|
|
7319
|
-
for (let j = 0; j < indices.length; j += 3) {
|
|
7320
|
-
const a = getMiddlePoint(indices[j + 0], indices[j + 1]);
|
|
7321
|
-
const b = getMiddlePoint(indices[j + 1], indices[j + 2]);
|
|
7322
|
-
const c = getMiddlePoint(indices[j + 2], indices[j + 0]);
|
|
7323
|
-
indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c);
|
|
7324
|
-
}
|
|
7325
|
-
indices = indices2;
|
|
7326
|
-
}
|
|
7327
|
-
const normals = new Array(positions.length);
|
|
7328
|
-
const texCoords = new Array(positions.length / 3 * 2);
|
|
7329
|
-
const l = indices.length;
|
|
7330
|
-
for (let i = l - 3; i >= 0; i -= 3) {
|
|
7331
|
-
const i1 = indices[i + 0];
|
|
7332
|
-
const i2 = indices[i + 1];
|
|
7333
|
-
const i3 = indices[i + 2];
|
|
7334
|
-
const in1 = i1 * 3;
|
|
7335
|
-
const in2 = i2 * 3;
|
|
7336
|
-
const in3 = i3 * 3;
|
|
7337
|
-
const iu1 = i1 * 2;
|
|
7338
|
-
const iu2 = i2 * 2;
|
|
7339
|
-
const iu3 = i3 * 2;
|
|
7340
|
-
const x1 = positions[in1 + 0];
|
|
7341
|
-
const y1 = positions[in1 + 1];
|
|
7342
|
-
const z1 = positions[in1 + 2];
|
|
7343
|
-
const theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1));
|
|
7344
|
-
const phi1 = Math.atan2(y1, x1) + PI;
|
|
7345
|
-
const v1 = theta1 / PI;
|
|
7346
|
-
const u1 = 1 - phi1 / PI2;
|
|
7347
|
-
const x2 = positions[in2 + 0];
|
|
7348
|
-
const y2 = positions[in2 + 1];
|
|
7349
|
-
const z2 = positions[in2 + 2];
|
|
7350
|
-
const theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2));
|
|
7351
|
-
const phi2 = Math.atan2(y2, x2) + PI;
|
|
7352
|
-
const v2 = theta2 / PI;
|
|
7353
|
-
const u2 = 1 - phi2 / PI2;
|
|
7354
|
-
const x3 = positions[in3 + 0];
|
|
7355
|
-
const y3 = positions[in3 + 1];
|
|
7356
|
-
const z3 = positions[in3 + 2];
|
|
7357
|
-
const theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3));
|
|
7358
|
-
const phi3 = Math.atan2(y3, x3) + PI;
|
|
7359
|
-
const v3 = theta3 / PI;
|
|
7360
|
-
const u3 = 1 - phi3 / PI2;
|
|
7361
|
-
const vec1 = [x3 - x2, y3 - y2, z3 - z2];
|
|
7362
|
-
const vec2 = [x1 - x2, y1 - y2, z1 - z2];
|
|
7363
|
-
const normal = new import_core24.Vector3(vec1).cross(vec2).normalize();
|
|
7364
|
-
let newIndex;
|
|
7365
|
-
if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) {
|
|
7366
|
-
positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
|
|
7367
|
-
newIndex = positions.length / 3 - 1;
|
|
7368
|
-
indices.push(newIndex);
|
|
7369
|
-
texCoords[newIndex * 2 + 0] = 1;
|
|
7370
|
-
texCoords[newIndex * 2 + 1] = v1;
|
|
7371
|
-
normals[newIndex * 3 + 0] = normal.x;
|
|
7372
|
-
normals[newIndex * 3 + 1] = normal.y;
|
|
7373
|
-
normals[newIndex * 3 + 2] = normal.z;
|
|
7374
|
-
positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]);
|
|
7375
|
-
newIndex = positions.length / 3 - 1;
|
|
7376
|
-
indices.push(newIndex);
|
|
7377
|
-
texCoords[newIndex * 2 + 0] = 1;
|
|
7378
|
-
texCoords[newIndex * 2 + 1] = v2;
|
|
7379
|
-
normals[newIndex * 3 + 0] = normal.x;
|
|
7380
|
-
normals[newIndex * 3 + 1] = normal.y;
|
|
7381
|
-
normals[newIndex * 3 + 2] = normal.z;
|
|
7382
|
-
positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]);
|
|
7383
|
-
newIndex = positions.length / 3 - 1;
|
|
7384
|
-
indices.push(newIndex);
|
|
7385
|
-
texCoords[newIndex * 2 + 0] = 1;
|
|
7386
|
-
texCoords[newIndex * 2 + 1] = v3;
|
|
7387
|
-
normals[newIndex * 3 + 0] = normal.x;
|
|
7388
|
-
normals[newIndex * 3 + 1] = normal.y;
|
|
7389
|
-
normals[newIndex * 3 + 2] = normal.z;
|
|
7390
|
-
}
|
|
7391
|
-
normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x;
|
|
7392
|
-
normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y;
|
|
7393
|
-
normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z;
|
|
7394
|
-
texCoords[iu1 + 0] = u1;
|
|
7395
|
-
texCoords[iu1 + 1] = v1;
|
|
7396
|
-
texCoords[iu2 + 0] = u2;
|
|
7397
|
-
texCoords[iu2 + 1] = v2;
|
|
7398
|
-
texCoords[iu3 + 0] = u3;
|
|
7399
|
-
texCoords[iu3 + 1] = v3;
|
|
7400
|
-
}
|
|
7401
|
-
return {
|
|
7402
|
-
indices: { size: 1, value: new Uint16Array(indices) },
|
|
7403
|
-
attributes: {
|
|
7404
|
-
POSITION: { size: 3, value: new Float32Array(positions) },
|
|
7405
|
-
NORMAL: { size: 3, value: new Float32Array(normals) },
|
|
7406
|
-
TEXCOORD_0: { size: 2, value: new Float32Array(texCoords) }
|
|
7407
|
-
}
|
|
7408
|
-
};
|
|
7409
|
-
}
|
|
7410
|
-
|
|
7411
|
-
// dist/geometries/plane-geometry.js
|
|
7412
|
-
var PlaneGeometry = class extends Geometry {
|
|
7413
|
-
constructor(props = {}) {
|
|
7414
|
-
const { id = uid("plane-geometry") } = props;
|
|
7415
|
-
const { indices, attributes } = tesselatePlane(props);
|
|
7416
|
-
super({
|
|
7417
|
-
...props,
|
|
7418
|
-
id,
|
|
7419
|
-
topology: "triangle-list",
|
|
7420
|
-
indices,
|
|
7421
|
-
attributes: { ...attributes, ...props.attributes }
|
|
7422
|
-
});
|
|
7423
|
-
}
|
|
7424
|
-
};
|
|
7425
|
-
function tesselatePlane(props) {
|
|
7426
|
-
const { type = "x,y", offset = 0, flipCull = false, unpack = false } = props;
|
|
7427
|
-
const coords = type.split(",");
|
|
7428
|
-
let c1len = props[`${coords[0]}len`] || 1;
|
|
7429
|
-
const c2len = props[`${coords[1]}len`] || 1;
|
|
7430
|
-
const subdivisions1 = props[`n${coords[0]}`] || 1;
|
|
7431
|
-
const subdivisions2 = props[`n${coords[1]}`] || 1;
|
|
7432
|
-
const numVertices = (subdivisions1 + 1) * (subdivisions2 + 1);
|
|
7433
|
-
const positions = new Float32Array(numVertices * 3);
|
|
7434
|
-
const normals = new Float32Array(numVertices * 3);
|
|
7435
|
-
const texCoords = new Float32Array(numVertices * 2);
|
|
7436
|
-
if (flipCull) {
|
|
7437
|
-
c1len = -c1len;
|
|
7438
|
-
}
|
|
7439
|
-
let i2 = 0;
|
|
7440
|
-
let i3 = 0;
|
|
7441
|
-
for (let z = 0; z <= subdivisions2; z++) {
|
|
7442
|
-
for (let x = 0; x <= subdivisions1; x++) {
|
|
7443
|
-
const u = x / subdivisions1;
|
|
7444
|
-
const v = z / subdivisions2;
|
|
7445
|
-
texCoords[i2 + 0] = flipCull ? 1 - u : u;
|
|
7446
|
-
texCoords[i2 + 1] = v;
|
|
7447
|
-
switch (type) {
|
|
7448
|
-
case "x,y":
|
|
7449
|
-
positions[i3 + 0] = c1len * u - c1len * 0.5;
|
|
7450
|
-
positions[i3 + 1] = c2len * v - c2len * 0.5;
|
|
7451
|
-
positions[i3 + 2] = offset;
|
|
7452
|
-
normals[i3 + 0] = 0;
|
|
7453
|
-
normals[i3 + 1] = 0;
|
|
7454
|
-
normals[i3 + 2] = flipCull ? 1 : -1;
|
|
7455
|
-
break;
|
|
7456
|
-
case "x,z":
|
|
7457
|
-
positions[i3 + 0] = c1len * u - c1len * 0.5;
|
|
7458
|
-
positions[i3 + 1] = offset;
|
|
7459
|
-
positions[i3 + 2] = c2len * v - c2len * 0.5;
|
|
7460
|
-
normals[i3 + 0] = 0;
|
|
7461
|
-
normals[i3 + 1] = flipCull ? 1 : -1;
|
|
7462
|
-
normals[i3 + 2] = 0;
|
|
7463
|
-
break;
|
|
7464
|
-
case "y,z":
|
|
7465
|
-
positions[i3 + 0] = offset;
|
|
7466
|
-
positions[i3 + 1] = c1len * u - c1len * 0.5;
|
|
7467
|
-
positions[i3 + 2] = c2len * v - c2len * 0.5;
|
|
7468
|
-
normals[i3 + 0] = flipCull ? 1 : -1;
|
|
7469
|
-
normals[i3 + 1] = 0;
|
|
7470
|
-
normals[i3 + 2] = 0;
|
|
7471
|
-
break;
|
|
7472
|
-
default:
|
|
7473
|
-
throw new Error("PlaneGeometry: unknown type");
|
|
7474
|
-
}
|
|
7475
|
-
i2 += 2;
|
|
7476
|
-
i3 += 3;
|
|
7477
|
-
}
|
|
7478
|
-
}
|
|
7479
|
-
const numVertsAcross = subdivisions1 + 1;
|
|
7480
|
-
const indices = new Uint16Array(subdivisions1 * subdivisions2 * 6);
|
|
7481
|
-
for (let z = 0; z < subdivisions2; z++) {
|
|
7482
|
-
for (let x = 0; x < subdivisions1; x++) {
|
|
7483
|
-
const index = (z * subdivisions1 + x) * 6;
|
|
7484
|
-
indices[index + 0] = (z + 0) * numVertsAcross + x;
|
|
7485
|
-
indices[index + 1] = (z + 1) * numVertsAcross + x;
|
|
7486
|
-
indices[index + 2] = (z + 0) * numVertsAcross + x + 1;
|
|
7487
|
-
indices[index + 3] = (z + 1) * numVertsAcross + x;
|
|
7488
|
-
indices[index + 4] = (z + 1) * numVertsAcross + x + 1;
|
|
7489
|
-
indices[index + 5] = (z + 0) * numVertsAcross + x + 1;
|
|
7490
|
-
}
|
|
7491
|
-
}
|
|
7492
|
-
const geometry = {
|
|
7493
|
-
indices: { size: 1, value: indices },
|
|
7494
|
-
attributes: {
|
|
7495
|
-
POSITION: { size: 3, value: positions },
|
|
7496
|
-
NORMAL: { size: 3, value: normals },
|
|
7497
|
-
TEXCOORD_0: { size: 2, value: texCoords }
|
|
7498
|
-
}
|
|
7499
|
-
};
|
|
7500
|
-
return unpack ? unpackIndexedGeometry(geometry) : geometry;
|
|
7501
|
-
}
|
|
7502
|
-
|
|
7503
6744
|
// dist/application-utils/random.js
|
|
7504
6745
|
function makeRandomGenerator() {
|
|
7505
6746
|
let s = 1;
|
|
@@ -7562,7 +6803,7 @@ function isAbsoluteLoadFileUrl(url) {
|
|
|
7562
6803
|
}
|
|
7563
6804
|
|
|
7564
6805
|
// dist/dynamic-texture/video-texture.js
|
|
7565
|
-
var
|
|
6806
|
+
var import_core26 = require("@luma.gl/core");
|
|
7566
6807
|
var VideoTexture = class {
|
|
7567
6808
|
/** Device used to create copied and native external texture bindings. */
|
|
7568
6809
|
device;
|
|
@@ -7611,7 +6852,7 @@ var VideoTexture = class {
|
|
|
7611
6852
|
* @param props Live video source and copied texture options.
|
|
7612
6853
|
*/
|
|
7613
6854
|
constructor(device, props) {
|
|
7614
|
-
(0,
|
|
6855
|
+
(0, import_core26.assert)(isHTMLVideoElementSource(props == null ? void 0 : props.source) || isVideoFrameSource(props == null ? void 0 : props.source));
|
|
7615
6856
|
this.device = device;
|
|
7616
6857
|
this.id = props.id || uid("video-texture");
|
|
7617
6858
|
this._source = props.source;
|
|
@@ -7625,7 +6866,7 @@ var VideoTexture = class {
|
|
|
7625
6866
|
* @param source Next caller-owned video source to follow.
|
|
7626
6867
|
*/
|
|
7627
6868
|
setSource(source4) {
|
|
7628
|
-
(0,
|
|
6869
|
+
(0, import_core26.assert)(isHTMLVideoElementSource(source4) || isVideoFrameSource(source4));
|
|
7629
6870
|
this._destroyExternalTexture();
|
|
7630
6871
|
this._source = source4;
|
|
7631
6872
|
this._sourceVersion++;
|
|
@@ -7705,7 +6946,7 @@ var VideoTexture = class {
|
|
|
7705
6946
|
width: size.width,
|
|
7706
6947
|
height: size.height,
|
|
7707
6948
|
format: "rgba8unorm",
|
|
7708
|
-
usage:
|
|
6949
|
+
usage: import_core26.Texture.SAMPLE | import_core26.Texture.COPY_DST,
|
|
7709
6950
|
mipLevels: 1,
|
|
7710
6951
|
sampler: this._sampler
|
|
7711
6952
|
});
|
|
@@ -7741,7 +6982,7 @@ var VideoTexture = class {
|
|
|
7741
6982
|
*/
|
|
7742
6983
|
_getResolvedSize() {
|
|
7743
6984
|
const size = getVideoTextureSourceSize(this._source);
|
|
7744
|
-
(0,
|
|
6985
|
+
(0, import_core26.assert)(size.width > 0 && size.height > 0);
|
|
7745
6986
|
return size;
|
|
7746
6987
|
}
|
|
7747
6988
|
/** Observes current source readiness and frame identity before binding resolution. */
|
|
@@ -7806,11 +7047,11 @@ function getVideoTextureSourceFrameToken(source4, sourceVersion) {
|
|
|
7806
7047
|
}
|
|
7807
7048
|
|
|
7808
7049
|
// dist/passes/shader-pass-renderer.js
|
|
7809
|
-
var
|
|
7050
|
+
var import_core29 = require("@luma.gl/core");
|
|
7810
7051
|
var import_shadertools7 = require("@luma.gl/shadertools");
|
|
7811
7052
|
|
|
7812
7053
|
// dist/compute/swap.js
|
|
7813
|
-
var
|
|
7054
|
+
var import_core27 = require("@luma.gl/core");
|
|
7814
7055
|
var Swap = class {
|
|
7815
7056
|
id;
|
|
7816
7057
|
/** The current resource - usually the source for renders or computations */
|
|
@@ -7843,7 +7084,7 @@ var SwapFramebuffers = class extends Swap {
|
|
|
7843
7084
|
let colorAttachments = (_a = props.colorAttachments) == null ? void 0 : _a.map((colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
|
|
7844
7085
|
id: `${props.id}-texture-0`,
|
|
7845
7086
|
format: colorAttachment,
|
|
7846
|
-
usage:
|
|
7087
|
+
usage: import_core27.Texture.SAMPLE | import_core27.Texture.RENDER | import_core27.Texture.COPY_SRC | import_core27.Texture.COPY_DST,
|
|
7847
7088
|
width,
|
|
7848
7089
|
height
|
|
7849
7090
|
}));
|
|
@@ -7851,7 +7092,7 @@ var SwapFramebuffers = class extends Swap {
|
|
|
7851
7092
|
colorAttachments = (_b = props.colorAttachments) == null ? void 0 : _b.map((colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
|
|
7852
7093
|
id: `${props.id}-texture-1`,
|
|
7853
7094
|
format: colorAttachment,
|
|
7854
|
-
usage:
|
|
7095
|
+
usage: import_core27.Texture.SAMPLE | import_core27.Texture.RENDER | import_core27.Texture.COPY_SRC | import_core27.Texture.COPY_DST,
|
|
7855
7096
|
width,
|
|
7856
7097
|
height
|
|
7857
7098
|
}));
|
|
@@ -7914,7 +7155,7 @@ var SwapBuffers = class extends Swap {
|
|
|
7914
7155
|
};
|
|
7915
7156
|
|
|
7916
7157
|
// dist/compute/computation.js
|
|
7917
|
-
var
|
|
7158
|
+
var import_core28 = require("@luma.gl/core");
|
|
7918
7159
|
var import_shadertools6 = require("@luma.gl/shadertools");
|
|
7919
7160
|
var import_types2 = require("@math.gl/types");
|
|
7920
7161
|
var LOG_DRAW_PRIORITY2 = 2;
|
|
@@ -7927,14 +7168,14 @@ var Computation = class _Computation {
|
|
|
7927
7168
|
* constructor remains the synchronous compatibility path.
|
|
7928
7169
|
*/
|
|
7929
7170
|
static async createAsync(device, props) {
|
|
7930
|
-
const ownsCompilation = !
|
|
7931
|
-
const asyncCompilation = ownsCompilation ?
|
|
7171
|
+
const ownsCompilation = !import_core28.PipelineFactory.getAsyncCompilation(device);
|
|
7172
|
+
const asyncCompilation = ownsCompilation ? import_core28.PipelineFactory.beginAsyncCompilation(device) : import_core28.PipelineFactory.getAsyncCompilation(device);
|
|
7932
7173
|
let computation;
|
|
7933
7174
|
try {
|
|
7934
7175
|
computation = new _Computation(device, props);
|
|
7935
7176
|
} finally {
|
|
7936
7177
|
if (ownsCompilation)
|
|
7937
|
-
|
|
7178
|
+
import_core28.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
|
|
7938
7179
|
}
|
|
7939
7180
|
try {
|
|
7940
7181
|
if (ownsCompilation) {
|
|
@@ -7949,11 +7190,12 @@ var Computation = class _Computation {
|
|
|
7949
7190
|
}
|
|
7950
7191
|
}
|
|
7951
7192
|
static defaultProps = {
|
|
7952
|
-
...
|
|
7193
|
+
...import_core28.ComputePipeline.defaultProps,
|
|
7953
7194
|
id: "unnamed",
|
|
7954
7195
|
handle: void 0,
|
|
7955
7196
|
userData: {},
|
|
7956
7197
|
source: "",
|
|
7198
|
+
sourceLanguage: void 0,
|
|
7957
7199
|
modules: [],
|
|
7958
7200
|
defines: {},
|
|
7959
7201
|
plugins: [],
|
|
@@ -8012,23 +7254,26 @@ var Computation = class _Computation {
|
|
|
8012
7254
|
const modules = mergeShaderModules(this.props.modules, (_a = this.shaderInputs) == null ? void 0 : _a.getModules());
|
|
8013
7255
|
const defines = { ...resolvedPlugins.defines, ...this.props.defines };
|
|
8014
7256
|
this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
|
|
8015
|
-
this.pipelineFactory = props.pipelineFactory ||
|
|
8016
|
-
this.shaderFactory = props.shaderFactory ||
|
|
7257
|
+
this.pipelineFactory = props.pipelineFactory || import_core28.PipelineFactory.getDefaultPipelineFactory(this.device);
|
|
7258
|
+
this.shaderFactory = props.shaderFactory || import_core28.ShaderFactory.getDefaultShaderFactory(this.device);
|
|
8017
7259
|
const shaderAssembler = this.props.shaderAssembler;
|
|
8018
|
-
(0,
|
|
8019
|
-
const { source: source4, getUniforms: getUniforms2, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
|
|
7260
|
+
(0, import_core28.assert)(shaderAssembler instanceof import_shadertools6.WGSLShaderAssembler);
|
|
7261
|
+
const { source: source4, getUniforms: getUniforms2, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
|
|
8020
7262
|
platformInfo,
|
|
8021
7263
|
...this.props,
|
|
8022
7264
|
modules,
|
|
8023
7265
|
defines,
|
|
7266
|
+
shaderStage: "compute",
|
|
7267
|
+
computeEntryPoint: this.props.entryPoint,
|
|
8024
7268
|
scanVertexAttributes: false,
|
|
8025
7269
|
pluginInjections: resolvedPlugins.injections
|
|
8026
7270
|
});
|
|
8027
7271
|
this.source = source4;
|
|
7272
|
+
this.props.entryPoint = entryPoints.compute || this.props.entryPoint;
|
|
8028
7273
|
this._getModuleUniforms = getUniforms2;
|
|
8029
7274
|
const inferredShaderLayout = assembledShaderLayout ?? ((_b = device.getShaderLayout) == null ? void 0 : _b.call(device, this.source, { scanVertexAttributes: false }));
|
|
8030
7275
|
this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout || inferredShaderLayout || null, modules) || null;
|
|
8031
|
-
const asyncCompilation =
|
|
7276
|
+
const asyncCompilation = import_core28.PipelineFactory.getAsyncCompilation(this.device);
|
|
8032
7277
|
if (asyncCompilation) {
|
|
8033
7278
|
this._pipelineInitialization = this._updatePipelineAsync();
|
|
8034
7279
|
asyncCompilation.push(this._pipelineInitialization);
|
|
@@ -8098,7 +7343,7 @@ var Computation = class _Computation {
|
|
|
8098
7343
|
}
|
|
8099
7344
|
setShaderInputs(shaderInputs) {
|
|
8100
7345
|
this.shaderInputs = shaderInputs;
|
|
8101
|
-
this._uniformStore = new
|
|
7346
|
+
this._uniformStore = new import_core28.UniformStore(this.device, this.shaderInputs.modules);
|
|
8102
7347
|
for (const [moduleName, module2] of Object.entries(this.shaderInputs.modules)) {
|
|
8103
7348
|
if (shaderModuleHasUniforms(module2)) {
|
|
8104
7349
|
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
|
|
@@ -8168,7 +7413,7 @@ var Computation = class _Computation {
|
|
|
8168
7413
|
return null;
|
|
8169
7414
|
const previousShader = this.pipeline ? this.shader : null;
|
|
8170
7415
|
if (this.pipeline) {
|
|
8171
|
-
|
|
7416
|
+
import_core28.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
|
|
8172
7417
|
}
|
|
8173
7418
|
this._pipelineNeedsUpdate = false;
|
|
8174
7419
|
this.shader = this.shaderFactory.createShader({
|
|
@@ -8187,27 +7432,27 @@ var Computation = class _Computation {
|
|
|
8187
7432
|
_lastLogTime = 0;
|
|
8188
7433
|
_logOpen = false;
|
|
8189
7434
|
_logDrawCallStart() {
|
|
8190
|
-
const logDrawTimeout =
|
|
8191
|
-
if (
|
|
7435
|
+
const logDrawTimeout = import_core28.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
|
|
7436
|
+
if (import_core28.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
|
|
8192
7437
|
return;
|
|
8193
7438
|
}
|
|
8194
7439
|
this._lastLogTime = Date.now();
|
|
8195
7440
|
this._logOpen = true;
|
|
8196
|
-
|
|
7441
|
+
import_core28.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core28.log.level <= 2 })();
|
|
8197
7442
|
}
|
|
8198
7443
|
_logDrawCallEnd() {
|
|
8199
7444
|
if (this._logOpen) {
|
|
8200
7445
|
const uniformTable = this.shaderInputs.getDebugTable();
|
|
8201
|
-
|
|
8202
|
-
|
|
7446
|
+
import_core28.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
|
|
7447
|
+
import_core28.log.groupEnd(LOG_DRAW_PRIORITY2)();
|
|
8203
7448
|
this._logOpen = false;
|
|
8204
7449
|
}
|
|
8205
7450
|
}
|
|
8206
7451
|
_drawCount = 0;
|
|
8207
7452
|
// TODO - fix typing of luma data types
|
|
8208
7453
|
_getBufferOrConstantValues(attribute, dataType) {
|
|
8209
|
-
const TypedArrayConstructor =
|
|
8210
|
-
const typedArray = attribute instanceof
|
|
7454
|
+
const TypedArrayConstructor = import_core28.dataTypeDecoder.getTypedArrayConstructor(dataType);
|
|
7455
|
+
const typedArray = attribute instanceof import_core28.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
|
|
8211
7456
|
return typedArray.toString();
|
|
8212
7457
|
}
|
|
8213
7458
|
};
|
|
@@ -8743,7 +7988,7 @@ var CompositeShaderPassComputeRenderer = class {
|
|
|
8743
7988
|
this.parameterBuffer = device.createBuffer({
|
|
8744
7989
|
id: `${optimization.name}-parameters`,
|
|
8745
7990
|
byteLength: Math.max(Math.ceil(optimization.uniformNames.length / 4) * 16, 16),
|
|
8746
|
-
usage:
|
|
7991
|
+
usage: import_core29.Buffer.UNIFORM | import_core29.Buffer.COPY_DST
|
|
8747
7992
|
});
|
|
8748
7993
|
const outputBindings = Object.entries(optimization.outputs).map(([bindingName, targetName], outputIndex) => ({
|
|
8749
7994
|
name: bindingName,
|
|
@@ -9003,7 +8248,7 @@ function createTargetResources(device, name, spec, targetSize) {
|
|
|
9003
8248
|
width: targetSize[0],
|
|
9004
8249
|
height: targetSize[1],
|
|
9005
8250
|
format: spec.format || device.preferredColorFormat,
|
|
9006
|
-
usage:
|
|
8251
|
+
usage: import_core29.Texture.SAMPLE | import_core29.Texture.RENDER | import_core29.Texture.COPY_SRC | import_core29.Texture.COPY_DST | (spec.storage && device.type === "webgpu" && device.getTextureFormatCapabilities(spec.format || device.preferredColorFormat).store ? import_core29.Texture.STORAGE : 0),
|
|
9007
8252
|
...spec.sampler ? { sampler: spec.sampler } : {}
|
|
9008
8253
|
});
|
|
9009
8254
|
const framebuffer = device.createFramebuffer({
|
|
@@ -9059,18 +8304,18 @@ function calculateTextureScale(sourceTexture, outputTexture) {
|
|
|
9059
8304
|
}
|
|
9060
8305
|
|
|
9061
8306
|
// dist/compute/kernel.js
|
|
9062
|
-
var
|
|
8307
|
+
var import_core30 = require("@luma.gl/core");
|
|
9063
8308
|
var Kernel = class _Kernel {
|
|
9064
8309
|
/** Creates a kernel while allowing the backend to compile its pipeline asynchronously. */
|
|
9065
8310
|
static async createAsync(device, props) {
|
|
9066
|
-
const ownsCompilation = !
|
|
9067
|
-
const asyncCompilation = ownsCompilation ?
|
|
8311
|
+
const ownsCompilation = !import_core30.PipelineFactory.getAsyncCompilation(device);
|
|
8312
|
+
const asyncCompilation = ownsCompilation ? import_core30.PipelineFactory.beginAsyncCompilation(device) : import_core30.PipelineFactory.getAsyncCompilation(device);
|
|
9068
8313
|
let kernel;
|
|
9069
8314
|
try {
|
|
9070
8315
|
kernel = new _Kernel(device, props);
|
|
9071
8316
|
} finally {
|
|
9072
8317
|
if (ownsCompilation)
|
|
9073
|
-
|
|
8318
|
+
import_core30.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
|
|
9074
8319
|
}
|
|
9075
8320
|
try {
|
|
9076
8321
|
if (ownsCompilation) {
|
|
@@ -9101,8 +8346,8 @@ var Kernel = class _Kernel {
|
|
|
9101
8346
|
this.device = device;
|
|
9102
8347
|
this.id = props.id ?? "kernel";
|
|
9103
8348
|
this.source = source4;
|
|
9104
|
-
this.pipelineFactory = pipelineFactory ??
|
|
9105
|
-
this.shaderFactory = shaderFactory ??
|
|
8349
|
+
this.pipelineFactory = pipelineFactory ?? import_core30.PipelineFactory.getDefaultPipelineFactory(device);
|
|
8350
|
+
this.shaderFactory = shaderFactory ?? import_core30.ShaderFactory.getDefaultShaderFactory(device);
|
|
9106
8351
|
this.shader = this.shaderFactory.createShader({
|
|
9107
8352
|
id: `${this.id}-compute`,
|
|
9108
8353
|
stage: "compute",
|
|
@@ -9110,7 +8355,7 @@ var Kernel = class _Kernel {
|
|
|
9110
8355
|
debugShaders
|
|
9111
8356
|
});
|
|
9112
8357
|
const computePipelineProps = { ...pipelineProps, shader: this.shader };
|
|
9113
|
-
const asyncCompilation =
|
|
8358
|
+
const asyncCompilation = import_core30.PipelineFactory.getAsyncCompilation(device);
|
|
9114
8359
|
if (asyncCompilation) {
|
|
9115
8360
|
const pipelineInitialization = this.pipelineFactory.createComputePipelineAsync(computePipelineProps);
|
|
9116
8361
|
this._pipelineInitialization = pipelineInitialization;
|
|
@@ -9147,18 +8392,18 @@ var Kernel = class _Kernel {
|
|
|
9147
8392
|
};
|
|
9148
8393
|
|
|
9149
8394
|
// dist/compute/render-kernel.js
|
|
9150
|
-
var
|
|
8395
|
+
var import_core31 = require("@luma.gl/core");
|
|
9151
8396
|
var RenderKernel = class _RenderKernel {
|
|
9152
8397
|
/** Creates a render kernel while allowing the backend to compile its pipeline asynchronously. */
|
|
9153
8398
|
static async createAsync(device, props) {
|
|
9154
|
-
const ownsCompilation = !
|
|
9155
|
-
const asyncCompilation = ownsCompilation ?
|
|
8399
|
+
const ownsCompilation = !import_core31.PipelineFactory.getAsyncCompilation(device);
|
|
8400
|
+
const asyncCompilation = ownsCompilation ? import_core31.PipelineFactory.beginAsyncCompilation(device) : import_core31.PipelineFactory.getAsyncCompilation(device);
|
|
9156
8401
|
let kernel;
|
|
9157
8402
|
try {
|
|
9158
8403
|
kernel = new _RenderKernel(device, props);
|
|
9159
8404
|
} finally {
|
|
9160
8405
|
if (ownsCompilation)
|
|
9161
|
-
|
|
8406
|
+
import_core31.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
|
|
9162
8407
|
}
|
|
9163
8408
|
try {
|
|
9164
8409
|
if (ownsCompilation) {
|
|
@@ -9192,8 +8437,8 @@ var RenderKernel = class _RenderKernel {
|
|
|
9192
8437
|
this.id = props.id ?? "render-kernel";
|
|
9193
8438
|
this.vertexSource = vertexSource;
|
|
9194
8439
|
this.fragmentSource = fragmentSource;
|
|
9195
|
-
this.pipelineFactory = pipelineFactory ??
|
|
9196
|
-
this.shaderFactory = shaderFactory ??
|
|
8440
|
+
this.pipelineFactory = pipelineFactory ?? import_core31.PipelineFactory.getDefaultPipelineFactory(device);
|
|
8441
|
+
this.shaderFactory = shaderFactory ?? import_core31.ShaderFactory.getDefaultShaderFactory(device);
|
|
9197
8442
|
this.vertexShader = this.shaderFactory.createShader({
|
|
9198
8443
|
id: `${this.id}-vertex`,
|
|
9199
8444
|
stage: "vertex",
|
|
@@ -9211,7 +8456,7 @@ var RenderKernel = class _RenderKernel {
|
|
|
9211
8456
|
vs: this.vertexShader,
|
|
9212
8457
|
fs: this.fragmentShader
|
|
9213
8458
|
};
|
|
9214
|
-
const asyncCompilation =
|
|
8459
|
+
const asyncCompilation = import_core31.PipelineFactory.getAsyncCompilation(device);
|
|
9215
8460
|
if (asyncCompilation) {
|
|
9216
8461
|
const pipelineInitialization = this.pipelineFactory.createRenderPipelineAsync(renderPipelineProps);
|
|
9217
8462
|
this._pipelineInitialization = pipelineInitialization;
|
|
@@ -9259,7 +8504,7 @@ var RenderKernel = class _RenderKernel {
|
|
|
9259
8504
|
};
|
|
9260
8505
|
|
|
9261
8506
|
// dist/modules/picking/picking-manager.js
|
|
9262
|
-
var
|
|
8507
|
+
var import_core32 = require("@luma.gl/core");
|
|
9263
8508
|
|
|
9264
8509
|
// dist/modules/picking/picking-uniforms.js
|
|
9265
8510
|
var DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];
|
|
@@ -9518,13 +8763,13 @@ var PickingManager = class _PickingManager {
|
|
|
9518
8763
|
format: "rgba8unorm",
|
|
9519
8764
|
width: 1,
|
|
9520
8765
|
height: 1,
|
|
9521
|
-
usage:
|
|
8766
|
+
usage: import_core32.Texture.RENDER_ATTACHMENT
|
|
9522
8767
|
});
|
|
9523
8768
|
const pickingTexture = this.device.createTexture({
|
|
9524
8769
|
format: "rg32sint",
|
|
9525
8770
|
width: 1,
|
|
9526
8771
|
height: 1,
|
|
9527
|
-
usage:
|
|
8772
|
+
usage: import_core32.Texture.RENDER_ATTACHMENT | import_core32.Texture.COPY_SRC
|
|
9528
8773
|
});
|
|
9529
8774
|
return this.device.createFramebuffer({
|
|
9530
8775
|
colorAttachments: [colorTexture, pickingTexture],
|
|
@@ -9536,7 +8781,7 @@ var PickingManager = class _PickingManager {
|
|
|
9536
8781
|
format: "rgba8unorm",
|
|
9537
8782
|
width: 1,
|
|
9538
8783
|
height: 1,
|
|
9539
|
-
usage:
|
|
8784
|
+
usage: import_core32.Texture.RENDER_ATTACHMENT | import_core32.Texture.COPY_SRC
|
|
9540
8785
|
});
|
|
9541
8786
|
return this.device.createFramebuffer({
|
|
9542
8787
|
colorAttachments: [pickingTexture],
|
|
@@ -9560,7 +8805,7 @@ var PickingManager = class _PickingManager {
|
|
|
9560
8805
|
const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
|
|
9561
8806
|
const readBuffer = this.device.createBuffer({
|
|
9562
8807
|
byteLength: layout.byteLength,
|
|
9563
|
-
usage:
|
|
8808
|
+
usage: import_core32.Buffer.COPY_DST | import_core32.Buffer.MAP_READ
|
|
9564
8809
|
});
|
|
9565
8810
|
try {
|
|
9566
8811
|
pickTexture.readBuffer({
|
|
@@ -9594,7 +8839,7 @@ var PickingManager = class _PickingManager {
|
|
|
9594
8839
|
const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
|
|
9595
8840
|
const readBuffer = this.device.createBuffer({
|
|
9596
8841
|
byteLength: layout.byteLength,
|
|
9597
|
-
usage:
|
|
8842
|
+
usage: import_core32.Buffer.COPY_DST | import_core32.Buffer.MAP_READ
|
|
9598
8843
|
});
|
|
9599
8844
|
try {
|
|
9600
8845
|
pickTexture.readBuffer({
|