@cesium/engine 9.1.0 → 10.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 (255) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +108 -210
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +54 -104
  4. package/Build/Workers/{chunk-TMMOULW3.js → chunk-2J3JKXCP.js} +5 -5
  5. package/Build/Workers/{chunk-ZDP32RQI.js → chunk-3WUV74WM.js} +95 -155
  6. package/Build/Workers/{chunk-FOZQIHZK.js → chunk-4BAE4PWO.js} +6 -6
  7. package/Build/Workers/{chunk-CYAJYEKW.js → chunk-4MSUJ4I7.js} +8 -8
  8. package/Build/Workers/{chunk-KPY4F4BW.js → chunk-4YSNMHZ4.js} +6 -6
  9. package/Build/Workers/{chunk-66E3H2KU.js → chunk-5S7OLEPK.js} +12 -12
  10. package/Build/Workers/{chunk-4AJGCQFX.js → chunk-7XGC6YB2.js} +14 -14
  11. package/Build/Workers/{chunk-BDUJXBVF.js → chunk-AA4GZKOT.js} +3 -5
  12. package/Build/Workers/{chunk-7LPEGKOF.js → chunk-AD5HBJ2F.js} +11 -8
  13. package/Build/Workers/{chunk-XHLDDE65.js → chunk-AVI4IUWC.js} +11 -11
  14. package/Build/Workers/{chunk-MWYZ64MH.js → chunk-BCL4PHHT.js} +10 -10
  15. package/Build/Workers/{chunk-PWF3YJJ5.js → chunk-BDFNKFOE.js} +13 -13
  16. package/Build/Workers/{chunk-7VZNXIKG.js → chunk-BJF5LOWE.js} +7 -7
  17. package/Build/Workers/{chunk-3S2MFY4B.js → chunk-C2CGMAIU.js} +13 -13
  18. package/Build/Workers/{chunk-UAJEGIWA.js → chunk-COYFZ5VA.js} +6 -6
  19. package/Build/Workers/{chunk-ZWPIM77Q.js → chunk-DGS5QNIO.js} +13 -13
  20. package/Build/Workers/{chunk-V7JB576Q.js → chunk-DKVHRNFY.js} +5 -5
  21. package/Build/Workers/{chunk-NI2R52QD.js → chunk-DOXCPOG4.js} +11 -9
  22. package/Build/Workers/{chunk-XWML5Y7N.js → chunk-FXIHSF7O.js} +9 -9
  23. package/Build/Workers/{chunk-LW7WGHEU.js → chunk-G3YR53LY.js} +13 -13
  24. package/Build/Workers/{chunk-34DGOKCO.js → chunk-GR3CDLCP.js} +7 -7
  25. package/Build/Workers/{chunk-AOIKO5Y7.js → chunk-GRAT5GE7.js} +5 -5
  26. package/Build/Workers/{chunk-AOFMPKUB.js → chunk-I2RC4XVN.js} +4 -4
  27. package/Build/Workers/{chunk-PK7TEP3J.js → chunk-JYAHOGGL.js} +15 -15
  28. package/Build/Workers/{chunk-4KIUON73.js → chunk-KUN2ZA5X.js} +4 -4
  29. package/Build/Workers/{chunk-POLFRINT.js → chunk-L6RTJ3RE.js} +14 -14
  30. package/Build/Workers/{chunk-LVJCR7DH.js → chunk-LCLJJ2MZ.js} +18 -18
  31. package/Build/Workers/{chunk-3RZK5NNV.js → chunk-LEABCTLP.js} +4 -4
  32. package/Build/Workers/{chunk-QKF7XXEQ.js → chunk-MDHQR3ZS.js} +10 -8
  33. package/Build/Workers/{chunk-4PHPQRSH.js → chunk-MSKXMXJI.js} +5 -6
  34. package/Build/Workers/{chunk-GIFJ77E4.js → chunk-NTXTUNEF.js} +4 -4
  35. package/Build/Workers/{chunk-I5TDPPC4.js → chunk-O3JCMSS3.js} +17 -17
  36. package/Build/Workers/{chunk-PEABJLCK.js → chunk-OOK53QUQ.js} +1 -1
  37. package/Build/Workers/{chunk-PS6AEMBR.js → chunk-OORVMGDU.js} +7 -7
  38. package/Build/Workers/{chunk-JI2445T5.js → chunk-PCP4YQST.js} +11 -11
  39. package/Build/Workers/{chunk-C5CE4OG6.js → chunk-PYHLO636.js} +42 -13
  40. package/Build/Workers/{chunk-S4XDCPKD.js → chunk-Q55ECN3Y.js} +1 -1
  41. package/Build/Workers/{chunk-WWP3I7R5.js → chunk-QD4KM3GO.js} +5 -5
  42. package/Build/Workers/{chunk-YLZTCEBJ.js → chunk-QMLTCCYG.js} +1 -1
  43. package/Build/Workers/{chunk-IBXGK4WV.js → chunk-QX5XS4LC.js} +2 -2
  44. package/Build/Workers/{chunk-RL73GOEF.js → chunk-R6B7UCQB.js} +2 -2
  45. package/Build/Workers/{chunk-RR7EOKGZ.js → chunk-RJYML24O.js} +48 -85
  46. package/Build/Workers/{chunk-U4IMCOF5.js → chunk-S3PI2KFM.js} +2 -2
  47. package/Build/Workers/{chunk-6HCAQOVK.js → chunk-STBBMQGG.js} +6 -6
  48. package/Build/Workers/{chunk-CE6GTZ4I.js → chunk-SYCPRK3D.js} +10 -10
  49. package/Build/Workers/{chunk-WFICTTOE.js → chunk-T77JILCU.js} +2 -2
  50. package/Build/Workers/{chunk-ZC4AGBZK.js → chunk-TO2PVHKI.js} +2 -2
  51. package/Build/Workers/{chunk-UCPPWV64.js → chunk-VE7BFUIX.js} +1 -1
  52. package/Build/Workers/{chunk-2CSEEWHN.js → chunk-VFBNELXB.js} +7 -7
  53. package/Build/Workers/{chunk-A6NCZSL3.js → chunk-VO3ACQB2.js} +19 -19
  54. package/Build/Workers/{chunk-WEGCQ5DY.js → chunk-X23FRWHJ.js} +6 -6
  55. package/Build/Workers/{chunk-G7CJQKKD.js → chunk-XD445VDH.js} +7 -7
  56. package/Build/Workers/combineGeometry.js +22 -22
  57. package/Build/Workers/createBoxGeometry.js +16 -16
  58. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  59. package/Build/Workers/createCircleGeometry.js +29 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +32 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  63. package/Build/Workers/createCorridorGeometry.js +29 -29
  64. package/Build/Workers/createCorridorOutlineGeometry.js +27 -27
  65. package/Build/Workers/createCylinderGeometry.js +18 -18
  66. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  67. package/Build/Workers/createEllipseGeometry.js +24 -24
  68. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  69. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  71. package/Build/Workers/createFrustumGeometry.js +16 -16
  72. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  73. package/Build/Workers/createGeometry.js +22 -22
  74. package/Build/Workers/createGroundPolylineGeometry.js +24 -24
  75. package/Build/Workers/createPlaneGeometry.js +14 -14
  76. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  77. package/Build/Workers/createPolygonGeometry.js +32 -32
  78. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  79. package/Build/Workers/createPolylineGeometry.js +24 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +30 -30
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +26 -26
  82. package/Build/Workers/createRectangleGeometry.js +27 -27
  83. package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  85. package/Build/Workers/createSphereGeometry.js +17 -17
  86. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  89. package/Build/Workers/createVectorTileGeometries.js +22 -22
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +20 -20
  92. package/Build/Workers/createVectorTilePolylines.js +13 -13
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  94. package/Build/Workers/createVerticesFromHeightmap.js +21 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  96. package/Build/Workers/createWallGeometry.js +23 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
  100. package/Build/Workers/decodeI3S.js +10 -10
  101. package/Build/Workers/transcodeKTX2.js +43 -79
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  104. package/Source/Core/ApproximateTerrainHeights.js +4 -4
  105. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +12 -8
  106. package/Source/Core/BoundingRectangle.js +2 -0
  107. package/Source/Core/BoundingSphere.js +4 -2
  108. package/Source/Core/Cartesian3.js +13 -10
  109. package/Source/Core/Cartographic.js +11 -8
  110. package/Source/Core/CesiumTerrainProvider.js +3 -2
  111. package/Source/Core/CircleGeometry.js +6 -2
  112. package/Source/Core/CircleOutlineGeometry.js +1 -1
  113. package/Source/Core/CoplanarPolygonGeometry.js +3 -3
  114. package/Source/Core/CorridorGeometry.js +4 -4
  115. package/Source/Core/CorridorOutlineGeometry.js +2 -2
  116. package/Source/Core/Credit.js +3 -2
  117. package/Source/Core/CustomHeightmapTerrainProvider.js +17 -3
  118. package/Source/Core/EllipseGeometry.js +4 -4
  119. package/Source/Core/EllipseOutlineGeometry.js +2 -2
  120. package/Source/Core/Ellipsoid.js +34 -0
  121. package/Source/Core/EllipsoidGeodesic.js +2 -2
  122. package/Source/Core/EllipsoidRhumbLine.js +4 -4
  123. package/Source/Core/EllipsoidTangentPlane.js +3 -3
  124. package/Source/Core/EllipsoidTerrainProvider.js +3 -3
  125. package/Source/Core/GeographicProjection.js +4 -3
  126. package/Source/Core/GeographicTilingScheme.js +3 -3
  127. package/Source/Core/GeometryPipeline.js +2 -2
  128. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
  129. package/Source/Core/GoogleMaps.js +1 -1
  130. package/Source/Core/GroundPolylineGeometry.js +1 -1
  131. package/Source/Core/HeightmapTessellator.js +2 -2
  132. package/Source/Core/Ion.js +1 -1
  133. package/Source/Core/Math.js +0 -5
  134. package/Source/Core/Occluder.js +3 -3
  135. package/Source/Core/OrientedBoundingBox.js +2 -2
  136. package/Source/Core/PolygonGeometry.js +4 -4
  137. package/Source/Core/PolygonGeometryLibrary.js +1 -1
  138. package/Source/Core/PolygonOutlineGeometry.js +3 -3
  139. package/Source/Core/PolygonPipeline.js +2 -2
  140. package/Source/Core/PolylineGeometry.js +2 -2
  141. package/Source/Core/PolylinePipeline.js +6 -6
  142. package/Source/Core/PolylineVolumeGeometry.js +2 -2
  143. package/Source/Core/PolylineVolumeOutlineGeometry.js +2 -2
  144. package/Source/Core/Rectangle.js +6 -6
  145. package/Source/Core/RectangleGeometry.js +6 -6
  146. package/Source/Core/RectangleGeometryLibrary.js +3 -0
  147. package/Source/Core/RectangleOutlineGeometry.js +2 -2
  148. package/Source/Core/Simon1994PlanetaryPositions.js +3 -2
  149. package/Source/Core/SimplePolylineGeometry.js +2 -2
  150. package/Source/Core/Stereographic.js +2 -2
  151. package/Source/Core/TaskProcessor.js +19 -3
  152. package/Source/Core/Transforms.js +17 -17
  153. package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
  154. package/Source/Core/WallGeometry.js +3 -3
  155. package/Source/Core/WallOutlineGeometry.js +3 -3
  156. package/Source/Core/WebMercatorTilingScheme.js +3 -3
  157. package/Source/Core/createWorldTerrainAsync.js +2 -0
  158. package/Source/Core/sampleTerrain.js +3 -3
  159. package/Source/DataSources/BoxGeometryUpdater.js +2 -2
  160. package/Source/DataSources/CylinderGeometryUpdater.js +2 -2
  161. package/Source/DataSources/CzmlDataSource.js +8 -8
  162. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -3
  163. package/Source/DataSources/EntityCluster.js +1 -1
  164. package/Source/DataSources/EntityView.js +2 -2
  165. package/Source/DataSources/KmlDataSource.js +4 -4
  166. package/Source/DataSources/ModelVisualizer.js +1 -2
  167. package/Source/DataSources/PolygonGeometryUpdater.js +1 -1
  168. package/Source/DataSources/PolylineGeometryUpdater.js +3 -2
  169. package/Source/DataSources/RectangleGeometryUpdater.js +1 -1
  170. package/Source/DataSources/ScaledPositionProperty.js +2 -2
  171. package/Source/DataSources/TerrainOffsetProperty.js +3 -7
  172. package/Source/DataSources/VelocityOrientationProperty.js +2 -2
  173. package/Source/DataSources/exportKml.js +2 -2
  174. package/Source/Renderer/UniformState.js +1 -1
  175. package/Source/Scene/ArcGisMapServerImageryProvider.js +2 -2
  176. package/Source/Scene/ArcGisMapService.js +1 -1
  177. package/Source/Scene/Billboard.js +8 -6
  178. package/Source/Scene/BingMapsImageryProvider.js +1 -1
  179. package/Source/Scene/Camera.js +16 -10
  180. package/Source/Scene/Cesium3DTileset.js +1 -1
  181. package/Source/Scene/ClippingPolygon.js +2 -2
  182. package/Source/Scene/ClippingPolygonCollection.js +1 -1
  183. package/Source/Scene/CreditDisplay.js +94 -104
  184. package/Source/Scene/Globe.js +16 -13
  185. package/Source/Scene/GltfLoader.js +458 -435
  186. package/Source/Scene/GltfLoaderUtil.js +5 -16
  187. package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
  188. package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
  189. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +1 -1
  190. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
  191. package/Source/Scene/GridImageryProvider.js +2 -2
  192. package/Source/Scene/ImageryLayerCollection.js +2 -2
  193. package/Source/Scene/Label.js +1 -1
  194. package/Source/Scene/MapboxImageryProvider.js +1 -1
  195. package/Source/Scene/MapboxStyleImageryProvider.js +1 -1
  196. package/Source/Scene/MetadataSemantic.js +4 -4
  197. package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
  198. package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
  199. package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
  200. package/Source/Scene/Model/InstancingPipelineStage.js +3 -3
  201. package/Source/Scene/Model/LightingPipelineStage.js +2 -4
  202. package/Source/Scene/Model/MaterialPipelineStage.js +395 -29
  203. package/Source/Scene/Model/Model.js +15 -7
  204. package/Source/Scene/Model/ModelSceneGraph.js +1 -1
  205. package/Source/Scene/Model/ModelUtility.js +3 -0
  206. package/Source/Scene/Model/SceneMode2DPipelineStage.js +3 -3
  207. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
  208. package/Source/Scene/Model/pickModel.js +2 -2
  209. package/Source/Scene/ModelComponents.js +178 -1
  210. package/Source/Scene/PickDepth.js +23 -15
  211. package/Source/Scene/Picking.js +4 -13
  212. package/Source/Scene/PointPrimitive.js +5 -2
  213. package/Source/Scene/ResourceCache.js +41 -50
  214. package/Source/Scene/ResourceCacheKey.js +41 -53
  215. package/Source/Scene/Scene.js +39 -31
  216. package/Source/Scene/SceneTransforms.js +78 -20
  217. package/Source/Scene/SceneTransitioner.js +2 -2
  218. package/Source/Scene/ScreenSpaceCameraController.js +29 -19
  219. package/Source/Scene/SkyBox.js +26 -0
  220. package/Source/Scene/Sun.js +1 -1
  221. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -10
  222. package/Source/Shaders/Builtin/Functions/ellipsoidTextureCoordinates.glsl +10 -0
  223. package/Source/Shaders/Builtin/Functions/{ellipsoidWgs84TextureCoordinates.js → ellipsoidTextureCoordinates.js} +3 -3
  224. package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
  225. package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
  226. package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
  227. package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
  228. package/Source/Shaders/Builtin/Structs/materialInput.glsl +1 -1
  229. package/Source/Shaders/Builtin/Structs/materialInput.js +1 -1
  230. package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +16 -0
  231. package/Source/Shaders/Builtin/Structs/modelMaterial.js +16 -0
  232. package/Source/Shaders/EllipsoidFS.glsl +1 -1
  233. package/Source/Shaders/EllipsoidFS.js +1 -1
  234. package/Source/Shaders/GlobeFS.glsl +3 -3
  235. package/Source/Shaders/GlobeFS.js +3 -3
  236. package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
  237. package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
  238. package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
  239. package/Source/Shaders/Model/LightingStageFS.js +113 -48
  240. package/Source/Shaders/Model/MaterialStageFS.glsl +407 -136
  241. package/Source/Shaders/Model/MaterialStageFS.js +407 -136
  242. package/Source/Widget/CesiumWidget.css +0 -5
  243. package/Source/Widget/CesiumWidget.js +29 -28
  244. package/index.d.ts +184 -116
  245. package/index.js +92 -95
  246. package/package.json +2 -2
  247. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
  248. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
  249. package/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.glsl +0 -10
  250. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
  251. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
  252. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
  253. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
  254. package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
  255. package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
@@ -35,9 +35,7 @@ const GltfLoaderUtil = {};
35
35
  */
36
36
  GltfLoaderUtil.getImageIdFromTexture = function (options) {
37
37
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
38
- const gltf = options.gltf;
39
- const textureId = options.textureId;
40
- const supportedImageFormats = options.supportedImageFormats;
38
+ const { gltf, textureId, supportedImageFormats } = options;
41
39
 
42
40
  //>>includeStart('debug', pragmas.debug);
43
41
  Check.typeOf.object("options.gltf", gltf);
@@ -73,12 +71,7 @@ GltfLoaderUtil.getImageIdFromTexture = function (options) {
73
71
  */
74
72
  GltfLoaderUtil.createSampler = function (options) {
75
73
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
76
- const gltf = options.gltf;
77
- const textureInfo = options.textureInfo;
78
- const compressedTextureNoMipmap = defaultValue(
79
- options.compressedTextureNoMipmap,
80
- false
81
- );
74
+ const { gltf, textureInfo, compressedTextureNoMipmap = false } = options;
82
75
 
83
76
  //>>includeStart('debug', pragmas.debug);
84
77
  Check.typeOf.object("options.gltf", gltf);
@@ -140,9 +133,7 @@ const defaultScale = new Cartesian2(1.0, 1.0);
140
133
  */
141
134
  GltfLoaderUtil.createModelTextureReader = function (options) {
142
135
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
143
- const textureInfo = options.textureInfo;
144
- const channels = options.channels;
145
- const texture = options.texture;
136
+ const { textureInfo, channels, texture } = options;
146
137
 
147
138
  //>>includeStart('debug', pragmas.debug);
148
139
  Check.typeOf.object("options.textureInfo", textureInfo);
@@ -151,10 +142,7 @@ GltfLoaderUtil.createModelTextureReader = function (options) {
151
142
  let texCoord = defaultValue(textureInfo.texCoord, 0);
152
143
  let transform;
153
144
 
154
- const textureTransform = defaultValue(
155
- textureInfo.extensions,
156
- defaultValue.EMPTY_OBJECT
157
- ).KHR_texture_transform;
145
+ const textureTransform = textureInfo.extensions?.KHR_texture_transform;
158
146
 
159
147
  if (defined(textureTransform)) {
160
148
  texCoord = defaultValue(textureTransform.texCoord, texCoord);
@@ -186,6 +174,7 @@ GltfLoaderUtil.createModelTextureReader = function (options) {
186
174
  modelTextureReader.index = textureInfo.index;
187
175
  modelTextureReader.texture = texture;
188
176
  modelTextureReader.texCoord = texCoord;
177
+ modelTextureReader.scale = textureInfo.scale;
189
178
  modelTextureReader.transform = transform;
190
179
  modelTextureReader.channels = channels;
191
180
 
@@ -33,10 +33,11 @@ function forEachTextureInMaterial(material, handler) {
33
33
  }
34
34
  }
35
35
 
36
- if (defined(material.extensions)) {
36
+ const { extensions } = material;
37
+ if (defined(extensions)) {
37
38
  // Spec gloss extension
38
39
  const pbrSpecularGlossiness =
39
- material.extensions.KHR_materials_pbrSpecularGlossiness;
40
+ extensions.KHR_materials_pbrSpecularGlossiness;
40
41
  if (defined(pbrSpecularGlossiness)) {
41
42
  if (defined(pbrSpecularGlossiness.diffuseTexture)) {
42
43
  const textureInfo = pbrSpecularGlossiness.diffuseTexture;
@@ -54,13 +55,28 @@ function forEachTextureInMaterial(material, handler) {
54
55
  }
55
56
  }
56
57
 
58
+ // Specular extension
59
+ const specular = extensions.KHR_materials_specular;
60
+ if (defined(specular)) {
61
+ const { specularTexture, specularColorTexture } = specular;
62
+ if (defined(specularTexture)) {
63
+ const value = handler(specularTexture.index, specularTexture);
64
+ if (defined(value)) {
65
+ return value;
66
+ }
67
+ }
68
+ if (defined(specularColorTexture)) {
69
+ const value = handler(specularColorTexture.index, specularColorTexture);
70
+ if (defined(value)) {
71
+ return value;
72
+ }
73
+ }
74
+ }
75
+
57
76
  // Materials common extension (may be present in models converted from glTF 1.0)
58
- const materialsCommon = material.extensions.KHR_materials_common;
77
+ const materialsCommon = extensions.KHR_materials_common;
59
78
  if (defined(materialsCommon) && defined(materialsCommon.values)) {
60
- const diffuse = materialsCommon.values.diffuse;
61
- const ambient = materialsCommon.values.ambient;
62
- const emission = materialsCommon.values.emission;
63
- const specular = materialsCommon.values.specular;
79
+ const { diffuse, ambient, emission, specular } = materialsCommon.values;
64
80
  if (defined(diffuse) && defined(diffuse.index)) {
65
81
  const value = handler(diffuse.index, diffuse);
66
82
  if (defined(value)) {
@@ -34,15 +34,17 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
34
34
  */
35
35
  function GltfStructuralMetadataLoader(options) {
36
36
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
37
- const gltf = options.gltf;
38
- const extension = options.extension;
39
- const extensionLegacy = options.extensionLegacy;
40
- const gltfResource = options.gltfResource;
41
- const baseResource = options.baseResource;
42
- const supportedImageFormats = options.supportedImageFormats;
43
- const frameState = options.frameState;
44
- const cacheKey = options.cacheKey;
45
- const asynchronous = defaultValue(options.asynchronous, true);
37
+ const {
38
+ gltf,
39
+ extension,
40
+ extensionLegacy,
41
+ gltfResource,
42
+ baseResource,
43
+ supportedImageFormats,
44
+ frameState,
45
+ cacheKey,
46
+ asynchronous = true,
47
+ } = options;
46
48
 
47
49
  //>>includeStart('debug', pragmas.debug);
48
50
  Check.typeOf.object("options.gltf", gltf);
@@ -45,7 +45,7 @@ GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage = function (
45
45
  *
46
46
  * Initialization options for the GoogleEarthEnterpriseImageryProvider constructor
47
47
  *
48
- * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used.
48
+ * @property {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
49
49
  * @property {TileDiscardPolicy} [tileDiscardPolicy] The policy that determines if a tile
50
50
  * is invalid and should be discarded. If this value is not specified, a default
51
51
  * is to discard tiles that fail to download.
@@ -41,7 +41,7 @@ import ImageryProvider from "./ImageryProvider.js";
41
41
  * @property {TileDiscardPolicy} [tileDiscardPolicy] The policy that determines if a tile
42
42
  * is invalid and should be discarded. To ensure that no tiles are discarded, construct and pass
43
43
  * a {@link NeverTileDiscardPolicy} for this parameter.
44
- * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used.
44
+ * @property {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
45
45
  */
46
46
 
47
47
  /**
@@ -14,9 +14,9 @@ const defaultBackgroundColor = new Color(0.0, 0.5, 0.0, 0.2);
14
14
  * Initialization options for the GridImageryProvider constructor
15
15
  *
16
16
  * @property {TilingScheme} [tilingScheme=new GeographicTilingScheme()] The tiling scheme for which to draw tiles.
17
- * @property {Ellipsoid} [ellipsoid] The ellipsoid. If the tilingScheme is specified,
17
+ * @property {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid. If the tilingScheme is specified,
18
18
  * this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither
19
- * parameter is specified, the WGS84 ellipsoid is used.
19
+ * parameter is specified, the default ellipsoid is used.
20
20
  * @property {number} [cells=8] The number of grids cells.
21
21
  * @property {Color} [color=Color(1.0, 1.0, 1.0, 0.4)] The color to draw grid lines.
22
22
  * @property {Color} [glowColor=Color(0.0, 1.0, 0.0, 0.05)] The color to draw glow for grid lines.
@@ -436,7 +436,7 @@ ImageryLayerCollection.prototype.pickImageryLayers = function (ray, scene) {
436
436
  return;
437
437
  }
438
438
 
439
- const pickedLocation = scene.globe.ellipsoid.cartesianToCartographic(
439
+ const pickedLocation = scene.ellipsoid.cartesianToCartographic(
440
440
  pickedPosition
441
441
  );
442
442
 
@@ -491,7 +491,7 @@ ImageryLayerCollection.prototype.pickImageryLayerFeatures = function (
491
491
  return;
492
492
  }
493
493
 
494
- const pickedLocation = scene.globe.ellipsoid.cartesianToCartographic(
494
+ const pickedLocation = scene.ellipsoid.cartesianToCartographic(
495
495
  pickedPosition
496
496
  );
497
497
 
@@ -91,7 +91,7 @@ function parseFont(label) {
91
91
  * Initialization options for the Label constructor
92
92
  *
93
93
  * @property {Cartesian3} position The cartesian position of the label.
94
- * @property {string} [id] A user-defined object to return when the label is picked with {@link Scene#pick}.
94
+ * @property {*} [id] A user-defined object to return when the label is picked with {@link Scene#pick}.
95
95
  * @property {boolean} [show=true] Determines if this label will be shown.
96
96
  * @property {string} [text] A string specifying the text of the label.
97
97
  * @property {string} [font='30px sans-serif'] A string specifying the font used to draw this label. Fonts are specified using the same syntax as the CSS 'font' property.
@@ -19,7 +19,7 @@ const defaultCredit = new Credit(
19
19
  * @property {string} mapId The Mapbox Map ID.
20
20
  * @property {string} accessToken The public access token for the imagery.
21
21
  * @property {string} [format='png'] The format of the image request.
22
- * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used.
22
+ * @property {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
23
23
  * @property {number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
24
24
  * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
25
25
  * to result in rendering problems.
@@ -21,7 +21,7 @@ const defaultCredit = new Credit(
21
21
  * @property {string} accessToken The public access token for the imagery.
22
22
  * @property {number} [tilesize=512] The size of the image tiles.
23
23
  * @property {boolean} [scaleFactor] Determines if tiles are rendered at a @2x scale factor.
24
- * @property {Ellipsoid} [ellipsoid] The ellipsoid. If not specified, the WGS84 ellipsoid is used.
24
+ * @property {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
25
25
  * @property {number} [minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
26
26
  * this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
27
27
  * to result in rendering problems.
@@ -65,7 +65,7 @@ const MetadataSemantic = {
65
65
  */
66
66
  TILE_BOUNDING_SPHERE: "TILE_BOUNDING_SPHERE",
67
67
  /**
68
- * The minimum height of a tile above (or below) the WGS84 ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>. This semantic is used to tighten bounding regions implicitly calculated in implicit tiling.
68
+ * The minimum height of a tile above (or below) the ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>. This semantic is used to tighten bounding regions implicitly calculated in implicit tiling.
69
69
  *
70
70
  * @type {string}
71
71
  * @constant
@@ -73,7 +73,7 @@ const MetadataSemantic = {
73
73
  */
74
74
  TILE_MINIMUM_HEIGHT: "TILE_MINIMUM_HEIGHT",
75
75
  /**
76
- * The maximum height of a tile above (or below) the WGS84 ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>. This semantic is used to tighten bounding regions implicitly calculated in implicit tiling.
76
+ * The maximum height of a tile above (or below) the ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>. This semantic is used to tighten bounding regions implicitly calculated in implicit tiling.
77
77
  *
78
78
  * @type {string}
79
79
  * @constant
@@ -123,7 +123,7 @@ const MetadataSemantic = {
123
123
  */
124
124
  CONTENT_BOUNDING_SPHERE: "CONTENT_BOUNDING_SPHERE",
125
125
  /**
126
- * The minimum height of the content of a tile above (or below) the WGS84 ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>
126
+ * The minimum height of the content of a tile above (or below) the ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>
127
127
  *
128
128
  * @type {string}
129
129
  * @constant
@@ -131,7 +131,7 @@ const MetadataSemantic = {
131
131
  */
132
132
  CONTENT_MINIMUM_HEIGHT: "CONTENT_MINIMUM_HEIGHT",
133
133
  /**
134
- * The maximum height of the content of a tile above (or below) the WGS84 ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>
134
+ * The maximum height of the content of a tile above (or below) the ellipsoid, stored as a <code>FLOAT32</code> or a <code>FLOAT64</code>
135
135
  *
136
136
  * @type {string}
137
137
  * @constant
@@ -7,7 +7,7 @@ import Pass from "../../Renderer/Pass.js";
7
7
  /**
8
8
  * A pipeline stage for configuring the alpha options for handling translucency.
9
9
  *
10
- * @namespace MaterialPipelineStage
10
+ * @namespace AlphaPipelineStage
11
11
  *
12
12
  * @private
13
13
  */
@@ -63,8 +63,7 @@ GeometryPipelineStage.process = function (
63
63
  primitive,
64
64
  frameState
65
65
  ) {
66
- const shaderBuilder = renderResources.shaderBuilder;
67
- const model = renderResources.model;
66
+ const { shaderBuilder, model } = renderResources;
68
67
 
69
68
  // These structs are similar, though the fragment shader version has a couple
70
69
  // additional fields.
@@ -125,8 +124,7 @@ GeometryPipelineStage.process = function (
125
124
  );
126
125
 
127
126
  // .pnts point clouds store sRGB color rather than linear color
128
- const modelType = model.type;
129
- if (modelType === ModelType.TILE_PNTS) {
127
+ if (model.type === ModelType.TILE_PNTS) {
130
128
  shaderBuilder.addDefine(
131
129
  "HAS_SRGB_COLOR",
132
130
  undefined,
@@ -246,8 +244,7 @@ function processAttribute(
246
244
  }
247
245
 
248
246
  function addSemanticDefine(shaderBuilder, attribute) {
249
- const semantic = attribute.semantic;
250
- const setIndex = attribute.setIndex;
247
+ const { semantic, setIndex } = attribute;
251
248
  switch (semantic) {
252
249
  case VertexAttributeSemantic.NORMAL:
253
250
  shaderBuilder.addDefine("HAS_NORMALS");
@@ -272,19 +269,11 @@ function addAttributeToRenderResources(
272
269
  attributeIndex,
273
270
  modifyFor2D
274
271
  ) {
275
- const quantization = attribute.quantization;
276
- let type;
277
- let componentDatatype;
278
- if (defined(quantization)) {
279
- type = quantization.type;
280
- componentDatatype = quantization.componentDatatype;
281
- } else {
282
- type = attribute.type;
283
- componentDatatype = attribute.componentDatatype;
284
- }
272
+ const { quantization, semantic, setIndex } = attribute;
273
+ const { type, componentDatatype } = defined(quantization)
274
+ ? quantization
275
+ : attribute;
285
276
 
286
- const semantic = attribute.semantic;
287
- const setIndex = attribute.setIndex;
288
277
  if (
289
278
  semantic === VertexAttributeSemantic.FEATURE_ID &&
290
279
  setIndex >= renderResources.featureIdVertexAttributeSetIndex
@@ -337,18 +326,10 @@ function addMatrixAttributeToRenderResources(
337
326
  attributeIndex,
338
327
  columnCount
339
328
  ) {
340
- const quantization = attribute.quantization;
341
- let type;
342
- let componentDatatype;
343
- if (defined(quantization)) {
344
- type = quantization.type;
345
- componentDatatype = quantization.componentDatatype;
346
- } else {
347
- type = attribute.type;
348
- componentDatatype = attribute.componentDatatype;
349
- }
350
-
351
- const normalized = attribute.normalized;
329
+ const { quantization, normalized } = attribute;
330
+ const { type, componentDatatype } = defined(quantization)
331
+ ? quantization
332
+ : attribute;
352
333
 
353
334
  // componentCount is either 4, 9 or 16
354
335
  const componentCount = AttributeType.getNumberOfComponents(type);
@@ -435,7 +416,7 @@ function addAttributeDeclaration(shaderBuilder, attributeInfo, modifyFor2D) {
435
416
  function updateAttributesStruct(shaderBuilder, attributeInfo, use2D) {
436
417
  const vsStructId = GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS;
437
418
  const fsStructId = GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS;
438
- const variableName = attributeInfo.variableName;
419
+ const { variableName, glslType } = attributeInfo;
439
420
 
440
421
  if (variableName === "tangentMC") {
441
422
  // The w component of the tangent is only used for computing the bitangent,
@@ -451,16 +432,8 @@ function updateAttributesStruct(shaderBuilder, attributeInfo, use2D) {
451
432
  shaderBuilder.addStructField(vsStructId, "vec3", "normalMC");
452
433
  shaderBuilder.addStructField(fsStructId, "vec3", "normalEC");
453
434
  } else {
454
- shaderBuilder.addStructField(
455
- vsStructId,
456
- attributeInfo.glslType,
457
- variableName
458
- );
459
- shaderBuilder.addStructField(
460
- fsStructId,
461
- attributeInfo.glslType,
462
- variableName
463
- );
435
+ shaderBuilder.addStructField(vsStructId, glslType, variableName);
436
+ shaderBuilder.addStructField(fsStructId, glslType, variableName);
464
437
  }
465
438
 
466
439
  if (variableName === "positionMC" && use2D) {
@@ -501,8 +474,7 @@ function updateInitializeAttributesFunction(
501
474
  }
502
475
 
503
476
  function updateSetDynamicVaryingsFunction(shaderBuilder, attributeInfo) {
504
- const semantic = attributeInfo.attribute.semantic;
505
- const setIndex = attributeInfo.attribute.setIndex;
477
+ const { semantic, setIndex } = attributeInfo.attribute;
506
478
  if (defined(semantic) && !defined(setIndex)) {
507
479
  // positions, normals, and tangents are handled statically in
508
480
  // GeometryStageVS
@@ -8,6 +8,13 @@ const ImageBasedLightingPipelineStage = {
8
8
  name: "ImageBasedLightingPipelineStage", // Helps with debugging
9
9
  };
10
10
 
11
+ /**
12
+ * Add shader code, uniforms, and defines related to image based lighting
13
+ * @param {ModelRenderResources} renderResources
14
+ * @param {Model} model
15
+ * @param {FrameState} frameState
16
+ * @private
17
+ */
11
18
  ImageBasedLightingPipelineStage.process = function (
12
19
  renderResources,
13
20
  model,
@@ -276,7 +276,7 @@ function projectPositionTo2D(
276
276
  projectedPositionScratch
277
277
  );
278
278
 
279
- result = SceneTransforms.computeActualWgs84Position(
279
+ result = SceneTransforms.computeActualEllipsoidPosition(
280
280
  frameState,
281
281
  finalPosition,
282
282
  result
@@ -432,7 +432,7 @@ function computeReferencePoint2D(renderResources, frameState) {
432
432
  scratchProjectedMin
433
433
  );
434
434
 
435
- const projectedMin = SceneTransforms.computeActualWgs84Position(
435
+ const projectedMin = SceneTransforms.computeActualEllipsoidPosition(
436
436
  frameState,
437
437
  transformedPositionMin,
438
438
  transformedPositionMin
@@ -444,7 +444,7 @@ function computeReferencePoint2D(renderResources, frameState) {
444
444
  scratchProjectedMax
445
445
  );
446
446
 
447
- const projectedMax = SceneTransforms.computeActualWgs84Position(
447
+ const projectedMax = SceneTransforms.computeActualEllipsoidPosition(
448
448
  frameState,
449
449
  transformedPositionMax,
450
450
  transformedPositionMax
@@ -28,9 +28,7 @@ const LightingPipelineStage = {
28
28
  * @private
29
29
  */
30
30
  LightingPipelineStage.process = function (renderResources, primitive) {
31
- const model = renderResources.model;
32
- const lightingOptions = renderResources.lightingOptions;
33
- const shaderBuilder = renderResources.shaderBuilder;
31
+ const { model, lightingOptions, shaderBuilder } = renderResources;
34
32
 
35
33
  if (defined(model.lightColor)) {
36
34
  shaderBuilder.addDefine(
@@ -53,7 +51,7 @@ LightingPipelineStage.process = function (renderResources, primitive) {
53
51
 
54
52
  // The lighting model is always set by the material. However, custom shaders
55
53
  // can override this.
56
- const lightingModel = lightingOptions.lightingModel;
54
+ const { lightingModel } = lightingOptions;
57
55
 
58
56
  if (lightingModel === LightingModel.PBR) {
59
57
  shaderBuilder.addDefine(