itowns 2.45.1 → 2.45.2-next.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/dist/455.js +1 -1
- package/dist/455.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +8 -2
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.LICENSE.txt +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_lasparser.js +1 -1
- package/dist/itowns_lasparser.js.map +1 -1
- package/dist/itowns_lasworker.js +1 -1
- package/dist/itowns_lasworker.js.map +1 -1
- package/dist/itowns_potree2worker.js +1 -1
- package/dist/itowns_potree2worker.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/copc_simple_loader.html +3 -3
- package/examples/entwine_3d_loader.html +2 -2
- package/examples/entwine_simple_loader.html +10 -6
- package/examples/view_3d_map_webxr.html +2 -5
- package/lib/Controls/FirstPersonControls.d.ts +90 -0
- package/lib/Controls/FlyControls.d.ts +36 -0
- package/lib/Controls/GlobeControls.d.ts +274 -0
- package/lib/Controls/PlanarControls.d.ts +339 -0
- package/lib/Controls/StateControl.d.ts +140 -0
- package/lib/Controls/StreetControls.d.ts +134 -0
- package/lib/Controls/VRControls.d.ts +56 -0
- package/lib/Controls/VRControls.js +409 -0
- package/lib/Converter/Feature2Mesh.d.ts +42 -0
- package/lib/Converter/Feature2Texture.d.ts +5 -0
- package/lib/Converter/convertToTile.d.ts +5 -0
- package/lib/Converter/convertToTile.js +2 -2
- package/lib/Converter/textureConverter.d.ts +4 -0
- package/lib/Core/3DTiles/C3DTBatchTable.d.ts +49 -0
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.d.ts +37 -0
- package/lib/Core/3DTiles/C3DTBoundingVolume.d.ts +39 -0
- package/lib/Core/3DTiles/C3DTExtensions.d.ts +75 -0
- package/lib/Core/3DTiles/C3DTFeature.d.ts +47 -0
- package/lib/Core/3DTiles/C3DTilesEnums.d.ts +14 -0
- package/lib/Core/3DTiles/C3DTileset.d.ts +46 -0
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.d.ts +14 -0
- package/lib/Core/AnimationPlayer.d.ts +53 -0
- package/lib/Core/CopcNode.d.ts +67 -0
- package/lib/Core/CopcNode.js +50 -69
- package/lib/Core/Deprecated/Undeprecator.d.ts +6 -0
- package/lib/Core/EntwinePointTileNode.d.ts +58 -0
- package/lib/Core/EntwinePointTileNode.js +6 -34
- package/lib/Core/Feature.d.ts +323 -0
- package/lib/Core/Geographic/GeoidGrid.d.ts +86 -0
- package/lib/Core/Label.d.ts +86 -0
- package/lib/Core/MainLoop.d.ts +23 -0
- package/lib/Core/Picking.d.ts +6 -0
- package/lib/Core/Picking.js +4 -0
- package/lib/Core/PointCloudNode.d.ts +14 -0
- package/lib/Core/PointCloudNode.js +28 -0
- package/lib/Core/Potree2Node.d.ts +11 -0
- package/lib/Core/Potree2Node.js +3 -57
- package/lib/Core/Potree2PointAttributes.d.ts +97 -0
- package/lib/Core/PotreeNode.d.ts +13 -0
- package/lib/Core/PotreeNode.js +17 -17
- package/lib/Core/Prefab/Globe/Atmosphere.d.ts +66 -0
- package/lib/Core/Prefab/Globe/Atmosphere.js +10 -5
- package/lib/Core/Prefab/Globe/GlobeLayer.d.ts +48 -0
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.d.ts +38 -0
- package/lib/Core/Prefab/Globe/SkyShader.d.ts +5 -0
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -3
- package/lib/Core/Prefab/GlobeView.d.ts +65 -0
- package/lib/Core/Prefab/GlobeView.js +9 -0
- package/lib/Core/Prefab/Planar/PlanarLayer.d.ts +38 -0
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.d.ts +32 -0
- package/lib/Core/Prefab/PlanarView.d.ts +33 -0
- package/lib/Core/Prefab/TileBuilder.d.ts +63 -0
- package/lib/Core/Prefab/computeBufferTileGeometry.d.ts +17 -0
- package/lib/Core/Scheduler/Cache.d.ts +25 -0
- package/lib/Core/Scheduler/CancelledCommandException.d.ts +12 -0
- package/lib/Core/Scheduler/Scheduler.d.ts +106 -0
- package/lib/Core/Style.d.ts +248 -0
- package/lib/Core/StyleOptions.d.ts +455 -0
- package/lib/Core/System/Capabilities.d.ts +9 -0
- package/lib/Core/Tile/Tile.d.ts +70 -0
- package/lib/Core/Tile/TileGrid.d.ts +12 -0
- package/lib/Core/TileGeometry.d.ts +46 -0
- package/lib/Core/TileMesh.d.ts +50 -0
- package/lib/Core/TileMesh.js +2 -4
- package/lib/Core/View.d.ts +403 -0
- package/lib/Core/View.js +1 -7
- package/lib/Layer/C3DTilesLayer.d.ts +140 -0
- package/lib/Layer/ColorLayer.d.ts +128 -0
- package/lib/Layer/ColorLayer.js +4 -4
- package/lib/Layer/CopcLayer.d.ts +42 -0
- package/lib/Layer/CopcLayer.js +3 -6
- package/lib/Layer/ElevationLayer.d.ts +96 -0
- package/lib/Layer/ElevationLayer.js +3 -3
- package/lib/Layer/EntwinePointTileLayer.d.ts +56 -0
- package/lib/Layer/EntwinePointTileLayer.js +4 -3
- package/lib/Layer/FeatureGeometryLayer.d.ts +62 -0
- package/lib/Layer/GeoidLayer.d.ts +41 -0
- package/lib/Layer/GeometryLayer.d.ts +120 -0
- package/lib/Layer/InfoLayer.d.ts +24 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/LabelLayer.d.ts +93 -0
- package/lib/Layer/LabelLayer.js +2 -2
- package/lib/Layer/Layer.d.ts +185 -0
- package/lib/Layer/LayerUpdateState.d.ts +24 -0
- package/lib/Layer/LayerUpdateStrategy.d.ts +11 -0
- package/lib/Layer/LayerUpdateStrategy.js +2 -7
- package/lib/Layer/OGC3DTilesLayer.d.ts +277 -0
- package/lib/Layer/OGC3DTilesLayer.js +21 -0
- package/lib/Layer/OrientedImageLayer.d.ts +53 -0
- package/lib/Layer/PointCloudLayer.d.ts +103 -0
- package/lib/Layer/PointCloudLayer.js +1 -1
- package/lib/Layer/Potree2Layer.d.ts +56 -0
- package/lib/Layer/PotreeLayer.d.ts +55 -0
- package/lib/Layer/RasterLayer.d.ts +8 -0
- package/lib/Layer/RasterLayer.js +2 -2
- package/lib/Layer/ReferencingLayerProperties.d.ts +2 -0
- package/lib/Layer/ReferencingLayerProperties.js +0 -12
- package/lib/Layer/TiledGeometryLayer.d.ts +192 -0
- package/lib/Layer/TiledGeometryLayer.js +4 -3
- package/lib/Main.d.ts +89 -0
- package/lib/Main.js +3 -1
- package/lib/Parser/B3dmParser.d.ts +26 -0
- package/lib/Parser/CameraCalibrationParser.d.ts +32 -0
- package/lib/Parser/GDFParser.d.ts +24 -0
- package/lib/Parser/GTXParser.d.ts +28 -0
- package/lib/Parser/GeoJsonParser.d.ts +12 -0
- package/lib/Parser/GpxParser.d.ts +12 -0
- package/lib/Parser/ISGParser.d.ts +23 -0
- package/lib/Parser/KMLParser.d.ts +12 -0
- package/lib/Parser/LASParser.d.ts +61 -0
- package/lib/Parser/MapBoxUrlParser.d.ts +9 -0
- package/lib/Parser/PntsParser.d.ts +4 -0
- package/lib/Parser/Potree2BinParser.d.ts +8 -0
- package/lib/Parser/PotreeBinParser.d.ts +4 -0
- package/lib/Parser/PotreeCinParser.d.ts +4 -0
- package/lib/Parser/ShapefileParser.d.ts +25 -0
- package/lib/Parser/VectorTileParser.d.ts +34 -0
- package/lib/Parser/XbilParser.d.ts +18 -0
- package/lib/Parser/deprecated/LegacyGLTFLoader.d.ts +32 -0
- package/lib/Parser/iGLTFLoader.d.ts +104 -0
- package/lib/Process/3dTilesProcessing.d.ts +43 -0
- package/lib/Process/FeatureProcessing.d.ts +4 -0
- package/lib/Process/LayeredMaterialNodeProcessing.d.ts +3 -0
- package/lib/Process/LayeredMaterialNodeProcessing.js +12 -12
- package/lib/Process/ObjectRemovalHelper.d.ts +32 -0
- package/lib/Process/handlerNodeError.d.ts +1 -0
- package/lib/Provider/3dTilesProvider.d.ts +7 -0
- package/lib/Provider/DataSourceProvider.d.ts +4 -0
- package/lib/Provider/Fetcher.d.ts +101 -0
- package/lib/Provider/PointCloudProvider.d.ts +4 -0
- package/lib/Provider/TileProvider.d.ts +4 -0
- package/lib/Provider/URLBuilder.d.ts +28 -0
- package/lib/Renderer/Camera.d.ts +95 -0
- package/lib/Renderer/Color.d.ts +3 -0
- package/lib/Renderer/ColorLayersOrdering.d.ts +38 -0
- package/lib/Renderer/ColorLayersOrdering.js +2 -2
- package/lib/Renderer/CommonMaterial.d.ts +6 -0
- package/lib/Renderer/Label2DRenderer.d.ts +31 -0
- package/lib/Renderer/LayeredMaterial.d.ts +121 -0
- package/lib/Renderer/LayeredMaterial.js +221 -141
- package/lib/Renderer/OBB.d.ts +65 -0
- package/lib/Renderer/OrientedImageCamera.d.ts +36 -0
- package/lib/Renderer/OrientedImageMaterial.d.ts +68 -0
- package/lib/Renderer/PointsMaterial.d.ts +226 -0
- package/lib/Renderer/PointsMaterial.js +60 -22
- package/lib/Renderer/RasterTile.d.ts +53 -0
- package/lib/Renderer/RasterTile.js +8 -9
- package/lib/Renderer/RenderMode.d.ts +11 -0
- package/lib/Renderer/RenderMode.js +1 -0
- package/lib/Renderer/Shader/ShaderChunk.d.ts +78 -0
- package/lib/Renderer/Shader/ShaderUtils.d.ts +5 -0
- package/lib/Renderer/WebXR.d.ts +33 -0
- package/lib/Renderer/WebXR.js +128 -47
- package/lib/Renderer/c3DEngine.d.ts +55 -0
- package/lib/Renderer/c3DEngine.js +5 -1
- package/lib/Source/C3DTilesGoogleSource.d.ts +38 -0
- package/lib/Source/C3DTilesIonSource.d.ts +31 -0
- package/lib/Source/C3DTilesSource.d.ts +17 -0
- package/lib/Source/CopcSource.d.ts +79 -0
- package/lib/Source/EntwinePointTileSource.d.ts +40 -0
- package/lib/Source/EntwinePointTileSource.js +0 -5
- package/lib/Source/FileSource.d.ts +118 -0
- package/lib/Source/OGC3DTilesGoogleSource.d.ts +24 -0
- package/lib/Source/OGC3DTilesIonSource.d.ts +26 -0
- package/lib/Source/OGC3DTilesSource.d.ts +21 -0
- package/lib/Source/OrientedImageSource.d.ts +48 -0
- package/lib/Source/Potree2Source.d.ts +157 -0
- package/lib/Source/PotreeSource.d.ts +69 -0
- package/lib/Source/Source.d.ts +122 -0
- package/lib/Source/TMSSource.d.ts +77 -0
- package/lib/Source/VectorTilesSource.d.ts +56 -0
- package/lib/Source/WFSSource.d.ts +110 -0
- package/lib/Source/WMSSource.d.ts +85 -0
- package/lib/Source/WMTSSource.d.ts +65 -0
- package/lib/ThreeExtended/capabilities/WebGL.d.ts +9 -0
- package/lib/ThreeExtended/libs/ktx-parse.module.d.ts +274 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.d.ts +64 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.js +375 -0
- package/lib/ThreeExtended/libs/zstddec.module.d.ts +6 -0
- package/lib/ThreeExtended/loaders/DDSLoader.js +40 -1
- package/lib/ThreeExtended/loaders/DRACOLoader.d.ts +41 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.d.ts +16 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.js +22 -3
- package/lib/ThreeExtended/loaders/KTX2Loader.d.ts +116 -0
- package/lib/ThreeExtended/loaders/KTX2Loader.js +9 -2
- package/lib/ThreeExtended/math/ColorSpaces.d.ts +56 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.d.ts +62 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +2 -2
- package/lib/ThreeExtended/utils/WorkerPool.d.ts +19 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.d.ts +25 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.js +209 -0
- package/lib/Utils/CameraUtils.d.ts +132 -0
- package/lib/Utils/DEMUtils.d.ts +84 -0
- package/lib/Utils/DEMUtils.js +2 -2
- package/lib/Utils/FeaturesUtils.d.ts +17 -0
- package/lib/Utils/Gradients.d.ts +13 -0
- package/lib/Utils/ThreeUtils.d.ts +14 -0
- package/lib/Utils/placeObjectOnGround.d.ts +28 -0
- package/lib/global.d.js +0 -0
- package/package.json +18 -15
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export class Potree2PointAttributes {
|
|
2
|
+
attributes: any[];
|
|
3
|
+
byteSize: number;
|
|
4
|
+
size: number;
|
|
5
|
+
vectors: any[];
|
|
6
|
+
add(pointAttribute: any): void;
|
|
7
|
+
addVector(vector: any): void;
|
|
8
|
+
hasNormals(): boolean;
|
|
9
|
+
}
|
|
10
|
+
export namespace PointAttributeTypes {
|
|
11
|
+
namespace DATA_TYPE_DOUBLE {
|
|
12
|
+
let name: string;
|
|
13
|
+
let size: number;
|
|
14
|
+
}
|
|
15
|
+
namespace DATA_TYPE_FLOAT {
|
|
16
|
+
let name_1: string;
|
|
17
|
+
export { name_1 as name };
|
|
18
|
+
let size_1: number;
|
|
19
|
+
export { size_1 as size };
|
|
20
|
+
}
|
|
21
|
+
namespace DATA_TYPE_INT8 {
|
|
22
|
+
let name_2: string;
|
|
23
|
+
export { name_2 as name };
|
|
24
|
+
let size_2: number;
|
|
25
|
+
export { size_2 as size };
|
|
26
|
+
}
|
|
27
|
+
namespace DATA_TYPE_UINT8 {
|
|
28
|
+
let name_3: string;
|
|
29
|
+
export { name_3 as name };
|
|
30
|
+
let size_3: number;
|
|
31
|
+
export { size_3 as size };
|
|
32
|
+
}
|
|
33
|
+
namespace DATA_TYPE_INT16 {
|
|
34
|
+
let name_4: string;
|
|
35
|
+
export { name_4 as name };
|
|
36
|
+
let size_4: number;
|
|
37
|
+
export { size_4 as size };
|
|
38
|
+
}
|
|
39
|
+
namespace DATA_TYPE_UINT16 {
|
|
40
|
+
let name_5: string;
|
|
41
|
+
export { name_5 as name };
|
|
42
|
+
let size_5: number;
|
|
43
|
+
export { size_5 as size };
|
|
44
|
+
}
|
|
45
|
+
namespace DATA_TYPE_INT32 {
|
|
46
|
+
let name_6: string;
|
|
47
|
+
export { name_6 as name };
|
|
48
|
+
let size_6: number;
|
|
49
|
+
export { size_6 as size };
|
|
50
|
+
}
|
|
51
|
+
namespace DATA_TYPE_UINT32 {
|
|
52
|
+
let name_7: string;
|
|
53
|
+
export { name_7 as name };
|
|
54
|
+
let size_7: number;
|
|
55
|
+
export { size_7 as size };
|
|
56
|
+
}
|
|
57
|
+
namespace DATA_TYPE_INT64 {
|
|
58
|
+
let name_8: string;
|
|
59
|
+
export { name_8 as name };
|
|
60
|
+
let size_8: number;
|
|
61
|
+
export { size_8 as size };
|
|
62
|
+
}
|
|
63
|
+
namespace DATA_TYPE_UINT64 {
|
|
64
|
+
let name_9: string;
|
|
65
|
+
export { name_9 as name };
|
|
66
|
+
let size_9: number;
|
|
67
|
+
export { size_9 as size };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export class PointAttribute {
|
|
71
|
+
constructor(name: any, type: any, numElements: any);
|
|
72
|
+
name: any;
|
|
73
|
+
type: any;
|
|
74
|
+
numElements: any;
|
|
75
|
+
byteSize: number;
|
|
76
|
+
description: string;
|
|
77
|
+
range: number[];
|
|
78
|
+
}
|
|
79
|
+
export namespace PointAttribute {
|
|
80
|
+
export let POSITION_CARTESIAN: PointAttribute;
|
|
81
|
+
export let RGBA_PACKED: PointAttribute;
|
|
82
|
+
import COLOR_PACKED = RGBA_PACKED;
|
|
83
|
+
export { COLOR_PACKED };
|
|
84
|
+
export let RGB_PACKED: PointAttribute;
|
|
85
|
+
export let NORMAL_FLOATS: PointAttribute;
|
|
86
|
+
export let INTENSITY: PointAttribute;
|
|
87
|
+
export let CLASSIFICATION: PointAttribute;
|
|
88
|
+
export let NORMAL_SPHEREMAPPED: PointAttribute;
|
|
89
|
+
export let NORMAL_OCT16: PointAttribute;
|
|
90
|
+
export let NORMAL: PointAttribute;
|
|
91
|
+
export let RETURN_NUMBER: PointAttribute;
|
|
92
|
+
export let NUMBER_OF_RETURNS: PointAttribute;
|
|
93
|
+
export let SOURCE_ID: PointAttribute;
|
|
94
|
+
export let INDICES: PointAttribute;
|
|
95
|
+
export let SPACING: PointAttribute;
|
|
96
|
+
export let GPS_TIME: PointAttribute;
|
|
97
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default PotreeNode;
|
|
2
|
+
declare class PotreeNode extends PointCloudNode {
|
|
3
|
+
constructor(numPoints: number | undefined, childrenBitField: number | undefined, layer: any);
|
|
4
|
+
childrenBitField: number;
|
|
5
|
+
id: string;
|
|
6
|
+
depth: number;
|
|
7
|
+
baseurl: any;
|
|
8
|
+
get octreeIsLoaded(): boolean;
|
|
9
|
+
get url(): string;
|
|
10
|
+
createChildAABB(node: any, childIndex: any): void;
|
|
11
|
+
loadOctree(): any;
|
|
12
|
+
}
|
|
13
|
+
import PointCloudNode from '../Core/PointCloudNode';
|
package/lib/Core/PotreeNode.js
CHANGED
|
@@ -16,15 +16,16 @@ class PotreeNode extends PointCloudNode {
|
|
|
16
16
|
this.depth = 0;
|
|
17
17
|
this.baseurl = layer.source.baseurl;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
get octreeIsLoaded() {
|
|
20
|
+
return !(this.childrenBitField && this.children.length === 0);
|
|
21
|
+
}
|
|
22
|
+
get url() {
|
|
23
|
+
return `${this.baseurl}/r${this.id}.${this.layer.source.extension}`;
|
|
24
|
+
}
|
|
25
|
+
add(node, indexChild) {
|
|
21
26
|
node.id = this.id + indexChild;
|
|
22
|
-
node.depth =
|
|
23
|
-
|
|
24
|
-
node.baseurl = `${root.baseurl}/${node.id.substr(root.id.length)}`;
|
|
25
|
-
} else {
|
|
26
|
-
node.baseurl = root.baseurl;
|
|
27
|
-
}
|
|
27
|
+
node.depth = this.depth + 1;
|
|
28
|
+
super.add(node, indexChild);
|
|
28
29
|
}
|
|
29
30
|
createChildAABB(node, childIndex) {
|
|
30
31
|
// Code inspired from potree
|
|
@@ -62,12 +63,6 @@ class PotreeNode extends PointCloudNode {
|
|
|
62
63
|
node.bbox.max.x += dHalfLength.x;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
get octreeIsLoaded() {
|
|
66
|
-
return !(this.childrenBitField && this.children.length === 0);
|
|
67
|
-
}
|
|
68
|
-
get url() {
|
|
69
|
-
return `${this.baseurl}/r${this.id}.${this.layer.source.extension}`;
|
|
70
|
-
}
|
|
71
66
|
loadOctree() {
|
|
72
67
|
const octreeUrl = `${this.baseurl}/r${this.id}.${this.layer.source.extensionOctree}`;
|
|
73
68
|
return this.layer.source.fetcher(octreeUrl, this.layer.source.networkOptions).then(blob => {
|
|
@@ -89,9 +84,14 @@ class PotreeNode extends PointCloudNode {
|
|
|
89
84
|
offset += 1;
|
|
90
85
|
const numPoints = view.getUint32(offset, true) || this.numPoints;
|
|
91
86
|
offset += 4;
|
|
92
|
-
const
|
|
93
|
-
snode.add(
|
|
94
|
-
|
|
87
|
+
const child = new PotreeNode(numPoints, childrenBitField, this.layer);
|
|
88
|
+
snode.add(child, indexChild);
|
|
89
|
+
if (child.id.length % this.layer.hierarchyStepSize == 0) {
|
|
90
|
+
child.baseurl = `${this.baseurl}/${child.id}`;
|
|
91
|
+
} else {
|
|
92
|
+
child.baseurl = this.baseurl;
|
|
93
|
+
}
|
|
94
|
+
stack.push(child);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export default Atmosphere;
|
|
2
|
+
/**
|
|
3
|
+
* @extends GeometryLayer
|
|
4
|
+
*/
|
|
5
|
+
declare class Atmosphere extends GeometryLayer {
|
|
6
|
+
/**
|
|
7
|
+
* It's layer to simulate Globe atmosphere.
|
|
8
|
+
* There's 2 modes : simple and realistic (atmospheric-scattering).
|
|
9
|
+
*
|
|
10
|
+
* The atmospheric-scattering it is taken from :
|
|
11
|
+
* * [Atmosphere Shader From Space (Atmospheric scattering)](http://stainlessbeer.weebly.com/planets-9-atmospheric-scattering.html)
|
|
12
|
+
* * [Accurate Atmospheric Scattering (NVIDIA GPU Gems 2)](https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering).
|
|
13
|
+
*
|
|
14
|
+
* @param {string} id - The id of the layer Atmosphere.
|
|
15
|
+
* @param {Object} [options] - options layer.
|
|
16
|
+
* @param {number} [options.Kr] - `Kr` is the rayleigh scattering constant.
|
|
17
|
+
* @param {number} [options.Km] - `Km` is the Mie scattering constant.
|
|
18
|
+
* @param {number} [options.ESun] - `ESun` is the brightness of the sun.
|
|
19
|
+
* @param {number} [options.g] - constant `g` that affects the symmetry of the scattering.
|
|
20
|
+
* @param {number} [options.innerRadius] - The inner (planetary) radius
|
|
21
|
+
* @param {number} [options.outerRadius] - The outer (Atmosphere) radius
|
|
22
|
+
* @param {number[]} [options.wavelength] - The constant is the `wavelength` (or color) of light.
|
|
23
|
+
* @param {number} [options.scaleDepth] - The `scale depth` (i.e. the altitude at which the atmosphere's average density is found).
|
|
24
|
+
* @param {number} [options.mieScaleDepth] - not used.
|
|
25
|
+
*/
|
|
26
|
+
constructor(id?: string, options?: {
|
|
27
|
+
Kr?: number | undefined;
|
|
28
|
+
Km?: number | undefined;
|
|
29
|
+
ESun?: number | undefined;
|
|
30
|
+
g?: number | undefined;
|
|
31
|
+
innerRadius?: number | undefined;
|
|
32
|
+
outerRadius?: number | undefined;
|
|
33
|
+
wavelength?: number[] | undefined;
|
|
34
|
+
scaleDepth?: number | undefined;
|
|
35
|
+
mieScaleDepth?: number | undefined;
|
|
36
|
+
});
|
|
37
|
+
isAtmosphere: boolean;
|
|
38
|
+
basicAtmosphere: THREE.Object3D<THREE.Object3DEventMap>;
|
|
39
|
+
realisticAtmosphere: THREE.Object3D<THREE.Object3DEventMap>;
|
|
40
|
+
realisticLightingPosition: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
z: number;
|
|
44
|
+
};
|
|
45
|
+
fog: {
|
|
46
|
+
enable: boolean;
|
|
47
|
+
distance: number;
|
|
48
|
+
};
|
|
49
|
+
realisticAtmosphereInitParams: {
|
|
50
|
+
Kr?: number | undefined;
|
|
51
|
+
Km?: number | undefined;
|
|
52
|
+
ESun?: number | undefined;
|
|
53
|
+
g?: number | undefined;
|
|
54
|
+
innerRadius?: number | undefined;
|
|
55
|
+
outerRadius?: number | undefined;
|
|
56
|
+
wavelength?: number[] | undefined;
|
|
57
|
+
scaleDepth?: number | undefined;
|
|
58
|
+
mieScaleDepth?: number | undefined;
|
|
59
|
+
};
|
|
60
|
+
update(context: any, layer: any, node: any): void;
|
|
61
|
+
preUpdate(context: any, srcs: any): void;
|
|
62
|
+
_initRealisticLighning(): void;
|
|
63
|
+
setRealisticOn(bool: any): void;
|
|
64
|
+
}
|
|
65
|
+
import GeometryLayer from '../../../Layer/GeometryLayer';
|
|
66
|
+
import * as THREE from 'three';
|
|
@@ -75,6 +75,7 @@ class Atmosphere extends GeometryLayer {
|
|
|
75
75
|
const sphereGeometry = new THREE.SphereGeometry(1, 64, 64);
|
|
76
76
|
const basicAtmosphereOut = new THREE.Mesh(sphereGeometry, material);
|
|
77
77
|
basicAtmosphereOut.scale.copy(ellipsoidSizes).multiplyScalar(1.14);
|
|
78
|
+
basicAtmosphereOut.renderOrder = 1;
|
|
78
79
|
this.basicAtmosphere = new THREE.Object3D();
|
|
79
80
|
this.realisticAtmosphere = new THREE.Object3D();
|
|
80
81
|
this.realisticAtmosphere.visible = false;
|
|
@@ -101,6 +102,7 @@ class Atmosphere extends GeometryLayer {
|
|
|
101
102
|
});
|
|
102
103
|
const basicAtmosphereIn = new THREE.Mesh(sphereGeometry, materialAtmoIn);
|
|
103
104
|
basicAtmosphereIn.scale.copy(ellipsoidSizes).multiplyScalar(1.002);
|
|
105
|
+
basicAtmosphereIn.renderOrder = 2;
|
|
104
106
|
this.basicAtmosphere.add(basicAtmosphereIn);
|
|
105
107
|
this.realisticLightingPosition = {
|
|
106
108
|
x: -0.5,
|
|
@@ -130,9 +132,9 @@ class Atmosphere extends GeometryLayer {
|
|
|
130
132
|
}
|
|
131
133
|
update(context, layer, node) {
|
|
132
134
|
// update uniforms
|
|
133
|
-
node.material.fogDistance
|
|
134
|
-
node.material.lightingEnabled
|
|
135
|
-
node.material.lightPosition
|
|
135
|
+
node.material.setUniform('fogDistance', this.fog.distance);
|
|
136
|
+
node.material.setUniform('lightingEnabled', this.realisticAtmosphere.visible);
|
|
137
|
+
node.material.setUniform('lightPosition', this.realisticLightingPosition);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -245,6 +247,7 @@ class Atmosphere extends GeometryLayer {
|
|
|
245
247
|
depthWrite: false
|
|
246
248
|
});
|
|
247
249
|
const ground = new THREE.Mesh(geometryAtmosphereIn, materialAtmosphereIn);
|
|
250
|
+
ground.renderOrder = 2;
|
|
248
251
|
const geometryAtmosphereOut = new THREE.SphereGeometry(atmosphere.outerRadius, 196, 196);
|
|
249
252
|
const materialAtmosphereOut = new THREE.ShaderMaterial({
|
|
250
253
|
uniforms: uniformsAtmosphere,
|
|
@@ -254,7 +257,9 @@ class Atmosphere extends GeometryLayer {
|
|
|
254
257
|
side: THREE.BackSide
|
|
255
258
|
});
|
|
256
259
|
const sky = new THREE.Mesh(geometryAtmosphereOut, materialAtmosphereOut);
|
|
260
|
+
sky.renderOrder = 1;
|
|
257
261
|
const skyDome = new Sky();
|
|
262
|
+
skyDome.renderOrder = 1;
|
|
258
263
|
skyDome.frustumCulled = false;
|
|
259
264
|
this.realisticAtmosphere.add(ground);
|
|
260
265
|
this.realisticAtmosphere.add(sky);
|
|
@@ -264,7 +269,7 @@ class Atmosphere extends GeometryLayer {
|
|
|
264
269
|
reileigh: 2,
|
|
265
270
|
mieCoefficient: 0.005,
|
|
266
271
|
mieDirectionalG: 0.8,
|
|
267
|
-
|
|
272
|
+
luminanceAtmosphere: 1,
|
|
268
273
|
inclination: 0.49,
|
|
269
274
|
// elevation / inclination
|
|
270
275
|
azimuth: 0.25,
|
|
@@ -273,7 +278,7 @@ class Atmosphere extends GeometryLayer {
|
|
|
273
278
|
};
|
|
274
279
|
skyDome.material.uniforms.turbidity.value = effectController.turbidity;
|
|
275
280
|
skyDome.material.uniforms.reileigh.value = effectController.reileigh;
|
|
276
|
-
skyDome.material.uniforms.
|
|
281
|
+
skyDome.material.uniforms.luminanceAtmosphere.value = effectController.luminanceAtmosphere;
|
|
277
282
|
skyDome.material.uniforms.mieCoefficient.value = effectController.mieCoefficient;
|
|
278
283
|
skyDome.material.uniforms.mieDirectionalG.value = effectController.mieDirectionalG;
|
|
279
284
|
skyDome.material.uniforms.up.value = new THREE.Vector3(); // no more necessary, estimate normal from cam..
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export default GlobeLayer;
|
|
2
|
+
/**
|
|
3
|
+
* @property {boolean} isGlobeLayer - Used to checkout whether this layer is a
|
|
4
|
+
* GlobeLayer. Default is true. You should not change this, as it is used
|
|
5
|
+
* internally for optimisation.
|
|
6
|
+
*
|
|
7
|
+
* @extends TiledGeometryLayer
|
|
8
|
+
*/
|
|
9
|
+
declare class GlobeLayer extends TiledGeometryLayer {
|
|
10
|
+
static horizonCulling(point: any): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* A {@link TiledGeometryLayer} to use with a {@link GlobeView}. It has
|
|
13
|
+
* specific method for updating and subdivising its grid.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} id - The id of the layer, that should be unique. It is
|
|
16
|
+
* not mandatory, but an error will be emitted if this layer is added a
|
|
17
|
+
* {@link View} that already has a layer going by that id.
|
|
18
|
+
* @param {THREE.Object3D} [object3d=THREE.Group] - The object3d used to
|
|
19
|
+
* contain the geometry of the TiledGeometryLayer. It is usually a
|
|
20
|
+
* `THREE.Group`, but it can be anything inheriting from a `THREE.Object3d`.
|
|
21
|
+
* @param {Object} [config] - Optional configuration, all elements in it
|
|
22
|
+
* will be merged as is in the layer. For example, if the configuration
|
|
23
|
+
* contains three elements `name, protocol, extent`, these elements will be
|
|
24
|
+
* available using `layer.name` or something else depending on the property
|
|
25
|
+
* name.
|
|
26
|
+
* @param {number} [config.minSubdivisionLevel=2] - Minimum subdivision
|
|
27
|
+
* level for this tiled layer.
|
|
28
|
+
* @param {number} [config.maxSubdivisionLevel=18] - Maximum subdivision
|
|
29
|
+
* level for this tiled layer.
|
|
30
|
+
* @param {number} [config.sseSubdivisionThreshold=1] - Threshold level for
|
|
31
|
+
* the SSE.
|
|
32
|
+
*
|
|
33
|
+
* @throws {Error} `object3d` must be a valid `THREE.Object3d`.
|
|
34
|
+
*/
|
|
35
|
+
constructor(id: string, object3d?: THREE.Object3D, config?: {
|
|
36
|
+
minSubdivisionLevel?: number | undefined;
|
|
37
|
+
maxSubdivisionLevel?: number | undefined;
|
|
38
|
+
sseSubdivisionThreshold?: number | undefined;
|
|
39
|
+
});
|
|
40
|
+
isGlobeLayer: boolean;
|
|
41
|
+
extent: any;
|
|
42
|
+
preUpdate(context: any, changeSources: any): TileMesh[];
|
|
43
|
+
subdivision(context: any, layer: any, node: any): boolean;
|
|
44
|
+
computeTileZoomFromDistanceCamera(distance: any, camera: any): number;
|
|
45
|
+
computeDistanceCameraFromTileZoom(zoom: any, camera: any): number;
|
|
46
|
+
}
|
|
47
|
+
import TiledGeometryLayer from '../../../Layer/TiledGeometryLayer';
|
|
48
|
+
import * as THREE from 'three';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { Coordinates, Extent } from '@itowns/geographic';
|
|
3
|
+
import { ShareableExtent, TileBuilder, TileBuilderParams } from '../TileBuilder';
|
|
4
|
+
/** Specialized parameters for the [GlobeTileBuilder]. */
|
|
5
|
+
export interface GlobeTileBuilderParams extends TileBuilderParams {
|
|
6
|
+
/** Number of rows of tiles, essentially the resolution of the globe. */
|
|
7
|
+
nbRow: number;
|
|
8
|
+
/** Offset of the second texture set. */
|
|
9
|
+
deltaUV1: number;
|
|
10
|
+
/** Transformation to align a tile's normal to the Z axis. */
|
|
11
|
+
quatNormalToZ: THREE.Quaternion;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* TileBuilder implementation for the purpose of generating globe (or more
|
|
15
|
+
* precisely ellipsoidal) tile arrangements.
|
|
16
|
+
*/
|
|
17
|
+
export declare class GlobeTileBuilder implements TileBuilder<GlobeTileBuilderParams> {
|
|
18
|
+
private static _crs;
|
|
19
|
+
private static _computeExtraOffset;
|
|
20
|
+
/**
|
|
21
|
+
* Buffer holding information about the tile/vertex currently being
|
|
22
|
+
* processed.
|
|
23
|
+
*/
|
|
24
|
+
private _transform;
|
|
25
|
+
computeExtraOffset?: (params: GlobeTileBuilderParams) => number;
|
|
26
|
+
get crs(): string;
|
|
27
|
+
constructor(options: {
|
|
28
|
+
/** Number of unaligned texture sets. */
|
|
29
|
+
uvCount: number;
|
|
30
|
+
});
|
|
31
|
+
prepare(params: TileBuilderParams): GlobeTileBuilderParams;
|
|
32
|
+
center(extent: Extent): THREE.Vector3;
|
|
33
|
+
vertexPosition(coordinates: Coordinates): THREE.Vector3;
|
|
34
|
+
vertexNormal(): THREE.Vector3;
|
|
35
|
+
uProject(u: number, extent: Extent): number;
|
|
36
|
+
vProject(v: number, extent: Extent): number;
|
|
37
|
+
computeShareableExtent(extent: Extent): ShareableExtent;
|
|
38
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import * as THREE from 'three';
|
|
18
18
|
const skyShader = {
|
|
19
19
|
uniforms: {
|
|
20
|
-
|
|
20
|
+
luminanceAtmosphere: {
|
|
21
21
|
type: 'f',
|
|
22
22
|
value: 1
|
|
23
23
|
},
|
|
@@ -49,7 +49,7 @@ const skyShader = {
|
|
|
49
49
|
vertexShader: ['varying vec3 vWorldPosition;', 'void main() {', 'vec4 worldPosition = modelMatrix * vec4( cameraPosition + position, 1.0 );', 'vWorldPosition = worldPosition.xyz;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( cameraPosition + position, 1.0 );', '}'].join('\n'),
|
|
50
50
|
fragmentShader: ['uniform sampler2D skySampler;', 'uniform vec3 v3LightPosition;', 'uniform vec3 up;', 'varying vec3 vWorldPosition;',
|
|
51
51
|
// "vec3 cameraPos = cameraPosition; //vec3(0., 0., 0.);",
|
|
52
|
-
'// uniform sampler2D sDiffuse;', '// const float turbidity = 10.0; //', '// const float reileigh = 2.; //', '// const float
|
|
52
|
+
'// uniform sampler2D sDiffuse;', '// const float turbidity = 10.0; //', '// const float reileigh = 2.; //', '// const float luminanceAtmosphere = 1.0; //', '// const float mieCoefficient = 0.005;', '// const float mieDirectionalG = 0.8;', 'uniform float luminanceAtmosphere;', 'uniform float turbidity;', 'uniform float reileigh;', 'uniform float mieCoefficient;', 'uniform float mieDirectionalG;', '// constants for atmospheric scattering', 'const float e = 2.71828182845904523536028747135266249775724709369995957;', 'const float pi = 3.141592653589793238462643383279502884197169;', 'const float n = 1.0003; // refractive index of air', 'const float N = 2.545E25; // number of molecules per unit volume for air at', '// 288.15K and 1013mb (sea level -45 celsius)', 'const float pn = 0.035; // depolatization factor for standard air', '// wavelength of used primaries, according to preetham', 'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);', '// mie stuff', '// K coefficient for the primaries', 'const vec3 K = vec3(0.686, 0.678, 0.666);', 'const float v = 4.0;', '// optical length at zenith for molecules', 'const float rayleighZenithLength = 8.4E3;', 'const float mieZenithLength = 1.25E3;',
|
|
53
53
|
// "const vec3 up = vec3(0.0, 1.0, 0.0);",
|
|
54
54
|
|
|
55
55
|
'const float EE = 1000.0;', 'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;', '// 66 arc seconds -> degrees, and the cosine of that', '// earth shadow hack', 'const float cutoffAngle = pi/1.95;', 'const float steepness = 1.5;', 'vec3 totalRayleigh(vec3 lambda)', '{', 'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));', '}',
|
|
@@ -58,7 +58,7 @@ const skyShader = {
|
|
|
58
58
|
// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);
|
|
59
59
|
'}', 'float rayleighPhase(float cosTheta)', '{ ', 'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '// return (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '// return (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));', '}', 'vec3 totalMie(vec3 lambda, vec3 K, float T)', '{', 'float c = (0.2 * T ) * 10E-18;', 'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;', '}', 'float hgPhase(float cosTheta, float g)', '{', 'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));', '}', 'float sunIntensity(float zenithAngleCos)', '{', 'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));', '}', '// float logLuminance(vec3 c)', '// {', '// return log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);', '// }', '// Filmic ToneMapping http://filmicgames.com/archives/75', 'float A = 0.15;', 'float B = 0.50;', 'float C = 0.10;', 'float D = 0.20;', 'float E = 0.02;', 'float F = 0.30;', 'float W = 1000.0;', 'vec3 Uncharted2Tonemap(vec3 x)', '{', 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;', '}', 'void main() ', '{', 'vec3 up2 = normalize(cameraPosition.xyz);', 'float sunfade = 1.0-clamp(1.0-exp((v3LightPosition.y/450000.0)),0.0,1.0);', 'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));', 'vec3 sunDirection = normalize(v3LightPosition);', 'float sunE = sunIntensity(dot(sunDirection, up2));', '// extinction (absorbtion + out scattering) ', '// rayleigh coefficients',
|
|
60
60
|
// "vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;",
|
|
61
|
-
'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;', '// mie coefficients', 'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;', '// optical length', '// cutoff angle at 90 to avoid singularity in next formula.', 'float zenithAngle = acos(max(0.0, dot(up2, normalize(vWorldPosition - cameraPosition))));', 'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', 'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', '// combined extinction factor', 'vec3 Fex = exp(-(betaR * sR + betaM * sM));', '// in scattering', 'float cosTheta = dot(normalize(vWorldPosition - cameraPosition), sunDirection);', 'float rPhase = rayleighPhase(cosTheta*0.5+0.5);', 'vec3 betaRTheta = betaR * rPhase;', 'float mPhase = hgPhase(cosTheta, mieDirectionalG);', 'vec3 betaMTheta = betaM * mPhase;', 'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));', 'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up2, sunDirection),5.0),0.0,1.0));', '//nightsky', 'vec3 direction = normalize(vWorldPosition - cameraPosition);', 'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]', 'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]', 'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);', '// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;', 'vec3 L0 = vec3(0.1) * Fex;', '// composition + solar disc', '//if (cosTheta > sunAngularDiameterCos)', 'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);', '// if (normalize(vWorldPosition - cameraPosition).y>0.0)', 'L0 += (sunE * 19000.0 * Fex)*sundisk;', 'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));', 'vec3 texColor = (Lin+L0); ', 'texColor *= 0.04 ;', 'texColor += vec3(0.0,0.001,0.0025)*0.3;', 'float g_fMaxLuminance = 1.0;', 'float fLumScaled = 0.1 /
|
|
61
|
+
'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;', '// mie coefficients', 'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;', '// optical length', '// cutoff angle at 90 to avoid singularity in next formula.', 'float zenithAngle = acos(max(0.0, dot(up2, normalize(vWorldPosition - cameraPosition))));', 'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', 'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', '// combined extinction factor', 'vec3 Fex = exp(-(betaR * sR + betaM * sM));', '// in scattering', 'float cosTheta = dot(normalize(vWorldPosition - cameraPosition), sunDirection);', 'float rPhase = rayleighPhase(cosTheta*0.5+0.5);', 'vec3 betaRTheta = betaR * rPhase;', 'float mPhase = hgPhase(cosTheta, mieDirectionalG);', 'vec3 betaMTheta = betaM * mPhase;', 'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));', 'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up2, sunDirection),5.0),0.0,1.0));', '//nightsky', 'vec3 direction = normalize(vWorldPosition - cameraPosition);', 'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]', 'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]', 'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);', '// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;', 'vec3 L0 = vec3(0.1) * Fex;', '// composition + solar disc', '//if (cosTheta > sunAngularDiameterCos)', 'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);', '// if (normalize(vWorldPosition - cameraPosition).y>0.0)', 'L0 += (sunE * 19000.0 * Fex)*sundisk;', 'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));', 'vec3 texColor = (Lin+L0); ', 'texColor *= 0.04 ;', 'texColor += vec3(0.0,0.001,0.0025)*0.3;', 'float g_fMaxLuminance = 1.0;', 'float fLumScaled = 0.1 / luminanceAtmosphere; ', 'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ', 'float ExposureBias = fLumCompressed;', 'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminanceAtmosphere,4.0)))*texColor);', 'vec3 color = curr*whiteScale;', 'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));', 'gl_FragColor.rgb = retColor;', 'gl_FragColor.a = 1. - ( (length(cameraPosition) - 6400000.) / 1000.);', '}'].join('\n')
|
|
62
62
|
};
|
|
63
63
|
class Sky extends THREE.Mesh {
|
|
64
64
|
constructor() {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export namespace GLOBE_VIEW_EVENTS {
|
|
2
|
+
let GLOBE_INITIALIZED: string;
|
|
3
|
+
let LAYER_ADDED: string;
|
|
4
|
+
let LAYER_REMOVED: string;
|
|
5
|
+
let COLOR_LAYERS_ORDER_CHANGED: string;
|
|
6
|
+
}
|
|
7
|
+
export default GlobeView;
|
|
8
|
+
declare class GlobeView extends View {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a view of a globe.
|
|
11
|
+
*
|
|
12
|
+
* @extends View
|
|
13
|
+
*
|
|
14
|
+
* @example <caption><b>Instance GlobeView.</b></caption>
|
|
15
|
+
* var viewerDiv = document.getElementById('viewerDiv');
|
|
16
|
+
* const placement = {
|
|
17
|
+
* coord: new itowns.Coordinates('EPSG:4326', 2.351323, 48.856712),
|
|
18
|
+
* range: 25000000,
|
|
19
|
+
* }
|
|
20
|
+
* var view = new itowns.GlobeView(viewerDiv, placement);
|
|
21
|
+
*
|
|
22
|
+
* @param {HTMLDivElement} viewerDiv - Where to attach the view and display it
|
|
23
|
+
* in the DOM.
|
|
24
|
+
* @param {CameraTransformOptions|Extent} placement - An object to place view
|
|
25
|
+
* @param {object} [options] - See options of {@link View}.
|
|
26
|
+
* @param {Object} [options.controls] - See options of {@link GlobeControls}
|
|
27
|
+
* @param {Object} [options.webXR] - WebXR configuration - its presence alone
|
|
28
|
+
* enable WebXR to switch on VR visualization. (optional).
|
|
29
|
+
* @param {function} [options.webXR.callback] - WebXR rendering callback (optional).
|
|
30
|
+
* @param {boolean} [options.webXR.controllers] - Enable the webXR controllers handling (optional).
|
|
31
|
+
*/
|
|
32
|
+
constructor(viewerDiv: HTMLDivElement, placement?: CameraTransformOptions | Extent, options?: {
|
|
33
|
+
controls?: Object | undefined;
|
|
34
|
+
webXR?: {
|
|
35
|
+
callback?: Function | undefined;
|
|
36
|
+
controllers?: boolean | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
});
|
|
39
|
+
isGlobeView: boolean;
|
|
40
|
+
tileLayer: GlobeLayer;
|
|
41
|
+
controls: GlobeControls | undefined;
|
|
42
|
+
webXR: WebXR | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Add layer in viewer.
|
|
45
|
+
* The layer id must be unique.
|
|
46
|
+
*
|
|
47
|
+
* The `layer.whenReady` is a promise that resolves when
|
|
48
|
+
* the layer is done. This promise is also returned by
|
|
49
|
+
* `addLayer` allowing to chain call.
|
|
50
|
+
*
|
|
51
|
+
* The layer added is attached, by default to `GlobeLayer` (`GlobeView.tileLayer`).
|
|
52
|
+
* If you want add a unattached layer use `View#addLayer` parent method.
|
|
53
|
+
*
|
|
54
|
+
* @param {LayerOptions|Layer|GeometryLayer} layer The layer to add in view.
|
|
55
|
+
* @return {Promise} a promise resolved with the new layer object when it is fully initialized or rejected if any error occurred.
|
|
56
|
+
*/
|
|
57
|
+
addLayer(layer: LayerOptions | Layer | GeometryLayer): Promise<any>;
|
|
58
|
+
getPixelsToDegrees(pixels: number | undefined, screenCoord: any): number;
|
|
59
|
+
getPixelsToDegreesFromDistance(pixels?: number, distance?: number): number;
|
|
60
|
+
getMetersToDegrees(meters?: number): number;
|
|
61
|
+
}
|
|
62
|
+
import View from '../../Core/View';
|
|
63
|
+
import GlobeLayer from '../../Core/Prefab/Globe/GlobeLayer';
|
|
64
|
+
import GlobeControls from '../../Controls/GlobeControls';
|
|
65
|
+
import WebXR from '../../Renderer/WebXR';
|
|
@@ -5,6 +5,7 @@ import { Coordinates, ellipsoidSizes } from '@itowns/geographic';
|
|
|
5
5
|
import GlobeLayer from "./Globe/GlobeLayer.js";
|
|
6
6
|
import Atmosphere from "./Globe/Atmosphere.js";
|
|
7
7
|
import CameraUtils from "../../Utils/CameraUtils.js";
|
|
8
|
+
import WebXR from "../../Renderer/WebXR.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Fires when the view is completely loaded. Controls and view's functions can be called then.
|
|
@@ -76,6 +77,10 @@ class GlobeView extends View {
|
|
|
76
77
|
* @param {CameraTransformOptions|Extent} placement - An object to place view
|
|
77
78
|
* @param {object} [options] - See options of {@link View}.
|
|
78
79
|
* @param {Object} [options.controls] - See options of {@link GlobeControls}
|
|
80
|
+
* @param {Object} [options.webXR] - WebXR configuration - its presence alone
|
|
81
|
+
* enable WebXR to switch on VR visualization. (optional).
|
|
82
|
+
* @param {function} [options.webXR.callback] - WebXR rendering callback (optional).
|
|
83
|
+
* @param {boolean} [options.webXR.controllers] - Enable the webXR controllers handling (optional).
|
|
79
84
|
*/
|
|
80
85
|
constructor(viewerDiv) {
|
|
81
86
|
let placement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -106,6 +111,10 @@ class GlobeView extends View {
|
|
|
106
111
|
|
|
107
112
|
// GlobeView needs this.camera.resize to set perpsective matrix camera
|
|
108
113
|
this.camera.resize(viewerDiv.clientWidth, viewerDiv.clientHeight);
|
|
114
|
+
if (options.webXR) {
|
|
115
|
+
this.webXR = new WebXR(this, typeof options.webXR === 'boolean' ? {} : options.webXR);
|
|
116
|
+
this.webXR.initializeWebXR();
|
|
117
|
+
}
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
/**
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default PlanarLayer;
|
|
2
|
+
/**
|
|
3
|
+
* @property {boolean} isPlanarLayer - Used to checkout whether this layer is a
|
|
4
|
+
* PlanarLayer. Default is true. You should not change this, as it is used
|
|
5
|
+
* internally for optimisation.
|
|
6
|
+
* @extends TiledGeometryLayer
|
|
7
|
+
*/
|
|
8
|
+
declare class PlanarLayer extends TiledGeometryLayer {
|
|
9
|
+
/**
|
|
10
|
+
* A {@link TiledGeometryLayer} to use with a {@link PlanarView}. It has
|
|
11
|
+
* specific method for updating and subdivising its grid.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} id - The id of the layer, that should be unique. It is
|
|
14
|
+
* not mandatory, but an error will be emitted if this layer is added a
|
|
15
|
+
* {@link View} that already has a layer going by that id.
|
|
16
|
+
* @param {Extent} extent - The extent to define the layer within.
|
|
17
|
+
* @param {THREE.Object3d} [object3d=THREE.Group] - The object3d used to
|
|
18
|
+
* contain the geometry of the TiledGeometryLayer. It is usually a
|
|
19
|
+
* `THREE.Group`, but it can be anything inheriting from a `THREE.Object3d`.
|
|
20
|
+
* @param {Object} [config] - Optional configuration, all elements in it
|
|
21
|
+
* will be merged as is in the layer. For example, if the configuration
|
|
22
|
+
* contains three elements `name, protocol, extent`, these elements will be
|
|
23
|
+
* available using `layer.name` or something else depending on the property
|
|
24
|
+
* name.
|
|
25
|
+
* @param {number} [config.maxSubdivisionLevel=5] - Maximum subdivision
|
|
26
|
+
* level for this tiled layer.
|
|
27
|
+
*
|
|
28
|
+
* @throws {Error} `object3d` must be a valid `THREE.Object3d`.
|
|
29
|
+
*/
|
|
30
|
+
constructor(id: string, extent: Extent, object3d?: THREE.Object3d, config?: {
|
|
31
|
+
maxSubdivisionLevel?: number | undefined;
|
|
32
|
+
});
|
|
33
|
+
isPlanarLayer: boolean;
|
|
34
|
+
extent: Extent;
|
|
35
|
+
minSubdivisionLevel: any;
|
|
36
|
+
}
|
|
37
|
+
import TiledGeometryLayer from '../../../Layer/TiledGeometryLayer';
|
|
38
|
+
import * as THREE from 'three';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { Coordinates, Extent } from '@itowns/geographic';
|
|
3
|
+
import { ShareableExtent, TileBuilder, TileBuilderParams } from '../TileBuilder';
|
|
4
|
+
/** Specialized parameters for the [PlanarTileBuilder]. */
|
|
5
|
+
export interface PlanarTileBuilderParams extends TileBuilderParams {
|
|
6
|
+
crs: string;
|
|
7
|
+
uvCount?: number;
|
|
8
|
+
nbRow: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* TileBuilder implementation for the purpose of generating planar
|
|
12
|
+
* tile arrangements.
|
|
13
|
+
*/
|
|
14
|
+
export declare class PlanarTileBuilder implements TileBuilder<PlanarTileBuilderParams> {
|
|
15
|
+
private _uvCount;
|
|
16
|
+
private _transform;
|
|
17
|
+
private _crs;
|
|
18
|
+
constructor(options: {
|
|
19
|
+
projection?: string;
|
|
20
|
+
crs: string;
|
|
21
|
+
uvCount?: number;
|
|
22
|
+
});
|
|
23
|
+
get uvCount(): number;
|
|
24
|
+
get crs(): string;
|
|
25
|
+
prepare(params: TileBuilderParams): PlanarTileBuilderParams;
|
|
26
|
+
center(extent: Extent): THREE.Vector3;
|
|
27
|
+
vertexPosition(coordinates: Coordinates): THREE.Vector3;
|
|
28
|
+
vertexNormal(): THREE.Vector3;
|
|
29
|
+
uProject(u: number, extent: Extent): number;
|
|
30
|
+
vProject(v: number, extent: Extent): number;
|
|
31
|
+
computeShareableExtent(extent: Extent): ShareableExtent;
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default PlanarView;
|
|
2
|
+
declare class PlanarView extends View {
|
|
3
|
+
/**
|
|
4
|
+
* @extends View
|
|
5
|
+
*
|
|
6
|
+
* @example <caption><b>Instance with placement on the ground.</b></caption>
|
|
7
|
+
* var viewerDiv = document.getElementById('viewerDiv');
|
|
8
|
+
* const extent = new Extent('EPSG:3946', 1837816.94334, 1847692.32501, 5170036.4587, 5178412.82698);
|
|
9
|
+
* var view = new itowns.PlanarView(viewerDiv, extent, { placement: { heading: -49.6, range: 6200, tilt: 17 } });
|
|
10
|
+
*
|
|
11
|
+
* @param {HTMLDivElement} viewerDiv - Where to attach the view and display it
|
|
12
|
+
* in the DOM.
|
|
13
|
+
* @param {Extent} extent - The ground extent.
|
|
14
|
+
* @param {Object} [options] - See options of {@link View}.
|
|
15
|
+
* @param {boolean} [options.noControls=false] - If true, no controls are associated to the view.
|
|
16
|
+
* @param {Object} [options.controls] - options for the {@link PlanarControls} associated to the view, if
|
|
17
|
+
* `options.noControls` is false.
|
|
18
|
+
* @param {CameraUtils~CameraTransformOptions|Extent} [options.placement] - The
|
|
19
|
+
* {@link CameraUtils~CameraTransformOptions} to apply to view's camera or the extent it must display at
|
|
20
|
+
* initialization. By default, camera will display the view's extent (given in `extent` parameter).
|
|
21
|
+
*/
|
|
22
|
+
constructor(viewerDiv: HTMLDivElement, extent: Extent, options?: {
|
|
23
|
+
noControls?: boolean | undefined;
|
|
24
|
+
controls?: Object | undefined;
|
|
25
|
+
});
|
|
26
|
+
isPlanarView: boolean;
|
|
27
|
+
controls: PlanarControls | undefined;
|
|
28
|
+
tileLayer: PlanarLayer;
|
|
29
|
+
addLayer(layer: any): Promise<any>;
|
|
30
|
+
}
|
|
31
|
+
import View from '../../Core/View';
|
|
32
|
+
import PlanarControls from '../../Controls/PlanarControls';
|
|
33
|
+
import PlanarLayer from './Planar/PlanarLayer';
|