@splnlss/3d-story-viewer 0.8.4 → 0.8.5
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/README.md +45 -1
- package/build/{main-DZ2oJmQ9.js → main-DCLbtFn7.js} +1234 -471
- package/build/main-DXC7nIw_.cjs +1 -0
- package/build/spark.module-BPiIta4L.cjs +1 -0
- package/build/{spark.module-OeW1hboi.js → spark.module-SbwV3up9.js} +235 -13
- package/build/types/src/main.d.ts +11 -1
- package/build/types/src/viewer/ContentLayer/ContentLayerRegistry.d.ts +31 -0
- package/build/types/src/viewer/ContentLayer/GeojsonLayer.d.ts +1 -0
- package/build/types/src/viewer/ContentLayer/MeshLayer.d.ts +4 -1
- package/build/types/src/viewer/ContentLayer/TilesLayer.d.ts +1 -0
- package/build/types/src/viewer/ContentLayer/gaussianSplatUtils.d.ts +6 -0
- package/build/types/src/viewer/DesktopLookControls.d.ts +22 -0
- package/build/types/src/viewer/GlobeManager.d.ts +3 -0
- package/build/types/src/viewer/SplatDestinationPrefetch.d.ts +18 -0
- package/build/types/src/viewer/WebXRSession.d.ts +2 -2
- package/build/types/src/viewer/XRDiagnosticsPanel.d.ts +14 -0
- package/build/types/src/viewer/XRRenderBridge.d.ts +3 -4
- package/build/types/src/viewer/index.d.ts +135 -7
- package/build/types/src/viewer/loadingDiagnostics.d.ts +10 -0
- package/build/types/src/workers/WorkerPool.d.ts +9 -3
- package/build/viewer.cjs +1 -1
- package/build/viewer.js +1 -1
- package/package.json +1 -1
- package/build/main-CNVle6K1.cjs +0 -1
- package/build/spark.module-HtQy_Ka9.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { V as Vector3, a as Vector2, ak as Euler, M as Matrix4, Q as Quaternion, k as Color, bh as Vector4, bz as DataArrayTexture, bA as RGIntegerFormat, bB as UnsignedIntType, bC as RGBAIntegerFormat, bD as WebGLArrayRenderTarget, y as NearestFilter, aX as DataTexture, e as Raycaster, aQ as RGBAFormat, aR as UnsignedByteType, O as Object3D, b as Mesh, c as ShaderMaterial, W as DoubleSide, bE as GLSL3, bF as Timer, bb as WebGLRenderTarget, m as SRGBColorSpace, ap as Matrix3, af as ColorManagement, a3 as PerspectiveCamera, a4 as OrthographicCamera, bG as WebGLCubeRenderTarget, l as LinearSRGBColorSpace, x as LinearFilter, b7 as LinearMipMapLinearFilter, bH as CubeCamera, bI as Camera, bJ as PMREMGenerator, U as MeshStandardMaterial, L as Loader, F as FileLoader, ai as Box3, aV as UnsignedShortType, aW as FloatType, S as ShaderChunk, bK as InstancedBufferGeometry, s as BufferAttribute, bg as Matrix2, b0 as REVISION, bL as RawShaderMaterial } from "./index-a8PLKOvo.js";
|
|
2
|
-
import { F as FullScreenQuad } from "./main-
|
|
2
|
+
import { F as FullScreenQuad } from "./main-DCLbtFn7.js";
|
|
3
3
|
const LN_SCALE_MIN = -12;
|
|
4
4
|
const LN_SCALE_MAX = 9;
|
|
5
5
|
const SCALE_MIN = Math.exp(LN_SCALE_MIN);
|
|
@@ -11160,7 +11160,8 @@ class PagedSplats {
|
|
|
11160
11160
|
requestHeader: this.requestHeader,
|
|
11161
11161
|
withCredentials: this.withCredentials,
|
|
11162
11162
|
offset: 0,
|
|
11163
|
-
bytes: tryBytes
|
|
11163
|
+
bytes: tryBytes,
|
|
11164
|
+
signal: this.abortController.signal
|
|
11164
11165
|
});
|
|
11165
11166
|
const metaStart = decode_rad_header(bytes);
|
|
11166
11167
|
if (metaStart) {
|
|
@@ -11179,7 +11180,7 @@ class PagedSplats {
|
|
|
11179
11180
|
chunkUrl(chunk) {
|
|
11180
11181
|
return this.rootUrl.replace(/-lod-0\./, `-lod-${chunk}.`);
|
|
11181
11182
|
}
|
|
11182
|
-
async fetchDecodeChunk(chunk) {
|
|
11183
|
+
async fetchDecodeChunk(chunk, requestSignal = this.abortController.signal) {
|
|
11183
11184
|
let decodeBytes = void 0;
|
|
11184
11185
|
if (this.fileType === SplatFileType.RAD) {
|
|
11185
11186
|
const { meta, chunksStart } = await this.getRadMeta();
|
|
@@ -11202,7 +11203,7 @@ class PagedSplats {
|
|
|
11202
11203
|
url: chunkUrl,
|
|
11203
11204
|
requestHeader: this.requestHeader,
|
|
11204
11205
|
withCredentials: this.withCredentials,
|
|
11205
|
-
signal:
|
|
11206
|
+
signal: requestSignal
|
|
11206
11207
|
});
|
|
11207
11208
|
} else {
|
|
11208
11209
|
offset += chunksStart;
|
|
@@ -11220,7 +11221,7 @@ class PagedSplats {
|
|
|
11220
11221
|
withCredentials: this.withCredentials,
|
|
11221
11222
|
offset,
|
|
11222
11223
|
bytes,
|
|
11223
|
-
signal:
|
|
11224
|
+
signal: requestSignal
|
|
11224
11225
|
});
|
|
11225
11226
|
} else {
|
|
11226
11227
|
throw new Error("No url or fileBytes provided");
|
|
@@ -11232,7 +11233,7 @@ class PagedSplats {
|
|
|
11232
11233
|
const request = new Request(url, {
|
|
11233
11234
|
headers: this.requestHeader ? new Headers(this.requestHeader) : void 0,
|
|
11234
11235
|
credentials: this.withCredentials ? "include" : "same-origin",
|
|
11235
|
-
signal:
|
|
11236
|
+
signal: requestSignal
|
|
11236
11237
|
});
|
|
11237
11238
|
const response = await fetch(request);
|
|
11238
11239
|
if (!response.ok || !response.body) {
|
|
@@ -11453,6 +11454,9 @@ const _SplatPager = class _SplatPager2 {
|
|
|
11453
11454
|
this.fetchers = [];
|
|
11454
11455
|
this.fetched = [];
|
|
11455
11456
|
this.fetchPriority = [];
|
|
11457
|
+
this.destinationRequests = /* @__PURE__ */ new Map();
|
|
11458
|
+
this.livePriority = /* @__PURE__ */ new Map();
|
|
11459
|
+
this.failedDestinationChunks = /* @__PURE__ */ new Map();
|
|
11456
11460
|
this.packedTexture = new DynoUsampler2DArray({
|
|
11457
11461
|
value: this.newUint32ArrayTexture(4)
|
|
11458
11462
|
});
|
|
@@ -11786,7 +11790,48 @@ const _SplatPager = class _SplatPager2 {
|
|
|
11786
11790
|
this.renderer.initTexture(texture2);
|
|
11787
11791
|
return texture2;
|
|
11788
11792
|
}
|
|
11793
|
+
setDestinationEntries(entries) {
|
|
11794
|
+
this.destinationRequests.clear();
|
|
11795
|
+
for (const { splats, chunk } of entries) {
|
|
11796
|
+
let chunks = this.destinationRequests.get(splats);
|
|
11797
|
+
if (!chunks) this.destinationRequests.set(splats, chunks = /* @__PURE__ */ new Set());
|
|
11798
|
+
chunks.add(chunk);
|
|
11799
|
+
}
|
|
11800
|
+
}
|
|
11801
|
+
reclassifyLiveChunks(entries) {
|
|
11802
|
+
var _a2;
|
|
11803
|
+
this.livePriority.clear();
|
|
11804
|
+
for (const { splats, chunk } of entries) {
|
|
11805
|
+
let chunks = this.livePriority.get(splats);
|
|
11806
|
+
if (!chunks) this.livePriority.set(splats, chunks = /* @__PURE__ */ new Set());
|
|
11807
|
+
chunks.add(chunk);
|
|
11808
|
+
}
|
|
11809
|
+
for (const fetcher of this.fetchers) {
|
|
11810
|
+
if ((_a2 = this.livePriority.get(fetcher.splats)) == null ? void 0 : _a2.has(fetcher.chunk)) fetcher.purpose = "live";
|
|
11811
|
+
}
|
|
11812
|
+
}
|
|
11813
|
+
clearDestinationEntries(recompute = true) {
|
|
11814
|
+
var _a2;
|
|
11815
|
+
const old = this.destinationRequests;
|
|
11816
|
+
const destinationOnly = (splats, chunk) => {
|
|
11817
|
+
var _a3, _b2;
|
|
11818
|
+
return ((_a3 = old.get(splats)) == null ? void 0 : _a3.has(chunk)) && !((_b2 = this.livePriority.get(splats)) == null ? void 0 : _b2.has(chunk));
|
|
11819
|
+
};
|
|
11820
|
+
this.fetchPriority = this.fetchPriority.filter(({ splats, chunk }) => !destinationOnly(splats, chunk));
|
|
11821
|
+
this.fetched = this.fetched.filter(({ splats, chunk }) => !destinationOnly(splats, chunk));
|
|
11822
|
+
for (const fetcher of [...this.fetchers]) {
|
|
11823
|
+
if (fetcher.purpose !== "destination" || !destinationOnly(fetcher.splats, fetcher.chunk)) continue;
|
|
11824
|
+
fetcher.cancelled = true;
|
|
11825
|
+
(_a2 = fetcher.controller) == null ? void 0 : _a2.abort();
|
|
11826
|
+
const index = this.fetchers.indexOf(fetcher);
|
|
11827
|
+
if (index >= 0) this.fetchers.splice(index, 1);
|
|
11828
|
+
}
|
|
11829
|
+
this.destinationRequests = /* @__PURE__ */ new Map();
|
|
11830
|
+
this.failedDestinationChunks.clear();
|
|
11831
|
+
if (recompute && this.autoDrive) this.driveFetchers();
|
|
11832
|
+
}
|
|
11789
11833
|
driveFetchers() {
|
|
11834
|
+
var _a2, _b2, _c;
|
|
11790
11835
|
const needed = [];
|
|
11791
11836
|
const overflow = [];
|
|
11792
11837
|
let numPages = 0;
|
|
@@ -11810,12 +11855,19 @@ const _SplatPager = class _SplatPager2 {
|
|
|
11810
11855
|
continue;
|
|
11811
11856
|
}
|
|
11812
11857
|
if (numPages < this.maxPages && this.fetchers.length < this.numFetchers) {
|
|
11858
|
+
const purpose = ((_a2 = this.destinationRequests.get(splats)) == null ? void 0 : _a2.has(chunk)) && !((_b2 = this.livePriority.get(splats)) == null ? void 0 : _b2.has(chunk)) ? "destination" : "live";
|
|
11859
|
+
if (purpose === "destination") {
|
|
11860
|
+
if ((_c = this.failedDestinationChunks.get(splats)) == null ? void 0 : _c.has(chunk)) continue;
|
|
11861
|
+
if (this.fetchers.some((entry) => entry.purpose === "destination") || this.pageFreelist.length <= this.fetchers.length) continue;
|
|
11862
|
+
}
|
|
11813
11863
|
numPages += 1;
|
|
11814
|
-
const
|
|
11864
|
+
const controller = purpose === "destination" ? new AbortController() : null;
|
|
11865
|
+
const requestSignal = controller ? AbortSignal.any([splats.abortController.signal, controller.signal]) : splats.abortController.signal;
|
|
11866
|
+
const fetcher = { splats, chunk, purpose, controller, cancelled: false };
|
|
11815
11867
|
this.fetchers.push(fetcher);
|
|
11816
|
-
const promise = splats.fetchDecodeChunk(chunk).then(
|
|
11868
|
+
const promise = splats.fetchDecodeChunk(chunk, requestSignal).then(
|
|
11817
11869
|
async (data) => {
|
|
11818
|
-
if (splats.abortController.signal.aborted) {
|
|
11870
|
+
if (fetcher.cancelled || splats.abortController.signal.aborted) {
|
|
11819
11871
|
return;
|
|
11820
11872
|
}
|
|
11821
11873
|
this.fetched.push({ splats, chunk, data });
|
|
@@ -11826,6 +11878,12 @@ const _SplatPager = class _SplatPager2 {
|
|
|
11826
11878
|
}
|
|
11827
11879
|
},
|
|
11828
11880
|
async (error) => {
|
|
11881
|
+
if (fetcher.cancelled || error.name === "AbortError") return;
|
|
11882
|
+
if (purpose === "destination") {
|
|
11883
|
+
let failed = this.failedDestinationChunks.get(splats);
|
|
11884
|
+
if (!failed) this.failedDestinationChunks.set(splats, failed = /* @__PURE__ */ new Set());
|
|
11885
|
+
failed.add(chunk);
|
|
11886
|
+
}
|
|
11829
11887
|
if (error.name !== "AbortError") {
|
|
11830
11888
|
console.warn(error);
|
|
11831
11889
|
}
|
|
@@ -11834,8 +11892,10 @@ const _SplatPager = class _SplatPager2 {
|
|
|
11834
11892
|
}
|
|
11835
11893
|
).finally(() => {
|
|
11836
11894
|
const fetchIndex = this.fetchers.indexOf(fetcher);
|
|
11837
|
-
|
|
11838
|
-
|
|
11895
|
+
if (fetchIndex >= 0) {
|
|
11896
|
+
this.fetchers[fetchIndex] = this.fetchers[this.fetchers.length - 1];
|
|
11897
|
+
this.fetchers.length--;
|
|
11898
|
+
}
|
|
11839
11899
|
this.processFetched();
|
|
11840
11900
|
});
|
|
11841
11901
|
promise.then((data) => {
|
|
@@ -13489,6 +13549,9 @@ const _SparkRenderer = class _SparkRenderer2 extends Mesh {
|
|
|
13489
13549
|
this.lodInitQueue = [];
|
|
13490
13550
|
this.lodInstances = /* @__PURE__ */ new Map();
|
|
13491
13551
|
this.lodUpdates = [];
|
|
13552
|
+
this.destinationHint = null;
|
|
13553
|
+
this.destinationArrivalHold = null;
|
|
13554
|
+
this.pendingDestinationCancel = false;
|
|
13492
13555
|
this.lastTraverseTime = 0;
|
|
13493
13556
|
this.pagerId = 0;
|
|
13494
13557
|
this.superXY = 1;
|
|
@@ -13701,6 +13764,146 @@ const _SparkRenderer = class _SparkRenderer2 extends Mesh {
|
|
|
13701
13764
|
this.pager = void 0;
|
|
13702
13765
|
}
|
|
13703
13766
|
}
|
|
13767
|
+
releasePagedSplats(splats) {
|
|
13768
|
+
var _a2;
|
|
13769
|
+
if (!splats) return Promise.resolve();
|
|
13770
|
+
splats.abortController.abort();
|
|
13771
|
+
if (this.viewerDisposed) return Promise.resolve();
|
|
13772
|
+
if ((_a2 = this.destinationHint) == null ? void 0 : _a2.meshes.some((mesh) => mesh.paged === splats)) this.clearDestinationHint(false);
|
|
13773
|
+
if (this.destinationArrivalHold) this.destinationArrivalHold = this.destinationArrivalHold.filter((entry) => entry.splats !== splats);
|
|
13774
|
+
const pager = this.pager;
|
|
13775
|
+
if (pager) {
|
|
13776
|
+
pager.fetchPriority = pager.fetchPriority.filter((entry) => entry.splats !== splats);
|
|
13777
|
+
pager.fetched = pager.fetched.filter((entry) => entry.splats !== splats);
|
|
13778
|
+
pager.fetchers = pager.fetchers.filter((entry) => entry.splats !== splats);
|
|
13779
|
+
}
|
|
13780
|
+
this.lodMeshes = this.lodMeshes.filter(({ mesh }) => mesh.paged !== splats);
|
|
13781
|
+
this.lodInitQueue = this.lodInitQueue.filter((entry) => entry !== splats);
|
|
13782
|
+
this.lodDirty = true;
|
|
13783
|
+
const release = async (worker) => {
|
|
13784
|
+
if (this.viewerDisposed) return;
|
|
13785
|
+
const record = this.lodIds.get(splats);
|
|
13786
|
+
if (record) {
|
|
13787
|
+
this.lodIds.delete(splats);
|
|
13788
|
+
this.lodIdToSplats.delete(record.lodId);
|
|
13789
|
+
this.lodUpdates = this.lodUpdates.filter((entry) => entry.lodId !== record.lodId);
|
|
13790
|
+
for (const [mesh, instance] of this.lodInstances) {
|
|
13791
|
+
if (instance.lodId === record.lodId) {
|
|
13792
|
+
instance.texture.dispose();
|
|
13793
|
+
this.lodInstances.delete(mesh);
|
|
13794
|
+
}
|
|
13795
|
+
}
|
|
13796
|
+
}
|
|
13797
|
+
if (pager) {
|
|
13798
|
+
pager.fetchPriority = pager.fetchPriority.filter((entry) => entry.splats !== splats);
|
|
13799
|
+
pager.fetched = pager.fetched.filter((entry) => entry.splats !== splats);
|
|
13800
|
+
pager.fetchers = pager.fetchers.filter((entry) => entry.splats !== splats);
|
|
13801
|
+
const pages = /* @__PURE__ */ new Set();
|
|
13802
|
+
for (const entry of pager.splatsChunkToPage.get(splats) ?? []) {
|
|
13803
|
+
if (entry) pages.add(entry.page);
|
|
13804
|
+
}
|
|
13805
|
+
pager.newUploads = pager.newUploads.filter((entry) => !pages.has(entry.page));
|
|
13806
|
+
pager.readyUploads = pager.readyUploads.filter((entry) => !pages.has(entry.page));
|
|
13807
|
+
pager.lodTreeUpdates = pager.lodTreeUpdates.filter((entry) => entry.splats !== splats);
|
|
13808
|
+
pager.removeSplats(splats);
|
|
13809
|
+
if (pager.autoDrive) pager.driveFetchers();
|
|
13810
|
+
}
|
|
13811
|
+
if (record && worker) await worker.call("disposeLodTree", { lodId: record.lodId });
|
|
13812
|
+
};
|
|
13813
|
+
const pending = this.lodWorker ? this.lodWorker.exclusive(release) : release(null);
|
|
13814
|
+
return pending.catch((error) => {
|
|
13815
|
+
if (!this.viewerDisposed) console.error(error);
|
|
13816
|
+
});
|
|
13817
|
+
}
|
|
13818
|
+
setDestinationHint(hint) {
|
|
13819
|
+
if (this.viewerDisposed) return;
|
|
13820
|
+
this.clearDestinationHint(false);
|
|
13821
|
+
this.destinationHint = { ...hint, entries: [] };
|
|
13822
|
+
this.destinationArrivalHold = null;
|
|
13823
|
+
this.lodDirty = true;
|
|
13824
|
+
}
|
|
13825
|
+
clearDestinationHint(arrival = false) {
|
|
13826
|
+
const hint = this.destinationHint;
|
|
13827
|
+
if (!hint) return;
|
|
13828
|
+
this.destinationHint = null;
|
|
13829
|
+
if (arrival) {
|
|
13830
|
+
this.destinationArrivalHold = hint.entries.filter(({ splats, chunk }) => {
|
|
13831
|
+
var _a2;
|
|
13832
|
+
return (_a2 = this.pager) == null ? void 0 : _a2.getSplatsChunk(splats, chunk);
|
|
13833
|
+
});
|
|
13834
|
+
} else {
|
|
13835
|
+
this.destinationArrivalHold = null;
|
|
13836
|
+
this.pendingDestinationCancel = true;
|
|
13837
|
+
if (this.pager) {
|
|
13838
|
+
this.pager.fetchPriority = this.pager.fetchPriority.filter(
|
|
13839
|
+
({ splats, chunk }) => {
|
|
13840
|
+
var _a2, _b2;
|
|
13841
|
+
return !((_a2 = this.pager.destinationRequests.get(splats)) == null ? void 0 : _a2.has(chunk)) || ((_b2 = this.pager.livePriority.get(splats)) == null ? void 0 : _b2.has(chunk));
|
|
13842
|
+
}
|
|
13843
|
+
);
|
|
13844
|
+
this.pager.fetched = this.pager.fetched.filter(
|
|
13845
|
+
({ splats, chunk }) => {
|
|
13846
|
+
var _a2, _b2;
|
|
13847
|
+
return !((_a2 = this.pager.destinationRequests.get(splats)) == null ? void 0 : _a2.has(chunk)) || ((_b2 = this.pager.livePriority.get(splats)) == null ? void 0 : _b2.has(chunk));
|
|
13848
|
+
}
|
|
13849
|
+
);
|
|
13850
|
+
}
|
|
13851
|
+
}
|
|
13852
|
+
this.lodDirty = true;
|
|
13853
|
+
}
|
|
13854
|
+
async traverseDestinationHint(worker, pixelScaleLimit, renderOrigin) {
|
|
13855
|
+
var _a2, _b2;
|
|
13856
|
+
const hint = this.destinationHint;
|
|
13857
|
+
if (!hint || !this.pager) return;
|
|
13858
|
+
hint.entries = hint.entries.filter(
|
|
13859
|
+
({ splats, chunk }) => {
|
|
13860
|
+
var _a3;
|
|
13861
|
+
return hint.meshes.some((mesh) => mesh.paged === splats) && !((_a3 = this.pager.failedDestinationChunks.get(splats)) == null ? void 0 : _a3.has(chunk));
|
|
13862
|
+
}
|
|
13863
|
+
);
|
|
13864
|
+
if (hint.entries.length >= hint.maxChunks) return;
|
|
13865
|
+
const instances = {};
|
|
13866
|
+
for (const mesh of hint.meshes) {
|
|
13867
|
+
if (!mesh.paged || mesh.paged.abortController.signal.aborted || !mesh.visible || !mesh.parent) continue;
|
|
13868
|
+
const record = this.lodIds.get(mesh.paged);
|
|
13869
|
+
if ((record == null ? void 0 : record.rootPage) === void 0) continue;
|
|
13870
|
+
mesh.updateMatrixWorld();
|
|
13871
|
+
const destinationView = new Matrix4().compose(
|
|
13872
|
+
hint.position.clone().sub(renderOrigin),
|
|
13873
|
+
hint.quaternion,
|
|
13874
|
+
new Vector3(1, 1, 1)
|
|
13875
|
+
);
|
|
13876
|
+
const objectToRender = mesh.matrixWorld.clone();
|
|
13877
|
+
objectToRender.setPosition(mesh.getWorldPosition(new Vector3()).sub(renderOrigin));
|
|
13878
|
+
instances[mesh.uuid] = {
|
|
13879
|
+
instanceId: mesh.uuid,
|
|
13880
|
+
lodId: record.lodId,
|
|
13881
|
+
rootPage: record.rootPage,
|
|
13882
|
+
viewToObjectCols: objectToRender.invert().multiply(destinationView).elements.slice(),
|
|
13883
|
+
lodScale: mesh.lodScale,
|
|
13884
|
+
behindFoveate: mesh.behindFoveate ?? this.behindFoveate,
|
|
13885
|
+
coneFov0: mesh.coneFov0 ?? this.coneFov0,
|
|
13886
|
+
coneFov: mesh.coneFov ?? this.coneFov,
|
|
13887
|
+
coneFoveate: mesh.coneFoveate ?? this.coneFoveate
|
|
13888
|
+
};
|
|
13889
|
+
}
|
|
13890
|
+
if (Object.keys(instances).length === 0) return;
|
|
13891
|
+
const result = await worker.call("traverseLodTrees", {
|
|
13892
|
+
maxSplats: hint.maxSplats,
|
|
13893
|
+
pixelScaleLimit,
|
|
13894
|
+
lastPixelLimit: this.lastPixelLimit,
|
|
13895
|
+
instances,
|
|
13896
|
+
traverseMode: this.lodTraverseMode
|
|
13897
|
+
});
|
|
13898
|
+
if (this.viewerDisposed || hint !== this.destinationHint) return;
|
|
13899
|
+
for (const [lodId, chunk] of result.chunks) {
|
|
13900
|
+
if (chunk === 0 || hint.entries.length >= hint.maxChunks) continue;
|
|
13901
|
+
const splats = this.lodIdToSplats.get(lodId);
|
|
13902
|
+
if (!splats || ((_a2 = this.pager.livePriority.get(splats)) == null ? void 0 : _a2.has(chunk)) || ((_b2 = this.pager.failedDestinationChunks.get(splats)) == null ? void 0 : _b2.has(chunk))) continue;
|
|
13903
|
+
if (hint.entries.some((entry) => entry.splats === splats && entry.chunk === chunk)) continue;
|
|
13904
|
+
hint.entries.push({ splats, chunk });
|
|
13905
|
+
}
|
|
13906
|
+
}
|
|
13704
13907
|
setDirty() {
|
|
13705
13908
|
var _a2;
|
|
13706
13909
|
if (!this.dirty) {
|
|
@@ -14208,6 +14411,7 @@ const _SparkRenderer = class _SparkRenderer2 extends Mesh {
|
|
|
14208
14411
|
}
|
|
14209
14412
|
}
|
|
14210
14413
|
async updateLodInstances(worker, deltaPred, lodMeshes, maxSplats, lodPos, viewPos, viewQuat, renderOrigin, pixelScaleLimit) {
|
|
14414
|
+
var _a2, _b2;
|
|
14211
14415
|
const uuidToMesh = /* @__PURE__ */ new Map();
|
|
14212
14416
|
const cameraToWorld = this.lodCameraToWorld.compose(
|
|
14213
14417
|
viewPos,
|
|
@@ -14216,12 +14420,12 @@ const _SparkRenderer = class _SparkRenderer2 extends Mesh {
|
|
|
14216
14420
|
);
|
|
14217
14421
|
const instances = lodMeshes.reduce(
|
|
14218
14422
|
(instances2, mesh) => {
|
|
14219
|
-
var
|
|
14423
|
+
var _a22, _b22;
|
|
14220
14424
|
uuidToMesh.set(mesh.uuid, mesh);
|
|
14221
14425
|
const viewToObject = this.lodViewToObject.copy(mesh.matrixWorld).setPosition(
|
|
14222
14426
|
this.lodMeshOrigin.setFromMatrixPosition(mesh.matrixWorld).sub(renderOrigin)
|
|
14223
14427
|
).invert().multiply(cameraToWorld);
|
|
14224
|
-
const splats = ((
|
|
14428
|
+
const splats = ((_a22 = mesh.packedSplats) == null ? void 0 : _a22.lodSplats) ?? ((_b22 = mesh.extSplats) == null ? void 0 : _b22.lodSplats) ?? mesh.paged;
|
|
14225
14429
|
if (!splats) {
|
|
14226
14430
|
return instances2;
|
|
14227
14431
|
}
|
|
@@ -14295,10 +14499,28 @@ const _SparkRenderer = class _SparkRenderer2 extends Mesh {
|
|
|
14295
14499
|
}
|
|
14296
14500
|
}
|
|
14297
14501
|
}
|
|
14502
|
+
this.pager.reclassifyLiveChunks(this.pager.fetchPriority);
|
|
14503
|
+
if (this.pendingDestinationCancel) {
|
|
14504
|
+
this.pager.clearDestinationEntries(false);
|
|
14505
|
+
this.pendingDestinationCancel = false;
|
|
14506
|
+
}
|
|
14507
|
+
let arrivalHandoff = false;
|
|
14508
|
+
if (this.destinationHint) {
|
|
14509
|
+
await this.traverseDestinationHint(worker, pixelScaleLimit, renderOrigin);
|
|
14510
|
+
if (this.viewerDisposed) return;
|
|
14511
|
+
this.pager.setDestinationEntries(((_a2 = this.destinationHint) == null ? void 0 : _a2.entries) ?? []);
|
|
14512
|
+
for (const entry of ((_b2 = this.destinationHint) == null ? void 0 : _b2.entries) ?? []) this.pager.fetchPriority.push(entry);
|
|
14513
|
+
} else if (this.destinationArrivalHold) {
|
|
14514
|
+
this.pager.setDestinationEntries(this.destinationArrivalHold);
|
|
14515
|
+
for (const entry of this.destinationArrivalHold) this.pager.fetchPriority.push(entry);
|
|
14516
|
+
this.destinationArrivalHold = null;
|
|
14517
|
+
arrivalHandoff = true;
|
|
14518
|
+
}
|
|
14298
14519
|
this.pager.autoDrive = this.enableLodFetching;
|
|
14299
14520
|
if (this.enableLodFetching) {
|
|
14300
14521
|
this.pager.driveFetchers();
|
|
14301
14522
|
}
|
|
14523
|
+
if (arrivalHandoff) this.pager.clearDestinationEntries(false);
|
|
14302
14524
|
}
|
|
14303
14525
|
if (this.lodRaycast && performance.now() - this.lastLodRaycastTime >= this.lodRaycastIntervalMs) {
|
|
14304
14526
|
this.lastLodRaycastTime = performance.now();
|
|
@@ -81,7 +81,7 @@ export type MeshLayerDefinition = {
|
|
|
81
81
|
url: string;
|
|
82
82
|
};
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* A local-model transform is mutually exclusive with offset/offsetOrigin. Anchor longitude/latitude are WGS84 decimal degrees; altitude is ellipsoidal meters. Translation is ENU meters, XYZ rotation is degrees, scale is dimensionless. A missing rotation defaults to [90,0,0] for glTF Y-up. Legacy offsets translate existing ECEF geometry.
|
|
85
85
|
*/
|
|
86
86
|
options?: {
|
|
87
87
|
renderOrder?: number;
|
|
@@ -95,6 +95,16 @@ export type MeshLayerDefinition = {
|
|
|
95
95
|
latitude: number;
|
|
96
96
|
altitude: number;
|
|
97
97
|
};
|
|
98
|
+
transform?: {
|
|
99
|
+
anchor: {
|
|
100
|
+
longitude: number;
|
|
101
|
+
latitude: number;
|
|
102
|
+
altitude: number;
|
|
103
|
+
};
|
|
104
|
+
translationENU?: Vector3Tuple;
|
|
105
|
+
rotationDegrees?: Vector3Tuple;
|
|
106
|
+
scale?: number;
|
|
107
|
+
};
|
|
98
108
|
};
|
|
99
109
|
};
|
|
100
110
|
export type GeojsonLayerDefinition = {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Owns active named layers; definitions alone do not create loader resources. */
|
|
2
|
+
export class ContentLayerRegistry {
|
|
3
|
+
/** @param {{ group?: import('three').Group, createLayer?: (definition: any) => any, onError?: (definition: any, error: Error) => void, onAllSplatsDisabled?: () => void }} [options] */
|
|
4
|
+
constructor({ group, createLayer, onError, onAllSplatsDisabled }?: {
|
|
5
|
+
group?: import("three").Group;
|
|
6
|
+
createLayer?: (definition: any) => any;
|
|
7
|
+
onError?: (definition: any, error: Error) => void;
|
|
8
|
+
onAllSplatsDisabled?: () => void;
|
|
9
|
+
});
|
|
10
|
+
group: import("three").Group<import("three").Object3DEventMap>;
|
|
11
|
+
createLayer: (definition: any) => any;
|
|
12
|
+
onError: (definition: any, error: Error) => void;
|
|
13
|
+
onAllSplatsDisabled: () => void;
|
|
14
|
+
definitions: any[];
|
|
15
|
+
enabledLabels: Set<any>;
|
|
16
|
+
active: Map<any, any>;
|
|
17
|
+
timeFrameStart: any;
|
|
18
|
+
timeFrameEnd: any;
|
|
19
|
+
disposed: boolean;
|
|
20
|
+
setDefinitions(definitions?: any[]): void;
|
|
21
|
+
setEnabledLabels(labels?: any[]): void;
|
|
22
|
+
setTimeFrame(start: any, end: any): void;
|
|
23
|
+
getActiveLayer(id: any): any;
|
|
24
|
+
createActiveLayer(definition: any): any;
|
|
25
|
+
orderActiveLayers(): void;
|
|
26
|
+
/** Replace one definition while preserving unrelated live layers. */
|
|
27
|
+
replaceDefinition(id: any, definition: any): boolean;
|
|
28
|
+
reconcile(): void;
|
|
29
|
+
clear(): void;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export class MeshLayer extends ContentLayer {
|
|
2
2
|
constructor(url: any, options?: {}, callbacks?: {});
|
|
3
3
|
isMeshLayer: boolean;
|
|
4
|
-
|
|
4
|
+
xrRenderLayer: number;
|
|
5
|
+
abortController: AbortController;
|
|
6
|
+
disposed: boolean;
|
|
7
|
+
mesh: any;
|
|
5
8
|
}
|
|
6
9
|
import { ContentLayer } from '.';
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export function validateGaussianSplatLayerDefinition(definition: any): any;
|
|
2
2
|
export function makeGaussianSplatTransform(transform: any): Matrix4;
|
|
3
|
+
export function normalizeLocalMeshTransform(transform: any): {
|
|
4
|
+
anchor: any;
|
|
5
|
+
translationENU: any[];
|
|
6
|
+
rotationDegrees: any[];
|
|
7
|
+
scale: any;
|
|
8
|
+
};
|
|
3
9
|
import { Matrix4 } from 'three';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class DesktopLookControls {
|
|
2
|
+
constructor(canvas: any, onLook: any);
|
|
3
|
+
canvas: any;
|
|
4
|
+
onLook: any;
|
|
5
|
+
root: any;
|
|
6
|
+
window: any;
|
|
7
|
+
pointer: {
|
|
8
|
+
id: any;
|
|
9
|
+
startX: any;
|
|
10
|
+
startY: any;
|
|
11
|
+
x: any;
|
|
12
|
+
y: any;
|
|
13
|
+
dragging: boolean;
|
|
14
|
+
};
|
|
15
|
+
down: (event: any) => void;
|
|
16
|
+
move: (event: any) => void;
|
|
17
|
+
end: (event: any) => void;
|
|
18
|
+
wheel: (event: any) => any;
|
|
19
|
+
contextMenu: (event: any) => any;
|
|
20
|
+
handleKeyDown(event: any): boolean;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
@@ -7,12 +7,15 @@ export class GlobeManager extends EventDispatcher {
|
|
|
7
7
|
destinationTileCamera: PerspectiveCamera;
|
|
8
8
|
destinationTileResolution: number;
|
|
9
9
|
previousAutoDisableRendererCulling: boolean;
|
|
10
|
+
parseQueueTimer: number;
|
|
10
11
|
dracoLoader: any;
|
|
11
12
|
ownsDecoders: boolean;
|
|
12
13
|
decoders: any;
|
|
13
14
|
apiToken: any;
|
|
14
15
|
googleMapsToken: any;
|
|
15
16
|
initTiles(): void;
|
|
17
|
+
startParseQueuePump(): void;
|
|
18
|
+
stopParseQueuePump(): void;
|
|
16
19
|
attachTileLoadListener(): void;
|
|
17
20
|
/** The renderer shares one cache and request scheduler between both registered cameras. */
|
|
18
21
|
setDestinationTilePrefetch(target: any): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Owns one temporary destination viewpoint; layer definitions stay independent. */
|
|
2
|
+
export class SplatDestinationPrefetch {
|
|
3
|
+
constructor({ getRenderer, getLayer }: {
|
|
4
|
+
getRenderer: any;
|
|
5
|
+
getLayer: any;
|
|
6
|
+
});
|
|
7
|
+
getRenderer: any;
|
|
8
|
+
getLayer: any;
|
|
9
|
+
target: any;
|
|
10
|
+
boundRenderer: any;
|
|
11
|
+
boundMeshes: any[];
|
|
12
|
+
timeoutId: number;
|
|
13
|
+
disposed: boolean;
|
|
14
|
+
set(target: any): void;
|
|
15
|
+
sync(): void;
|
|
16
|
+
clear(reason?: string): void;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
@@ -18,7 +18,6 @@ export class WebXRSession {
|
|
|
18
18
|
pose: XRViewerPose;
|
|
19
19
|
}) => void;
|
|
20
20
|
onStateChange: (active: boolean) => void;
|
|
21
|
-
showAttribution: boolean;
|
|
22
21
|
session: any;
|
|
23
22
|
starting: any;
|
|
24
23
|
bridge: {
|
|
@@ -29,7 +28,8 @@ export class WebXRSession {
|
|
|
29
28
|
direction: import("three").Vector3Tuple;
|
|
30
29
|
};
|
|
31
30
|
setNavigationCue: (cue: any) => void;
|
|
32
|
-
setTerrainCredits: (
|
|
31
|
+
setTerrainCredits: () => void;
|
|
32
|
+
setDiagnosticsRows(rows: any): void;
|
|
33
33
|
setPlayerPose(pose: any): void;
|
|
34
34
|
setVisualBlend(blend: any): void;
|
|
35
35
|
hasUi(): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A small head-local canvas, drawn by the shared layer-31 pass for both eyes. */
|
|
2
|
+
export class XRDiagnosticsPanel {
|
|
3
|
+
context: CanvasRenderingContext2D;
|
|
4
|
+
texture: CanvasTexture<HTMLCanvasElement>;
|
|
5
|
+
mesh: Mesh<PlaneGeometry, MeshBasicMaterial, import("three").Object3DEventMap>;
|
|
6
|
+
rows: any[];
|
|
7
|
+
setRows(rows: any): void;
|
|
8
|
+
update(headMatrix: any): void;
|
|
9
|
+
dispose(): void;
|
|
10
|
+
}
|
|
11
|
+
import { CanvasTexture } from 'three';
|
|
12
|
+
import { PlaneGeometry } from 'three';
|
|
13
|
+
import { MeshBasicMaterial } from 'three';
|
|
14
|
+
import { Mesh } from 'three';
|
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
* @param {XRRigidTransform} initialHeadPose
|
|
6
6
|
* @param {{ showAttribution?: boolean }} [options]
|
|
7
7
|
*/
|
|
8
|
-
export function createXRRenderBridge(viewer: import("./index.js").default, initialHeadPose: XRRigidTransform, {
|
|
9
|
-
showAttribution?: boolean;
|
|
10
|
-
}): {
|
|
8
|
+
export function createXRRenderBridge(viewer: import("./index.js").default, initialHeadPose: XRRigidTransform, _options?: {}): {
|
|
11
9
|
getHeadPose: () => import("./XRPlayerRig.js").XRHeadPose;
|
|
12
10
|
getHeadForward: () => import("three").Vector3Tuple;
|
|
13
11
|
getControllerWorldRay: (controller: any) => {
|
|
@@ -15,7 +13,8 @@ export function createXRRenderBridge(viewer: import("./index.js").default, initi
|
|
|
15
13
|
direction: import("three").Vector3Tuple;
|
|
16
14
|
};
|
|
17
15
|
setNavigationCue: (cue: any) => void;
|
|
18
|
-
setTerrainCredits: (
|
|
16
|
+
setTerrainCredits: () => void;
|
|
17
|
+
setDiagnosticsRows(rows: any): void;
|
|
19
18
|
setPlayerPose(pose: any): void;
|
|
20
19
|
setVisualBlend(blend: any): void;
|
|
21
20
|
hasUi(): boolean;
|