easy-three-utils 0.0.1
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/package.json +12 -0
- package/src/common/index.ts +24 -0
- package/src/common/useLine2.ts +87 -0
- package/src/common/useLoader.ts +184 -0
- package/src/common/useLocationCalculator.ts +145 -0
- package/src/common/useMark.ts +42 -0
- package/src/common/useTween.ts +86 -0
- package/src/core/basic/camera.ts +28 -0
- package/src/core/basic/clock.ts +11 -0
- package/src/core/basic/control.ts +32 -0
- package/src/core/basic/index.ts +35 -0
- package/src/core/basic/labelRenderer.ts +26 -0
- package/src/core/basic/light.ts +63 -0
- package/src/core/basic/renderer.ts +37 -0
- package/src/core/basic/scene.ts +11 -0
- package/src/core/basic/stats.ts +16 -0
- package/src/core/event.ts +74 -0
- package/src/core/index.ts +11 -0
- package/src/core/main.ts +389 -0
- package/src/draco/README.md +32 -0
- package/src/draco/draco_decoder.js +34 -0
- package/src/draco/draco_decoder.wasm +0 -0
- package/src/draco/draco_encoder.js +33 -0
- package/src/draco/draco_wasm_wrapper.js +117 -0
- package/src/draco/gltf/draco_decoder.js +33 -0
- package/src/draco/gltf/draco_decoder.wasm +0 -0
- package/src/draco/gltf/draco_encoder.js +33 -0
- package/src/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/src/tileRenderer/base/Tile.d.ts +50 -0
- package/src/tileRenderer/base/TileBase.d.ts +76 -0
- package/src/tileRenderer/base/TileInternal.d.ts +36 -0
- package/src/tileRenderer/base/TilesRendererBase.d.ts +35 -0
- package/src/tileRenderer/base/TilesRendererBase.js +847 -0
- package/src/tileRenderer/base/Tileset.d.ts +66 -0
- package/src/tileRenderer/base/constants.d.ts +6 -0
- package/src/tileRenderer/base/constants.js +16 -0
- package/src/tileRenderer/base/loaders/B3DMLoaderBase.d.ts +18 -0
- package/src/tileRenderer/base/loaders/B3DMLoaderBase.js +85 -0
- package/src/tileRenderer/base/loaders/CMPTLoaderBase.d.ts +22 -0
- package/src/tileRenderer/base/loaders/CMPTLoaderBase.js +61 -0
- package/src/tileRenderer/base/loaders/I3DMLoaderBase.d.ts +21 -0
- package/src/tileRenderer/base/loaders/I3DMLoaderBase.js +130 -0
- package/src/tileRenderer/base/loaders/LoaderBase.d.ts +10 -0
- package/src/tileRenderer/base/loaders/LoaderBase.js +73 -0
- package/src/tileRenderer/base/loaders/PNTSLoaderBase.d.ts +17 -0
- package/src/tileRenderer/base/loaders/PNTSLoaderBase.js +82 -0
- package/src/tileRenderer/base/plugins/ImplicitTilingPlugin.js +12 -0
- package/src/tileRenderer/base/traverseFunctions.js +468 -0
- package/src/tileRenderer/gltf.js +144 -0
- package/src/tileRenderer/index.d.ts +41 -0
- package/src/tileRenderer/index.js +44 -0
- package/src/tileRenderer/plugins/README.md +578 -0
- package/src/tileRenderer/plugins/base/ImplicitTilingPlugin.d.ts +2 -0
- package/src/tileRenderer/plugins/base/ImplicitTilingPlugin.js +84 -0
- package/src/tileRenderer/plugins/base/SUBTREELoader.js +876 -0
- package/src/tileRenderer/plugins/index.d.ts +17 -0
- package/src/tileRenderer/plugins/index.js +17 -0
- package/src/tileRenderer/plugins/three/CesiumIonAuthPlugin.d.ts +9 -0
- package/src/tileRenderer/plugins/three/CesiumIonAuthPlugin.js +175 -0
- package/src/tileRenderer/plugins/three/DebugTilesPlugin.d.ts +29 -0
- package/src/tileRenderer/plugins/three/DebugTilesPlugin.js +677 -0
- package/src/tileRenderer/plugins/three/GLTFExtensionsPlugin.d.ts +18 -0
- package/src/tileRenderer/plugins/three/GLTFExtensionsPlugin.js +86 -0
- package/src/tileRenderer/plugins/three/GoogleAttributionsManager.js +62 -0
- package/src/tileRenderer/plugins/three/GoogleCloudAuthPlugin.d.ts +5 -0
- package/src/tileRenderer/plugins/three/GoogleCloudAuthPlugin.js +200 -0
- package/src/tileRenderer/plugins/three/ReorientationPlugin.d.ts +12 -0
- package/src/tileRenderer/plugins/three/ReorientationPlugin.js +136 -0
- package/src/tileRenderer/plugins/three/TileCompressionPlugin.d.ts +18 -0
- package/src/tileRenderer/plugins/three/TileCompressionPlugin.js +223 -0
- package/src/tileRenderer/plugins/three/UpdateOnChangePlugin.d.ts +5 -0
- package/src/tileRenderer/plugins/three/UpdateOnChangePlugin.js +87 -0
- package/src/tileRenderer/plugins/three/fade/FadeManager.js +370 -0
- package/src/tileRenderer/plugins/three/fade/TilesFadePlugin.d.ts +9 -0
- package/src/tileRenderer/plugins/three/fade/TilesFadePlugin.js +318 -0
- package/src/tileRenderer/plugins/three/gltf/GLTFCesiumRTCExtension.d.ts +5 -0
- package/src/tileRenderer/plugins/three/gltf/GLTFCesiumRTCExtension.js +27 -0
- package/src/tileRenderer/plugins/three/gltf/GLTFMeshFeaturesExtension.d.ts +30 -0
- package/src/tileRenderer/plugins/three/gltf/GLTFMeshFeaturesExtension.js +76 -0
- package/src/tileRenderer/plugins/three/gltf/GLTFStructuralMetadataExtension.d.ts +49 -0
- package/src/tileRenderer/plugins/three/gltf/GLTFStructuralMetadataExtension.js +147 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/classes/ClassProperty.js +149 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/classes/MeshFeatures.js +215 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/classes/PropertyAttributeAccessor.js +107 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/classes/PropertySetAccessor.js +45 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/classes/PropertyTableAccessor.js +209 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/classes/PropertyTextureAccessor.js +244 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/classes/StructuralMetadata.js +202 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/math/Matrix2.js +55 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/utilities/ClassPropertyHelpers.js +495 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/utilities/TexCoordUtilities.js +72 -0
- package/src/tileRenderer/plugins/three/gltf/metadata/utilities/TextureReadUtility.js +154 -0
- package/src/tileRenderer/plugins/three/objects/EllipsoidRegionHelper.js +186 -0
- package/src/tileRenderer/plugins/three/objects/SphereHelper.js +55 -0
- package/src/tileRenderer/r3f/README.md +238 -0
- package/src/tileRenderer/r3f/components/CameraControls.jsx +132 -0
- package/src/tileRenderer/r3f/components/CameraTransition.jsx +177 -0
- package/src/tileRenderer/r3f/components/CanvasDOMOverlay.jsx +54 -0
- package/src/tileRenderer/r3f/components/CompassGizmo.jsx +260 -0
- package/src/tileRenderer/r3f/components/TilesAttributionOverlay.jsx +110 -0
- package/src/tileRenderer/r3f/components/TilesRenderer.jsx +239 -0
- package/src/tileRenderer/r3f/index.jsx +6 -0
- package/src/tileRenderer/r3f/utilities/useForceUpdate.jsx +8 -0
- package/src/tileRenderer/r3f/utilities/useObjectDep.jsx +59 -0
- package/src/tileRenderer/r3f/utilities/useOptions.jsx +143 -0
- package/src/tileRenderer/three/DebugTilesRenderer.d.ts +28 -0
- package/src/tileRenderer/three/DebugTilesRenderer.js +58 -0
- package/src/tileRenderer/three/TilesGroup.d.ts +9 -0
- package/src/tileRenderer/three/TilesGroup.js +91 -0
- package/src/tileRenderer/three/TilesRenderer.d.ts +37 -0
- package/src/tileRenderer/three/TilesRenderer.js +1049 -0
- package/src/tileRenderer/three/controls/CameraTransitionManager.js +305 -0
- package/src/tileRenderer/three/controls/EnvironmentControls.js +1295 -0
- package/src/tileRenderer/three/controls/GlobeControls.js +684 -0
- package/src/tileRenderer/three/controls/PivotPointMesh.js +104 -0
- package/src/tileRenderer/three/controls/PointerTracker.js +257 -0
- package/src/tileRenderer/three/controls/utils.js +113 -0
- package/src/tileRenderer/three/loaders/B3DMLoader.d.ts +26 -0
- package/src/tileRenderer/three/loaders/B3DMLoader.js +85 -0
- package/src/tileRenderer/three/loaders/CMPTLoader.d.ts +19 -0
- package/src/tileRenderer/three/loaders/CMPTLoader.js +97 -0
- package/src/tileRenderer/three/loaders/GLTFExtensionLoader.d.ts +11 -0
- package/src/tileRenderer/three/loaders/GLTFExtensionLoader.js +68 -0
- package/src/tileRenderer/three/loaders/I3DMLoader.d.ts +26 -0
- package/src/tileRenderer/three/loaders/I3DMLoader.js +256 -0
- package/src/tileRenderer/three/loaders/PNTSLoader.d.ts +25 -0
- package/src/tileRenderer/three/loaders/PNTSLoader.js +202 -0
- package/src/tileRenderer/three/loaders/gltf/GLTFCesiumRTCExtension.js +12 -0
- package/src/tileRenderer/three/loaders/gltf/GLTFMeshFeaturesExtension.js +12 -0
- package/src/tileRenderer/three/loaders/gltf/GLTFStructuralMetadataExtension.js +12 -0
- package/src/tileRenderer/three/math/Ellipsoid.d.ts +31 -0
- package/src/tileRenderer/three/math/Ellipsoid.js +337 -0
- package/src/tileRenderer/three/math/EllipsoidRegion.d.ts +23 -0
- package/src/tileRenderer/three/math/EllipsoidRegion.js +178 -0
- package/src/tileRenderer/three/math/ExtendedFrustum.js +65 -0
- package/src/tileRenderer/three/math/GeoConstants.d.ts +4 -0
- package/src/tileRenderer/three/math/GeoConstants.js +5 -0
- package/src/tileRenderer/three/math/GeoUtils.d.ts +9 -0
- package/src/tileRenderer/three/math/GeoUtils.js +106 -0
- package/src/tileRenderer/three/math/OBB.js +179 -0
- package/src/tileRenderer/three/math/TileBoundingVolume.js +272 -0
- package/src/tileRenderer/three/plugins/CesiumIonAuthPlugin.js +12 -0
- package/src/tileRenderer/three/plugins/DebugTilesPlugin.js +26 -0
- package/src/tileRenderer/three/plugins/GoogleCloudAuthPlugin.js +12 -0
- package/src/tileRenderer/three/raycastTraverse.js +178 -0
- package/src/tileRenderer/three/renderers/CesiumIonTilesRenderer.d.ts +14 -0
- package/src/tileRenderer/three/renderers/CesiumIonTilesRenderer.js +21 -0
- package/src/tileRenderer/three/renderers/GoogleTilesRenderer.d.ts +43 -0
- package/src/tileRenderer/three/renderers/GoogleTilesRenderer.js +48 -0
- package/src/tileRenderer/three/utilities.js +54 -0
- package/src/tileRenderer/utilities/BatchTable.d.ts +24 -0
- package/src/tileRenderer/utilities/BatchTable.js +82 -0
- package/src/tileRenderer/utilities/BatchTableHierarchyExtension.js +127 -0
- package/src/tileRenderer/utilities/FeatureTable.d.ts +30 -0
- package/src/tileRenderer/utilities/FeatureTable.js +159 -0
- package/src/tileRenderer/utilities/LRUCache.d.ts +8 -0
- package/src/tileRenderer/utilities/LRUCache.js +385 -0
- package/src/tileRenderer/utilities/PriorityQueue.d.ts +16 -0
- package/src/tileRenderer/utilities/PriorityQueue.js +137 -0
- package/src/tileRenderer/utilities/arrayToString.js +7 -0
- package/src/tileRenderer/utilities/readMagicBytes.js +29 -0
- package/src/tileRenderer/utilities/rgb565torgb.js +22 -0
- package/src/tileRenderer/utilities/urlExtension.js +34 -0
- package/tsconfig.json +42 -0
- package/tsconfig.node.json +11 -0
- package/typings/three.d.ts +27 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
Documentation for plugins and extensions provided by the `3d-tiles-renderer/plugins` export.
|
|
2
|
+
|
|
3
|
+
# GLTF Plugins
|
|
4
|
+
|
|
5
|
+
Set of three.js GLTFLoader plugins to be registered via `GLTFLoader.register`. To use with the TilesRenderer:
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
const tiles = new TilesRenderer( url );
|
|
9
|
+
const loader = new GLTFLoader( tiles.manager );
|
|
10
|
+
loader.register( () => new GLTFMeshFeaturesExtension() );
|
|
11
|
+
loader.register( () => new GLTFStructuralMetadataExtension() );
|
|
12
|
+
loader.register( () => new GLTFCesiumRTCExtension() );
|
|
13
|
+
tiles.manager.addHandler( /(gltf|glb)$/g, loader );
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## GLTFMeshFeaturesExtension
|
|
17
|
+
|
|
18
|
+
Plugin that adds support for the [EXT_mesh_features](https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features) extension.
|
|
19
|
+
Adds a `Object3D.userData.meshFeatures` to each object with the extension that provides the following API:
|
|
20
|
+
|
|
21
|
+
### .getTextures
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
getTextures() : Array<Texture>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Returns an indexed list of all textures used by features in the extension.
|
|
28
|
+
|
|
29
|
+
### .getFeatureInfo
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
getFeatureInfo() : {
|
|
33
|
+
label: string | null,
|
|
34
|
+
propertyTable: string | null,
|
|
35
|
+
nullFeatureId: number | null,
|
|
36
|
+
texture?: {
|
|
37
|
+
texCoord: number,
|
|
38
|
+
channels: Array<number>,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Returns the feature information information associated with all features on the object.
|
|
44
|
+
|
|
45
|
+
### .getFeatures
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
getFeatures( triangle : number, barycoord : Vector3 ) : Array<number>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Takes the triangle index from something like a raycast hit as well as the calculated barycentric coordinate and returns the list of feature ids extracted from
|
|
52
|
+
the object at the given point. Indexed in the same order as the list of feature info in the extension.
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
const barycoord = new Vector3();
|
|
56
|
+
const triangle = new Triangle();
|
|
57
|
+
const hit = raycaster.raycast( object );
|
|
58
|
+
if ( hit ) {
|
|
59
|
+
|
|
60
|
+
const { face, point, faceIndex } = hit;
|
|
61
|
+
triangle.setFromAttributeAndIndices( object.geometry.attributes.position, face.a, face.b, face.c );
|
|
62
|
+
triangle.a.applyMatrix4( object.matrixWorld );
|
|
63
|
+
triangle.b.applyMatrix4( object.matrixWorld );
|
|
64
|
+
triangle.c.applyMatrix4( object.matrixWorld );
|
|
65
|
+
triangle.getBarycoord( point, barycoord );
|
|
66
|
+
|
|
67
|
+
const features = meshFeatures.getFeatures( faceIndex, barycoord );
|
|
68
|
+
// ...
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### .getFeaturesAsync
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
getFeaturesAsync( triangle : number, barycoord : Vector3 ) : Promise<Array<number>>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Performs the same function as `getFeatures` but with the texture asynchronous texture read operation.
|
|
80
|
+
|
|
81
|
+
## GLTFStructuralMetadataExtension
|
|
82
|
+
|
|
83
|
+
Plugin that adds support for the [EXT_structural_metadata](https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata) extension. Adds a `Object3D.userData.structuralMetadata` to each object with the extension that provides the following API.
|
|
84
|
+
|
|
85
|
+
_Note that 64 bit integer types are not fully supported._
|
|
86
|
+
|
|
87
|
+
### .textures
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
textures: Array<Texture>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Returns an indexed list of all textures used by metadata accessors in the extension.
|
|
94
|
+
|
|
95
|
+
### .schema
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
schema: Object
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The extension schema object.
|
|
102
|
+
|
|
103
|
+
### .getPropertyTableData
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
getPropertyTableData(
|
|
107
|
+
tableIndices : Array<number>,
|
|
108
|
+
ids : Array<number>,
|
|
109
|
+
target = [] : Array,
|
|
110
|
+
) : target
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Returns data stored in property tables. Takes a list of table ids and ids from those tables, and returns a list of objects adhering to the structure class referenced in the table schema.
|
|
114
|
+
|
|
115
|
+
### .getPropertyTableInfo
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
getPropertyTableInfo( tableIndices = null : Array<number> ) : Array<{
|
|
119
|
+
name: string,
|
|
120
|
+
className: string,
|
|
121
|
+
}>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Returns information about the tables.
|
|
125
|
+
|
|
126
|
+
### .getPropertyTextureData
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
getPropertyTextureData(
|
|
130
|
+
triangle : number,
|
|
131
|
+
barycoord : Vector3,
|
|
132
|
+
target = [] : Array,
|
|
133
|
+
) : target
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Returns data stored in property textures. Takes a triangle index and barycentric coordinate, and returns a list of objects adhering to the structure class referenced in the table schema. See `MeshFeatures.getFeatures` for how to calculate the index and barycoord.
|
|
137
|
+
|
|
138
|
+
### .getPropertyTextureDataAsync
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
getPropertyTextureDataAsync(
|
|
142
|
+
triangle : number,
|
|
143
|
+
barycoord : Vector3,
|
|
144
|
+
target = [] : Array,
|
|
145
|
+
) : Promise<target>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Returns the same data from `getPropertyTextureData` but performs texture read operations asynchronously.
|
|
149
|
+
|
|
150
|
+
### .getPropertyTextureInfo
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
getPropertyTextureInfo() : Array<{
|
|
154
|
+
name: string,
|
|
155
|
+
className: string,
|
|
156
|
+
properties: {
|
|
157
|
+
[name]: {
|
|
158
|
+
channels: Array<number>,
|
|
159
|
+
index: number | null,
|
|
160
|
+
texCoord: number | null,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
}>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Returns information about the property texture accessors from the extension.
|
|
167
|
+
|
|
168
|
+
### .getPropertyAttributeData
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
getPropertyAttributeData( attributeIndex : number, target = [] : Array) : target
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Returns data stored as property attributes. Takes the index of an index from length of the attributes, and returns a list of objects adhering to the structure class referenced in the table schema.
|
|
175
|
+
|
|
176
|
+
### .getPropertyAttributeInfo
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
getPropertyAttributeInfo() : Array<{
|
|
180
|
+
name: string,
|
|
181
|
+
className: string,
|
|
182
|
+
}>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Returns information about the attribute accessors from the extension.
|
|
186
|
+
|
|
187
|
+
## GLTFCesiumRTCExtension
|
|
188
|
+
|
|
189
|
+
Plugin that adds support for [CESIUM_RTC](https://github.com/KhronosGroup/glTF/blob/main/extensions/1.0/Vendor/CESIUM_RTC/README.md) extension.
|
|
190
|
+
|
|
191
|
+
# TilesRenderer Plugins
|
|
192
|
+
|
|
193
|
+
Plugins to register to the TilesRenderer instance to modify behavior.
|
|
194
|
+
|
|
195
|
+
```js
|
|
196
|
+
const tiles = new TilesRenderer( url );
|
|
197
|
+
tiles.registerPlugin( new TileCompressionPlugin() );
|
|
198
|
+
tiles.registerPlugin( new TilesFadePlugin() );
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## ImplicitTilingPlugin
|
|
202
|
+
|
|
203
|
+
Plugin that adds support for 3d tiles [implicit tiling](https://github.com/CesiumGS/3d-tiles/tree/main/specification/ImplicitTiling) feature.
|
|
204
|
+
|
|
205
|
+
## DebugTilesPlugin
|
|
206
|
+
|
|
207
|
+
Plugin TilesRenderer that includes helpers for debugging and visualizing the various tiles in the tile set. Material overrides will not work as expected with this plugin. The plugin includes additional logic and initialization code which can cause performance loss so it's recommended to only use this when needed.
|
|
208
|
+
|
|
209
|
+
### .colorMode
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
colorMode = NONE : ColorMode
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Which color mode to use when rendering the tile set. The following exported enumerations can be used:
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
// No special color mode. Uses the default materials.
|
|
219
|
+
NONE
|
|
220
|
+
|
|
221
|
+
// Render the screenspace error from black to white with errorTarget
|
|
222
|
+
// being the maximum value.
|
|
223
|
+
SCREEN_ERROR
|
|
224
|
+
|
|
225
|
+
// Render the geometric error from black to white with maxDebugError
|
|
226
|
+
// being the maximum value.
|
|
227
|
+
GEOMETRIC_ERROR
|
|
228
|
+
|
|
229
|
+
// Render the distance from the camera to the tile as black to white
|
|
230
|
+
// with maxDebugDistance being the maximum value.
|
|
231
|
+
DISTANCE
|
|
232
|
+
|
|
233
|
+
// Render the depth of the tile relative to the root as black to white
|
|
234
|
+
// with maxDebugDepth being the maximum value.
|
|
235
|
+
DEPTH
|
|
236
|
+
|
|
237
|
+
// Render the depth of the tile relative to the nearest rendered parent
|
|
238
|
+
// as black to white with maxDebugDepth being the maximum value.
|
|
239
|
+
RELATIVE_DEPTH
|
|
240
|
+
|
|
241
|
+
// Render leaf nodes as white and parent nodes as black.
|
|
242
|
+
IS_LEAF
|
|
243
|
+
|
|
244
|
+
// Render the tiles with a random color to show tile edges clearly.
|
|
245
|
+
RANDOM_COLOR
|
|
246
|
+
|
|
247
|
+
// Render every individual mesh in the scene with a random color.
|
|
248
|
+
RANDOM_NODE_COLOR
|
|
249
|
+
|
|
250
|
+
// Sets a custom color using the customColorCallback call back.
|
|
251
|
+
CUSTOM_COLOR
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### .customColorCallback
|
|
255
|
+
|
|
256
|
+
```js
|
|
257
|
+
customColorCallback: (tile: Tile, child: Object3D) => void
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The callback used if `debugColor` is set to `CUSTOM_COLOR`. Value defaults to `null` and must be set explicitly.
|
|
261
|
+
|
|
262
|
+
### .displayBoxBounds
|
|
263
|
+
|
|
264
|
+
```js
|
|
265
|
+
displayBoxBounds = false : Boolean
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Display wireframe bounding boxes from the tiles `boundingVolume.box` (or derived from the region bounds) for every visible tile.
|
|
269
|
+
|
|
270
|
+
### .displaySphereBounds
|
|
271
|
+
|
|
272
|
+
```js
|
|
273
|
+
displaySphereBounds = false : Boolean
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Display wireframe bounding boxes from the tiles `boundingVolume.sphere` (or derived from the bounding box / region bounds) for every visible tile.
|
|
277
|
+
|
|
278
|
+
### .displayRegionBounds
|
|
279
|
+
|
|
280
|
+
```js
|
|
281
|
+
displayRegionBounds = false : Boolean
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Display wireframe bounding rgions from the tiles `boundingVolume.region` for every visible tile if it exists.
|
|
285
|
+
|
|
286
|
+
### .maxDebugDepth
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
maxDebugDepth = - 1 : Number
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
The depth value that represents white when rendering with `DEPTH` or `RELATIVE_DEPTH` [colorMode](#colorMode). If `maxDebugDepth` is `-1` then the maximum depth of the tile set is used.
|
|
293
|
+
|
|
294
|
+
### .maxDebugError
|
|
295
|
+
|
|
296
|
+
```js
|
|
297
|
+
maxDebugError = - 1 : Number
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
The error value that represents white when rendering with `GEOMETRIC_ERROR` [colorMode](#colorMode). If `maxDebugError` is `-1` then the maximum geometric error in the tile set is used.
|
|
301
|
+
|
|
302
|
+
### .maxDebugDistance
|
|
303
|
+
|
|
304
|
+
```js
|
|
305
|
+
maxDebugDistance = - 1 : Number
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
The distance value that represents white when rendering with `DISTANCE` [colorMode](#colorMode). If `maxDebugDistance` is `-1` then the radius of the tile set is used.
|
|
309
|
+
|
|
310
|
+
### .constructor
|
|
311
|
+
|
|
312
|
+
```js
|
|
313
|
+
constructor( options = {} )
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Takes a set of options to initialize to.
|
|
317
|
+
|
|
318
|
+
### .getDebugColor
|
|
319
|
+
|
|
320
|
+
```js
|
|
321
|
+
getDebugColor : ( val : Number, target : Color ) => void
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The function used to map a [0, 1] value to a color for debug visualizations. By default the color is mapped from black to white.
|
|
325
|
+
|
|
326
|
+
## GoogleCloudAuthPlugin
|
|
327
|
+
|
|
328
|
+
### constructor
|
|
329
|
+
|
|
330
|
+
```js
|
|
331
|
+
constructor( { accessToken : String, autoRefreshToken = false : Boolean, logoUrl = null : String | null, useRecommendedSettings = true : Boolean } )
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Takes the Google Cloud access token. If `autoRefreshToken` is set to true then the plugin will automatically perform a new root tile request once the existing token has expired after four hours.
|
|
335
|
+
This plugin changes below values to be more efficient for the photorealistic tiles if `useRecommendedSettings = true (default)`:
|
|
336
|
+
```js
|
|
337
|
+
tiles.parseQueue.maxJobs = 10;
|
|
338
|
+
tiles.downloadQueue.maxJobs = 30;
|
|
339
|
+
tiles.errorTarget = 40;
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## CesiumIonAuthPlugin
|
|
343
|
+
|
|
344
|
+
### constructor
|
|
345
|
+
|
|
346
|
+
```js
|
|
347
|
+
constructor( { apiToken : String, assetId = null : String | null, autoRefreshToken = false : Boolean } )
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Takes the CesiumIon access token and optionally the asset id. If the asset id is not provided then the Cesium Ion URL is expected to have been passed into the `TilesRenderer` constructor. If `autoRefreshToken` is set to true then the plugin will automatically perform a new root tile request once the existing token has expired after an hour.
|
|
351
|
+
|
|
352
|
+
## TextureOverlayPlugin
|
|
353
|
+
|
|
354
|
+
_available in the examples directory_
|
|
355
|
+
|
|
356
|
+
Plugin for loading alternate texture sets and assigning them to geometry in the tile set.
|
|
357
|
+
|
|
358
|
+
### .textureUpdateCallback
|
|
359
|
+
|
|
360
|
+
```
|
|
361
|
+
textureUpdateCallback : ( tile, model, plugin ) => void;
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Callback fired when the textures for a specific tile has been loaded. This function is required.
|
|
365
|
+
|
|
366
|
+
### .waitForLoadCompletion
|
|
367
|
+
|
|
368
|
+
```js
|
|
369
|
+
waitForLoadCompletion : Boolean
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
If true then the update callback will only fire for tiles once all the associated textures have loaded.
|
|
373
|
+
|
|
374
|
+
### constructor
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
constructor( options = {
|
|
378
|
+
textureUpdateCallback: null,
|
|
379
|
+
waitForLoadCompletion: true,
|
|
380
|
+
} );
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### .getTexturesForTile
|
|
384
|
+
|
|
385
|
+
```js
|
|
386
|
+
getTexturesForTile( tile : Tile, target = {} : Object ) : target
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### .registerLayer
|
|
390
|
+
|
|
391
|
+
```js
|
|
392
|
+
registerLayer( name : string, customTextureCallback : Function ) : void
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### .unregisterLayer
|
|
396
|
+
|
|
397
|
+
```js
|
|
398
|
+
unregisterLayer( name : string ) : void
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### .hasLayer
|
|
402
|
+
|
|
403
|
+
```js
|
|
404
|
+
hasLayer( name : string ) : boolean
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
## TileCompressionPlugin
|
|
408
|
+
|
|
409
|
+
Plugin that processes geometry buffer attributes into smaller data types on load and disables texture mipmaps to save memory. The default compression is fairly aggressive and may cause artifacts. Can reduce geometry memory footprint by more than half and texture memory by around a third.
|
|
410
|
+
|
|
411
|
+
### .constructor
|
|
412
|
+
|
|
413
|
+
```js
|
|
414
|
+
constructor( options : Object )
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Available options are as follows:
|
|
418
|
+
|
|
419
|
+
```js
|
|
420
|
+
{
|
|
421
|
+
// Whether to generate normals if they don't already exist.
|
|
422
|
+
generateNormals: false,
|
|
423
|
+
|
|
424
|
+
// Whether to disable use of mipmaps on all textures since they are typically
|
|
425
|
+
// not necessary.
|
|
426
|
+
disableMipmaps: true,
|
|
427
|
+
|
|
428
|
+
// Whether to compress and quantize attributes.
|
|
429
|
+
compressIndex: true,
|
|
430
|
+
compressNormals: true,
|
|
431
|
+
compressUvs: true,
|
|
432
|
+
compressPosition: false,
|
|
433
|
+
|
|
434
|
+
// The TypedArray type to use when compressing attributes.
|
|
435
|
+
uvType: Int8Array,
|
|
436
|
+
normalType: Int8Array,
|
|
437
|
+
positionType: Int16Array,
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## TilesFadePlugin
|
|
442
|
+
|
|
443
|
+
Plugin that overrides material shaders to fade tile geometry in and out as tile LODs change. Based on [this Cesium article](https://cesium.com/blog/2022/10/20/smoother-lod-transitions-in-cesium-for-unreal/) on the topic.
|
|
444
|
+
|
|
445
|
+
The plugin will dispatch `fade-change`, `fade-start`, and `fade-end` events per tile on the TilesRenderer when the animation updates. These events should be used in addition to any others required when performing on-demand rendering.
|
|
446
|
+
|
|
447
|
+
### .fadeDuration
|
|
448
|
+
|
|
449
|
+
```js
|
|
450
|
+
fadeDuration = 250 : number
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Amount of time a tile takes to fade in and out.
|
|
454
|
+
|
|
455
|
+
### .maximumFadeOutTiles
|
|
456
|
+
|
|
457
|
+
```js
|
|
458
|
+
maximumFadeOutTiles = 50 : number
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
Maximum number of tiles to be fading at once. If this quantity is exceeded the animation ends and tiles pop in.
|
|
462
|
+
|
|
463
|
+
### .fadeRootTiles
|
|
464
|
+
|
|
465
|
+
```js
|
|
466
|
+
fadeRootTiles = false : boolean
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
Whether to fade the root tile objects in.
|
|
470
|
+
|
|
471
|
+
## GLTFExtensionsPlugin
|
|
472
|
+
|
|
473
|
+
Plugin for automatically adding common extensions and loaders for 3d tiles to the GLTFLoader used for parsing tile geometry. Additionally, a DRACOLoader is added, as well, to support loading compressed point cloud files.
|
|
474
|
+
|
|
475
|
+
### .constructor
|
|
476
|
+
|
|
477
|
+
```js
|
|
478
|
+
constructor( options : Object )
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Available options are as follows:
|
|
482
|
+
|
|
483
|
+
```js
|
|
484
|
+
{
|
|
485
|
+
// If true then the StructuralMetadata and MeshFeatures extensions are included.
|
|
486
|
+
metadata: true,
|
|
487
|
+
|
|
488
|
+
// If true then the Cesium RTC Center extension is included.
|
|
489
|
+
rtc: true,
|
|
490
|
+
|
|
491
|
+
// A list of other extensions to include in the loader. All elements are passed to the "GLTFLoader.register" function.
|
|
492
|
+
plugins: [],
|
|
493
|
+
|
|
494
|
+
// DRACOLoader and KTX2Loader instances to add to the loader.
|
|
495
|
+
dracoLoader: null,
|
|
496
|
+
ktxLoader: null,
|
|
497
|
+
|
|
498
|
+
// Whether to automatically dispose of the DRACO and KTX Loaders when the plugin is disposed.
|
|
499
|
+
autoDispose: true,
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
## ReorientationPlugin
|
|
504
|
+
|
|
505
|
+
Plugin for automatically re-orienting and re-centering the tile set to make it visible near the origin and facing the right direction.
|
|
506
|
+
|
|
507
|
+
### .constructor
|
|
508
|
+
|
|
509
|
+
```js
|
|
510
|
+
constructor( options : Object )
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Available options are as follows:
|
|
514
|
+
|
|
515
|
+
```js
|
|
516
|
+
{
|
|
517
|
+
// The latitude, longitude, and height of the point on the surface to orient to. Lat and lon are in radians. If
|
|
518
|
+
// no coordinates are provided then the plugin tries to determine if the tile set is a tile set on the globe surface
|
|
519
|
+
// and estimates the coordinates.
|
|
520
|
+
lat: null,
|
|
521
|
+
lon: null,
|
|
522
|
+
height: 0,
|
|
523
|
+
|
|
524
|
+
// If a set of lat and lon coordinates cannot be determined then the tile set is simple oriented so the provided axes
|
|
525
|
+
// is oriented to three.js' +Y up direction. Valid values are positive or negative x, y, or z.
|
|
526
|
+
up: '+z',
|
|
527
|
+
|
|
528
|
+
// Whether or not to recenter the tile set.
|
|
529
|
+
recenter: true,
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### transformLatLonHeightToOrigin
|
|
534
|
+
|
|
535
|
+
```js
|
|
536
|
+
transformLatLonHeightToOrigin( lat, lon, height = 0 ) : void
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
Transforms the centers the tile set such that the given coordinates and height are positioned at the origin with "X" facing west and "Z" facing north.
|
|
540
|
+
|
|
541
|
+
## BatchedTilesPlugin
|
|
542
|
+
|
|
543
|
+
_available in the examples directory_
|
|
544
|
+
|
|
545
|
+
Plugin that uses three.js' BatchedMesh to limit the number of draw calls required and improve performance. The BatchedMesh geometry and instance size are automatically resized and optimized as new geometry is added and removed. The max number of instances to generate is limited by the max size of a 3d texture.
|
|
546
|
+
|
|
547
|
+
> [!WARNING]
|
|
548
|
+
> All tile geometry rendered with BatchedMesh will use the same material and only a single material "map" is supported. Only tiles geometry containing a single mesh are supported. Not compatible with other plugins that modify mesh materials or rely on other bespoke mesh data (eg TilesFadePlugin, DebugTilesPlugin, GLTF Metadata extensions).
|
|
549
|
+
|
|
550
|
+
### .constructor
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
```js
|
|
554
|
+
constructor( options : Object )
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
Available options are as follows:
|
|
558
|
+
|
|
559
|
+
```js
|
|
560
|
+
{
|
|
561
|
+
// WebGLRenderer used for generating a WebGLArrayRenderTarget
|
|
562
|
+
renderer,
|
|
563
|
+
|
|
564
|
+
// The initial number of instances to use for rendering
|
|
565
|
+
instanceCount: 500,
|
|
566
|
+
|
|
567
|
+
// The minimum amount of vertex and index space to save per tile geometry added. If adequate tile space is already allocated
|
|
568
|
+
// when a new tile geometry is added then it can prevent more expensive geometry resizing and optimization.
|
|
569
|
+
vertexCount: 1000,
|
|
570
|
+
indexCount: 1000,
|
|
571
|
+
|
|
572
|
+
// The amount to increase the geometry and instance allocation when the operations must occur
|
|
573
|
+
expandPercent: 0.25,
|
|
574
|
+
|
|
575
|
+
// The material to use for the BatchedMesh. The material of the first tile rendered with be used if not set.
|
|
576
|
+
material: null,
|
|
577
|
+
}
|
|
578
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { SUBTREELoader } from './SUBTREELoader.js';
|
|
2
|
+
|
|
3
|
+
export class ImplicitTilingPlugin {
|
|
4
|
+
|
|
5
|
+
constructor() {
|
|
6
|
+
|
|
7
|
+
this.name = 'IMPLICIT_TILING_PLUGIN';
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
init( tiles ) {
|
|
12
|
+
|
|
13
|
+
this.tiles = tiles;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
preprocessNode( tile, tileSetDir, parentTile ) {
|
|
18
|
+
|
|
19
|
+
if ( tile.implicitTiling ) {
|
|
20
|
+
|
|
21
|
+
tile.__hasUnrenderableContent = true;
|
|
22
|
+
tile.__hasRenderableContent = false;
|
|
23
|
+
|
|
24
|
+
// Declare some properties
|
|
25
|
+
tile.__subtreeIdx = 0; // Idx of the tile in its subtree
|
|
26
|
+
tile.__implicitRoot = tile; // Keep this tile as an Implicit Root Tile
|
|
27
|
+
|
|
28
|
+
// Coords of the tile
|
|
29
|
+
tile.__x = 0;
|
|
30
|
+
tile.__y = 0;
|
|
31
|
+
tile.__z = 0;
|
|
32
|
+
tile.__level = 0;
|
|
33
|
+
|
|
34
|
+
} else if ( /.subtree$/i.test( tile.content?.uri ) ) {
|
|
35
|
+
|
|
36
|
+
// Handling content uri pointing to a subtree file
|
|
37
|
+
tile.__hasUnrenderableContent = true;
|
|
38
|
+
tile.__hasRenderableContent = false;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
parseTile( buffer, parseTile, extension ) {
|
|
45
|
+
|
|
46
|
+
if ( /^subtree$/i.test( extension ) ) {
|
|
47
|
+
|
|
48
|
+
const loader = new SUBTREELoader( parseTile );
|
|
49
|
+
loader.parse( buffer );
|
|
50
|
+
return Promise.resolve();
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
preprocessURL( url, tile ) {
|
|
57
|
+
|
|
58
|
+
if ( tile && tile.implicitTiling ) {
|
|
59
|
+
|
|
60
|
+
const implicitUri = tile.implicitTiling.subtrees.uri
|
|
61
|
+
.replace( '{level}', tile.__level )
|
|
62
|
+
.replace( '{x}', tile.__x )
|
|
63
|
+
.replace( '{y}', tile.__y )
|
|
64
|
+
.replace( '{z}', tile.__z );
|
|
65
|
+
|
|
66
|
+
return new URL( implicitUri, tile.__basePath + '/' ).toString();
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return url;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
disposeTile( tile ) {
|
|
75
|
+
|
|
76
|
+
if ( /.subtree$/i.test( tile.content?.uri ) ) {
|
|
77
|
+
|
|
78
|
+
tile.children.length = 0;
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|