@jdultra/threedtiles 10.0.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -32
- package/dist/decoder/B3DMDecoder.d.ts +8 -0
- package/dist/decoder/FeatureTable.d.ts +14 -0
- package/dist/draco-decoders/README.md +32 -0
- package/dist/draco-decoders/draco_decoder.js +1 -0
- package/dist/draco-decoders/draco_decoder.wasm +0 -0
- package/dist/draco-decoders/draco_encoder.js +1 -0
- package/dist/draco-decoders/draco_wasm_wrapper.js +1 -0
- package/dist/draco-decoders/gltf/draco_decoder.js +1 -0
- package/dist/draco-decoders/gltf/draco_decoder.wasm +0 -0
- package/dist/draco-decoders/gltf/draco_encoder.js +1 -0
- package/dist/draco-decoders/gltf/draco_wasm_wrapper.js +1 -0
- package/dist/entry.d.ts +5 -0
- package/dist/geometry/obb.d.ts +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.html +1 -0
- package/dist/ktx2-decoders/README.md +46 -0
- package/dist/ktx2-decoders/basis_transcoder.js +1 -0
- package/dist/ktx2-decoders/basis_transcoder.wasm +0 -0
- package/dist/threedtiles.min.js +1 -1
- package/dist/threedtiles.min.js.LICENSE.txt +22 -0
- package/dist/threedtiles.min.js.map +1 -0
- package/dist/tileset/OGC3DTile.d.ts +123 -0
- package/dist/tileset/OcclusionCullingService.d.ts +31 -0
- package/dist/tileset/TileLoader.d.ts +78 -0
- package/dist/tileset/implicit/ImplicitTileResolver.d.ts +1 -0
- package/dist/tileset/implicit/SubtreeDecoder.d.ts +1 -0
- package/dist/tileset/instanced/InstancedOGC3DTile.d.ts +73 -0
- package/dist/tileset/instanced/InstancedTile.d.ts +70 -0
- package/dist/tileset/instanced/InstancedTileLoader.d.ts +73 -0
- package/dist/tileset/instanced/JsonTile.d.ts +11 -0
- package/dist/tileset/instanced/MeshTile.d.ts +13 -0
- package/package.json +8 -5
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* class representing a tiled and multileveled mesh or point-cloud according to the OGC3DTiles 1.1 spec
|
|
3
|
+
* @class
|
|
4
|
+
* @extends THREE.Object3D
|
|
5
|
+
*/
|
|
6
|
+
export class OGC3DTile {
|
|
7
|
+
/**
|
|
8
|
+
* @param {Object} [properties] - the properties for this tileset
|
|
9
|
+
* @param {THREE.Renderer} [properties.renderer] - the renderer used to display the tileset
|
|
10
|
+
* @param {String} [properties.url] - the url to the parent tileset.json
|
|
11
|
+
* @param {String} [properties.queryParams] - optional, path params to add to individual tile urls (starts with "?").
|
|
12
|
+
* @param {Number} [properties.geometricErrorMultiplier] - the geometric error of the parent. 1.0 by default corresponds to a maxScreenSpaceError of 16
|
|
13
|
+
* @param {Boolean} [properties.loadOutsideView] - if truthy, tiles otside the camera frustum will be loaded with the least possible amount of detail
|
|
14
|
+
* @param {TileLoader} [properties.tileLoader] - A tile loader that can be shared among tilesets in order to share a common cache.
|
|
15
|
+
* @param {Function} [properties.meshCallback] - A callback function that will be called on every mesh
|
|
16
|
+
* @param {Function} [properties.pointsCallback] - A callback function that will be called on every points
|
|
17
|
+
* @param {Function} [properties.onLoadCallback] - A callback function that will be called when the root tile has been loaded
|
|
18
|
+
* @param {OcclusionCullingService} [properties.occlusionCullingService] - A service that handles occlusion culling
|
|
19
|
+
* @param {Boolean} [properties.centerModel] - If true, the tileset will be centered on 0,0,0 and in the case of georeferenced tilesets that use the "region" bounding volume, it will also be rotated so that the up axis matched the world y axis.
|
|
20
|
+
* @param {Boolean} [properties.static] - If true, the tileset is considered static which improves performance but the matrices aren't automatically updated
|
|
21
|
+
* @param {String} [properties.rootPath] - optional the root path for fetching children
|
|
22
|
+
* @param {String} [properties.json] - optional json object representing the tileset sub-tree
|
|
23
|
+
* @param {Number} [properties.parentGeometricError] - optional geometric error of the parent
|
|
24
|
+
* @param {Object} [properties.parentBoundingVolume] - optional bounding volume of the parent
|
|
25
|
+
* @param {String} [properties.parentRefine] - optional refine strategy of the parent of the parent
|
|
26
|
+
* @param {THREE.Camera} [properties.cameraOnLoad] - optional the camera used when loading this particular sub-tile
|
|
27
|
+
* @param {OGC3DTile} [properties.parentTile] - optional the OGC3DTile object that loaded this tile as a child
|
|
28
|
+
* @param {String} [properties.proxy] - optional the url to a proxy service. Instead of fetching tiles via a GET request, a POST will be sent to the proxy url with the real tile address in the body of the request.
|
|
29
|
+
* @param {Boolean} [properties.displayErrors] - optional value indicating that errors should be shown on screen.
|
|
30
|
+
*/
|
|
31
|
+
constructor(properties?: {
|
|
32
|
+
renderer?: any;
|
|
33
|
+
url?: string | undefined;
|
|
34
|
+
queryParams?: string | undefined;
|
|
35
|
+
geometricErrorMultiplier?: number | undefined;
|
|
36
|
+
loadOutsideView?: boolean | undefined;
|
|
37
|
+
tileLoader?: TileLoader | undefined;
|
|
38
|
+
meshCallback?: Function | undefined;
|
|
39
|
+
pointsCallback?: Function | undefined;
|
|
40
|
+
onLoadCallback?: Function | undefined;
|
|
41
|
+
occlusionCullingService?: any;
|
|
42
|
+
centerModel?: boolean | undefined;
|
|
43
|
+
static?: boolean | undefined;
|
|
44
|
+
rootPath?: string | undefined;
|
|
45
|
+
json?: string | undefined;
|
|
46
|
+
parentGeometricError?: number | undefined;
|
|
47
|
+
parentBoundingVolume?: Object | undefined;
|
|
48
|
+
parentRefine?: string | undefined;
|
|
49
|
+
cameraOnLoad?: any;
|
|
50
|
+
parentTile?: OGC3DTile | undefined;
|
|
51
|
+
proxy?: string | undefined;
|
|
52
|
+
displayErrors?: boolean | undefined;
|
|
53
|
+
} | undefined);
|
|
54
|
+
proxy: string | undefined;
|
|
55
|
+
displayErrors: boolean | undefined;
|
|
56
|
+
displayCopyright: boolean;
|
|
57
|
+
queryParams: any;
|
|
58
|
+
uuid: any;
|
|
59
|
+
tileLoader: TileLoader;
|
|
60
|
+
/**
|
|
61
|
+
* To be called in the render loop.
|
|
62
|
+
* @param {Three.Camera} camera a camera that the tileset will be rendered with.
|
|
63
|
+
*/
|
|
64
|
+
update(camera: Three.Camera): void;
|
|
65
|
+
geometricErrorMultiplier: number;
|
|
66
|
+
renderer: any;
|
|
67
|
+
meshCallback: Function | undefined;
|
|
68
|
+
loadOutsideView: boolean | undefined;
|
|
69
|
+
cameraOnLoad: any;
|
|
70
|
+
parentTile: OGC3DTile | undefined;
|
|
71
|
+
occlusionCullingService: any;
|
|
72
|
+
static: boolean | undefined;
|
|
73
|
+
color: any;
|
|
74
|
+
colorID: number | undefined;
|
|
75
|
+
matrixAutoUpdate: boolean | undefined;
|
|
76
|
+
matrixWorldAutoUpdate: boolean | undefined;
|
|
77
|
+
childrenTiles: any[];
|
|
78
|
+
meshContent: any[];
|
|
79
|
+
materialVisibility: boolean;
|
|
80
|
+
inFrustum: boolean;
|
|
81
|
+
level: any;
|
|
82
|
+
hasMeshContent: number;
|
|
83
|
+
hasUnloadedJSONContent: number;
|
|
84
|
+
centerModel: boolean | undefined;
|
|
85
|
+
abortController: AbortController;
|
|
86
|
+
_setup(properties: any): Promise<void>;
|
|
87
|
+
rootPath: any;
|
|
88
|
+
isSetup: boolean | undefined;
|
|
89
|
+
_assembleURL(root: any, relative: any): string;
|
|
90
|
+
_extractQueryParams(url: any, params: any): string;
|
|
91
|
+
_load(): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Disposes of all the resources used by the tileset.
|
|
94
|
+
*/
|
|
95
|
+
dispose(): void;
|
|
96
|
+
deleted: boolean | undefined;
|
|
97
|
+
parent: any;
|
|
98
|
+
_disposeChildren(): void;
|
|
99
|
+
children: any[] | undefined;
|
|
100
|
+
_update(camera: any, frustum: any): void;
|
|
101
|
+
_areAllChildrenLoadedAndHidden(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Node is ready if it is outside frustum, if it was drawn at least once or if all it's children are ready
|
|
104
|
+
* @returns true if ready
|
|
105
|
+
*/
|
|
106
|
+
_isReady(): boolean;
|
|
107
|
+
_changeContentVisibility(visibility: any): void;
|
|
108
|
+
meshDisplayed: boolean | undefined;
|
|
109
|
+
_calculateUpdateMetric(camera: any, frustum: any): number;
|
|
110
|
+
_getSiblings(): any[];
|
|
111
|
+
_calculateDistanceToCamera(camera: any): number;
|
|
112
|
+
/**
|
|
113
|
+
* Set the Geometric Error Multiplier for the tileset.
|
|
114
|
+
* the {@param geometricErrorMultiplier} can be a number between 1 and infinity.
|
|
115
|
+
* A {@param geometricErrorMultiplier} of 1 (default) corresponds to a max ScreenSpace error (MSE) of 16.
|
|
116
|
+
* A lower {@param geometricErrorMultiplier} loads less detail (higher MSE) and a higher {@param geometricErrorMultiplier} loads more detail (lower MSE)
|
|
117
|
+
*
|
|
118
|
+
* @param {Number} geometricErrorMultiplier set the LOD multiplier for the entire tileset
|
|
119
|
+
*/
|
|
120
|
+
setGeometricErrorMultiplier(geometricErrorMultiplier: number): void;
|
|
121
|
+
_transformWGS84ToCartesian(lon: any, lat: any, h: any, sfct: any): void;
|
|
122
|
+
}
|
|
123
|
+
import { TileLoader } from "./TileLoader";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An occlusion culling service that helps to only refine tiles that are visible.
|
|
3
|
+
* This occlusion culling has a cost but allows downloading much less data.
|
|
4
|
+
* For models that have a lot of geometry that is often hidden from the camera by walls, this can greatly improve the frame-rate.
|
|
5
|
+
* @class
|
|
6
|
+
*/
|
|
7
|
+
export class OcclusionCullingService {
|
|
8
|
+
cullMap: any[];
|
|
9
|
+
cullMaterial: any;
|
|
10
|
+
cullTarget: any;
|
|
11
|
+
cullPixels: Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {Integer} side use THREE.FrontSide, THREE.BackSide or THREE.DoubleSide (FrontSide default)
|
|
15
|
+
*/
|
|
16
|
+
setSide(side: Integer): void;
|
|
17
|
+
_createCullTarget(): any;
|
|
18
|
+
/**
|
|
19
|
+
* Update function to be called on every frame in the render loop.
|
|
20
|
+
* @param {THREE.scene} scene
|
|
21
|
+
* @param {THREE.Renderer} renderer
|
|
22
|
+
* @param {THREE.camera} camera
|
|
23
|
+
*/
|
|
24
|
+
update(scene: THREE.scene, renderer: THREE.Renderer, camera: THREE.camera): void;
|
|
25
|
+
/**
|
|
26
|
+
* check if the given tile ID was visible in the last rendered frame.
|
|
27
|
+
* @param {string|Number} id
|
|
28
|
+
* @returns true if tile is visible
|
|
29
|
+
*/
|
|
30
|
+
hasID(id: string | number): any;
|
|
31
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Tile loader that manages caching and load order.
|
|
3
|
+
* The cache is an LRU cache and is defined by the number of items it can hold.
|
|
4
|
+
* The actual number of cached items might grow beyond max if all items are in use.
|
|
5
|
+
*
|
|
6
|
+
* The load order is designed for optimal perceived loading speed (nearby tiles are refined first).
|
|
7
|
+
* @class
|
|
8
|
+
*/
|
|
9
|
+
export class TileLoader {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a tile loader with a maximum number of cached items and callbacks.
|
|
12
|
+
* The only required property is a renderer that will be used to visualize the tiles.
|
|
13
|
+
* The maxCachedItems property is the size of the cache in number of objects, mesh tile and tileset.json files.
|
|
14
|
+
* The mesh and point callbacks will be called for every incoming mesh or points.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} [options] - Optional configuration object.
|
|
19
|
+
* @param {renderer} [options.renderer] - The renderer, this is required for KTX2 support.
|
|
20
|
+
* @param {number} [options.maxCachedItems=100] - the cache size.
|
|
21
|
+
* @param {function} [options.meshCallback = undefined] - A callback to call on newly decoded meshes.
|
|
22
|
+
* @param {function} [options.pointsCallback = undefined] - A callback to call on newly decoded points.
|
|
23
|
+
* @param {sring} [options.proxy = undefined] - An optional proxy that tile requests will be directed too as POST requests with the actual tile url in the body of the request.
|
|
24
|
+
*/
|
|
25
|
+
constructor(options?: {
|
|
26
|
+
renderer?: any;
|
|
27
|
+
maxCachedItems?: number | undefined;
|
|
28
|
+
meshCallback?: Function | undefined;
|
|
29
|
+
pointsCallback?: Function | undefined;
|
|
30
|
+
proxy?: any;
|
|
31
|
+
} | undefined);
|
|
32
|
+
maxCachedItems: number;
|
|
33
|
+
proxy: any;
|
|
34
|
+
meshCallback: Function | undefined;
|
|
35
|
+
pointsCallback: Function | undefined;
|
|
36
|
+
gltfLoader: any;
|
|
37
|
+
b3dmDecoder: B3DMDecoder;
|
|
38
|
+
cache: any;
|
|
39
|
+
register: {};
|
|
40
|
+
ready: any[];
|
|
41
|
+
downloads: any[];
|
|
42
|
+
nextReady: any[];
|
|
43
|
+
nextDownloads: any[];
|
|
44
|
+
/**
|
|
45
|
+
* To be called in the render loop or at regular intervals.
|
|
46
|
+
* launches tile downloading and loading in an orderly fashion.
|
|
47
|
+
*/
|
|
48
|
+
update(): void;
|
|
49
|
+
_scheduleDownload(f: any): void;
|
|
50
|
+
_download(): void;
|
|
51
|
+
_meshReceived(cache: any, register: any, key: any, distanceFunction: any, getSiblings: any, level: any, uuid: any): void;
|
|
52
|
+
_loadBatch(): 0 | 1;
|
|
53
|
+
_getNextDownloads(): void;
|
|
54
|
+
_getNextReady(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Schedules a tile content to be downloaded
|
|
57
|
+
*
|
|
58
|
+
* @param {AbortController} abortController
|
|
59
|
+
* @param {string|Number} tileIdentifier
|
|
60
|
+
* @param {string} path
|
|
61
|
+
* @param {Function} callback
|
|
62
|
+
* @param {Function} distanceFunction
|
|
63
|
+
* @param {Function} getSiblings
|
|
64
|
+
* @param {Number} level
|
|
65
|
+
* @param {Boolean} sceneZupToYup
|
|
66
|
+
* @param {Boolean} meshZupToYup
|
|
67
|
+
* @param {Number} geometricError
|
|
68
|
+
*/
|
|
69
|
+
get(abortController: AbortController, tileIdentifier: string | number, path: string, callback: Function, distanceFunction: Function, getSiblings: Function, level: number, sceneZupToYup: boolean, meshZupToYup: boolean, geometricError: number): void;
|
|
70
|
+
/**
|
|
71
|
+
* unregisters a tile content for a specific tile, removing it from the cache if no other tile is using the same content.
|
|
72
|
+
* @param {string} path the content path/url
|
|
73
|
+
* @param {string|Number} tileIdentifier the tile ID
|
|
74
|
+
*/
|
|
75
|
+
invalidate(path: string, tileIdentifier: string | number): void;
|
|
76
|
+
_checkSize(): void;
|
|
77
|
+
}
|
|
78
|
+
import { B3DMDecoder } from "../decoder/B3DMDecoder";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function resolveImplicite(rootTile: any, url: any): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function fetchAndDecodeSubtree(url: any): Promise<any>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Similarly to {@link OGC3DTile}, this class that extends THREE.Object3D loads a tiled and multileveled OGC3DTiles 1.0 or 1.1 dataset.
|
|
3
|
+
* The difference is that tiles are instanced. This is useful when one wants to load the same tileset hundreds or even thousands of times.
|
|
4
|
+
* Imagine rendering hundreds of very high detail cars driving in a city.
|
|
5
|
+
* Each tile content is instanced but each {@link InstancedOGC3DTile} object also has it's own LOD tree making this scenario very efficient.
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export class InstancedOGC3DTile {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} [properties] - the properties for this tileset
|
|
12
|
+
* @param {Object} [properties.renderer] - the renderer used to display the tileset
|
|
13
|
+
* @param {Object} [properties.url] - the url to the parent tileset.json
|
|
14
|
+
* @param {Object} [properties.pathParams] - optional, path params to add to individual tile urls (starts with "?").
|
|
15
|
+
* @param {Object} [properties.geometricErrorMultiplier] - the geometric error of the parent. 1.0 by default corresponds to a maxScreenSpaceError of 16
|
|
16
|
+
* @param {Object} [properties.loadOutsideView] - if truthy, tiles otside the camera frustum will be loaded with the least possible amount of detail
|
|
17
|
+
* @param {Object} [properties.tileLoader] - A tile loader that can be shared among tilesets in order to share a common cache.
|
|
18
|
+
* @param {Object} [properties.meshCallback] - A callback function that will be called on every mesh
|
|
19
|
+
* @param {Object} [properties.pointsCallback] - A callback function that will be called on every points
|
|
20
|
+
* @param {Object} [properties.onLoadCallback] - A callback function that will be called when the root tile has been loaded
|
|
21
|
+
* @param {Object} [properties.occlusionCullingService] - A service that handles occlusion culling
|
|
22
|
+
* @param {Object} [properties.centerModel] - If true, the tileset will be centered on 0,0,0 and in the case of georeferenced tilesets that use the "region" bounding volume, it will also be rotated so that the up axis matched the world y axis.
|
|
23
|
+
* @param {Object} [properties.static] - If true, the tileset is considered static which improves performance but the tileset cannot be moved
|
|
24
|
+
* @param {Object} [properties.rootPath] - optional the root path for fetching children
|
|
25
|
+
* @param {Object} [properties.json] - optional json object representing the tileset sub-tree
|
|
26
|
+
* @param {Object} [properties.parentGeometricError] - optional geometric error of the parent
|
|
27
|
+
* @param {Object} [properties.parentBoundingVolume] - optional bounding volume of the parent
|
|
28
|
+
* @param {Object} [properties.parentRefinement] - optional refinement strategy of the parent of the parent
|
|
29
|
+
* @param {Object} [properties.cameraOnLoad] - optional the camera used when loading this particular sub-tile
|
|
30
|
+
* @param {Object} [properties.parentTile] - optional the OGC3DTile object that loaded this tile as a child
|
|
31
|
+
*/
|
|
32
|
+
constructor(properties?: {
|
|
33
|
+
renderer?: Object | undefined;
|
|
34
|
+
url?: Object | undefined;
|
|
35
|
+
pathParams?: Object | undefined;
|
|
36
|
+
geometricErrorMultiplier?: Object | undefined;
|
|
37
|
+
loadOutsideView?: Object | undefined;
|
|
38
|
+
tileLoader?: Object | undefined;
|
|
39
|
+
meshCallback?: Object | undefined;
|
|
40
|
+
pointsCallback?: Object | undefined;
|
|
41
|
+
onLoadCallback?: Object | undefined;
|
|
42
|
+
occlusionCullingService?: Object | undefined;
|
|
43
|
+
centerModel?: Object | undefined;
|
|
44
|
+
static?: Object | undefined;
|
|
45
|
+
rootPath?: Object | undefined;
|
|
46
|
+
json?: Object | undefined;
|
|
47
|
+
parentGeometricError?: Object | undefined;
|
|
48
|
+
parentBoundingVolume?: Object | undefined;
|
|
49
|
+
parentRefinement?: Object | undefined;
|
|
50
|
+
cameraOnLoad?: Object | undefined;
|
|
51
|
+
parentTile?: Object | undefined;
|
|
52
|
+
} | undefined);
|
|
53
|
+
renderer: Object | undefined;
|
|
54
|
+
geometricErrorMultiplier: number | Object;
|
|
55
|
+
tileset: InstancedTile;
|
|
56
|
+
matrixAutoUpdate: boolean | undefined;
|
|
57
|
+
tileLoader: Object | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* To be called in the render loop.
|
|
60
|
+
* @param {Three.Camera} camera a camera that the tileset will be rendered with.
|
|
61
|
+
*/
|
|
62
|
+
update(camera: Three.Camera, frustum: any): void;
|
|
63
|
+
/**
|
|
64
|
+
* Set the Geometric Error Multiplier for the tileset.
|
|
65
|
+
* the {@param geometricErrorMultiplier} can be a number between 1 and infinity.
|
|
66
|
+
* A {@param geometricErrorMultiplier} of 1 (default) corresponds to a max ScreenSpace error (MSE) of 16.
|
|
67
|
+
* A lower {@param geometricErrorMultiplier} loads less detail (higher MSE) and a higher {@param geometricErrorMultiplier} loads more detail (lower MSE)
|
|
68
|
+
*
|
|
69
|
+
* @param {Number} geometricErrorMultiplier set the LOD multiplier for the entire tileset
|
|
70
|
+
*/
|
|
71
|
+
setGeometricErrorMultiplier(geometricErrorMultiplier: number): void;
|
|
72
|
+
}
|
|
73
|
+
import { InstancedTile } from "./InstancedTile.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export class InstancedTile {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {
|
|
5
|
+
* json: optional,
|
|
6
|
+
* url: optional,
|
|
7
|
+
* rootPath: optional,
|
|
8
|
+
* parentGeometricError: optional,
|
|
9
|
+
* parentBoundingVolume: optional,
|
|
10
|
+
* parentRefinement: optional,
|
|
11
|
+
* loadOutsideView: Boolean,
|
|
12
|
+
* tileLoader : InstancedTileLoader,
|
|
13
|
+
* meshCallback: function,
|
|
14
|
+
* cameraOnLoad: camera,
|
|
15
|
+
* parentTile: OGC3DTile,
|
|
16
|
+
* onLoadCallback: function,
|
|
17
|
+
* centerModel: Boolean,
|
|
18
|
+
* queryParams: String
|
|
19
|
+
* } properties
|
|
20
|
+
*/
|
|
21
|
+
constructor(properties: any);
|
|
22
|
+
queryParams: any;
|
|
23
|
+
uuid: any;
|
|
24
|
+
tileLoader: any;
|
|
25
|
+
master: any;
|
|
26
|
+
meshCallback: any;
|
|
27
|
+
loadOutsideView: any;
|
|
28
|
+
cameraOnLoad: any;
|
|
29
|
+
parentTile: any;
|
|
30
|
+
childrenTiles: any[];
|
|
31
|
+
jsonChildren: any;
|
|
32
|
+
meshContent: Set<any>;
|
|
33
|
+
static: any;
|
|
34
|
+
matrixAutoUpdate: boolean | undefined;
|
|
35
|
+
matrixWorldAutoUpdate: boolean | undefined;
|
|
36
|
+
materialVisibility: boolean;
|
|
37
|
+
inFrustum: boolean;
|
|
38
|
+
level: any;
|
|
39
|
+
hasMeshContent: number;
|
|
40
|
+
hasUnloadedJSONContent: number;
|
|
41
|
+
centerModel: any;
|
|
42
|
+
deleted: boolean;
|
|
43
|
+
abortController: AbortController;
|
|
44
|
+
rootPath: any;
|
|
45
|
+
loadJson(json: any, url: any): void;
|
|
46
|
+
setup(properties: any): Promise<void>;
|
|
47
|
+
isSetup: boolean | undefined;
|
|
48
|
+
isAbsolutePathOrURL(input: any): any;
|
|
49
|
+
assembleURL(root: any, relative: any): string;
|
|
50
|
+
extractQueryParams(url: any, params: any): string;
|
|
51
|
+
load(): void;
|
|
52
|
+
matrixWorldNeedsUpdate: boolean | undefined;
|
|
53
|
+
loadMesh(mesh: any): void;
|
|
54
|
+
dispose(): void;
|
|
55
|
+
parent: any;
|
|
56
|
+
disposeChildren(): void;
|
|
57
|
+
_update(camera: any, frustum: any): void;
|
|
58
|
+
areAllChildrenLoadedAndHidden(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Node is ready if it is outside frustum, if it was drawn at least once or if all it's children are ready
|
|
61
|
+
* @returns true if ready
|
|
62
|
+
*/
|
|
63
|
+
isReady(): boolean;
|
|
64
|
+
changeContentVisibility(visibility: any): void;
|
|
65
|
+
calculateUpdateMetric(camera: any, frustum: any): number;
|
|
66
|
+
getSiblings(): any[];
|
|
67
|
+
calculateDistanceToCamera(camera: any): number;
|
|
68
|
+
getWorldMatrix(): any;
|
|
69
|
+
transformWGS84ToCartesian(lon: any, lat: any, h: any, sfct: any): void;
|
|
70
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Tile loader that manages caching and load order for instanced tiles.
|
|
3
|
+
* The cache is an LRU cache and is defined by the number of items it can hold.
|
|
4
|
+
* The actual number of cached items might grow beyond max if all items are in use.
|
|
5
|
+
*
|
|
6
|
+
* The load order is designed for optimal perceived loading speed (nearby tiles are refined first).
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export class InstancedTileLoader {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a tile loader with a maximum number of cached items and callbacks.
|
|
12
|
+
* The only required property is a renderer that will be used to visualize the tiles.
|
|
13
|
+
* The maxCachedItems property is the size of the cache in number of objects, mesh tile and tileset.json files.
|
|
14
|
+
* The mesh and point callbacks will be called for every incoming mesh or points.
|
|
15
|
+
*
|
|
16
|
+
* @param {scene} [scene] - a threejs scene.
|
|
17
|
+
* @param {Object} [options] - Optional configuration object.
|
|
18
|
+
* @param {number} [options.maxCachedItems=100] - the cache size.
|
|
19
|
+
* @param {number} [options.maxInstances=1] - the cache size.
|
|
20
|
+
* @param {function} [options.meshCallback] - A callback to call on newly decoded meshes.
|
|
21
|
+
* @param {function} [options.pointsCallback] - A callback to call on newly decoded points.
|
|
22
|
+
* @param {renderer} [options.renderer] - The renderer, this is required for KTX2 support.
|
|
23
|
+
* @param {sring} [options.proxy] - An optional proxy that tile requests will be directed too as POST requests with the actual tile url in the body of the request.
|
|
24
|
+
*/
|
|
25
|
+
constructor(scene?: any, options?: {
|
|
26
|
+
maxCachedItems?: number | undefined;
|
|
27
|
+
maxInstances?: number | undefined;
|
|
28
|
+
meshCallback?: Function | undefined;
|
|
29
|
+
pointsCallback?: Function | undefined;
|
|
30
|
+
renderer?: any;
|
|
31
|
+
proxy?: any;
|
|
32
|
+
} | undefined);
|
|
33
|
+
maxCachedItems: number;
|
|
34
|
+
maxInstances: number;
|
|
35
|
+
proxy: any;
|
|
36
|
+
meshCallback: Function | undefined;
|
|
37
|
+
pointsCallback: Function | undefined;
|
|
38
|
+
gltfLoader: any;
|
|
39
|
+
b3dmDecoder: B3DMDecoder;
|
|
40
|
+
cache: any;
|
|
41
|
+
scene: any;
|
|
42
|
+
ready: any[];
|
|
43
|
+
downloads: any[];
|
|
44
|
+
nextReady: any[];
|
|
45
|
+
nextDownloads: any[];
|
|
46
|
+
/**
|
|
47
|
+
* To be called in the render loop or at regular intervals.
|
|
48
|
+
* launches tile downloading and loading in an orderly fashion.
|
|
49
|
+
*/
|
|
50
|
+
update(): void;
|
|
51
|
+
_download(): void;
|
|
52
|
+
_loadBatch(): 0 | 1;
|
|
53
|
+
_getNextReady(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Schedules a tile content to be downloaded
|
|
56
|
+
*
|
|
57
|
+
* @param {AbortController} abortController
|
|
58
|
+
* @param {string} path path or url to tile content
|
|
59
|
+
* @param {string|Number} uuid tile id
|
|
60
|
+
* @param {InstancedOGC3DTile} instancedOGC3DTile
|
|
61
|
+
* @param {Function} distanceFunction
|
|
62
|
+
* @param {Function} getSiblings
|
|
63
|
+
* @param {Number} level
|
|
64
|
+
* @param {Boolean} sceneZupToYup
|
|
65
|
+
* @param {Boolean} meshZupToYup
|
|
66
|
+
* @param {Number} geometricError
|
|
67
|
+
*/
|
|
68
|
+
get(abortController: AbortController, path: string, uuid: string | number, instancedOGC3DTile: InstancedOGC3DTile, distanceFunction: Function, getSiblings: Function, level: number, sceneZupToYup: boolean, meshZupToYup: boolean, geometricError: number): void;
|
|
69
|
+
_getNextDownloads(): void;
|
|
70
|
+
_checkSize(): void;
|
|
71
|
+
}
|
|
72
|
+
import { B3DMDecoder } from "../../decoder/B3DMDecoder";
|
|
73
|
+
import { InstancedOGC3DTile } from './InstancedOGC3DTile';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class MeshTile {
|
|
2
|
+
constructor(scene: any);
|
|
3
|
+
scene: any;
|
|
4
|
+
instancedTiles: any[];
|
|
5
|
+
reuseableMatrix: any;
|
|
6
|
+
addInstance(instancedTile: any): void;
|
|
7
|
+
addToScene(): void;
|
|
8
|
+
setObject(instancedMesh: any): void;
|
|
9
|
+
instancedMesh: any;
|
|
10
|
+
update(): void;
|
|
11
|
+
getCount(): number;
|
|
12
|
+
dispose(): boolean;
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jdultra/threedtiles",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.2",
|
|
4
4
|
"description": "An OGC 3DTiles viewer for Three.js",
|
|
5
5
|
"main": "dist/threedtiles.min.js",
|
|
6
6
|
"files": [
|
|
7
|
-
"dist
|
|
7
|
+
"dist/**/*",
|
|
8
8
|
"README.md",
|
|
9
9
|
"LICENSE"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "
|
|
12
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --allowJs --outDir dist",
|
|
13
|
+
"build": "webpack --config webpack.prod.config.js && npm run build:types",
|
|
13
14
|
"build-dev": "webpack --config webpack.dev.config.js",
|
|
14
15
|
"watch": "webpack --watch --config webpack.dev.config.js",
|
|
15
|
-
"dev": "webpack-dev-server --config webpack.dev.config.js"
|
|
16
|
+
"dev": "webpack-dev-server --config webpack.dev.config.js",
|
|
17
|
+
"generate-docs": "jsdoc --configure jsdoc.json --verbose"
|
|
16
18
|
},
|
|
17
19
|
"repository": {
|
|
18
20
|
"type": "git",
|
|
@@ -54,6 +56,7 @@
|
|
|
54
56
|
"webpack-dev-server": "^4.13.2",
|
|
55
57
|
"webpack-glsl-loader": "^1.0.1",
|
|
56
58
|
"webpack-node-externals": "^3.0.0",
|
|
57
|
-
"whatwg-fetch": "^3.5.0"
|
|
59
|
+
"whatwg-fetch": "^3.5.0",
|
|
60
|
+
"typescript": "^5.2.2"
|
|
58
61
|
}
|
|
59
62
|
}
|