@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
|
@@ -64,6 +64,7 @@ const Instances = ModelComponents.Instances;
|
|
|
64
64
|
* @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
|
|
65
65
|
* @param {Axis} [options.forwardAxis=Axis.X] The forward-axis of the glTF model.
|
|
66
66
|
* @param {boolean} [options.loadAttributesAsTypedArray=false] Load all attributes as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
|
|
67
|
+
* @param {boolean} [options.enablePick=false] If <code>true</code>, load the positions buffer, any instanced attribute buffers, and index buffer as typed arrays for CPU-enabled picking in WebGL1.
|
|
67
68
|
* @param {boolean} [options.loadIndicesForWireframe=false] Load the index buffer as a typed array so wireframe indices can be created for WebGL1.
|
|
68
69
|
* @param {boolean} [options.loadPrimitiveOutline=true] If true, load outlines from the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. This can be set false to avoid post-processing geometry at load time.
|
|
69
70
|
*/
|
|
@@ -91,6 +92,7 @@ function I3dmLoader(options) {
|
|
|
91
92
|
false
|
|
92
93
|
);
|
|
93
94
|
const loadPrimitiveOutline = defaultValue(options.loadPrimitiveOutline, true);
|
|
95
|
+
const enablePick = defaultValue(options.enablePick, false);
|
|
94
96
|
|
|
95
97
|
//>>includeStart('debug', pragmas.debug);
|
|
96
98
|
Check.typeOf.object("options.i3dmResource", i3dmResource);
|
|
@@ -111,6 +113,7 @@ function I3dmLoader(options) {
|
|
|
111
113
|
this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
|
|
112
114
|
this._loadIndicesForWireframe = loadIndicesForWireframe;
|
|
113
115
|
this._loadPrimitiveOutline = loadPrimitiveOutline;
|
|
116
|
+
this._enablePick = enablePick;
|
|
114
117
|
|
|
115
118
|
this._state = I3dmLoaderState.NOT_LOADED;
|
|
116
119
|
this._promise = undefined;
|
|
@@ -240,6 +243,7 @@ I3dmLoader.prototype.load = function () {
|
|
|
240
243
|
releaseGltfJson: this._releaseGltfJson,
|
|
241
244
|
incrementallyLoadTextures: this._incrementallyLoadTextures,
|
|
242
245
|
loadAttributesAsTypedArray: this._loadAttributesAsTypedArray,
|
|
246
|
+
enablePick: this._enablePick,
|
|
243
247
|
loadIndicesForWireframe: this._loadIndicesForWireframe,
|
|
244
248
|
loadPrimitiveOutline: this._loadPrimitiveOutline,
|
|
245
249
|
};
|
|
@@ -73,6 +73,7 @@ InstancingPipelineStage.process = function (renderResources, node, frameState) {
|
|
|
73
73
|
frameState.mode !== SceneMode.SCENE3D &&
|
|
74
74
|
!frameState.scene3DOnly &&
|
|
75
75
|
model._projectTo2D;
|
|
76
|
+
const keepTypedArray = model._enablePick && !frameState.context.webgl2;
|
|
76
77
|
|
|
77
78
|
const instancingVertexAttributes = [];
|
|
78
79
|
|
|
@@ -81,7 +82,8 @@ InstancingPipelineStage.process = function (renderResources, node, frameState) {
|
|
|
81
82
|
frameState,
|
|
82
83
|
instances,
|
|
83
84
|
instancingVertexAttributes,
|
|
84
|
-
use2D
|
|
85
|
+
use2D,
|
|
86
|
+
keepTypedArray
|
|
85
87
|
);
|
|
86
88
|
|
|
87
89
|
processFeatureIdAttributes(
|
|
@@ -697,7 +699,8 @@ function processTransformAttributes(
|
|
|
697
699
|
frameState,
|
|
698
700
|
instances,
|
|
699
701
|
instancingVertexAttributes,
|
|
700
|
-
use2D
|
|
702
|
+
use2D,
|
|
703
|
+
keepTypedArray
|
|
701
704
|
) {
|
|
702
705
|
const rotationAttribute = ModelUtility.getAttributeBySemantic(
|
|
703
706
|
instances,
|
|
@@ -711,7 +714,8 @@ function processTransformAttributes(
|
|
|
711
714
|
instances,
|
|
712
715
|
instancingVertexAttributes,
|
|
713
716
|
frameState,
|
|
714
|
-
use2D
|
|
717
|
+
use2D,
|
|
718
|
+
keepTypedArray
|
|
715
719
|
);
|
|
716
720
|
} else {
|
|
717
721
|
processTransformVec3Attributes(
|
|
@@ -729,7 +733,8 @@ function processTransformMatrixAttributes(
|
|
|
729
733
|
instances,
|
|
730
734
|
instancingVertexAttributes,
|
|
731
735
|
frameState,
|
|
732
|
-
use2D
|
|
736
|
+
use2D,
|
|
737
|
+
keepTypedArray
|
|
733
738
|
) {
|
|
734
739
|
const shaderBuilder = renderResources.shaderBuilder;
|
|
735
740
|
const count = instances.attributes[0].count;
|
|
@@ -755,6 +760,10 @@ function processTransformMatrixAttributes(
|
|
|
755
760
|
buffer = createVertexBuffer(transformsTypedArray, frameState);
|
|
756
761
|
model._modelResources.push(buffer);
|
|
757
762
|
|
|
763
|
+
if (keepTypedArray) {
|
|
764
|
+
runtimeNode.transformsTypedArray = transformsTypedArray;
|
|
765
|
+
}
|
|
766
|
+
|
|
758
767
|
runtimeNode.instancingTransformsBuffer = buffer;
|
|
759
768
|
}
|
|
760
769
|
|
|
@@ -812,7 +821,8 @@ function processTransformVec3Attributes(
|
|
|
812
821
|
instances,
|
|
813
822
|
instancingVertexAttributes,
|
|
814
823
|
frameState,
|
|
815
|
-
use2D
|
|
824
|
+
use2D,
|
|
825
|
+
keepTypedArray
|
|
816
826
|
) {
|
|
817
827
|
const shaderBuilder = renderResources.shaderBuilder;
|
|
818
828
|
const runtimeNode = renderResources.runtimeNode;
|
|
@@ -872,7 +882,7 @@ function processTransformVec3Attributes(
|
|
|
872
882
|
attributeString
|
|
873
883
|
);
|
|
874
884
|
|
|
875
|
-
if (!use2D) {
|
|
885
|
+
if (!use2D && !keepTypedArray) {
|
|
876
886
|
return;
|
|
877
887
|
}
|
|
878
888
|
|
|
@@ -898,6 +908,10 @@ function processTransformVec3Attributes(
|
|
|
898
908
|
);
|
|
899
909
|
const projectedTypedArray = translationsToTypedArray(projectedTranslations);
|
|
900
910
|
|
|
911
|
+
if (keepTypedArray) {
|
|
912
|
+
runtimeNode.transformsTypedArray = projectedTypedArray;
|
|
913
|
+
}
|
|
914
|
+
|
|
901
915
|
// This memory is counted during the statistics stage at the end
|
|
902
916
|
// of the pipeline.
|
|
903
917
|
buffer2D = createVertexBuffer(projectedTypedArray, frameState);
|
|
@@ -906,6 +920,10 @@ function processTransformVec3Attributes(
|
|
|
906
920
|
runtimeNode.instancingTranslationBuffer2D = buffer2D;
|
|
907
921
|
}
|
|
908
922
|
|
|
923
|
+
if (!use2D) {
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
|
|
909
927
|
const byteOffset = 0;
|
|
910
928
|
const byteStride = undefined;
|
|
911
929
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Matrix3 from "../../Core/Matrix3.js";
|
|
1
2
|
import defined from "../../Core/defined.js";
|
|
2
3
|
import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
3
4
|
import MetadataStageFS from "../../Shaders/Model/MetadataStageFS.js";
|
|
@@ -430,7 +431,13 @@ function addPropertyTexturePropertyMetadata(renderResources, propertyInfo) {
|
|
|
430
431
|
const { shaderBuilder, uniformMap } = renderResources;
|
|
431
432
|
const { metadataVariable, glslType, property } = propertyInfo;
|
|
432
433
|
|
|
433
|
-
const {
|
|
434
|
+
const {
|
|
435
|
+
texCoord,
|
|
436
|
+
channels,
|
|
437
|
+
index,
|
|
438
|
+
texture,
|
|
439
|
+
transform,
|
|
440
|
+
} = property.textureReader;
|
|
434
441
|
const textureUniformName = `u_propertyTexture_${index}`;
|
|
435
442
|
|
|
436
443
|
// Property texture properties may share the same physical texture, so only
|
|
@@ -450,9 +457,30 @@ function addPropertyTexturePropertyMetadata(renderResources, propertyInfo) {
|
|
|
450
457
|
metadataVariable
|
|
451
458
|
);
|
|
452
459
|
|
|
453
|
-
// Get a GLSL expression for the
|
|
460
|
+
// Get a GLSL expression for the texture coordinates of the property.
|
|
461
|
+
// By default, this will be taken directly from the attributes.
|
|
454
462
|
const texCoordVariable = `attributes.texCoord_${texCoord}`;
|
|
455
|
-
|
|
463
|
+
let texCoordVariableExpression = texCoordVariable;
|
|
464
|
+
|
|
465
|
+
// Check if the texture defines a `transform` from a `KHR_texture_transform`
|
|
466
|
+
if (defined(transform) && !Matrix3.equals(transform, Matrix3.IDENTITY)) {
|
|
467
|
+
// Add a uniform for the transformation matrix
|
|
468
|
+
const transformUniformName = `${textureUniformName}Transform`;
|
|
469
|
+
shaderBuilder.addUniform(
|
|
470
|
+
"mat3",
|
|
471
|
+
transformUniformName,
|
|
472
|
+
ShaderDestination.FRAGMENT
|
|
473
|
+
);
|
|
474
|
+
uniformMap[transformUniformName] = function () {
|
|
475
|
+
return transform;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
// Update the expression for the texture coordinates
|
|
479
|
+
// with one that transforms the texture coordinates
|
|
480
|
+
// with the transform matrix first
|
|
481
|
+
texCoordVariableExpression = `vec2(${transformUniformName} * vec3(${texCoordVariable}, 1.0))`;
|
|
482
|
+
}
|
|
483
|
+
const valueExpression = `texture(${textureUniformName}, ${texCoordVariableExpression}).${channels}`;
|
|
456
484
|
|
|
457
485
|
// Some types need an unpacking step or two. For example, since texture reads
|
|
458
486
|
// are always normalized, UINT8 (not normalized) properties need to be
|
|
@@ -9,6 +9,7 @@ import defaultValue from "../../Core/defaultValue.js";
|
|
|
9
9
|
import DeveloperError from "../../Core/DeveloperError.js";
|
|
10
10
|
import destroyObject from "../../Core/destroyObject.js";
|
|
11
11
|
import DistanceDisplayCondition from "../../Core/DistanceDisplayCondition.js";
|
|
12
|
+
import Ellipsoid from "../../Core/Ellipsoid.js";
|
|
12
13
|
import Event from "../../Core/Event.js";
|
|
13
14
|
import Matrix3 from "../../Core/Matrix3.js";
|
|
14
15
|
import Matrix4 from "../../Core/Matrix4.js";
|
|
@@ -18,7 +19,9 @@ import Pass from "../../Renderer/Pass.js";
|
|
|
18
19
|
import ClippingPlaneCollection from "../ClippingPlaneCollection.js";
|
|
19
20
|
import ColorBlendMode from "../ColorBlendMode.js";
|
|
20
21
|
import GltfLoader from "../GltfLoader.js";
|
|
21
|
-
import HeightReference
|
|
22
|
+
import HeightReference, {
|
|
23
|
+
isHeightReferenceRelative,
|
|
24
|
+
} from "../HeightReference.js";
|
|
22
25
|
import ImageBasedLighting from "../ImageBasedLighting.js";
|
|
23
26
|
import PointCloudShading from "../PointCloudShading.js";
|
|
24
27
|
import SceneMode from "../SceneMode.js";
|
|
@@ -37,6 +40,7 @@ import ModelUtility from "./ModelUtility.js";
|
|
|
37
40
|
import oneTimeWarning from "../../Core/oneTimeWarning.js";
|
|
38
41
|
import PntsLoader from "./PntsLoader.js";
|
|
39
42
|
import StyleCommandsNeeded from "./StyleCommandsNeeded.js";
|
|
43
|
+
import pickModel from "./pickModel.js";
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
46
|
* <div class="notice">
|
|
@@ -112,7 +116,7 @@ import StyleCommandsNeeded from "./StyleCommandsNeeded.js";
|
|
|
112
116
|
* @internalConstructor
|
|
113
117
|
*
|
|
114
118
|
* @privateParam {ResourceLoader} options.loader The loader used to load resources for this model.
|
|
115
|
-
* @privateParam {ModelType} options.type Type of this model, to distinguish individual glTF files from 3D Tiles internally.
|
|
119
|
+
* @privateParam {ModelType} options.type Type of this model, to distinguish individual glTF files from 3D Tiles internally.
|
|
116
120
|
* @privateParam {object} options Object with the following properties:
|
|
117
121
|
* @privateParam {Resource} options.resource The Resource to the 3D model.
|
|
118
122
|
* @privateParam {boolean} [options.show=true] Whether or not to render the model.
|
|
@@ -150,11 +154,12 @@ import StyleCommandsNeeded from "./StyleCommandsNeeded.js";
|
|
|
150
154
|
* @privateParam {boolean} [options.showCreditsOnScreen=false] Whether to display the credits of this model on screen.
|
|
151
155
|
* @privateParam {SplitDirection} [options.splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this model.
|
|
152
156
|
* @privateParam {boolean} [options.projectTo2D=false] Whether to accurately project the model's positions in 2D. If this is true, the model will be projected accurately to 2D, but it will use more memory to do so. If this is false, the model will use less memory and will still render in 2D / CV mode, but its positions may be inaccurate. This disables minimumPixelSize and prevents future modification to the model matrix. This also cannot be set after the model has loaded.
|
|
157
|
+
* @privateParam {boolean} [options.enablePick=false] Whether to allow CPU picking with <code>pick</code> when not using WebGL 2 or above. 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 model has loaded.
|
|
153
158
|
* @privateParam {string|number} [options.featureIdLabel="featureId_0"] Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
|
|
154
159
|
* @privateParam {string|number} [options.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.
|
|
155
160
|
* @privateParam {object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting.
|
|
156
161
|
* @privateParam {ClassificationType} [options.classificationType] Determines whether terrain, 3D Tiles or both will be classified by this model. This cannot be set after the model has loaded.
|
|
157
|
-
|
|
162
|
+
|
|
158
163
|
*
|
|
159
164
|
* @see Model.fromGltfAsync
|
|
160
165
|
*
|
|
@@ -192,7 +197,7 @@ function Model(options) {
|
|
|
192
197
|
* When this is the identity matrix, the model is drawn in world coordinates, i.e., Earth's Cartesian WGS84 coordinates.
|
|
193
198
|
* Local reference frames can be used by providing a different transformation matrix, like that returned
|
|
194
199
|
* by {@link Transforms.eastNorthUpToFixedFrame}.
|
|
195
|
-
*
|
|
200
|
+
*
|
|
196
201
|
* @type {Matrix4}
|
|
197
202
|
|
|
198
203
|
* @default {@link Matrix4.IDENTITY}
|
|
@@ -340,10 +345,9 @@ function Model(options) {
|
|
|
340
345
|
const scene = options.scene;
|
|
341
346
|
if (defined(scene) && defined(scene.terrainProviderChanged)) {
|
|
342
347
|
this._terrainProviderChangedCallback = scene.terrainProviderChanged.addEventListener(
|
|
343
|
-
|
|
348
|
+
() => {
|
|
344
349
|
this._heightDirty = true;
|
|
345
|
-
}
|
|
346
|
-
this
|
|
350
|
+
}
|
|
347
351
|
);
|
|
348
352
|
}
|
|
349
353
|
this._scene = scene;
|
|
@@ -455,6 +459,9 @@ function Model(options) {
|
|
|
455
459
|
|
|
456
460
|
this._sceneMode = undefined;
|
|
457
461
|
this._projectTo2D = defaultValue(options.projectTo2D, false);
|
|
462
|
+
this._enablePick = defaultValue(options.enablePick, false);
|
|
463
|
+
|
|
464
|
+
this._fogRenderable = undefined;
|
|
458
465
|
|
|
459
466
|
this._skipLevelOfDetail = false;
|
|
460
467
|
this._ignoreCommands = defaultValue(options.ignoreCommands, false);
|
|
@@ -1550,11 +1557,15 @@ Object.defineProperties(Model.prototype, {
|
|
|
1550
1557
|
* <li>The glTF cannot contain morph targets, skins, or animations.</li>
|
|
1551
1558
|
* <li>The glTF cannot contain the <code>EXT_mesh_gpu_instancing</code> extension.</li>
|
|
1552
1559
|
* <li>Only meshes with TRIANGLES can be used to classify other assets.</li>
|
|
1553
|
-
* <li>The
|
|
1560
|
+
* <li>The meshes must be watertight.</li>
|
|
1561
|
+
* <li>The POSITION attribute is required.</li>
|
|
1554
1562
|
* <li>If feature IDs and an index buffer are both present, all indices with the same feature id must occupy contiguous sections of the index buffer.</li>
|
|
1555
1563
|
* <li>If feature IDs are present without an index buffer, all positions with the same feature id must occupy contiguous sections of the position buffer.</li>
|
|
1556
1564
|
* </ul>
|
|
1557
1565
|
* </p>
|
|
1566
|
+
* <p>
|
|
1567
|
+
* The 3D Tiles or terrain receiving the classification must be opaque.
|
|
1568
|
+
* </p>
|
|
1558
1569
|
*
|
|
1559
1570
|
* @memberof Model.prototype
|
|
1560
1571
|
*
|
|
@@ -1791,6 +1802,7 @@ Model.prototype.update = function (frameState) {
|
|
|
1791
1802
|
updateSkipLevelOfDetail(this, frameState);
|
|
1792
1803
|
updateClippingPlanes(this, frameState);
|
|
1793
1804
|
updateSceneMode(this, frameState);
|
|
1805
|
+
updateFog(this, frameState);
|
|
1794
1806
|
updateVerticalExaggeration(this, frameState);
|
|
1795
1807
|
|
|
1796
1808
|
this._defaultTexture = frameState.context.defaultTexture;
|
|
@@ -1986,6 +1998,14 @@ function updateSceneMode(model, frameState) {
|
|
|
1986
1998
|
}
|
|
1987
1999
|
}
|
|
1988
2000
|
|
|
2001
|
+
function updateFog(model, frameState) {
|
|
2002
|
+
const fogRenderable = frameState.fog.enabled && frameState.fog.renderable;
|
|
2003
|
+
if (fogRenderable !== model._fogRenderable) {
|
|
2004
|
+
model.resetDrawCommands();
|
|
2005
|
+
model._fogRenderable = fogRenderable;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
1989
2009
|
function updateVerticalExaggeration(model, frameState) {
|
|
1990
2010
|
const verticalExaggerationNeeded = frameState.verticalExaggeration !== 1.0;
|
|
1991
2011
|
if (model._verticalExaggerationOn !== verticalExaggerationNeeded) {
|
|
@@ -2036,15 +2056,11 @@ function updateClamping(model) {
|
|
|
2036
2056
|
}
|
|
2037
2057
|
|
|
2038
2058
|
const scene = model._scene;
|
|
2039
|
-
if (
|
|
2040
|
-
!defined(scene) ||
|
|
2041
|
-
!defined(scene.globe) ||
|
|
2042
|
-
model.heightReference === HeightReference.NONE
|
|
2043
|
-
) {
|
|
2059
|
+
if (!defined(scene) || model.heightReference === HeightReference.NONE) {
|
|
2044
2060
|
//>>includeStart('debug', pragmas.debug);
|
|
2045
2061
|
if (model.heightReference !== HeightReference.NONE) {
|
|
2046
2062
|
throw new DeveloperError(
|
|
2047
|
-
"Height reference is not supported without a scene
|
|
2063
|
+
"Height reference is not supported without a scene."
|
|
2048
2064
|
);
|
|
2049
2065
|
}
|
|
2050
2066
|
//>>includeEnd('debug');
|
|
@@ -2053,7 +2069,7 @@ function updateClamping(model) {
|
|
|
2053
2069
|
}
|
|
2054
2070
|
|
|
2055
2071
|
const globe = scene.globe;
|
|
2056
|
-
const ellipsoid = globe.
|
|
2072
|
+
const ellipsoid = defaultValue(globe?.ellipsoid, Ellipsoid.WGS84);
|
|
2057
2073
|
|
|
2058
2074
|
// Compute cartographic position so we don't recompute every update
|
|
2059
2075
|
const modelMatrix = model.modelMatrix;
|
|
@@ -2067,14 +2083,14 @@ function updateClamping(model) {
|
|
|
2067
2083
|
}
|
|
2068
2084
|
|
|
2069
2085
|
// Install callback to handle updating of terrain tiles
|
|
2070
|
-
|
|
2071
|
-
model._removeUpdateHeightCallback = surface.updateHeight(
|
|
2086
|
+
model._removeUpdateHeightCallback = scene.updateHeight(
|
|
2072
2087
|
cartoPosition,
|
|
2073
|
-
getUpdateHeightCallback(model, ellipsoid, cartoPosition)
|
|
2088
|
+
getUpdateHeightCallback(model, ellipsoid, cartoPosition),
|
|
2089
|
+
model.heightReference
|
|
2074
2090
|
);
|
|
2075
2091
|
|
|
2076
2092
|
// Set the correct height now
|
|
2077
|
-
const height =
|
|
2093
|
+
const height = scene.getHeight(cartoPosition, model.heightReference);
|
|
2078
2094
|
if (defined(height)) {
|
|
2079
2095
|
// Get callback with cartoPosition being the non-clamped position
|
|
2080
2096
|
const callback = getUpdateHeightCallback(model, ellipsoid, cartoPosition);
|
|
@@ -2082,8 +2098,7 @@ function updateClamping(model) {
|
|
|
2082
2098
|
// Compute the clamped cartesian and call updateHeight callback
|
|
2083
2099
|
Cartographic.clone(cartoPosition, scratchCartographic);
|
|
2084
2100
|
scratchCartographic.height = height;
|
|
2085
|
-
|
|
2086
|
-
callback(scratchPosition);
|
|
2101
|
+
callback(scratchCartographic);
|
|
2087
2102
|
}
|
|
2088
2103
|
|
|
2089
2104
|
model._heightDirty = false;
|
|
@@ -2340,24 +2355,25 @@ function scaleInPixels(positionWC, radius, frameState) {
|
|
|
2340
2355
|
);
|
|
2341
2356
|
}
|
|
2342
2357
|
|
|
2343
|
-
|
|
2358
|
+
const scratchUpdateHeightCartesian = new Cartesian3();
|
|
2359
|
+
function getUpdateHeightCallback(model, ellipsoid, originalPostition) {
|
|
2344
2360
|
return function (clampedPosition) {
|
|
2345
|
-
if (model.heightReference
|
|
2346
|
-
|
|
2347
|
-
clampedPosition,
|
|
2348
|
-
scratchCartographic
|
|
2349
|
-
);
|
|
2350
|
-
clampedCart.height += cartoPosition.height;
|
|
2351
|
-
ellipsoid.cartographicToCartesian(clampedCart, clampedPosition);
|
|
2361
|
+
if (isHeightReferenceRelative(model.heightReference)) {
|
|
2362
|
+
clampedPosition.height += originalPostition.height;
|
|
2352
2363
|
}
|
|
2353
2364
|
|
|
2365
|
+
ellipsoid.cartographicToCartesian(
|
|
2366
|
+
clampedPosition,
|
|
2367
|
+
scratchUpdateHeightCartesian
|
|
2368
|
+
);
|
|
2369
|
+
|
|
2354
2370
|
const clampedModelMatrix = model._clampedModelMatrix;
|
|
2355
2371
|
|
|
2356
2372
|
// Modify clamped model matrix to use new height
|
|
2357
2373
|
Matrix4.clone(model.modelMatrix, clampedModelMatrix);
|
|
2358
|
-
clampedModelMatrix[12] =
|
|
2359
|
-
clampedModelMatrix[13] =
|
|
2360
|
-
clampedModelMatrix[14] =
|
|
2374
|
+
clampedModelMatrix[12] = scratchUpdateHeightCartesian.x;
|
|
2375
|
+
clampedModelMatrix[13] = scratchUpdateHeightCartesian.y;
|
|
2376
|
+
clampedModelMatrix[14] = scratchUpdateHeightCartesian.z;
|
|
2361
2377
|
|
|
2362
2378
|
model._heightDirty = true;
|
|
2363
2379
|
};
|
|
@@ -2492,6 +2508,35 @@ Model.prototype.isClippingEnabled = function () {
|
|
|
2492
2508
|
);
|
|
2493
2509
|
};
|
|
2494
2510
|
|
|
2511
|
+
/**
|
|
2512
|
+
* Find an intersection between a ray and the model surface that was rendered. The ray must be given in world coordinates.
|
|
2513
|
+
*
|
|
2514
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
2515
|
+
* @param {FrameState} frameState The frame state.
|
|
2516
|
+
* @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.
|
|
2517
|
+
* @param {number} [relativeHeight=0.0] The height above the ellipsoid relative to which a position is exaggerated. If the value is 0.0 the position will be exaggerated relative to the ellipsoid surface.
|
|
2518
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
2519
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
2520
|
+
*
|
|
2521
|
+
* @private
|
|
2522
|
+
*/
|
|
2523
|
+
Model.prototype.pick = function (
|
|
2524
|
+
ray,
|
|
2525
|
+
frameState,
|
|
2526
|
+
verticalExaggeration,
|
|
2527
|
+
relativeHeight,
|
|
2528
|
+
result
|
|
2529
|
+
) {
|
|
2530
|
+
return pickModel(
|
|
2531
|
+
this,
|
|
2532
|
+
ray,
|
|
2533
|
+
frameState,
|
|
2534
|
+
verticalExaggeration,
|
|
2535
|
+
relativeHeight,
|
|
2536
|
+
result
|
|
2537
|
+
);
|
|
2538
|
+
};
|
|
2539
|
+
|
|
2495
2540
|
/**
|
|
2496
2541
|
* Returns true if this object was destroyed; otherwise, false.
|
|
2497
2542
|
* <br /><br />
|
|
@@ -2651,6 +2696,7 @@ Model.prototype.destroyModelResources = function () {
|
|
|
2651
2696
|
* @param {boolean} [options.showCreditsOnScreen=false] Whether to display the credits of this model on screen.
|
|
2652
2697
|
* @param {SplitDirection} [options.splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this model.
|
|
2653
2698
|
* @param {boolean} [options.projectTo2D=false] Whether to accurately project the model's positions in 2D. If this is true, the model will be projected accurately to 2D, but it will use more memory to do so. If this is false, the model will use less memory and will still render in 2D / CV mode, but its positions may be inaccurate. This disables minimumPixelSize and prevents future modification to the model matrix. This also cannot be set after the model has loaded.
|
|
2699
|
+
* @param {boolean} [options.enablePick=false] Whether to allow with CPU picking with <code>pick</code> when not using WebGL 2 or above. 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 model has loaded.
|
|
2654
2700
|
* @param {string|number} [options.featureIdLabel="featureId_0"] Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
|
|
2655
2701
|
* @param {string|number} [options.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.
|
|
2656
2702
|
* @param {object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation and lighting.
|
|
@@ -2745,6 +2791,7 @@ Model.fromGltfAsync = async function (options) {
|
|
|
2745
2791
|
upAxis: options.upAxis,
|
|
2746
2792
|
forwardAxis: options.forwardAxis,
|
|
2747
2793
|
loadAttributesFor2D: options.projectTo2D,
|
|
2794
|
+
enablePick: options.enablePick,
|
|
2748
2795
|
loadIndicesForWireframe: options.enableDebugWireframe,
|
|
2749
2796
|
loadPrimitiveOutline: options.enableShowOutline,
|
|
2750
2797
|
loadForClassification: defined(options.classificationType),
|
|
@@ -2821,6 +2868,7 @@ Model.fromB3dm = async function (options) {
|
|
|
2821
2868
|
upAxis: options.upAxis,
|
|
2822
2869
|
forwardAxis: options.forwardAxis,
|
|
2823
2870
|
loadAttributesFor2D: options.projectTo2D,
|
|
2871
|
+
enablePick: options.enablePick,
|
|
2824
2872
|
loadIndicesForWireframe: options.enableDebugWireframe,
|
|
2825
2873
|
loadPrimitiveOutline: options.enableShowOutline,
|
|
2826
2874
|
loadForClassification: defined(options.classificationType),
|
|
@@ -2876,6 +2924,7 @@ Model.fromI3dm = async function (options) {
|
|
|
2876
2924
|
upAxis: options.upAxis,
|
|
2877
2925
|
forwardAxis: options.forwardAxis,
|
|
2878
2926
|
loadAttributesFor2D: options.projectTo2D,
|
|
2927
|
+
enablePick: options.enablePick,
|
|
2879
2928
|
loadIndicesForWireframe: options.enableDebugWireframe,
|
|
2880
2929
|
loadPrimitiveOutline: options.enableShowOutline,
|
|
2881
2930
|
};
|
|
@@ -3009,6 +3058,7 @@ function makeModelOptions(loader, modelType, options) {
|
|
|
3009
3058
|
showCreditsOnScreen: options.showCreditsOnScreen,
|
|
3010
3059
|
splitDirection: options.splitDirection,
|
|
3011
3060
|
projectTo2D: options.projectTo2D,
|
|
3061
|
+
enablePick: options.enablePick,
|
|
3012
3062
|
featureIdLabel: options.featureIdLabel,
|
|
3013
3063
|
instanceFeatureIdLabel: options.instanceFeatureIdLabel,
|
|
3014
3064
|
pointCloudShading: options.pointCloudShading,
|
|
@@ -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
|
|
|
@@ -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) {
|