@cesium/engine 6.1.1 → 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-FRG2Z7DE.js → chunk-2HJWSU7B.js} +4 -4
- package/Build/Workers/{chunk-ZTYE74E2.js → chunk-46UD5ABS.js} +4 -4
- package/Build/Workers/{chunk-VODWDCX6.js → chunk-4EBHOMFX.js} +18 -20
- package/Build/Workers/{chunk-N7TYCDTR.js → chunk-5HDYHG3F.js} +13 -13
- package/Build/Workers/{chunk-C53JYYKX.js → chunk-5M3U6ZMA.js} +1 -1
- package/Build/Workers/{chunk-GTEXWEAP.js → chunk-5WQ523AW.js} +5 -5
- package/Build/Workers/{chunk-SEFDWMCW.js → chunk-5YLJ77FF.js} +31 -21
- package/Build/Workers/{chunk-VNRUVNIK.js → chunk-6HZQPRUS.js} +1 -1
- package/Build/Workers/{chunk-PB7BIXHI.js → chunk-6VJVYK2V.js} +2 -2
- package/Build/Workers/{chunk-PHQVHDVI.js → chunk-72SANQJV.js} +325 -5
- package/Build/Workers/{chunk-D325WRAY.js → chunk-7XEAYGZK.js} +35 -11
- package/Build/Workers/{chunk-FGUP2QEP.js → chunk-AIPU2VSX.js} +6 -6
- package/Build/Workers/{chunk-QUXSQQEF.js → chunk-AR5DNBJ4.js} +6 -6
- package/Build/Workers/{chunk-ZVUAJKAL.js → chunk-BZP4T2JJ.js} +11 -13
- package/Build/Workers/{chunk-K6Q5IRBK.js → chunk-DTAIXKTO.js} +6 -6
- package/Build/Workers/{chunk-D4YHO4NZ.js → chunk-F6SE42BK.js} +133 -101
- package/Build/Workers/{chunk-QY2WY5XJ.js → chunk-FP6GYBFX.js} +11 -11
- package/Build/Workers/{chunk-Z6LPXA7S.js → chunk-GEJTYLCO.js} +5 -5
- package/Build/Workers/{chunk-VKTKOIYG.js → chunk-GV56Q4LU.js} +11 -11
- package/Build/Workers/{chunk-KUB2HQXR.js → chunk-IQBYFRVW.js} +8 -8
- package/Build/Workers/{chunk-235MRXLH.js → chunk-IX2JCCNM.js} +1 -1
- package/Build/Workers/{chunk-3FCUUN6M.js → chunk-JCNXK6EL.js} +11 -11
- package/Build/Workers/{chunk-364TQORK.js → chunk-JJ4VBOQ3.js} +5 -7
- package/Build/Workers/{chunk-66CXKODF.js → chunk-JXDC723O.js} +2 -2
- package/Build/Workers/{chunk-OTBRPBCC.js → chunk-JY5YEZFA.js} +9 -9
- package/Build/Workers/{chunk-LSGUCCKJ.js → chunk-L2ZN645J.js} +6 -6
- package/Build/Workers/{chunk-VLDDXYKI.js → chunk-LZ7JIV3K.js} +18 -18
- package/Build/Workers/{chunk-36ESDRIZ.js → chunk-LZGHD6NY.js} +16 -16
- package/Build/Workers/{chunk-PXLFBN2Q.js → chunk-MY3VNFGQ.js} +7 -7
- package/Build/Workers/{chunk-W7F5VTH6.js → chunk-NKPBIX7F.js} +1 -1
- package/Build/Workers/{chunk-XBZSOW3F.js → chunk-NY3K4IM3.js} +12 -12
- package/Build/Workers/{chunk-AI3KSNM6.js → chunk-ODW7WYM4.js} +2 -2
- package/Build/Workers/{chunk-6PWSSCRA.js → chunk-OVLG3FRS.js} +6 -6
- package/Build/Workers/{chunk-MOLGJDJV.js → chunk-PNBGBETF.js} +11 -11
- package/Build/Workers/{chunk-T73B27DG.js → chunk-PTQQUQC3.js} +13 -13
- package/Build/Workers/{chunk-RSWBNJPT.js → chunk-QZAD5O7I.js} +8 -304
- package/Build/Workers/{chunk-I6TVJ6T7.js → chunk-R5X4OQT4.js} +8 -8
- package/Build/Workers/{chunk-DTNN3ODA.js → chunk-RAEV7K66.js} +5 -5
- package/Build/Workers/{chunk-IZED7ODV.js → chunk-RV7ZYPFT.js} +4 -4
- package/Build/Workers/{chunk-7FEGZO3D.js → chunk-S4MAZ3SS.js} +2 -2
- package/Build/Workers/{chunk-J3U6Z5YQ.js → chunk-S6SKF6DT.js} +5 -5
- package/Build/Workers/{chunk-CHDJ66UM.js → chunk-U2VCRRQW.js} +6 -6
- package/Build/Workers/{chunk-R22RQAAM.js → chunk-UAEW6HKG.js} +13 -13
- package/Build/Workers/{chunk-S7IBK36I.js → chunk-UDO6BFSF.js} +14 -16
- package/Build/Workers/{chunk-YS4KPNLC.js → chunk-UGK3FCDY.js} +1 -1
- package/Build/Workers/{chunk-SJDXMQSP.js → chunk-VK3EJHWI.js} +2 -2
- package/Build/Workers/{chunk-HEROVJML.js → chunk-VRGFV2UO.js} +7 -7
- package/Build/Workers/{chunk-VOAZN4IP.js → chunk-WBQCVXR3.js} +4 -4
- package/Build/Workers/{chunk-HSW63JN4.js → chunk-WZU2YLWG.js} +3 -3
- package/Build/Workers/{chunk-4EYB62WJ.js → chunk-XWXM2O2R.js} +6 -6
- package/Build/Workers/{chunk-ZGMOBRTG.js → chunk-YUCVWAY6.js} +7 -7
- package/Build/Workers/{chunk-CLVEIRXT.js → chunk-ZK5JOS3D.js} +15 -17
- package/Build/Workers/{chunk-5NZTU5YL.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 +33 -34
- 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 +18 -19
- 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 +22 -22
- package/Build/Workers/createPlaneGeometry.js +15 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +14 -14
- package/Build/Workers/createPolygonGeometry.js +32 -167
- package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createPolylineGeometry.js +24 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +32 -35
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -29
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +21 -23
- 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 +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -19
- 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 +22 -22
- package/LICENSE.md +1 -1
- package/Source/Assets/approximateTerrainHeights.json +1 -1
- package/Source/Core/Ellipsoid.js +45 -0
- 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/Quaternion.js +6 -2
- package/Source/Core/RectangleOutlineGeometry.js +2 -4
- package/Source/Core/RequestScheduler.js +3 -9
- package/Source/Core/Resource.js +30 -69
- package/Source/Core/TerrainEncoding.js +2 -2
- package/Source/Core/Transforms.js +27 -18
- package/Source/Core/VerticalExaggeration.js +69 -0
- 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 +173 -0
- package/Source/Renderer/UniformState.js +246 -1
- 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 +123 -10
- 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 +13 -5
- package/Source/Scene/Geometry3DTileContent.js +4 -0
- package/Source/Scene/Globe.js +69 -21
- package/Source/Scene/GlobeSurfaceTile.js +4 -4
- package/Source/Scene/GlobeSurfaceTileProvider.js +24 -22
- package/Source/Scene/GltfLoader.js +15 -5
- package/Source/Scene/GroundPrimitive.js +5 -5
- package/Source/Scene/HeightReference.js +59 -2
- package/Source/Scene/ImageryLayer.js +3 -3
- package/Source/Scene/Implicit3DTileContent.js +4 -0
- package/Source/Scene/LabelCollection.js +2 -2
- package/Source/Scene/MapboxImageryProvider.js +2 -2
- package/Source/Scene/Megatexture.js +1 -1
- 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 +93 -32
- package/Source/Scene/Model/Model3DTileContent.js +31 -0
- package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
- package/Source/Scene/Model/ModelRuntimePrimitive.js +6 -0
- package/Source/Scene/Model/ModelSceneGraph.js +6 -0
- package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +60 -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 +226 -19
- package/Source/Scene/ScreenSpaceCameraController.js +14 -25
- package/Source/Scene/SkyAtmosphere.js +5 -6
- package/Source/Scene/Terrain.js +49 -0
- package/Source/Scene/TerrainFillMesh.js +2 -2
- package/Source/Scene/TileBoundingS2Cell.js +2 -2
- package/Source/Scene/TileOrientedBoundingBox.js +1 -1
- package/Source/Scene/Tileset3DTileContent.js +4 -0
- package/Source/Scene/Vector3DTileContent.js +4 -0
- package/Source/Scene/VoxelPrimitive.js +73 -2
- 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 +4 -4
- package/Source/Shaders/GlobeVS.js +4 -4
- 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 +13 -4
- package/Source/Shaders/Model/ModelVS.js +13 -4
- package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +39 -0
- package/Source/Shaders/Model/VerticalExaggerationStageVS.js +41 -0
- 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 +318 -83
- package/index.js +77 -62
- package/package.json +3 -3
- package/Build/Workers/chunk-7ONRI7T4.js +0 -55
- package/Source/Core/TerrainExaggeration.js +0 -49
|
@@ -3,6 +3,7 @@ import combine from "../../Core/combine.js";
|
|
|
3
3
|
import defined from "../../Core/defined.js";
|
|
4
4
|
import destroyObject from "../../Core/destroyObject.js";
|
|
5
5
|
import DeveloperError from "../../Core/DeveloperError.js";
|
|
6
|
+
import Ellipsoid from "../../Core/Ellipsoid.js";
|
|
6
7
|
import Pass from "../../Renderer/Pass.js";
|
|
7
8
|
import ModelAnimationLoop from "../ModelAnimationLoop.js";
|
|
8
9
|
import Model from "./Model.js";
|
|
@@ -416,6 +417,35 @@ Model3DTileContent.fromGeoJson = async function (
|
|
|
416
417
|
return content;
|
|
417
418
|
};
|
|
418
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
|
|
422
|
+
*
|
|
423
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
424
|
+
* @param {FrameState} frameState The frame state.
|
|
425
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
426
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
427
|
+
*
|
|
428
|
+
* @private
|
|
429
|
+
*/
|
|
430
|
+
Model3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
431
|
+
if (!defined(this._model) || !this._ready) {
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const verticalExaggeration = frameState.verticalExaggeration;
|
|
436
|
+
const relativeHeight = frameState.verticalExaggerationRelativeHeight;
|
|
437
|
+
|
|
438
|
+
// All tilesets assume a WGS84 ellipsoid
|
|
439
|
+
return this._model.pick(
|
|
440
|
+
ray,
|
|
441
|
+
frameState,
|
|
442
|
+
verticalExaggeration,
|
|
443
|
+
relativeHeight,
|
|
444
|
+
Ellipsoid.WGS84,
|
|
445
|
+
result
|
|
446
|
+
);
|
|
447
|
+
};
|
|
448
|
+
|
|
419
449
|
function makeModelOptions(tileset, tile, content, additionalOptions) {
|
|
420
450
|
const mainOptions = {
|
|
421
451
|
cull: false, // The model is already culled by 3D Tiles
|
|
@@ -442,6 +472,7 @@ function makeModelOptions(tileset, tile, content, additionalOptions) {
|
|
|
442
472
|
enableDebugWireframe: tileset._enableDebugWireframe,
|
|
443
473
|
debugWireframe: tileset.debugWireframe,
|
|
444
474
|
projectTo2D: tileset._projectTo2D,
|
|
475
|
+
enablePick: tileset._enablePick,
|
|
445
476
|
enableShowOutline: tileset._enableShowOutline,
|
|
446
477
|
showOutline: tileset.showOutline,
|
|
447
478
|
outlineColor: tileset.outlineColor,
|
|
@@ -215,7 +215,8 @@ function createSplines(times, points, interpolation, path, count) {
|
|
|
215
215
|
return splines;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
const scratchCartesian3 = new Cartesian3();
|
|
219
|
+
const scratchQuaternion = new Quaternion();
|
|
219
220
|
|
|
220
221
|
function initialize(runtimeChannel) {
|
|
221
222
|
const channel = runtimeChannel._channel;
|
|
@@ -236,19 +237,6 @@ function initialize(runtimeChannel) {
|
|
|
236
237
|
|
|
237
238
|
runtimeChannel._splines = splines;
|
|
238
239
|
runtimeChannel._path = path;
|
|
239
|
-
|
|
240
|
-
switch (path) {
|
|
241
|
-
case AnimatedPropertyType.TRANSLATION:
|
|
242
|
-
case AnimatedPropertyType.SCALE:
|
|
243
|
-
scratchVariable = new Cartesian3();
|
|
244
|
-
break;
|
|
245
|
-
case AnimatedPropertyType.ROTATION:
|
|
246
|
-
scratchVariable = new Quaternion();
|
|
247
|
-
break;
|
|
248
|
-
case AnimatedPropertyType.WEIGHTS:
|
|
249
|
-
// This is unused when setting a node's morph weights.
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
240
|
}
|
|
253
241
|
|
|
254
242
|
/**
|
|
@@ -286,7 +274,20 @@ ModelAnimationChannel.prototype.animate = function (time) {
|
|
|
286
274
|
: spline.wrapTime(time);
|
|
287
275
|
|
|
288
276
|
// This sets the translate, rotate, and scale properties.
|
|
289
|
-
|
|
277
|
+
if (
|
|
278
|
+
path === AnimatedPropertyType.TRANSLATION ||
|
|
279
|
+
path === AnimatedPropertyType.SCALE
|
|
280
|
+
) {
|
|
281
|
+
runtimeNode[path] = spline.evaluate(
|
|
282
|
+
localAnimationTime,
|
|
283
|
+
scratchCartesian3
|
|
284
|
+
);
|
|
285
|
+
} else if (path === AnimatedPropertyType.ROTATION) {
|
|
286
|
+
runtimeNode[path] = spline.evaluate(
|
|
287
|
+
localAnimationTime,
|
|
288
|
+
scratchQuaternion
|
|
289
|
+
);
|
|
290
|
+
}
|
|
290
291
|
}
|
|
291
292
|
};
|
|
292
293
|
|
|
@@ -24,6 +24,7 @@ import PrimitiveStatisticsPipelineStage from "./PrimitiveStatisticsPipelineStage
|
|
|
24
24
|
import SceneMode2DPipelineStage from "./SceneMode2DPipelineStage.js";
|
|
25
25
|
import SelectedFeatureIdPipelineStage from "./SelectedFeatureIdPipelineStage.js";
|
|
26
26
|
import SkinningPipelineStage from "./SkinningPipelineStage.js";
|
|
27
|
+
import VerticalExaggerationPipelineStage from "./VerticalExaggerationPipelineStage.js";
|
|
27
28
|
import WireframePipelineStage from "./WireframePipelineStage.js";
|
|
28
29
|
|
|
29
30
|
/**
|
|
@@ -198,6 +199,7 @@ ModelRuntimePrimitive.prototype.configurePipeline = function (frameState) {
|
|
|
198
199
|
const mode = frameState.mode;
|
|
199
200
|
const use2D =
|
|
200
201
|
mode !== SceneMode.SCENE3D && !frameState.scene3DOnly && model._projectTo2D;
|
|
202
|
+
const exaggerateTerrain = frameState.verticalExaggeration !== 1.0;
|
|
201
203
|
|
|
202
204
|
const hasMorphTargets =
|
|
203
205
|
defined(primitive.morphTargets) && primitive.morphTargets.length > 0;
|
|
@@ -281,6 +283,10 @@ ModelRuntimePrimitive.prototype.configurePipeline = function (frameState) {
|
|
|
281
283
|
pipelineStages.push(CPUStylingPipelineStage);
|
|
282
284
|
}
|
|
283
285
|
|
|
286
|
+
if (exaggerateTerrain) {
|
|
287
|
+
pipelineStages.push(VerticalExaggerationPipelineStage);
|
|
288
|
+
}
|
|
289
|
+
|
|
284
290
|
if (hasCustomShader) {
|
|
285
291
|
pipelineStages.push(CustomShaderPipelineStage);
|
|
286
292
|
}
|
|
@@ -9,6 +9,7 @@ import SceneMode from "../SceneMode.js";
|
|
|
9
9
|
import SplitDirection from "../SplitDirection.js";
|
|
10
10
|
import buildDrawCommand from "./buildDrawCommand.js";
|
|
11
11
|
import TilesetPipelineStage from "./TilesetPipelineStage.js";
|
|
12
|
+
import AtmospherePipelineStage from "./AtmospherePipelineStage.js";
|
|
12
13
|
import ImageBasedLightingPipelineStage from "./ImageBasedLightingPipelineStage.js";
|
|
13
14
|
import ModelArticulation from "./ModelArticulation.js";
|
|
14
15
|
import ModelColorPipelineStage from "./ModelColorPipelineStage.js";
|
|
@@ -606,6 +607,7 @@ ModelSceneGraph.prototype.configurePipeline = function (frameState) {
|
|
|
606
607
|
modelPipelineStages.length = 0;
|
|
607
608
|
|
|
608
609
|
const model = this._model;
|
|
610
|
+
const fogRenderable = frameState.fog.enabled && frameState.fog.renderable;
|
|
609
611
|
|
|
610
612
|
if (defined(model.color)) {
|
|
611
613
|
modelPipelineStages.push(ModelColorPipelineStage);
|
|
@@ -638,6 +640,10 @@ ModelSceneGraph.prototype.configurePipeline = function (frameState) {
|
|
|
638
640
|
if (ModelType.is3DTiles(model.type)) {
|
|
639
641
|
modelPipelineStages.push(TilesetPipelineStage);
|
|
640
642
|
}
|
|
643
|
+
|
|
644
|
+
if (fogRenderable) {
|
|
645
|
+
modelPipelineStages.push(AtmospherePipelineStage);
|
|
646
|
+
}
|
|
641
647
|
};
|
|
642
648
|
|
|
643
649
|
ModelSceneGraph.prototype.update = function (frameState, updateForAnimations) {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Cartesian2 from "../../Core/Cartesian2.js";
|
|
2
|
+
import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
3
|
+
import VerticalExaggerationStageVS from "../../Shaders/Model/VerticalExaggerationStageVS.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The custom shader pipeline stage takes GLSL callbacks from the
|
|
7
|
+
* {@link CustomShader} and inserts them into the overall shader code for the
|
|
8
|
+
* {@link Model}. The input to the callback is a struct with many
|
|
9
|
+
* properties that depend on the attributes of the primitive. This shader code
|
|
10
|
+
* is automatically generated by this stage.
|
|
11
|
+
*
|
|
12
|
+
* @namespace VerticalExaggerationPipelineStage
|
|
13
|
+
*
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
const VerticalExaggerationPipelineStage = {
|
|
17
|
+
name: "VerticalExaggerationPipelineStage", // Helps with debugging
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const scratchExaggerationUniform = new Cartesian2();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Add vertical exaggeration to a shader
|
|
24
|
+
*
|
|
25
|
+
* @param {PrimitiveRenderResources} renderResources The render resources for the primitive
|
|
26
|
+
* @param {ModelComponents.Primitive} primitive The primitive to be rendered
|
|
27
|
+
* @param {FrameState} frameState The frame state.
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
VerticalExaggerationPipelineStage.process = function (
|
|
31
|
+
renderResources,
|
|
32
|
+
primitive,
|
|
33
|
+
frameState
|
|
34
|
+
) {
|
|
35
|
+
const { shaderBuilder, uniformMap } = renderResources;
|
|
36
|
+
|
|
37
|
+
shaderBuilder.addVertexLines(VerticalExaggerationStageVS);
|
|
38
|
+
|
|
39
|
+
shaderBuilder.addDefine(
|
|
40
|
+
"HAS_VERTICAL_EXAGGERATION",
|
|
41
|
+
undefined,
|
|
42
|
+
ShaderDestination.VERTEX
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
shaderBuilder.addUniform(
|
|
46
|
+
"vec2",
|
|
47
|
+
"u_verticalExaggerationAndRelativeHeight",
|
|
48
|
+
ShaderDestination.VERTEX
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
uniformMap.u_verticalExaggerationAndRelativeHeight = function () {
|
|
52
|
+
return Cartesian2.fromElements(
|
|
53
|
+
frameState.verticalExaggeration,
|
|
54
|
+
frameState.verticalExaggerationRelativeHeight,
|
|
55
|
+
scratchExaggerationUniform
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default VerticalExaggerationPipelineStage;
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import AttributeCompression from "../../Core/AttributeCompression.js";
|
|
2
|
+
import BoundingSphere from "../../Core/BoundingSphere.js";
|
|
3
|
+
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
4
|
+
import Cartographic from "../../Core/Cartographic.js";
|
|
5
|
+
import Check from "../../Core/Check.js";
|
|
6
|
+
import ComponentDatatype from "../../Core/ComponentDatatype.js";
|
|
7
|
+
import defaultValue from "../../Core/defaultValue.js";
|
|
8
|
+
import defined from "../../Core/defined.js";
|
|
9
|
+
import Ellipsoid from "../../Core/Ellipsoid.js";
|
|
10
|
+
import IndexDatatype from "../../Core/IndexDatatype.js";
|
|
11
|
+
import IntersectionTests from "../../Core/IntersectionTests.js";
|
|
12
|
+
import Ray from "../../Core/Ray.js";
|
|
13
|
+
import Matrix4 from "../../Core/Matrix4.js";
|
|
14
|
+
import Transforms from "../../Core/Transforms.js";
|
|
15
|
+
import VerticalExaggeration from "../../Core/VerticalExaggeration.js";
|
|
16
|
+
import AttributeType from "../AttributeType.js";
|
|
17
|
+
import SceneMode from "../SceneMode.js";
|
|
18
|
+
import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
|
|
19
|
+
import ModelUtility from "./ModelUtility.js";
|
|
20
|
+
|
|
21
|
+
const scratchV0 = new Cartesian3();
|
|
22
|
+
const scratchV1 = new Cartesian3();
|
|
23
|
+
const scratchV2 = new Cartesian3();
|
|
24
|
+
const scratchNodeComputedTransform = new Matrix4();
|
|
25
|
+
const scratchModelMatrix = new Matrix4();
|
|
26
|
+
const scratchcomputedModelMatrix = new Matrix4();
|
|
27
|
+
const scratchPickCartographic = new Cartographic();
|
|
28
|
+
const scratchBoundingSphere = new BoundingSphere();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Find an intersection between a ray and the model surface that was rendered. The ray must be given in world coordinates.
|
|
32
|
+
*
|
|
33
|
+
* @param {Model} model The model to pick.
|
|
34
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
35
|
+
* @param {FrameState} frameState The frame state.
|
|
36
|
+
* @param {number} [verticalExaggeration=1.0] A scalar used to exaggerate the height of a position relative to the ellipsoid. If the value is 1.0 there will be no effect.
|
|
37
|
+
* @param {number} [relativeHeight=0.0] The ellipsoid height relative to which a position is exaggerated. If the value is 0.0 the position will be exaggerated relative to the ellipsoid surface.
|
|
38
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid to which the exaggerated position is relative.
|
|
39
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
40
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
export default function pickModel(
|
|
45
|
+
model,
|
|
46
|
+
ray,
|
|
47
|
+
frameState,
|
|
48
|
+
verticalExaggeration,
|
|
49
|
+
relativeHeight,
|
|
50
|
+
ellipsoid,
|
|
51
|
+
result
|
|
52
|
+
) {
|
|
53
|
+
//>>includeStart('debug', pragmas.debug);
|
|
54
|
+
Check.typeOf.object("model", model);
|
|
55
|
+
Check.typeOf.object("ray", ray);
|
|
56
|
+
Check.typeOf.object("frameState", frameState);
|
|
57
|
+
//>>includeEnd('debug');
|
|
58
|
+
|
|
59
|
+
if (!model._ready || frameState.mode === SceneMode.MORPHING) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let minT = Number.MAX_VALUE;
|
|
64
|
+
const sceneGraph = model.sceneGraph;
|
|
65
|
+
|
|
66
|
+
const nodes = sceneGraph._runtimeNodes;
|
|
67
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
68
|
+
const runtimeNode = nodes[i];
|
|
69
|
+
const node = runtimeNode.node;
|
|
70
|
+
|
|
71
|
+
let nodeComputedTransform = Matrix4.clone(
|
|
72
|
+
runtimeNode.computedTransform,
|
|
73
|
+
scratchNodeComputedTransform
|
|
74
|
+
);
|
|
75
|
+
let modelMatrix = Matrix4.clone(
|
|
76
|
+
sceneGraph.computedModelMatrix,
|
|
77
|
+
scratchModelMatrix
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const instances = node.instances;
|
|
81
|
+
if (defined(instances)) {
|
|
82
|
+
if (instances.transformInWorldSpace) {
|
|
83
|
+
// Replicate the multiplication order in LegacyInstancingStageVS.
|
|
84
|
+
modelMatrix = Matrix4.multiplyTransformation(
|
|
85
|
+
model.modelMatrix,
|
|
86
|
+
sceneGraph.components.transform,
|
|
87
|
+
modelMatrix
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
nodeComputedTransform = Matrix4.multiplyTransformation(
|
|
91
|
+
sceneGraph.axisCorrectionMatrix,
|
|
92
|
+
runtimeNode.computedTransform,
|
|
93
|
+
nodeComputedTransform
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let computedModelMatrix = Matrix4.multiplyTransformation(
|
|
99
|
+
modelMatrix,
|
|
100
|
+
nodeComputedTransform,
|
|
101
|
+
scratchcomputedModelMatrix
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
if (frameState.mode !== SceneMode.SCENE3D) {
|
|
105
|
+
computedModelMatrix = Transforms.basisTo2D(
|
|
106
|
+
frameState.mapProjection,
|
|
107
|
+
computedModelMatrix,
|
|
108
|
+
computedModelMatrix
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const transforms = [];
|
|
113
|
+
if (defined(instances)) {
|
|
114
|
+
const transformsCount = instances.attributes[0].count;
|
|
115
|
+
const instanceComponentDatatype =
|
|
116
|
+
instances.attributes[0].componentDatatype;
|
|
117
|
+
|
|
118
|
+
const transformElements = 12;
|
|
119
|
+
let transformsTypedArray = runtimeNode.transformsTypedArray;
|
|
120
|
+
if (!defined(transformsTypedArray)) {
|
|
121
|
+
const instanceTransformsBuffer = runtimeNode.instancingTransformsBuffer;
|
|
122
|
+
if (defined(instanceTransformsBuffer) && frameState.context.webgl2) {
|
|
123
|
+
transformsTypedArray = ComponentDatatype.createTypedArray(
|
|
124
|
+
instanceComponentDatatype,
|
|
125
|
+
transformsCount * transformElements
|
|
126
|
+
);
|
|
127
|
+
instanceTransformsBuffer.getBufferData(transformsTypedArray);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (defined(transformsTypedArray)) {
|
|
132
|
+
for (let i = 0; i < transformsCount; i++) {
|
|
133
|
+
const index = i * transformElements;
|
|
134
|
+
|
|
135
|
+
const transform = new Matrix4(
|
|
136
|
+
transformsTypedArray[index],
|
|
137
|
+
transformsTypedArray[index + 1],
|
|
138
|
+
transformsTypedArray[index + 2],
|
|
139
|
+
transformsTypedArray[index + 3],
|
|
140
|
+
transformsTypedArray[index + 4],
|
|
141
|
+
transformsTypedArray[index + 5],
|
|
142
|
+
transformsTypedArray[index + 6],
|
|
143
|
+
transformsTypedArray[index + 7],
|
|
144
|
+
transformsTypedArray[index + 8],
|
|
145
|
+
transformsTypedArray[index + 9],
|
|
146
|
+
transformsTypedArray[index + 10],
|
|
147
|
+
transformsTypedArray[index + 11],
|
|
148
|
+
0,
|
|
149
|
+
0,
|
|
150
|
+
0,
|
|
151
|
+
1
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
if (instances.transformInWorldSpace) {
|
|
155
|
+
Matrix4.multiplyTransformation(
|
|
156
|
+
transform,
|
|
157
|
+
nodeComputedTransform,
|
|
158
|
+
transform
|
|
159
|
+
);
|
|
160
|
+
Matrix4.multiplyTransformation(modelMatrix, transform, transform);
|
|
161
|
+
} else {
|
|
162
|
+
Matrix4.multiplyTransformation(
|
|
163
|
+
transform,
|
|
164
|
+
computedModelMatrix,
|
|
165
|
+
transform
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
transforms.push(transform);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (transforms.length === 0) {
|
|
174
|
+
transforms.push(computedModelMatrix);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const primitivesLength = runtimeNode.runtimePrimitives.length;
|
|
178
|
+
for (let j = 0; j < primitivesLength; j++) {
|
|
179
|
+
const runtimePrimitive = runtimeNode.runtimePrimitives[j];
|
|
180
|
+
const primitive = runtimePrimitive.primitive;
|
|
181
|
+
|
|
182
|
+
if (defined(runtimePrimitive.boundingSphere) && !defined(instances)) {
|
|
183
|
+
const boundingSphere = BoundingSphere.transform(
|
|
184
|
+
runtimePrimitive.boundingSphere,
|
|
185
|
+
computedModelMatrix,
|
|
186
|
+
scratchBoundingSphere
|
|
187
|
+
);
|
|
188
|
+
const boundsIntersection = IntersectionTests.raySphere(
|
|
189
|
+
ray,
|
|
190
|
+
boundingSphere
|
|
191
|
+
);
|
|
192
|
+
if (!defined(boundsIntersection)) {
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
198
|
+
primitive,
|
|
199
|
+
VertexAttributeSemantic.POSITION
|
|
200
|
+
);
|
|
201
|
+
const vertexCount = positionAttribute.count;
|
|
202
|
+
|
|
203
|
+
if (!defined(primitive.indices)) {
|
|
204
|
+
// Point clouds
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let indices = primitive.indices.typedArray;
|
|
209
|
+
if (!defined(indices)) {
|
|
210
|
+
const indicesBuffer = primitive.indices.buffer;
|
|
211
|
+
const indicesCount = primitive.indices.count;
|
|
212
|
+
const indexDatatype = primitive.indices.indexDatatype;
|
|
213
|
+
if (defined(indicesBuffer) && frameState.context.webgl2) {
|
|
214
|
+
if (indexDatatype === IndexDatatype.UNSIGNED_BYTE) {
|
|
215
|
+
indices = new Uint8Array(indicesCount);
|
|
216
|
+
} else if (indexDatatype === IndexDatatype.UNSIGNED_SHORT) {
|
|
217
|
+
indices = new Uint16Array(indicesCount);
|
|
218
|
+
} else if (indexDatatype === IndexDatatype.UNSIGNED_INT) {
|
|
219
|
+
indices = new Uint32Array(indicesCount);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
indicesBuffer.getBufferData(indices);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
let vertices = positionAttribute.typedArray;
|
|
227
|
+
let componentDatatype = positionAttribute.componentDatatype;
|
|
228
|
+
let attributeType = positionAttribute.type;
|
|
229
|
+
|
|
230
|
+
const quantization = positionAttribute.quantization;
|
|
231
|
+
if (defined(quantization)) {
|
|
232
|
+
componentDatatype = positionAttribute.quantization.componentDatatype;
|
|
233
|
+
attributeType = positionAttribute.quantization.type;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const numComponents = AttributeType.getNumberOfComponents(attributeType);
|
|
237
|
+
const elementCount = vertexCount * numComponents;
|
|
238
|
+
|
|
239
|
+
if (!defined(vertices)) {
|
|
240
|
+
const verticesBuffer = positionAttribute.buffer;
|
|
241
|
+
|
|
242
|
+
if (defined(verticesBuffer) && frameState.context.webgl2) {
|
|
243
|
+
vertices = ComponentDatatype.createTypedArray(
|
|
244
|
+
componentDatatype,
|
|
245
|
+
elementCount
|
|
246
|
+
);
|
|
247
|
+
verticesBuffer.getBufferData(
|
|
248
|
+
vertices,
|
|
249
|
+
positionAttribute.byteOffset,
|
|
250
|
+
0,
|
|
251
|
+
elementCount
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (quantization && positionAttribute.normalized) {
|
|
256
|
+
vertices = AttributeCompression.dequantize(
|
|
257
|
+
vertices,
|
|
258
|
+
componentDatatype,
|
|
259
|
+
attributeType,
|
|
260
|
+
vertexCount
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (!defined(indices) || !defined(vertices)) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
|
|
270
|
+
verticalExaggeration = defaultValue(verticalExaggeration, 1.0);
|
|
271
|
+
relativeHeight = defaultValue(relativeHeight, 0.0);
|
|
272
|
+
|
|
273
|
+
const indicesLength = indices.length;
|
|
274
|
+
for (let i = 0; i < indicesLength; i += 3) {
|
|
275
|
+
const i0 = indices[i];
|
|
276
|
+
const i1 = indices[i + 1];
|
|
277
|
+
const i2 = indices[i + 2];
|
|
278
|
+
|
|
279
|
+
for (const instanceTransform of transforms) {
|
|
280
|
+
const v0 = getVertexPosition(
|
|
281
|
+
vertices,
|
|
282
|
+
i0,
|
|
283
|
+
numComponents,
|
|
284
|
+
quantization,
|
|
285
|
+
instanceTransform,
|
|
286
|
+
verticalExaggeration,
|
|
287
|
+
relativeHeight,
|
|
288
|
+
ellipsoid,
|
|
289
|
+
scratchV0
|
|
290
|
+
);
|
|
291
|
+
const v1 = getVertexPosition(
|
|
292
|
+
vertices,
|
|
293
|
+
i1,
|
|
294
|
+
numComponents,
|
|
295
|
+
quantization,
|
|
296
|
+
instanceTransform,
|
|
297
|
+
verticalExaggeration,
|
|
298
|
+
relativeHeight,
|
|
299
|
+
ellipsoid,
|
|
300
|
+
scratchV1
|
|
301
|
+
);
|
|
302
|
+
const v2 = getVertexPosition(
|
|
303
|
+
vertices,
|
|
304
|
+
i2,
|
|
305
|
+
numComponents,
|
|
306
|
+
quantization,
|
|
307
|
+
instanceTransform,
|
|
308
|
+
verticalExaggeration,
|
|
309
|
+
relativeHeight,
|
|
310
|
+
ellipsoid,
|
|
311
|
+
scratchV2
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
const t = IntersectionTests.rayTriangleParametric(
|
|
315
|
+
ray,
|
|
316
|
+
v0,
|
|
317
|
+
v1,
|
|
318
|
+
v2,
|
|
319
|
+
defaultValue(model.backFaceCulling, true)
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
if (defined(t)) {
|
|
323
|
+
if (t < minT && t >= 0.0) {
|
|
324
|
+
minT = t;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (minT === Number.MAX_VALUE) {
|
|
333
|
+
return undefined;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
result = Ray.getPoint(ray, minT, result);
|
|
337
|
+
if (frameState.mode !== SceneMode.SCENE3D) {
|
|
338
|
+
Cartesian3.fromElements(result.y, result.z, result.x, result);
|
|
339
|
+
|
|
340
|
+
const projection = frameState.mapProjection;
|
|
341
|
+
const ellipsoid = projection.ellipsoid;
|
|
342
|
+
|
|
343
|
+
const cartographic = projection.unproject(result, scratchPickCartographic);
|
|
344
|
+
ellipsoid.cartographicToCartesian(cartographic, result);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function getVertexPosition(
|
|
351
|
+
vertices,
|
|
352
|
+
index,
|
|
353
|
+
numComponents,
|
|
354
|
+
quantization,
|
|
355
|
+
instanceTransform,
|
|
356
|
+
verticalExaggeration,
|
|
357
|
+
relativeHeight,
|
|
358
|
+
ellipsoid,
|
|
359
|
+
result
|
|
360
|
+
) {
|
|
361
|
+
const i = index * numComponents;
|
|
362
|
+
result.x = vertices[i];
|
|
363
|
+
result.y = vertices[i + 1];
|
|
364
|
+
result.z = vertices[i + 2];
|
|
365
|
+
|
|
366
|
+
if (defined(quantization)) {
|
|
367
|
+
if (quantization.octEncoded) {
|
|
368
|
+
result = AttributeCompression.octDecodeInRange(
|
|
369
|
+
result,
|
|
370
|
+
quantization.normalizationRange,
|
|
371
|
+
result
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
if (quantization.octEncodedZXY) {
|
|
375
|
+
const x = result.x;
|
|
376
|
+
result.x = result.z;
|
|
377
|
+
result.z = result.y;
|
|
378
|
+
result.y = x;
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
result = Cartesian3.multiplyComponents(
|
|
382
|
+
result,
|
|
383
|
+
quantization.quantizedVolumeStepSize,
|
|
384
|
+
result
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
result = Cartesian3.add(
|
|
388
|
+
result,
|
|
389
|
+
quantization.quantizedVolumeOffset,
|
|
390
|
+
result
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
result = Matrix4.multiplyByPoint(instanceTransform, result, result);
|
|
396
|
+
|
|
397
|
+
if (verticalExaggeration !== 1.0) {
|
|
398
|
+
VerticalExaggeration.getPosition(
|
|
399
|
+
result,
|
|
400
|
+
ellipsoid,
|
|
401
|
+
verticalExaggeration,
|
|
402
|
+
relativeHeight,
|
|
403
|
+
result
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return result;
|
|
408
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
1
2
|
import defined from "../Core/defined.js";
|
|
2
3
|
import destroyObject from "../Core/destroyObject.js";
|
|
3
4
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
@@ -650,6 +651,47 @@ Multiple3DTileContent.prototype.update = function (tileset, frameState) {
|
|
|
650
651
|
}
|
|
651
652
|
};
|
|
652
653
|
|
|
654
|
+
/**
|
|
655
|
+
* Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
|
|
656
|
+
*
|
|
657
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
658
|
+
* @param {FrameState} frameState The frame state.
|
|
659
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
660
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
661
|
+
*
|
|
662
|
+
* @private
|
|
663
|
+
*/
|
|
664
|
+
Multiple3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
665
|
+
if (!this._ready) {
|
|
666
|
+
return undefined;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
let intersection;
|
|
670
|
+
let minDistance = Number.POSITIVE_INFINITY;
|
|
671
|
+
const contents = this._contents;
|
|
672
|
+
const length = contents.length;
|
|
673
|
+
|
|
674
|
+
for (let i = 0; i < length; ++i) {
|
|
675
|
+
const candidate = contents[i].pick(ray, frameState, result);
|
|
676
|
+
|
|
677
|
+
if (!defined(candidate)) {
|
|
678
|
+
continue;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
const distance = Cartesian3.distance(ray.origin, candidate);
|
|
682
|
+
if (distance < minDistance) {
|
|
683
|
+
intersection = candidate;
|
|
684
|
+
minDistance = distance;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
if (!defined(intersection)) {
|
|
689
|
+
return undefined;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
return result;
|
|
693
|
+
};
|
|
694
|
+
|
|
653
695
|
Multiple3DTileContent.prototype.isDestroyed = function () {
|
|
654
696
|
return false;
|
|
655
697
|
};
|
|
@@ -274,7 +274,7 @@ QuadtreePrimitive.prototype.forEachRenderedTile = function (tileFunction) {
|
|
|
274
274
|
* is the cartesian position on the tile.
|
|
275
275
|
*
|
|
276
276
|
* @param {Cartographic} cartographic The cartographic position.
|
|
277
|
-
* @param {Function} callback The function to be called when a new tile is loaded containing cartographic.
|
|
277
|
+
* @param {Function} callback The function to be called when a new tile is loaded containing the updated cartographic.
|
|
278
278
|
* @returns {Function} The function to remove this callback from the quadtree.
|
|
279
279
|
*/
|
|
280
280
|
QuadtreePrimitive.prototype.updateHeight = function (cartographic, callback) {
|