@hztxi/cesium-engine 25.0.0 → 25.0.2

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 (231) hide show
  1. package/Build/Workers/chunk-24H74D3Q.js +102 -0
  2. package/Build/Workers/chunk-27UNFKLP.js +78 -0
  3. package/Build/Workers/chunk-2NIRC5FH.js +398 -0
  4. package/Build/Workers/chunk-2YHL3RU5.js +162 -0
  5. package/Build/Workers/chunk-327KDYY5.js +241 -0
  6. package/Build/Workers/chunk-36Y4HYYW.js +1067 -0
  7. package/Build/Workers/chunk-3EB75M2K.js +2342 -0
  8. package/Build/Workers/chunk-3HGZ7PIQ.js +1483 -0
  9. package/Build/Workers/chunk-3S3R4BCY.js +280 -0
  10. package/Build/Workers/chunk-3TK6563P.js +9230 -0
  11. package/Build/Workers/chunk-4A34KHP2.js +138 -0
  12. package/Build/Workers/chunk-4B3I4BQ3.js +454 -0
  13. package/Build/Workers/chunk-4GKVVYGC.js +124 -0
  14. package/Build/Workers/chunk-4NOKV4XU.js +301 -0
  15. package/Build/Workers/chunk-4VMEH443.js +754 -0
  16. package/Build/Workers/chunk-4VO5KZVX.js +693 -0
  17. package/Build/Workers/chunk-53ITLB2Q.js +288 -0
  18. package/Build/Workers/chunk-5523YTNX.js +352 -0
  19. package/Build/Workers/chunk-562MM6RC.js +682 -0
  20. package/Build/Workers/chunk-5BQXC3BP.js +837 -0
  21. package/Build/Workers/chunk-5DHF2GEC.js +497 -0
  22. package/Build/Workers/chunk-5EN3SEJC.js +44 -0
  23. package/Build/Workers/chunk-5NSH64L5.js +368 -0
  24. package/Build/Workers/chunk-5RSLOB22.js +511 -0
  25. package/Build/Workers/chunk-5SLGYIPO.js +454 -0
  26. package/Build/Workers/chunk-65RILO72.js +76 -0
  27. package/Build/Workers/chunk-6A74XDJV.js +1054 -0
  28. package/Build/Workers/chunk-6CAFY3E7.js +280 -0
  29. package/Build/Workers/chunk-6IWHUZUQ.js +959 -0
  30. package/Build/Workers/chunk-6JM3OV5P.js +163 -0
  31. package/Build/Workers/chunk-6ROOPL5F.js +455 -0
  32. package/Build/Workers/chunk-6SQMSSOR.js +352 -0
  33. package/Build/Workers/chunk-6SZK4XE5.js +1800 -0
  34. package/Build/Workers/chunk-6V5GAERI.js +288 -0
  35. package/Build/Workers/chunk-6XE6USHI.js +280 -0
  36. package/Build/Workers/chunk-6YMLC7BS.js +1067 -0
  37. package/Build/Workers/chunk-7BWPTYVV.js +1992 -0
  38. package/Build/Workers/chunk-7QXAVVZH.js +9230 -0
  39. package/Build/Workers/chunk-7SUI2JKP.js +162 -0
  40. package/Build/Workers/chunk-A4AIHOC7.js +476 -0
  41. package/Build/Workers/chunk-AFBRALW3.js +3620 -0
  42. package/Build/Workers/chunk-AGANEUZR.js +305 -0
  43. package/Build/Workers/chunk-AIA3JN4E.js +171 -0
  44. package/Build/Workers/chunk-AJ4TSZQD.js +352 -0
  45. package/Build/Workers/chunk-AMW7Q4HY.js +78 -0
  46. package/Build/Workers/chunk-ANB53XEA.js +198 -0
  47. package/Build/Workers/chunk-APAN2W5B.js +630 -0
  48. package/Build/Workers/chunk-AWP7JHXS.js +58 -0
  49. package/Build/Workers/chunk-AXAP4UXD.js +973 -0
  50. package/Build/Workers/chunk-B2MY5ZT4.js +241 -0
  51. package/Build/Workers/chunk-BUS2WCDM.js +1067 -0
  52. package/Build/Workers/chunk-BVOP4FBU.js +778 -0
  53. package/Build/Workers/chunk-CCSHJCGX.js +56 -0
  54. package/Build/Workers/chunk-CUJKQD6C.js +1287 -0
  55. package/Build/Workers/chunk-D6XIXIZN.js +57 -0
  56. package/Build/Workers/chunk-DOJQOYSZ.js +1344 -0
  57. package/Build/Workers/chunk-DSOWTJU3.js +3201 -0
  58. package/Build/Workers/chunk-DWNGALVJ.js +147 -0
  59. package/Build/Workers/chunk-E4SAHWMA.js +1992 -0
  60. package/Build/Workers/chunk-EJES53XD.js +147 -0
  61. package/Build/Workers/chunk-FEMEGP72.js +97 -0
  62. package/Build/Workers/chunk-FPUTHLEQ.js +73 -0
  63. package/Build/Workers/chunk-FSGWPS5K.js +102 -0
  64. package/Build/Workers/chunk-FVGN2Y5F.js +414 -0
  65. package/Build/Workers/chunk-FYOTKGMD.js +38 -0
  66. package/Build/Workers/chunk-FYOU33DL.js +454 -0
  67. package/Build/Workers/chunk-FZQTWCZX.js +138 -0
  68. package/Build/Workers/chunk-G7QZ6W7K.js +56 -0
  69. package/Build/Workers/chunk-GBYWJNH6.js +455 -0
  70. package/Build/Workers/chunk-H62GX37Y.js +414 -0
  71. package/Build/Workers/chunk-HA42BW2W.js +73 -0
  72. package/Build/Workers/chunk-HGDGYWXB.js +368 -0
  73. package/Build/Workers/chunk-HLCNW67V.js +162 -0
  74. package/Build/Workers/chunk-HM6KRMLB.js +682 -0
  75. package/Build/Workers/chunk-HOOAYVKT.js +754 -0
  76. package/Build/Workers/chunk-HPRR2MW2.js +9230 -0
  77. package/Build/Workers/chunk-HVIAU36M.js +124 -0
  78. package/Build/Workers/chunk-I6PQQIM5.js +257 -0
  79. package/Build/Workers/chunk-JHL6DEKL.js +1287 -0
  80. package/Build/Workers/chunk-K3SIFA6H.js +352 -0
  81. package/Build/Workers/chunk-KFRGYJLT.js +171 -0
  82. package/Build/Workers/chunk-KGNDVO6V.js +497 -0
  83. package/Build/Workers/chunk-KIRR4SHO.js +38 -0
  84. package/Build/Workers/chunk-KKXT553B.js +2719 -0
  85. package/Build/Workers/chunk-KM3TU6SW.js +101 -0
  86. package/Build/Workers/chunk-KTHM63AY.js +837 -0
  87. package/Build/Workers/chunk-LANT2AAI.js +398 -0
  88. package/Build/Workers/chunk-LC2DM3UY.js +352 -0
  89. package/Build/Workers/chunk-LDTDF3GI.js +511 -0
  90. package/Build/Workers/chunk-LFVZBOFT.js +140 -0
  91. package/Build/Workers/chunk-LPWXXHTU.js +2342 -0
  92. package/Build/Workers/chunk-LU6LZORF.js +3620 -0
  93. package/Build/Workers/chunk-LZI4ZK6U.js +97 -0
  94. package/Build/Workers/chunk-M3YCBXY6.js +97 -0
  95. package/Build/Workers/chunk-M6XP5U6F.js +959 -0
  96. package/Build/Workers/chunk-MG54QB2S.js +1287 -0
  97. package/Build/Workers/chunk-MNKWZJLE.js +754 -0
  98. package/Build/Workers/chunk-MR7LJQY3.js +1344 -0
  99. package/Build/Workers/chunk-MVCGWYYA.js +693 -0
  100. package/Build/Workers/chunk-N4ECLSTH.js +163 -0
  101. package/Build/Workers/chunk-N52ZLKZ3.js +73 -0
  102. package/Build/Workers/chunk-N54RGG53.js +398 -0
  103. package/Build/Workers/chunk-NG6PINOD.js +973 -0
  104. package/Build/Workers/chunk-NO4VBMKQ.js +387 -0
  105. package/Build/Workers/chunk-NOOOB6XR.js +76 -0
  106. package/Build/Workers/chunk-NRIECATP.js +124 -0
  107. package/Build/Workers/chunk-NSTJ4RH4.js +198 -0
  108. package/Build/Workers/chunk-NW27SGND.js +2719 -0
  109. package/Build/Workers/chunk-O7JC67VX.js +1483 -0
  110. package/Build/Workers/chunk-OGSPRAJN.js +414 -0
  111. package/Build/Workers/chunk-OI6UMRBT.js +368 -0
  112. package/Build/Workers/chunk-OJMOQSS5.js +387 -0
  113. package/Build/Workers/chunk-P2DEQUE6.js +301 -0
  114. package/Build/Workers/chunk-PAO4TRRA.js +497 -0
  115. package/Build/Workers/chunk-PEK6L3A2.js +102 -0
  116. package/Build/Workers/chunk-PLMDKE2G.js +57 -0
  117. package/Build/Workers/chunk-Q2MV7V3J.js +1344 -0
  118. package/Build/Workers/chunk-Q3JUKGCA.js +305 -0
  119. package/Build/Workers/chunk-Q56GS53F.js +455 -0
  120. package/Build/Workers/chunk-R3E7ZNXL.js +44 -0
  121. package/Build/Workers/chunk-RGNURFR5.js +1992 -0
  122. package/Build/Workers/chunk-RHVCL4BF.js +3620 -0
  123. package/Build/Workers/chunk-S2SZ2HYA.js +101 -0
  124. package/Build/Workers/chunk-S7NAPXAR.js +305 -0
  125. package/Build/Workers/chunk-SAFIA66W.js +140 -0
  126. package/Build/Workers/chunk-SLZBHAWM.js +837 -0
  127. package/Build/Workers/chunk-SOD6C4T2.js +682 -0
  128. package/Build/Workers/chunk-SOMBAQ6X.js +3201 -0
  129. package/Build/Workers/chunk-SOOUWXOJ.js +198 -0
  130. package/Build/Workers/chunk-SSNBEN3T.js +3201 -0
  131. package/Build/Workers/chunk-SZONDGD2.js +778 -0
  132. package/Build/Workers/chunk-TT3NOX52.js +257 -0
  133. package/Build/Workers/chunk-TT6EXCGT.js +387 -0
  134. package/Build/Workers/chunk-UA3ZQQGQ.js +352 -0
  135. package/Build/Workers/chunk-UOXL2W6I.js +1800 -0
  136. package/Build/Workers/chunk-UQABUNQP.js +301 -0
  137. package/Build/Workers/chunk-UUN6ELAF.js +476 -0
  138. package/Build/Workers/chunk-UZ7FDKAX.js +1054 -0
  139. package/Build/Workers/chunk-VAYNR45Y.js +219 -0
  140. package/Build/Workers/chunk-VDJVNJXW.js +2342 -0
  141. package/Build/Workers/chunk-VG4FKBIJ.js +140 -0
  142. package/Build/Workers/chunk-VU2OEFZS.js +511 -0
  143. package/Build/Workers/chunk-VYTIQ2Y2.js +630 -0
  144. package/Build/Workers/chunk-W5MRHFMR.js +288 -0
  145. package/Build/Workers/chunk-WA2OK3VI.js +76 -0
  146. package/Build/Workers/chunk-WHJCVALR.js +241 -0
  147. package/Build/Workers/chunk-WKB3ASRI.js +973 -0
  148. package/Build/Workers/chunk-WLDDKODU.js +44 -0
  149. package/Build/Workers/chunk-WMSNHJUP.js +476 -0
  150. package/Build/Workers/chunk-WWOR75YX.js +778 -0
  151. package/Build/Workers/chunk-X4A7LVKE.js +219 -0
  152. package/Build/Workers/chunk-XFMCNWLM.js +2719 -0
  153. package/Build/Workers/chunk-XGU44EOV.js +219 -0
  154. package/Build/Workers/chunk-XIIIDBAK.js +171 -0
  155. package/Build/Workers/chunk-XLMFFASL.js +1483 -0
  156. package/Build/Workers/chunk-XNSQLK46.js +138 -0
  157. package/Build/Workers/chunk-Y2TJP7FF.js +959 -0
  158. package/Build/Workers/chunk-Y7LAUPYL.js +1054 -0
  159. package/Build/Workers/chunk-YMIPCEQ6.js +1800 -0
  160. package/Build/Workers/chunk-YQVAKERA.js +57 -0
  161. package/Build/Workers/chunk-YWXQX4RS.js +147 -0
  162. package/Build/Workers/chunk-YZTJZDOY.js +693 -0
  163. package/Build/Workers/chunk-ZOMW6KCQ.js +56 -0
  164. package/Build/Workers/chunk-ZY636MPN.js +58 -0
  165. package/Build/Workers/chunk-ZZIFOLD3.js +56 -0
  166. package/Build/Workers/combineGeometry.js +24 -24
  167. package/Build/Workers/createBoxGeometry.js +18 -18
  168. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  169. package/Build/Workers/createCircleGeometry.js +26 -26
  170. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  171. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  172. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  173. package/Build/Workers/createCorridorGeometry.js +29 -29
  174. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  175. package/Build/Workers/createCylinderGeometry.js +20 -20
  176. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  177. package/Build/Workers/createEllipseGeometry.js +26 -26
  178. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  179. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  180. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  181. package/Build/Workers/createFrustumGeometry.js +18 -18
  182. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  183. package/Build/Workers/createGeometry.js +24 -24
  184. package/Build/Workers/createGroundPolylineGeometry.js +23 -23
  185. package/Build/Workers/createPlaneGeometry.js +16 -16
  186. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  187. package/Build/Workers/createPolygonGeometry.js +32 -32
  188. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  189. package/Build/Workers/createPolylineGeometry.js +25 -25
  190. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  191. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  192. package/Build/Workers/createRectangleGeometry.js +27 -27
  193. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  194. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  195. package/Build/Workers/createSphereGeometry.js +19 -19
  196. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  197. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  198. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  199. package/Build/Workers/createVectorTileGeometries.js +24 -24
  200. package/Build/Workers/createVectorTilePoints.js +13 -13
  201. package/Build/Workers/createVectorTilePolygons.js +22 -22
  202. package/Build/Workers/createVectorTilePolylines.js +14 -14
  203. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +26 -26
  204. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
  205. package/Build/Workers/createVerticesFromHeightmap.js +25 -25
  206. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
  207. package/Build/Workers/createWallGeometry.js +24 -24
  208. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  209. package/Build/Workers/decodeDraco.js +10 -10
  210. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +29 -29
  211. package/Build/Workers/decodeI3S.js +10 -10
  212. package/Build/Workers/gaussianSplatSorter.js +4 -4
  213. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  214. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  215. package/Build/Workers/transcodeKTX2.js +7 -7
  216. package/Build/Workers/transferTypedArrayTest.js +1 -1
  217. package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
  218. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
  219. package/Source/DataSources/DynamicGeometryUpdater.js +1 -0
  220. package/Source/DataSources/GeometryVisualizer.js +5 -0
  221. package/Source/DataSources/PolylineGeometryUpdater.js +65 -15
  222. package/Source/DataSources/PolylineVisualizer.js +3 -0
  223. package/Source/DataSources/StaticGeometryPerMaterialBatch.js +17 -0
  224. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +11 -0
  225. package/Source/Renderer/Context.js +28 -0
  226. package/Source/Scene/GroundPolylinePrimitive.js +64 -19
  227. package/Source/Scene/Material.js +51 -7
  228. package/Source/Scene/Primitive.js +21 -2
  229. package/Source/ThirdParty/zip-module.wasm +0 -0
  230. package/index.js +307 -307
  231. package/package.json +10 -10
@@ -16,6 +16,7 @@ const defaultDistanceDisplayCondition = new DistanceDisplayCondition();
16
16
 
17
17
  // Encapsulates a Primitive and all the entities that it represents.
18
18
  function Batch(
19
+ scene,
19
20
  primitives,
20
21
  classificationType,
21
22
  appearanceType,
@@ -23,6 +24,7 @@ function Batch(
23
24
  usingSphericalTextureCoordinates,
24
25
  zIndex,
25
26
  ) {
27
+ this.scene = scene;
26
28
  this.primitives = primitives; // scene level primitive collection (each Batch manages its own Primitive from this collection)
27
29
  this.classificationType = classificationType;
28
30
  this.appearanceType = appearanceType;
@@ -157,6 +159,9 @@ Batch.prototype.update = function (time) {
157
159
  this.materialProperty,
158
160
  this.material,
159
161
  );
162
+ if (defined(this.scene)) {
163
+ this.material.update(this.scene.context);
164
+ }
160
165
 
161
166
  const AppearanceType = this.appearanceType;
162
167
 
@@ -200,6 +205,9 @@ Batch.prototype.update = function (time) {
200
205
  this.materialProperty,
201
206
  this.material,
202
207
  );
208
+ if (defined(this.scene)) {
209
+ this.material.update(this.scene.context);
210
+ }
203
211
  this.primitive.appearance.material = this.material;
204
212
 
205
213
  const updatersWithAttributes = this.updatersWithAttributes.values;
@@ -331,10 +339,12 @@ Batch.prototype.destroy = function () {
331
339
  * @private
332
340
  */
333
341
  function StaticGroundGeometryPerMaterialBatch(
342
+ scene,
334
343
  primitives,
335
344
  classificationType,
336
345
  appearanceType,
337
346
  ) {
347
+ this._scene = scene;
338
348
  this._items = []; // array of Batch objects, each containing representing a primitive and a set of updaters that manage the visual representation of the primitive.
339
349
  this._primitives = primitives; // scene level primitive collection
340
350
  this._classificationType = classificationType;
@@ -377,6 +387,7 @@ StaticGroundGeometryPerMaterialBatch.prototype.add = function (time, updater) {
377
387
  }
378
388
  // If a compatible batch wasn't found, create a new batch.
379
389
  const batch = new Batch(
390
+ this._scene,
380
391
  this._primitives,
381
392
  this._classificationType,
382
393
  this._appearanceType,
@@ -342,6 +342,7 @@ function Context(canvas, options) {
342
342
  // default emissive texture has a value of (0, 0, 0)
343
343
  // default normal texture is +z which is encoded as (0.5, 0.5, 1)
344
344
  this._defaultTexture = undefined;
345
+ this._defaultTransparentTexture = undefined;
345
346
  this._defaultEmissiveTexture = undefined;
346
347
  this._defaultNormalTexture = undefined;
347
348
  this._defaultCubeMap = undefined;
@@ -1032,6 +1033,30 @@ Object.defineProperties(Context.prototype, {
1032
1033
  return this._defaultTexture;
1033
1034
  },
1034
1035
  },
1036
+ /**
1037
+ * A 1x1 RGBA texture initialized to [0, 0, 0, 0]. Used as a placeholder for
1038
+ * image uniforms while asynchronous textures are downloaded so geometry does not
1039
+ * briefly appear filled with white.
1040
+ * @memberof Context.prototype
1041
+ * @type {Texture}
1042
+ */
1043
+ defaultTransparentTexture: {
1044
+ get: function () {
1045
+ if (this._defaultTransparentTexture === undefined) {
1046
+ this._defaultTransparentTexture = new Texture({
1047
+ context: this,
1048
+ source: {
1049
+ width: 1,
1050
+ height: 1,
1051
+ arrayBufferView: new Uint8Array([0, 0, 0, 0]),
1052
+ },
1053
+ flipY: false,
1054
+ });
1055
+ }
1056
+
1057
+ return this._defaultTransparentTexture;
1058
+ },
1059
+ },
1035
1060
  /**
1036
1061
  * A 1x1 RGB texture initialized to [0, 0, 0] representing a material that is
1037
1062
  * not emissive. This can be used as a placeholder texture for emissive
@@ -1714,6 +1739,9 @@ Context.prototype.destroy = function () {
1714
1739
  this._shaderCache = this._shaderCache.destroy();
1715
1740
  this._textureCache = this._textureCache.destroy();
1716
1741
  this._defaultTexture = this._defaultTexture && this._defaultTexture.destroy();
1742
+ this._defaultTransparentTexture =
1743
+ this._defaultTransparentTexture &&
1744
+ this._defaultTransparentTexture.destroy();
1717
1745
  this._defaultEmissiveTexture =
1718
1746
  this._defaultEmissiveTexture && this._defaultEmissiveTexture.destroy();
1719
1747
  this._defaultNormalTexture =
@@ -182,6 +182,9 @@ function GroundPolylinePrimitive(options) {
182
182
 
183
183
  this._retainedGeometryInstances = undefined;
184
184
 
185
+ /** @private Root {@link GroundPolylineGeometry} ref from the last inner {@link Primitive} build. */
186
+ this._lastGroundPolylineRootGeometry = undefined;
187
+
185
188
  this._ready = false;
186
189
  this._primitive = undefined;
187
190
 
@@ -316,19 +319,30 @@ GroundPolylinePrimitive.initializeTerrainHeights = function () {
316
319
  return ApproximateTerrainHeights.initialize();
317
320
  };
318
321
 
322
+ function normalizeGeometryInstances(instances) {
323
+ if (!defined(instances)) {
324
+ return instances;
325
+ }
326
+ return Array.isArray(instances) ? instances : [instances];
327
+ }
328
+
319
329
  function verticalExaggerationMatchesFrameState(geometryInstances, frameState) {
320
- if (!defined(geometryInstances)) {
330
+ const instances = normalizeGeometryInstances(geometryInstances);
331
+ if (!defined(instances)) {
321
332
  return true;
322
333
  }
323
334
  const ex = frameState.verticalExaggeration;
324
335
  const exRel = frameState.verticalExaggerationRelativeHeight;
325
- const length = geometryInstances.length;
336
+ const length = instances.length;
326
337
  for (let i = 0; i < length; ++i) {
327
- const geom = geometryInstances[i].geometry;
328
- if (
329
- geom._verticalExaggeration !== ex ||
330
- geom._verticalExaggerationRelativeHeight !== exRel
331
- ) {
338
+ const instance = instances[i];
339
+ if (!defined(instance) || !defined(instance.geometry)) {
340
+ return false;
341
+ }
342
+ const geom = instance.geometry;
343
+ const geomEx = geom._verticalExaggeration ?? 1.0;
344
+ const geomExRel = geom._verticalExaggerationRelativeHeight ?? 0.0;
345
+ if (geomEx !== ex || geomExRel !== exRel) {
332
346
  return false;
333
347
  }
334
348
  }
@@ -689,6 +703,20 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
689
703
  return;
690
704
  }
691
705
 
706
+ let i;
707
+
708
+ const that = this;
709
+ const primitiveOptions = this._primitiveOptions;
710
+
711
+ if (
712
+ defined(this.geometryInstances) &&
713
+ !defined(this._retainedGeometryInstances)
714
+ ) {
715
+ this._retainedGeometryInstances = Array.isArray(this.geometryInstances)
716
+ ? this.geometryInstances.slice()
717
+ : [this.geometryInstances];
718
+ }
719
+
692
720
  if (!ApproximateTerrainHeights.initialized) {
693
721
  //>>includeStart('debug', pragmas.debug);
694
722
  if (!this.asynchronous) {
@@ -702,23 +730,37 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
702
730
  return;
703
731
  }
704
732
 
705
- let i;
733
+ const sourceGeometryInstances = normalizeGeometryInstances(
734
+ this.geometryInstances ?? this._retainedGeometryInstances,
735
+ );
706
736
 
707
- const that = this;
708
- const primitiveOptions = this._primitiveOptions;
737
+ let rootGeometryFromSource;
738
+ if (defined(sourceGeometryInstances)) {
739
+ const src0 = sourceGeometryInstances[0];
740
+ if (defined(src0) && defined(src0.geometry)) {
741
+ rootGeometryFromSource = src0.geometry;
742
+ }
743
+ }
709
744
 
745
+ // New GeometryInstances (e.g. dynamic Entity polylines) assign a fresh GroundPolylineGeometry
746
+ // each frame. Destroy the inner Primitive when the source geometry object changes; otherwise
747
+ // we would keep rendering the previous combineGeometry result.
710
748
  if (
711
- defined(this.geometryInstances) &&
712
- !defined(this._retainedGeometryInstances)
749
+ defined(this._primitive) &&
750
+ defined(rootGeometryFromSource) &&
751
+ rootGeometryFromSource !== this._lastGroundPolylineRootGeometry
713
752
  ) {
714
- this._retainedGeometryInstances = Array.isArray(this.geometryInstances)
715
- ? this.geometryInstances.slice()
716
- : [this.geometryInstances];
753
+ this._primitive = this._primitive.destroy();
754
+ this._primitive = undefined;
755
+ this._ready = false;
756
+ if (defined(this._sp)) {
757
+ this._sp = this._sp.destroy();
758
+ }
759
+ this._sp2D = undefined;
760
+ this._spMorph = undefined;
761
+ this._lastGroundPolylineRootGeometry = undefined;
717
762
  }
718
763
 
719
- const sourceGeometryInstances =
720
- this.geometryInstances ?? this._retainedGeometryInstances;
721
-
722
764
  if (
723
765
  defined(this._primitive) &&
724
766
  !verticalExaggerationMatchesFrameState(sourceGeometryInstances, frameState)
@@ -740,6 +782,7 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
740
782
 
741
783
  let attributes;
742
784
 
785
+ this._hasPerInstanceColors = true;
743
786
  // Check if each instance has a color attribute.
744
787
  for (i = 0; i < geometryInstancesLength; ++i) {
745
788
  attributes = geometryInstances[i].attributes;
@@ -752,7 +795,7 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
752
795
  for (i = 0; i < geometryInstancesLength; ++i) {
753
796
  const geometryInstance = geometryInstances[i];
754
797
  attributes = {};
755
- const instanceAttributes = geometryInstance.attributes;
798
+ const instanceAttributes = geometryInstance.attributes ?? {};
756
799
  for (const attributeKey in instanceAttributes) {
757
800
  if (instanceAttributes.hasOwnProperty(attributeKey)) {
758
801
  attributes[attributeKey] = instanceAttributes[attributeKey];
@@ -837,6 +880,7 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
837
880
  };
838
881
 
839
882
  this._primitive = new Primitive(primitiveOptions);
883
+ this._lastGroundPolylineRootGeometry = rootGeometryFromSource;
840
884
  }
841
885
 
842
886
  if (
@@ -932,6 +976,7 @@ GroundPolylinePrimitive.prototype.isDestroyed = function () {
932
976
  * @see GroundPolylinePrimitive#isDestroyed
933
977
  */
934
978
  GroundPolylinePrimitive.prototype.destroy = function () {
979
+ this._lastGroundPolylineRootGeometry = undefined;
935
980
  this._primitive = this._primitive && this._primitive.destroy();
936
981
  this._sp = this._sp && this._sp.destroy();
937
982
 
@@ -326,6 +326,7 @@ function Material(options) {
326
326
  this._updateFunctions = [];
327
327
 
328
328
  this._defaultTexture = undefined;
329
+ this._transparentPlaceholderTexture = undefined;
329
330
 
330
331
  /**
331
332
  * Any and all promises that are created when initializing the material.
@@ -530,6 +531,7 @@ Material.prototype.isTranslucent = function () {
530
531
  */
531
532
  Material.prototype.update = function (context) {
532
533
  this._defaultTexture = context.defaultTexture;
534
+ this._transparentPlaceholderTexture = context.defaultTransparentTexture;
533
535
 
534
536
  let i;
535
537
  let uniformId;
@@ -582,7 +584,10 @@ Material.prototype.update = function (context) {
582
584
  // This will ensure a smooth swap of textures and prevent the default texture
583
585
  // from appearing for a few frames.
584
586
  const oldTexture = this._textures[uniformId];
585
- if (defined(oldTexture) && oldTexture !== this._defaultTexture) {
587
+ if (
588
+ defined(oldTexture) &&
589
+ !isContextOwnedPlaceholderTexture(this, oldTexture)
590
+ ) {
586
591
  oldTexture.destroy();
587
592
  }
588
593
 
@@ -676,7 +681,7 @@ Material.prototype.destroy = function () {
676
681
  for (const texture in textures) {
677
682
  if (textures.hasOwnProperty(texture)) {
678
683
  const instance = textures[texture];
679
- if (instance !== this._defaultTexture) {
684
+ if (!isContextOwnedPlaceholderTexture(this, instance)) {
680
685
  instance.destroy();
681
686
  }
682
687
  }
@@ -895,6 +900,13 @@ const matrixMap = {
895
900
 
896
901
  const ktx2Regex = /\.ktx2$/i;
897
902
 
903
+ function isContextOwnedPlaceholderTexture(material, texture) {
904
+ return (
905
+ texture === material._defaultTexture ||
906
+ texture === material._transparentPlaceholderTexture
907
+ );
908
+ }
909
+
898
910
  function createTexture2DUpdateFunction(uniformId) {
899
911
  let oldUniformValue;
900
912
  return function (material, context) {
@@ -946,7 +958,7 @@ function createTexture2DUpdateFunction(uniformId) {
946
958
  if (uniformValue instanceof Texture && uniformValue !== texture) {
947
959
  material._texturePaths[uniformId] = undefined;
948
960
  const tmp = material._textures[uniformId];
949
- if (defined(tmp) && tmp !== material._defaultTexture) {
961
+ if (defined(tmp) && !isContextOwnedPlaceholderTexture(material, tmp)) {
950
962
  tmp.destroy();
951
963
  }
952
964
  material._textures[uniformId] = uniformValue;
@@ -965,7 +977,7 @@ function createTexture2DUpdateFunction(uniformId) {
965
977
  // If the newly-assigned texture is the default texture,
966
978
  // we don't need to wait for a new image to load before destroying
967
979
  // the old texture.
968
- if (texture !== material._defaultTexture) {
980
+ if (!isContextOwnedPlaceholderTexture(material, texture)) {
969
981
  texture.destroy();
970
982
  }
971
983
  texture = undefined;
@@ -973,7 +985,28 @@ function createTexture2DUpdateFunction(uniformId) {
973
985
  }
974
986
 
975
987
  if (!defined(texture)) {
976
- texture = material._textures[uniformId] = material._defaultTexture;
988
+ const useTransparentImagePlaceholder =
989
+ material.type === Material.ImageType &&
990
+ uniformId === "image" &&
991
+ !uniformValueIsDefaultImage;
992
+ texture = material._textures[uniformId] = useTransparentImagePlaceholder
993
+ ? context.defaultTransparentTexture
994
+ : material._defaultTexture;
995
+
996
+ uniformDimensionsName = `${uniformId}Dimensions`;
997
+ if (uniforms.hasOwnProperty(uniformDimensionsName)) {
998
+ uniformDimensions = uniforms[uniformDimensionsName];
999
+ uniformDimensions.x = texture._width;
1000
+ uniformDimensions.y = texture._height;
1001
+ }
1002
+ } else if (
1003
+ material.type === Material.ImageType &&
1004
+ uniformId === "image" &&
1005
+ !uniformValueIsDefaultImage &&
1006
+ texture === material._defaultTexture
1007
+ ) {
1008
+ texture = material._textures[uniformId] =
1009
+ context.defaultTransparentTexture;
977
1010
 
978
1011
  uniformDimensionsName = `${uniformId}Dimensions`;
979
1012
  if (uniforms.hasOwnProperty(uniformDimensionsName)) {
@@ -1061,7 +1094,10 @@ function loadTexture2DImageForUniform(material, uniformId) {
1061
1094
  .catch(function (error) {
1062
1095
  material._initializationError = error;
1063
1096
  const texture = material._textures[uniformId];
1064
- if (defined(texture) && texture !== material._defaultTexture) {
1097
+ if (
1098
+ defined(texture) &&
1099
+ !isContextOwnedPlaceholderTexture(material, texture)
1100
+ ) {
1065
1101
  texture.destroy();
1066
1102
  }
1067
1103
  material._textures[uniformId] = material._defaultTexture;
@@ -1440,7 +1476,15 @@ Material._materialCache.addMaterial(Material.ImageType, {
1440
1476
  },
1441
1477
  },
1442
1478
  translucent: function (material) {
1443
- return material.uniforms.color.alpha < 1.0;
1479
+ if (material.uniforms.color.alpha < 1.0) {
1480
+ return true;
1481
+ }
1482
+ const tex = material._textures.image;
1483
+ return (
1484
+ defined(tex) &&
1485
+ defined(material._transparentPlaceholderTexture) &&
1486
+ tex === material._transparentPlaceholderTexture
1487
+ );
1444
1488
  },
1445
1489
  });
1446
1490
 
@@ -485,7 +485,14 @@ function getCommonPerInstanceAttributeNames(instances) {
485
485
  const length = instances.length;
486
486
 
487
487
  const attributesInAllInstances = [];
488
+ if (length === 0 || !defined(instances[0])) {
489
+ return attributesInAllInstances;
490
+ }
491
+
488
492
  const attributes0 = instances[0].attributes;
493
+ if (!defined(attributes0)) {
494
+ return attributesInAllInstances;
495
+ }
489
496
  let name;
490
497
 
491
498
  for (name in attributes0) {
@@ -495,7 +502,13 @@ function getCommonPerInstanceAttributeNames(instances) {
495
502
 
496
503
  // Does this same attribute exist in all instances?
497
504
  for (let i = 1; i < length; ++i) {
498
- const otherAttribute = instances[i].attributes[name];
505
+ const otherInstance = instances[i];
506
+ const otherAttributes = defined(otherInstance)
507
+ ? otherInstance.attributes
508
+ : undefined;
509
+ const otherAttribute = defined(otherAttributes)
510
+ ? otherAttributes[name]
511
+ : undefined;
499
512
 
500
513
  if (
501
514
  !defined(otherAttribute) ||
@@ -537,11 +550,14 @@ function getAttributeValue(value) {
537
550
 
538
551
  function createBatchTable(primitive, context) {
539
552
  const geometryInstances = primitive.geometryInstances;
553
+ if (!defined(geometryInstances)) {
554
+ return;
555
+ }
540
556
  const instances = Array.isArray(geometryInstances)
541
557
  ? geometryInstances
542
558
  : [geometryInstances];
543
559
  const numberOfInstances = instances.length;
544
- if (numberOfInstances === 0) {
560
+ if (numberOfInstances === 0 || !defined(instances[0])) {
545
561
  return;
546
562
  }
547
563
 
@@ -2109,6 +2125,9 @@ Primitive.prototype.update = function (frameState) {
2109
2125
  if (!defined(this._batchTable)) {
2110
2126
  createBatchTable(this, context);
2111
2127
  }
2128
+ if (!defined(this._batchTable)) {
2129
+ return;
2130
+ }
2112
2131
  if (this._batchTable.attributes.length > 0) {
2113
2132
  if (ContextLimits.maximumVertexTextureImageUnits === 0) {
2114
2133
  throw new RuntimeError(
File without changes