@jdultra/threedtiles 12.0.1 → 13.0.0

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.
@@ -7,33 +7,33 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
7
7
  /**
8
8
  * @param {Object} [properties] - the properties for this tileset
9
9
  * @param {String} [properties.url] - the url to the parent tileset.json
10
- * @param {Object} [properties.queryParams] - optional, path params to add to individual tile urls
11
- * @param {Number} [properties.geometricErrorMultiplier] - the geometric error of the parent. 1.0 by default corresponds to a maxScreenSpaceError of 16
12
- * @param {Boolean} [properties.loadOutsideView] - if truthy, tiles otside the camera frustum will be loaded with the least possible amount of detail
13
- * @param {TileLoader} [properties.tileLoader] - A tile loader that can be shared among tilesets in order to share a common cache.
14
- * @param {Function} [properties.meshCallback] - A callback function that will be called on every mesh
15
- * @param {Function} [properties.pointsCallback] - A callback function that will be called on every points
16
- * @param {Function} [properties.onLoadCallback] - A callback function that will be called when the root tile has been loaded
17
- * @param {OcclusionCullingService} [properties.occlusionCullingService] - A service that handles occlusion culling
18
- * @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.
19
- * @param {Boolean} [properties.static] - If true, the tileset is considered static which improves performance but the matrices aren't automatically updated
20
- * @param {String} [properties.rootPath] - optional the root path for fetching children
21
- * @param {String} [properties.json] - optional json object representing the tileset sub-tree
22
- * @param {Number} [properties.parentGeometricError] - optional geometric error of the parent
23
- * @param {Object} [properties.parentBoundingVolume] - optional bounding volume of the parent
24
- * @param {String} [properties.parentRefine] - optional refine strategy of the parent of the parent
25
- * @param {THREE.Camera} [properties.cameraOnLoad] - optional the camera used when loading this particular sub-tile
26
- * @param {OGC3DTile} [properties.parentTile] - optional the OGC3DTile object that loaded this tile as a child
27
- * @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.
28
- * @param {Boolean} [properties.displayErrors] - optional value indicating that errors should be shown on screen.
29
- * @param {THREE.Renderer} [properties.renderer] - optional the renderer used to display the tileset. Used to infer render resolution at runtime and to instantiate a ktx2loader on the fly if not provided.
30
- * @param {Number} [properties.domWidth] - optional the canvas width (used to calculate geometric error). If a renderer is provided, it'll be used instead, else a default value is used.
31
- * @param {Number} [properties.domHeight] - optional the canvas height (used to calculate geometric error). If a renderer is provided, it'll be used instead, else a default value is used.
32
- * @param {DracoLoader} [properties.dracoLoader] - optional a draco loader (three/addons).
33
- * @param {KTX2Loader} [properties.ktx2Loader] - optional a ktx2 loader (three/addons).
34
- * @param {Number} [properties.distanceBias] - optional a bias that allows loading more or less detail closer to the camera relative to far away. The value should be a positive number. A value below 1 loads less detail near the camera and a value above 1 loads more detail near the camera. This needs to be compensated by the geometricErrorMultiplier in order to load a reasonable number of tiles.
35
- * @param {String} [properties.loadingStrategy] - optional a strategy for loading tiles "INCREMENTAL" loads intermediate LODs while "IMMEDIATE" skips intermediate LODs.
36
- * @param {String} [properties.drawBoundingVolume] - optional draws the bounding volume (may cause flickering)
10
+ * @param {Object} [properties.queryParams = undefined] - optional, path params to add to individual tile urls
11
+ * @param {Number} [properties.geometricErrorMultiplier = 1] - the geometric error of the parent. 1.0 by default corresponds to a maxScreenSpaceError of 16
12
+ * @param {Boolean} [properties.loadOutsideView = false] - if truthy, tiles otside the camera frustum will be loaded with the least possible amount of detail
13
+ * @param {TileLoader} [properties.tileLoader = undefined] - A tile loader that can be shared among tilesets in order to share a common cache.
14
+ * @param {Function} [properties.meshCallback = undefined] - A callback function that will be called on every mesh
15
+ * @param {Function} [properties.pointsCallback = undefined] - A callback function that will be called on every points
16
+ * @param {Function} [properties.onLoadCallback = undefined] - A callback function that will be called when the root tile has been loaded
17
+ * @param {OcclusionCullingService} [properties.occlusionCullingService = undefined] - A service that handles occlusion culling
18
+ * @param {Boolean} [properties.centerModel = false] - 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.
19
+ * @param {Boolean} [properties.static = false] - If true, the tileset is considered static which improves performance but the matrices aren't automatically updated
20
+ * @param {String} [properties.rootPath = undefined] - optional the root path for fetching children
21
+ * @param {String} [properties.json = undefined] - optional json object representing the tileset sub-tree
22
+ * @param {Number} [properties.parentGeometricError = undefined] - optional geometric error of the parent
23
+ * @param {Object} [properties.parentBoundingVolume = undefined] - optional bounding volume of the parent
24
+ * @param {String} [properties.parentRefine = undefined] - optional refine strategy of the parent of the parent
25
+ * @param {THREE.Camera} [properties.cameraOnLoad = undefined] - optional the camera used when loading this particular sub-tile
26
+ * @param {OGC3DTile} [properties.parentTile = undefined] - optional the OGC3DTile object that loaded this tile as a child
27
+ * @param {String} [properties.proxy = undefined] - 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.
28
+ * @param {Boolean} [properties.displayErrors = false] - optional value indicating that errors should be shown on screen.
29
+ * @param {THREE.Renderer} [properties.renderer = undefined] - optional the renderer used to display the tileset. Used to infer render resolution at runtime and to instantiate a ktx2loader on the fly if not provided.
30
+ * @param {Number} [properties.domWidth = undefined] - optional the canvas width (used to calculate geometric error). If a renderer is provided, it'll be used instead, else a default value is used.
31
+ * @param {Number} [properties.domHeight = undefined] - optional the canvas height (used to calculate geometric error). If a renderer is provided, it'll be used instead, else a default value is used.
32
+ * @param {DracoLoader} [properties.dracoLoader = undefined] - optional a draco loader (three/addons).
33
+ * @param {KTX2Loader} [properties.ktx2Loader = undefined] - optional a ktx2 loader (three/addons).
34
+ * @param {Number} [properties.distanceBias = 1] - optional a bias that allows loading more or less detail closer to the camera relative to far away. The value should be a positive number. A value below 1 loads less detail near the camera and a value above 1 loads more detail near the camera. This needs to be compensated by the geometricErrorMultiplier in order to load a reasonable number of tiles.
35
+ * @param {String} [properties.loadingStrategy = "INCREMENTAL"] - optional a strategy for loading tiles "INCREMENTAL" loads intermediate LODs while "IMMEDIATE" skips intermediate LODs.
36
+ * @param {String} [properties.drawBoundingVolume = false] - optional draws the bounding volume (may cause flickering)
37
37
  */
38
38
  constructor(properties?: {
39
39
  url?: string | undefined;
@@ -65,6 +65,7 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
65
65
  loadingStrategy?: string | undefined;
66
66
  drawBoundingVolume?: string | undefined;
67
67
  } | undefined);
68
+ splatsMesh: any;
68
69
  contentURL: any[];
69
70
  rendererSize: THREE.Vector2;
70
71
  loadingStrategy: string;
@@ -96,6 +97,8 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
96
97
  percentageLoaded: number;
97
98
  };
98
99
  geometricErrorMultiplier: number;
100
+ splatsCropRadius: number;
101
+ splatsSizeMultiplier: number;
99
102
  renderer: THREE.Renderer | undefined;
100
103
  meshCallback: Function | undefined;
101
104
  loadOutsideView: boolean | undefined;
@@ -114,6 +117,16 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
114
117
  centerModel: boolean | undefined;
115
118
  abortController: AbortController;
116
119
  onLoadCallback: Function | undefined;
120
+ /**
121
+ * Specify a size multiplier for splats
122
+ * @param {number} sizeMultiplier
123
+ */
124
+ setSplatsSizeMultiplier(sizeMultiplier: number): void;
125
+ /**
126
+ * specify a crop radius for splats
127
+ * @param {number} cropRadius
128
+ */
129
+ setSplatsCropRadius(cropRadius: number): void;
117
130
  /**
118
131
  * Manually updates all the matrices of the tileset.
119
132
  * To be called after transforming a {@link OGC3DTile tileset} instantiated with the "static" option
@@ -140,6 +153,7 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
140
153
  deleted: boolean | undefined;
141
154
  _disposeMeshContent(): void;
142
155
  _disposeChildren(): void;
156
+ raycast(raycaster: any, intersects: any): boolean | void;
143
157
  _updateImmediate(camera: any, frustum: any): void;
144
158
  shouldBeVisible: boolean | undefined;
145
159
  _statsImmediate(maxLOD: any, numTiles: any, percentageLoaded: any, numTilesRendered: any): void;
@@ -174,6 +188,7 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
174
188
  * @param {Number} geometricErrorMultiplier set the LOD multiplier for the entire tileset
175
189
  */
176
190
  setGeometricErrorMultiplier(geometricErrorMultiplier: number): void;
191
+ splatsReady: boolean | undefined;
177
192
  /**
178
193
  * Set the Distance Bias for the tileset.
179
194
  * the {@param distanceBias} can be a number between 0 and infinity.
@@ -16,23 +16,24 @@ export class TileLoader {
16
16
  *
17
17
  *
18
18
  * @param {Object} [options] - Optional configuration object.
19
+ * @param {renderer} [options.renderer] - the WebGL renderer
19
20
  * @param {number} [options.maxCachedItems=100] - the cache size.
20
21
  * @param {function} [options.meshCallback = undefined] - A callback to call on newly decoded meshes.
21
22
  * @param {function} [options.pointsCallback = undefined] - A callback to call on newly decoded points.
22
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.
23
24
  * @param {KTX2Loader} [options.ktx2Loader = undefined] - A KTX2Loader (three/addons)
24
25
  * @param {DRACOLoader} [options.dracoLoader = undefined] - A DRACOLoader (three/addons)
25
- * @param {renderer} [options.renderer = undefined] - optional the renderer, this is required only for on the fly ktx2 support. not needed if you pass a ktx2Loader manually
26
26
  */
27
27
  constructor(options?: {
28
+ renderer?: any;
28
29
  maxCachedItems?: number | undefined;
29
30
  meshCallback?: Function | undefined;
30
31
  pointsCallback?: Function | undefined;
31
32
  proxy?: any;
32
33
  ktx2Loader?: any;
33
34
  dracoLoader?: any;
34
- renderer?: any;
35
35
  } | undefined);
36
+ renderer: any;
36
37
  zUpToYUpMatrix: THREE.Matrix4;
37
38
  maxCachedItems: number;
38
39
  proxy: any;
@@ -43,6 +44,7 @@ export class TileLoader {
43
44
  hasKTX2Loader: boolean | undefined;
44
45
  hasMeshOptDecoder: boolean;
45
46
  b3dmDecoder: B3DMDecoder;
47
+ splatsDecoder: SplatsDecoder;
46
48
  cache: any;
47
49
  register: {};
48
50
  ready: any[];
@@ -74,7 +76,7 @@ export class TileLoader {
74
76
  * @param {Boolean} meshZupToYup
75
77
  * @param {Number} geometricError
76
78
  */
77
- get(abortController: AbortController, tileIdentifier: string | number, path: string, callback: Function, distanceFunction: Function, getSiblings: Function, level: number, sceneZupToYup: boolean, meshZupToYup: boolean, geometricError: number): void;
79
+ get(abortController: AbortController, tileIdentifier: string | number, path: string, callback: Function, distanceFunction: Function, getSiblings: Function, level: number, sceneZupToYup: boolean, meshZupToYup: boolean, geometricError: number, splatsMesh: any): void;
78
80
  /**
79
81
  * Invalidates all the unused cached tiles.
80
82
  */
@@ -89,3 +91,4 @@ export class TileLoader {
89
91
  }
90
92
  import * as THREE from 'three';
91
93
  import { B3DMDecoder } from "../decoder/B3DMDecoder";
94
+ import { SplatsDecoder } from "../decoder/SplatsDecoder";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jdultra/threedtiles",
3
- "version": "12.0.1",
3
+ "version": "13.0.0",
4
4
  "author": "Emeric Beaufays",
5
5
  "description": "An OGC 3DTiles viewer for Three.js",
6
6
  "main": "dist/threedtiles.cjs.js",
@@ -22,12 +22,17 @@
22
22
  "build": "vite build --config vite.prod.config.js && npm run build:types",
23
23
  "build:types": "tsc --declaration --emitDeclarationOnly --allowJs --outDir dist",
24
24
  "generate-docs": "jsdoc --configure jsdoc.json --verbose",
25
- "dev": "vite"
25
+ "dev": "vite",
26
+ "build:dev": "vite build --config vite.config.js",
27
+ "test:watch": "vitest",
28
+ "test": "vitest run"
26
29
  },
27
30
  "peerDependencies": {
28
31
  "three": "0.170.0"
29
32
  },
30
33
  "dependencies": {
34
+ "@haragei/dag": "^1.1.0",
35
+ "data-structure-typed": "^1.53.5",
31
36
  "js-utils-z": "^1.2.1",
32
37
  "meshoptimizer": "^0.20.0",
33
38
  "path-browserify": "^1.0.1",
@@ -36,9 +41,11 @@
36
41
  },
37
42
  "devDependencies": {
38
43
  "@rollup/plugin-terser": "^0.4.4",
44
+ "@types/three": "^0.169.0",
45
+ "jsdom": "^25.0.1",
39
46
  "typescript": "^5.6.3",
40
47
  "vite": "^5.4.10",
41
48
  "vite-plugin-static-copy": "^2.0.0",
42
- "@types/three": "^0.169.0"
49
+ "vitest": "^2.1.5"
43
50
  }
44
51
  }