@cesium/engine 6.2.0 → 8.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-RH4N2ONY.js → chunk-23UFSGND.js} +7 -7
- package/Build/Workers/{chunk-HPP4JLNH.js → chunk-2A75IWRS.js} +7 -7
- package/Build/Workers/{chunk-5IRLXUTA.js → chunk-2FRVPMCS.js} +10 -10
- package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-2FWRMUTY.js} +4 -4
- package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-2UPKWTMJ.js} +6 -6
- package/Build/Workers/{chunk-434ZTTFX.js → chunk-34FXV7D7.js} +2 -2
- package/Build/Workers/{chunk-MW3CJYLX.js → chunk-3VAZEH7M.js} +2 -2
- package/Build/Workers/{chunk-HUPNRBWW.js → chunk-4DO5W5XZ.js} +6 -6
- package/Build/Workers/{chunk-PIXK6KHB.js → chunk-4H7PY4U5.js} +2 -2
- package/Build/Workers/{chunk-BP467WX3.js → chunk-5QULIR53.js} +4 -4
- package/Build/Workers/{chunk-R3HUGXBH.js → chunk-7TC63SJW.js} +8 -8
- package/Build/Workers/{chunk-SQVTYRZY.js → chunk-7ZFGPDJA.js} +4 -4
- package/Build/Workers/{chunk-TIXXVKUY.js → chunk-A5DWLWCY.js} +10 -10
- package/Build/Workers/{chunk-CWJQGBWT.js → chunk-BBWDMCVU.js} +1 -1
- package/Build/Workers/{chunk-4KP73B43.js → chunk-BG4UCVXN.js} +3 -3
- package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-BIKA3NRA.js} +5 -5
- package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-BROJAZRZ.js} +13 -13
- package/Build/Workers/{chunk-FWGNCYP6.js → chunk-DDUQAJ4P.js} +7 -7
- package/Build/Workers/{chunk-QRBRVGZC.js → chunk-EERJKOAF.js} +4 -4
- package/Build/Workers/{chunk-52VSIKEA.js → chunk-EG6PTBY2.js} +15 -15
- package/Build/Workers/{chunk-O43GWBSF.js → chunk-EHWHNOEX.js} +1 -1
- package/Build/Workers/{chunk-MN34FIF5.js → chunk-F3YA3Y2Z.js} +1 -1
- package/Build/Workers/{chunk-GF5TNNKP.js → chunk-F4HFJMGM.js} +6 -6
- package/Build/Workers/{chunk-HOT2SNXP.js → chunk-FJKNFAKQ.js} +133 -553
- package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-FNIRWHJB.js} +10 -10
- package/Build/Workers/{chunk-DMCSY5BU.js → chunk-FZRIVR7Y.js} +5 -5
- package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-G43QFN4Q.js} +6 -6
- package/Build/Workers/{chunk-HPH5HSFE.js → chunk-GATZHF3K.js} +2 -2
- package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-GRC2ZTAF.js} +14 -14
- package/Build/Workers/{chunk-NE4JNU6H.js → chunk-HU6N6EXB.js} +10 -10
- package/Build/Workers/{chunk-GVL5I7TC.js → chunk-I46ZRR5W.js} +17 -17
- package/Build/Workers/{chunk-5GDBZTHX.js → chunk-JURN7NPV.js} +17 -17
- package/Build/Workers/{chunk-H5DUXHCV.js → chunk-KKCR2YOP.js} +11 -11
- package/Build/Workers/{chunk-LX6XV4DK.js → chunk-LPR3YNP2.js} +5 -5
- package/Build/Workers/{chunk-HFKSAB5K.js → chunk-M7ERACJJ.js} +13 -13
- package/Build/Workers/{chunk-BUZDZBUH.js → chunk-MDWEGWPA.js} +10 -10
- package/Build/Workers/{chunk-LGJUI2CE.js → chunk-OGXZVPPM.js} +9 -5
- package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-PGSJK77E.js} +6 -6
- package/Build/Workers/{chunk-ARPTYYKS.js → chunk-PPH7OFP3.js} +5 -5
- package/Build/Workers/{chunk-R4OZKBXH.js → chunk-SH5USDPI.js} +6 -6
- package/Build/Workers/{chunk-SV7DDPAC.js → chunk-SOWMRMWA.js} +1 -1
- package/Build/Workers/{chunk-RIDPF7PO.js → chunk-STW2DGFI.js} +2 -2
- package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-T3XIFPYR.js} +13 -13
- package/Build/Workers/chunk-TTUZP4BO.js +501 -0
- package/Build/Workers/{chunk-QTZQZY2C.js → chunk-UEXTBDBE.js} +34 -10
- package/Build/Workers/{chunk-XUTVA4K5.js → chunk-VOXYEYJT.js} +11 -11
- package/Build/Workers/{chunk-AXFRNOVC.js → chunk-X4356LRH.js} +12 -12
- package/Build/Workers/{chunk-5HLGKKG3.js → chunk-XGI5BXZY.js} +2 -2
- package/Build/Workers/{chunk-SNN7WOC2.js → chunk-Y2ME2IJV.js} +13 -13
- package/Build/Workers/{chunk-LGL4P5KL.js → chunk-Y5UQJLYE.js} +6 -6
- package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-YJEBABKH.js} +7 -7
- package/Build/Workers/{chunk-YBKFS53K.js → chunk-YWTJ2B4B.js} +1 -1
- package/Build/Workers/{chunk-5SK36PU4.js → chunk-Z3TIFFGF.js} +7 -7
- package/Build/Workers/{chunk-JGG36SQV.js → chunk-ZT7KWISZ.js} +4 -4
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +32 -166
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/LICENSE.md +1 -1
- package/Source/Assets/approximateTerrainHeights.json +1 -1
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/GregorianDate.js +85 -0
- package/Source/Core/HeadingPitchRange.js +2 -2
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/PolygonGeometry.js +0 -169
- package/Source/Core/Resource.js +30 -69
- package/Source/Core/Transforms.js +30 -18
- package/Source/Core/createWorldBathymetryAsync.js +45 -0
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
- package/Source/DataSources/Entity.js +28 -7
- package/Source/DataSources/EntityCollection.js +1 -2
- package/Source/DataSources/GeometryUpdater.js +1 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- 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/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/UniformState.js +127 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Atmosphere.js +127 -0
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Billboard.js +29 -26
- package/Source/Scene/BillboardCollection.js +3 -3
- package/Source/Scene/Camera.js +47 -5
- package/Source/Scene/Cesium3DTile.js +1 -0
- package/Source/Scene/Cesium3DTileContent.js +14 -0
- package/Source/Scene/Cesium3DTileset.js +364 -45
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- 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 +14 -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/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfLoader.js +15 -5
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/HeightReference.js +59 -2
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/Implicit3DTileContent.js +4 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- 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 +426 -0
- package/Source/Scene/Multiple3DTileContent.js +42 -0
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -2
- package/Source/Scene/QuadtreePrimitive.js +1 -1
- package/Source/Scene/Scene.js +312 -46
- package/Source/Scene/ScreenSpaceCameraController.js +23 -13
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SkyAtmosphere.js +5 -6
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- 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/Scene/VoxelBoxShape.js +76 -0
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +114 -43
- package/Source/Scene/VoxelEllipsoidShape.js +158 -116
- package/Source/Scene/VoxelPrimitive.js +3 -1
- package/Source/Scene/VoxelRenderResources.js +3 -0
- package/Source/Scene/VoxelShape.js +13 -0
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +2 -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/Shaders/Voxels/IntersectCylinder.glsl +14 -111
- package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
- package/Source/Shaders/Voxels/VoxelFS.js +39 -1
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
- package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/ThirdParty/draco_decoder.wasm +0 -0
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +574 -71
- package/index.js +217 -196
- package/package.json +3 -3
- package/Build/Workers/chunk-ATB2I7OS.js +0 -55
|
@@ -0,0 +1,426 @@
|
|
|
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 byteOffset = positionAttribute.byteOffset;
|
|
202
|
+
const byteStride = positionAttribute.byteStride;
|
|
203
|
+
const vertexCount = positionAttribute.count;
|
|
204
|
+
|
|
205
|
+
if (!defined(primitive.indices)) {
|
|
206
|
+
// Point clouds
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
let indices = primitive.indices.typedArray;
|
|
211
|
+
if (!defined(indices)) {
|
|
212
|
+
const indicesBuffer = primitive.indices.buffer;
|
|
213
|
+
const indicesCount = primitive.indices.count;
|
|
214
|
+
const indexDatatype = primitive.indices.indexDatatype;
|
|
215
|
+
if (defined(indicesBuffer) && frameState.context.webgl2) {
|
|
216
|
+
if (indexDatatype === IndexDatatype.UNSIGNED_BYTE) {
|
|
217
|
+
indices = new Uint8Array(indicesCount);
|
|
218
|
+
} else if (indexDatatype === IndexDatatype.UNSIGNED_SHORT) {
|
|
219
|
+
indices = new Uint16Array(indicesCount);
|
|
220
|
+
} else if (indexDatatype === IndexDatatype.UNSIGNED_INT) {
|
|
221
|
+
indices = new Uint32Array(indicesCount);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
indicesBuffer.getBufferData(indices);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let vertices = positionAttribute.typedArray;
|
|
229
|
+
let componentDatatype = positionAttribute.componentDatatype;
|
|
230
|
+
let attributeType = positionAttribute.type;
|
|
231
|
+
|
|
232
|
+
const quantization = positionAttribute.quantization;
|
|
233
|
+
if (defined(quantization)) {
|
|
234
|
+
componentDatatype = positionAttribute.quantization.componentDatatype;
|
|
235
|
+
attributeType = positionAttribute.quantization.type;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const numComponents = AttributeType.getNumberOfComponents(attributeType);
|
|
239
|
+
const bytes = ComponentDatatype.getSizeInBytes(componentDatatype);
|
|
240
|
+
const isInterleaved =
|
|
241
|
+
!defined(vertices) &&
|
|
242
|
+
defined(byteStride) &&
|
|
243
|
+
byteStride !== numComponents * bytes;
|
|
244
|
+
|
|
245
|
+
let elementStride = numComponents;
|
|
246
|
+
let offset = 0;
|
|
247
|
+
if (isInterleaved) {
|
|
248
|
+
elementStride = byteStride / bytes;
|
|
249
|
+
offset = byteOffset / bytes;
|
|
250
|
+
}
|
|
251
|
+
const elementCount = vertexCount * elementStride;
|
|
252
|
+
|
|
253
|
+
if (!defined(vertices)) {
|
|
254
|
+
const verticesBuffer = positionAttribute.buffer;
|
|
255
|
+
|
|
256
|
+
if (defined(verticesBuffer) && frameState.context.webgl2) {
|
|
257
|
+
vertices = ComponentDatatype.createTypedArray(
|
|
258
|
+
componentDatatype,
|
|
259
|
+
elementCount
|
|
260
|
+
);
|
|
261
|
+
verticesBuffer.getBufferData(
|
|
262
|
+
vertices,
|
|
263
|
+
isInterleaved ? 0 : byteOffset,
|
|
264
|
+
0,
|
|
265
|
+
elementCount
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (quantization && positionAttribute.normalized) {
|
|
270
|
+
vertices = AttributeCompression.dequantize(
|
|
271
|
+
vertices,
|
|
272
|
+
componentDatatype,
|
|
273
|
+
attributeType,
|
|
274
|
+
vertexCount
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (!defined(indices) || !defined(vertices)) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
|
|
284
|
+
verticalExaggeration = defaultValue(verticalExaggeration, 1.0);
|
|
285
|
+
relativeHeight = defaultValue(relativeHeight, 0.0);
|
|
286
|
+
|
|
287
|
+
const indicesLength = indices.length;
|
|
288
|
+
for (let i = 0; i < indicesLength; i += 3) {
|
|
289
|
+
const i0 = indices[i];
|
|
290
|
+
const i1 = indices[i + 1];
|
|
291
|
+
const i2 = indices[i + 2];
|
|
292
|
+
|
|
293
|
+
for (const instanceTransform of transforms) {
|
|
294
|
+
const v0 = getVertexPosition(
|
|
295
|
+
vertices,
|
|
296
|
+
i0,
|
|
297
|
+
offset,
|
|
298
|
+
elementStride,
|
|
299
|
+
quantization,
|
|
300
|
+
instanceTransform,
|
|
301
|
+
verticalExaggeration,
|
|
302
|
+
relativeHeight,
|
|
303
|
+
ellipsoid,
|
|
304
|
+
scratchV0
|
|
305
|
+
);
|
|
306
|
+
const v1 = getVertexPosition(
|
|
307
|
+
vertices,
|
|
308
|
+
i1,
|
|
309
|
+
offset,
|
|
310
|
+
elementStride,
|
|
311
|
+
quantization,
|
|
312
|
+
instanceTransform,
|
|
313
|
+
verticalExaggeration,
|
|
314
|
+
relativeHeight,
|
|
315
|
+
ellipsoid,
|
|
316
|
+
scratchV1
|
|
317
|
+
);
|
|
318
|
+
const v2 = getVertexPosition(
|
|
319
|
+
vertices,
|
|
320
|
+
i2,
|
|
321
|
+
offset,
|
|
322
|
+
elementStride,
|
|
323
|
+
quantization,
|
|
324
|
+
instanceTransform,
|
|
325
|
+
verticalExaggeration,
|
|
326
|
+
relativeHeight,
|
|
327
|
+
ellipsoid,
|
|
328
|
+
scratchV2
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
const t = IntersectionTests.rayTriangleParametric(
|
|
332
|
+
ray,
|
|
333
|
+
v0,
|
|
334
|
+
v1,
|
|
335
|
+
v2,
|
|
336
|
+
defaultValue(model.backFaceCulling, true)
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
if (defined(t)) {
|
|
340
|
+
if (t < minT && t >= 0.0) {
|
|
341
|
+
minT = t;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (minT === Number.MAX_VALUE) {
|
|
350
|
+
return undefined;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
result = Ray.getPoint(ray, minT, result);
|
|
354
|
+
if (frameState.mode !== SceneMode.SCENE3D) {
|
|
355
|
+
Cartesian3.fromElements(result.y, result.z, result.x, result);
|
|
356
|
+
|
|
357
|
+
const projection = frameState.mapProjection;
|
|
358
|
+
const ellipsoid = projection.ellipsoid;
|
|
359
|
+
|
|
360
|
+
const cartographic = projection.unproject(result, scratchPickCartographic);
|
|
361
|
+
ellipsoid.cartographicToCartesian(cartographic, result);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return result;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function getVertexPosition(
|
|
368
|
+
vertices,
|
|
369
|
+
index,
|
|
370
|
+
offset,
|
|
371
|
+
numElements,
|
|
372
|
+
quantization,
|
|
373
|
+
instanceTransform,
|
|
374
|
+
verticalExaggeration,
|
|
375
|
+
relativeHeight,
|
|
376
|
+
ellipsoid,
|
|
377
|
+
result
|
|
378
|
+
) {
|
|
379
|
+
const i = offset + index * numElements;
|
|
380
|
+
result.x = vertices[i];
|
|
381
|
+
result.y = vertices[i + 1];
|
|
382
|
+
result.z = vertices[i + 2];
|
|
383
|
+
|
|
384
|
+
if (defined(quantization)) {
|
|
385
|
+
if (quantization.octEncoded) {
|
|
386
|
+
result = AttributeCompression.octDecodeInRange(
|
|
387
|
+
result,
|
|
388
|
+
quantization.normalizationRange,
|
|
389
|
+
result
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
if (quantization.octEncodedZXY) {
|
|
393
|
+
const x = result.x;
|
|
394
|
+
result.x = result.z;
|
|
395
|
+
result.z = result.y;
|
|
396
|
+
result.y = x;
|
|
397
|
+
}
|
|
398
|
+
} else {
|
|
399
|
+
result = Cartesian3.multiplyComponents(
|
|
400
|
+
result,
|
|
401
|
+
quantization.quantizedVolumeStepSize,
|
|
402
|
+
result
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
result = Cartesian3.add(
|
|
406
|
+
result,
|
|
407
|
+
quantization.quantizedVolumeOffset,
|
|
408
|
+
result
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
result = Matrix4.multiplyByPoint(instanceTransform, result, result);
|
|
414
|
+
|
|
415
|
+
if (verticalExaggeration !== 1.0) {
|
|
416
|
+
VerticalExaggeration.getPosition(
|
|
417
|
+
result,
|
|
418
|
+
ellipsoid,
|
|
419
|
+
verticalExaggeration,
|
|
420
|
+
relativeHeight,
|
|
421
|
+
result
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return result;
|
|
426
|
+
}
|
|
@@ -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
|
};
|
|
@@ -27,10 +27,10 @@ function PickFramebuffer(context) {
|
|
|
27
27
|
this._width = 0;
|
|
28
28
|
this._height = 0;
|
|
29
29
|
}
|
|
30
|
+
|
|
30
31
|
PickFramebuffer.prototype.begin = function (screenSpaceRectangle, viewport) {
|
|
31
32
|
const context = this._context;
|
|
32
|
-
const width = viewport
|
|
33
|
-
const height = viewport.height;
|
|
33
|
+
const { width, height } = viewport;
|
|
34
34
|
|
|
35
35
|
BoundingRectangle.clone(
|
|
36
36
|
screenSpaceRectangle,
|
|
@@ -51,6 +51,12 @@ PickFramebuffer.prototype.begin = function (screenSpaceRectangle, viewport) {
|
|
|
51
51
|
|
|
52
52
|
const colorScratch = new Color();
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Return the picked object rendered within a given rectangle.
|
|
56
|
+
*
|
|
57
|
+
* @param {BoundingRectangle} screenSpaceRectangle
|
|
58
|
+
* @returns {object|undefined} The object rendered in the middle of the rectangle, or undefined if nothing was rendered.
|
|
59
|
+
*/
|
|
54
60
|
PickFramebuffer.prototype.end = function (screenSpaceRectangle) {
|
|
55
61
|
const width = defaultValue(screenSpaceRectangle.width, 1.0);
|
|
56
62
|
const height = defaultValue(screenSpaceRectangle.height, 1.0);
|
|
@@ -114,6 +120,34 @@ PickFramebuffer.prototype.end = function (screenSpaceRectangle) {
|
|
|
114
120
|
return undefined;
|
|
115
121
|
};
|
|
116
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Return voxel tile and sample information as rendered by a pickVoxel pass,
|
|
125
|
+
* within a given rectangle.
|
|
126
|
+
*
|
|
127
|
+
* @param {BoundingRectangle} screenSpaceRectangle
|
|
128
|
+
* @returns {TypedArray}
|
|
129
|
+
*/
|
|
130
|
+
PickFramebuffer.prototype.readVoxelInfo = function (screenSpaceRectangle) {
|
|
131
|
+
const width = defaultValue(screenSpaceRectangle.width, 1.0);
|
|
132
|
+
const height = defaultValue(screenSpaceRectangle.height, 1.0);
|
|
133
|
+
|
|
134
|
+
const context = this._context;
|
|
135
|
+
const pixels = context.readPixels({
|
|
136
|
+
x: screenSpaceRectangle.x,
|
|
137
|
+
y: screenSpaceRectangle.y,
|
|
138
|
+
width: width,
|
|
139
|
+
height: height,
|
|
140
|
+
framebuffer: this._fb.framebuffer,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Read the center pixel
|
|
144
|
+
const halfWidth = Math.floor(width * 0.5);
|
|
145
|
+
const halfHeight = Math.floor(height * 0.5);
|
|
146
|
+
const index = 4 * (halfHeight * width + halfWidth);
|
|
147
|
+
|
|
148
|
+
return pixels.slice(index, index + 4);
|
|
149
|
+
};
|
|
150
|
+
|
|
117
151
|
PickFramebuffer.prototype.isDestroyed = function () {
|
|
118
152
|
return false;
|
|
119
153
|
};
|
|
@@ -122,4 +156,5 @@ PickFramebuffer.prototype.destroy = function () {
|
|
|
122
156
|
this._fb.destroy();
|
|
123
157
|
return destroyObject(this);
|
|
124
158
|
};
|
|
159
|
+
|
|
125
160
|
export default PickFramebuffer;
|