@cesium/engine 6.2.0 → 7.0.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/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
- package/Build/Workers/{chunk-QRBRVGZC.js → chunk-2HJWSU7B.js} +4 -4
- package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-46UD5ABS.js} +4 -4
- package/Build/Workers/{chunk-GVL5I7TC.js → chunk-4EBHOMFX.js} +17 -17
- package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-5HDYHG3F.js} +13 -13
- package/Build/Workers/{chunk-CWJQGBWT.js → chunk-5M3U6ZMA.js} +1 -1
- package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-5WQ523AW.js} +5 -5
- package/Build/Workers/{chunk-NE4JNU6H.js → chunk-5YLJ77FF.js} +10 -10
- package/Build/Workers/{chunk-SV7DDPAC.js → chunk-6HZQPRUS.js} +1 -1
- package/Build/Workers/{chunk-434ZTTFX.js → chunk-6VJVYK2V.js} +2 -2
- package/Build/Workers/{chunk-LGJUI2CE.js → chunk-72SANQJV.js} +5 -5
- package/Build/Workers/{chunk-QTZQZY2C.js → chunk-7XEAYGZK.js} +34 -10
- package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-AIPU2VSX.js} +6 -6
- package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-AR5DNBJ4.js} +6 -6
- package/Build/Workers/{chunk-BUZDZBUH.js → chunk-BZP4T2JJ.js} +10 -10
- package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-DTAIXKTO.js} +6 -6
- package/Build/Workers/{chunk-HOT2SNXP.js → chunk-F6SE42BK.js} +127 -90
- package/Build/Workers/{chunk-TIXXVKUY.js → chunk-FP6GYBFX.js} +10 -10
- package/Build/Workers/{chunk-ARPTYYKS.js → chunk-GEJTYLCO.js} +5 -5
- package/Build/Workers/{chunk-XUTVA4K5.js → chunk-GV56Q4LU.js} +11 -11
- package/Build/Workers/{chunk-HPP4JLNH.js → chunk-IQBYFRVW.js} +7 -7
- package/Build/Workers/{chunk-O43GWBSF.js → chunk-IX2JCCNM.js} +1 -1
- package/Build/Workers/{chunk-H5DUXHCV.js → chunk-JCNXK6EL.js} +11 -11
- package/Build/Workers/{chunk-SQVTYRZY.js → chunk-JJ4VBOQ3.js} +4 -4
- package/Build/Workers/{chunk-RIDPF7PO.js → chunk-JXDC723O.js} +2 -2
- package/Build/Workers/{chunk-R3HUGXBH.js → chunk-JY5YEZFA.js} +8 -8
- package/Build/Workers/{chunk-GF5TNNKP.js → chunk-L2ZN645J.js} +6 -6
- package/Build/Workers/{chunk-5GDBZTHX.js → chunk-LZ7JIV3K.js} +17 -17
- package/Build/Workers/{chunk-52VSIKEA.js → chunk-LZGHD6NY.js} +15 -15
- package/Build/Workers/{chunk-RH4N2ONY.js → chunk-MY3VNFGQ.js} +7 -7
- package/Build/Workers/{chunk-MN34FIF5.js → chunk-NKPBIX7F.js} +1 -1
- package/Build/Workers/{chunk-AXFRNOVC.js → chunk-NY3K4IM3.js} +12 -12
- package/Build/Workers/{chunk-MW3CJYLX.js → chunk-ODW7WYM4.js} +2 -2
- package/Build/Workers/{chunk-R4OZKBXH.js → chunk-OVLG3FRS.js} +6 -6
- package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-PNBGBETF.js} +10 -10
- package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-PTQQUQC3.js} +13 -13
- package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-QZAD5O7I.js} +7 -7
- package/Build/Workers/{chunk-5SK36PU4.js → chunk-R5X4OQT4.js} +7 -7
- package/Build/Workers/{chunk-DMCSY5BU.js → chunk-RAEV7K66.js} +5 -5
- package/Build/Workers/{chunk-BP467WX3.js → chunk-RV7ZYPFT.js} +4 -4
- package/Build/Workers/{chunk-5HLGKKG3.js → chunk-S4MAZ3SS.js} +2 -2
- package/Build/Workers/{chunk-LX6XV4DK.js → chunk-S6SKF6DT.js} +5 -5
- package/Build/Workers/{chunk-HUPNRBWW.js → chunk-U2VCRRQW.js} +6 -6
- package/Build/Workers/{chunk-SNN7WOC2.js → chunk-UAEW6HKG.js} +13 -13
- package/Build/Workers/{chunk-HFKSAB5K.js → chunk-UDO6BFSF.js} +13 -13
- package/Build/Workers/{chunk-YBKFS53K.js → chunk-UGK3FCDY.js} +1 -1
- package/Build/Workers/{chunk-PIXK6KHB.js → chunk-VK3EJHWI.js} +2 -2
- package/Build/Workers/{chunk-5IRLXUTA.js → chunk-VRGFV2UO.js} +7 -7
- package/Build/Workers/{chunk-JGG36SQV.js → chunk-WBQCVXR3.js} +4 -4
- package/Build/Workers/{chunk-4KP73B43.js → chunk-WZU2YLWG.js} +3 -3
- package/Build/Workers/{chunk-LGL4P5KL.js → chunk-XWXM2O2R.js} +6 -6
- package/Build/Workers/{chunk-FWGNCYP6.js → chunk-YUCVWAY6.js} +7 -7
- package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-ZK5JOS3D.js} +14 -14
- package/Build/Workers/{chunk-HPH5HSFE.js → chunk-ZUA2UUNV.js} +2 -2
- package/Build/Workers/combineGeometry.js +23 -23
- package/Build/Workers/createBoxGeometry.js +17 -17
- package/Build/Workers/createBoxOutlineGeometry.js +15 -15
- package/Build/Workers/createCircleGeometry.js +25 -25
- package/Build/Workers/createCircleOutlineGeometry.js +18 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +32 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createCorridorGeometry.js +28 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +27 -28
- package/Build/Workers/createCylinderGeometry.js +19 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipseGeometry.js +25 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipsoidGeometry.js +18 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +17 -17
- package/Build/Workers/createFrustumGeometry.js +17 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +17 -17
- package/Build/Workers/createGeometry.js +23 -23
- package/Build/Workers/createGroundPolylineGeometry.js +21 -21
- package/Build/Workers/createPlaneGeometry.js +15 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +14 -14
- package/Build/Workers/createPolygonGeometry.js +31 -166
- package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createPolylineGeometry.js +24 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -33
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +26 -27
- package/Build/Workers/createRectangleGeometry.js +26 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
- package/Build/Workers/createSimplePolylineGeometry.js +22 -22
- package/Build/Workers/createSphereGeometry.js +18 -18
- package/Build/Workers/createSphereOutlineGeometry.js +17 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +23 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +21 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +21 -21
- package/Build/Workers/createVerticesFromHeightmap.js +21 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +18 -18
- package/Build/Workers/createWallGeometry.js +23 -23
- package/Build/Workers/createWallOutlineGeometry.js +22 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +21 -21
- package/LICENSE.md +1 -1
- package/Source/Assets/approximateTerrainHeights.json +1 -1
- package/Source/Core/GregorianDate.js +85 -0
- package/Source/Core/HeadingPitchRange.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PolygonGeometry.js +0 -169
- package/Source/Core/Resource.js +30 -69
- package/Source/Core/Transforms.js +27 -18
- package/Source/Core/createWorldBathymetryAsync.js +45 -0
- package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
- package/Source/DataSources/Entity.js +8 -5
- package/Source/DataSources/EntityCollection.js +1 -2
- package/Source/DataSources/GeometryUpdater.js +1 -2
- package/Source/DataSources/GroundGeometryUpdater.js +6 -3
- package/Source/DataSources/ModelVisualizer.js +19 -98
- package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
- package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
- package/Source/DataSources/TerrainOffsetProperty.js +15 -23
- package/Source/Renderer/AutomaticUniforms.js +121 -1
- package/Source/Renderer/UniformState.js +127 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Atmosphere.js +127 -0
- package/Source/Scene/Billboard.js +29 -26
- package/Source/Scene/BillboardCollection.js +3 -3
- package/Source/Scene/Camera.js +1 -1
- package/Source/Scene/Cesium3DTile.js +1 -0
- package/Source/Scene/Cesium3DTileContent.js +14 -0
- package/Source/Scene/Cesium3DTileset.js +326 -45
- package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
- package/Source/Scene/Composite3DTileContent.js +42 -0
- package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
- package/Source/Scene/Empty3DTileContent.js +4 -0
- package/Source/Scene/Fog.js +1 -0
- package/Source/Scene/FrameState.js +9 -1
- package/Source/Scene/Geometry3DTileContent.js +4 -0
- package/Source/Scene/Globe.js +3 -2
- package/Source/Scene/GlobeSurfaceTileProvider.js +3 -1
- package/Source/Scene/GltfLoader.js +15 -5
- package/Source/Scene/HeightReference.js +59 -2
- package/Source/Scene/Implicit3DTileContent.js +4 -0
- package/Source/Scene/LabelCollection.js +2 -2
- package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
- package/Source/Scene/Model/B3dmLoader.js +4 -0
- package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
- package/Source/Scene/Model/I3dmLoader.js +4 -0
- package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
- package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
- package/Source/Scene/Model/Model.js +82 -32
- package/Source/Scene/Model/Model3DTileContent.js +31 -0
- package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
- package/Source/Scene/Model/ModelSceneGraph.js +6 -0
- package/Source/Scene/Model/pickModel.js +408 -0
- package/Source/Scene/Multiple3DTileContent.js +42 -0
- package/Source/Scene/QuadtreePrimitive.js +1 -1
- package/Source/Scene/Scene.js +198 -16
- package/Source/Scene/ScreenSpaceCameraController.js +2 -6
- package/Source/Scene/SkyAtmosphere.js +5 -6
- package/Source/Scene/Terrain.js +49 -0
- package/Source/Scene/TileBoundingS2Cell.js +2 -2
- package/Source/Scene/Tileset3DTileContent.js +4 -0
- package/Source/Scene/Vector3DTileContent.js +4 -0
- package/Source/Shaders/AtmosphereCommon.glsl +3 -11
- package/Source/Shaders/AtmosphereCommon.js +3 -11
- package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
- package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
- package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
- package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
- package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
- package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
- package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
- package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
- package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
- package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
- package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
- package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
- package/Source/Shaders/GlobeFS.glsl +16 -25
- package/Source/Shaders/GlobeFS.js +16 -25
- package/Source/Shaders/GlobeVS.glsl +1 -1
- package/Source/Shaders/GlobeVS.js +1 -1
- package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
- package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
- package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
- package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
- package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
- package/Source/Shaders/Model/GeometryStageFS.js +1 -1
- package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
- package/Source/Shaders/Model/GeometryStageVS.js +4 -4
- package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
- package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +4 -0
- package/Source/Shaders/Model/ModelFS.js +4 -0
- package/Source/Shaders/Model/ModelVS.glsl +9 -4
- package/Source/Shaders/Model/ModelVS.js +9 -4
- package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
- package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
- package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
- package/Source/Shaders/SkyAtmosphereFS.js +5 -10
- package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
- package/Source/Shaders/SkyAtmosphereVS.js +3 -2
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/ThirdParty/draco_decoder.wasm +0 -0
- package/index.d.ts +283 -65
- package/index.js +260 -247
- package/package.json +3 -3
- package/Build/Workers/chunk-ATB2I7OS.js +0 -55
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ApproximateTerrainHeights from "../Core/ApproximateTerrainHeights.js";
|
|
2
|
+
import BoundingSphere from "../Core/BoundingSphere.js";
|
|
2
3
|
import Cartesian2 from "../Core/Cartesian2.js";
|
|
3
4
|
import Cartesian3 from "../Core/Cartesian3.js";
|
|
4
5
|
import Cartographic from "../Core/Cartographic.js";
|
|
@@ -13,10 +14,13 @@ import destroyObject from "../Core/destroyObject.js";
|
|
|
13
14
|
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
14
15
|
import Event from "../Core/Event.js";
|
|
15
16
|
import ImageBasedLighting from "./ImageBasedLighting.js";
|
|
17
|
+
import Interval from "../Core/Interval.js";
|
|
18
|
+
import IntersectionTests from "../Core/IntersectionTests.js";
|
|
16
19
|
import IonResource from "../Core/IonResource.js";
|
|
17
20
|
import JulianDate from "../Core/JulianDate.js";
|
|
18
21
|
import ManagedArray from "../Core/ManagedArray.js";
|
|
19
22
|
import CesiumMath from "../Core/Math.js";
|
|
23
|
+
import Matrix3 from "../Core/Matrix3.js";
|
|
20
24
|
import Matrix4 from "../Core/Matrix4.js";
|
|
21
25
|
import Resource from "../Core/Resource.js";
|
|
22
26
|
import RuntimeError from "../Core/RuntimeError.js";
|
|
@@ -55,6 +59,7 @@ import TileOrientedBoundingBox from "./TileOrientedBoundingBox.js";
|
|
|
55
59
|
import Cesium3DTilesetMostDetailedTraversal from "./Cesium3DTilesetMostDetailedTraversal.js";
|
|
56
60
|
import Cesium3DTilesetBaseTraversal from "./Cesium3DTilesetBaseTraversal.js";
|
|
57
61
|
import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
62
|
+
import Ray from "../Core/Ray.js";
|
|
58
63
|
|
|
59
64
|
/**
|
|
60
65
|
* @typedef {Object} Cesium3DTileset.ConstructorOptions
|
|
@@ -75,10 +80,10 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
|
75
80
|
* @property {boolean} [preloadWhenHidden=false] Preload tiles when <code>tileset.show</code> is <code>false</code>. Loads tiles as if the tileset is visible but does not render them.
|
|
76
81
|
* @property {boolean} [preloadFlightDestinations=true] Optimization option. Preload tiles at the camera's flight destination while the camera is in flight.
|
|
77
82
|
* @property {boolean} [preferLeaves=false] Optimization option. Prefer loading of leaves first.
|
|
78
|
-
* @property {boolean} [dynamicScreenSpaceError=
|
|
79
|
-
* @property {number} [dynamicScreenSpaceErrorDensity=
|
|
80
|
-
* @property {number} [dynamicScreenSpaceErrorFactor=
|
|
81
|
-
* @property {number} [dynamicScreenSpaceErrorHeightFalloff=0.25] A ratio of the tileset's height
|
|
83
|
+
* @property {boolean} [dynamicScreenSpaceError=true] Optimization option. For street-level horizon views, use lower resolution tiles far from the camera. This reduces the amount of data loaded and improves tileset loading time with a slight drop in visual quality in the distance.
|
|
84
|
+
* @property {number} [dynamicScreenSpaceErrorDensity=2.0e-4] Similar to {@link Fog#density}, this option controls the camera distance at which the {@link Cesium3DTileset#dynamicScreenSpaceError} optimization applies. Larger values will cause tiles closer to the camera to be affected.
|
|
85
|
+
* @property {number} [dynamicScreenSpaceErrorFactor=24.0] A parameter that controls the intensity of the {@link Cesium3DTileset#dynamicScreenSpaceError} optimization for tiles on the horizon. Larger values cause lower resolution tiles to load, improving runtime performance at a slight reduction of visual quality.
|
|
86
|
+
* @property {number} [dynamicScreenSpaceErrorHeightFalloff=0.25] A ratio of the tileset's height that determines where "street level" camera views occur. When the camera is below this height, the {@link Cesium3DTileset#dynamicScreenSpaceError} optimization will have the maximum effect, and it will roll off above this value.
|
|
82
87
|
* @property {number} [progressiveResolutionHeightFraction=0.3] Optimization option. If between (0.0, 0.5], tiles at or above the screen space error for the reduced screen resolution of <code>progressiveResolutionHeightFraction*screenHeight</code> will be prioritized first. This can help get a quick layer of tiles down while full resolution tiles continue to load.
|
|
83
88
|
* @property {boolean} [foveatedScreenSpaceError=true] Optimization option. Prioritize loading tiles in the center of the screen by temporarily raising the screen space error for tiles around the edge of the screen. Screen space error returns to normal once all the tiles in the center of the screen as determined by the {@link Cesium3DTileset#foveatedConeSize} are loaded.
|
|
84
89
|
* @property {number} [foveatedConeSize=0.1] Optimization option. Used when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control the cone size that determines which tiles are deferred. Tiles that are inside this cone are loaded immediately. Tiles outside the cone are potentially deferred based on how far outside the cone they are and their screen space error. This is controlled by {@link Cesium3DTileset#foveatedInterpolationCallback} and {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation}. Setting this to 0.0 means the cone will be the line formed by the camera position and its view direction. Setting this to 1.0 means the cone encompasses the entire field of view of the camera, disabling the effect.
|
|
@@ -107,11 +112,13 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
|
107
112
|
* @property {string|number} [instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
|
|
108
113
|
* @property {boolean} [showCreditsOnScreen=false] Whether to display the credits of this tileset on screen.
|
|
109
114
|
* @property {SplitDirection} [splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this tileset.
|
|
110
|
-
* @property {boolean} [
|
|
115
|
+
* @property {boolean} [disableCollision=false] Whether to turn off collisions for camera collisions or picking. While this is <code>true</code> the camera will be allowed to go in or below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true.
|
|
116
|
+
* @property {boolean} [projectTo2D=false] Whether to accurately project the tileset to 2D. If this is true, the tileset will be projected accurately to 2D, but it will use more memory to do so. If this is false, the tileset will use less memory and will still render in 2D / CV mode, but its projected positions may be inaccurate. This cannot be set after the tileset has been created.
|
|
117
|
+
* @property {boolean} [enablePick=false] Whether to allow collision and CPU picking with <code>pick</code> when using WebGL 1. If using WebGL 2 or above, this option will be ignored. If using WebGL 1 and this is true, the <code>pick</code> operation will work correctly, but it will use more memory to do so. If running with WebGL 1 and this is false, the model will use less memory, but <code>pick</code> will always return <code>undefined</code>. This cannot be set after the tileset has loaded.
|
|
111
118
|
* @property {string} [debugHeatmapTilePropertyName] The tile variable to colorize as a heatmap. All rendered tiles will be colorized relative to each other's specified variable value.
|
|
112
119
|
* @property {boolean} [debugFreezeFrame=false] For debugging only. Determines if only the tiles from last frame should be used for rendering.
|
|
113
120
|
* @property {boolean} [debugColorizeTiles=false] For debugging only. When true, assigns a random color to each tile.
|
|
114
|
-
* @property {boolean} [enableDebugWireframe] For debugging only. This must be true for debugWireframe to work in WebGL1. This cannot be set after the tileset has
|
|
121
|
+
* @property {boolean} [enableDebugWireframe=false] For debugging only. This must be true for debugWireframe to work in WebGL1. This cannot be set after the tileset has been created.
|
|
115
122
|
* @property {boolean} [debugWireframe=false] For debugging only. When true, render's each tile's content as a wireframe.
|
|
116
123
|
* @property {boolean} [debugShowBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile.
|
|
117
124
|
* @property {boolean} [debugShowContentBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile's content.
|
|
@@ -148,6 +155,18 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
|
148
155
|
* }
|
|
149
156
|
*
|
|
150
157
|
* @example
|
|
158
|
+
* // Allow camera to go inside and under 3D tileset
|
|
159
|
+
* try {
|
|
160
|
+
* const tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
161
|
+
* "http://localhost:8002/tilesets/Seattle/tileset.json",
|
|
162
|
+
* { disableCollision: true }
|
|
163
|
+
* );
|
|
164
|
+
* scene.primitives.add(tileset);
|
|
165
|
+
* } catch (error) {
|
|
166
|
+
* console.error(`Error creating tileset: ${error}`);
|
|
167
|
+
* }
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
151
170
|
* // Common setting for the skipLevelOfDetail optimization
|
|
152
171
|
* const tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
153
172
|
* "http://localhost:8002/tilesets/Seattle/tileset.json", {
|
|
@@ -166,8 +185,8 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
|
166
185
|
* const tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
167
186
|
* "http://localhost:8002/tilesets/Seattle/tileset.json", {
|
|
168
187
|
* dynamicScreenSpaceError: true,
|
|
169
|
-
* dynamicScreenSpaceErrorDensity:
|
|
170
|
-
* dynamicScreenSpaceErrorFactor:
|
|
188
|
+
* dynamicScreenSpaceErrorDensity: 2.0e-4,
|
|
189
|
+
* dynamicScreenSpaceErrorFactor: 24.0,
|
|
171
190
|
* dynamicScreenSpaceErrorHeightFalloff: 0.25
|
|
172
191
|
* });
|
|
173
192
|
* scene.primitives.add(tileset);
|
|
@@ -248,6 +267,8 @@ function Cesium3DTileset(options) {
|
|
|
248
267
|
? Matrix4.clone(options.modelMatrix)
|
|
249
268
|
: Matrix4.clone(Matrix4.IDENTITY);
|
|
250
269
|
|
|
270
|
+
this._addHeightCallbacks = [];
|
|
271
|
+
|
|
251
272
|
this._statistics = new Cesium3DTilesetStatistics();
|
|
252
273
|
this._statisticsLast = new Cesium3DTilesetStatistics();
|
|
253
274
|
this._statisticsPerPass = new Array(Cesium3DTilePass.NUMBER_OF_PASSES);
|
|
@@ -361,18 +382,18 @@ function Cesium3DTileset(options) {
|
|
|
361
382
|
this._pass = undefined; // Cesium3DTilePass
|
|
362
383
|
|
|
363
384
|
/**
|
|
364
|
-
* Optimization option.
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
385
|
+
* Optimization option. For street-level horizon views, use lower resolution tiles far from the camera. This reduces
|
|
386
|
+
* the amount of data loaded and improves tileset loading time with a slight drop in visual quality in the distance.
|
|
387
|
+
* <p>
|
|
388
|
+
* This optimization is strongest when the camera is close to the ground plane of the tileset and looking at the
|
|
389
|
+
* horizon. Furthermore, the results are more accurate for tightly fitting bounding volumes like box and region.
|
|
369
390
|
*
|
|
370
391
|
* @type {boolean}
|
|
371
|
-
* @default
|
|
392
|
+
* @default true
|
|
372
393
|
*/
|
|
373
394
|
this.dynamicScreenSpaceError = defaultValue(
|
|
374
395
|
options.dynamicScreenSpaceError,
|
|
375
|
-
|
|
396
|
+
true
|
|
376
397
|
);
|
|
377
398
|
|
|
378
399
|
/**
|
|
@@ -416,48 +437,68 @@ function Cesium3DTileset(options) {
|
|
|
416
437
|
this.foveatedTimeDelay = defaultValue(options.foveatedTimeDelay, 0.2);
|
|
417
438
|
|
|
418
439
|
/**
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* This has the effect of keeping high detail in the closer tiles and lower detail in the further tiles, with all tiles
|
|
423
|
-
* beyond a certain distance all roughly having an error of 1.0.
|
|
440
|
+
* Similar to {@link Fog#density}, this option controls the camera distance at which the {@link Cesium3DTileset#dynamicScreenSpaceError}
|
|
441
|
+
* optimization applies. Larger values will cause tiles closer to the camera to be affected. This value must be
|
|
442
|
+
* non-negative.
|
|
424
443
|
* <p>
|
|
425
|
-
*
|
|
426
|
-
*
|
|
444
|
+
* This optimization works by rolling off the tile screen space error (SSE) with camera distance like a bell curve.
|
|
445
|
+
* This has the effect of selecting lower resolution tiles far from the camera. Near the camera, no adjustment is
|
|
446
|
+
* made. For tiles further away, the SSE is reduced by up to {@link Cesium3DTileset#dynamicScreenSpaceErrorFactor}
|
|
447
|
+
* (measured in pixels of error).
|
|
427
448
|
* </p>
|
|
428
449
|
* <p>
|
|
429
|
-
* Increasing
|
|
430
|
-
*
|
|
450
|
+
* Increasing the density makes the bell curve narrower so tiles closer to the camera are affected. This is analagous
|
|
451
|
+
* to moving fog closer to the camera.
|
|
452
|
+
* </p>
|
|
453
|
+
* <p>
|
|
454
|
+
* When the density is 0, the optimization will have no effect on the tileset.
|
|
431
455
|
* </p>
|
|
432
456
|
*
|
|
433
457
|
* @type {number}
|
|
434
|
-
* @default
|
|
458
|
+
* @default 2.0e-4
|
|
435
459
|
*/
|
|
436
|
-
this.dynamicScreenSpaceErrorDensity =
|
|
460
|
+
this.dynamicScreenSpaceErrorDensity = defaultValue(
|
|
461
|
+
options.dynamicScreenSpaceErrorDensity,
|
|
462
|
+
2.0e-4
|
|
463
|
+
);
|
|
437
464
|
|
|
438
465
|
/**
|
|
439
|
-
* A
|
|
440
|
-
*
|
|
466
|
+
* A parameter that controls the intensity of the {@link Cesium3DTileset#dynamicScreenSpaceError} optimization for
|
|
467
|
+
* tiles on the horizon. Larger values cause lower resolution tiles to load, improving runtime performance at a slight
|
|
468
|
+
* reduction of visual quality. The value must be non-negative.
|
|
469
|
+
* <p>
|
|
470
|
+
* More specifically, this parameter represents the maximum adjustment to screen space error (SSE) in pixels for tiles
|
|
471
|
+
* far away from the camera. See {@link Cesium3DTileset#dynamicScreenSpaceErrorDensity} for more details about how
|
|
472
|
+
* this optimization works.
|
|
473
|
+
* </p>
|
|
474
|
+
* <p>
|
|
475
|
+
* When the SSE factor is set to 0, the optimization will have no effect on the tileset.
|
|
476
|
+
* </p>
|
|
441
477
|
*
|
|
442
478
|
* @type {number}
|
|
443
|
-
* @default
|
|
479
|
+
* @default 24.0
|
|
444
480
|
*/
|
|
445
|
-
this.dynamicScreenSpaceErrorFactor =
|
|
481
|
+
this.dynamicScreenSpaceErrorFactor = defaultValue(
|
|
482
|
+
options.dynamicScreenSpaceErrorFactor,
|
|
483
|
+
24.0
|
|
484
|
+
);
|
|
446
485
|
|
|
447
486
|
/**
|
|
448
|
-
* A ratio of the tileset's height
|
|
449
|
-
*
|
|
450
|
-
*
|
|
487
|
+
* A ratio of the tileset's height that determines "street level" for the {@link Cesium3DTileset#dynamicScreenSpaceError}
|
|
488
|
+
* optimization. When the camera is below this height, the dynamic screen space error optimization will have the maximum
|
|
489
|
+
* effect, and it will roll off above this value. Valid values are between 0.0 and 1.0.
|
|
451
490
|
* <p>
|
|
452
|
-
* Valid values are between 0.0 and 1.0.
|
|
453
|
-
* </p>
|
|
454
491
|
*
|
|
455
492
|
* @type {number}
|
|
456
493
|
* @default 0.25
|
|
457
494
|
*/
|
|
458
|
-
this.dynamicScreenSpaceErrorHeightFalloff =
|
|
495
|
+
this.dynamicScreenSpaceErrorHeightFalloff = defaultValue(
|
|
496
|
+
options.dynamicScreenSpaceErrorHeightFalloff,
|
|
497
|
+
0.25
|
|
498
|
+
);
|
|
459
499
|
|
|
460
|
-
|
|
500
|
+
// Updated based on the camera position and direction
|
|
501
|
+
this._dynamicScreenSpaceErrorComputedDensity = 0.0;
|
|
461
502
|
|
|
462
503
|
/**
|
|
463
504
|
* Determines whether the tileset casts or receives shadows from light sources.
|
|
@@ -822,7 +863,16 @@ function Cesium3DTileset(options) {
|
|
|
822
863
|
SplitDirection.NONE
|
|
823
864
|
);
|
|
824
865
|
|
|
866
|
+
/**
|
|
867
|
+
* Whether to turn off collisions for camera collisions or picking. While this is <code>true</code> the camera will be allowed to go in or below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true.
|
|
868
|
+
*
|
|
869
|
+
* @type {boolean}
|
|
870
|
+
* @default false
|
|
871
|
+
*/
|
|
872
|
+
this.disableCollision = defaultValue(options.disableCollision, false);
|
|
873
|
+
|
|
825
874
|
this._projectTo2D = defaultValue(options.projectTo2D, false);
|
|
875
|
+
this._enablePick = defaultValue(options.enablePick, false);
|
|
826
876
|
|
|
827
877
|
/**
|
|
828
878
|
* This property is for debugging only; it is not optimized for production use.
|
|
@@ -1635,6 +1685,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1635
1685
|
* <li>The glTF cannot contain morph targets, skins, or animations.</li>
|
|
1636
1686
|
* <li>The glTF cannot contain the <code>EXT_mesh_gpu_instancing</code> extension.</li>
|
|
1637
1687
|
* <li>Only meshes with TRIANGLES can be used to classify other assets.</li>
|
|
1688
|
+
* <li>The meshes must be watertight.</li>
|
|
1638
1689
|
* <li>The <code>POSITION</code> semantic is required.</li>
|
|
1639
1690
|
* <li>If <code>_BATCHID</code>s and an index buffer are both present, all indices with the same batch id must occupy contiguous sections of the index buffer.</li>
|
|
1640
1691
|
* <li>If <code>_BATCHID</code>s are present with no index buffer, all positions with the same batch id must occupy contiguous sections of the position buffer.</li>
|
|
@@ -1644,6 +1695,9 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1644
1695
|
* Additionally, classification is not supported for points or instanced 3D
|
|
1645
1696
|
* models.
|
|
1646
1697
|
* </p>
|
|
1698
|
+
* <p>
|
|
1699
|
+
* The 3D Tiles or terrain receiving the classification must be opaque.
|
|
1700
|
+
* </p>
|
|
1647
1701
|
*
|
|
1648
1702
|
* @memberof Cesium3DTileset.prototype
|
|
1649
1703
|
*
|
|
@@ -1905,7 +1959,8 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1905
1959
|
* @param {Cesium3DTileset.ConstructorOptions} [options] An object describing initialization options
|
|
1906
1960
|
* @returns {Promise<Cesium3DTileset>}
|
|
1907
1961
|
*
|
|
1908
|
-
* @exception {
|
|
1962
|
+
* @exception {RuntimeError} When the tileset asset version is not 0.0, 1.0, or 1.1,
|
|
1963
|
+
* or when the tileset contains a required extension that is not supported.
|
|
1909
1964
|
*
|
|
1910
1965
|
* @see Cesium3DTileset#fromUrl
|
|
1911
1966
|
*
|
|
@@ -1935,7 +1990,8 @@ Cesium3DTileset.fromIonAssetId = async function (assetId, options) {
|
|
|
1935
1990
|
* @param {Cesium3DTileset.ConstructorOptions} [options] An object describing initialization options
|
|
1936
1991
|
* @returns {Promise<Cesium3DTileset>}
|
|
1937
1992
|
*
|
|
1938
|
-
* @exception {
|
|
1993
|
+
* @exception {RuntimeError} When the tileset asset version is not 0.0, 1.0, or 1.1,
|
|
1994
|
+
* or when the tileset contains a required extension that is not supported.
|
|
1939
1995
|
*
|
|
1940
1996
|
* @see Cesium3DTileset#fromIonAssetId
|
|
1941
1997
|
*
|
|
@@ -1968,8 +2024,8 @@ Cesium3DTileset.fromIonAssetId = async function (assetId, options) {
|
|
|
1968
2024
|
* const tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
1969
2025
|
* "http://localhost:8002/tilesets/Seattle/tileset.json", {
|
|
1970
2026
|
* dynamicScreenSpaceError: true,
|
|
1971
|
-
* dynamicScreenSpaceErrorDensity:
|
|
1972
|
-
* dynamicScreenSpaceErrorFactor:
|
|
2027
|
+
* dynamicScreenSpaceErrorDensity: 2.0e-4,
|
|
2028
|
+
* dynamicScreenSpaceErrorFactor: 24.0,
|
|
1973
2029
|
* dynamicScreenSpaceErrorHeightFalloff: 0.25
|
|
1974
2030
|
* });
|
|
1975
2031
|
* scene.primitives.add(tileset);
|
|
@@ -2078,6 +2134,9 @@ Cesium3DTileset.prototype.makeStyleDirty = function () {
|
|
|
2078
2134
|
/**
|
|
2079
2135
|
* Loads the main tileset JSON file or a tileset JSON file referenced from a tile.
|
|
2080
2136
|
*
|
|
2137
|
+
* @exception {RuntimeError} When the tileset asset version is not 0.0, 1.0, or 1.1,
|
|
2138
|
+
* or when the tileset contains a required extension that is not supported.
|
|
2139
|
+
*
|
|
2081
2140
|
* @private
|
|
2082
2141
|
*/
|
|
2083
2142
|
Cesium3DTileset.prototype.loadTileset = function (
|
|
@@ -2266,6 +2325,7 @@ const scratchMatrix = new Matrix4();
|
|
|
2266
2325
|
const scratchCenter = new Cartesian3();
|
|
2267
2326
|
const scratchPosition = new Cartesian3();
|
|
2268
2327
|
const scratchDirection = new Cartesian3();
|
|
2328
|
+
const scratchHalfHeight = new Cartesian3();
|
|
2269
2329
|
|
|
2270
2330
|
/**
|
|
2271
2331
|
* @private
|
|
@@ -2330,10 +2390,16 @@ function updateDynamicScreenSpaceError(tileset, frameState) {
|
|
|
2330
2390
|
direction = Cartesian3.normalize(direction, direction);
|
|
2331
2391
|
height = positionLocal.z;
|
|
2332
2392
|
if (tileBoundingVolume instanceof TileOrientedBoundingBox) {
|
|
2333
|
-
// Assuming z-up, the last
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2393
|
+
// Assuming z-up, the last column is the local z direction and
|
|
2394
|
+
// represents the height of the bounding box.
|
|
2395
|
+
const halfHeightVector = Matrix3.getColumn(
|
|
2396
|
+
boundingVolume.halfAxes,
|
|
2397
|
+
2,
|
|
2398
|
+
scratchHalfHeight
|
|
2399
|
+
);
|
|
2400
|
+
const halfHeight = Cartesian3.magnitude(halfHeightVector);
|
|
2401
|
+
minimumHeight = centerLocal.z - halfHeight;
|
|
2402
|
+
maximumHeight = centerLocal.z + halfHeight;
|
|
2337
2403
|
} else if (tileBoundingVolume instanceof TileBoundingSphere) {
|
|
2338
2404
|
const radius = boundingVolume.radius;
|
|
2339
2405
|
minimumHeight = centerLocal.z - radius;
|
|
@@ -2569,6 +2635,55 @@ function filterProcessingQueue(tileset) {
|
|
|
2569
2635
|
tiles.length -= removeCount;
|
|
2570
2636
|
}
|
|
2571
2637
|
|
|
2638
|
+
const scratchUpdateHeightCartographic = new Cartographic();
|
|
2639
|
+
const scratchUpdateHeightCartographic2 = new Cartographic();
|
|
2640
|
+
const scratchUpdateHeightCartesian = new Cartesian3();
|
|
2641
|
+
function processUpdateHeight(tileset, tile, frameState) {
|
|
2642
|
+
const heightCallbackData = tileset._addHeightCallbacks;
|
|
2643
|
+
const boundingSphere = tile.boundingSphere;
|
|
2644
|
+
|
|
2645
|
+
for (const callbackData of heightCallbackData) {
|
|
2646
|
+
// No need to upadate if the tile was already visible last frame
|
|
2647
|
+
if (callbackData.invoked || tile._wasSelectedLastFrame) {
|
|
2648
|
+
continue;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
const ellipsoid = callbackData.ellipsoid;
|
|
2652
|
+
const positionCartographic = Cartographic.clone(
|
|
2653
|
+
callbackData.positionCartographic,
|
|
2654
|
+
scratchUpdateHeightCartographic
|
|
2655
|
+
);
|
|
2656
|
+
const centerCartographic = Cartographic.fromCartesian(
|
|
2657
|
+
boundingSphere.center,
|
|
2658
|
+
ellipsoid,
|
|
2659
|
+
scratchUpdateHeightCartographic2
|
|
2660
|
+
);
|
|
2661
|
+
|
|
2662
|
+
// This can be undefined when the bounding sphere is at the origin
|
|
2663
|
+
if (defined(centerCartographic)) {
|
|
2664
|
+
positionCartographic.height = centerCartographic.height;
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
const position = Cartographic.toCartesian(
|
|
2668
|
+
positionCartographic,
|
|
2669
|
+
ellipsoid,
|
|
2670
|
+
scratchUpdateHeightCartesian
|
|
2671
|
+
);
|
|
2672
|
+
if (
|
|
2673
|
+
Cartesian3.distance(position, boundingSphere.center) <=
|
|
2674
|
+
boundingSphere.radius
|
|
2675
|
+
) {
|
|
2676
|
+
frameState.afterRender.push(() => {
|
|
2677
|
+
// Callback can be removed before it actually invoked at the end of the frame
|
|
2678
|
+
if (defined(callbackData.callback)) {
|
|
2679
|
+
callbackData.callback(positionCartographic);
|
|
2680
|
+
}
|
|
2681
|
+
callbackData.invoked = false;
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2572
2687
|
/**
|
|
2573
2688
|
* Process tiles in the PROCESSING state so they will eventually move to the READY state.
|
|
2574
2689
|
* @private
|
|
@@ -2836,6 +2951,7 @@ function updateTiles(tileset, frameState, passOptions) {
|
|
|
2836
2951
|
if (isRender) {
|
|
2837
2952
|
tileVisible.raiseEvent(tile);
|
|
2838
2953
|
}
|
|
2954
|
+
processUpdateHeight(tileset, tile, frameState);
|
|
2839
2955
|
tile.update(tileset, frameState, passOptions);
|
|
2840
2956
|
statistics.incrementSelectionCounts(tile.content);
|
|
2841
2957
|
++statistics.selected;
|
|
@@ -3379,6 +3495,171 @@ Cesium3DTileset.checkSupportedExtensions = function (extensionsRequired) {
|
|
|
3379
3495
|
}
|
|
3380
3496
|
};
|
|
3381
3497
|
|
|
3498
|
+
const scratchGetHeightRay = new Ray();
|
|
3499
|
+
const scratchIntersection = new Cartesian3();
|
|
3500
|
+
const scratchGetHeightCartographic = new Cartographic();
|
|
3501
|
+
|
|
3502
|
+
/**
|
|
3503
|
+
* Get the height of the loaded surface at a given cartographic. This function will only take into account meshes for loaded tiles, not neccisarily the most detailed tiles available for a tileset. This function will always return undefined when sampling a point cloud.
|
|
3504
|
+
*
|
|
3505
|
+
* @param {Cartographic} cartographic The cartographic for which to find the height.
|
|
3506
|
+
* @param {Scene} scene The scene where visualization is taking place.
|
|
3507
|
+
* @returns {number|undefined} The height of the cartographic or undefined if it could not be found.
|
|
3508
|
+
*
|
|
3509
|
+
* @example
|
|
3510
|
+
* const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(124624234);
|
|
3511
|
+
* scene.primitives.add(tileset);
|
|
3512
|
+
*
|
|
3513
|
+
* const height = tileset.getHeight(scene.camera.positionCartographic, scene);
|
|
3514
|
+
*/
|
|
3515
|
+
Cesium3DTileset.prototype.getHeight = function (cartographic, scene) {
|
|
3516
|
+
//>>includeStart('debug', pragmas.debug);
|
|
3517
|
+
Check.typeOf.object("cartographic", cartographic);
|
|
3518
|
+
Check.typeOf.object("scene", scene);
|
|
3519
|
+
//>>includeEnd('debug');
|
|
3520
|
+
|
|
3521
|
+
let ellipsoid = scene.globe?.ellipsoid;
|
|
3522
|
+
if (!defined(ellipsoid)) {
|
|
3523
|
+
ellipsoid = Ellipsoid.WGS84;
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
const ray = scratchGetHeightRay;
|
|
3527
|
+
const position = ellipsoid.cartographicToCartesian(
|
|
3528
|
+
cartographic,
|
|
3529
|
+
ray.direction
|
|
3530
|
+
);
|
|
3531
|
+
Cartesian3.normalize(ray.direction, ray.direction);
|
|
3532
|
+
|
|
3533
|
+
ray.direction = Cartesian3.normalize(position, ray.direction);
|
|
3534
|
+
ray.direction = Cartesian3.negate(position, ray.direction);
|
|
3535
|
+
ray.origin = Cartesian3.multiplyByScalar(
|
|
3536
|
+
ray.direction,
|
|
3537
|
+
-2 * ellipsoid.maximumRadius,
|
|
3538
|
+
ray.origin
|
|
3539
|
+
);
|
|
3540
|
+
|
|
3541
|
+
const intersection = this.pick(ray, scene.frameState, scratchIntersection);
|
|
3542
|
+
if (!defined(intersection)) {
|
|
3543
|
+
return;
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
return ellipsoid.cartesianToCartographic(
|
|
3547
|
+
intersection,
|
|
3548
|
+
scratchGetHeightCartographic
|
|
3549
|
+
)?.height;
|
|
3550
|
+
};
|
|
3551
|
+
|
|
3552
|
+
/**
|
|
3553
|
+
* Calls the callback when a new tile is rendered that contains the given cartographic. The only parameter
|
|
3554
|
+
* is the cartographic position on the tile.
|
|
3555
|
+
*
|
|
3556
|
+
* @private
|
|
3557
|
+
*
|
|
3558
|
+
* @param {Scene} scene The scene where visualization is taking place.
|
|
3559
|
+
* @param {Cartographic} cartographic The cartographic position.
|
|
3560
|
+
* @param {Function} callback The function to be called when a new tile is loaded.
|
|
3561
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to use.
|
|
3562
|
+
* @returns {Function} The function to remove this callback from the quadtree.
|
|
3563
|
+
*/
|
|
3564
|
+
Cesium3DTileset.prototype.updateHeight = function (
|
|
3565
|
+
cartographic,
|
|
3566
|
+
callback,
|
|
3567
|
+
ellipsoid
|
|
3568
|
+
) {
|
|
3569
|
+
ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
|
|
3570
|
+
|
|
3571
|
+
const object = {
|
|
3572
|
+
positionCartographic: cartographic,
|
|
3573
|
+
ellipsoid: ellipsoid,
|
|
3574
|
+
callback: callback,
|
|
3575
|
+
invoked: false,
|
|
3576
|
+
};
|
|
3577
|
+
|
|
3578
|
+
const removeCallback = () => {
|
|
3579
|
+
const addedCallbacks = this._addHeightCallbacks;
|
|
3580
|
+
const length = addedCallbacks.length;
|
|
3581
|
+
for (let i = 0; i < length; ++i) {
|
|
3582
|
+
if (addedCallbacks[i] === object) {
|
|
3583
|
+
addedCallbacks.splice(i, 1);
|
|
3584
|
+
break;
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
|
|
3588
|
+
if (object.callback) {
|
|
3589
|
+
object.callback = undefined;
|
|
3590
|
+
}
|
|
3591
|
+
};
|
|
3592
|
+
|
|
3593
|
+
this._addHeightCallbacks.push(object);
|
|
3594
|
+
return removeCallback;
|
|
3595
|
+
};
|
|
3596
|
+
|
|
3597
|
+
const scratchSphereIntersection = new Interval();
|
|
3598
|
+
const scratchPickIntersection = new Cartesian3();
|
|
3599
|
+
|
|
3600
|
+
/**
|
|
3601
|
+
* Find an intersection between a ray and the tileset surface that was rendered. The ray must be given in world coordinates.
|
|
3602
|
+
*
|
|
3603
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
3604
|
+
* @param {FrameState} frameState The frame state.
|
|
3605
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
3606
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
3607
|
+
*
|
|
3608
|
+
* @private
|
|
3609
|
+
*/
|
|
3610
|
+
Cesium3DTileset.prototype.pick = function (ray, frameState, result) {
|
|
3611
|
+
if (!frameState.context.webgl2 && !this._enablePick) {
|
|
3612
|
+
return;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
const selectedTiles = this._selectedTiles;
|
|
3616
|
+
const selectedLength = selectedTiles.length;
|
|
3617
|
+
const candidates = [];
|
|
3618
|
+
|
|
3619
|
+
for (let i = 0; i < selectedLength; ++i) {
|
|
3620
|
+
const tile = selectedTiles[i];
|
|
3621
|
+
const boundsIntersection = IntersectionTests.raySphere(
|
|
3622
|
+
ray,
|
|
3623
|
+
tile.contentBoundingVolume.boundingSphere,
|
|
3624
|
+
scratchSphereIntersection
|
|
3625
|
+
);
|
|
3626
|
+
if (!defined(boundsIntersection) || !defined(tile.content)) {
|
|
3627
|
+
continue;
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
candidates.push(tile);
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
const length = candidates.length;
|
|
3634
|
+
candidates.sort((a, b) => {
|
|
3635
|
+
const aDist = BoundingSphere.distanceSquaredTo(
|
|
3636
|
+
a.contentBoundingVolume.boundingSphere,
|
|
3637
|
+
ray.origin
|
|
3638
|
+
);
|
|
3639
|
+
const bDist = BoundingSphere.distanceSquaredTo(
|
|
3640
|
+
b.contentBoundingVolume.boundingSphere,
|
|
3641
|
+
ray.origin
|
|
3642
|
+
);
|
|
3643
|
+
|
|
3644
|
+
return aDist - bDist;
|
|
3645
|
+
});
|
|
3646
|
+
|
|
3647
|
+
let intersection;
|
|
3648
|
+
for (let i = 0; i < length; ++i) {
|
|
3649
|
+
const tile = candidates[i];
|
|
3650
|
+
const candidate = tile.content.pick(
|
|
3651
|
+
ray,
|
|
3652
|
+
frameState,
|
|
3653
|
+
scratchPickIntersection
|
|
3654
|
+
);
|
|
3655
|
+
|
|
3656
|
+
if (defined(candidate)) {
|
|
3657
|
+
intersection = Cartesian3.clone(candidate, result);
|
|
3658
|
+
return intersection;
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
};
|
|
3662
|
+
|
|
3382
3663
|
/**
|
|
3383
3664
|
* Optimization option. Used as a callback when {@link Cesium3DTileset#foveatedScreenSpaceError} is true to control how much to raise the screen space error for tiles outside the foveated cone,
|
|
3384
3665
|
* interpolating between {@link Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation} and {@link Cesium3DTileset#maximumScreenSpaceError}.
|
|
@@ -79,6 +79,8 @@ Cesium3DTilesetTraversal.selectTile = function (tile, frameState) {
|
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
tile._wasSelectedLastFrame = true;
|
|
83
|
+
|
|
82
84
|
const { content, tileset } = tile;
|
|
83
85
|
if (content.featurePropertiesDirty) {
|
|
84
86
|
// A feature's property in this tile changed, the tile needs to be re-styled.
|
|
@@ -88,7 +90,9 @@ Cesium3DTilesetTraversal.selectTile = function (tile, frameState) {
|
|
|
88
90
|
} else if (tile._selectedFrame < frameState.frameNumber - 1) {
|
|
89
91
|
// Tile is newly selected; it is selected this frame, but was not selected last frame.
|
|
90
92
|
tileset._selectedTilesToStyle.push(tile);
|
|
93
|
+
tile._wasSelectedLastFrame = false;
|
|
91
94
|
}
|
|
95
|
+
|
|
92
96
|
tile._selectedFrame = frameState.frameNumber;
|
|
93
97
|
tileset._selectedTiles.push(tile);
|
|
94
98
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
1
2
|
import defaultValue from "../Core/defaultValue.js";
|
|
2
3
|
import defined from "../Core/defined.js";
|
|
3
4
|
import destroyObject from "../Core/destroyObject.js";
|
|
@@ -347,6 +348,47 @@ Composite3DTileContent.prototype.update = function (tileset, frameState) {
|
|
|
347
348
|
}
|
|
348
349
|
};
|
|
349
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
|
|
353
|
+
*
|
|
354
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
355
|
+
* @param {FrameState} frameState The frame state.
|
|
356
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
357
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
358
|
+
*
|
|
359
|
+
* @private
|
|
360
|
+
*/
|
|
361
|
+
Composite3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
362
|
+
if (!this._ready) {
|
|
363
|
+
return undefined;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
let intersection;
|
|
367
|
+
let minDistance = Number.POSITIVE_INFINITY;
|
|
368
|
+
const contents = this._contents;
|
|
369
|
+
const length = contents.length;
|
|
370
|
+
|
|
371
|
+
for (let i = 0; i < length; ++i) {
|
|
372
|
+
const candidate = contents[i].pick(ray, frameState, result);
|
|
373
|
+
|
|
374
|
+
if (!defined(candidate)) {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const distance = Cartesian3.distance(ray.origin, candidate);
|
|
379
|
+
if (distance < minDistance) {
|
|
380
|
+
intersection = candidate;
|
|
381
|
+
minDistance = distance;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (!defined(intersection)) {
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return result;
|
|
390
|
+
};
|
|
391
|
+
|
|
350
392
|
Composite3DTileContent.prototype.isDestroyed = function () {
|
|
351
393
|
return false;
|
|
352
394
|
};
|