@loaders.gl/tile-converter 5.0.0-alpha.11 → 5.0.0-alpha.12
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 +178 -2
- package/bin/converter-v5.js +2 -0
- package/dist/converter.min.cjs +162 -163
- package/dist/i3s-server/bin/i3s-server.min.cjs +73 -73
- package/dist/index.cjs +1749 -2152
- package/dist/index.js +1748 -2162
- package/dist/v5/adapters.cjs +1550 -128
- package/dist/v5/adapters.d.ts +16 -0
- package/dist/v5/adapters.js +1558 -117
- package/dist/v5/archive-source.d.ts +36 -0
- package/dist/v5/browser-tileset-source.d.ts +55 -11
- package/dist/v5/browser.cjs +18 -0
- package/dist/v5/browser.d.ts +14 -0
- package/dist/v5/browser.js +26 -0
- package/dist/v5/conversion-api.d.ts +9 -0
- package/dist/v5/converter-cli.d.ts +1 -0
- package/dist/v5/converter-cli.js +1214 -0
- package/dist/v5/core.cjs +471 -60
- package/dist/v5/core.d.ts +2 -0
- package/dist/v5/core.js +471 -60
- package/dist/v5/i3s-mesh-conversion.d.ts +4 -0
- package/dist/v5/i3s-selection-source.d.ts +70 -0
- package/dist/v5/index.cjs +10 -0
- package/dist/v5/index.d.ts +8 -0
- package/dist/v5/index.js +14 -0
- package/dist/v5/mesh-conversion.d.ts +18 -0
- package/dist/v5/mesh-hierarchy.d.ts +47 -0
- package/dist/v5/mesh-source-features.d.ts +2 -1
- package/dist/v5/mesh-source-schema.d.ts +12 -0
- package/dist/v5/mesh-source.d.ts +5 -2
- package/dist/v5/mesh-tileset-sink.d.ts +5 -0
- package/dist/v5/node-cli.d.ts +9 -0
- package/dist/v5/node-conversion.d.ts +32 -0
- package/dist/v5/node-feature-schema.d.ts +3 -0
- package/dist/v5/node-i3s-source.d.ts +41 -0
- package/dist/v5/node-source.d.ts +47 -0
- package/dist/v5/node.cjs +900 -0
- package/dist/v5/node.d.ts +6 -0
- package/dist/v5/node.js +877 -0
- package/dist/v5/point-cloud-file.d.ts +83 -0
- package/dist/v5/point-cloud-potree.d.ts +47 -0
- package/dist/v5/point-cloud-tileset.d.ts +44 -0
- package/dist/v5/resource-manifest.d.ts +10 -1
- package/dist/v5/selected-mesh-source.d.ts +53 -0
- package/package.json +33 -25
- package/src/index.ts +4 -1
- package/src/v4/3d-tiles-converter/helpers/load-i3s.ts +2 -4
- package/src/v4/converter-cli.ts +8 -2
- package/src/v4/i3s-converter/helpers/load-3d-tiles.ts +3 -51
- package/src/v4/i3s-converter/helpers/node-index-document.ts +5 -2
- package/src/v4/i3s-converter/helpers/preprocess-3d-tiles.ts +1 -1
- package/src/v4/i3s-converter/json-templates/store.ts +2 -1
- package/src/v5/adapters.ts +48 -0
- package/src/v5/archive-source.ts +235 -0
- package/src/v5/browser-tileset-source.ts +418 -48
- package/src/v5/browser.ts +45 -0
- package/src/v5/conversion-api.ts +69 -9
- package/src/v5/converter-cli.ts +28 -0
- package/src/v5/core.ts +6 -0
- package/src/v5/i3s-mesh-conversion.ts +40 -2
- package/src/v5/i3s-mesh-sink.ts +1 -1
- package/src/v5/i3s-mesh-source.ts +1 -0
- package/src/v5/i3s-selection-source.ts +298 -0
- package/src/v5/index.ts +26 -0
- package/src/v5/mesh-conversion.ts +20 -0
- package/src/v5/mesh-hierarchy.ts +648 -0
- package/src/v5/mesh-source-features.ts +39 -7
- package/src/v5/mesh-source-schema.ts +134 -0
- package/src/v5/mesh-source.ts +16 -4
- package/src/v5/mesh-tileset-sink.ts +1 -1
- package/src/v5/node-cli.ts +197 -0
- package/src/v5/node-conversion.ts +345 -0
- package/src/v5/node-feature-schema.ts +155 -0
- package/src/v5/node-i3s-source.ts +181 -0
- package/src/v5/node-source.ts +328 -0
- package/src/v5/node.ts +16 -0
- package/src/v5/point-cloud-file.ts +306 -0
- package/src/v5/point-cloud-potree.ts +130 -0
- package/src/v5/point-cloud-tileset.ts +137 -0
- package/src/v5/resource-fetcher.ts +4 -1
- package/src/v5/resource-manifest.ts +40 -5
- package/src/v5/selected-mesh-source.ts +384 -0
- package/src/v5/spatial-conversion.ts +88 -17
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { COPCTileSource, COPCSourceLoaderOptions } from '@loaders.gl/copc';
|
|
2
|
+
import { PotreeSourceLoader } from '@loaders.gl/potree';
|
|
3
|
+
import type { PotreeDataset, PotreeWriterNode, PotreeWriterOptions, PotreeSourceLoaderOptions } from '@loaders.gl/potree';
|
|
4
|
+
import type { Mesh, MeshArrowTable, MeshGeometry } from '@loaders.gl/schema';
|
|
5
|
+
/** Explicit local-file input; no format is inferred from an extension. */
|
|
6
|
+
export type OpenPointCloudFileOptions = {
|
|
7
|
+
/** Maximum retained input Blob size. This does not bound decoded heap. */
|
|
8
|
+
readonly maxFileBytes: number;
|
|
9
|
+
/** Cancellation before/after initialization and during archived resource reads. */
|
|
10
|
+
readonly signal?: AbortSignal;
|
|
11
|
+
} & ({
|
|
12
|
+
/** COPC is a native single LAZ file. */
|
|
13
|
+
readonly format: 'copc';
|
|
14
|
+
/** Existing COPC source coordinate and decoder controls. */
|
|
15
|
+
readonly sourceOptions?: COPCSourceLoaderOptions;
|
|
16
|
+
} | {
|
|
17
|
+
/** A loaders.gl STORE ZIP convention, not a native Potree archive standard. */
|
|
18
|
+
readonly format: 'potree-zip';
|
|
19
|
+
/** Maximum ZIP entry count, including metadata; default 100000. */
|
|
20
|
+
readonly maxEntries?: number;
|
|
21
|
+
/** Maximum requested ZIP resource/range bytes; default 64 MiB. */
|
|
22
|
+
readonly maxResourceBytes?: number;
|
|
23
|
+
/** Explicit metadata path when it is not at the ZIP root. */
|
|
24
|
+
readonly metadataPath?: string;
|
|
25
|
+
/** Existing Potree parser controls; the bundle owns its isolated fetch transport. */
|
|
26
|
+
readonly sourceOptions?: PotreeSourceLoaderOptions;
|
|
27
|
+
});
|
|
28
|
+
/** An initialized source with an owned local file lifetime. */
|
|
29
|
+
export interface OpenedPointCloudFile {
|
|
30
|
+
/** Lazy node access through the existing unified source APIs. */
|
|
31
|
+
readonly source: ReturnType<typeof PotreeSourceLoader.createDataSource> | COPCTileSource;
|
|
32
|
+
/** Closes the source and rejects subsequent bundle reads; idempotent. */
|
|
33
|
+
readonly close: () => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/** Complete Potree dataset packaging controls. */
|
|
36
|
+
export interface EncodePotreeArchiveOptions {
|
|
37
|
+
/** Existing dataset version, precision, hierarchy and encoded-byte limits. */
|
|
38
|
+
readonly potree?: PotreeWriterOptions['potree'];
|
|
39
|
+
/** Maximum completed STORE ZIP32 bytes, checked before archive allocation. */
|
|
40
|
+
readonly maxArchiveBytes: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Writes a complete Potree 1.x/2.0 dataset to a deterministic uncompressed ZIP32 Blob.
|
|
44
|
+
* This is a loaders.gl bundle convention, not a native Potree archive standard. Metadata sits
|
|
45
|
+
* at the root with original relative resource paths. Writer version/attribute/precision gates
|
|
46
|
+
* apply. Inputs, dataset bytes, ZIP temporaries and the returned Blob are separate memory.
|
|
47
|
+
* @param input - Decoded points or caller-organized additive nodes; no LOD sampling is inferred.
|
|
48
|
+
* @param options - Dataset writer controls and final archive budget.
|
|
49
|
+
* @returns A downloadable ZIP Blob that openPointCloudFile can read incrementally.
|
|
50
|
+
*/
|
|
51
|
+
export declare function encodePotreeArchive(input: Mesh | MeshArrowTable | readonly PotreeWriterNode[], options: EncodePotreeArchiveOptions): Promise<Blob>;
|
|
52
|
+
/** Packages already encoded Potree files without encoding or sampling points a second time. */
|
|
53
|
+
export declare function encodePotreeDatasetArchive(dataset: PotreeDataset, maxArchiveBytes: number, signal?: AbortSignal): Promise<Blob>;
|
|
54
|
+
/**
|
|
55
|
+
* Opens a COPC Blob or a Potree STORE ZIP without extracting the complete dataset.
|
|
56
|
+
* ZIP directory/local headers are checked before constructing the Potree source; modern node
|
|
57
|
+
* requests slice only their archived byte ranges. DEFLATE, encrypted entries, ambiguous
|
|
58
|
+
* metadata and noncanonical paths fail explicitly. Partial reads do not verify whole-entry CRCs.
|
|
59
|
+
* Legacy Potree retains its existing coordinate behavior; modern Potree retains native coordinates.
|
|
60
|
+
* COPC uses its existing source coordinate policy. Applications own CRS preparation and conversion.
|
|
61
|
+
* @param input - Immutable local file/Blob, bounded by maxFileBytes.
|
|
62
|
+
* @param options - Explicit format, source controls and archive transport limits.
|
|
63
|
+
* @returns An initialized lazy source; close it when conversion finishes.
|
|
64
|
+
*/
|
|
65
|
+
export declare function openPointCloudFile(input: Blob, options: OpenPointCloudFileOptions): Promise<OpenedPointCloudFile>;
|
|
66
|
+
/** Explicit opt-in mesh-to-point selection. */
|
|
67
|
+
export interface ExtractMeshVerticesOptions {
|
|
68
|
+
/** Attribute names to retain in addition to POSITION; all other semantics are omitted explicitly. */
|
|
69
|
+
readonly attributes: readonly string[];
|
|
70
|
+
/** Maximum stored vertices, not expanded triangle corners. */
|
|
71
|
+
readonly maxPoints: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Harvests one point per stored vertex from already placed triangle geometry.
|
|
75
|
+
* Does not expand indices, deduplicate coincident vertices or sample triangle interiors. Output
|
|
76
|
+
* shares immutable attribute arrays. Materials, features, topology and unselected attributes are
|
|
77
|
+
* discarded by this explicit opt-in; select compatible attributes before destination encoding.
|
|
78
|
+
* For tiles, use the mesh source adapters first so node/RTC/tile transforms are applied once.
|
|
79
|
+
* @param mesh - Decoded triangle geometry in the desired absolute coordinate frame.
|
|
80
|
+
* @param options - Explicit retained attributes and stored-vertex count budget.
|
|
81
|
+
* @returns An unindexed point Mesh ready for point-cloud writers or the dynamic tiler.
|
|
82
|
+
*/
|
|
83
|
+
export declare function extractMeshVertices(mesh: MeshGeometry, options: ExtractMeshVerticesOptions): Mesh;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Mesh, MeshArrowTable } from '@loaders.gl/schema';
|
|
2
|
+
import { type PointCloudTilerOptions } from '@loaders.gl/schema-utils';
|
|
3
|
+
import type { PotreeDataset, PotreeWriterOptions } from '@loaders.gl/potree';
|
|
4
|
+
/** Bounded authoring of one decoded dataset in its already placed native coordinates. */
|
|
5
|
+
export interface ConvertPointCloudToPotreeOptions {
|
|
6
|
+
/** Explicit CRS declaration written verbatim; coordinates are not reprojected. */
|
|
7
|
+
readonly projection: string;
|
|
8
|
+
/** Maximum bytes retained across all gathered node attribute buffers. */
|
|
9
|
+
readonly maxGatheredBytes: number;
|
|
10
|
+
/** Maximum complete encoded dataset bytes, including metadata and hierarchy. */
|
|
11
|
+
readonly maxOutputBytes: number;
|
|
12
|
+
/** Input, index, per-node and node-count limits of the shared dynamic tiler. */
|
|
13
|
+
readonly tiling?: Omit<PointCloudTilerOptions, 'signal'>;
|
|
14
|
+
/** Existing version, precision, spacing and hierarchy controls. */
|
|
15
|
+
readonly potree?: Omit<NonNullable<PotreeWriterOptions['potree']>, 'projection' | 'signal' | 'maxOutputBytes'>;
|
|
16
|
+
/** Also package the completed files as a loaders.gl STORE ZIP32 bundle. */
|
|
17
|
+
readonly archive?: {
|
|
18
|
+
readonly maxArchiveBytes: number;
|
|
19
|
+
};
|
|
20
|
+
/** Cooperative cancellation during indexing, gathering, writing and packaging. */
|
|
21
|
+
readonly signal?: AbortSignal;
|
|
22
|
+
}
|
|
23
|
+
/** Complete Potree files; no partial dataset is returned after a failure. */
|
|
24
|
+
export interface ConvertedPointCloudPotree {
|
|
25
|
+
/** Exact input row count, emitted once across the additive octree. */
|
|
26
|
+
readonly pointCount: number;
|
|
27
|
+
/** Number of connected octree nodes, including an empty root for empty input. */
|
|
28
|
+
readonly nodeCount: number;
|
|
29
|
+
/** Metadata and encoded resources; applications own storage. */
|
|
30
|
+
readonly dataset: PotreeDataset;
|
|
31
|
+
/** Optional downloadable bundle; applications own object URL and saving lifetimes. */
|
|
32
|
+
readonly archive?: Blob;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Connects the portable point tiler to the existing Potree 1.x/2.0 dataset writer.
|
|
36
|
+
* Retains additive octree addresses and every source row exactly once, including terminal
|
|
37
|
+
* overflow. Input must be immutable, unindexed decoded points already placed in the declared
|
|
38
|
+
* CRS. No origins, transforms, reprojection, attribute mappings or surface sampling are inferred.
|
|
39
|
+
* The writer rejects attributes or precision that the selected version cannot represent.
|
|
40
|
+
* Gathered nodes are bounded separately from source buffers, indexes, encoded output and ZIP
|
|
41
|
+
* temporaries. This is in-memory authoring, not streaming ingestion or a peak-heap guarantee.
|
|
42
|
+
* The shared tiler's sample coverage bound is not a qualified viewer LOD/error contract.
|
|
43
|
+
* @param input - One decoded point Mesh or MeshArrowTable, including loader output.
|
|
44
|
+
* @param options - Explicit native CRS, resource budgets and existing writer controls.
|
|
45
|
+
* @returns A complete dataset and optional bundle after releasing the owned tiler.
|
|
46
|
+
*/
|
|
47
|
+
export declare function convertPointCloudToPotree(input: Mesh | MeshArrowTable, options: ConvertPointCloudToPotreeOptions): Promise<ConvertedPointCloudPotree>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Mesh, MeshArrowTable } from '@loaders.gl/schema';
|
|
2
|
+
import type { PointCloudTilerOptions } from '@loaders.gl/schema-utils';
|
|
3
|
+
import type { TilesetSpatialReference } from '@loaders.gl/tiles';
|
|
4
|
+
import type { BrowserTileConversionFile, TileConversionProgress, TileConversionReport } from '@loaders.gl/tile-converter/v5/core';
|
|
5
|
+
import type { PointCloudTilesetSinkOptions } from './point-cloud-tileset-sink.js';
|
|
6
|
+
import type { TileConversionArchiveOptions } from './conversion-archive.js';
|
|
7
|
+
/** Bounded authoring of a complete decoded ECEF point dataset. */
|
|
8
|
+
export interface ConvertPointCloudToTilesetOptions extends PointCloudTilesetSinkOptions {
|
|
9
|
+
/** Explicit native EPSG:4978 XYZ meters with ellipsoidal heights. No CRS is inferred. */
|
|
10
|
+
readonly spatialReference: TilesetSpatialReference;
|
|
11
|
+
/** In-memory input, index, gathered-tile and node limits; defaults belong to PointCloudTiler. */
|
|
12
|
+
readonly tiling?: Omit<PointCloudTilerOptions, 'signal'>;
|
|
13
|
+
/** Also create an indexed 3TZ Blob within this final archive-size budget. */
|
|
14
|
+
readonly archive?: Pick<TileConversionArchiveOptions, 'maxArchiveBytes'>;
|
|
15
|
+
/** Cooperative cancellation during indexing, traversal, encoding and packaging. */
|
|
16
|
+
readonly signal?: AbortSignal;
|
|
17
|
+
/** PNTS conversion progress; excludes tileset JSON and optional archive packaging. */
|
|
18
|
+
readonly onProgress?: (progress: TileConversionProgress) => void;
|
|
19
|
+
}
|
|
20
|
+
/** Completed point authoring result; no partial files are returned on failure. */
|
|
21
|
+
export interface ConvertedPointCloudTileset {
|
|
22
|
+
/** Exact number of input points, each emitted once across the complete collection. */
|
|
23
|
+
readonly pointCount: number;
|
|
24
|
+
/** PNTS resource counts and bytes; input bytes count gathered Arrow column buffers. */
|
|
25
|
+
readonly report: TileConversionReport;
|
|
26
|
+
/** PNTS resources and tileset.json, including JSON in the retained output byte budget. */
|
|
27
|
+
readonly files: readonly BrowserTileConversionFile[];
|
|
28
|
+
/** Optional indexed 3TZ Blob. Applications own saving and object URL lifetimes. */
|
|
29
|
+
readonly archive?: Blob;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Tiles decoded point Mesh/Arrow data and authors a flat additive 3D Tiles 1.0 collection.
|
|
33
|
+
* All input rows are emitted once, including remaining rows at the tiler's maximum depth.
|
|
34
|
+
* Per-tile RTC centers reduce float32 rounding; geometricError gates measured reconstruction error.
|
|
35
|
+
* The flat collection does not preserve octree LOD or provide a sampling-error guarantee.
|
|
36
|
+
* Input must remain immutable until completion. Arrow normalization can copy buffers; retained
|
|
37
|
+
* input, row indexes, gathered tiles, output Blobs and optional ZIP temporaries are separate memory.
|
|
38
|
+
* This is bounded in-memory authoring, not streaming ingestion or an out-of-core converter.
|
|
39
|
+
* Unsupported PNTS attributes fail; callers must explicitly map or remove them beforehand.
|
|
40
|
+
* @param input - One decoded unindexed point-list with finite floating-point XYZ positions.
|
|
41
|
+
* @param options - Explicit ECEF frame, precision and resource limits, and optional 3TZ packaging.
|
|
42
|
+
* @returns Completed files and report after releasing the privately owned dynamic source.
|
|
43
|
+
*/
|
|
44
|
+
export declare function convertPointCloudToTileset(input: Mesh | MeshArrowTable, options: ConvertPointCloudToTilesetOptions): Promise<ConvertedPointCloudTileset>;
|
|
@@ -32,6 +32,14 @@ export interface ManifestBackedTileConversionSinkOptions<TResource> {
|
|
|
32
32
|
readonly sink: TileConversionSink<TResource>;
|
|
33
33
|
/** Persistence adapter for snapshots written after each resource. */
|
|
34
34
|
readonly manifestStore: TileResourceManifestStore;
|
|
35
|
+
/** Optional cap on unique checkpoint entries loaded or written; defaults to no cap. */
|
|
36
|
+
readonly maxResources?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Checks destination bytes before skipping a matching checkpoint. Return true only when
|
|
39
|
+
* stored bytes match the entry's size and fingerprint; false rewrites the resource.
|
|
40
|
+
* Without this callback the caller guarantees checkpointed destination bytes remain intact.
|
|
41
|
+
*/
|
|
42
|
+
readonly verifyResource?: (entry: TileResourceManifestEntry, signal?: AbortSignal) => Promise<boolean>;
|
|
35
43
|
/** Stable profile-specific path or resource key. */
|
|
36
44
|
readonly getResourceId: (resource: TResource) => string;
|
|
37
45
|
/** Byte length used to detect changed content under an existing resource ID. */
|
|
@@ -50,7 +58,8 @@ export interface ManifestBackedTileConversionSinkOptions<TResource> {
|
|
|
50
58
|
* including writes skipped because the matching resource was already present. A graceful abort
|
|
51
59
|
* clears the manifest checkpoint before asking the destination to clean partial output, so the
|
|
52
60
|
* next run starts cleanly. A process interruption that does not call `abort` can resume from its
|
|
53
|
-
* last saved checkpoint.
|
|
61
|
+
* last saved checkpoint. Optional destination verification repairs missing or changed stored
|
|
62
|
+
* resources before treating them as complete. maxResources caps unique checkpoint entries.
|
|
54
63
|
*
|
|
55
64
|
* @param options - Destination, manifest store, stable IDs, byte measurement, and fingerprinting.
|
|
56
65
|
* @returns A `TileConversionSink` with resumable per-resource progress.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { DracoLibraryOptions } from '@loaders.gl/draco/bundled';
|
|
2
|
+
import { createTiles3DConversionSpatialContext } from '@loaders.gl/tile-converter/v5/core';
|
|
3
|
+
import type { BrowserTilesetConversionInspection, BrowserTilesetConversionInputResource, TileConversionSource } from '@loaders.gl/tile-converter/v5/core';
|
|
4
|
+
import type { MeshSourceResource, MeshSourceFeatureOptions } from '@loaders.gl/tile-converter/v5/adapters';
|
|
5
|
+
/** Required transport, decoded geometry, retained output, and archive budgets for this demo. */
|
|
6
|
+
export declare const SELECTED_MESH_LIMITS: {
|
|
7
|
+
/** Root JSON plus selected content transport bytes; also the decoded geometry/image/feature byte gate. */
|
|
8
|
+
readonly maxInputBytes: number;
|
|
9
|
+
/** Maximum declared content placements inspected. */
|
|
10
|
+
readonly maxInputResources: 1000;
|
|
11
|
+
/** Maximum inspected root/external document placements. */
|
|
12
|
+
readonly maxTilesetDocuments: 32;
|
|
13
|
+
/** Maximum explicitly selected content placements in one partial archive. */
|
|
14
|
+
readonly maxSelectedResources: 64;
|
|
15
|
+
/** Maximum primitive placements authored across all selected contents. */
|
|
16
|
+
readonly maxMeshResources: 64;
|
|
17
|
+
/** Maximum retained file bytes and final archive bytes. */
|
|
18
|
+
readonly maxOutputBytes: number;
|
|
19
|
+
/** Maximum measured reconstruction error in meters. */
|
|
20
|
+
readonly maxPositionError: 0.01;
|
|
21
|
+
};
|
|
22
|
+
/** Injected transport and decoder assets for the bounded selected mesh profile. */
|
|
23
|
+
export interface SelectedMeshSourceOptions {
|
|
24
|
+
/** Require a complete qualified explicit tree; pair with createMeshHierarchyTilesetSink. */
|
|
25
|
+
readonly preserveHierarchy?: boolean;
|
|
26
|
+
/** Inspected content placement identifiers; one to 64 distinct selections. */
|
|
27
|
+
readonly resourceIds: readonly string[];
|
|
28
|
+
/** Cancellation across qualification, raw reads and decoding. */
|
|
29
|
+
readonly signal: AbortSignal;
|
|
30
|
+
/** Application-owned decoder asset locations or modules. */
|
|
31
|
+
readonly dracoLibraryOptions: DracoLibraryOptions;
|
|
32
|
+
/** Transport for decoded buffers/images, confined by a platform adapter when local. */
|
|
33
|
+
readonly fetcher?: typeof fetch;
|
|
34
|
+
/** Optional source owning the raw input lifetime, such as a Node file/archive adapter. */
|
|
35
|
+
readonly source?: TileConversionSource<BrowserTilesetConversionInspection, BrowserTilesetConversionInputResource>;
|
|
36
|
+
/** Explicit feature mapping, or the qualified inline structural metadata profile. */
|
|
37
|
+
readonly features?: MeshSourceFeatureOptions;
|
|
38
|
+
/** Lower the shared 16 MiB transport and decoded mesh limit. */
|
|
39
|
+
readonly maxInputBytes?: number;
|
|
40
|
+
}
|
|
41
|
+
/** Qualified selected-mesh decoding and source error policy. */
|
|
42
|
+
export interface SelectedMeshConversionSource {
|
|
43
|
+
/** Lazy source that releases each dedicated mesh runtime after use. */
|
|
44
|
+
readonly source: TileConversionSource<BrowserTilesetConversionInspection, MeshSourceResource>;
|
|
45
|
+
/** Native ECEF coordinate context, qualified before reading mesh content. */
|
|
46
|
+
readonly spatialContext: ReturnType<typeof createTiles3DConversionSpatialContext>;
|
|
47
|
+
/** Conservative metric source error plus the position reconstruction allowance. */
|
|
48
|
+
readonly geometricError: number;
|
|
49
|
+
}
|
|
50
|
+
/** Qualifies and constructs a lazy selected mesh source without platform I/O or output ownership. */
|
|
51
|
+
export declare function createSelectedMeshConversionSource(inspection: BrowserTilesetConversionInspection, options: SelectedMeshSourceOptions): Promise<SelectedMeshConversionSource>;
|
|
52
|
+
/** Charges geometry, encoded image bytes, triangle associations and Arrow columns after extraction. */
|
|
53
|
+
export declare function measureMeshBytes(resource: MeshSourceResource): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tile-converter",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.12",
|
|
4
4
|
"description": "Converter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,12 +44,18 @@
|
|
|
44
44
|
"types": "./dist/v5/adapters.d.ts",
|
|
45
45
|
"import": "./dist/v5/adapters.js",
|
|
46
46
|
"require": "./dist/v5/adapters.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./v5/node": {
|
|
49
|
+
"types": "./dist/v5/node.d.ts",
|
|
50
|
+
"import": "./dist/v5/node.js",
|
|
51
|
+
"require": "./dist/v5/node.cjs"
|
|
47
52
|
}
|
|
48
53
|
},
|
|
49
54
|
"sideEffects": false,
|
|
50
55
|
"bin": {
|
|
51
56
|
"i3s-server": "./bin/i3s-server.js",
|
|
52
|
-
"tile-converter": "./bin/converter.js"
|
|
57
|
+
"tile-converter": "./bin/converter.js",
|
|
58
|
+
"tile-converter-v5": "./bin/converter-v5.js"
|
|
53
59
|
},
|
|
54
60
|
"files": [
|
|
55
61
|
"src",
|
|
@@ -71,30 +77,32 @@
|
|
|
71
77
|
"build-converter-bundle": "esbuild src/v4/converter-cli.ts --outfile=dist/converter.min.cjs --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
72
78
|
"build-i3s-server-bundle": "esbuild src/v4/i3s-server/bin/www.ts --outfile=dist/i3s-server/bin/i3s-server.min.cjs --platform=node --target=esnext,node14 --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
73
79
|
"copy-certificates": "cp -R src/v4/i3s-server/certs dist/i3s-server",
|
|
74
|
-
"build-v5-entrypoints": "esbuild src/v5/core.ts src/v5/adapters.ts src/v5/index.ts src/v5/browser.ts --bundle --packages=external --external:@loaders.gl/* --platform=browser --outdir=dist/v5 --format=esm && esbuild src/v5/core.ts src/v5/adapters.ts src/v5/index.ts src/v5/browser.ts --bundle --packages=external --external:@loaders.gl/* --platform=browser --outdir=dist/v5 --format=cjs --out-extension:.js=.cjs"
|
|
80
|
+
"build-v5-entrypoints": "esbuild src/v5/core.ts src/v5/adapters.ts src/v5/index.ts src/v5/browser.ts --bundle --packages=external --external:@loaders.gl/* --platform=browser --outdir=dist/v5 --format=esm && esbuild src/v5/core.ts src/v5/adapters.ts src/v5/index.ts src/v5/browser.ts --bundle --packages=external --external:@loaders.gl/* --platform=browser --outdir=dist/v5 --format=cjs --out-extension:.js=.cjs && esbuild src/v5/node.ts src/v5/converter-cli.ts --bundle --packages=external --external:@loaders.gl/* --platform=node --outdir=dist/v5 --format=esm && esbuild src/v5/node.ts --bundle --packages=external --external:@loaders.gl/* --platform=node --outdir=dist/v5 --format=cjs --out-extension:.js=.cjs"
|
|
75
81
|
},
|
|
76
82
|
"dependencies": {
|
|
77
|
-
"@loaders.gl/3d-tiles": "5.0.0-alpha.
|
|
78
|
-
"@loaders.gl/compression": "5.0.0-alpha.
|
|
79
|
-
"@loaders.gl/
|
|
80
|
-
"@loaders.gl/
|
|
81
|
-
"@loaders.gl/
|
|
82
|
-
"@loaders.gl/
|
|
83
|
-
"@loaders.gl/
|
|
84
|
-
"@loaders.gl/
|
|
85
|
-
"@loaders.gl/
|
|
86
|
-
"@loaders.gl/
|
|
87
|
-
"@loaders.gl/
|
|
88
|
-
"@loaders.gl/
|
|
89
|
-
"@loaders.gl/
|
|
90
|
-
"@loaders.gl/
|
|
91
|
-
"@loaders.gl/
|
|
92
|
-
"@
|
|
93
|
-
"@
|
|
94
|
-
"@math.gl/
|
|
95
|
-
"@math.gl/
|
|
96
|
-
"@math.gl/
|
|
97
|
-
"@math.gl/
|
|
83
|
+
"@loaders.gl/3d-tiles": "5.0.0-alpha.12",
|
|
84
|
+
"@loaders.gl/compression": "5.0.0-alpha.12",
|
|
85
|
+
"@loaders.gl/copc": "5.0.0-alpha.12",
|
|
86
|
+
"@loaders.gl/crypto": "5.0.0-alpha.12",
|
|
87
|
+
"@loaders.gl/draco": "5.0.0-alpha.12",
|
|
88
|
+
"@loaders.gl/gltf": "5.0.0-alpha.12",
|
|
89
|
+
"@loaders.gl/i3s": "5.0.0-alpha.12",
|
|
90
|
+
"@loaders.gl/images": "5.0.0-alpha.12",
|
|
91
|
+
"@loaders.gl/loader-utils": "5.0.0-alpha.12",
|
|
92
|
+
"@loaders.gl/polyfills": "5.0.0-alpha.12",
|
|
93
|
+
"@loaders.gl/potree": "5.0.0-alpha.12",
|
|
94
|
+
"@loaders.gl/schema": "5.0.0-alpha.12",
|
|
95
|
+
"@loaders.gl/schema-utils": "5.0.0-alpha.12",
|
|
96
|
+
"@loaders.gl/textures": "5.0.0-alpha.12",
|
|
97
|
+
"@loaders.gl/tiles": "5.0.0-alpha.12",
|
|
98
|
+
"@loaders.gl/worker-utils": "5.0.0-alpha.12",
|
|
99
|
+
"@loaders.gl/zip": "5.0.0-alpha.12",
|
|
100
|
+
"@math.gl/core": "5.0.0-alpha.16",
|
|
101
|
+
"@math.gl/crs": "5.0.0-alpha.16",
|
|
102
|
+
"@math.gl/culling": "5.0.0-alpha.16",
|
|
103
|
+
"@math.gl/geoid": "5.0.0-alpha.16",
|
|
104
|
+
"@math.gl/geometry-utils": "5.0.0-alpha.16",
|
|
105
|
+
"@math.gl/geospatial": "5.0.0-alpha.16",
|
|
98
106
|
"ajv": "^8.12.0",
|
|
99
107
|
"archiver": "^5.0.0",
|
|
100
108
|
"cors": "^2.8.5",
|
|
@@ -119,5 +127,5 @@
|
|
|
119
127
|
"peerDependencies": {
|
|
120
128
|
"@loaders.gl/core": "~5.0.0-alpha.0"
|
|
121
129
|
},
|
|
122
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "8cbff6cb3e55c4eb1305072743992af27ff0c171"
|
|
123
131
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
parseSLPKArchive
|
|
9
9
|
} from '@loaders.gl/i3s';
|
|
10
10
|
import {NodeFile} from '@loaders.gl/loader-utils';
|
|
11
|
-
import {ZipFileSystem
|
|
11
|
+
import {ZipFileSystem} from '@loaders.gl/zip';
|
|
12
12
|
|
|
13
13
|
export type SLPKUrlParts = {slpkFileName: string; internalFileName: string};
|
|
14
14
|
|
|
@@ -116,9 +116,7 @@ export async function getNodeCount(fileSystem: ZipFileSystem | null): Promise<nu
|
|
|
116
116
|
return 0;
|
|
117
117
|
}
|
|
118
118
|
const nodeSet = new Set();
|
|
119
|
-
const
|
|
120
|
-
for await (const file of filesIterator) {
|
|
121
|
-
const filename = file.fileName;
|
|
119
|
+
for (const filename of await fileSystem.readdir()) {
|
|
122
120
|
const nodeNumberSearchResult = /^nodes\/(\d+)\//.exec(filename);
|
|
123
121
|
if (nodeNumberSearchResult) {
|
|
124
122
|
nodeSet.add(nodeNumberSearchResult[1]);
|
package/src/v4/converter-cli.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getURLValue,
|
|
12
12
|
validateOptionsWithEqual
|
|
13
13
|
} from './lib/utils/cli-utils';
|
|
14
|
-
import {addOneFile, composeHashFile,
|
|
14
|
+
import {addOneFile, composeHashFile, openZipArchive} from '@loaders.gl/zip';
|
|
15
15
|
import {NodeFile} from '@loaders.gl/loader-utils';
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
import {copyFile} from 'node:fs/promises';
|
|
@@ -141,7 +141,13 @@ async function main() {
|
|
|
141
141
|
if (finalPath !== validatedOptions.tileset) {
|
|
142
142
|
await copyFile(validatedOptions.tileset, finalPath);
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const archive = await openZipArchive(new NodeFile(finalPath));
|
|
145
|
+
let hashTable: ArrayBuffer;
|
|
146
|
+
try {
|
|
147
|
+
hashTable = await composeHashFile(archive.entries());
|
|
148
|
+
} finally {
|
|
149
|
+
await archive.close();
|
|
150
|
+
}
|
|
145
151
|
await addOneFile(finalPath, hashTable, '@specialIndexFileHASH128@');
|
|
146
152
|
|
|
147
153
|
return;
|
|
@@ -4,19 +4,11 @@ import type {
|
|
|
4
4
|
Tiles3DTileJSONPostprocessed,
|
|
5
5
|
Tiles3DTilesetJSONPostprocessed
|
|
6
6
|
} from '@loaders.gl/3d-tiles';
|
|
7
|
-
import {
|
|
7
|
+
import {parse3DTilesArchive} from '@loaders.gl/3d-tiles';
|
|
8
8
|
import {LoaderWithParser, load} from '@loaders.gl/core';
|
|
9
9
|
import type {ReadableFile} from '@loaders.gl/loader-utils';
|
|
10
10
|
import {HttpFile, NodeFile, isBrowser} from '@loaders.gl/loader-utils';
|
|
11
|
-
import {
|
|
12
|
-
CD_HEADER_SIGNATURE,
|
|
13
|
-
ZipFileSystem,
|
|
14
|
-
parseHashTable,
|
|
15
|
-
parseZipCDFileHeader,
|
|
16
|
-
parseZipLocalFileHeader,
|
|
17
|
-
searchFromTheEnd,
|
|
18
|
-
readRange
|
|
19
|
-
} from '@loaders.gl/zip';
|
|
11
|
+
import {ZipFileSystem} from '@loaders.gl/zip';
|
|
20
12
|
|
|
21
13
|
/**
|
|
22
14
|
* Load nested 3DTiles tileset. If the sourceTile is not nested tileset - do nothing
|
|
@@ -116,8 +108,7 @@ export async function loadFromArchive(
|
|
|
116
108
|
if (filename) {
|
|
117
109
|
const tz3Path = `${tz3UrlParts[0]}.3tz`;
|
|
118
110
|
const fileProvider = createReadableFile(tz3Path);
|
|
119
|
-
const
|
|
120
|
-
const archive = new Tiles3DArchive(fileProvider, hashTable, tz3Path);
|
|
111
|
+
const archive = await parse3DTilesArchive(fileProvider, undefined, tz3Path);
|
|
121
112
|
const fileSystem = new ZipFileSystem(archive);
|
|
122
113
|
const archiveLoadOptions = {
|
|
123
114
|
...loadOptions,
|
|
@@ -145,42 +136,3 @@ function createReadableFile(path: string): ReadableFile {
|
|
|
145
136
|
}
|
|
146
137
|
return isBrowser ? new HttpFile(path) : new NodeFile(path);
|
|
147
138
|
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Load hash file from 3TZ
|
|
151
|
-
* @param fileProvider - binary reader of 3TZ
|
|
152
|
-
* @returns hash table of the 3TZ file content or undefined if the hash file is not presented inside
|
|
153
|
-
*/
|
|
154
|
-
async function loadHashTable(
|
|
155
|
-
fileProvider: ReadableFile
|
|
156
|
-
): Promise<undefined | Record<string, bigint>> {
|
|
157
|
-
let hashTable: undefined | Record<string, bigint>;
|
|
158
|
-
|
|
159
|
-
const hashCDOffset = await searchFromTheEnd(fileProvider, CD_HEADER_SIGNATURE);
|
|
160
|
-
|
|
161
|
-
const cdFileHeader = await parseZipCDFileHeader(hashCDOffset, fileProvider);
|
|
162
|
-
|
|
163
|
-
// '@3dtilesIndex1@' is index file that must be the last in the archive. It allows
|
|
164
|
-
// to improve load and read performance when the archive contains a very large number
|
|
165
|
-
// of files.
|
|
166
|
-
if (cdFileHeader?.fileName === '@3dtilesIndex1@') {
|
|
167
|
-
const localFileHeader = await parseZipLocalFileHeader(
|
|
168
|
-
cdFileHeader.localHeaderOffset,
|
|
169
|
-
fileProvider
|
|
170
|
-
);
|
|
171
|
-
if (!localFileHeader) {
|
|
172
|
-
throw new Error('corrupted 3tz');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const fileDataOffset = localFileHeader.fileDataOffset;
|
|
176
|
-
const hashFile = await readRange(
|
|
177
|
-
fileProvider,
|
|
178
|
-
fileDataOffset,
|
|
179
|
-
fileDataOffset + localFileHeader.compressedSize
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
hashTable = parseHashTable(hashFile);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return hashTable;
|
|
186
|
-
}
|
|
@@ -97,7 +97,7 @@ export class NodeIndexDocument {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* Add neighbors
|
|
100
|
+
* Add neighbors, save leaf documents and children, then release finalized child data.
|
|
101
101
|
*/
|
|
102
102
|
public async addNeighbors(): Promise<void> {
|
|
103
103
|
if (this.finalized) {
|
|
@@ -130,7 +130,10 @@ export class NodeIndexDocument {
|
|
|
130
130
|
}
|
|
131
131
|
await childNode.save();
|
|
132
132
|
}
|
|
133
|
-
//
|
|
133
|
+
// Internal documents were saved during child traversal. A root mesh leaf has no such traversal.
|
|
134
|
+
if (!this.children.length) {
|
|
135
|
+
await this.save();
|
|
136
|
+
}
|
|
134
137
|
this.finalize();
|
|
135
138
|
}
|
|
136
139
|
|
|
@@ -43,7 +43,7 @@ export const analyzeTileContent = async (
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const gltfData = await parse(tileContent.gltfArrayBuffer, GLTFLoader, {
|
|
46
|
-
gltf: {normalize:
|
|
46
|
+
gltf: {normalize: true, loadBuffers: false, loadImages: false, decompressMeshes: false}
|
|
47
47
|
});
|
|
48
48
|
const gltf = gltfData.json;
|
|
49
49
|
|
|
@@ -32,7 +32,8 @@ export const STORE = {
|
|
|
32
32
|
},
|
|
33
33
|
normalReferenceFrame: {
|
|
34
34
|
path: 'normalReferenceFrame',
|
|
35
|
-
|
|
35
|
+
// Geometry conversion rotates normals into the ECEF frame.
|
|
36
|
+
default: 'earth-centered'
|
|
36
37
|
},
|
|
37
38
|
attributeEncoding: {
|
|
38
39
|
path: 'attributeEncoding',
|
package/src/v5/adapters.ts
CHANGED
|
@@ -73,3 +73,51 @@ export type {PointCloudSpatialOptions} from './point-cloud-spatial.js';
|
|
|
73
73
|
|
|
74
74
|
export {createI3SMeshTilesetConversionSource} from './i3s-mesh-source.js';
|
|
75
75
|
export type {I3SMeshTilesetSourceOptions, I3SMeshSourceFeatureOptions} from './i3s-mesh-source.js';
|
|
76
|
+
|
|
77
|
+
export {convertPointCloudToTileset} from './point-cloud-tileset.js';
|
|
78
|
+
export type {
|
|
79
|
+
ConvertPointCloudToTilesetOptions,
|
|
80
|
+
ConvertedPointCloudTileset
|
|
81
|
+
} from './point-cloud-tileset.js';
|
|
82
|
+
|
|
83
|
+
export {encodePotreeArchive, openPointCloudFile, extractMeshVertices} from './point-cloud-file.js';
|
|
84
|
+
export type {
|
|
85
|
+
EncodePotreeArchiveOptions,
|
|
86
|
+
OpenPointCloudFileOptions,
|
|
87
|
+
OpenedPointCloudFile,
|
|
88
|
+
ExtractMeshVerticesOptions
|
|
89
|
+
} from './point-cloud-file.js';
|
|
90
|
+
|
|
91
|
+
export {createMeshSourceFeatureOptions} from './mesh-source-schema.js';
|
|
92
|
+
export type {MeshSourceSchemaOptions} from './mesh-source-schema.js';
|
|
93
|
+
export {convertPointCloudToPotree} from './point-cloud-potree.js';
|
|
94
|
+
export type {
|
|
95
|
+
ConvertPointCloudToPotreeOptions,
|
|
96
|
+
ConvertedPointCloudPotree
|
|
97
|
+
} from './point-cloud-potree.js';
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
createSelectedMeshConversionSource,
|
|
101
|
+
measureMeshBytes,
|
|
102
|
+
SELECTED_MESH_LIMITS
|
|
103
|
+
} from './selected-mesh-source.js';
|
|
104
|
+
export type {
|
|
105
|
+
SelectedMeshSourceOptions,
|
|
106
|
+
SelectedMeshConversionSource
|
|
107
|
+
} from './selected-mesh-source.js';
|
|
108
|
+
|
|
109
|
+
export {openTileConversionArchive, createTileConversionArchiveTransport} from './archive-source.js';
|
|
110
|
+
export type {TileConversionArchiveInput} from './archive-source.js';
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
inspectI3SMeshConversionSource,
|
|
114
|
+
createSelectedI3SMeshConversionSource
|
|
115
|
+
} from './i3s-selection-source.js';
|
|
116
|
+
export type {
|
|
117
|
+
I3SMeshSelectionOptions,
|
|
118
|
+
I3SMeshConversionInspection,
|
|
119
|
+
I3SMeshConversionResourceDescriptor
|
|
120
|
+
} from './i3s-selection-source.js';
|
|
121
|
+
|
|
122
|
+
export {createMeshHierarchyTilesetSink} from './mesh-hierarchy.js';
|
|
123
|
+
export type {MeshHierarchyTilesetSinkOptions} from './mesh-hierarchy.js';
|