itowns 2.45.1-next.0 → 2.45.1-next.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/dist/455.js +2 -0
- package/dist/455.js.map +1 -0
- package/dist/debug.js +3 -0
- package/dist/debug.js.LICENSE.txt +13 -0
- package/dist/debug.js.map +1 -0
- package/dist/itowns.js +3 -0
- package/dist/itowns.js.LICENSE.txt +5 -0
- package/dist/itowns.js.map +1 -0
- package/dist/itowns_lasparser.js +2 -0
- package/dist/itowns_lasparser.js.map +1 -0
- package/dist/itowns_lasworker.js +2 -0
- package/dist/itowns_lasworker.js.map +1 -0
- package/dist/itowns_potree2worker.js +2 -0
- package/dist/itowns_potree2worker.js.map +1 -0
- package/dist/itowns_widgets.js +2 -0
- package/dist/itowns_widgets.js.map +1 -0
- package/lib/Controls/FirstPersonControls.js +308 -0
- package/lib/Controls/FlyControls.js +175 -0
- package/lib/Controls/GlobeControls.js +1178 -0
- package/lib/Controls/PlanarControls.js +1025 -0
- package/lib/Controls/StateControl.js +432 -0
- package/lib/Controls/StreetControls.js +392 -0
- package/lib/Converter/Feature2Mesh.js +612 -0
- package/lib/Converter/Feature2Texture.js +174 -0
- package/lib/Converter/convertToTile.js +70 -0
- package/lib/Converter/textureConverter.js +43 -0
- package/lib/Core/3DTiles/C3DTBatchTable.js +131 -0
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +96 -0
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +156 -0
- package/lib/Core/3DTiles/C3DTExtensions.js +97 -0
- package/lib/Core/3DTiles/C3DTFeature.js +110 -0
- package/lib/Core/3DTiles/C3DTilesEnums.js +20 -0
- package/lib/Core/3DTiles/C3DTileset.js +99 -0
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +100 -0
- package/lib/Core/AnimationPlayer.js +142 -0
- package/lib/Core/CopcNode.js +174 -0
- package/lib/Core/Deprecated/Undeprecator.js +74 -0
- package/lib/Core/EntwinePointTileNode.js +126 -0
- package/lib/Core/Feature.js +488 -0
- package/lib/Core/Geographic/GeoidGrid.js +108 -0
- package/lib/Core/Label.js +222 -0
- package/lib/Core/MainLoop.js +209 -0
- package/lib/Core/Picking.js +255 -0
- package/lib/Core/PointCloudNode.js +42 -0
- package/lib/Core/Potree2Node.js +206 -0
- package/lib/Core/Potree2PointAttributes.js +139 -0
- package/lib/Core/PotreeNode.js +101 -0
- package/lib/Core/Prefab/Globe/Atmosphere.js +293 -0
- package/lib/Core/Prefab/Globe/GlobeLayer.js +152 -0
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.js +110 -0
- package/lib/Core/Prefab/Globe/SkyShader.js +78 -0
- package/lib/Core/Prefab/GlobeView.js +155 -0
- package/lib/Core/Prefab/Planar/PlanarLayer.js +59 -0
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +71 -0
- package/lib/Core/Prefab/PlanarView.js +62 -0
- package/lib/Core/Prefab/TileBuilder.js +82 -0
- package/lib/Core/Prefab/computeBufferTileGeometry.js +248 -0
- package/lib/Core/Scheduler/Cache.js +17 -0
- package/lib/Core/Scheduler/CancelledCommandException.js +15 -0
- package/lib/Core/Scheduler/Scheduler.js +294 -0
- package/lib/Core/Style.js +660 -0
- package/lib/Core/StyleOptions.js +486 -0
- package/lib/Core/System/Capabilities.js +63 -0
- package/lib/Core/Tile/Tile.js +205 -0
- package/lib/Core/Tile/TileGrid.js +49 -0
- package/lib/Core/TileGeometry.js +124 -0
- package/lib/Core/TileMesh.js +108 -0
- package/lib/Core/View.js +1115 -0
- package/lib/Layer/C3DTilesLayer.js +459 -0
- package/lib/Layer/ColorLayer.js +154 -0
- package/lib/Layer/CopcLayer.js +63 -0
- package/lib/Layer/ElevationLayer.js +139 -0
- package/lib/Layer/EntwinePointTileLayer.js +71 -0
- package/lib/Layer/FeatureGeometryLayer.js +77 -0
- package/lib/Layer/GeoidLayer.js +80 -0
- package/lib/Layer/GeometryLayer.js +233 -0
- package/lib/Layer/InfoLayer.js +64 -0
- package/lib/Layer/LabelLayer.js +469 -0
- package/lib/Layer/Layer.js +335 -0
- package/lib/Layer/LayerUpdateState.js +89 -0
- package/lib/Layer/LayerUpdateStrategy.js +80 -0
- package/lib/Layer/OGC3DTilesLayer.js +543 -0
- package/lib/Layer/OrientedImageLayer.js +227 -0
- package/lib/Layer/PointCloudLayer.js +405 -0
- package/lib/Layer/Potree2Layer.js +171 -0
- package/lib/Layer/PotreeLayer.js +72 -0
- package/lib/Layer/RasterLayer.js +37 -0
- package/lib/Layer/ReferencingLayerProperties.js +62 -0
- package/lib/Layer/TiledGeometryLayer.js +459 -0
- package/lib/Loader/LASLoader.js +193 -0
- package/lib/Loader/Potree2BrotliLoader.js +261 -0
- package/lib/Loader/Potree2Loader.js +207 -0
- package/lib/Main.js +113 -0
- package/lib/MainBundle.js +4 -0
- package/lib/Parser/B3dmParser.js +174 -0
- package/lib/Parser/CameraCalibrationParser.js +94 -0
- package/lib/Parser/GDFParser.js +72 -0
- package/lib/Parser/GTXParser.js +75 -0
- package/lib/Parser/GeoJsonParser.js +212 -0
- package/lib/Parser/GpxParser.js +25 -0
- package/lib/Parser/ISGParser.js +71 -0
- package/lib/Parser/KMLParser.js +25 -0
- package/lib/Parser/LASParser.js +137 -0
- package/lib/Parser/MapBoxUrlParser.js +83 -0
- package/lib/Parser/PntsParser.js +131 -0
- package/lib/Parser/Potree2BinParser.js +92 -0
- package/lib/Parser/PotreeBinParser.js +106 -0
- package/lib/Parser/PotreeCinParser.js +29 -0
- package/lib/Parser/ShapefileParser.js +78 -0
- package/lib/Parser/VectorTileParser.js +215 -0
- package/lib/Parser/XbilParser.js +120 -0
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +1386 -0
- package/lib/Parser/iGLTFLoader.js +168 -0
- package/lib/Process/3dTilesProcessing.js +304 -0
- package/lib/Process/FeatureProcessing.js +76 -0
- package/lib/Process/LayeredMaterialNodeProcessing.js +229 -0
- package/lib/Process/ObjectRemovalHelper.js +97 -0
- package/lib/Process/handlerNodeError.js +23 -0
- package/lib/Provider/3dTilesProvider.js +149 -0
- package/lib/Provider/DataSourceProvider.js +24 -0
- package/lib/Provider/Fetcher.js +233 -0
- package/lib/Provider/PointCloudProvider.js +45 -0
- package/lib/Provider/TileProvider.js +16 -0
- package/lib/Provider/URLBuilder.js +116 -0
- package/lib/Renderer/Camera.js +281 -0
- package/lib/Renderer/Color.js +56 -0
- package/lib/Renderer/ColorLayersOrdering.js +115 -0
- package/lib/Renderer/CommonMaterial.js +31 -0
- package/lib/Renderer/Label2DRenderer.js +192 -0
- package/lib/Renderer/LayeredMaterial.js +243 -0
- package/lib/Renderer/OBB.js +150 -0
- package/lib/Renderer/OrientedImageCamera.js +118 -0
- package/lib/Renderer/OrientedImageMaterial.js +167 -0
- package/lib/Renderer/PointsMaterial.js +485 -0
- package/lib/Renderer/RasterTile.js +243 -0
- package/lib/Renderer/RenderMode.js +31 -0
- package/lib/Renderer/Shader/ShaderChunk.js +160 -0
- package/lib/Renderer/Shader/ShaderUtils.js +47 -0
- package/lib/Renderer/SphereHelper.js +17 -0
- package/lib/Renderer/WebXR.js +51 -0
- package/lib/Renderer/c3DEngine.js +214 -0
- package/lib/Source/C3DTilesGoogleSource.js +74 -0
- package/lib/Source/C3DTilesIonSource.js +54 -0
- package/lib/Source/C3DTilesSource.js +30 -0
- package/lib/Source/CopcSource.js +126 -0
- package/lib/Source/EntwinePointTileSource.js +72 -0
- package/lib/Source/FileSource.js +188 -0
- package/lib/Source/OGC3DTilesGoogleSource.js +29 -0
- package/lib/Source/OGC3DTilesIonSource.js +34 -0
- package/lib/Source/OGC3DTilesSource.js +21 -0
- package/lib/Source/OrientedImageSource.js +59 -0
- package/lib/Source/Potree2Source.js +167 -0
- package/lib/Source/PotreeSource.js +82 -0
- package/lib/Source/Source.js +202 -0
- package/lib/Source/TMSSource.js +144 -0
- package/lib/Source/VectorTilesSource.js +182 -0
- package/lib/Source/WFSSource.js +170 -0
- package/lib/Source/WMSSource.js +167 -0
- package/lib/Source/WMTSSource.js +92 -0
- package/lib/ThreeExtended/capabilities/WebGL.js +69 -0
- package/lib/ThreeExtended/libs/ktx-parse.module.js +506 -0
- package/lib/ThreeExtended/libs/zstddec.module.js +29 -0
- package/lib/ThreeExtended/loaders/DDSLoader.js +200 -0
- package/lib/ThreeExtended/loaders/DRACOLoader.js +400 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.js +2879 -0
- package/lib/ThreeExtended/loaders/KTX2Loader.js +709 -0
- package/lib/ThreeExtended/math/ColorSpaces.js +59 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +846 -0
- package/lib/ThreeExtended/utils/WorkerPool.js +70 -0
- package/lib/Utils/CameraUtils.js +554 -0
- package/lib/Utils/DEMUtils.js +350 -0
- package/lib/Utils/FeaturesUtils.js +156 -0
- package/lib/Utils/Gradients.js +16 -0
- package/lib/Utils/ThreeUtils.js +115 -0
- package/lib/Utils/gui/C3DTilesStyle.js +218 -0
- package/lib/Utils/gui/Main.js +7 -0
- package/lib/Utils/gui/Minimap.js +152 -0
- package/lib/Utils/gui/Navigation.js +245 -0
- package/lib/Utils/gui/Scale.js +104 -0
- package/lib/Utils/gui/Searchbar.js +234 -0
- package/lib/Utils/gui/Widget.js +80 -0
- package/lib/Utils/placeObjectOnGround.js +136 -0
- package/lib/Worker/LASLoaderWorker.js +19 -0
- package/lib/Worker/Potree2Worker.js +21 -0
- package/package.json +2 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { MAIN_LOOP_EVENTS } from "../Core/MainLoop.js";
|
|
3
|
+
const MOVEMENTS = {
|
|
4
|
+
38: {
|
|
5
|
+
method: 'translateZ',
|
|
6
|
+
sign: -1
|
|
7
|
+
},
|
|
8
|
+
// FORWARD: up key
|
|
9
|
+
40: {
|
|
10
|
+
method: 'translateZ',
|
|
11
|
+
sign: 1
|
|
12
|
+
},
|
|
13
|
+
// BACKWARD: down key
|
|
14
|
+
37: {
|
|
15
|
+
method: 'translateX',
|
|
16
|
+
sign: -1
|
|
17
|
+
},
|
|
18
|
+
// STRAFE_LEFT: left key
|
|
19
|
+
39: {
|
|
20
|
+
method: 'translateX',
|
|
21
|
+
sign: 1
|
|
22
|
+
},
|
|
23
|
+
// STRAFE_RIGHT: right key
|
|
24
|
+
33: {
|
|
25
|
+
method: 'rotateZ',
|
|
26
|
+
sign: 1,
|
|
27
|
+
noSpeed: true
|
|
28
|
+
},
|
|
29
|
+
// UP: PageUp key
|
|
30
|
+
34: {
|
|
31
|
+
method: 'rotateZ',
|
|
32
|
+
sign: -1,
|
|
33
|
+
noSpeed: true
|
|
34
|
+
},
|
|
35
|
+
// DOWN: PageDown key
|
|
36
|
+
wheelup: {
|
|
37
|
+
method: 'translateZ',
|
|
38
|
+
sign: 1,
|
|
39
|
+
oneshot: true
|
|
40
|
+
},
|
|
41
|
+
// WHEEL up
|
|
42
|
+
wheeldown: {
|
|
43
|
+
method: 'translateZ',
|
|
44
|
+
sign: -1,
|
|
45
|
+
oneshot: true
|
|
46
|
+
} // WHEEL down
|
|
47
|
+
};
|
|
48
|
+
function onDocumentMouseDown(event) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
this._isMouseDown = true;
|
|
51
|
+
const coords = this.view.eventToViewCoords(event);
|
|
52
|
+
this._onMouseDownMouseX = coords.x;
|
|
53
|
+
this._onMouseDownMouseY = coords.y;
|
|
54
|
+
}
|
|
55
|
+
function onTouchStart(event) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
this._isMouseDown = true;
|
|
58
|
+
this._onMouseDownMouseX = event.touches[0].pageX;
|
|
59
|
+
this._onMouseDownMouseY = event.touches[0].pageY;
|
|
60
|
+
}
|
|
61
|
+
function onPointerMove(event) {
|
|
62
|
+
if (this._isMouseDown === true) {
|
|
63
|
+
const coords = this.view.eventToViewCoords(event);
|
|
64
|
+
|
|
65
|
+
// in rigor we have tan(theta) = tan(cameraFOV) * deltaH / H
|
|
66
|
+
// (where deltaH is the vertical amount we moved, and H the renderer height)
|
|
67
|
+
// we loosely approximate tan(x) by x
|
|
68
|
+
const pxToAngleRatio = THREE.MathUtils.degToRad(this._camera3D.fov) / this.view.mainLoop.gfxEngine.height;
|
|
69
|
+
this._camera3D.rotateY((coords.x - this._onMouseDownMouseX) * pxToAngleRatio);
|
|
70
|
+
this._camera3D.rotateX((coords.y - this._onMouseDownMouseY) * pxToAngleRatio);
|
|
71
|
+
this._onMouseDownMouseX = coords.x;
|
|
72
|
+
this._onMouseDownMouseY = coords.y;
|
|
73
|
+
this.view.notifyChange(this._camera3D, false);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function onDocumentMouseUp() {
|
|
77
|
+
this._isMouseDown = false;
|
|
78
|
+
}
|
|
79
|
+
function onKeyUp(e) {
|
|
80
|
+
const move = MOVEMENTS[e.keyCode];
|
|
81
|
+
if (move) {
|
|
82
|
+
this.moves.delete(move);
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function onKeyDown(e) {
|
|
87
|
+
const move = MOVEMENTS[e.keyCode];
|
|
88
|
+
if (move) {
|
|
89
|
+
this.moves.add(move);
|
|
90
|
+
this.view.notifyChange(this._camera3D, false);
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function onDocumentMouseWheel(event) {
|
|
95
|
+
const delta = -event.deltaY;
|
|
96
|
+
if (delta < 0) {
|
|
97
|
+
this.moves.add(MOVEMENTS.wheelup);
|
|
98
|
+
} else {
|
|
99
|
+
this.moves.add(MOVEMENTS.wheeldown);
|
|
100
|
+
}
|
|
101
|
+
this.view.notifyChange(this._camera3D, false);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* First-Person controls (at least a possible declination of it).
|
|
106
|
+
*
|
|
107
|
+
* Bindings:
|
|
108
|
+
* - up + down keys: forward/backward
|
|
109
|
+
* - left + right keys: strafing movements
|
|
110
|
+
* - PageUp + PageDown: roll movement
|
|
111
|
+
* - mouse click+drag: pitch and yaw movements (as looking at a panorama, not as in FPS games for instance)
|
|
112
|
+
*/
|
|
113
|
+
class FlyControls extends THREE.EventDispatcher {
|
|
114
|
+
/**
|
|
115
|
+
* @param {View} view
|
|
116
|
+
* @param {object} options
|
|
117
|
+
* @param {boolean} options.focusOnClick - whether or not to focus the renderer domElement on click
|
|
118
|
+
* @param {boolean} options.focusOnMouseOver - whether or not to focus when the mouse is over the domElement
|
|
119
|
+
*/
|
|
120
|
+
constructor(view) {
|
|
121
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
122
|
+
super();
|
|
123
|
+
this.view = view;
|
|
124
|
+
this.options = options;
|
|
125
|
+
this._camera3D = view.camera3D;
|
|
126
|
+
this.moves = new Set();
|
|
127
|
+
this.moveSpeed = 10; // backward or forward move speed in m/s
|
|
128
|
+
|
|
129
|
+
this._onMouseDownMouseX = 0;
|
|
130
|
+
this._onMouseDownMouseY = 0;
|
|
131
|
+
this._isMouseDown = false;
|
|
132
|
+
view.domElement.addEventListener('mousedown', onDocumentMouseDown.bind(this), false);
|
|
133
|
+
view.domElement.addEventListener('touchstart', onTouchStart.bind(this), false);
|
|
134
|
+
const bindedPM = onPointerMove.bind(this);
|
|
135
|
+
view.domElement.addEventListener('mousemove', bindedPM, false);
|
|
136
|
+
view.domElement.addEventListener('touchmove', bindedPM, false);
|
|
137
|
+
view.domElement.addEventListener('mouseup', onDocumentMouseUp.bind(this), false);
|
|
138
|
+
view.domElement.addEventListener('touchend', onDocumentMouseUp.bind(this), false);
|
|
139
|
+
view.domElement.addEventListener('wheel', onDocumentMouseWheel.bind(this), false);
|
|
140
|
+
view.domElement.addEventListener('keyup', onKeyUp.bind(this), true);
|
|
141
|
+
view.domElement.addEventListener('keydown', onKeyDown.bind(this), true);
|
|
142
|
+
this.view.addFrameRequester(MAIN_LOOP_EVENTS.AFTER_CAMERA_UPDATE, this.update.bind(this));
|
|
143
|
+
|
|
144
|
+
// focus policy
|
|
145
|
+
if (options.focusOnMouseOver) {
|
|
146
|
+
view.domElement.addEventListener('mouseover', () => view.domElement.focus());
|
|
147
|
+
}
|
|
148
|
+
if (options.focusOnClick) {
|
|
149
|
+
view.domElement.addEventListener('click', () => view.domElement.focus());
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
isUserInteracting() {
|
|
153
|
+
return this.moves.size !== 0 || this._isMouseDown;
|
|
154
|
+
}
|
|
155
|
+
update(dt, updateLoopRestarted) {
|
|
156
|
+
// if we are in a keypressed state, then update position
|
|
157
|
+
|
|
158
|
+
// dt will not be relevant when we just started rendering, we consider a 1-frame move in this case
|
|
159
|
+
if (updateLoopRestarted) {
|
|
160
|
+
dt = 16;
|
|
161
|
+
}
|
|
162
|
+
for (const move of this.moves) {
|
|
163
|
+
this._camera3D[move.method](move.sign * (move.noSpeed ? 1 : this.moveSpeed) * dt / 1000);
|
|
164
|
+
}
|
|
165
|
+
if (this.moves.size > 0 || this._isMouseDown) {
|
|
166
|
+
this.view.notifyChange(this._camera3D);
|
|
167
|
+
for (const move of this.moves) {
|
|
168
|
+
if (move.oneshot) {
|
|
169
|
+
this.moves.delete(move);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export default FlyControls;
|