@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.
Files changed (268) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
  2. package/Build/Workers/{chunk-RH4N2ONY.js → chunk-23UFSGND.js} +7 -7
  3. package/Build/Workers/{chunk-HPP4JLNH.js → chunk-2A75IWRS.js} +7 -7
  4. package/Build/Workers/{chunk-5IRLXUTA.js → chunk-2FRVPMCS.js} +10 -10
  5. package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-2FWRMUTY.js} +4 -4
  6. package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-2UPKWTMJ.js} +6 -6
  7. package/Build/Workers/{chunk-434ZTTFX.js → chunk-34FXV7D7.js} +2 -2
  8. package/Build/Workers/{chunk-MW3CJYLX.js → chunk-3VAZEH7M.js} +2 -2
  9. package/Build/Workers/{chunk-HUPNRBWW.js → chunk-4DO5W5XZ.js} +6 -6
  10. package/Build/Workers/{chunk-PIXK6KHB.js → chunk-4H7PY4U5.js} +2 -2
  11. package/Build/Workers/{chunk-BP467WX3.js → chunk-5QULIR53.js} +4 -4
  12. package/Build/Workers/{chunk-R3HUGXBH.js → chunk-7TC63SJW.js} +8 -8
  13. package/Build/Workers/{chunk-SQVTYRZY.js → chunk-7ZFGPDJA.js} +4 -4
  14. package/Build/Workers/{chunk-TIXXVKUY.js → chunk-A5DWLWCY.js} +10 -10
  15. package/Build/Workers/{chunk-CWJQGBWT.js → chunk-BBWDMCVU.js} +1 -1
  16. package/Build/Workers/{chunk-4KP73B43.js → chunk-BG4UCVXN.js} +3 -3
  17. package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-BIKA3NRA.js} +5 -5
  18. package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-BROJAZRZ.js} +13 -13
  19. package/Build/Workers/{chunk-FWGNCYP6.js → chunk-DDUQAJ4P.js} +7 -7
  20. package/Build/Workers/{chunk-QRBRVGZC.js → chunk-EERJKOAF.js} +4 -4
  21. package/Build/Workers/{chunk-52VSIKEA.js → chunk-EG6PTBY2.js} +15 -15
  22. package/Build/Workers/{chunk-O43GWBSF.js → chunk-EHWHNOEX.js} +1 -1
  23. package/Build/Workers/{chunk-MN34FIF5.js → chunk-F3YA3Y2Z.js} +1 -1
  24. package/Build/Workers/{chunk-GF5TNNKP.js → chunk-F4HFJMGM.js} +6 -6
  25. package/Build/Workers/{chunk-HOT2SNXP.js → chunk-FJKNFAKQ.js} +133 -553
  26. package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-FNIRWHJB.js} +10 -10
  27. package/Build/Workers/{chunk-DMCSY5BU.js → chunk-FZRIVR7Y.js} +5 -5
  28. package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-G43QFN4Q.js} +6 -6
  29. package/Build/Workers/{chunk-HPH5HSFE.js → chunk-GATZHF3K.js} +2 -2
  30. package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-GRC2ZTAF.js} +14 -14
  31. package/Build/Workers/{chunk-NE4JNU6H.js → chunk-HU6N6EXB.js} +10 -10
  32. package/Build/Workers/{chunk-GVL5I7TC.js → chunk-I46ZRR5W.js} +17 -17
  33. package/Build/Workers/{chunk-5GDBZTHX.js → chunk-JURN7NPV.js} +17 -17
  34. package/Build/Workers/{chunk-H5DUXHCV.js → chunk-KKCR2YOP.js} +11 -11
  35. package/Build/Workers/{chunk-LX6XV4DK.js → chunk-LPR3YNP2.js} +5 -5
  36. package/Build/Workers/{chunk-HFKSAB5K.js → chunk-M7ERACJJ.js} +13 -13
  37. package/Build/Workers/{chunk-BUZDZBUH.js → chunk-MDWEGWPA.js} +10 -10
  38. package/Build/Workers/{chunk-LGJUI2CE.js → chunk-OGXZVPPM.js} +9 -5
  39. package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-PGSJK77E.js} +6 -6
  40. package/Build/Workers/{chunk-ARPTYYKS.js → chunk-PPH7OFP3.js} +5 -5
  41. package/Build/Workers/{chunk-R4OZKBXH.js → chunk-SH5USDPI.js} +6 -6
  42. package/Build/Workers/{chunk-SV7DDPAC.js → chunk-SOWMRMWA.js} +1 -1
  43. package/Build/Workers/{chunk-RIDPF7PO.js → chunk-STW2DGFI.js} +2 -2
  44. package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-T3XIFPYR.js} +13 -13
  45. package/Build/Workers/chunk-TTUZP4BO.js +501 -0
  46. package/Build/Workers/{chunk-QTZQZY2C.js → chunk-UEXTBDBE.js} +34 -10
  47. package/Build/Workers/{chunk-XUTVA4K5.js → chunk-VOXYEYJT.js} +11 -11
  48. package/Build/Workers/{chunk-AXFRNOVC.js → chunk-X4356LRH.js} +12 -12
  49. package/Build/Workers/{chunk-5HLGKKG3.js → chunk-XGI5BXZY.js} +2 -2
  50. package/Build/Workers/{chunk-SNN7WOC2.js → chunk-Y2ME2IJV.js} +13 -13
  51. package/Build/Workers/{chunk-LGL4P5KL.js → chunk-Y5UQJLYE.js} +6 -6
  52. package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-YJEBABKH.js} +7 -7
  53. package/Build/Workers/{chunk-YBKFS53K.js → chunk-YWTJ2B4B.js} +1 -1
  54. package/Build/Workers/{chunk-5SK36PU4.js → chunk-Z3TIFFGF.js} +7 -7
  55. package/Build/Workers/{chunk-JGG36SQV.js → chunk-ZT7KWISZ.js} +4 -4
  56. package/Build/Workers/combineGeometry.js +24 -23
  57. package/Build/Workers/createBoxGeometry.js +18 -17
  58. package/Build/Workers/createBoxOutlineGeometry.js +16 -15
  59. package/Build/Workers/createCircleGeometry.js +26 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +19 -18
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
  63. package/Build/Workers/createCorridorGeometry.js +29 -29
  64. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  65. package/Build/Workers/createCylinderGeometry.js +20 -19
  66. package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
  67. package/Build/Workers/createEllipseGeometry.js +26 -25
  68. package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
  69. package/Build/Workers/createEllipsoidGeometry.js +19 -18
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
  71. package/Build/Workers/createFrustumGeometry.js +18 -17
  72. package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
  73. package/Build/Workers/createGeometry.js +54 -33
  74. package/Build/Workers/createGroundPolylineGeometry.js +22 -21
  75. package/Build/Workers/createPlaneGeometry.js +16 -15
  76. package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
  77. package/Build/Workers/createPolygonGeometry.js +32 -166
  78. package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
  79. package/Build/Workers/createPolylineGeometry.js +25 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  82. package/Build/Workers/createRectangleGeometry.js +27 -26
  83. package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +23 -22
  85. package/Build/Workers/createSphereGeometry.js +19 -18
  86. package/Build/Workers/createSphereOutlineGeometry.js +18 -17
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  89. package/Build/Workers/createVectorTileGeometries.js +24 -23
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +22 -21
  92. package/Build/Workers/createVectorTilePolylines.js +14 -14
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
  94. package/Build/Workers/createVerticesFromHeightmap.js +22 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
  96. package/Build/Workers/createWallGeometry.js +24 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +23 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +601 -92
  101. package/Build/Workers/transcodeKTX2.js +7 -7
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
  104. package/LICENSE.md +1 -1
  105. package/Source/Assets/approximateTerrainHeights.json +1 -1
  106. package/Source/Core/Ellipsoid.js +6 -0
  107. package/Source/Core/GregorianDate.js +85 -0
  108. package/Source/Core/HeadingPitchRange.js +2 -2
  109. package/Source/Core/IntersectionTests.js +6 -3
  110. package/Source/Core/Ion.js +1 -1
  111. package/Source/Core/PixelFormat.js +5 -0
  112. package/Source/Core/PolygonGeometry.js +0 -169
  113. package/Source/Core/Resource.js +30 -69
  114. package/Source/Core/Transforms.js +30 -18
  115. package/Source/Core/createWorldBathymetryAsync.js +45 -0
  116. package/Source/Core/srgbToLinear.js +32 -0
  117. package/Source/DataSources/CzmlDataSource.js +51 -23
  118. package/Source/DataSources/DataSourceDisplay.js +27 -0
  119. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
  120. package/Source/DataSources/Entity.js +28 -7
  121. package/Source/DataSources/EntityCollection.js +1 -2
  122. package/Source/DataSources/GeometryUpdater.js +1 -2
  123. package/Source/DataSources/GeometryUpdaterSet.js +114 -0
  124. package/Source/DataSources/GeometryVisualizer.js +19 -83
  125. package/Source/DataSources/GroundGeometryUpdater.js +6 -3
  126. package/Source/DataSources/ModelVisualizer.js +19 -98
  127. package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
  128. package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
  129. package/Source/DataSources/TerrainOffsetProperty.js +15 -23
  130. package/Source/Renderer/AutomaticUniforms.js +121 -1
  131. package/Source/Renderer/Context.js +10 -0
  132. package/Source/Renderer/ContextLimits.js +2 -0
  133. package/Source/Renderer/UniformState.js +127 -0
  134. package/Source/Renderer/demodernizeShader.js +4 -1
  135. package/Source/Scene/ArcGisMapService.js +1 -1
  136. package/Source/Scene/Atmosphere.js +127 -0
  137. package/Source/Scene/Axis.js +12 -7
  138. package/Source/Scene/Billboard.js +29 -26
  139. package/Source/Scene/BillboardCollection.js +3 -3
  140. package/Source/Scene/Camera.js +47 -5
  141. package/Source/Scene/Cesium3DTile.js +1 -0
  142. package/Source/Scene/Cesium3DTileContent.js +14 -0
  143. package/Source/Scene/Cesium3DTileset.js +364 -45
  144. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
  145. package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
  146. package/Source/Scene/Composite3DTileContent.js +42 -0
  147. package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
  148. package/Source/Scene/Empty3DTileContent.js +4 -0
  149. package/Source/Scene/Fog.js +1 -0
  150. package/Source/Scene/FrameState.js +14 -1
  151. package/Source/Scene/Geometry3DTileContent.js +4 -0
  152. package/Source/Scene/Globe.js +3 -2
  153. package/Source/Scene/GlobeSurfaceTileProvider.js +3 -1
  154. package/Source/Scene/GlobeTranslucencyState.js +1 -1
  155. package/Source/Scene/GltfLoader.js +15 -5
  156. package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
  157. package/Source/Scene/HeightReference.js +59 -2
  158. package/Source/Scene/I3SDataProvider.js +270 -53
  159. package/Source/Scene/I3SDecoder.js +8 -1
  160. package/Source/Scene/I3SFeature.js +2 -5
  161. package/Source/Scene/I3SField.js +136 -31
  162. package/Source/Scene/I3SGeometry.js +70 -2
  163. package/Source/Scene/I3SLayer.js +55 -10
  164. package/Source/Scene/I3SNode.js +175 -18
  165. package/Source/Scene/I3SStatistics.js +94 -0
  166. package/Source/Scene/I3SSublayer.js +176 -0
  167. package/Source/Scene/I3SSymbology.js +337 -0
  168. package/Source/Scene/Implicit3DTileContent.js +4 -0
  169. package/Source/Scene/KeyframeNode.js +1 -1
  170. package/Source/Scene/LabelCollection.js +2 -2
  171. package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
  172. package/Source/Scene/Model/B3dmLoader.js +4 -0
  173. package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
  174. package/Source/Scene/Model/I3dmLoader.js +4 -0
  175. package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
  176. package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
  177. package/Source/Scene/Model/Model.js +82 -32
  178. package/Source/Scene/Model/Model3DTileContent.js +31 -0
  179. package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
  180. package/Source/Scene/Model/ModelSceneGraph.js +6 -0
  181. package/Source/Scene/Model/pickModel.js +426 -0
  182. package/Source/Scene/Multiple3DTileContent.js +42 -0
  183. package/Source/Scene/PickFramebuffer.js +37 -2
  184. package/Source/Scene/Picking.js +113 -39
  185. package/Source/Scene/Primitive.js +6 -2
  186. package/Source/Scene/QuadtreePrimitive.js +1 -1
  187. package/Source/Scene/Scene.js +312 -46
  188. package/Source/Scene/ScreenSpaceCameraController.js +23 -13
  189. package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
  190. package/Source/Scene/SkyAtmosphere.js +5 -6
  191. package/Source/Scene/SpatialNode.js +12 -19
  192. package/Source/Scene/StructuralMetadata.js +1 -1
  193. package/Source/Scene/Terrain.js +49 -0
  194. package/Source/Scene/TileBoundingS2Cell.js +2 -2
  195. package/Source/Scene/Tileset3DTileContent.js +4 -0
  196. package/Source/Scene/Vector3DTileContent.js +4 -0
  197. package/Source/Scene/VoxelBoxShape.js +76 -0
  198. package/Source/Scene/VoxelCell.js +273 -0
  199. package/Source/Scene/VoxelCylinderShape.js +114 -43
  200. package/Source/Scene/VoxelEllipsoidShape.js +158 -116
  201. package/Source/Scene/VoxelPrimitive.js +3 -1
  202. package/Source/Scene/VoxelRenderResources.js +3 -0
  203. package/Source/Scene/VoxelShape.js +13 -0
  204. package/Source/Scene/VoxelTraversal.js +76 -54
  205. package/Source/Scene/buildVoxelDrawCommands.js +23 -0
  206. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
  207. package/Source/Scene/processVoxelProperties.js +2 -0
  208. package/Source/Shaders/AtmosphereCommon.glsl +3 -11
  209. package/Source/Shaders/AtmosphereCommon.js +3 -11
  210. package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
  211. package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
  212. package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
  213. package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
  214. package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
  215. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
  216. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
  217. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
  218. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
  219. package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
  220. package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
  221. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
  222. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
  223. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
  224. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
  225. package/Source/Shaders/GlobeFS.glsl +16 -25
  226. package/Source/Shaders/GlobeFS.js +16 -25
  227. package/Source/Shaders/GlobeVS.glsl +1 -1
  228. package/Source/Shaders/GlobeVS.js +1 -1
  229. package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
  230. package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
  231. package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
  232. package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
  233. package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
  234. package/Source/Shaders/Model/GeometryStageFS.js +1 -1
  235. package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
  236. package/Source/Shaders/Model/GeometryStageVS.js +4 -4
  237. package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
  238. package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
  239. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  240. package/Source/Shaders/Model/ModelFS.js +4 -0
  241. package/Source/Shaders/Model/ModelVS.glsl +9 -4
  242. package/Source/Shaders/Model/ModelVS.js +9 -4
  243. package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
  244. package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
  245. package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
  246. package/Source/Shaders/SkyAtmosphereFS.js +5 -10
  247. package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
  248. package/Source/Shaders/SkyAtmosphereVS.js +3 -2
  249. package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
  250. package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
  251. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
  252. package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
  253. package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
  254. package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
  255. package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
  256. package/Source/Shaders/Voxels/VoxelFS.js +39 -1
  257. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
  258. package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
  259. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
  260. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
  261. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  262. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  263. package/Source/Workers/createGeometry.js +40 -11
  264. package/Source/Workers/decodeI3S.js +720 -94
  265. package/index.d.ts +574 -71
  266. package/index.js +217 -196
  267. package/package.json +3 -3
  268. 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 { texCoord, channels, index, texture } = property.textureReader;
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 value of the property
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
- const valueExpression = `texture(${textureUniformName}, ${texCoordVariable}).${channels}`;
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 from "../HeightReference.js";
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
- function () {
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 position attribute is required.</li>
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 and globe."
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.ellipsoid;
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
- const surface = globe._surface;
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 = globe.getHeight(cartoPosition);
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
- ellipsoid.cartographicToCartesian(scratchCartographic, scratchPosition);
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
- function getUpdateHeightCallback(model, ellipsoid, cartoPosition) {
2358
+ const scratchUpdateHeightCartesian = new Cartesian3();
2359
+ function getUpdateHeightCallback(model, ellipsoid, originalPostition) {
2344
2360
  return function (clampedPosition) {
2345
- if (model.heightReference === HeightReference.RELATIVE_TO_GROUND) {
2346
- const clampedCart = ellipsoid.cartesianToCartographic(
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] = clampedPosition.x;
2359
- clampedModelMatrix[13] = clampedPosition.y;
2360
- clampedModelMatrix[14] = clampedPosition.z;
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
- let scratchVariable;
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
- runtimeNode[path] = spline.evaluate(localAnimationTime, scratchVariable);
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) {