@cesium/engine 9.1.0 → 9.2.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 (152) 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-7LPEGKOF.js → chunk-26NE4LRW.js} +7 -7
  5. package/Build/Workers/{chunk-PK7TEP3J.js → chunk-26XJDV3D.js} +15 -15
  6. package/Build/Workers/{chunk-G7CJQKKD.js → chunk-2TRB253J.js} +7 -7
  7. package/Build/Workers/{chunk-FOZQIHZK.js → chunk-3PV5HQ2R.js} +6 -6
  8. package/Build/Workers/{chunk-MWYZ64MH.js → chunk-3VDHTBY5.js} +10 -10
  9. package/Build/Workers/{chunk-XHLDDE65.js → chunk-4RG6WOXH.js} +10 -10
  10. package/Build/Workers/{chunk-WWP3I7R5.js → chunk-5OK5JFDP.js} +5 -5
  11. package/Build/Workers/{chunk-34DGOKCO.js → chunk-7HLZRYGD.js} +7 -7
  12. package/Build/Workers/{chunk-NI2R52QD.js → chunk-7PFZ4Z7C.js} +7 -7
  13. package/Build/Workers/{chunk-XWML5Y7N.js → chunk-A5CSB5ZE.js} +9 -9
  14. package/Build/Workers/{chunk-IBXGK4WV.js → chunk-AROLUUGS.js} +2 -2
  15. package/Build/Workers/{chunk-POLFRINT.js → chunk-BBBTT36L.js} +14 -14
  16. package/Build/Workers/{chunk-3RZK5NNV.js → chunk-BNT2SNWU.js} +4 -4
  17. package/Build/Workers/{chunk-CE6GTZ4I.js → chunk-CFBGPZU6.js} +9 -9
  18. package/Build/Workers/{chunk-YLZTCEBJ.js → chunk-CVCVMOQA.js} +1 -1
  19. package/Build/Workers/{chunk-U4IMCOF5.js → chunk-DIVFF6DK.js} +2 -2
  20. package/Build/Workers/{chunk-UAJEGIWA.js → chunk-EJZVBTX4.js} +6 -6
  21. package/Build/Workers/{chunk-UCPPWV64.js → chunk-EODIOQ35.js} +1 -1
  22. package/Build/Workers/{chunk-4PHPQRSH.js → chunk-ETC45PHH.js} +5 -6
  23. package/Build/Workers/{chunk-PS6AEMBR.js → chunk-G7IAO7CW.js} +7 -7
  24. package/Build/Workers/{chunk-LW7WGHEU.js → chunk-GOQEANLM.js} +13 -13
  25. package/Build/Workers/{chunk-I5TDPPC4.js → chunk-GUFV24F4.js} +7 -7
  26. package/Build/Workers/{chunk-4AJGCQFX.js → chunk-GX2BWBN2.js} +13 -13
  27. package/Build/Workers/{chunk-C5CE4OG6.js → chunk-GX5LMUGZ.js} +5 -5
  28. package/Build/Workers/{chunk-QKF7XXEQ.js → chunk-I6CW7ZE5.js} +7 -7
  29. package/Build/Workers/{chunk-BDUJXBVF.js → chunk-IF2OX6R4.js} +3 -5
  30. package/Build/Workers/{chunk-ZDP32RQI.js → chunk-IXYFH7DV.js} +95 -155
  31. package/Build/Workers/{chunk-2CSEEWHN.js → chunk-K5F23SZO.js} +6 -6
  32. package/Build/Workers/{chunk-7VZNXIKG.js → chunk-KTZK2UDR.js} +7 -7
  33. package/Build/Workers/{chunk-66E3H2KU.js → chunk-LZFFO4KB.js} +12 -12
  34. package/Build/Workers/{chunk-JI2445T5.js → chunk-OYP23VAL.js} +11 -11
  35. package/Build/Workers/{chunk-ZWPIM77Q.js → chunk-PHT53MCH.js} +11 -11
  36. package/Build/Workers/{chunk-6HCAQOVK.js → chunk-PUQR43HZ.js} +6 -6
  37. package/Build/Workers/{chunk-GIFJ77E4.js → chunk-QZIWFSRM.js} +4 -4
  38. package/Build/Workers/{chunk-LVJCR7DH.js → chunk-RDR4KVPA.js} +17 -17
  39. package/Build/Workers/{chunk-4KIUON73.js → chunk-RRUO4QEK.js} +4 -4
  40. package/Build/Workers/{chunk-ZC4AGBZK.js → chunk-RTIT7UDN.js} +2 -2
  41. package/Build/Workers/{chunk-AOFMPKUB.js → chunk-SC3TBKST.js} +4 -4
  42. package/Build/Workers/{chunk-S4XDCPKD.js → chunk-TDIGL45B.js} +1 -1
  43. package/Build/Workers/{chunk-RL73GOEF.js → chunk-TP4FFUAH.js} +2 -2
  44. package/Build/Workers/{chunk-WFICTTOE.js → chunk-U2LSTOMA.js} +2 -2
  45. package/Build/Workers/{chunk-RR7EOKGZ.js → chunk-U6MTSO6A.js} +47 -84
  46. package/Build/Workers/{chunk-PEABJLCK.js → chunk-UICVDDCQ.js} +1 -1
  47. package/Build/Workers/{chunk-WEGCQ5DY.js → chunk-UKJCFXVV.js} +6 -6
  48. package/Build/Workers/{chunk-V7JB576Q.js → chunk-UYKG3UFK.js} +5 -5
  49. package/Build/Workers/{chunk-3S2MFY4B.js → chunk-W4OS542B.js} +13 -13
  50. package/Build/Workers/{chunk-CYAJYEKW.js → chunk-WHDEZSAL.js} +6 -6
  51. package/Build/Workers/{chunk-TMMOULW3.js → chunk-WOYQB5HM.js} +5 -5
  52. package/Build/Workers/{chunk-PWF3YJJ5.js → chunk-WP3LCUOE.js} +13 -13
  53. package/Build/Workers/{chunk-AOIKO5Y7.js → chunk-YGNQJ4YI.js} +5 -5
  54. package/Build/Workers/{chunk-A6NCZSL3.js → chunk-YGTWKLFY.js} +17 -17
  55. package/Build/Workers/{chunk-KPY4F4BW.js → chunk-ZHJDE6JN.js} +6 -6
  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 +24 -24
  60. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  63. package/Build/Workers/createCorridorGeometry.js +27 -27
  64. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  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 +20 -20
  75. package/Build/Workers/createPlaneGeometry.js +14 -14
  76. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  77. package/Build/Workers/createPolygonGeometry.js +30 -30
  78. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  79. package/Build/Workers/createPolylineGeometry.js +23 -23
  80. package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  82. package/Build/Workers/createRectangleGeometry.js +25 -25
  83. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  84. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  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 +20 -20
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  96. package/Build/Workers/createWallGeometry.js +22 -22
  97. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  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/Ion.js +1 -1
  105. package/Source/Core/Math.js +0 -5
  106. package/Source/Core/TaskProcessor.js +19 -3
  107. package/Source/Core/sampleTerrain.js +3 -3
  108. package/Source/Scene/ArcGisMapService.js +1 -1
  109. package/Source/Scene/Billboard.js +2 -2
  110. package/Source/Scene/GltfLoader.js +458 -435
  111. package/Source/Scene/GltfLoaderUtil.js +3 -12
  112. package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
  113. package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
  114. package/Source/Scene/Label.js +1 -1
  115. package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
  116. package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
  117. package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
  118. package/Source/Scene/Model/LightingPipelineStage.js +2 -4
  119. package/Source/Scene/Model/MaterialPipelineStage.js +346 -29
  120. package/Source/Scene/Model/Model.js +8 -3
  121. package/Source/Scene/Model/ModelUtility.js +3 -0
  122. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
  123. package/Source/Scene/ModelComponents.js +169 -1
  124. package/Source/Scene/PickDepth.js +23 -15
  125. package/Source/Scene/ResourceCache.js +41 -50
  126. package/Source/Scene/ResourceCacheKey.js +41 -53
  127. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -8
  128. package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
  129. package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
  130. package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
  131. package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
  132. package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +14 -0
  133. package/Source/Shaders/Builtin/Structs/modelMaterial.js +14 -0
  134. package/Source/Shaders/GlobeFS.glsl +1 -1
  135. package/Source/Shaders/GlobeFS.js +1 -1
  136. package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
  137. package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
  138. package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
  139. package/Source/Shaders/Model/LightingStageFS.js +113 -48
  140. package/Source/Shaders/Model/MaterialStageFS.glsl +399 -137
  141. package/Source/Shaders/Model/MaterialStageFS.js +399 -137
  142. package/index.d.ts +3 -3
  143. package/index.js +203 -206
  144. package/package.json +1 -1
  145. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
  146. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
  147. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
  148. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
  149. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
  150. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
  151. package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
  152. package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
@@ -1337,10 +1337,151 @@ SpecularGlossiness.DEFAULT_SPECULAR_FACTOR = Cartesian3.ONE;
1337
1337
  */
1338
1338
  SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR = 1.0;
1339
1339
 
1340
+ function Specular() {
1341
+ /**
1342
+ * The specular factor.
1343
+ *
1344
+ * @type {number}
1345
+ * @default 1.0
1346
+ * @private
1347
+ */
1348
+ this.specularFactor = Specular.DEFAULT_SPECULAR_FACTOR;
1349
+
1350
+ /**
1351
+ * The specular texture reader.
1352
+ *
1353
+ * @type {ModelComponents.TextureReader}
1354
+ * @private
1355
+ */
1356
+ this.specularTexture = undefined;
1357
+
1358
+ /**
1359
+ * The specular color factor.
1360
+ *
1361
+ * @type {Cartesian3}
1362
+ * @default new Cartesian3(1.0, 1.0, 1.0)
1363
+ * @private
1364
+ */
1365
+ this.specularColorFactor = Cartesian3.clone(
1366
+ Specular.DEFAULT_SPECULAR_COLOR_FACTOR
1367
+ );
1368
+
1369
+ /**
1370
+ * The specular color texture reader.
1371
+ *
1372
+ * @type {ModelComponents.TextureReader}
1373
+ * @private
1374
+ */
1375
+ this.specularColorTexture = undefined;
1376
+ }
1377
+
1378
+ /**
1379
+ * @private
1380
+ */
1381
+ Specular.DEFAULT_SPECULAR_FACTOR = 1.0;
1382
+
1383
+ /**
1384
+ * @private
1385
+ */
1386
+ Specular.DEFAULT_SPECULAR_COLOR_FACTOR = Cartesian3.ONE;
1387
+
1388
+ function Anisotropy() {
1389
+ /**
1390
+ * The anisotropy strength.
1391
+ *
1392
+ * @type {number}
1393
+ * @default 0.0
1394
+ * @private
1395
+ */
1396
+ this.anisotropyStrength = Anisotropy.DEFAULT_ANISOTROPY_STRENGTH;
1397
+
1398
+ /**
1399
+ * The rotation of the anisotropy in tangent, bitangent space,
1400
+ * measured in radians counter-clockwise from the tangent.
1401
+ *
1402
+ * @type {number}
1403
+ * @default 0.0
1404
+ * @private
1405
+ */
1406
+ this.anisotropyRotation = Anisotropy.DEFAULT_ANISOTROPY_ROTATION;
1407
+
1408
+ /**
1409
+ * The anisotropy texture reader.
1410
+ *
1411
+ * @type {ModelComponents.TextureReader}
1412
+ * @private
1413
+ */
1414
+ this.anisotropyTexture = undefined;
1415
+ }
1416
+
1417
+ /**
1418
+ * @private
1419
+ */
1420
+ Anisotropy.DEFAULT_ANISOTROPY_STRENGTH = 0.0;
1421
+
1422
+ /**
1423
+ * @private
1424
+ */
1425
+ Anisotropy.DEFAULT_ANISOTROPY_ROTATION = 0.0;
1426
+
1427
+ function Clearcoat() {
1428
+ /**
1429
+ * The clearcoat layer intensity.
1430
+ *
1431
+ * @type {number}
1432
+ * @default 0.0
1433
+ * @private
1434
+ */
1435
+ this.clearcoatFactor = Clearcoat.DEFAULT_CLEARCOAT_FACTOR;
1436
+
1437
+ /**
1438
+ * The clearcoat layer intensity texture reader.
1439
+ *
1440
+ * @type {ModelComponents.TextureReader}
1441
+ * @private
1442
+ */
1443
+ this.clearcoatTexture = undefined;
1444
+
1445
+ /**
1446
+ * The clearcoat layer roughness.
1447
+ *
1448
+ * @type {number}
1449
+ * @default 0.0
1450
+ * @private
1451
+ */
1452
+ this.clearcoatRoughnessFactor = Clearcoat.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR;
1453
+
1454
+ /**
1455
+ * The clearcoat layer roughness texture.
1456
+ *
1457
+ * @type {ModelComponents.TextureReader}
1458
+ * @private
1459
+ */
1460
+ this.clearcoatRoughnessTexture = undefined;
1461
+
1462
+ /**
1463
+ * The clearcoat normal map texture.
1464
+ *
1465
+ * @type {ModelComponents.TextureReader}
1466
+ * @private
1467
+ */
1468
+ this.clearcoatNormalTexture = undefined;
1469
+ }
1470
+
1471
+ /**
1472
+ * @private
1473
+ */
1474
+ Clearcoat.DEFAULT_CLEARCOAT_FACTOR = 0.0;
1475
+
1476
+ /**
1477
+ * @private
1478
+ */
1479
+ Clearcoat.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR = 0.0;
1480
+
1340
1481
  /**
1341
1482
  * The material appearance of a primitive.
1342
1483
  *
1343
- * @alias ModelComponent.Material
1484
+ * @alias ModelComponents.Material
1344
1485
  * @constructor
1345
1486
  *
1346
1487
  * @private
@@ -1362,6 +1503,30 @@ function Material() {
1362
1503
  */
1363
1504
  this.specularGlossiness = undefined;
1364
1505
 
1506
+ /**
1507
+ * Material properties for the PBR specular shading model.
1508
+ *
1509
+ * @type {ModelComponents.Specular}
1510
+ * @private
1511
+ */
1512
+ this.specular = undefined;
1513
+
1514
+ /**
1515
+ * Material properties for the PBR anisotropy shading model.
1516
+ *
1517
+ * @type {ModelComponents.Anisotropy}
1518
+ * @private
1519
+ */
1520
+ this.anisotropy = undefined;
1521
+
1522
+ /**
1523
+ * Material properties for the PBR clearcoat shading model.
1524
+ *
1525
+ * @type {ModelComponents.Clearcoat}
1526
+ * @private
1527
+ */
1528
+ this.clearcoat = undefined;
1529
+
1365
1530
  /**
1366
1531
  * The emissive texture reader.
1367
1532
  *
@@ -1461,6 +1626,9 @@ ModelComponents.Components = Components;
1461
1626
  ModelComponents.TextureReader = TextureReader;
1462
1627
  ModelComponents.MetallicRoughness = MetallicRoughness;
1463
1628
  ModelComponents.SpecularGlossiness = SpecularGlossiness;
1629
+ ModelComponents.Specular = Specular;
1630
+ ModelComponents.Anisotropy = Anisotropy;
1631
+ ModelComponents.Clearcoat = Clearcoat;
1464
1632
  ModelComponents.Material = Material;
1465
1633
 
1466
1634
  export default ModelComponents;
@@ -30,22 +30,30 @@ function updateFramebuffers(pickDepth, context, depthTexture) {
30
30
 
31
31
  function updateCopyCommands(pickDepth, context, depthTexture) {
32
32
  if (!defined(pickDepth._copyDepthCommand)) {
33
- const fs =
34
- "uniform highp sampler2D u_texture;\n" +
35
- "in vec2 v_textureCoordinates;\n" +
36
- "void main()\n" +
37
- "{\n" +
38
- " out_FragColor = czm_packDepth(texture(u_texture, v_textureCoordinates).r);\n" +
39
- "}\n";
40
- pickDepth._copyDepthCommand = context.createViewportQuadCommand(fs, {
41
- renderState: RenderState.fromCache(),
42
- uniformMap: {
43
- u_texture: function () {
44
- return pickDepth._textureToCopy;
33
+ pickDepth._copyDepthCommand = context.createViewportQuadCommand(
34
+ `uniform highp sampler2D colorTexture;
35
+
36
+ in vec2 v_textureCoordinates;
37
+
38
+ void main()
39
+ {
40
+ vec4 globeDepthPacked = texture(czm_globeDepthTexture, v_textureCoordinates);
41
+ float globeDepth = czm_unpackDepth(globeDepthPacked);
42
+ float depth = texture(colorTexture, v_textureCoordinates).r;
43
+ out_FragColor = czm_branchFreeTernary(globeDepth <= 0.0 || globeDepth >= 1.0 || depth < globeDepth && depth > 0.0 && depth < 1.0,
44
+ czm_packDepth(depth), globeDepthPacked);
45
+ }
46
+ `,
47
+ {
48
+ renderState: RenderState.fromCache(),
49
+ uniformMap: {
50
+ colorTexture: function () {
51
+ return pickDepth._textureToCopy;
52
+ },
45
53
  },
46
- },
47
- owner: pickDepth,
48
- });
54
+ owner: pickDepth,
55
+ }
56
+ );
49
57
  }
50
58
 
51
59
  pickDepth._textureToCopy = depthTexture;
@@ -146,8 +146,7 @@ ResourceCache.unload = function (resourceLoader) {
146
146
  */
147
147
  ResourceCache.getSchemaLoader = function (options) {
148
148
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
149
- const schema = options.schema;
150
- const resource = options.resource;
149
+ const { schema, resource } = options;
151
150
 
152
151
  //>>includeStart('debug', pragmas.debug);
153
152
  if (defined(schema) === defined(resource)) {
@@ -189,9 +188,7 @@ ResourceCache.getSchemaLoader = function (options) {
189
188
  */
190
189
  ResourceCache.getEmbeddedBufferLoader = function (options) {
191
190
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
192
- const parentResource = options.parentResource;
193
- const bufferId = options.bufferId;
194
- const typedArray = options.typedArray;
191
+ const { parentResource, bufferId, typedArray } = options;
195
192
 
196
193
  //>>includeStart('debug', pragmas.debug);
197
194
  Check.typeOf.object("options.parentResource", parentResource);
@@ -231,7 +228,7 @@ ResourceCache.getEmbeddedBufferLoader = function (options) {
231
228
  */
232
229
  ResourceCache.getExternalBufferLoader = function (options) {
233
230
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
234
- const resource = options.resource;
231
+ const { resource } = options;
235
232
 
236
233
  //>>includeStart('debug', pragmas.debug);
237
234
  Check.typeOf.object("options.resource", resource);
@@ -268,10 +265,7 @@ ResourceCache.getExternalBufferLoader = function (options) {
268
265
  */
269
266
  ResourceCache.getGltfJsonLoader = function (options) {
270
267
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
271
- const gltfResource = options.gltfResource;
272
- const baseResource = options.baseResource;
273
- const typedArray = options.typedArray;
274
- const gltfJson = options.gltfJson;
268
+ const { gltfResource, baseResource, typedArray, gltfJson } = options;
275
269
 
276
270
  //>>includeStart('debug', pragmas.debug);
277
271
  Check.typeOf.object("options.gltfResource", gltfResource);
@@ -313,10 +307,7 @@ ResourceCache.getGltfJsonLoader = function (options) {
313
307
  */
314
308
  ResourceCache.getBufferViewLoader = function (options) {
315
309
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
316
- const gltf = options.gltf;
317
- const bufferViewId = options.bufferViewId;
318
- const gltfResource = options.gltfResource;
319
- const baseResource = options.baseResource;
310
+ const { gltf, bufferViewId, gltfResource, baseResource } = options;
320
311
 
321
312
  //>>includeStart('debug', pragmas.debug);
322
313
  Check.typeOf.object("options.gltf", gltf);
@@ -363,10 +354,7 @@ ResourceCache.getBufferViewLoader = function (options) {
363
354
  */
364
355
  ResourceCache.getDracoLoader = function (options) {
365
356
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
366
- const gltf = options.gltf;
367
- const draco = options.draco;
368
- const gltfResource = options.gltfResource;
369
- const baseResource = options.baseResource;
357
+ const { gltf, draco, gltfResource, baseResource } = options;
370
358
 
371
359
  //>>includeStart('debug', pragmas.debug);
372
360
  Check.typeOf.object("options.gltf", gltf);
@@ -424,18 +412,20 @@ ResourceCache.getDracoLoader = function (options) {
424
412
  */
425
413
  ResourceCache.getVertexBufferLoader = function (options) {
426
414
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
427
- const gltf = options.gltf;
428
- const gltfResource = options.gltfResource;
429
- const baseResource = options.baseResource;
430
- const frameState = options.frameState;
431
- const bufferViewId = options.bufferViewId;
432
- const draco = options.draco;
433
- const attributeSemantic = options.attributeSemantic;
434
- const accessorId = options.accessorId;
435
- const asynchronous = defaultValue(options.asynchronous, true);
436
- const dequantize = defaultValue(options.dequantize, false);
437
- const loadBuffer = defaultValue(options.loadBuffer, false);
438
- const loadTypedArray = defaultValue(options.loadTypedArray, false);
415
+ const {
416
+ gltf,
417
+ gltfResource,
418
+ baseResource,
419
+ frameState,
420
+ bufferViewId,
421
+ draco,
422
+ attributeSemantic,
423
+ accessorId,
424
+ asynchronous = true,
425
+ dequantize = false,
426
+ loadBuffer = false,
427
+ loadTypedArray = false,
428
+ } = options;
439
429
 
440
430
  //>>includeStart('debug', pragmas.debug);
441
431
  Check.typeOf.object("options.gltf", gltf);
@@ -541,15 +531,17 @@ function hasDracoCompression(draco, semantic) {
541
531
  */
542
532
  ResourceCache.getIndexBufferLoader = function (options) {
543
533
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
544
- const gltf = options.gltf;
545
- const accessorId = options.accessorId;
546
- const gltfResource = options.gltfResource;
547
- const baseResource = options.baseResource;
548
- const frameState = options.frameState;
549
- const draco = options.draco;
550
- const asynchronous = defaultValue(options.asynchronous, true);
551
- const loadBuffer = defaultValue(options.loadBuffer, false);
552
- const loadTypedArray = defaultValue(options.loadTypedArray, false);
534
+ const {
535
+ gltf,
536
+ accessorId,
537
+ gltfResource,
538
+ baseResource,
539
+ frameState,
540
+ draco,
541
+ asynchronous = true,
542
+ loadBuffer = false,
543
+ loadTypedArray = false,
544
+ } = options;
553
545
 
554
546
  //>>includeStart('debug', pragmas.debug);
555
547
  Check.typeOf.object("options.gltf", gltf);
@@ -610,10 +602,7 @@ ResourceCache.getIndexBufferLoader = function (options) {
610
602
  */
611
603
  ResourceCache.getImageLoader = function (options) {
612
604
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
613
- const gltf = options.gltf;
614
- const imageId = options.imageId;
615
- const gltfResource = options.gltfResource;
616
- const baseResource = options.baseResource;
605
+ const { gltf, imageId, gltfResource, baseResource } = options;
617
606
 
618
607
  //>>includeStart('debug', pragmas.debug);
619
608
  Check.typeOf.object("options.gltf", gltf);
@@ -663,13 +652,15 @@ ResourceCache.getImageLoader = function (options) {
663
652
  */
664
653
  ResourceCache.getTextureLoader = function (options) {
665
654
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
666
- const gltf = options.gltf;
667
- const textureInfo = options.textureInfo;
668
- const gltfResource = options.gltfResource;
669
- const baseResource = options.baseResource;
670
- const supportedImageFormats = options.supportedImageFormats;
671
- const frameState = options.frameState;
672
- const asynchronous = defaultValue(options.asynchronous, true);
655
+ const {
656
+ gltf,
657
+ textureInfo,
658
+ gltfResource,
659
+ baseResource,
660
+ supportedImageFormats,
661
+ frameState,
662
+ asynchronous = true,
663
+ } = options;
673
664
 
674
665
  //>>includeStart('debug', pragmas.debug);
675
666
  Check.typeOf.object("options.gltf", gltf);
@@ -20,8 +20,7 @@ function getExternalResourceCacheKey(resource) {
20
20
  }
21
21
 
22
22
  function getBufferViewCacheKey(bufferView) {
23
- let byteOffset = bufferView.byteOffset;
24
- let byteLength = bufferView.byteLength;
23
+ let { byteOffset, byteLength } = bufferView;
25
24
 
26
25
  if (hasExtension(bufferView, "EXT_meshopt_compression")) {
27
26
  const meshopt = bufferView.extensions.EXT_meshopt_compression;
@@ -34,16 +33,10 @@ function getBufferViewCacheKey(bufferView) {
34
33
 
35
34
  function getAccessorCacheKey(accessor, bufferView) {
36
35
  const byteOffset = bufferView.byteOffset + accessor.byteOffset;
37
- const componentType = accessor.componentType;
38
- const type = accessor.type;
39
- const count = accessor.count;
36
+ const { componentType, type, count } = accessor;
40
37
  return `${byteOffset}-${componentType}-${type}-${count}`;
41
38
  }
42
39
 
43
- function getExternalBufferCacheKey(resource) {
44
- return getExternalResourceCacheKey(resource);
45
- }
46
-
47
40
  function getEmbeddedBufferCacheKey(parentResource, bufferId) {
48
41
  const parentCacheKey = getExternalResourceCacheKey(parentResource);
49
42
  return `${parentCacheKey}-buffer-id-${bufferId}`;
@@ -54,7 +47,7 @@ function getBufferCacheKey(buffer, bufferId, gltfResource, baseResource) {
54
47
  const resource = baseResource.getDerivedResource({
55
48
  url: buffer.uri,
56
49
  });
57
- return getExternalBufferCacheKey(resource);
50
+ return getExternalResourceCacheKey(resource);
58
51
  }
59
52
 
60
53
  return getEmbeddedBufferCacheKey(gltfResource, bufferId);
@@ -128,8 +121,7 @@ function getSamplerCacheKey(gltf, textureInfo) {
128
121
  * @private
129
122
  */
130
123
  ResourceCacheKey.getSchemaCacheKey = function (options) {
131
- const schema = options.schema;
132
- const resource = options.resource;
124
+ const { schema, resource } = options;
133
125
 
134
126
  //>>includeStart('debug', pragmas.debug);
135
127
  if (defined(schema) === defined(resource)) {
@@ -157,13 +149,13 @@ ResourceCacheKey.getSchemaCacheKey = function (options) {
157
149
  */
158
150
  ResourceCacheKey.getExternalBufferCacheKey = function (options) {
159
151
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
160
- const resource = options.resource;
152
+ const { resource } = options;
161
153
 
162
154
  //>>includeStart('debug', pragmas.debug);
163
155
  Check.typeOf.object("options.resource", resource);
164
156
  //>>includeEnd('debug');
165
157
 
166
- return `external-buffer:${getExternalBufferCacheKey(resource)}`;
158
+ return `external-buffer:${getExternalResourceCacheKey(resource)}`;
167
159
  };
168
160
 
169
161
  /**
@@ -178,8 +170,7 @@ ResourceCacheKey.getExternalBufferCacheKey = function (options) {
178
170
  */
179
171
  ResourceCacheKey.getEmbeddedBufferCacheKey = function (options) {
180
172
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
181
- const parentResource = options.parentResource;
182
- const bufferId = options.bufferId;
173
+ const { parentResource, bufferId } = options;
183
174
 
184
175
  //>>includeStart('debug', pragmas.debug);
185
176
  Check.typeOf.object("options.parentResource", parentResource);
@@ -203,7 +194,7 @@ ResourceCacheKey.getEmbeddedBufferCacheKey = function (options) {
203
194
  */
204
195
  ResourceCacheKey.getGltfCacheKey = function (options) {
205
196
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
206
- const gltfResource = options.gltfResource;
197
+ const { gltfResource } = options;
207
198
 
208
199
  //>>includeStart('debug', pragmas.debug);
209
200
  Check.typeOf.object("options.gltfResource", gltfResource);
@@ -226,10 +217,7 @@ ResourceCacheKey.getGltfCacheKey = function (options) {
226
217
  */
227
218
  ResourceCacheKey.getBufferViewCacheKey = function (options) {
228
219
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
229
- const gltf = options.gltf;
230
- const bufferViewId = options.bufferViewId;
231
- const gltfResource = options.gltfResource;
232
- const baseResource = options.baseResource;
220
+ const { gltf, bufferViewId, gltfResource, baseResource } = options;
233
221
 
234
222
  //>>includeStart('debug', pragmas.debug);
235
223
  Check.typeOf.object("options.gltf", gltf);
@@ -272,10 +260,7 @@ ResourceCacheKey.getBufferViewCacheKey = function (options) {
272
260
  */
273
261
  ResourceCacheKey.getDracoCacheKey = function (options) {
274
262
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
275
- const gltf = options.gltf;
276
- const draco = options.draco;
277
- const gltfResource = options.gltfResource;
278
- const baseResource = options.baseResource;
263
+ const { gltf, draco, gltfResource, baseResource } = options;
279
264
 
280
265
  //>>includeStart('debug', pragmas.debug);
281
266
  Check.typeOf.object("options.gltf", gltf);
@@ -309,16 +294,18 @@ ResourceCacheKey.getDracoCacheKey = function (options) {
309
294
  */
310
295
  ResourceCacheKey.getVertexBufferCacheKey = function (options) {
311
296
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
312
- const gltf = options.gltf;
313
- const gltfResource = options.gltfResource;
314
- const baseResource = options.baseResource;
315
- const frameState = options.frameState;
316
- const bufferViewId = options.bufferViewId;
317
- const draco = options.draco;
318
- const attributeSemantic = options.attributeSemantic;
319
- const dequantize = defaultValue(options.dequantize, false);
320
- const loadBuffer = defaultValue(options.loadBuffer, false);
321
- const loadTypedArray = defaultValue(options.loadTypedArray, false);
297
+ const {
298
+ gltf,
299
+ gltfResource,
300
+ baseResource,
301
+ frameState,
302
+ bufferViewId,
303
+ draco,
304
+ attributeSemantic,
305
+ dequantize = false,
306
+ loadBuffer = false,
307
+ loadTypedArray = false,
308
+ } = options;
322
309
 
323
310
  //>>includeStart('debug', pragmas.debug);
324
311
  Check.typeOf.object("options.gltf", gltf);
@@ -420,14 +407,16 @@ function hasDracoCompression(draco, semantic) {
420
407
  */
421
408
  ResourceCacheKey.getIndexBufferCacheKey = function (options) {
422
409
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
423
- const gltf = options.gltf;
424
- const accessorId = options.accessorId;
425
- const gltfResource = options.gltfResource;
426
- const baseResource = options.baseResource;
427
- const frameState = options.frameState;
428
- const draco = options.draco;
429
- const loadBuffer = defaultValue(options.loadBuffer, false);
430
- const loadTypedArray = defaultValue(options.loadTypedArray, false);
410
+ const {
411
+ gltf,
412
+ accessorId,
413
+ gltfResource,
414
+ baseResource,
415
+ frameState,
416
+ draco,
417
+ loadBuffer = false,
418
+ loadTypedArray = false,
419
+ } = options;
431
420
 
432
421
  //>>includeStart('debug', pragmas.debug);
433
422
  Check.typeOf.object("options.gltf", gltf);
@@ -495,10 +484,7 @@ ResourceCacheKey.getIndexBufferCacheKey = function (options) {
495
484
  */
496
485
  ResourceCacheKey.getImageCacheKey = function (options) {
497
486
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
498
- const gltf = options.gltf;
499
- const imageId = options.imageId;
500
- const gltfResource = options.gltfResource;
501
- const baseResource = options.baseResource;
487
+ const { gltf, imageId, gltfResource, baseResource } = options;
502
488
 
503
489
  //>>includeStart('debug', pragmas.debug);
504
490
  Check.typeOf.object("options.gltf", gltf);
@@ -533,12 +519,14 @@ ResourceCacheKey.getImageCacheKey = function (options) {
533
519
  */
534
520
  ResourceCacheKey.getTextureCacheKey = function (options) {
535
521
  options = defaultValue(options, defaultValue.EMPTY_OBJECT);
536
- const gltf = options.gltf;
537
- const textureInfo = options.textureInfo;
538
- const gltfResource = options.gltfResource;
539
- const baseResource = options.baseResource;
540
- const supportedImageFormats = options.supportedImageFormats;
541
- const frameState = options.frameState;
522
+ const {
523
+ gltf,
524
+ textureInfo,
525
+ gltfResource,
526
+ baseResource,
527
+ supportedImageFormats,
528
+ frameState,
529
+ } = options;
542
530
 
543
531
  //>>includeStart('debug', pragmas.debug);
544
532
  Check.typeOf.object("options.gltf", gltf);
@@ -42,7 +42,6 @@ import czm_material from './Structs/material.js'
42
42
  import czm_materialInput from './Structs/materialInput.js'
43
43
  import czm_modelMaterial from './Structs/modelMaterial.js'
44
44
  import czm_modelVertexOutput from './Structs/modelVertexOutput.js'
45
- import czm_pbrParameters from './Structs/pbrParameters.js'
46
45
  import czm_ray from './Structs/ray.js'
47
46
  import czm_raySegment from './Structs/raySegment.js'
48
47
  import czm_shadowParameters from './Structs/shadowParameters.js'
@@ -72,7 +71,6 @@ import czm_computePosition from './Functions/computePosition.js'
72
71
  import czm_computeScattering from './Functions/computeScattering.js'
73
72
  import czm_cosineAndSine from './Functions/cosineAndSine.js'
74
73
  import czm_decompressTextureCoordinates from './Functions/decompressTextureCoordinates.js'
75
- import czm_defaultPbrMaterial from './Functions/defaultPbrMaterial.js'
76
74
  import czm_depthClamp from './Functions/depthClamp.js'
77
75
  import czm_eastNorthUpToEyeCoordinates from './Functions/eastNorthUpToEyeCoordinates.js'
78
76
  import czm_ellipsoidContainsPoint from './Functions/ellipsoidContainsPoint.js'
@@ -97,6 +95,7 @@ import czm_latitudeToWebMercatorFraction from './Functions/latitudeToWebMercator
97
95
  import czm_lineDistance from './Functions/lineDistance.js'
98
96
  import czm_linearToSrgb from './Functions/linearToSrgb.js'
99
97
  import czm_luminance from './Functions/luminance.js'
98
+ import czm_maximumComponent from './Functions/maximumComponent.js'
100
99
  import czm_metersPerPixel from './Functions/metersPerPixel.js'
101
100
  import czm_modelToWindowCoordinates from './Functions/modelToWindowCoordinates.js'
102
101
  import czm_multiplyWithColorBalance from './Functions/multiplyWithColorBalance.js'
@@ -104,8 +103,6 @@ import czm_nearFarScalar from './Functions/nearFarScalar.js'
104
103
  import czm_octDecode from './Functions/octDecode.js'
105
104
  import czm_packDepth from './Functions/packDepth.js'
106
105
  import czm_pbrLighting from './Functions/pbrLighting.js'
107
- import czm_pbrMetallicRoughnessMaterial from './Functions/pbrMetallicRoughnessMaterial.js'
108
- import czm_pbrSpecularGlossinessMaterial from './Functions/pbrSpecularGlossinessMaterial.js'
109
106
  import czm_phong from './Functions/phong.js'
110
107
  import czm_planeDistance from './Functions/planeDistance.js'
111
108
  import czm_pointAlongRay from './Functions/pointAlongRay.js'
@@ -183,7 +180,6 @@ export default {
183
180
  czm_materialInput : czm_materialInput,
184
181
  czm_modelMaterial : czm_modelMaterial,
185
182
  czm_modelVertexOutput : czm_modelVertexOutput,
186
- czm_pbrParameters : czm_pbrParameters,
187
183
  czm_ray : czm_ray,
188
184
  czm_raySegment : czm_raySegment,
189
185
  czm_shadowParameters : czm_shadowParameters,
@@ -213,7 +209,6 @@ export default {
213
209
  czm_computeScattering : czm_computeScattering,
214
210
  czm_cosineAndSine : czm_cosineAndSine,
215
211
  czm_decompressTextureCoordinates : czm_decompressTextureCoordinates,
216
- czm_defaultPbrMaterial : czm_defaultPbrMaterial,
217
212
  czm_depthClamp : czm_depthClamp,
218
213
  czm_eastNorthUpToEyeCoordinates : czm_eastNorthUpToEyeCoordinates,
219
214
  czm_ellipsoidContainsPoint : czm_ellipsoidContainsPoint,
@@ -238,6 +233,7 @@ export default {
238
233
  czm_lineDistance : czm_lineDistance,
239
234
  czm_linearToSrgb : czm_linearToSrgb,
240
235
  czm_luminance : czm_luminance,
236
+ czm_maximumComponent : czm_maximumComponent,
241
237
  czm_metersPerPixel : czm_metersPerPixel,
242
238
  czm_modelToWindowCoordinates : czm_modelToWindowCoordinates,
243
239
  czm_multiplyWithColorBalance : czm_multiplyWithColorBalance,
@@ -245,8 +241,6 @@ export default {
245
241
  czm_octDecode : czm_octDecode,
246
242
  czm_packDepth : czm_packDepth,
247
243
  czm_pbrLighting : czm_pbrLighting,
248
- czm_pbrMetallicRoughnessMaterial : czm_pbrMetallicRoughnessMaterial,
249
- czm_pbrSpecularGlossinessMaterial : czm_pbrSpecularGlossinessMaterial,
250
244
  czm_phong : czm_phong,
251
245
  czm_planeDistance : czm_planeDistance,
252
246
  czm_pointAlongRay : czm_pointAlongRay,
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Find the maximum component of a vector.
3
+ *
4
+ * @name czm_maximumComponent
5
+ * @glslFunction
6
+ *
7
+ * @param {vec2|vec3|vec4} v The input vector.
8
+ * @returns {float} The value of the largest component.
9
+ */
10
+ float czm_maximumComponent(vec2 v)
11
+ {
12
+ return max(v.x, v.y);
13
+ }
14
+ float czm_maximumComponent(vec3 v)
15
+ {
16
+ return max(max(v.x, v.y), v.z);
17
+ }
18
+ float czm_maximumComponent(vec4 v)
19
+ {
20
+ return max(max(max(v.x, v.y), v.z), v.w);
21
+ }