@hztxi/cesium-engine 25.0.0 → 25.0.1

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 (120) hide show
  1. package/Build/Workers/chunk-24H74D3Q.js +102 -0
  2. package/Build/Workers/chunk-327KDYY5.js +241 -0
  3. package/Build/Workers/chunk-3S3R4BCY.js +280 -0
  4. package/Build/Workers/chunk-3TK6563P.js +9230 -0
  5. package/Build/Workers/chunk-4B3I4BQ3.js +454 -0
  6. package/Build/Workers/chunk-5EN3SEJC.js +44 -0
  7. package/Build/Workers/chunk-5NSH64L5.js +368 -0
  8. package/Build/Workers/chunk-6JM3OV5P.js +163 -0
  9. package/Build/Workers/chunk-6V5GAERI.js +288 -0
  10. package/Build/Workers/chunk-7BWPTYVV.js +1992 -0
  11. package/Build/Workers/chunk-7SUI2JKP.js +162 -0
  12. package/Build/Workers/chunk-AMW7Q4HY.js +78 -0
  13. package/Build/Workers/chunk-APAN2W5B.js +630 -0
  14. package/Build/Workers/chunk-AXAP4UXD.js +973 -0
  15. package/Build/Workers/chunk-BUS2WCDM.js +1067 -0
  16. package/Build/Workers/chunk-CCSHJCGX.js +56 -0
  17. package/Build/Workers/chunk-D6XIXIZN.js +57 -0
  18. package/Build/Workers/chunk-DWNGALVJ.js +147 -0
  19. package/Build/Workers/chunk-HM6KRMLB.js +682 -0
  20. package/Build/Workers/chunk-HOOAYVKT.js +754 -0
  21. package/Build/Workers/chunk-HVIAU36M.js +124 -0
  22. package/Build/Workers/chunk-I6PQQIM5.js +257 -0
  23. package/Build/Workers/chunk-K3SIFA6H.js +352 -0
  24. package/Build/Workers/chunk-KFRGYJLT.js +171 -0
  25. package/Build/Workers/chunk-KIRR4SHO.js +38 -0
  26. package/Build/Workers/chunk-KTHM63AY.js +837 -0
  27. package/Build/Workers/chunk-LDTDF3GI.js +511 -0
  28. package/Build/Workers/chunk-LPWXXHTU.js +2342 -0
  29. package/Build/Workers/chunk-LU6LZORF.js +3620 -0
  30. package/Build/Workers/chunk-LZI4ZK6U.js +97 -0
  31. package/Build/Workers/chunk-M6XP5U6F.js +959 -0
  32. package/Build/Workers/chunk-MG54QB2S.js +1287 -0
  33. package/Build/Workers/chunk-N52ZLKZ3.js +73 -0
  34. package/Build/Workers/chunk-N54RGG53.js +398 -0
  35. package/Build/Workers/chunk-NO4VBMKQ.js +387 -0
  36. package/Build/Workers/chunk-NSTJ4RH4.js +198 -0
  37. package/Build/Workers/chunk-NW27SGND.js +2719 -0
  38. package/Build/Workers/chunk-O7JC67VX.js +1483 -0
  39. package/Build/Workers/chunk-OGSPRAJN.js +414 -0
  40. package/Build/Workers/chunk-P2DEQUE6.js +301 -0
  41. package/Build/Workers/chunk-PAO4TRRA.js +497 -0
  42. package/Build/Workers/chunk-Q2MV7V3J.js +1344 -0
  43. package/Build/Workers/chunk-Q3JUKGCA.js +305 -0
  44. package/Build/Workers/chunk-Q56GS53F.js +455 -0
  45. package/Build/Workers/chunk-S2SZ2HYA.js +101 -0
  46. package/Build/Workers/chunk-SSNBEN3T.js +3201 -0
  47. package/Build/Workers/chunk-UA3ZQQGQ.js +352 -0
  48. package/Build/Workers/chunk-UOXL2W6I.js +1800 -0
  49. package/Build/Workers/chunk-UZ7FDKAX.js +1054 -0
  50. package/Build/Workers/chunk-VAYNR45Y.js +219 -0
  51. package/Build/Workers/chunk-VG4FKBIJ.js +140 -0
  52. package/Build/Workers/chunk-WA2OK3VI.js +76 -0
  53. package/Build/Workers/chunk-WMSNHJUP.js +476 -0
  54. package/Build/Workers/chunk-WWOR75YX.js +778 -0
  55. package/Build/Workers/chunk-XNSQLK46.js +138 -0
  56. package/Build/Workers/chunk-YZTJZDOY.js +693 -0
  57. package/Build/Workers/chunk-ZY636MPN.js +58 -0
  58. package/Build/Workers/chunk-ZZIFOLD3.js +56 -0
  59. package/Build/Workers/combineGeometry.js +24 -24
  60. package/Build/Workers/createBoxGeometry.js +18 -18
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  62. package/Build/Workers/createCircleGeometry.js +26 -26
  63. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  66. package/Build/Workers/createCorridorGeometry.js +29 -29
  67. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  68. package/Build/Workers/createCylinderGeometry.js +20 -20
  69. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  70. package/Build/Workers/createEllipseGeometry.js +26 -26
  71. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  74. package/Build/Workers/createFrustumGeometry.js +18 -18
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  76. package/Build/Workers/createGeometry.js +24 -24
  77. package/Build/Workers/createGroundPolylineGeometry.js +23 -23
  78. package/Build/Workers/createPlaneGeometry.js +16 -16
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  80. package/Build/Workers/createPolygonGeometry.js +32 -32
  81. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  82. package/Build/Workers/createPolylineGeometry.js +25 -25
  83. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  85. package/Build/Workers/createRectangleGeometry.js +27 -27
  86. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  87. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  88. package/Build/Workers/createSphereGeometry.js +19 -19
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  92. package/Build/Workers/createVectorTileGeometries.js +24 -24
  93. package/Build/Workers/createVectorTilePoints.js +13 -13
  94. package/Build/Workers/createVectorTilePolygons.js +22 -22
  95. package/Build/Workers/createVectorTilePolylines.js +14 -14
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +26 -26
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
  98. package/Build/Workers/createVerticesFromHeightmap.js +23 -23
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
  100. package/Build/Workers/createWallGeometry.js +24 -24
  101. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +10 -10
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
  112. package/Source/DataSources/DynamicGeometryUpdater.js +1 -0
  113. package/Source/DataSources/GeometryVisualizer.js +5 -0
  114. package/Source/DataSources/PolylineVisualizer.js +3 -0
  115. package/Source/DataSources/StaticGeometryPerMaterialBatch.js +17 -0
  116. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +11 -0
  117. package/Source/Renderer/Context.js +28 -0
  118. package/Source/Scene/Material.js +51 -7
  119. package/index.js +306 -306
  120. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.141.0
4
+ * Version 1.141.1
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -25,33 +25,33 @@
25
25
 
26
26
  import {
27
27
  Cesium3DTilesTerrainGeometryProcessor_default
28
- } from "./chunk-DOB5JF3K.js";
29
- import "./chunk-P5SWEPTI.js";
30
- import "./chunk-VCJD4URC.js";
31
- import "./chunk-4VKEY67A.js";
28
+ } from "./chunk-LU6LZORF.js";
29
+ import "./chunk-K3SIFA6H.js";
30
+ import "./chunk-HOOAYVKT.js";
31
+ import "./chunk-WA2OK3VI.js";
32
32
  import {
33
33
  createTaskProcessorWorker_default
34
- } from "./chunk-FIBS5S7R.js";
35
- import "./chunk-DH3HFR2Z.js";
36
- import "./chunk-HZPEDSEN.js";
37
- import "./chunk-P7VT7DMK.js";
38
- import "./chunk-P3FP7NAM.js";
39
- import "./chunk-SPEMUYE5.js";
40
- import "./chunk-JUGOIC4O.js";
41
- import "./chunk-SGKTPOWQ.js";
42
- import "./chunk-6ZAVOU5L.js";
43
- import "./chunk-LOG5WXZZ.js";
44
- import "./chunk-4MTRQFJP.js";
45
- import "./chunk-NIJIKHQM.js";
46
- import "./chunk-GNBRTX2J.js";
47
- import "./chunk-77RL3MBD.js";
48
- import "./chunk-TA777BGS.js";
49
- import "./chunk-3TKLDHV3.js";
50
- import "./chunk-KSMUF4SU.js";
51
- import "./chunk-JQ4R7MXV.js";
52
- import "./chunk-WMMER2ET.js";
53
- import "./chunk-CZ23Y3RM.js";
54
- import "./chunk-DH26SNAB.js";
34
+ } from "./chunk-S2SZ2HYA.js";
35
+ import "./chunk-DWNGALVJ.js";
36
+ import "./chunk-KTHM63AY.js";
37
+ import "./chunk-4B3I4BQ3.js";
38
+ import "./chunk-6V5GAERI.js";
39
+ import "./chunk-7SUI2JKP.js";
40
+ import "./chunk-Q2MV7V3J.js";
41
+ import "./chunk-KFRGYJLT.js";
42
+ import "./chunk-VG4FKBIJ.js";
43
+ import "./chunk-MG54QB2S.js";
44
+ import "./chunk-ZZIFOLD3.js";
45
+ import "./chunk-3TK6563P.js";
46
+ import "./chunk-SSNBEN3T.js";
47
+ import "./chunk-I6PQQIM5.js";
48
+ import "./chunk-APAN2W5B.js";
49
+ import "./chunk-ZY636MPN.js";
50
+ import "./chunk-7BWPTYVV.js";
51
+ import "./chunk-LPWXXHTU.js";
52
+ import "./chunk-PAO4TRRA.js";
53
+ import "./chunk-6JM3OV5P.js";
54
+ import "./chunk-AMW7Q4HY.js";
55
55
 
56
56
  // packages/engine/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js
57
57
  function upsampleVerticesFromCesium3DTilesTerrain(options, transferableObjects) {
@@ -112,6 +112,7 @@ DynamicGeometryUpdater.prototype.update = function (time) {
112
112
  this._material,
113
113
  );
114
114
  this._material = material;
115
+ material.update(this._geometryUpdater._scene.context);
115
116
  appearance = new MaterialAppearance({
116
117
  material: material,
117
118
  translucent: material.isTranslucent(),
@@ -94,6 +94,7 @@ function GeometryVisualizer(
94
94
  );
95
95
 
96
96
  this._closedMaterialBatches[i] = new StaticGeometryPerMaterialBatch(
97
+ this._scene,
97
98
  primitives,
98
99
  MaterialAppearance,
99
100
  undefined,
@@ -103,6 +104,7 @@ function GeometryVisualizer(
103
104
  );
104
105
  this._closedMaterialBatches[numberOfShadowModes + i] =
105
106
  new StaticGeometryPerMaterialBatch(
107
+ this._scene,
106
108
  primitives,
107
109
  MaterialAppearance,
108
110
  undefined,
@@ -130,6 +132,7 @@ function GeometryVisualizer(
130
132
  );
131
133
 
132
134
  this._openMaterialBatches[i] = new StaticGeometryPerMaterialBatch(
135
+ this._scene,
133
136
  primitives,
134
137
  MaterialAppearance,
135
138
  undefined,
@@ -139,6 +142,7 @@ function GeometryVisualizer(
139
142
  );
140
143
  this._openMaterialBatches[numberOfShadowModes + i] =
141
144
  new StaticGeometryPerMaterialBatch(
145
+ this._scene,
142
146
  primitives,
143
147
  MaterialAppearance,
144
148
  undefined,
@@ -156,6 +160,7 @@ function GeometryVisualizer(
156
160
  for (i = 0; i < numberOfClassificationTypes; ++i) {
157
161
  groundMaterialBatches.push(
158
162
  new StaticGroundGeometryPerMaterialBatch(
163
+ this._scene,
159
164
  groundPrimitives,
160
165
  i,
161
166
  MaterialAppearance,
@@ -112,6 +112,7 @@ function PolylineVisualizer(
112
112
  i,
113
113
  ); // no depth fail appearance
114
114
  this._materialBatches[i] = new StaticGeometryPerMaterialBatch(
115
+ this._scene,
115
116
  primitives,
116
117
  PolylineMaterialAppearance,
117
118
  undefined,
@@ -128,6 +129,7 @@ function PolylineVisualizer(
128
129
  ); //depth fail appearance variations
129
130
  this._materialBatches[i + numberOfShadowModes] =
130
131
  new StaticGeometryPerMaterialBatch(
132
+ this._scene,
131
133
  primitives,
132
134
  PolylineMaterialAppearance,
133
135
  PolylineColorAppearance,
@@ -145,6 +147,7 @@ function PolylineVisualizer(
145
147
  );
146
148
  this._materialBatches[i + numberOfShadowModes * 2] =
147
149
  new StaticGeometryPerMaterialBatch(
150
+ this._scene,
148
151
  primitives,
149
152
  PolylineMaterialAppearance,
150
153
  PolylineMaterialAppearance,
@@ -19,6 +19,7 @@ const defaultOffset = Cartesian3.ZERO;
19
19
  const offsetScratch = new Cartesian3();
20
20
 
21
21
  function Batch(
22
+ scene,
22
23
  primitives,
23
24
  appearanceType,
24
25
  materialProperty,
@@ -27,6 +28,7 @@ function Batch(
27
28
  closed,
28
29
  shadows,
29
30
  ) {
31
+ this.scene = scene;
30
32
  this.primitives = primitives;
31
33
  this.appearanceType = appearanceType;
32
34
  this.materialProperty = materialProperty;
@@ -146,6 +148,9 @@ Batch.prototype.update = function (time) {
146
148
  this.materialProperty,
147
149
  this.material,
148
150
  );
151
+ if (defined(this.scene)) {
152
+ this.material.update(this.scene.context);
153
+ }
149
154
 
150
155
  let depthFailAppearance;
151
156
  if (defined(this.depthFailMaterialProperty)) {
@@ -154,6 +159,9 @@ Batch.prototype.update = function (time) {
154
159
  this.depthFailMaterialProperty,
155
160
  this.depthFailMaterial,
156
161
  );
162
+ if (defined(this.scene)) {
163
+ this.depthFailMaterial.update(this.scene.context);
164
+ }
157
165
 
158
166
  const DepthFailAppearanceType = this.depthFailAppearanceType;
159
167
 
@@ -208,6 +216,9 @@ Batch.prototype.update = function (time) {
208
216
  this.materialProperty,
209
217
  this.material,
210
218
  );
219
+ if (defined(this.scene)) {
220
+ this.material.update(this.scene.context);
221
+ }
211
222
  this.primitive.appearance.material = this.material;
212
223
 
213
224
  if (
@@ -219,6 +230,9 @@ Batch.prototype.update = function (time) {
219
230
  this.depthFailMaterialProperty,
220
231
  this.depthFailMaterial,
221
232
  );
233
+ if (defined(this.scene)) {
234
+ this.depthFailMaterial.update(this.scene.context);
235
+ }
222
236
  this.primitive.depthFailAppearance.material = this.depthFailMaterial;
223
237
  }
224
238
 
@@ -390,12 +404,14 @@ Batch.prototype.destroy = function () {
390
404
  * @private
391
405
  */
392
406
  function StaticGeometryPerMaterialBatch(
407
+ scene,
393
408
  primitives,
394
409
  appearanceType,
395
410
  depthFailAppearanceType,
396
411
  closed,
397
412
  shadows,
398
413
  ) {
414
+ this._scene = scene;
399
415
  this._items = [];
400
416
  this._primitives = primitives;
401
417
  this._appearanceType = appearanceType;
@@ -415,6 +431,7 @@ StaticGeometryPerMaterialBatch.prototype.add = function (time, updater) {
415
431
  }
416
432
  }
417
433
  const batch = new Batch(
434
+ this._scene,
418
435
  this._primitives,
419
436
  this._appearanceType,
420
437
  updater.fillMaterialProperty,
@@ -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 =
@@ -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