@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.
Files changed (33) hide show
  1. package/README.md +36 -32
  2. package/dist/decoder/B3DMDecoder.d.ts +8 -0
  3. package/dist/decoder/FeatureTable.d.ts +14 -0
  4. package/dist/draco-decoders/README.md +32 -0
  5. package/dist/draco-decoders/draco_decoder.js +1 -0
  6. package/dist/draco-decoders/draco_decoder.wasm +0 -0
  7. package/dist/draco-decoders/draco_encoder.js +1 -0
  8. package/dist/draco-decoders/draco_wasm_wrapper.js +1 -0
  9. package/dist/draco-decoders/gltf/draco_decoder.js +1 -0
  10. package/dist/draco-decoders/gltf/draco_decoder.wasm +0 -0
  11. package/dist/draco-decoders/gltf/draco_encoder.js +1 -0
  12. package/dist/draco-decoders/gltf/draco_wasm_wrapper.js +1 -0
  13. package/dist/entry.d.ts +5 -0
  14. package/dist/geometry/obb.d.ts +11 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.html +1 -0
  17. package/dist/ktx2-decoders/README.md +46 -0
  18. package/dist/ktx2-decoders/basis_transcoder.js +1 -0
  19. package/dist/ktx2-decoders/basis_transcoder.wasm +0 -0
  20. package/dist/threedtiles.min.js +1 -1
  21. package/dist/threedtiles.min.js.LICENSE.txt +22 -0
  22. package/dist/threedtiles.min.js.map +1 -0
  23. package/dist/tileset/OGC3DTile.d.ts +123 -0
  24. package/dist/tileset/OcclusionCullingService.d.ts +31 -0
  25. package/dist/tileset/TileLoader.d.ts +78 -0
  26. package/dist/tileset/implicit/ImplicitTileResolver.d.ts +1 -0
  27. package/dist/tileset/implicit/SubtreeDecoder.d.ts +1 -0
  28. package/dist/tileset/instanced/InstancedOGC3DTile.d.ts +73 -0
  29. package/dist/tileset/instanced/InstancedTile.d.ts +70 -0
  30. package/dist/tileset/instanced/InstancedTileLoader.d.ts +73 -0
  31. package/dist/tileset/instanced/JsonTile.d.ts +11 -0
  32. package/dist/tileset/instanced/MeshTile.d.ts +13 -0
  33. package/package.json +8 -5
package/README.md CHANGED
@@ -6,24 +6,39 @@
6
6
 
7
7
  A faster 3DTiles viewer for three.js, now with OGC3DTiles 1.1 support
8
8
 
9
+ ## Demos
10
+
11
+ [Google Tiles overlay](https://www.jdultra.com/overlay/index.html)
12
+ overlay high quality meshes over google tiles with some shader magic to avoid overlap
13
+
9
14
  [Windows desktop viewer](https://github.com/ebeaufay/desktop-3dtiles-viewer)
15
+ A viewer for windows based on flutter and this library
10
16
 
11
- [Google Map Tile API](https://www.jdultra.com/google-tiles/index.html) (experimental service with limited availability)
17
+ [Google Map Tile API](https://www.jdultra.com/google-tiles/index.html)
18
+ google tiles in a geospatial framework [ULTRAGLOBE](https://github.com/ebeaufay/UltraGlobe)
12
19
 
13
- [Photogrametry (OBJ conversion)](https://ebeaufay.github.io/ThreedTilesViewer.github.io/)
20
+ [Photogrametry](https://ebeaufay.github.io/ThreedTilesViewer.github.io/)
21
+ Some tiles converted from OBJ via proprietary ULTRAMESH tool
14
22
 
15
23
  [Point cloud vs Mesh](https://www.jdultra.com/pointmeshing/index.html)
16
24
 
17
25
  [PBR material (GlTF conversion)](https://www.jdultra.com/pbr/)
18
26
 
19
27
  [Occlusion culling (IFC conversion)](https://www.jdultra.com/occlusion/index.html)
28
+ Occlusion culling applied at the tile-loading level. This isn't just GPU occlusion culling, hidden tiles aren't even downloaded.
29
+
30
+ [Instanced Tileset](https://www.jdultra.com/instanced/index.html)
31
+ A multitude of identical meshes, each with its own LOD hiearchy but duplicate tiles are instanced
20
32
 
21
- [Instanced Tileset (pilot a swarm of highly detailed spaceships)](https://www.jdultra.com/instanced/index.html)
33
+ ## Getting started
22
34
 
23
- install the library and threejs if not done already:
35
+ ### DOC
36
+ [JSDOC](https://www.jdultra.com/threedtiles/docs/)
37
+
38
+ install the library:
24
39
 
25
40
  ```
26
- npm install three @jdultra/threedtiles --legacy-peer-deps
41
+ npm install three @jdultra/threedtiles
27
42
  ```
28
43
 
29
44
  Adding a tileset to a scene is as easy as :
@@ -46,8 +61,8 @@ It's up to the user to call updates on the tileset.
46
61
  function animate() {
47
62
  requestAnimationFrame(animate);
48
63
 
49
- ogc3DTile.update(camera);
50
- ogc3DTile.tileLoader.update(); // important, since v10!
64
+ ogc3DTile.update(camera); // computes what tiles need to be refined and what tiles can be disposed.
65
+ ogc3DTile.tileLoader.update(); // downloads, loads and caches tiles in optimal order.
51
66
 
52
67
  ...
53
68
 
@@ -57,7 +72,7 @@ function animate() {
57
72
  It is discouraged to call the update functions outside the render loop in a setInterval for example.
58
73
  While that may work fine on desktop, mobile browsers tend to block an entire frame when a timeout triggers in it.
59
74
 
60
- Here is a simple project : [Getting started](https://drive.google.com/file/d/1kJ-yfYmy8ShOMMPPXgqW2gMgGkLOIidf/view?usp=share_link)
75
+ Here is a simple project : [Getting started](https://drive.google.com/file/d/14lipb5eUqfad-n7EUgXuXul-drPdLifV/view?usp=sharing)
61
76
 
62
77
  Unzip and run :
63
78
 
@@ -69,7 +84,7 @@ Unzip and run :
69
84
 
70
85
  If you need to convert meshes to 3DTiles, from small assets to gigabytes of data, contact me for a trial on UltraMesh tool.
71
86
  It works for all types of meshes: photogrametry, BIM, colored or textured meshes with a single texture atlas or many individual textures.
72
- There's support for OBJ, IFC and glTF meshes and las/laz point clouds.
87
+ There's support for OBJ, IFC, Collada and glTF meshes and las/laz point clouds.
73
88
  I aim for optimal quality in terms of mesh, texture and tileset structure and for optimal streaming speed, with no limit to the size of the input data.
74
89
  Contact: emeric.beaufays@jdultra.com
75
90
 
@@ -283,6 +298,8 @@ const ogc3DTile = new OGC3DTile({
283
298
  Then, you must update the occlusionCullingService within your render loop:
284
299
  ```
285
300
  function animate() {
301
+ ogc3DTile.update(camera);
302
+ ogc3DTile.tileLoader.update();
286
303
  requestAnimationFrame(animate);
287
304
  renderer.render(scene, camera);
288
305
  occlusionCullingService.update(scene, renderer, camera)
@@ -418,30 +435,17 @@ KTX uses an external wasm loaded at runtime so if you have trouble packaging you
418
435
 
419
436
  ### tileset update loop
420
437
  Updating a single tileset via OGC3DTile#update or InstancedOGC3DTile#update is quite fast, even when the tree is deep.
421
- For a single tileset, it's safe to call it regularly with a setInterval:
422
- ```
423
- function startInterval() {
424
- interval = setIntervalAsync(function () {
425
- ogc3DTile.update(camera);
426
- }, 20);
427
- }
438
+ For a single tileset, it's safe to call it on every frame:
428
439
  ```
429
-
430
- However, with instancedTilesets, you may have hundreds or even thousands of LOD trees that need to be updated individually. In order to preserve frame-rate,
431
- you may want to implement something a little smarter that yields the CPU to the render loop. In the example below, the process tries to update as many tilesets as it can in under 4 ms.
432
-
433
- ```
434
- function now() {
435
- return (typeof performance === 'undefined' ? Date : performance).now();
440
+ function animate() {
441
+ requestAnimationFrame(animate);
442
+ ogc3DTile.update(camera);
443
+ ogc3DTile.tileLoader.update();
444
+
445
+ ... // rest of render loop
436
446
  }
437
- let updateIndex = 0;
438
- setInterval(() => {
439
- let startTime = now();
440
- do{
441
- instancedTilesets[updateIndex].update(camera);
442
- updateIndex= (updateIndex+1)%instancedTilesets.length;
443
- }while(updateIndex < instancedTilesets.length && now()-startTime<4);
444
- },50);
447
+ animate();
445
448
  ```
446
449
 
447
- window#requestIdleCallback is also a good option but the rate of updates becomes slightly unpredictable.
450
+ However, if you have several OGC3DTiles loaded or when you use instancedTilesets, you may have hundreds or even thousands of LOD trees that need to be updated individually. In order to preserve frame-rate,
451
+ you'll want to avoid updating every single tileset on every frame.
@@ -0,0 +1,8 @@
1
+ export class B3DMDecoder {
2
+ constructor(renderer: any);
3
+ gltfLoader: any;
4
+ tempMatrix: any;
5
+ parseB3DM(arrayBuffer: any, meshCallback: any, sceneZupToYUp: any, meshZUpToYUp: any): Promise<any>;
6
+ checkLoaderInitialized: () => Promise<any>;
7
+ parseB3DMInstanced(arrayBuffer: any, meshCallback: any, maxCount: any, sceneZupToYUp: any, meshZupToYup: any): Promise<any>;
8
+ }
@@ -0,0 +1,14 @@
1
+ export class FeatureTable {
2
+ constructor(buffer: any, start: any, headerLength: any, binLength: any);
3
+ buffer: any;
4
+ binOffset: any;
5
+ binLength: any;
6
+ header: any;
7
+ getKeys(): string[];
8
+ getData(key: any, count: any, defaultComponentType?: null, defaultType?: null): any;
9
+ }
10
+ export class BatchTable extends FeatureTable {
11
+ constructor(buffer: any, batchSize: any, start: any, headerLength: any, binLength: any);
12
+ batchSize: any;
13
+ getData(key: any, componentType?: null, type?: null): any;
14
+ }
@@ -0,0 +1,32 @@
1
+ # Draco 3D Data Compression
2
+
3
+ Draco is an open-source library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.
4
+
5
+ [Website](https://google.github.io/draco/) | [GitHub](https://github.com/google/draco)
6
+
7
+ ## Contents
8
+
9
+ This folder contains three utilities:
10
+
11
+ * `draco_decoder.js` — Emscripten-compiled decoder, compatible with any modern browser.
12
+ * `draco_decoder.wasm` — WebAssembly decoder, compatible with newer browsers and devices.
13
+ * `draco_wasm_wrapper.js` — JavaScript wrapper for the WASM decoder.
14
+
15
+ Each file is provided in two variations:
16
+
17
+ * **Default:** Latest stable builds, tracking the project's [master branch](https://github.com/google/draco).
18
+ * **glTF:** Builds targeted by the [glTF mesh compression extension](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression), tracking the [corresponding Draco branch](https://github.com/google/draco/tree/gltf_2.0_draco_extension).
19
+
20
+ Either variation may be used with `THREE.DRACOLoader`:
21
+
22
+ ```js
23
+ var dracoLoader = new THREE.DRACOLoader();
24
+ dracoLoader.setDecoderPath('path/to/decoders/');
25
+ dracoLoader.setDecoderConfig({type: 'js'}); // (Optional) Override detection of WASM support.
26
+ ```
27
+
28
+ Further [documentation on GitHub](https://github.com/google/draco/tree/master/javascript/example#static-loading-javascript-decoder).
29
+
30
+ ## License
31
+
32
+ [Apache License 2.0](https://github.com/google/draco/blob/master/LICENSE)