itowns 2.42.1-next.15 → 2.42.1-next.17
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/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/lib/Controls/FirstPersonControls.js +5 -12
- package/lib/Controls/FlyControls.js +4 -13
- package/lib/Controls/GlobeControls.js +33 -43
- package/lib/Controls/PlanarControls.js +9 -20
- package/lib/Controls/StateControl.js +2 -11
- package/lib/Controls/StreetControls.js +14 -24
- package/lib/Converter/Feature2Mesh.js +28 -38
- package/lib/Converter/Feature2Texture.js +15 -25
- package/lib/Converter/convertToTile.js +13 -24
- package/lib/Converter/textureConverter.js +9 -19
- package/lib/Core/3DTiles/C3DTBatchTable.js +5 -13
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +1 -8
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +17 -27
- package/lib/Core/3DTiles/C3DTExtensions.js +1 -8
- package/lib/Core/3DTiles/C3DTFeature.js +3 -10
- package/lib/Core/3DTiles/C3DTilesEnums.js +3 -11
- package/lib/Core/3DTiles/C3DTileset.js +7 -16
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +5 -11
- package/lib/Core/AnimationPlayer.js +2 -11
- package/lib/Core/Deprecated/Undeprecator.js +8 -19
- package/lib/Core/EntwinePointTileNode.js +6 -16
- package/lib/Core/Feature.js +16 -30
- package/lib/Core/Geographic/CoordStars.js +3 -12
- package/lib/Core/Geographic/Coordinates.js +12 -22
- package/lib/Core/Geographic/Crs.js +7 -15
- package/lib/Core/Geographic/Extent.js +36 -47
- package/lib/Core/Geographic/GeoidGrid.js +6 -16
- package/lib/Core/Label.js +7 -17
- package/lib/Core/MainLoop.js +7 -16
- package/lib/Core/Math/Ellipsoid.js +6 -17
- package/lib/Core/Picking.js +10 -20
- package/lib/Core/PointCloudNode.js +2 -11
- package/lib/Core/PotreeNode.js +4 -13
- package/lib/Core/Prefab/Globe/Atmosphere.js +17 -26
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +6 -16
- package/lib/Core/Prefab/Globe/GlobeLayer.js +19 -28
- package/lib/Core/Prefab/Globe/SkyShader.js +2 -11
- package/lib/Core/Prefab/GlobeView.js +27 -37
- package/lib/Core/Prefab/Planar/PlanarLayer.js +11 -20
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +6 -16
- package/lib/Core/Prefab/PlanarView.js +10 -20
- package/lib/Core/Prefab/TileBuilder.js +10 -19
- package/lib/Core/Prefab/computeBufferTileGeometry.js +3 -12
- package/lib/Core/Scheduler/Cache.js +2 -10
- package/lib/Core/Scheduler/CancelledCommandException.js +1 -8
- package/lib/Core/Scheduler/Scheduler.js +15 -23
- package/lib/Core/Style.js +21 -34
- package/lib/Core/System/Capabilities.js +2 -9
- package/lib/Core/TileGeometry.js +5 -14
- package/lib/Core/TileMesh.js +6 -15
- package/lib/Core/View.js +43 -53
- package/lib/Layer/C3DTilesLayer.js +25 -37
- package/lib/Layer/ColorLayer.js +10 -16
- package/lib/Layer/ElevationLayer.js +7 -14
- package/lib/Layer/EntwinePointTileLayer.js +8 -18
- package/lib/Layer/FeatureGeometryLayer.js +9 -16
- package/lib/Layer/GeoidLayer.js +6 -15
- package/lib/Layer/GeometryLayer.js +11 -17
- package/lib/Layer/InfoLayer.js +5 -14
- package/lib/Layer/LabelLayer.js +22 -32
- package/lib/Layer/Layer.js +16 -26
- package/lib/Layer/LayerUpdateState.js +1 -8
- package/lib/Layer/LayerUpdateStrategy.js +7 -18
- package/lib/Layer/OrientedImageLayer.js +15 -25
- package/lib/Layer/PointCloudLayer.js +9 -19
- package/lib/Layer/PotreeLayer.js +8 -18
- package/lib/Layer/RasterLayer.js +9 -17
- package/lib/Layer/ReferencingLayerProperties.js +1 -8
- package/lib/Layer/TiledGeometryLayer.js +21 -31
- package/lib/Main.js +86 -720
- package/lib/MainBundle.js +4 -34
- package/lib/Parser/B3dmParser.js +20 -28
- package/lib/Parser/CameraCalibrationParser.js +5 -14
- package/lib/Parser/GDFParser.js +11 -22
- package/lib/Parser/GLTFParser.js +13 -28
- package/lib/Parser/GTXParser.js +9 -21
- package/lib/Parser/GeoJsonParser.js +13 -21
- package/lib/Parser/GpxParser.js +7 -14
- package/lib/Parser/ISGParser.js +19 -28
- package/lib/Parser/KMLParser.js +7 -14
- package/lib/Parser/LASLoader.js +11 -16
- package/lib/Parser/LASParser.js +5 -15
- package/lib/Parser/MapBoxUrlParser.js +2 -9
- package/lib/Parser/PntsParser.js +4 -14
- package/lib/Parser/PotreeBinParser.js +3 -11
- package/lib/Parser/PotreeCinParser.js +3 -12
- package/lib/Parser/ShapefileParser.js +11 -18
- package/lib/Parser/VectorTileParser.js +18 -26
- package/lib/Parser/XbilParser.js +5 -13
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +2 -12
- package/lib/Process/3dTilesProcessing.js +14 -27
- package/lib/Process/FeatureProcessing.js +14 -22
- package/lib/Process/LayeredMaterialNodeProcessing.js +14 -26
- package/lib/Process/ObjectRemovalHelper.js +2 -9
- package/lib/Process/handlerNodeError.js +1 -7
- package/lib/Provider/3dTilesProvider.js +16 -27
- package/lib/Provider/DataSourceProvider.js +2 -9
- package/lib/Provider/Fetcher.js +6 -13
- package/lib/Provider/PointCloudProvider.js +5 -15
- package/lib/Provider/TileProvider.js +4 -12
- package/lib/Provider/URLBuilder.js +4 -12
- package/lib/Renderer/Camera.js +7 -17
- package/lib/Renderer/Color.js +3 -11
- package/lib/Renderer/ColorLayersOrdering.js +14 -22
- package/lib/Renderer/CommonMaterial.js +3 -12
- package/lib/Renderer/Label2DRenderer.js +5 -16
- package/lib/Renderer/LayeredMaterial.js +27 -41
- package/lib/Renderer/OBB.js +10 -19
- package/lib/Renderer/OrientedImageCamera.js +2 -11
- package/lib/Renderer/OrientedImageMaterial.js +7 -17
- package/lib/Renderer/PointsMaterial.js +34 -48
- package/lib/Renderer/RasterTile.js +15 -28
- package/lib/Renderer/RenderMode.js +2 -9
- package/lib/Renderer/Shader/ShaderChunk.js +2 -11
- package/lib/Renderer/Shader/ShaderUtils.js +2 -9
- package/lib/Renderer/SphereHelper.js +2 -11
- package/lib/Renderer/WebXR.js +2 -11
- package/lib/Renderer/c3DEngine.js +18 -28
- package/lib/Source/C3DTilesGoogleSource.js +5 -13
- package/lib/Source/C3DTilesIonSource.js +6 -13
- package/lib/Source/C3DTilesSource.js +5 -12
- package/lib/Source/EntwinePointTileSource.js +12 -19
- package/lib/Source/FileSource.js +7 -14
- package/lib/Source/OrientedImageSource.js +6 -13
- package/lib/Source/PotreeSource.js +9 -16
- package/lib/Source/Source.js +17 -26
- package/lib/Source/TMSSource.js +11 -21
- package/lib/Source/VectorTilesSource.js +18 -26
- package/lib/Source/WFSSource.js +7 -14
- package/lib/Source/WMSSource.js +5 -12
- package/lib/Source/WMTSSource.js +3 -10
- package/lib/ThreeExtended/capabilities/WebGL.js +1 -8
- package/lib/ThreeExtended/libs/ktx-parse.module.js +2 -256
- package/lib/ThreeExtended/libs/zstddec.module.js +2 -8
- package/lib/ThreeExtended/loaders/DDSLoader.js +10 -16
- package/lib/ThreeExtended/loaders/DRACOLoader.js +14 -19
- package/lib/ThreeExtended/loaders/GLTFLoader.js +124 -129
- package/lib/ThreeExtended/loaders/KTX2Loader.js +73 -78
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +40 -59
- package/lib/ThreeExtended/utils/WorkerPool.js +2 -9
- package/lib/Utils/CameraUtils.js +32 -44
- package/lib/Utils/DEMUtils.js +8 -19
- package/lib/Utils/FeaturesUtils.js +8 -16
- package/lib/Utils/Gradients.js +3 -12
- package/lib/Utils/OrientationUtils.js +8 -18
- package/lib/Utils/ThreeUtils.js +2 -9
- package/lib/Utils/gui/C3DTilesStyle.js +7 -15
- package/lib/Utils/gui/Main.js +7 -48
- package/lib/Utils/gui/Minimap.js +12 -20
- package/lib/Utils/gui/Navigation.js +6 -14
- package/lib/Utils/gui/Scale.js +11 -19
- package/lib/Utils/gui/Searchbar.js +5 -13
- package/lib/Utils/gui/Widget.js +1 -8
- package/lib/Utils/placeObjectOnGround.js +13 -23
- package/package.json +10 -7
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ellipsoidSizes = exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _proj = _interopRequireDefault(require("proj4"));
|
|
10
|
-
var _Coordinates = _interopRequireDefault(require("../Geographic/Coordinates"));
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
const ellipsoidSizes = new THREE.Vector3(_proj.default.WGS84.a, _proj.default.WGS84.a, _proj.default.WGS84.b);
|
|
14
|
-
exports.ellipsoidSizes = ellipsoidSizes;
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import proj4 from 'proj4';
|
|
3
|
+
import Coordinates from "../Geographic/Coordinates.js";
|
|
4
|
+
export const ellipsoidSizes = new THREE.Vector3(proj4.WGS84.a, proj4.WGS84.a, proj4.WGS84.b);
|
|
15
5
|
const normal = new THREE.Vector3();
|
|
16
6
|
class Ellipsoid {
|
|
17
7
|
constructor() {
|
|
@@ -61,7 +51,7 @@ class Ellipsoid {
|
|
|
61
51
|
* @returns {Coordinate} an object describing the coordinates on the reference ellipsoid, angles are in degree
|
|
62
52
|
*/
|
|
63
53
|
cartesianToCartographic(position) {
|
|
64
|
-
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new
|
|
54
|
+
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Coordinates('EPSG:4326', 0, 0, 0);
|
|
65
55
|
// for details, see for example http://www.linz.govt.nz/data/geodetic-system/coordinate-conversion/geodetic-datum-conversions/equations-used-datum
|
|
66
56
|
// TODO the following is only valable for oblate ellipsoid of revolution. do we want to support triaxial ellipsoid?
|
|
67
57
|
const R = Math.sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
|
@@ -151,5 +141,4 @@ class Ellipsoid {
|
|
|
151
141
|
return distRad * Math.sqrt(rho * N);
|
|
152
142
|
}
|
|
153
143
|
}
|
|
154
|
-
|
|
155
|
-
exports.default = _default;
|
|
144
|
+
export default Ellipsoid;
|
package/lib/Core/Picking.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _RenderMode = _interopRequireDefault(require("../Renderer/RenderMode"));
|
|
10
|
-
var _LayeredMaterial = require("../Renderer/LayeredMaterial");
|
|
11
|
-
var _Coordinates = _interopRequireDefault(require("./Geographic/Coordinates"));
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import RenderMode from "../Renderer/RenderMode.js";
|
|
3
|
+
import { unpack1K } from "../Renderer/LayeredMaterial.js";
|
|
4
|
+
import Coordinates from "./Geographic/Coordinates.js";
|
|
14
5
|
const depthRGBA = new THREE.Vector4();
|
|
15
6
|
// TileMesh picking support function
|
|
16
7
|
function screenCoordsToNodeId(view, tileLayer, viewCoords) {
|
|
17
8
|
let radius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
18
9
|
const dim = view.mainLoop.gfxEngine.getWindowSize();
|
|
19
10
|
viewCoords = viewCoords || new THREE.Vector2(Math.floor(dim.x / 2), Math.floor(dim.y / 2));
|
|
20
|
-
const restore = tileLayer.level0Nodes.map(n =>
|
|
11
|
+
const restore = tileLayer.level0Nodes.map(n => RenderMode.push(n, RenderMode.MODES.ID));
|
|
21
12
|
const buffer = view.mainLoop.gfxEngine.renderViewToBuffer({
|
|
22
13
|
camera: view.camera,
|
|
23
14
|
scene: tileLayer.object3d
|
|
@@ -33,7 +24,7 @@ function screenCoordsToNodeId(view, tileLayer, viewCoords) {
|
|
|
33
24
|
const idx = (y * 2 * radius + x) * 4;
|
|
34
25
|
const data = buffer.slice(idx, idx + 4 || undefined);
|
|
35
26
|
depthRGBA.fromArray(data).divideScalar(255.0);
|
|
36
|
-
const unpack =
|
|
27
|
+
const unpack = unpack1K(depthRGBA, 256 ** 3);
|
|
37
28
|
const _id = Math.round(unpack);
|
|
38
29
|
if (!ids.includes(_id)) {
|
|
39
30
|
ids.push(_id);
|
|
@@ -84,9 +75,9 @@ function findLayerInParent(obj) {
|
|
|
84
75
|
const raycaster = new THREE.Raycaster();
|
|
85
76
|
const normalized = new THREE.Vector2();
|
|
86
77
|
const pointPos = new THREE.Vector3();
|
|
87
|
-
const pointPosCoord = new
|
|
78
|
+
const pointPosCoord = new Coordinates('EPSG:4978'); // default crs, will be set to view crs when used
|
|
88
79
|
const cameraPos = new THREE.Vector3();
|
|
89
|
-
const cameraPosCoord = new
|
|
80
|
+
const cameraPosCoord = new Coordinates('EPSG:4978'); // default crs, will be set to view crs when used
|
|
90
81
|
|
|
91
82
|
/**
|
|
92
83
|
* @module Picking
|
|
@@ -101,7 +92,7 @@ const cameraPosCoord = new _Coordinates.default('EPSG:4978'); // default crs, wi
|
|
|
101
92
|
* - radius (in pixels) of the picking circle
|
|
102
93
|
* - layer: the geometry layer used for picking
|
|
103
94
|
*/
|
|
104
|
-
|
|
95
|
+
export default {
|
|
105
96
|
pickTilesAt(view, viewCoords, radius, layer) {
|
|
106
97
|
let results = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
107
98
|
const _ids = screenCoordsToNodeId(view, layer, viewCoords, radius);
|
|
@@ -261,5 +252,4 @@ var _default = {
|
|
|
261
252
|
});
|
|
262
253
|
return target;
|
|
263
254
|
}
|
|
264
|
-
};
|
|
265
|
-
exports.default = _default;
|
|
255
|
+
};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import * as THREE from 'three';
|
|
10
2
|
class PointCloudNode extends THREE.EventDispatcher {
|
|
11
3
|
constructor() {
|
|
12
4
|
let numPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
@@ -47,5 +39,4 @@ class PointCloudNode extends THREE.EventDispatcher {
|
|
|
47
39
|
}
|
|
48
40
|
}
|
|
49
41
|
}
|
|
50
|
-
|
|
51
|
-
exports.default = _default;
|
|
42
|
+
export default PointCloudNode;
|
package/lib/Core/PotreeNode.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import PointCloudNode from "./PointCloudNode.js";
|
|
2
3
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _PointCloudNode = _interopRequireDefault(require("./PointCloudNode"));
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
4
|
// Create an A(xis)A(ligned)B(ounding)B(ox) for the child `childIndex` of one aabb.
|
|
13
5
|
// (PotreeConverter protocol builds implicit octree hierarchy by applying the same
|
|
14
6
|
// subdivision algo recursively)
|
|
15
7
|
const dHalfLength = new THREE.Vector3();
|
|
16
|
-
class PotreeNode extends
|
|
8
|
+
class PotreeNode extends PointCloudNode {
|
|
17
9
|
constructor() {
|
|
18
10
|
let numPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
19
11
|
let childrenBitField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -106,5 +98,4 @@ class PotreeNode extends _PointCloudNode.default {
|
|
|
106
98
|
});
|
|
107
99
|
}
|
|
108
100
|
}
|
|
109
|
-
|
|
110
|
-
exports.default = _default;
|
|
101
|
+
export default PotreeNode;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _GeometryLayer = _interopRequireDefault(require("../../../Layer/GeometryLayer"));
|
|
10
|
-
var _Coordinates = _interopRequireDefault(require("../../Geographic/Coordinates"));
|
|
11
|
-
var _Ellipsoid = require("../../Math/Ellipsoid");
|
|
12
|
-
var _CoordStars = _interopRequireDefault(require("../../Geographic/CoordStars"));
|
|
13
|
-
var _SkyShader = _interopRequireDefault(require("./SkyShader"));
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
1
|
/*
|
|
17
2
|
* To change this license header, choose License Headers in Project Properties.
|
|
18
3
|
* To change this template file, choose Tools | Templates
|
|
19
4
|
* and open the template in the editor.
|
|
20
5
|
*/
|
|
6
|
+
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import GeometryLayer from "../../../Layer/GeometryLayer.js";
|
|
9
|
+
import Coordinates from "../../Geographic/Coordinates.js";
|
|
10
|
+
import { ellipsoidSizes } from "../../Math/Ellipsoid.js";
|
|
11
|
+
import CoordStars from "../../Geographic/CoordStars.js";
|
|
12
|
+
import Sky from "./SkyShader.js";
|
|
21
13
|
/* babel-plugin-inline-import './Shaders/skyFS.glsl' */
|
|
22
14
|
const skyFS = "uniform vec3 v3LightPos;\nuniform float g;\nuniform float g2;\n\nvarying vec3 v3Direction;\nvarying vec3 c0;\nvarying vec3 c1;\n\n// Calculates the Mie phase function\nfloat getMiePhase(float fCos, float fCos2, float g, float g2) {\n return 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) / pow(1.0 + g2 - 2.0 * g * fCos, 1.5);\n}\n\n// Calculates the Rayleigh phase function\nfloat getRayleighPhase(float fCos2) {\n return 0.75 + 0.75 * fCos2;\n}\n\nvoid main (void) {\n float fCos = dot(v3LightPos, v3Direction) / length(v3Direction);\n float fCos2 = fCos * fCos;\n\n vec3 color = getRayleighPhase(fCos2) * c0 + getMiePhase(fCos, fCos2, g, g2) * c1;\n\n gl_FragColor = vec4(color, 1.0);\n gl_FragColor.a = gl_FragColor.b;\n}";
|
|
23
15
|
/* babel-plugin-inline-import './Shaders/skyVS.glsl' */
|
|
@@ -32,14 +24,14 @@ const GlowFS = "#include <logdepthbuf_pars_fragment>\n\nuniform int atmoIN;\nvar
|
|
|
32
24
|
const GlowVS = "#include <common>\n#include <logdepthbuf_pars_vertex>\n\nuniform int atmoIN;\nvarying float intensity;\n\nvoid main()\n{\n vec3 normalES = normalize( normalMatrix * normal );\n vec3 normalCAMES = normalize( normalMatrix * cameraPosition );\n\n if(atmoIN == 0) {\n intensity = pow(0.666 - dot(normalES, normalCAMES), 4. );\n } else {\n intensity = pow( 1. - dot(normalES, normalCAMES), 0.8 );\n }\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n #include <logdepthbuf_vertex>\n}\n\n\n";
|
|
33
25
|
const LIGHTING_POSITION = new THREE.Vector3(1, 0, 0);
|
|
34
26
|
const v = new THREE.Vector3();
|
|
35
|
-
const coordCam = new
|
|
36
|
-
const coordGeoCam = new
|
|
27
|
+
const coordCam = new Coordinates('EPSG:4326');
|
|
28
|
+
const coordGeoCam = new Coordinates('EPSG:4326');
|
|
37
29
|
const skyBaseColor = new THREE.Color(0x93d5f8);
|
|
38
30
|
const colorSky = new THREE.Color();
|
|
39
31
|
const spaceColor = new THREE.Color(0x030508);
|
|
40
32
|
const limitAlti = 600000;
|
|
41
|
-
const mfogDistance =
|
|
42
|
-
class Atmosphere extends
|
|
33
|
+
const mfogDistance = ellipsoidSizes.x * 160.0;
|
|
34
|
+
class Atmosphere extends GeometryLayer {
|
|
43
35
|
/**
|
|
44
36
|
* It's layer to simulate Globe atmosphere.
|
|
45
37
|
* There's 2 modes : simple and realistic (atmospheric-scattering).
|
|
@@ -90,7 +82,7 @@ class Atmosphere extends _GeometryLayer.default {
|
|
|
90
82
|
});
|
|
91
83
|
const sphereGeometry = new THREE.SphereGeometry(1, 64, 64);
|
|
92
84
|
const basicAtmosphereOut = new THREE.Mesh(sphereGeometry, material);
|
|
93
|
-
basicAtmosphereOut.scale.copy(
|
|
85
|
+
basicAtmosphereOut.scale.copy(ellipsoidSizes).multiplyScalar(1.14);
|
|
94
86
|
this.basicAtmosphere = new THREE.Object3D();
|
|
95
87
|
this.realisticAtmosphere = new THREE.Object3D();
|
|
96
88
|
this.realisticAtmosphere.visible = false;
|
|
@@ -117,7 +109,7 @@ class Atmosphere extends _GeometryLayer.default {
|
|
|
117
109
|
depthWrite: false
|
|
118
110
|
});
|
|
119
111
|
const basicAtmosphereIn = new THREE.Mesh(sphereGeometry, materialAtmoIn);
|
|
120
|
-
basicAtmosphereIn.scale.copy(
|
|
112
|
+
basicAtmosphereIn.scale.copy(ellipsoidSizes).multiplyScalar(1.002);
|
|
121
113
|
this.basicAtmosphere.add(basicAtmosphereIn);
|
|
122
114
|
this.realisticLightingPosition = {
|
|
123
115
|
x: -0.5,
|
|
@@ -161,7 +153,7 @@ class Atmosphere extends _GeometryLayer.default {
|
|
|
161
153
|
const len = v.distanceTo(cameraPosition);
|
|
162
154
|
// Compute fog distance, this function makes it possible to have a shorter distance
|
|
163
155
|
// when the camera approaches the ground
|
|
164
|
-
this.fog.distance = mfogDistance * ((len -
|
|
156
|
+
this.fog.distance = mfogDistance * ((len - ellipsoidSizes.x * 0.99) * 0.25 / ellipsoidSizes.x) ** 1.5;
|
|
165
157
|
} else {
|
|
166
158
|
this.fog.distance = 10e10;
|
|
167
159
|
}
|
|
@@ -272,7 +264,7 @@ class Atmosphere extends _GeometryLayer.default {
|
|
|
272
264
|
side: THREE.BackSide
|
|
273
265
|
});
|
|
274
266
|
const sky = new THREE.Mesh(geometryAtmosphereOut, materialAtmosphereOut);
|
|
275
|
-
const skyDome = new
|
|
267
|
+
const skyDome = new Sky();
|
|
276
268
|
skyDome.frustumCulled = false;
|
|
277
269
|
this.realisticAtmosphere.add(ground);
|
|
278
270
|
this.realisticAtmosphere.add(sky);
|
|
@@ -302,12 +294,11 @@ class Atmosphere extends _GeometryLayer.default {
|
|
|
302
294
|
if (!this.realisticAtmosphere.children.length) {
|
|
303
295
|
this._initRealisticLighning();
|
|
304
296
|
}
|
|
305
|
-
this.realisticLightingPosition =
|
|
297
|
+
this.realisticLightingPosition = CoordStars.getSunPositionInScene(new Date().getTime(), 48.85, 2.35).normalize();
|
|
306
298
|
this.realisticAtmosphere.children.forEach(obj => obj.material.uniforms.v3LightPosition.value.copy(this.realisticLightingPosition));
|
|
307
299
|
}
|
|
308
300
|
this.basicAtmosphere.visible = !bool;
|
|
309
301
|
this.realisticAtmosphere.visible = bool;
|
|
310
302
|
}
|
|
311
303
|
}
|
|
312
|
-
|
|
313
|
-
exports.default = _default;
|
|
304
|
+
export default Atmosphere;
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Coordinates = _interopRequireDefault(require("../../Geographic/Coordinates"));
|
|
10
|
-
var _Extent = _interopRequireDefault(require("../../Geographic/Extent"));
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Coordinates from "../../Geographic/Coordinates.js";
|
|
3
|
+
import Extent from "../../Geographic/Extent.js";
|
|
13
4
|
const PI_OV_FOUR = Math.PI / 4;
|
|
14
5
|
const INV_TWO_PI = 1.0 / (Math.PI * 2);
|
|
15
6
|
const axisZ = new THREE.Vector3(0, 0, 1);
|
|
@@ -24,7 +15,7 @@ class BuilderEllipsoidTile {
|
|
|
24
15
|
constructor() {
|
|
25
16
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
17
|
this.tmp = {
|
|
27
|
-
coords: [new
|
|
18
|
+
coords: [new Coordinates('EPSG:4326', 0, 0), new Coordinates('EPSG:4326', 0, 0)],
|
|
28
19
|
position: new THREE.Vector3(),
|
|
29
20
|
dimension: new THREE.Vector2()
|
|
30
21
|
};
|
|
@@ -100,7 +91,7 @@ class BuilderEllipsoidTile {
|
|
|
100
91
|
// but we should be reverse UV on tile
|
|
101
92
|
// Common geometry is looking for only on longitude
|
|
102
93
|
const sizeLongitude = Math.abs(extent.west - extent.east) / 2;
|
|
103
|
-
const sharableExtent = new
|
|
94
|
+
const sharableExtent = new Extent(extent.crs, -sizeLongitude, sizeLongitude, extent.south, extent.north);
|
|
104
95
|
|
|
105
96
|
// compute rotation to transform tile to position it on ellipsoid
|
|
106
97
|
// this transformation take into account the transformation of the parents
|
|
@@ -116,5 +107,4 @@ class BuilderEllipsoidTile {
|
|
|
116
107
|
};
|
|
117
108
|
}
|
|
118
109
|
}
|
|
119
|
-
|
|
120
|
-
exports.default = _default;
|
|
110
|
+
export default BuilderEllipsoidTile;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import TiledGeometryLayer from "../../../Layer/TiledGeometryLayer.js";
|
|
3
|
+
import { ellipsoidSizes } from "../../Math/Ellipsoid.js";
|
|
4
|
+
import { globalExtentTMS, schemeTiles } from "../../Geographic/Extent.js";
|
|
5
|
+
import BuilderEllipsoidTile from "./BuilderEllipsoidTile.js";
|
|
6
|
+
import { SIZE_DIAGONAL_TEXTURE } from "../../../Process/LayeredMaterialNodeProcessing.js";
|
|
7
|
+
import CRS from "../../Geographic/Crs.js";
|
|
2
8
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _TiledGeometryLayer = _interopRequireDefault(require("../../../Layer/TiledGeometryLayer"));
|
|
10
|
-
var _Ellipsoid = require("../../Math/Ellipsoid");
|
|
11
|
-
var _Extent = require("../../Geographic/Extent");
|
|
12
|
-
var _BuilderEllipsoidTile = _interopRequireDefault(require("./BuilderEllipsoidTile"));
|
|
13
|
-
var _LayeredMaterialNodeProcessing = require("../../../Process/LayeredMaterialNodeProcessing");
|
|
14
|
-
var _Crs = _interopRequireDefault(require("../../Geographic/Crs"));
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
9
|
// matrix to convert sphere to ellipsoid
|
|
18
10
|
const worldToScaledEllipsoid = new THREE.Matrix4();
|
|
19
11
|
// camera's position in worldToScaledEllipsoid system
|
|
@@ -28,7 +20,7 @@ const scaledHorizonCullingPoint = new THREE.Vector3();
|
|
|
28
20
|
* GlobeLayer. Default is true. You should not change this, as it is used
|
|
29
21
|
* internally for optimisation.
|
|
30
22
|
*/
|
|
31
|
-
class GlobeLayer extends
|
|
23
|
+
class GlobeLayer extends TiledGeometryLayer {
|
|
32
24
|
/**
|
|
33
25
|
* A {@link TiledGeometryLayer} to use with a {@link GlobeView}. It has
|
|
34
26
|
* specific method for updating and subdivising its grid.
|
|
@@ -61,13 +53,13 @@ class GlobeLayer extends _TiledGeometryLayer.default {
|
|
|
61
53
|
constructor(id, object3d) {
|
|
62
54
|
let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
63
55
|
// Configure tiles
|
|
64
|
-
const scheme =
|
|
65
|
-
const schemeTile =
|
|
56
|
+
const scheme = schemeTiles.get(CRS.tms_4326);
|
|
57
|
+
const schemeTile = globalExtentTMS.get('EPSG:4326').subdivisionByScheme(scheme);
|
|
66
58
|
|
|
67
59
|
// Supported tile matrix set for color/elevation layer
|
|
68
|
-
config.tileMatrixSets = [
|
|
60
|
+
config.tileMatrixSets = [CRS.tms_4326, CRS.tms_3857];
|
|
69
61
|
const uvCount = config.tileMatrixSets.length;
|
|
70
|
-
const builder = new
|
|
62
|
+
const builder = new BuilderEllipsoidTile({
|
|
71
63
|
crs: 'EPSG:4978',
|
|
72
64
|
uvCount
|
|
73
65
|
});
|
|
@@ -87,7 +79,7 @@ class GlobeLayer extends _TiledGeometryLayer.default {
|
|
|
87
79
|
// This method assumes that the globe is a unit sphere at 0,0,0 so
|
|
88
80
|
// we setup a world-to-scaled-ellipsoid matrix4
|
|
89
81
|
worldToScaledEllipsoid.copy(this.object3d.matrixWorld).invert();
|
|
90
|
-
worldToScaledEllipsoid.premultiply(new THREE.Matrix4().makeScale(1 /
|
|
82
|
+
worldToScaledEllipsoid.premultiply(new THREE.Matrix4().makeScale(1 / ellipsoidSizes.x, 1 / ellipsoidSizes.y, 1 / ellipsoidSizes.z));
|
|
91
83
|
}
|
|
92
84
|
preUpdate(context, changeSources) {
|
|
93
85
|
// pre-horizon culling
|
|
@@ -110,7 +102,7 @@ class GlobeLayer extends _TiledGeometryLayer.default {
|
|
|
110
102
|
}
|
|
111
103
|
subdivision(context, layer, node) {
|
|
112
104
|
if (node.level == 5) {
|
|
113
|
-
const row = node.getExtentsByProjection(
|
|
105
|
+
const row = node.getExtentsByProjection(CRS.tms_4326)[0].row;
|
|
114
106
|
if (row == 31 || row == 0) {
|
|
115
107
|
// doesn't subdivise the pole
|
|
116
108
|
return false;
|
|
@@ -137,11 +129,11 @@ class GlobeLayer extends _TiledGeometryLayer.default {
|
|
|
137
129
|
return isOccluded;
|
|
138
130
|
}
|
|
139
131
|
computeTileZoomFromDistanceCamera(distance, camera) {
|
|
140
|
-
const preSinus =
|
|
132
|
+
const preSinus = SIZE_DIAGONAL_TEXTURE * (this.sseSubdivisionThreshold * 0.5) / camera._preSSE / ellipsoidSizes.x;
|
|
141
133
|
let sinus = distance * preSinus;
|
|
142
134
|
let zoom = Math.log(Math.PI / (2.0 * Math.asin(sinus))) / Math.log(2);
|
|
143
135
|
const delta = Math.PI / 2 ** zoom;
|
|
144
|
-
const circleChord = 2.0 *
|
|
136
|
+
const circleChord = 2.0 * ellipsoidSizes.x * Math.sin(delta * 0.5);
|
|
145
137
|
// adjust with bounding sphere rayon
|
|
146
138
|
sinus = (distance - circleChord * 0.5) * preSinus;
|
|
147
139
|
zoom = Math.log(Math.PI / (2.0 * Math.asin(sinus))) / Math.log(2);
|
|
@@ -149,10 +141,9 @@ class GlobeLayer extends _TiledGeometryLayer.default {
|
|
|
149
141
|
}
|
|
150
142
|
computeDistanceCameraFromTileZoom(zoom, camera) {
|
|
151
143
|
const delta = Math.PI / 2 ** zoom;
|
|
152
|
-
const circleChord = 2.0 *
|
|
144
|
+
const circleChord = 2.0 * ellipsoidSizes.x * Math.sin(delta * 0.5);
|
|
153
145
|
const radius = circleChord * 0.5;
|
|
154
|
-
return camera._preSSE * (radius /
|
|
146
|
+
return camera._preSSE * (radius / SIZE_DIAGONAL_TEXTURE) / (this.sseSubdivisionThreshold * 0.5) + radius;
|
|
155
147
|
}
|
|
156
148
|
}
|
|
157
|
-
|
|
158
|
-
exports.default = _default;
|
|
149
|
+
export default GlobeLayer;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
1
|
/**
|
|
11
2
|
* @author zz85 / https://github.com/zz85
|
|
12
3
|
*
|
|
@@ -23,6 +14,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
14
|
* Three.js integration by zz85 http://twitter.com/blurspline
|
|
24
15
|
*/
|
|
25
16
|
|
|
17
|
+
import * as THREE from 'three';
|
|
26
18
|
const skyShader = {
|
|
27
19
|
uniforms: {
|
|
28
20
|
luminance: {
|
|
@@ -83,5 +75,4 @@ class Sky extends THREE.Mesh {
|
|
|
83
75
|
super(skyGeo, skyMat);
|
|
84
76
|
}
|
|
85
77
|
}
|
|
86
|
-
|
|
87
|
-
exports.default = _default;
|
|
78
|
+
export default Sky;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import View, { VIEW_EVENTS } from "../View.js";
|
|
3
|
+
import GlobeControls from "../../Controls/GlobeControls.js";
|
|
4
|
+
import Coordinates from "../Geographic/Coordinates.js";
|
|
5
|
+
import GlobeLayer from "./Globe/GlobeLayer.js";
|
|
6
|
+
import Atmosphere from "./Globe/Atmosphere.js";
|
|
7
|
+
import CameraUtils from "../../Utils/CameraUtils.js";
|
|
8
|
+
import CRS from "../Geographic/Crs.js";
|
|
9
|
+
import { ellipsoidSizes } from "../Math/Ellipsoid.js";
|
|
2
10
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.GLOBE_VIEW_EVENTS = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _View = _interopRequireWildcard(require("../View"));
|
|
10
|
-
var _GlobeControls = _interopRequireDefault(require("../../Controls/GlobeControls"));
|
|
11
|
-
var _Coordinates = _interopRequireDefault(require("../Geographic/Coordinates"));
|
|
12
|
-
var _GlobeLayer = _interopRequireDefault(require("./Globe/GlobeLayer"));
|
|
13
|
-
var _Atmosphere = _interopRequireDefault(require("./Globe/Atmosphere"));
|
|
14
|
-
var _CameraUtils = _interopRequireDefault(require("../../Utils/CameraUtils"));
|
|
15
|
-
var _Crs = _interopRequireDefault(require("../Geographic/Crs"));
|
|
16
|
-
var _Ellipsoid = require("../Math/Ellipsoid");
|
|
17
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
11
|
/**
|
|
20
12
|
* Fires when the view is completely loaded. Controls and view's functions can be called then.
|
|
21
13
|
* @event GlobeView#initialized
|
|
@@ -61,14 +53,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
61
53
|
* @property COLOR_LAYERS_ORDER_CHANGED {string} Deprecated: emit when color layers order change (use VIEW_EVENTS.COLOR_LAYERS_ORDER_CHANGED instead).
|
|
62
54
|
*/
|
|
63
55
|
|
|
64
|
-
const GLOBE_VIEW_EVENTS = {
|
|
65
|
-
GLOBE_INITIALIZED:
|
|
66
|
-
LAYER_ADDED:
|
|
67
|
-
LAYER_REMOVED:
|
|
68
|
-
COLOR_LAYERS_ORDER_CHANGED:
|
|
56
|
+
export const GLOBE_VIEW_EVENTS = {
|
|
57
|
+
GLOBE_INITIALIZED: VIEW_EVENTS.INITIALIZED,
|
|
58
|
+
LAYER_ADDED: VIEW_EVENTS.LAYER_ADDED,
|
|
59
|
+
LAYER_REMOVED: VIEW_EVENTS.LAYER_REMOVED,
|
|
60
|
+
COLOR_LAYERS_ORDER_CHANGED: VIEW_EVENTS.COLOR_LAYERS_ORDER_CHANGED
|
|
69
61
|
};
|
|
70
|
-
|
|
71
|
-
class GlobeView extends _View.default {
|
|
62
|
+
class GlobeView extends View {
|
|
72
63
|
/**
|
|
73
64
|
* Creates a view of a globe.
|
|
74
65
|
*
|
|
@@ -104,9 +95,9 @@ class GlobeView extends _View.default {
|
|
|
104
95
|
// Setup View
|
|
105
96
|
super('EPSG:4978', viewerDiv, options);
|
|
106
97
|
this.isGlobeView = true;
|
|
107
|
-
this.camera3D.near = Math.max(15.0, 0.000002352 *
|
|
108
|
-
this.camera3D.far =
|
|
109
|
-
const tileLayer = new
|
|
98
|
+
this.camera3D.near = Math.max(15.0, 0.000002352 * ellipsoidSizes.x);
|
|
99
|
+
this.camera3D.far = ellipsoidSizes.x * 10;
|
|
100
|
+
const tileLayer = new GlobeLayer('globe', options.object3d, options);
|
|
110
101
|
this.mainLoop.gfxEngine.label2dRenderer.infoTileLayer = tileLayer.info;
|
|
111
102
|
const sun = new THREE.DirectionalLight();
|
|
112
103
|
sun.position.set(-0.5, 0, 1);
|
|
@@ -115,18 +106,18 @@ class GlobeView extends _View.default {
|
|
|
115
106
|
this.addLayer(tileLayer);
|
|
116
107
|
this.tileLayer = tileLayer;
|
|
117
108
|
if (!placement.isExtent) {
|
|
118
|
-
placement.coord = placement.coord || new
|
|
109
|
+
placement.coord = placement.coord || new Coordinates('EPSG:4326', 0, 0);
|
|
119
110
|
placement.tilt = placement.tilt || 89.5;
|
|
120
111
|
placement.heading = placement.heading || 0;
|
|
121
|
-
placement.range = placement.range ||
|
|
112
|
+
placement.range = placement.range || ellipsoidSizes.x * 2.0;
|
|
122
113
|
}
|
|
123
114
|
if (options.noControls) {
|
|
124
|
-
|
|
115
|
+
CameraUtils.transformCameraToLookAtTarget(this, this.camera3D, placement);
|
|
125
116
|
} else {
|
|
126
|
-
this.controls = new
|
|
117
|
+
this.controls = new GlobeControls(this, placement, options.controls);
|
|
127
118
|
this.controls.handleCollision = typeof options.handleCollision !== 'undefined' ? options.handleCollision : true;
|
|
128
119
|
}
|
|
129
|
-
this.addLayer(new
|
|
120
|
+
this.addLayer(new Atmosphere('atmosphere', options.atmosphere));
|
|
130
121
|
|
|
131
122
|
// GlobeView needs this.camera.resize to set perpsective matrix camera
|
|
132
123
|
this.camera.resize(viewerDiv.clientWidth, viewerDiv.clientHeight);
|
|
@@ -151,11 +142,11 @@ class GlobeView extends _View.default {
|
|
|
151
142
|
return Promise.reject(new Error('Add Layer type object'));
|
|
152
143
|
}
|
|
153
144
|
if (layer.isColorLayer) {
|
|
154
|
-
if (!this.tileLayer.tileMatrixSets.includes(
|
|
145
|
+
if (!this.tileLayer.tileMatrixSets.includes(CRS.formatToTms(layer.source.crs))) {
|
|
155
146
|
return layer._reject(`Only ${this.tileLayer.tileMatrixSets} tileMatrixSet are currently supported for color layers`);
|
|
156
147
|
}
|
|
157
148
|
} else if (layer.isElevationLayer) {
|
|
158
|
-
if (
|
|
149
|
+
if (CRS.formatToTms(layer.source.crs) !== this.tileLayer.tileMatrixSets[0]) {
|
|
159
150
|
return layer._reject(`Only ${this.tileLayer.tileMatrixSets[0]} tileMatrixSet is currently supported for elevation layers`);
|
|
160
151
|
}
|
|
161
152
|
}
|
|
@@ -173,8 +164,7 @@ class GlobeView extends _View.default {
|
|
|
173
164
|
}
|
|
174
165
|
getMetersToDegrees() {
|
|
175
166
|
let meters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
176
|
-
return THREE.MathUtils.radToDeg(2 * Math.asin(meters / (2 *
|
|
167
|
+
return THREE.MathUtils.radToDeg(2 * Math.asin(meters / (2 * ellipsoidSizes.x)));
|
|
177
168
|
}
|
|
178
169
|
}
|
|
179
|
-
|
|
180
|
-
exports.default = _default;
|
|
170
|
+
export default GlobeView;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import TiledGeometryLayer from "../../../Layer/TiledGeometryLayer.js";
|
|
3
|
+
import { globalExtentTMS } from "../../Geographic/Extent.js";
|
|
4
|
+
import CRS from "../../Geographic/Crs.js";
|
|
5
|
+
import PlanarTileBuilder from "./PlanarTileBuilder.js";
|
|
2
6
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _TiledGeometryLayer = _interopRequireDefault(require("../../../Layer/TiledGeometryLayer"));
|
|
10
|
-
var _Extent = require("../../Geographic/Extent");
|
|
11
|
-
var _Crs = _interopRequireDefault(require("../../Geographic/Crs"));
|
|
12
|
-
var _PlanarTileBuilder = _interopRequireDefault(require("./PlanarTileBuilder"));
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
7
|
/**
|
|
16
8
|
* @property {boolean} isPlanarLayer - Used to checkout whether this layer is a
|
|
17
9
|
* PlanarLayer. Default is true. You should not change this, as it is used
|
|
18
10
|
* internally for optimisation.
|
|
19
11
|
*/
|
|
20
|
-
class PlanarLayer extends
|
|
12
|
+
class PlanarLayer extends TiledGeometryLayer {
|
|
21
13
|
/**
|
|
22
14
|
* A {@link TiledGeometryLayer} to use with a {@link PlanarView}. It has
|
|
23
15
|
* specific method for updating and subdivising its grid.
|
|
@@ -46,13 +38,13 @@ class PlanarLayer extends _TiledGeometryLayer.default {
|
|
|
46
38
|
*/
|
|
47
39
|
constructor(id, extent, object3d) {
|
|
48
40
|
let config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
49
|
-
const tms =
|
|
50
|
-
if (!
|
|
41
|
+
const tms = CRS.formatToTms(extent.crs);
|
|
42
|
+
if (!globalExtentTMS.get(extent.crs)) {
|
|
51
43
|
// Add new global extent for this new crs projection.
|
|
52
|
-
|
|
44
|
+
globalExtentTMS.set(extent.crs, extent);
|
|
53
45
|
}
|
|
54
46
|
config.tileMatrixSets = [tms];
|
|
55
|
-
super(id, object3d || new THREE.Group(), [extent], new
|
|
47
|
+
super(id, object3d || new THREE.Group(), [extent], new PlanarTileBuilder({
|
|
56
48
|
crs: extent.crs
|
|
57
49
|
}), config);
|
|
58
50
|
this.isPlanarLayer = true;
|
|
@@ -62,5 +54,4 @@ class PlanarLayer extends _TiledGeometryLayer.default {
|
|
|
62
54
|
this.maxDeltaElevationLevel = this.maxDeltaElevationLevel || 4.0;
|
|
63
55
|
}
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
exports.default = _default;
|
|
57
|
+
export default PlanarLayer;
|