itowns 2.44.3-next.8 → 2.45.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.
- package/README.md +3 -129
- package/examples/3dtiles_loader.html +123 -48
- package/examples/config.json +3 -10
- package/examples/copc_simple_loader.html +15 -5
- package/examples/effects_stereo.html +2 -2
- package/examples/entwine_3d_loader.html +3 -1
- package/examples/entwine_simple_loader.html +1 -1
- package/examples/images/itowns_logo.svg +123 -0
- package/examples/js/plugins/COGParser.js +1 -1
- package/examples/jsm/OGC3DTilesHelper.js +6 -1
- package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
- package/examples/misc_collada.html +2 -2
- package/examples/source_file_geojson_3d.html +0 -1
- package/examples/source_file_kml_raster_usgs.html +0 -1
- package/examples/source_stream_wfs_raster.html +0 -7
- package/examples/vector_tile_mapbox_raster.html +91 -0
- package/examples/view_3d_map_webxr.html +3 -1
- package/examples/view_multi_25d.html +2 -2
- package/package.json +21 -75
- package/CODING.md +0 -120
- package/CONTRIBUTING.md +0 -150
- package/CONTRIBUTORS.md +0 -55
- package/LICENSE.md +0 -44
- package/changelog.md +0 -1361
- package/dist/455.js +0 -2
- package/dist/455.js.map +0 -1
- package/dist/debug.js +0 -3
- package/dist/debug.js.LICENSE.txt +0 -13
- package/dist/debug.js.map +0 -1
- package/dist/itowns.js +0 -3
- package/dist/itowns.js.LICENSE.txt +0 -7
- package/dist/itowns.js.map +0 -1
- package/dist/itowns_lasparser.js +0 -2
- package/dist/itowns_lasparser.js.map +0 -1
- package/dist/itowns_lasworker.js +0 -2
- package/dist/itowns_lasworker.js.map +0 -1
- package/dist/itowns_potree2worker.js +0 -2
- package/dist/itowns_potree2worker.js.map +0 -1
- package/dist/itowns_widgets.js +0 -2
- package/dist/itowns_widgets.js.map +0 -1
- package/examples/.eslintrc.cjs +0 -35
- package/examples/3dtiles_25d.html +0 -120
- package/examples/3dtiles_basic.html +0 -94
- package/examples/3dtiles_batch_table.html +0 -86
- package/examples/3dtiles_ion.html +0 -126
- package/examples/3dtiles_pointcloud.html +0 -95
- package/examples/jsm/.eslintrc.cjs +0 -38
- package/lib/Controls/FirstPersonControls.js +0 -308
- package/lib/Controls/FlyControls.js +0 -175
- package/lib/Controls/GlobeControls.js +0 -1162
- package/lib/Controls/PlanarControls.js +0 -1025
- package/lib/Controls/StateControl.js +0 -429
- package/lib/Controls/StreetControls.js +0 -392
- package/lib/Converter/Feature2Mesh.js +0 -615
- package/lib/Converter/Feature2Texture.js +0 -170
- package/lib/Converter/convertToTile.js +0 -75
- package/lib/Converter/textureConverter.js +0 -44
- package/lib/Core/3DTiles/C3DTBatchTable.js +0 -131
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +0 -96
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +0 -157
- package/lib/Core/3DTiles/C3DTExtensions.js +0 -97
- package/lib/Core/3DTiles/C3DTFeature.js +0 -110
- package/lib/Core/3DTiles/C3DTilesEnums.js +0 -20
- package/lib/Core/3DTiles/C3DTileset.js +0 -99
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +0 -100
- package/lib/Core/AnimationPlayer.js +0 -142
- package/lib/Core/CopcNode.js +0 -174
- package/lib/Core/Deprecated/Undeprecator.js +0 -75
- package/lib/Core/EntwinePointTileNode.js +0 -126
- package/lib/Core/Feature.js +0 -490
- package/lib/Core/Geographic/CoordStars.js +0 -80
- package/lib/Core/Geographic/Coordinates.js +0 -320
- package/lib/Core/Geographic/Crs.js +0 -175
- package/lib/Core/Geographic/Extent.js +0 -534
- package/lib/Core/Geographic/GeoidGrid.js +0 -109
- package/lib/Core/Label.js +0 -222
- package/lib/Core/MainLoop.js +0 -211
- package/lib/Core/Math/Ellipsoid.js +0 -144
- package/lib/Core/Picking.js +0 -255
- package/lib/Core/PointCloudNode.js +0 -42
- package/lib/Core/Potree2Node.js +0 -206
- package/lib/Core/Potree2PointAttributes.js +0 -139
- package/lib/Core/PotreeNode.js +0 -101
- package/lib/Core/Prefab/Globe/Atmosphere.js +0 -299
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
- package/lib/Core/Prefab/Globe/GlobeLayer.js +0 -145
- package/lib/Core/Prefab/Globe/SkyShader.js +0 -78
- package/lib/Core/Prefab/GlobeView.js +0 -161
- package/lib/Core/Prefab/Planar/PlanarLayer.js +0 -53
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +0 -72
- package/lib/Core/Prefab/PlanarView.js +0 -62
- package/lib/Core/Prefab/TileBuilder.js +0 -80
- package/lib/Core/Prefab/computeBufferTileGeometry.js +0 -183
- package/lib/Core/Scheduler/Cache.js +0 -256
- package/lib/Core/Scheduler/CancelledCommandException.js +0 -15
- package/lib/Core/Scheduler/Scheduler.js +0 -294
- package/lib/Core/Style.js +0 -1121
- package/lib/Core/System/Capabilities.js +0 -63
- package/lib/Core/Tile/Tile.js +0 -219
- package/lib/Core/Tile/TileGrid.js +0 -46
- package/lib/Core/TileGeometry.js +0 -40
- package/lib/Core/TileMesh.js +0 -109
- package/lib/Core/View.js +0 -1109
- package/lib/Layer/C3DTilesLayer.js +0 -455
- package/lib/Layer/ColorLayer.js +0 -128
- package/lib/Layer/CopcLayer.js +0 -58
- package/lib/Layer/ElevationLayer.js +0 -107
- package/lib/Layer/EntwinePointTileLayer.js +0 -64
- package/lib/Layer/FeatureGeometryLayer.js +0 -63
- package/lib/Layer/GeoidLayer.js +0 -80
- package/lib/Layer/GeometryLayer.js +0 -202
- package/lib/Layer/InfoLayer.js +0 -64
- package/lib/Layer/LabelLayer.js +0 -456
- package/lib/Layer/Layer.js +0 -304
- package/lib/Layer/LayerUpdateState.js +0 -89
- package/lib/Layer/LayerUpdateStrategy.js +0 -80
- package/lib/Layer/OGC3DTilesLayer.js +0 -387
- package/lib/Layer/OrientedImageLayer.js +0 -222
- package/lib/Layer/PointCloudLayer.js +0 -359
- package/lib/Layer/Potree2Layer.js +0 -164
- package/lib/Layer/PotreeLayer.js +0 -65
- package/lib/Layer/RasterLayer.js +0 -27
- package/lib/Layer/ReferencingLayerProperties.js +0 -62
- package/lib/Layer/TiledGeometryLayer.js +0 -403
- package/lib/Loader/LASLoader.js +0 -193
- package/lib/Loader/Potree2BrotliLoader.js +0 -261
- package/lib/Loader/Potree2Loader.js +0 -207
- package/lib/Main.js +0 -115
- package/lib/MainBundle.js +0 -4
- package/lib/Parser/B3dmParser.js +0 -174
- package/lib/Parser/CameraCalibrationParser.js +0 -94
- package/lib/Parser/GDFParser.js +0 -72
- package/lib/Parser/GTXParser.js +0 -75
- package/lib/Parser/GeoJsonParser.js +0 -212
- package/lib/Parser/GpxParser.js +0 -25
- package/lib/Parser/ISGParser.js +0 -71
- package/lib/Parser/KMLParser.js +0 -25
- package/lib/Parser/LASParser.js +0 -137
- package/lib/Parser/MapBoxUrlParser.js +0 -83
- package/lib/Parser/PntsParser.js +0 -131
- package/lib/Parser/Potree2BinParser.js +0 -92
- package/lib/Parser/PotreeBinParser.js +0 -106
- package/lib/Parser/PotreeCinParser.js +0 -29
- package/lib/Parser/ShapefileParser.js +0 -78
- package/lib/Parser/VectorTileParser.js +0 -202
- package/lib/Parser/XbilParser.js +0 -119
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +0 -1386
- package/lib/Parser/iGLTFLoader.js +0 -168
- package/lib/Process/3dTilesProcessing.js +0 -304
- package/lib/Process/FeatureProcessing.js +0 -76
- package/lib/Process/LayeredMaterialNodeProcessing.js +0 -221
- package/lib/Process/ObjectRemovalHelper.js +0 -97
- package/lib/Process/handlerNodeError.js +0 -23
- package/lib/Provider/3dTilesProvider.js +0 -149
- package/lib/Provider/DataSourceProvider.js +0 -8
- package/lib/Provider/Fetcher.js +0 -229
- package/lib/Provider/PointCloudProvider.js +0 -45
- package/lib/Provider/TileProvider.js +0 -16
- package/lib/Provider/URLBuilder.js +0 -116
- package/lib/Renderer/Camera.js +0 -281
- package/lib/Renderer/Color.js +0 -56
- package/lib/Renderer/ColorLayersOrdering.js +0 -115
- package/lib/Renderer/CommonMaterial.js +0 -31
- package/lib/Renderer/Label2DRenderer.js +0 -190
- package/lib/Renderer/LayeredMaterial.js +0 -243
- package/lib/Renderer/OBB.js +0 -153
- package/lib/Renderer/OrientedImageCamera.js +0 -118
- package/lib/Renderer/OrientedImageMaterial.js +0 -167
- package/lib/Renderer/PointsMaterial.js +0 -485
- package/lib/Renderer/RasterTile.js +0 -209
- package/lib/Renderer/RenderMode.js +0 -31
- package/lib/Renderer/Shader/ShaderChunk.js +0 -160
- package/lib/Renderer/Shader/ShaderUtils.js +0 -47
- package/lib/Renderer/SphereHelper.js +0 -23
- package/lib/Renderer/WebXR.js +0 -51
- package/lib/Renderer/c3DEngine.js +0 -214
- package/lib/Source/C3DTilesGoogleSource.js +0 -74
- package/lib/Source/C3DTilesIonSource.js +0 -54
- package/lib/Source/C3DTilesSource.js +0 -30
- package/lib/Source/CopcSource.js +0 -115
- package/lib/Source/EntwinePointTileSource.js +0 -62
- package/lib/Source/FileSource.js +0 -189
- package/lib/Source/OGC3DTilesGoogleSource.js +0 -29
- package/lib/Source/OGC3DTilesIonSource.js +0 -34
- package/lib/Source/OGC3DTilesSource.js +0 -21
- package/lib/Source/OrientedImageSource.js +0 -59
- package/lib/Source/Potree2Source.js +0 -167
- package/lib/Source/PotreeSource.js +0 -82
- package/lib/Source/Source.js +0 -223
- package/lib/Source/TMSSource.js +0 -145
- package/lib/Source/VectorTilesSource.js +0 -178
- package/lib/Source/WFSSource.js +0 -168
- package/lib/Source/WMSSource.js +0 -133
- package/lib/Source/WMTSSource.js +0 -86
- package/lib/ThreeExtended/capabilities/WebGL.js +0 -69
- package/lib/ThreeExtended/libs/ktx-parse.module.js +0 -470
- package/lib/ThreeExtended/libs/zstddec.module.js +0 -29
- package/lib/ThreeExtended/loaders/DDSLoader.js +0 -200
- package/lib/ThreeExtended/loaders/DRACOLoader.js +0 -399
- package/lib/ThreeExtended/loaders/GLTFLoader.js +0 -2876
- package/lib/ThreeExtended/loaders/KTX2Loader.js +0 -625
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +0 -846
- package/lib/ThreeExtended/utils/WorkerPool.js +0 -70
- package/lib/Utils/CameraUtils.js +0 -555
- package/lib/Utils/DEMUtils.js +0 -350
- package/lib/Utils/FeaturesUtils.js +0 -156
- package/lib/Utils/Gradients.js +0 -16
- package/lib/Utils/OrientationUtils.js +0 -457
- package/lib/Utils/ThreeUtils.js +0 -115
- package/lib/Utils/gui/C3DTilesStyle.js +0 -215
- package/lib/Utils/gui/Main.js +0 -7
- package/lib/Utils/gui/Minimap.js +0 -154
- package/lib/Utils/gui/Navigation.js +0 -245
- package/lib/Utils/gui/Scale.js +0 -107
- package/lib/Utils/gui/Searchbar.js +0 -234
- package/lib/Utils/gui/Widget.js +0 -80
- package/lib/Utils/placeObjectOnGround.js +0 -137
- package/lib/Worker/LASLoaderWorker.js +0 -19
- package/lib/Worker/Potree2Worker.js +0 -21
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { TilesRenderer, GLTFStructuralMetadataExtension, GLTFMeshFeaturesExtension, GLTFCesiumRTCExtension, CesiumIonAuthPlugin, GoogleCloudAuthPlugin, ImplicitTilingPlugin } from '3d-tiles-renderer';
|
|
3
|
-
import GeometryLayer from "./GeometryLayer.js";
|
|
4
|
-
import iGLTFLoader from "../Parser/iGLTFLoader.js";
|
|
5
|
-
import { DRACOLoader } from "../ThreeExtended/loaders/DRACOLoader.js";
|
|
6
|
-
import { KTX2Loader } from "../ThreeExtended/loaders/KTX2Loader.js";
|
|
7
|
-
import ReferLayerProperties from "./ReferencingLayerProperties.js";
|
|
8
|
-
import PointsMaterial, { PNTS_MODE, PNTS_SHAPE, PNTS_SIZE_MODE, ClassificationScheme } from "../Renderer/PointsMaterial.js";
|
|
9
|
-
const _raycaster = new THREE.Raycaster();
|
|
10
|
-
|
|
11
|
-
// Internal instance of GLTFLoader, passed to 3d-tiles-renderer-js to support GLTF 1.0 and 2.0
|
|
12
|
-
// Temporary exported to be used in deprecated B3dmParser
|
|
13
|
-
export const itownsGLTFLoader = new iGLTFLoader();
|
|
14
|
-
itownsGLTFLoader.register(() => new GLTFMeshFeaturesExtension());
|
|
15
|
-
itownsGLTFLoader.register(() => new GLTFStructuralMetadataExtension());
|
|
16
|
-
itownsGLTFLoader.register(() => new GLTFCesiumRTCExtension());
|
|
17
|
-
|
|
18
|
-
// Instantiated by the first tileset. Used to share cache and download and parse queues between tilesets
|
|
19
|
-
let lruCache = null;
|
|
20
|
-
let downloadQueue = null;
|
|
21
|
-
let parseQueue = null;
|
|
22
|
-
export const OGC3DTILES_LAYER_EVENTS = {
|
|
23
|
-
/**
|
|
24
|
-
* Fired when a new root or child tile set is loaded
|
|
25
|
-
* @event OGC3DTilesLayer#load-tile-set
|
|
26
|
-
* @type {Object}
|
|
27
|
-
* @property {Object} tileset - the tileset json parsed in an Object
|
|
28
|
-
* @property {String} url - tileset url
|
|
29
|
-
*/
|
|
30
|
-
LOAD_TILE_SET: 'load-tile-set',
|
|
31
|
-
/**
|
|
32
|
-
* Fired when a tile model is loaded
|
|
33
|
-
* @event OGC3DTilesLayer#load-model
|
|
34
|
-
* @type {Object}
|
|
35
|
-
* @property {THREE.Group} scene - the model (tile content) parsed in a THREE.GROUP
|
|
36
|
-
* @property {Object} tile - the tile metadata from the tileset
|
|
37
|
-
*/
|
|
38
|
-
LOAD_MODEL: 'load-model',
|
|
39
|
-
/**
|
|
40
|
-
* Fired when a tile model is disposed
|
|
41
|
-
* @event OGC3DTilesLayer#dispose-model
|
|
42
|
-
* @type {Object}
|
|
43
|
-
* @property {THREE.Group} scene - the model (tile content) that is disposed
|
|
44
|
-
* @property {Object} tile - the tile metadata from the tileset
|
|
45
|
-
*/
|
|
46
|
-
DISPOSE_MODEL: 'dispose-model',
|
|
47
|
-
/**
|
|
48
|
-
* Fired when a tiles visibility changes
|
|
49
|
-
* @event OGC3DTilesLayer#tile-visibility-change
|
|
50
|
-
* @type {Object}
|
|
51
|
-
* @property {THREE.Group} scene - the model (tile content) parsed in a THREE.GROUP
|
|
52
|
-
* @property {Object} tile - the tile metadata from the tileset
|
|
53
|
-
* @property {boolean} visible - the tile visible state
|
|
54
|
-
*/
|
|
55
|
-
TILE_VISIBILITY_CHANGE: 'tile-visibility-change'
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Enable loading 3D Tiles with [Draco](https://google.github.io/draco/) geometry extension.
|
|
60
|
-
*
|
|
61
|
-
* @param {String} path path to draco library folder containing the JS and WASM decoder libraries. They can be found in
|
|
62
|
-
* [itowns examples](https://github.com/iTowns/itowns/tree/master/examples/libs/draco).
|
|
63
|
-
* @param {Object} [config] optional configuration for Draco decoder (see threejs'
|
|
64
|
-
* [setDecoderConfig](https://threejs.org/docs/index.html?q=draco#examples/en/loaders/DRACOLoader.setDecoderConfig) that
|
|
65
|
-
* is called under the hood with this configuration for details.
|
|
66
|
-
*/
|
|
67
|
-
export function enableDracoLoader(path, config) {
|
|
68
|
-
if (!path) {
|
|
69
|
-
throw new Error('Path to draco folder is mandatory');
|
|
70
|
-
}
|
|
71
|
-
const dracoLoader = new DRACOLoader();
|
|
72
|
-
dracoLoader.setDecoderPath(path);
|
|
73
|
-
if (config) {
|
|
74
|
-
dracoLoader.setDecoderConfig(config);
|
|
75
|
-
}
|
|
76
|
-
itownsGLTFLoader.setDRACOLoader(dracoLoader);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Enable loading 3D Tiles with [KTX2](https://www.khronos.org/ktx/) texture extension.
|
|
81
|
-
*
|
|
82
|
-
* @param {String} path path to ktx2 library folder containing the JS and WASM decoder libraries. They can be found in
|
|
83
|
-
* [itowns examples](https://github.com/iTowns/itowns/tree/master/examples/libs/basis).
|
|
84
|
-
* @param {THREE.WebGLRenderer} renderer the threejs renderer
|
|
85
|
-
*/
|
|
86
|
-
export function enableKtx2Loader(path, renderer) {
|
|
87
|
-
if (!path || !renderer) {
|
|
88
|
-
throw new Error('Path to ktx2 folder and renderer are mandatory');
|
|
89
|
-
}
|
|
90
|
-
const ktx2Loader = new KTX2Loader();
|
|
91
|
-
ktx2Loader.setTranscoderPath(path);
|
|
92
|
-
ktx2Loader.detectSupport(renderer);
|
|
93
|
-
itownsGLTFLoader.setKTX2Loader(ktx2Loader);
|
|
94
|
-
}
|
|
95
|
-
class OGC3DTilesLayer extends GeometryLayer {
|
|
96
|
-
/**
|
|
97
|
-
* Layer for [3D Tiles](https://www.ogc.org/standard/3dtiles/) datasets.
|
|
98
|
-
* @extends Layer
|
|
99
|
-
*
|
|
100
|
-
* @param {String} id - unique layer id.
|
|
101
|
-
* @param {Object} config - layer specific configuration
|
|
102
|
-
* @param {OGC3DTilesSource} config.source - data source configuration
|
|
103
|
-
* @param {String} [config.pntsMode= PNTS_MODE.COLOR] Point cloud coloring mode (passed to {@link PointsMaterial}).
|
|
104
|
-
* Only 'COLOR' or 'CLASSIFICATION' are possible. COLOR uses RGB colors of the points,
|
|
105
|
-
* CLASSIFICATION uses a classification property of the batch table to color points.
|
|
106
|
-
* @param {ClassificationScheme} [config.classificationScheme] {@link PointsMaterial} classification scheme
|
|
107
|
-
* @param {String} [config.pntsShape= PNTS_SHAPE.CIRCLE] Point cloud point shape. Only 'CIRCLE' or 'SQUARE' are possible.
|
|
108
|
-
* (passed to {@link PointsMaterial}).
|
|
109
|
-
* @param {String} [config.pntsSizeMode= PNTS_SIZE_MODE.VALUE] {@link PointsMaterial} Point cloud size mode (passed to {@link PointsMaterial}).
|
|
110
|
-
* Only 'VALUE' or 'ATTENUATED' are possible. VALUE use constant size, ATTENUATED compute size depending on distance
|
|
111
|
-
* from point to camera.
|
|
112
|
-
* @param {Number} [config.pntsMinAttenuatedSize=1] Minimum scale used by 'ATTENUATED' size mode.
|
|
113
|
-
* @param {Number} [config.pntsMaxAttenuatedSize=7] Maximum scale used by 'ATTENUATED' size mode.
|
|
114
|
-
*/
|
|
115
|
-
constructor(id, config) {
|
|
116
|
-
super(id, new THREE.Group(), {
|
|
117
|
-
source: config.source
|
|
118
|
-
});
|
|
119
|
-
this.isOGC3DTilesLayer = true;
|
|
120
|
-
this._handlePointsMaterialConfig(config);
|
|
121
|
-
this.tilesRenderer = new TilesRenderer(this.source.url);
|
|
122
|
-
if (config.source.isOGC3DTilesIonSource) {
|
|
123
|
-
this.tilesRenderer.registerPlugin(new CesiumIonAuthPlugin({
|
|
124
|
-
apiToken: config.source.accessToken,
|
|
125
|
-
assetId: config.source.assetId,
|
|
126
|
-
autoRefreshToken: true
|
|
127
|
-
}));
|
|
128
|
-
} else if (config.source.isOGC3DTilesGoogleSource) {
|
|
129
|
-
this.tilesRenderer.registerPlugin(new GoogleCloudAuthPlugin({
|
|
130
|
-
apiToken: config.source.key,
|
|
131
|
-
autoRefreshToken: true
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
this.tilesRenderer.registerPlugin(new ImplicitTilingPlugin());
|
|
135
|
-
this.tilesRenderer.manager.addHandler(/\.gltf$/, itownsGLTFLoader);
|
|
136
|
-
this._setupCacheAndQueues();
|
|
137
|
-
this._setupEvents();
|
|
138
|
-
this.object3d.add(this.tilesRenderer.group);
|
|
139
|
-
|
|
140
|
-
// Add an initialization step that is resolved when the root tileset is loaded (see this._setup below), meaning
|
|
141
|
-
// that the layer will be marked ready when the tileset has been loaded.
|
|
142
|
-
this._res = this.addInitializationStep();
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @type {number}
|
|
146
|
-
*/
|
|
147
|
-
this.sseThreshold = this.tilesRenderer.errorTarget;
|
|
148
|
-
Object.defineProperty(this, 'sseThreshold', {
|
|
149
|
-
get() {
|
|
150
|
-
return this.tilesRenderer.errorTarget;
|
|
151
|
-
},
|
|
152
|
-
set(value) {
|
|
153
|
-
this.tilesRenderer.errorTarget = value;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
if (config.sseThreshold) {
|
|
157
|
-
this.sseThreshold = config.sseThreshold;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Store points material config so they can be used later to substitute points tiles material by our own PointsMaterial
|
|
163
|
-
* These properties should eventually be managed through the Style API (see https://github.com/iTowns/itowns/issues/2336)
|
|
164
|
-
* @param {Object} config - points material configuration as passed to the layer constructor.
|
|
165
|
-
* @private
|
|
166
|
-
*/
|
|
167
|
-
_handlePointsMaterialConfig(config) {
|
|
168
|
-
this.pntsMode = config.pntsMode ?? PNTS_MODE.COLOR;
|
|
169
|
-
this.pntsShape = config.pntsShape ?? PNTS_SHAPE.CIRCLE;
|
|
170
|
-
this.classification = config.classification ?? ClassificationScheme.DEFAULT;
|
|
171
|
-
this.pntsSizeMode = config.pntsSizeMode ?? PNTS_SIZE_MODE.VALUE;
|
|
172
|
-
this.pntsMinAttenuatedSize = config.pntsMinAttenuatedSize || 1;
|
|
173
|
-
this.pntsMaxAttenuatedSize = config.pntsMaxAttenuatedSize || 7;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Sets the lruCache and download and parse queues so they are shared amongst all tilesets.
|
|
178
|
-
* @private
|
|
179
|
-
*/
|
|
180
|
-
_setupCacheAndQueues() {
|
|
181
|
-
if (lruCache === null) {
|
|
182
|
-
lruCache = this.tilesRenderer.lruCache;
|
|
183
|
-
} else {
|
|
184
|
-
this.tilesRenderer.lruCache = lruCache;
|
|
185
|
-
}
|
|
186
|
-
if (downloadQueue === null) {
|
|
187
|
-
downloadQueue = this.tilesRenderer.downloadQueue;
|
|
188
|
-
} else {
|
|
189
|
-
this.tilesRenderer.downloadQueue = downloadQueue;
|
|
190
|
-
}
|
|
191
|
-
if (parseQueue === null) {
|
|
192
|
-
parseQueue = this.tilesRenderer.parseQueue;
|
|
193
|
-
} else {
|
|
194
|
-
this.tilesRenderer.parseQueue = parseQueue;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Binds 3d-tiles-renderer events to this layer.
|
|
200
|
-
* @private
|
|
201
|
-
*/
|
|
202
|
-
_setupEvents() {
|
|
203
|
-
for (const ev of Object.values(OGC3DTILES_LAYER_EVENTS)) {
|
|
204
|
-
this.tilesRenderer.addEventListener(ev, e => {
|
|
205
|
-
this.dispatchEvent(e);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Setup 3D tiles renderer js TilesRenderer with the camera, binds events and start updating. Executed when the
|
|
212
|
-
* layer has been added to the view.
|
|
213
|
-
* @param {View} view - the view the layer has been added to.
|
|
214
|
-
* @private
|
|
215
|
-
*/
|
|
216
|
-
_setup(view) {
|
|
217
|
-
this.tilesRenderer.setCamera(view.camera3D);
|
|
218
|
-
this.tilesRenderer.setResolutionFromRenderer(view.camera3D, view.renderer);
|
|
219
|
-
// Setup whenReady to be fullfiled when the root tileset has been loaded
|
|
220
|
-
let rootTilesetLoaded = false;
|
|
221
|
-
this.tilesRenderer.addEventListener('load-tile-set', () => {
|
|
222
|
-
view.notifyChange(this);
|
|
223
|
-
if (!rootTilesetLoaded) {
|
|
224
|
-
rootTilesetLoaded = true;
|
|
225
|
-
this._res();
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
this.tilesRenderer.addEventListener('load-model', _ref => {
|
|
229
|
-
let {
|
|
230
|
-
scene
|
|
231
|
-
} = _ref;
|
|
232
|
-
scene.traverse(obj => {
|
|
233
|
-
this._assignFinalMaterial(obj);
|
|
234
|
-
this._assignFinalAttributes(obj);
|
|
235
|
-
});
|
|
236
|
-
view.notifyChange(this);
|
|
237
|
-
});
|
|
238
|
-
// Start loading tileset and tiles
|
|
239
|
-
this.tilesRenderer.update();
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Replace materials from GLTFLoader by our own custom materials. Note that
|
|
244
|
-
* the replaced materials are not compiled yet and will be disposed by the
|
|
245
|
-
* GC.
|
|
246
|
-
* @param {Object3D} model
|
|
247
|
-
* @private
|
|
248
|
-
*/
|
|
249
|
-
_assignFinalMaterial(model) {
|
|
250
|
-
let material = model.material;
|
|
251
|
-
if (model.isPoints) {
|
|
252
|
-
const pointsMaterial = new PointsMaterial({
|
|
253
|
-
mode: this.pntsMode,
|
|
254
|
-
shape: this.pntsShape,
|
|
255
|
-
classificationScheme: this.classification,
|
|
256
|
-
sizeMode: this.pntsSizeMode,
|
|
257
|
-
minAttenuatedSize: this.pntsMinAttenuatedSize,
|
|
258
|
-
maxAttenuatedSize: this.pntsMaxAttenuatedSize
|
|
259
|
-
});
|
|
260
|
-
pointsMaterial.copy(material);
|
|
261
|
-
material = pointsMaterial;
|
|
262
|
-
}
|
|
263
|
-
if (material) {
|
|
264
|
-
ReferLayerProperties(material, this);
|
|
265
|
-
}
|
|
266
|
-
model.material = material;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* @param {Object3D} model
|
|
271
|
-
* @private
|
|
272
|
-
*/
|
|
273
|
-
_assignFinalAttributes(model) {
|
|
274
|
-
const geometry = model.geometry;
|
|
275
|
-
const batchTable = model.batchTable;
|
|
276
|
-
|
|
277
|
-
// Setup classification bufferAttribute
|
|
278
|
-
if (model.isPoints) {
|
|
279
|
-
const classificationData = batchTable?.getPropertyArray('Classification');
|
|
280
|
-
if (classificationData) {
|
|
281
|
-
geometry.setAttribute('classification', new THREE.BufferAttribute(classificationData, 1));
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
preUpdate(context) {
|
|
286
|
-
this.scale = context.camera._preSSE;
|
|
287
|
-
this.tilesRenderer.update();
|
|
288
|
-
return null; // don't return any element because 3d-tiles-renderer already updates them
|
|
289
|
-
}
|
|
290
|
-
update() {
|
|
291
|
-
// empty, elements are updated by 3d-tiles-renderer
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Deletes the layer and frees associated memory
|
|
296
|
-
*/
|
|
297
|
-
delete() {
|
|
298
|
-
this.tilesRenderer.dispose();
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Get the attributes for the closest intersection from a list of
|
|
303
|
-
* intersects.
|
|
304
|
-
* @param {Array} intersects - An array containing all
|
|
305
|
-
* objects picked under mouse coordinates computed with view.pickObjectsAt(..).
|
|
306
|
-
* @returns {Object | null} - An object containing
|
|
307
|
-
*/
|
|
308
|
-
getC3DTileFeatureFromIntersectsArray(intersects) {
|
|
309
|
-
if (!intersects.length) {
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
const {
|
|
313
|
-
face,
|
|
314
|
-
index,
|
|
315
|
-
object
|
|
316
|
-
} = intersects[0];
|
|
317
|
-
|
|
318
|
-
/** @type{number|null} */
|
|
319
|
-
let batchId;
|
|
320
|
-
if (object.isPoints && index) {
|
|
321
|
-
batchId = object.geometry.getAttribute('_BATCHID')?.getX(index) ?? index;
|
|
322
|
-
} else if (object.isMesh && face) {
|
|
323
|
-
batchId = object.geometry.getAttribute('_BATCHID')?.getX(face.a);
|
|
324
|
-
}
|
|
325
|
-
if (batchId === undefined) {
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
let tileObject = object;
|
|
329
|
-
while (!tileObject.batchTable) {
|
|
330
|
-
tileObject = tileObject.parent;
|
|
331
|
-
}
|
|
332
|
-
return tileObject.batchTable.getDataFromId(batchId);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Get all 3D objects (mesh and points primitives) as intersects at the
|
|
337
|
-
* given non-normalized screen coordinates.
|
|
338
|
-
* @param {View} view - The view instance.
|
|
339
|
-
* @param {THREE.Vector2} coords - The coordinates to pick in the view. It
|
|
340
|
-
* should have at least `x` and `y` properties.
|
|
341
|
-
* @param {number} radius - Radius of the picking circle.
|
|
342
|
-
* @param {Array} [target=[]] - Target array to push results too
|
|
343
|
-
* @returns {Array} Array containing all target objects picked under the
|
|
344
|
-
* specified coordinates.
|
|
345
|
-
*/
|
|
346
|
-
pickObjectsAt(view, coords) {
|
|
347
|
-
let target = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
348
|
-
const camera = view.camera.camera3D;
|
|
349
|
-
_raycaster.setFromCamera(view.viewToNormalizedCoords(coords), camera);
|
|
350
|
-
_raycaster.near = camera.near;
|
|
351
|
-
_raycaster.far = camera.far;
|
|
352
|
-
_raycaster.firstHitOnly = true;
|
|
353
|
-
_raycaster.intersectObject(this.tilesRenderer.group, true, target);
|
|
354
|
-
return target;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// eslint-disable-next-line no-unused-vars
|
|
358
|
-
attach() {
|
|
359
|
-
console.warn('[OGC3DTilesLayer]: Attaching / detaching layers is not yet implemented for OGC3DTilesLayer.');
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// eslint-disable-next-line no-unused-vars
|
|
363
|
-
detach() {
|
|
364
|
-
console.warn('[OGC3DTilesLayer]: Attaching / detaching layers is not yet implemented for OGC3DTilesLayer.');
|
|
365
|
-
return true;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// eslint-disable-next-line no-unused-vars
|
|
369
|
-
getObjectToUpdateForAttachedLayers() {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Executes a callback for each tile of this layer tileset.
|
|
375
|
-
*
|
|
376
|
-
* @param {Function} callback The callback to execute for each tile. Has the following two parameters:
|
|
377
|
-
* 1. tile (Object) - the JSON tile
|
|
378
|
-
* 2. scene (THREE.Object3D | null) - The tile content. Contains a `batchTable` property. Can be null if the tile
|
|
379
|
-
* has not yet been loaded.
|
|
380
|
-
*/
|
|
381
|
-
forEachTile(callback) {
|
|
382
|
-
this.tilesRenderer.traverse(tile => {
|
|
383
|
-
callback(tile, tile.cached.scene);
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
export default OGC3DTilesLayer;
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import GeometryLayer from "./GeometryLayer.js";
|
|
3
|
-
import OrientedImageMaterial from "../Renderer/OrientedImageMaterial.js";
|
|
4
|
-
import GeoJsonParser from "../Parser/GeoJsonParser.js";
|
|
5
|
-
import CameraCalibrationParser from "../Parser/CameraCalibrationParser.js";
|
|
6
|
-
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
7
|
-
import OrientationUtils from "../Utils/OrientationUtils.js";
|
|
8
|
-
const coord = new Coordinates('EPSG:4978', 0, 0, 0);
|
|
9
|
-
const commandCancellation = cmd => cmd.requester.id !== cmd.layer.currentPano.id;
|
|
10
|
-
function updatePano(context, camera, layer) {
|
|
11
|
-
const newPano = layer.mostNearPano(camera.position);
|
|
12
|
-
// detection of oriented image change
|
|
13
|
-
const currentId = layer.currentPano ? layer.currentPano.id : undefined;
|
|
14
|
-
if (newPano && currentId != newPano.id) {
|
|
15
|
-
layer.currentPano = newPano;
|
|
16
|
-
|
|
17
|
-
// callback to indicate current pano has changed
|
|
18
|
-
layer.onPanoChanged({
|
|
19
|
-
previousPanoPosition: layer.getPreviousPano() ? layer.getPreviousPano().position : undefined,
|
|
20
|
-
currentPanoPosition: layer.getCurrentPano().position,
|
|
21
|
-
nextPanoPosition: layer.getNextPano().position
|
|
22
|
-
});
|
|
23
|
-
// prepare informations about the needed textures
|
|
24
|
-
const panoCameras = newPano.geometries[0].properties.idSensors;
|
|
25
|
-
const imagesInfo = layer.cameras.map(cam => ({
|
|
26
|
-
cameraId: cam.name,
|
|
27
|
-
panoId: newPano.id,
|
|
28
|
-
as: () => {}
|
|
29
|
-
})).filter(info => !panoCameras || panoCameras.includes(info.cameraId));
|
|
30
|
-
const command = {
|
|
31
|
-
layer,
|
|
32
|
-
// put informations about image URL as extent to be used by generic DataSourceProvider, OrientedImageSource will use that.
|
|
33
|
-
extentsSource: imagesInfo,
|
|
34
|
-
view: context.view,
|
|
35
|
-
requester: newPano,
|
|
36
|
-
earlyDropFunction: commandCancellation
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// async call to scheduler to get textures
|
|
40
|
-
context.scheduler.execute(command).then(textures => {
|
|
41
|
-
if (newPano.id === layer.currentPano.id) {
|
|
42
|
-
layer.material.setTextures(textures, newPano, layer.getCamerasNameFromFeature(newPano));
|
|
43
|
-
layer.material.updateUniforms(context.camera.camera3D);
|
|
44
|
-
context.view.notifyChange(layer, true);
|
|
45
|
-
}
|
|
46
|
-
}, () => {});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function updateBackground(layer) {
|
|
50
|
-
if (layer.background && layer.currentPano) {
|
|
51
|
-
layer.background.position.copy(layer.currentPano.position);
|
|
52
|
-
layer.background.updateMatrixWorld();
|
|
53
|
-
layer.background.material = layer.material || layer.background.material;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function createBackground(radius) {
|
|
57
|
-
if (!radius || radius <= 0) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
const geometry = new THREE.SphereGeometry(radius, 32, 32);
|
|
61
|
-
const material = new THREE.MeshPhongMaterial({
|
|
62
|
-
color: 0x7777ff,
|
|
63
|
-
side: THREE.DoubleSide,
|
|
64
|
-
transparent: true,
|
|
65
|
-
opacity: 0.5,
|
|
66
|
-
wireframe: true
|
|
67
|
-
});
|
|
68
|
-
const sphere = new THREE.Mesh(geometry, material);
|
|
69
|
-
sphere.visible = true;
|
|
70
|
-
sphere.name = 'OrientedImageBackground';
|
|
71
|
-
return sphere;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* OrientedImageLayer loads oriented images, and project these textures on the scene.
|
|
76
|
-
* It is design to create an immersive view. </br>
|
|
77
|
-
* It loads a set of panoramic position and orientation,
|
|
78
|
-
* a set of camera calibration file (it's the same set of camera for each panoramic),
|
|
79
|
-
* and a set of texture (each image for each camera for each panoramic), all organised in an {@link OrientedImageSource}. </br>
|
|
80
|
-
* It creates an {@link OrientedImageMaterial} used to do projective texture mapping on the scene.
|
|
81
|
-
* @extends GeometryLayer
|
|
82
|
-
*/
|
|
83
|
-
class OrientedImageLayer extends GeometryLayer {
|
|
84
|
-
/**
|
|
85
|
-
* @param { string } id - The id of the layer, a unique name.
|
|
86
|
-
* @param { Object } config - configuration of the layer
|
|
87
|
-
* @param { number } config.backgroundDistance - Radius in meter of the sphere used as a background
|
|
88
|
-
* @param { function } config.onPanoChanged - callback fired when current panoramic changes
|
|
89
|
-
* @param { string } config.crs - crs projection of the view
|
|
90
|
-
* @param { string } config.orientation - Json object, using GeoJSon format to represent points,
|
|
91
|
-
* it's a set of panoramic position and orientation.
|
|
92
|
-
* @param { string } config.calibrations - Json object, representing a set of camera.
|
|
93
|
-
* see {@link CameraCalibrationParser}
|
|
94
|
-
* @param { OrientedImageSource } config.source - Source used to build url of texture for each oriented image,
|
|
95
|
-
* a tecture is need for each camera, for each panoramic.
|
|
96
|
-
*/
|
|
97
|
-
constructor(id) {
|
|
98
|
-
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
99
|
-
/* istanbul ignore next */
|
|
100
|
-
if (config.projection) {
|
|
101
|
-
console.warn('OrientedImageLayer projection parameter is deprecated, use crs instead.');
|
|
102
|
-
config.crs = config.crs || config.projection;
|
|
103
|
-
}
|
|
104
|
-
super(id, new THREE.Group(), config);
|
|
105
|
-
this.isOrientedImageLayer = true;
|
|
106
|
-
this.background = config.background || createBackground(config.backgroundDistance);
|
|
107
|
-
if (this.background) {
|
|
108
|
-
// Add layer id to easily identify the objects later on (e.g. to delete the geometries when deleting the layer)
|
|
109
|
-
this.background.layer = this.background.layer ?? {};
|
|
110
|
-
this.background.layer.id = this.background.layer.id ?? id;
|
|
111
|
-
this.object3d.add(this.background);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// currentPano is the current point, means it's the closest from the camera
|
|
115
|
-
this.currentPano = undefined;
|
|
116
|
-
|
|
117
|
-
// store a callback to fire event when current panoramic change
|
|
118
|
-
this.onPanoChanged = config.onPanoChanged || (() => {});
|
|
119
|
-
|
|
120
|
-
// function to get cameras name from panoramic feature
|
|
121
|
-
this.getCamerasNameFromFeature = config.getCamerasNameFromFeature || (() => {});
|
|
122
|
-
const resolve = this.addInitializationStep();
|
|
123
|
-
this.mergeFeatures = false;
|
|
124
|
-
this.filteringExtent = false;
|
|
125
|
-
this.accurate = true;
|
|
126
|
-
const options = {
|
|
127
|
-
out: this
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// panos is an array of feature point, representing many panoramics.
|
|
131
|
-
// for each point, there is a position and a quaternion attribute.
|
|
132
|
-
this.source.whenReady.then(metadata => GeoJsonParser.parse(config.orientation || metadata.orientation, options).then(orientation => {
|
|
133
|
-
this.panos = orientation.features;
|
|
134
|
-
|
|
135
|
-
// the crs input is parsed in geojson parser
|
|
136
|
-
// and returned in options.in
|
|
137
|
-
const crsIn = options.in.crs;
|
|
138
|
-
const crsOut = config.crs;
|
|
139
|
-
const crs2crs = OrientationUtils.quaternionFromCRSToCRS(crsIn, crsOut);
|
|
140
|
-
const quat = new THREE.Quaternion();
|
|
141
|
-
|
|
142
|
-
// add position and quaternion attributes from point feature
|
|
143
|
-
let i = 0;
|
|
144
|
-
for (const pano of this.panos) {
|
|
145
|
-
// set position
|
|
146
|
-
coord.crs = pano.crs;
|
|
147
|
-
coord.setFromArray(pano.vertices).applyMatrix4(orientation.matrix);
|
|
148
|
-
pano.position = coord.toVector3();
|
|
149
|
-
|
|
150
|
-
// set quaternion
|
|
151
|
-
crs2crs(coord, quat);
|
|
152
|
-
pano.quaternion = OrientationUtils.quaternionFromAttitude(pano.geometries[0].properties).premultiply(quat);
|
|
153
|
-
pano.id = pano.geometries[0].properties.id;
|
|
154
|
-
pano.index = i++;
|
|
155
|
-
}
|
|
156
|
-
}).then(() => {
|
|
157
|
-
// array of cameras, represent the projective texture configuration for each panoramic.
|
|
158
|
-
CameraCalibrationParser.parse(config.calibration || metadata.calibration, config).then(cameras => {
|
|
159
|
-
this.cameras = cameras;
|
|
160
|
-
// create the material
|
|
161
|
-
this.material = new OrientedImageMaterial(this.cameras, config);
|
|
162
|
-
resolve();
|
|
163
|
-
});
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// eslint-disable-next-line
|
|
168
|
-
update() {}
|
|
169
|
-
set boostLight(value) {
|
|
170
|
-
this.material.uniforms.boostLight.value = value;
|
|
171
|
-
}
|
|
172
|
-
get boostLight() {
|
|
173
|
-
return this.material.uniforms.boostLight.value;
|
|
174
|
-
}
|
|
175
|
-
preUpdate(context) {
|
|
176
|
-
updatePano(context, context.camera.camera3D, this);
|
|
177
|
-
this.material.updateUniforms(context.camera.camera3D);
|
|
178
|
-
updateBackground(this);
|
|
179
|
-
}
|
|
180
|
-
getNextPano() {
|
|
181
|
-
const index = (this.currentPano.index + 1) % this.panos.length;
|
|
182
|
-
return this.panos[index];
|
|
183
|
-
}
|
|
184
|
-
getCurrentPano() {
|
|
185
|
-
return this.currentPano;
|
|
186
|
-
}
|
|
187
|
-
getPreviousPano() {
|
|
188
|
-
const index = (this.currentPano.index - 1) % this.panos.length;
|
|
189
|
-
return this.panos[index];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Delete background, but doesn't delete OrientedImageLayer.material. For the moment, this material visibility is set to false.
|
|
194
|
-
* You need to replace OrientedImageLayer.material applied on each object, if you want to continue displaying them.
|
|
195
|
-
* This issue (see #1018 {@link https://github.com/iTowns/itowns/issues/1018}) will be fixed when OrientedImageLayer will be a ColorLayer.
|
|
196
|
-
* @param {boolean} [clearCache=false] Whether to clear the layer cache or not
|
|
197
|
-
*/
|
|
198
|
-
delete(clearCache) {
|
|
199
|
-
if (this.background) {
|
|
200
|
-
// only delete geometries if it has some
|
|
201
|
-
super.delete();
|
|
202
|
-
}
|
|
203
|
-
if (clearCache) {
|
|
204
|
-
this.cache.clear();
|
|
205
|
-
}
|
|
206
|
-
this.material.visible = false;
|
|
207
|
-
console.warn('You need to replace OrientedImageLayer.material applied on each object. This issue will be fixed when OrientedImageLayer will be a ColorLayer. the material visibility is set to false. To follow issue see https://github.com/iTowns/itowns/issues/1018');
|
|
208
|
-
}
|
|
209
|
-
mostNearPano(position) {
|
|
210
|
-
let minDistance = Infinity;
|
|
211
|
-
let nearPano;
|
|
212
|
-
for (const pano of this.panos) {
|
|
213
|
-
const distance = position.distanceTo(pano.position);
|
|
214
|
-
if (distance < minDistance) {
|
|
215
|
-
minDistance = distance;
|
|
216
|
-
nearPano = pano;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return nearPano;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
export default OrientedImageLayer;
|