@cesium/engine 2.2.0 → 2.4.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 (139) hide show
  1. package/Build/Workers/{AttributeCompression-8a5a065e.js → AttributeCompression-f9f6c717.js} +1 -1
  2. package/Build/Workers/{AxisAlignedBoundingBox-379015ef.js → AxisAlignedBoundingBox-4bfd84f3.js} +1 -1
  3. package/Build/Workers/{BoundingRectangle-57f2b24f.js → BoundingRectangle-5fd6403a.js} +1 -1
  4. package/Build/Workers/{BoxGeometry-ecabfc78.js → BoxGeometry-af7d05ef.js} +1 -1
  5. package/Build/Workers/{Color-14d1a36d.js → Color-e5bfda3f.js} +1 -1
  6. package/Build/Workers/{CoplanarPolygonGeometryLibrary-048c3c14.js → CoplanarPolygonGeometryLibrary-59c69b0a.js} +1 -1
  7. package/Build/Workers/{CorridorGeometryLibrary-520c8619.js → CorridorGeometryLibrary-63907365.js} +1 -1
  8. package/Build/Workers/{CylinderGeometry-119068b8.js → CylinderGeometry-dbaa1678.js} +1 -1
  9. package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
  10. package/Build/Workers/{EllipseGeometry-2dfc3523.js → EllipseGeometry-6508b78b.js} +1 -1
  11. package/Build/Workers/{EllipseGeometryLibrary-0a1e0170.js → EllipseGeometryLibrary-21262a28.js} +1 -1
  12. package/Build/Workers/{EllipseOutlineGeometry-c5251669.js → EllipseOutlineGeometry-2a2510bb.js} +1 -1
  13. package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
  14. package/Build/Workers/{EllipsoidGeometry-d10a5221.js → EllipsoidGeometry-8155e3a2.js} +1 -1
  15. package/Build/Workers/{EllipsoidOutlineGeometry-7039a0ae.js → EllipsoidOutlineGeometry-c045678d.js} +1 -1
  16. package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
  17. package/Build/Workers/{EllipsoidTangentPlane-857186be.js → EllipsoidTangentPlane-546c0d5e.js} +1 -1
  18. package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
  19. package/Build/Workers/{FrustumGeometry-400fa1b7.js → FrustumGeometry-d3ff16d0.js} +31 -3
  20. package/Build/Workers/{GeometryAttribute-7a2de5c6.js → GeometryAttribute-13da9466.js} +1 -1
  21. package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
  22. package/Build/Workers/{GeometryPipeline-916636fa.js → GeometryPipeline-03bc5709.js} +1 -1
  23. package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
  24. package/Build/Workers/{IntersectionTests-b4d02d4d.js → IntersectionTests-85350792.js} +1 -1
  25. package/Build/Workers/{Math-dad82b4d.js → Math-0a2ac845.js} +12 -2
  26. package/Build/Workers/{Matrix2-1e403d0e.js → Matrix2-e1298525.js} +1 -1
  27. package/Build/Workers/{Matrix3-fa806b97.js → Matrix3-41c58dde.js} +1 -1
  28. package/Build/Workers/{OrientedBoundingBox-96fe1752.js → OrientedBoundingBox-29fb0fcd.js} +1 -1
  29. package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
  30. package/Build/Workers/{PolygonGeometryLibrary-931f1ec6.js → PolygonGeometryLibrary-d447448d.js} +1 -1
  31. package/Build/Workers/PolygonPipeline-460cce4e.js +1344 -0
  32. package/Build/Workers/{PolylinePipeline-6d5c63e5.js → PolylinePipeline-7119eb3f.js} +1 -1
  33. package/Build/Workers/{PolylineVolumeGeometryLibrary-f068c1fb.js → PolylineVolumeGeometryLibrary-d25f0050.js} +1 -1
  34. package/Build/Workers/{PrimitivePipeline-879f996a.js → PrimitivePipeline-e648752b.js} +1 -1
  35. package/Build/Workers/{RectangleGeometryLibrary-2d6f36f3.js → RectangleGeometryLibrary-bb378fb6.js} +1 -1
  36. package/Build/Workers/{TerrainEncoding-82882059.js → TerrainEncoding-c8e029a2.js} +1 -1
  37. package/Build/Workers/Transforms-e2d4a55a.js +14713 -0
  38. package/Build/Workers/{WallGeometryLibrary-db7a64fb.js → WallGeometryLibrary-3e0819ec.js} +1 -1
  39. package/Build/Workers/{WebMercatorProjection-76a3fcc0.js → WebMercatorProjection-13ed1a6e.js} +1 -1
  40. package/Build/Workers/{arrayRemoveDuplicates-fac118a8.js → arrayRemoveDuplicates-d2061e85.js} +1 -1
  41. package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
  42. package/Build/Workers/combineGeometry.js +1 -1
  43. package/Build/Workers/createBoxGeometry.js +1 -1
  44. package/Build/Workers/createBoxOutlineGeometry.js +1 -1
  45. package/Build/Workers/createCircleGeometry.js +1 -1
  46. package/Build/Workers/createCircleOutlineGeometry.js +1 -1
  47. package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
  48. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
  49. package/Build/Workers/createCorridorGeometry.js +1 -1
  50. package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
  51. package/Build/Workers/createCylinderGeometry.js +1 -1
  52. package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
  53. package/Build/Workers/createEllipseGeometry.js +1 -1
  54. package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
  55. package/Build/Workers/createEllipsoidGeometry.js +1 -1
  56. package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
  57. package/Build/Workers/createFrustumGeometry.js +1 -1
  58. package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
  59. package/Build/Workers/createGeometry.js +1 -1
  60. package/Build/Workers/createGroundPolylineGeometry.js +1 -1
  61. package/Build/Workers/createPlaneGeometry.js +1 -1
  62. package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
  63. package/Build/Workers/createPolygonGeometry.js +1 -1
  64. package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
  65. package/Build/Workers/createPolylineGeometry.js +1 -1
  66. package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
  67. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
  68. package/Build/Workers/createRectangleGeometry.js +1 -1
  69. package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
  70. package/Build/Workers/createSimplePolylineGeometry.js +1 -1
  71. package/Build/Workers/createSphereGeometry.js +1 -1
  72. package/Build/Workers/createSphereOutlineGeometry.js +1 -1
  73. package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
  74. package/Build/Workers/createVectorTileGeometries.js +1 -1
  75. package/Build/Workers/createVectorTilePoints.js +1 -1
  76. package/Build/Workers/createVectorTilePolygons.js +1 -1
  77. package/Build/Workers/createVectorTilePolylines.js +1 -1
  78. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
  79. package/Build/Workers/createVerticesFromHeightmap.js +5 -8
  80. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
  81. package/Build/Workers/createWallGeometry.js +1 -1
  82. package/Build/Workers/createWallOutlineGeometry.js +1 -1
  83. package/Build/Workers/decodeDraco.js +1 -1
  84. package/Build/Workers/decodeI3S.js +1 -1
  85. package/Build/Workers/package.js +1 -1
  86. package/Build/Workers/transferTypedArrayTest.js +1 -1
  87. package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
  88. package/Source/Core/BingMapsGeocoderService.js +19 -1
  89. package/Source/Core/CartographicGeocoderService.js +15 -0
  90. package/Source/Core/Credit.js +1 -1
  91. package/Source/Core/FrustumGeometry.js +3 -2
  92. package/Source/Core/GeocoderService.js +32 -1
  93. package/Source/Core/GoogleMaps.js +56 -0
  94. package/Source/Core/Ion.js +2 -1
  95. package/Source/Core/IonGeocoderService.js +17 -2
  96. package/Source/Core/OpenCageGeocoderService.js +18 -1
  97. package/Source/Core/OrthographicFrustum.js +13 -0
  98. package/Source/Core/PeliasGeocoderService.js +14 -1
  99. package/Source/Core/PerspectiveFrustum.js +14 -0
  100. package/Source/Core/Request.js +3 -2
  101. package/Source/Core/RequestScheduler.js +10 -4
  102. package/Source/Core/Resource.js +240 -233
  103. package/Source/DataSources/DataSourceDisplay.js +2 -2
  104. package/Source/DataSources/EntityCluster.js +126 -128
  105. package/Source/DataSources/ModelVisualizer.js +5 -3
  106. package/Source/Renderer/UniformState.js +3 -2
  107. package/Source/Renderer/demodernizeShader.js +5 -5
  108. package/Source/Scene/ArcGisBaseMapType.js +12 -0
  109. package/Source/Scene/ArcGisMapServerImageryProvider.js +162 -20
  110. package/Source/Scene/ArcGisMapService.js +84 -0
  111. package/Source/Scene/Camera.js +8 -7
  112. package/Source/Scene/Cesium3DTile.js +4 -3
  113. package/Source/Scene/Cesium3DTileset.js +6 -5
  114. package/Source/Scene/CreditDisplay.js +112 -16
  115. package/Source/Scene/GlobeSurfaceTileProvider.js +4 -4
  116. package/Source/Scene/GltfJsonLoader.js +12 -0
  117. package/Source/Scene/GltfLoader.js +6 -37
  118. package/Source/Scene/IonImageryProvider.js +11 -11
  119. package/Source/Scene/Model/MaterialPipelineStage.js +12 -12
  120. package/Source/Scene/Model/Model.js +90 -47
  121. package/Source/Scene/Model/UniformType.js +1 -1
  122. package/Source/Scene/Picking.js +3 -2
  123. package/Source/Scene/QuadtreePrimitive.js +3 -2
  124. package/Source/Scene/SceneTransforms.js +3 -2
  125. package/Source/Scene/ScreenSpaceCameraController.js +140 -32
  126. package/Source/Scene/Vector3DTilePoints.js +25 -13
  127. package/Source/Scene/createGooglePhotorealistic3DTileset.js +53 -0
  128. package/Source/Shaders/AtmosphereCommon.glsl +51 -8
  129. package/Source/Shaders/AtmosphereCommon.js +51 -8
  130. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +1 -1
  131. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +1 -1
  132. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +3 -3
  133. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +3 -3
  134. package/Source/Widget/CesiumWidget.js +12 -0
  135. package/index.d.ts +244 -17
  136. package/index.js +14 -10
  137. package/package.json +4 -4
  138. package/Build/Workers/PolygonPipeline-32fc92cc.js +0 -1345
  139. package/Build/Workers/Transforms-9052372a.js +0 -14715
@@ -2384,19 +2384,21 @@ function updateShowCreditsOnScreen(model) {
2384
2384
 
2385
2385
  const showOnScreen = model._showCreditsOnScreen;
2386
2386
  if (defined(model._credit)) {
2387
- model._credit.showOnScreen = showOnScreen;
2387
+ model._credit.showOnScreen = showOnScreen || model._credit._isDefaultToken;
2388
2388
  }
2389
2389
 
2390
2390
  const resourceCredits = model._resourceCredits;
2391
2391
  const resourceCreditsLength = resourceCredits.length;
2392
2392
  for (let i = 0; i < resourceCreditsLength; i++) {
2393
- resourceCredits[i].showOnScreen = showOnScreen;
2393
+ resourceCredits[i].showOnScreen =
2394
+ showOnScreen || resourceCredits[i]._isDefaultToken;
2394
2395
  }
2395
2396
 
2396
2397
  const gltfCredits = model._gltfCredits;
2397
2398
  const gltfCreditsLength = gltfCredits.length;
2398
2399
  for (let i = 0; i < gltfCreditsLength; i++) {
2399
- gltfCredits[i].showOnScreen = showOnScreen;
2400
+ gltfCredits[i].showOnScreen =
2401
+ showOnScreen || gltfCredits[i]._isDefaultToken;
2400
2402
  }
2401
2403
  }
2402
2404
 
@@ -2509,19 +2511,19 @@ function addCreditsToCreditDisplay(model, frameState) {
2509
2511
  // Add all credits to the credit display.
2510
2512
  const credit = model._credit;
2511
2513
  if (defined(credit)) {
2512
- creditDisplay.addCredit(credit);
2514
+ creditDisplay.addCreditToNextFrame(credit);
2513
2515
  }
2514
2516
 
2515
2517
  const resourceCredits = model._resourceCredits;
2516
2518
  const resourceCreditsLength = resourceCredits.length;
2517
2519
  for (let c = 0; c < resourceCreditsLength; c++) {
2518
- creditDisplay.addCredit(resourceCredits[c]);
2520
+ creditDisplay.addCreditToNextFrame(resourceCredits[c]);
2519
2521
  }
2520
2522
 
2521
2523
  const gltfCredits = model._gltfCredits;
2522
2524
  const gltfCreditsLength = gltfCredits.length;
2523
2525
  for (let c = 0; c < gltfCreditsLength; c++) {
2524
- creditDisplay.addCredit(gltfCredits[c]);
2526
+ creditDisplay.addCreditToNextFrame(gltfCredits[c]);
2525
2527
  }
2526
2528
  }
2527
2529
 
@@ -2841,26 +2843,26 @@ Model.fromGltf = function (options) {
2841
2843
  * <p>
2842
2844
  * The model can be a traditional glTF asset with a .gltf extension or a Binary glTF using the .glb extension.
2843
2845
  *
2844
- * @param {Object} options Object with the following properties:
2845
- * @param {String|Resource} options.url The url to the .gltf or .glb file.
2846
- * @param {String|Resource} [options.basePath=''] The base path that paths in the glTF JSON are relative to.
2847
- * @param {Boolean} [options.show=true] Whether or not to render the model.
2846
+ * @param {object} options Object with the following properties:
2847
+ * @param {string|Resource} options.url The url to the .gltf or .glb file.
2848
+ * @param {string|Resource} [options.basePath=''] The base path that paths in the glTF JSON are relative to.
2849
+ * @param {boolean} [options.show=true] Whether or not to render the model.
2848
2850
  * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The 4x4 transformation matrix that transforms the model from model to world coordinates.
2849
- * @param {Number} [options.scale=1.0] A uniform scale applied to this model.
2850
- * @param {Number} [options.minimumPixelSize=0.0] The approximate minimum pixel size of the model regardless of zoom.
2851
- * @param {Number} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize.
2852
- * @param {Object} [options.id] A user-defined object to return when the model is picked with {@link Scene#pick}.
2853
- * @param {Boolean} [options.allowPicking=true] When <code>true</code>, each primitive is pickable with {@link Scene#pick}.
2854
- * @param {Boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded.
2855
- * @param {Boolean} [options.asynchronous=true] Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded.
2856
- * @param {Boolean} [options.clampAnimations=true] Determines if the model's animations should hold a pose over frames where no keyframes are specified.
2851
+ * @param {number} [options.scale=1.0] A uniform scale applied to this model.
2852
+ * @param {number} [options.minimumPixelSize=0.0] The approximate minimum pixel size of the model regardless of zoom.
2853
+ * @param {number} [options.maximumScale] The maximum scale size of a model. An upper limit for minimumPixelSize.
2854
+ * @param {object} [options.id] A user-defined object to return when the model is picked with {@link Scene#pick}.
2855
+ * @param {boolean} [options.allowPicking=true] When <code>true</code>, each primitive is pickable with {@link Scene#pick}.
2856
+ * @param {boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded.
2857
+ * @param {boolean} [options.asynchronous=true] Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded.
2858
+ * @param {boolean} [options.clampAnimations=true] Determines if the model's animations should hold a pose over frames where no keyframes are specified.
2857
2859
  * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the model casts or receives shadows from light sources.
2858
- * @param {Boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
2859
- * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each draw command in the model.
2860
- * @param {Boolean} [options.enableDebugWireframe=false] For debugging only. This must be set to true for debugWireframe to work in WebGL1. This cannot be set after the model has loaded.
2861
- * @param {Boolean} [options.debugWireframe=false] For debugging only. Draws the model in wireframe. Will only work for WebGL1 if enableDebugWireframe is set to true.
2862
- * @param {Boolean} [options.cull=true] Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used.
2863
- * @param {Boolean} [options.opaquePass=Pass.OPAQUE] The pass to use in the {@link DrawCommand} for the opaque portions of the model.
2860
+ * @param {boolean} [options.releaseGltfJson=false] When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective.
2861
+ * @param {boolean} [options.debugShowBoundingVolume=false] For debugging only. Draws the bounding sphere for each draw command in the model.
2862
+ * @param {boolean} [options.enableDebugWireframe=false] For debugging only. This must be set to true for debugWireframe to work in WebGL1. This cannot be set after the model has loaded.
2863
+ * @param {boolean} [options.debugWireframe=false] For debugging only. Draws the model in wireframe. Will only work for WebGL1 if enableDebugWireframe is set to true.
2864
+ * @param {boolean} [options.cull=true] Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used.
2865
+ * @param {boolean} [options.opaquePass=Pass.OPAQUE] The pass to use in the {@link DrawCommand} for the opaque portions of the model.
2864
2866
  * @param {Axis} [options.upAxis=Axis.Y] The up-axis of the glTF model.
2865
2867
  * @param {Axis} [options.forwardAxis=Axis.Z] The forward-axis of the glTF model.
2866
2868
  * @param {CustomShader} [options.customShader] A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a {@link Cesium3DTileStyle} may lead to undefined behavior.
@@ -2870,28 +2872,31 @@ Model.fromGltf = function (options) {
2870
2872
  * @param {DistanceDisplayCondition} [options.distanceDisplayCondition] The condition specifying at what distance from the camera that this model will be displayed.
2871
2873
  * @param {Color} [options.color] A color that blends with the model's rendered color.
2872
2874
  * @param {ColorBlendMode} [options.colorBlendMode=ColorBlendMode.HIGHLIGHT] Defines how the color blends with the model.
2873
- * @param {Number} [options.colorBlendAmount=0.5] Value used to determine the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
2875
+ * @param {number} [options.colorBlendAmount=0.5] Value used to determine the color strength when the <code>colorBlendMode</code> is <code>MIX</code>. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
2874
2876
  * @param {Color} [options.silhouetteColor=Color.RED] The silhouette color. If more than 256 models have silhouettes enabled, there is a small chance that overlapping models will have minor artifacts.
2875
- * @param {Number} [options.silhouetteSize=0.0] The size of the silhouette in pixels.
2876
- * @param {Boolean} [options.enableShowOutline=true] Whether to enable outlines for models using 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. When false, the showOutlines and outlineColor options are ignored.
2877
- * @param {Boolean} [options.showOutline=true] Whether to display the outline for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. When true, outlines are displayed. When false, outlines are not displayed.
2877
+ * @param {number} [options.silhouetteSize=0.0] The size of the silhouette in pixels.
2878
+ * @param {boolean} [options.enableShowOutline=true] Whether to enable outlines for models using 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. When false, the showOutlines and outlineColor options are ignored.
2879
+ * @param {boolean} [options.showOutline=true] Whether to display the outline for models using the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. When true, outlines are displayed. When false, outlines are not displayed.
2878
2880
  * @param {Color} [options.outlineColor=Color.BLACK] The color to use when rendering outlines.
2879
2881
  * @param {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the model.
2880
2882
  * @param {Cartesian3} [options.lightColor] The light color when shading the model. When <code>undefined</code> the scene's light color is used instead.
2881
2883
  * @param {ImageBasedLighting} [options.imageBasedLighting] The properties for managing image-based lighting on this model.
2882
- * @param {Boolean} [options.backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent.
2883
- * @param {Credit|String} [options.credit] A credit for the data source, which is displayed on the canvas.
2884
- * @param {Boolean} [options.showCreditsOnScreen=false] Whether to display the credits of this model on screen.
2884
+ * @param {boolean} [options.backFaceCulling=true] Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent.
2885
+ * @param {Credit|string} [options.credit] A credit for the data source, which is displayed on the canvas.
2886
+ * @param {boolean} [options.showCreditsOnScreen=false] Whether to display the credits of this model on screen.
2885
2887
  * @param {SplitDirection} [options.splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this model.
2886
- * @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.
2887
- * @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.
2888
- * @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.
2889
- * @param {Object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation and lighting.
2888
+ * @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.
2889
+ * @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.
2890
+ * @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.
2891
+ * @param {object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation and lighting.
2890
2892
  * @param {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.
2893
+ * @param {Model.GltfCallback} [options.gltfCallback] A function that is called with the loaded gltf object once loaded.
2891
2894
  *
2892
2895
  * @returns {Promise<Model>} A promise that resolves to the created model when it is ready to render.
2893
2896
  *
2894
2897
  * @exception {RuntimeError} The model failed to load.
2898
+ * @exception {RuntimeError} Unsupported glTF version.
2899
+ * @exception {RuntimeError} Unsupported glTF Extension
2895
2900
  *
2896
2901
  * @example
2897
2902
  * // Load a model and add it to the scene
@@ -2931,6 +2936,28 @@ Model.fromGltf = function (options) {
2931
2936
  * } catch (error) {
2932
2937
  * console.log(`Failed to load model. ${error}`);
2933
2938
  * }
2939
+ *
2940
+ * @example
2941
+ * // Load a model and play the last animation at half speed
2942
+ * let animations;
2943
+ * try {
2944
+ * const model = await Cesium.Model.fromGltfAsync({
2945
+ * url: "../../SampleData/models/CesiumMan/Cesium_Man.glb",
2946
+ * gltfCallback: gltf => {
2947
+ * animations = gltf.animations
2948
+ * }
2949
+ * });
2950
+ * viewer.scene.primitives.add(model);
2951
+ * model.readyEvent.addEventListener(() => {
2952
+ * model.activeAnimations.add({
2953
+ * index: animations.length - 1,
2954
+ * loop: Cesium.ModelAnimationLoop.REPEAT,
2955
+ * multiplier: 0.5,
2956
+ * });
2957
+ * });
2958
+ * } catch (error) {
2959
+ * console.log(`Failed to load model. ${error}`);
2960
+ * }
2934
2961
  */
2935
2962
  Model.fromGltfAsync = async function (options) {
2936
2963
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
@@ -2988,22 +3015,31 @@ Model.fromGltfAsync = async function (options) {
2988
3015
  // Further resource loading is handled synchronously in loader.process(), and requires
2989
3016
  // hooking into model's update() as the frameState is needed
2990
3017
  await loader.load();
2991
-
2992
- const model = new Model(modelOptions);
2993
-
2994
- const resourceCredits = model._resource.credits;
2995
- if (defined(resourceCredits)) {
2996
- const length = resourceCredits.length;
2997
- for (let i = 0; i < length; i++) {
2998
- model._resourceCredits.push(resourceCredits[i]);
2999
- }
3000
- }
3001
-
3002
- return model;
3003
3018
  } catch (error) {
3004
3019
  loader.destroy();
3005
3020
  throw ModelUtility.getError("model", resource, error);
3006
3021
  }
3022
+
3023
+ const gltfCallback = options.gltfCallback;
3024
+ if (defined(gltfCallback)) {
3025
+ //>>includeStart('debug', pragmas.debug);
3026
+ Check.typeOf.func("options.gltfCallback", gltfCallback);
3027
+ //>>includeEnd('debug');
3028
+
3029
+ gltfCallback(loader.gltfJson);
3030
+ }
3031
+
3032
+ const model = new Model(modelOptions);
3033
+
3034
+ const resourceCredits = model._resource.credits;
3035
+ if (defined(resourceCredits)) {
3036
+ const length = resourceCredits.length;
3037
+ for (let i = 0; i < length; i++) {
3038
+ model._resourceCredits.push(resourceCredits[i]);
3039
+ }
3040
+ }
3041
+
3042
+ return model;
3007
3043
  };
3008
3044
 
3009
3045
  /*
@@ -3214,4 +3250,11 @@ function makeModelOptions(loader, modelType, options) {
3214
3250
  };
3215
3251
  }
3216
3252
 
3253
+ /**
3254
+ * Interface for the function that is called with the loaded gltf object once loaded.
3255
+ * @callback Model.GltfCallback
3256
+ *
3257
+ * @param {object} gltf The gltf object
3258
+ */
3259
+
3217
3260
  export default Model;
@@ -104,7 +104,7 @@ const UniformType = {
104
104
  * @type {string}
105
105
  * @constant
106
106
  */
107
- MAT3: "mat2",
107
+ MAT3: "mat3",
108
108
  /**
109
109
  * A 3x3 matrix of floating point values.
110
110
  *
@@ -92,8 +92,9 @@ function getPickOrthographicCullingVolume(
92
92
  ) {
93
93
  const camera = scene.camera;
94
94
  let frustum = camera.frustum;
95
- if (defined(frustum._offCenterFrustum)) {
96
- frustum = frustum._offCenterFrustum;
95
+ const offCenterFrustum = frustum.offCenterFrustum;
96
+ if (defined(offCenterFrustum)) {
97
+ frustum = offCenterFrustum;
97
98
  }
98
99
 
99
100
  let x = (2.0 * (drawingBufferPosition.x - viewport.x)) / viewport.width - 1.0;
@@ -1275,8 +1275,9 @@ function screenSpaceError(primitive, frameState, tile) {
1275
1275
  function screenSpaceError2D(primitive, frameState, tile) {
1276
1276
  const camera = frameState.camera;
1277
1277
  let frustum = camera.frustum;
1278
- if (defined(frustum._offCenterFrustum)) {
1279
- frustum = frustum._offCenterFrustum;
1278
+ const offCenterFrustum = frustum.offCenterFrustum;
1279
+ if (defined(offCenterFrustum)) {
1280
+ frustum = offCenterFrustum;
1280
1281
  }
1281
1282
 
1282
1283
  const context = frameState.context;
@@ -432,8 +432,9 @@ SceneTransforms.drawingBufferToWgs84Coordinates = function (
432
432
  let worldCoords;
433
433
  let frustum = scene.camera.frustum;
434
434
  if (!defined(frustum.fovy)) {
435
- if (defined(frustum._offCenterFrustum)) {
436
- frustum = frustum._offCenterFrustum;
435
+ const offCenterFrustum = frustum.offCenterFrustum;
436
+ if (defined(offCenterFrustum)) {
437
+ frustum = offCenterFrustum;
437
438
  }
438
439
  worldCoords = scratchWorldCoords;
439
440
  worldCoords.x =
@@ -217,7 +217,7 @@ function ScreenSpaceCameraController(scene) {
217
217
  modifier: KeyboardEventModifier.SHIFT,
218
218
  };
219
219
  /**
220
- * The minimum height the camera must be before picking the terrain instead of the ellipsoid.
220
+ * The minimum height the camera must be before picking the terrain or scene content instead of the ellipsoid.
221
221
  * @type {number}
222
222
  * @default 150000.0
223
223
  */
@@ -291,6 +291,8 @@ function ScreenSpaceCameraController(scene) {
291
291
  this._zoomMouseStart = new Cartesian2(-1.0, -1.0);
292
292
  this._zoomWorldPosition = new Cartesian3();
293
293
  this._useZoomWorldPosition = false;
294
+ this._panLastMousePosition = new Cartesian2();
295
+ this._panLastWorldPosition = new Cartesian3();
294
296
  this._tiltCVOffMap = false;
295
297
  this._looking = false;
296
298
  this._rotating = false;
@@ -592,7 +594,7 @@ function handleZoom(
592
594
  if (camera.frustum instanceof OrthographicFrustum) {
593
595
  if (Math.abs(distance) > 0.0) {
594
596
  camera.zoomIn(distance);
595
- camera._adjustOrthographicFrustum();
597
+ camera._adjustOrthographicFrustum(true);
596
598
  }
597
599
  return;
598
600
  }
@@ -611,19 +613,22 @@ function handleZoom(
611
613
  object._zoomMouseStart
612
614
  );
613
615
 
614
- if (defined(object._globe)) {
615
- if (mode === SceneMode.SCENE2D) {
616
- pickedPosition = camera.getPickRay(startPosition, scratchZoomPickRay)
617
- .origin;
618
- pickedPosition = Cartesian3.fromElements(
619
- pickedPosition.y,
620
- pickedPosition.z,
621
- pickedPosition.x
622
- );
623
- } else {
624
- pickedPosition = pickGlobe(object, startPosition, scratchPickCartesian);
625
- }
616
+ if (defined(object._globe) && mode === SceneMode.SCENE2D) {
617
+ pickedPosition = camera.getPickRay(startPosition, scratchZoomPickRay)
618
+ .origin;
619
+ pickedPosition = Cartesian3.fromElements(
620
+ pickedPosition.y,
621
+ pickedPosition.z,
622
+ pickedPosition.x
623
+ );
624
+ } else {
625
+ pickedPosition = pickPosition(
626
+ object,
627
+ startPosition,
628
+ scratchPickCartesian
629
+ );
626
630
  }
631
+
627
632
  if (defined(pickedPosition)) {
628
633
  object._useZoomWorldPosition = true;
629
634
  object._zoomWorldPosition = Cartesian3.clone(
@@ -709,7 +714,7 @@ function handleZoom(
709
714
  const centerPixel = scratchCenterPixel;
710
715
  centerPixel.x = canvas.clientWidth / 2;
711
716
  centerPixel.y = canvas.clientHeight / 2;
712
- const centerPosition = pickGlobe(
717
+ const centerPosition = pickPosition(
713
718
  object,
714
719
  centerPixel,
715
720
  scratchCenterPosition
@@ -1107,17 +1112,11 @@ const pickGlobeScratchRay = new Ray();
1107
1112
  const scratchDepthIntersection = new Cartesian3();
1108
1113
  const scratchRayIntersection = new Cartesian3();
1109
1114
 
1110
- function pickGlobe(controller, mousePosition, result) {
1115
+ function pickPosition(controller, mousePosition, result) {
1111
1116
  const scene = controller._scene;
1112
1117
  const globe = controller._globe;
1113
1118
  const camera = scene.camera;
1114
1119
 
1115
- if (!defined(globe)) {
1116
- return undefined;
1117
- }
1118
-
1119
- const cullBackFaces = !controller._cameraUnderground;
1120
-
1121
1120
  let depthIntersection;
1122
1121
  if (scene.pickPositionSupported) {
1123
1122
  depthIntersection = scene.pickPositionWorldCoordinates(
@@ -1126,6 +1125,11 @@ function pickGlobe(controller, mousePosition, result) {
1126
1125
  );
1127
1126
  }
1128
1127
 
1128
+ if (!defined(globe)) {
1129
+ return Cartesian3.clone(depthIntersection, result);
1130
+ }
1131
+
1132
+ const cullBackFaces = !controller._cameraUnderground;
1129
1133
  const ray = camera.getPickRay(mousePosition, pickGlobeScratchRay);
1130
1134
  const rayIntersection = globe.pickWorldCoordinates(
1131
1135
  ray,
@@ -1289,7 +1293,8 @@ function translateCV(controller, startPosition, movement) {
1289
1293
 
1290
1294
  let globePos;
1291
1295
  if (camera.position.z < controller._minimumPickingTerrainHeight) {
1292
- globePos = pickGlobe(controller, startMouse, translateCVStartPos);
1296
+ globePos = pickPosition(controller, startMouse, translateCVStartPos);
1297
+
1293
1298
  if (defined(globePos)) {
1294
1299
  origin.x = globePos.x;
1295
1300
  }
@@ -1476,7 +1481,7 @@ function rotateCVOnTerrain(controller, startPosition, movement) {
1476
1481
  center = Cartesian3.clone(controller._tiltCenter, rotateCVCenter);
1477
1482
  } else {
1478
1483
  if (camera.position.z < controller._minimumPickingTerrainHeight) {
1479
- center = pickGlobe(controller, startPosition, rotateCVCenter);
1484
+ center = pickPosition(controller, startPosition, rotateCVCenter);
1480
1485
  }
1481
1486
 
1482
1487
  if (!defined(center)) {
@@ -1711,7 +1716,7 @@ function zoomCV(controller, startPosition, movement) {
1711
1716
 
1712
1717
  let intersection;
1713
1718
  if (height < controller._minimumPickingTerrainHeight) {
1714
- intersection = pickGlobe(controller, windowPosition, zoomCVIntersection);
1719
+ intersection = pickPosition(controller, windowPosition, zoomCVIntersection);
1715
1720
  }
1716
1721
 
1717
1722
  let distance;
@@ -1826,7 +1831,6 @@ const scratchStrafeRay = new Ray();
1826
1831
  const scratchStrafePlane = new Plane(Cartesian3.UNIT_X, 0.0);
1827
1832
  const scratchStrafeIntersection = new Cartesian3();
1828
1833
  const scratchStrafeDirection = new Cartesian3();
1829
- const scratchMousePos = new Cartesian3();
1830
1834
 
1831
1835
  function strafe(controller, movement, strafeStartPosition) {
1832
1836
  const scene = controller._scene;
@@ -1867,6 +1871,7 @@ const scratchRadii = new Cartesian3();
1867
1871
  const scratchEllipsoid = new Ellipsoid();
1868
1872
  const scratchLookUp = new Cartesian3();
1869
1873
  const scratchNormal = new Cartesian3();
1874
+ const scratchMousePosition = new Cartesian3();
1870
1875
 
1871
1876
  function spin3D(controller, startPosition, movement) {
1872
1877
  const scene = controller._scene;
@@ -1918,10 +1923,10 @@ function spin3D(controller, startPosition, movement) {
1918
1923
  const globe = controller._globe;
1919
1924
 
1920
1925
  if (defined(globe) && height < controller._minimumPickingTerrainHeight) {
1921
- const mousePos = pickGlobe(
1926
+ const mousePos = pickPosition(
1922
1927
  controller,
1923
1928
  movement.startPosition,
1924
- scratchMousePos
1929
+ scratchMousePosition
1925
1930
  );
1926
1931
  if (defined(mousePos)) {
1927
1932
  let strafing = false;
@@ -2051,6 +2056,9 @@ const pan3DTemp2 = new Cartesian3();
2051
2056
  const pan3DTemp3 = new Cartesian3();
2052
2057
  const pan3DStartMousePosition = new Cartesian2();
2053
2058
  const pan3DEndMousePosition = new Cartesian2();
2059
+ const pan3DDiffMousePosition = new Cartesian2();
2060
+ const pan3DPixelDimensions = new Cartesian2();
2061
+ const panRay = new Ray();
2054
2062
 
2055
2063
  function pan3D(controller, startPosition, movement, ellipsoid) {
2056
2064
  const scene = controller._scene;
@@ -2064,9 +2072,109 @@ function pan3D(controller, startPosition, movement, ellipsoid) {
2064
2072
  movement.endPosition,
2065
2073
  pan3DEndMousePosition
2066
2074
  );
2075
+ const height = ellipsoid.cartesianToCartographic(
2076
+ camera.positionWC,
2077
+ scratchCartographic
2078
+ ).height;
2079
+
2080
+ let p0, p1;
2081
+
2082
+ if (
2083
+ !movement.inertiaEnabled &&
2084
+ height < controller._minimumPickingTerrainHeight
2085
+ ) {
2086
+ p0 = Cartesian3.clone(controller._panLastWorldPosition, pan3DP0);
2087
+
2088
+ // Use the last picked world position unless we're starting a new drag
2089
+ if (
2090
+ !defined(controller._globe) &&
2091
+ !Cartesian2.equalsEpsilon(
2092
+ startMousePosition,
2093
+ controller._panLastMousePosition
2094
+ )
2095
+ ) {
2096
+ p0 = pickPosition(controller, startMousePosition, pan3DP0);
2097
+ }
2098
+
2099
+ if (!defined(controller._globe) && defined(p0)) {
2100
+ const toCenter = Cartesian3.subtract(p0, camera.positionWC, pan3DTemp1);
2101
+ const toCenterProj = Cartesian3.multiplyByScalar(
2102
+ camera.directionWC,
2103
+ Cartesian3.dot(camera.directionWC, toCenter),
2104
+ pan3DTemp1
2105
+ );
2106
+ const distanceToNearPlane = Cartesian3.magnitude(toCenterProj);
2107
+ const pixelDimensions = camera.frustum.getPixelDimensions(
2108
+ scene.drawingBufferWidth,
2109
+ scene.drawingBufferHeight,
2110
+ distanceToNearPlane,
2111
+ scene.pixelRatio,
2112
+ pan3DPixelDimensions
2113
+ );
2067
2114
 
2068
- let p0 = camera.pickEllipsoid(startMousePosition, ellipsoid, pan3DP0);
2069
- let p1 = camera.pickEllipsoid(endMousePosition, ellipsoid, pan3DP1);
2115
+ const dragDelta = Cartesian2.subtract(
2116
+ endMousePosition,
2117
+ startMousePosition,
2118
+ pan3DDiffMousePosition
2119
+ );
2120
+
2121
+ // Move the camera to the the distance the cursor moved in worldspace
2122
+ const right = Cartesian3.multiplyByScalar(
2123
+ camera.rightWC,
2124
+ dragDelta.x * pixelDimensions.x,
2125
+ pan3DTemp1
2126
+ );
2127
+
2128
+ // Move the camera towards the picked position in worldspace as the camera is pointed towards a horizon view
2129
+ const cameraPositionNormal = Cartesian3.normalize(
2130
+ camera.positionWC,
2131
+ scratchCameraPositionNormal
2132
+ );
2133
+ const endPickDirection = camera.getPickRay(endMousePosition, panRay)
2134
+ .direction;
2135
+ const endPickProj = Cartesian3.subtract(
2136
+ endPickDirection,
2137
+ Cartesian3.projectVector(endPickDirection, camera.rightWC, pan3DTemp2),
2138
+ pan3DTemp2
2139
+ );
2140
+ const angle = Cartesian3.angleBetween(endPickProj, camera.directionWC);
2141
+ let forward = 1.0;
2142
+ if (defined(camera.frustum.fov)) {
2143
+ forward = Math.max(Math.tan(angle), 0.1); // Clamp so we don't make the magnitude infinitely large when the angle is small
2144
+ }
2145
+ let dot = Math.abs(
2146
+ Cartesian3.dot(camera.directionWC, cameraPositionNormal)
2147
+ );
2148
+ const magnitude =
2149
+ ((-dragDelta.y * pixelDimensions.y * 2.0) / Math.sqrt(forward)) *
2150
+ (1.0 - dot);
2151
+ const direction = Cartesian3.multiplyByScalar(
2152
+ endPickDirection,
2153
+ magnitude,
2154
+ pan3DTemp2
2155
+ );
2156
+
2157
+ // Move the camera up the distance the cursor moved in worldspace as the camera is pointed towards the center
2158
+ dot = Math.abs(Cartesian3.dot(camera.upWC, cameraPositionNormal));
2159
+ const up = Cartesian3.multiplyByScalar(
2160
+ camera.upWC,
2161
+ -dragDelta.y * (1.0 - dot) * pixelDimensions.y,
2162
+ pan3DTemp3
2163
+ );
2164
+
2165
+ p1 = Cartesian3.add(p0, right, pan3DP1);
2166
+ p1 = Cartesian3.add(p1, direction, p1);
2167
+ p1 = Cartesian3.add(p1, up, p1);
2168
+
2169
+ Cartesian3.clone(p1, controller._panLastWorldPosition);
2170
+ Cartesian2.clone(endMousePosition, controller._panLastMousePosition);
2171
+ }
2172
+ }
2173
+
2174
+ if (!defined(p0) || !defined(p1)) {
2175
+ p0 = camera.pickEllipsoid(startMousePosition, ellipsoid, pan3DP0);
2176
+ p1 = camera.pickEllipsoid(endMousePosition, ellipsoid, pan3DP1);
2177
+ }
2070
2178
 
2071
2179
  if (!defined(p0) || !defined(p1)) {
2072
2180
  controller._rotating = true;
@@ -2205,7 +2313,7 @@ function zoom3D(controller, startPosition, movement) {
2205
2313
  ? approachingCollision
2206
2314
  : height < controller._minimumPickingTerrainHeight;
2207
2315
  if (needPickGlobe) {
2208
- intersection = pickGlobe(controller, windowPosition, zoomCVIntersection);
2316
+ intersection = pickPosition(controller, windowPosition, zoomCVIntersection);
2209
2317
  }
2210
2318
 
2211
2319
  let distance;
@@ -2397,7 +2505,7 @@ function tilt3DOnTerrain(controller, startPosition, movement) {
2397
2505
  if (Cartesian2.equals(startPosition, controller._tiltCenterMousePosition)) {
2398
2506
  center = Cartesian3.clone(controller._tiltCenter, tilt3DCenter);
2399
2507
  } else {
2400
- center = pickGlobe(controller, startPosition, tilt3DCenter);
2508
+ center = pickPosition(controller, startPosition, tilt3DCenter);
2401
2509
 
2402
2510
  if (!defined(center)) {
2403
2511
  ray = camera.getPickRay(startPosition, tilt3DRay);
@@ -394,11 +394,15 @@ Vector3DTilePoints.prototype.applyStyle = function (style, features) {
394
394
 
395
395
  if (defined(style.scaleByDistance)) {
396
396
  const scaleByDistanceCart4 = style.scaleByDistance.evaluate(feature);
397
- scratchScaleByDistance.near = scaleByDistanceCart4.x;
398
- scratchScaleByDistance.nearValue = scaleByDistanceCart4.y;
399
- scratchScaleByDistance.far = scaleByDistanceCart4.z;
400
- scratchScaleByDistance.farValue = scaleByDistanceCart4.w;
401
- feature.scaleByDistance = scratchScaleByDistance;
397
+ if (defined(scaleByDistanceCart4)) {
398
+ scratchScaleByDistance.near = scaleByDistanceCart4.x;
399
+ scratchScaleByDistance.nearValue = scaleByDistanceCart4.y;
400
+ scratchScaleByDistance.far = scaleByDistanceCart4.z;
401
+ scratchScaleByDistance.farValue = scaleByDistanceCart4.w;
402
+ feature.scaleByDistance = scratchScaleByDistance;
403
+ } else {
404
+ feature.scaleByDistance = undefined;
405
+ }
402
406
  } else {
403
407
  feature.scaleByDistance = undefined;
404
408
  }
@@ -407,11 +411,15 @@ Vector3DTilePoints.prototype.applyStyle = function (style, features) {
407
411
  const translucencyByDistanceCart4 = style.translucencyByDistance.evaluate(
408
412
  feature
409
413
  );
410
- scratchTranslucencyByDistance.near = translucencyByDistanceCart4.x;
411
- scratchTranslucencyByDistance.nearValue = translucencyByDistanceCart4.y;
412
- scratchTranslucencyByDistance.far = translucencyByDistanceCart4.z;
413
- scratchTranslucencyByDistance.farValue = translucencyByDistanceCart4.w;
414
- feature.translucencyByDistance = scratchTranslucencyByDistance;
414
+ if (defined(translucencyByDistanceCart4)) {
415
+ scratchTranslucencyByDistance.near = translucencyByDistanceCart4.x;
416
+ scratchTranslucencyByDistance.nearValue = translucencyByDistanceCart4.y;
417
+ scratchTranslucencyByDistance.far = translucencyByDistanceCart4.z;
418
+ scratchTranslucencyByDistance.farValue = translucencyByDistanceCart4.w;
419
+ feature.translucencyByDistance = scratchTranslucencyByDistance;
420
+ } else {
421
+ feature.translucencyByDistance = undefined;
422
+ }
415
423
  } else {
416
424
  feature.translucencyByDistance = undefined;
417
425
  }
@@ -420,9 +428,13 @@ Vector3DTilePoints.prototype.applyStyle = function (style, features) {
420
428
  const distanceDisplayConditionCart2 = style.distanceDisplayCondition.evaluate(
421
429
  feature
422
430
  );
423
- scratchDistanceDisplayCondition.near = distanceDisplayConditionCart2.x;
424
- scratchDistanceDisplayCondition.far = distanceDisplayConditionCart2.y;
425
- feature.distanceDisplayCondition = scratchDistanceDisplayCondition;
431
+ if (defined(distanceDisplayConditionCart2)) {
432
+ scratchDistanceDisplayCondition.near = distanceDisplayConditionCart2.x;
433
+ scratchDistanceDisplayCondition.far = distanceDisplayConditionCart2.y;
434
+ feature.distanceDisplayCondition = scratchDistanceDisplayCondition;
435
+ } else {
436
+ feature.distanceDisplayCondition = undefined;
437
+ }
426
438
  } else {
427
439
  feature.distanceDisplayCondition = undefined;
428
440
  }