@cesium/engine 13.1.0 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/Build/Workers/{chunk-APCS5YJI.js → chunk-25TOENEE.js} +7 -7
  2. package/Build/Workers/{chunk-FNCXBBCF.js → chunk-2AVIUB5H.js} +2 -2
  3. package/Build/Workers/{chunk-OZTFRHA2.js → chunk-3JZGPJMZ.js} +6 -6
  4. package/Build/Workers/{chunk-5JY4LYO3.js → chunk-3LHBH4TC.js} +7 -7
  5. package/Build/Workers/{chunk-MGABCOOH.js → chunk-3LZF23RY.js} +6 -6
  6. package/Build/Workers/{chunk-AXYZUG4N.js → chunk-5S2B46UQ.js} +1 -1
  7. package/Build/Workers/{chunk-2SRHVCFD.js → chunk-67ONR44K.js} +6 -6
  8. package/Build/Workers/{chunk-PBJQFLKS.js → chunk-6EDBC234.js} +11 -11
  9. package/Build/Workers/{chunk-GSLKQJM2.js → chunk-6EV4VOET.js} +10 -10
  10. package/Build/Workers/{chunk-OGRXNUR2.js → chunk-7ITUZTFH.js} +1 -1
  11. package/Build/Workers/{chunk-IP7F2MVW.js → chunk-ARVZCY6X.js} +7 -7
  12. package/Build/Workers/{chunk-EYZFEJX3.js → chunk-B2UQN3DH.js} +6 -6
  13. package/Build/Workers/{chunk-WE4KF4AM.js → chunk-B2Y4ZS6X.js} +9 -9
  14. package/Build/Workers/{chunk-DWIKWWEE.js → chunk-BD2TPFGC.js} +5 -5
  15. package/Build/Workers/{chunk-5ICYLS6B.js → chunk-CHX2K5AC.js} +10 -10
  16. package/Build/Workers/{chunk-NQDKNE7V.js → chunk-CJGVEABL.js} +13 -13
  17. package/Build/Workers/{chunk-B34JXFHF.js → chunk-DYJHEP3B.js} +5 -5
  18. package/Build/Workers/{chunk-J7BMSSY7.js → chunk-E3H7AVMK.js} +13 -13
  19. package/Build/Workers/{chunk-TOHDFUJM.js → chunk-EZNAJPP5.js} +4 -4
  20. package/Build/Workers/{chunk-K62EHZFT.js → chunk-F7ZI463G.js} +15 -15
  21. package/Build/Workers/{chunk-EJ5DT5BP.js → chunk-FMZ5CX6V.js} +1 -1
  22. package/Build/Workers/{chunk-OARMSJUU.js → chunk-FRAWHNSR.js} +2 -2
  23. package/Build/Workers/{chunk-S3UM4OKP.js → chunk-GGV2XJHE.js} +7 -7
  24. package/Build/Workers/{chunk-SAKQO5NX.js → chunk-GK4QU6QI.js} +2 -2
  25. package/Build/Workers/{chunk-LFUFGHL3.js → chunk-HYPB7FAV.js} +10 -10
  26. package/Build/Workers/{chunk-3SCCWLZS.js → chunk-I4HO2ED2.js} +9 -9
  27. package/Build/Workers/{chunk-K6SQV4IS.js → chunk-IGINOLDX.js} +6 -6
  28. package/Build/Workers/{chunk-IXNXKVOB.js → chunk-ISQSYLZY.js} +4 -4
  29. package/Build/Workers/{chunk-PM76TX2X.js → chunk-JZAMRL5I.js} +6 -6
  30. package/Build/Workers/{chunk-CBE4HRBH.js → chunk-K5G2WELR.js} +7 -7
  31. package/Build/Workers/{chunk-EHGQQA7C.js → chunk-L5SO4Y5V.js} +1 -1
  32. package/Build/Workers/{chunk-M2AA2ARJ.js → chunk-LCMJQVIF.js} +11 -11
  33. package/Build/Workers/{chunk-HI73PIPQ.js → chunk-MWJW37I7.js} +2 -2
  34. package/Build/Workers/{chunk-WAJNX74N.js → chunk-NAGMYRDW.js} +27 -20
  35. package/Build/Workers/{chunk-WUIDEXAN.js → chunk-OYO6TKMU.js} +7 -7
  36. package/Build/Workers/{chunk-YVGU235V.js → chunk-PUTA3AE2.js} +4 -4
  37. package/Build/Workers/{chunk-ZWSWJYJP.js → chunk-Q5BHMNKU.js} +13 -13
  38. package/Build/Workers/{chunk-LQT2ZK7D.js → chunk-QTEX3Y4V.js} +17 -17
  39. package/Build/Workers/{chunk-UBAHTE4Q.js → chunk-QZKN2RXM.js} +1 -1
  40. package/Build/Workers/{chunk-T34EOLFR.js → chunk-RO2Z3LCR.js} +14 -14
  41. package/Build/Workers/{chunk-PTFIVVLX.js → chunk-RRN6LRDX.js} +12 -12
  42. package/Build/Workers/{chunk-B6IJY6AN.js → chunk-SLIA3GQP.js} +7 -7
  43. package/Build/Workers/{chunk-GIOZHX7U.js → chunk-TFCOEX3W.js} +2 -2
  44. package/Build/Workers/{chunk-KRVALCCI.js → chunk-TU6ZXHVU.js} +5 -5
  45. package/Build/Workers/{chunk-54I6VSRP.js → chunk-VJ2PDF64.js} +6 -6
  46. package/Build/Workers/{chunk-BMFWWTD7.js → chunk-VMVPONIV.js} +5 -5
  47. package/Build/Workers/{chunk-CNPP6TQ2.js → chunk-WPXU45PH.js} +4 -4
  48. package/Build/Workers/{chunk-2ONAV62A.js → chunk-XDHM4G3P.js} +7 -7
  49. package/Build/Workers/{chunk-KO232FLP.js → chunk-XED3RXKO.js} +2 -2
  50. package/Build/Workers/{chunk-5I3LPAS7.js → chunk-YNYCGTQH.js} +5 -5
  51. package/Build/Workers/{chunk-THDHWSEJ.js → chunk-Z4SI54EB.js} +4 -4
  52. package/Build/Workers/{chunk-R2KGFZBA.js → chunk-ZVDLC3T4.js} +13 -13
  53. package/Build/Workers/combineGeometry.js +22 -22
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +22 -22
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +30 -30
  75. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +25 -25
  80. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  91. package/Build/Workers/createVerticesFromHeightmap.js +20 -20
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +15 -14
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +50 -43
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Core/Color.js +3 -3
  102. package/Source/Core/Credit.js +3 -3
  103. package/Source/Core/DistanceDisplayCondition.js +3 -3
  104. package/Source/Core/EllipsoidRhumbLine.js +1 -1
  105. package/Source/Core/Ion.js +1 -1
  106. package/Source/Core/OrientedBoundingBox.js +2 -2
  107. package/Source/Core/PolygonGeometryLibrary.js +26 -4
  108. package/Source/Core/Spherical.js +3 -3
  109. package/Source/Core/TexturePacker.js +166 -0
  110. package/Source/Core/writeTextToCanvas.js +0 -1
  111. package/Source/DataSources/BillboardVisualizer.js +3 -3
  112. package/Source/DataSources/BoundingSphereState.js +3 -3
  113. package/Source/DataSources/DataSourceClock.js +1 -1
  114. package/Source/DataSources/DataSourceDisplay.js +5 -2
  115. package/Source/DataSources/EntityCluster.js +44 -19
  116. package/Source/Renderer/AutomaticUniforms.js +2 -2
  117. package/Source/Renderer/Context.js +0 -4
  118. package/Source/Renderer/Texture.js +6 -5
  119. package/Source/Renderer/TextureAtlas.js +802 -0
  120. package/Source/Scene/ArcGisMapService.js +1 -1
  121. package/Source/Scene/Billboard.js +87 -142
  122. package/Source/Scene/BillboardCollection.js +132 -202
  123. package/Source/Scene/BillboardLoadState.js +44 -0
  124. package/Source/Scene/BillboardTexture.js +348 -0
  125. package/Source/Scene/Camera.js +2 -2
  126. package/Source/Scene/Cesium3DTile.js +56 -28
  127. package/Source/Scene/Cesium3DTilesVoxelProvider.js +403 -132
  128. package/Source/Scene/Cesium3DTilesetStatistics.js +0 -1
  129. package/Source/Scene/ClippingPolygon.js +2 -2
  130. package/Source/Scene/Expression.js +1 -0
  131. package/Source/Scene/GltfDracoLoader.js +45 -0
  132. package/Source/Scene/GltfIndexBufferLoader.js +5 -0
  133. package/Source/Scene/GltfLoader.js +22 -9
  134. package/Source/Scene/GltfVertexBufferLoader.js +13 -0
  135. package/Source/Scene/ITwinData.js +47 -1
  136. package/Source/Scene/ImageryLayer.js +1 -1
  137. package/Source/Scene/ImplicitSubtree.js +2 -0
  138. package/Source/Scene/KeyframeNode.js +16 -2
  139. package/Source/Scene/Label.js +1 -1
  140. package/Source/Scene/LabelCollection.js +212 -193
  141. package/Source/Scene/Megatexture.js +145 -81
  142. package/Source/Scene/Model/CustomShader.js +0 -2
  143. package/Source/Scene/Model/Model.js +1 -1
  144. package/Source/Scene/Model/ModelUtility.js +5 -1
  145. package/Source/Scene/Multiple3DTileContent.js +21 -8
  146. package/Source/Scene/PointPrimitive.js +1 -1
  147. package/Source/Scene/ResourceCache.js +17 -1
  148. package/Source/Scene/Scene.js +39 -15
  149. package/Source/Scene/ScreenSpaceCameraController.js +0 -8
  150. package/Source/Scene/SpatialNode.js +4 -11
  151. package/Source/Scene/Vector3DTilePoints.js +2 -5
  152. package/Source/Scene/VoxelBoxShape.js +12 -5
  153. package/Source/Scene/VoxelCell.js +6 -5
  154. package/Source/Scene/VoxelContent.js +171 -107
  155. package/Source/Scene/VoxelCylinderShape.js +65 -58
  156. package/Source/Scene/VoxelEllipsoidShape.js +15 -5
  157. package/Source/Scene/VoxelMetadataOrder.js +12 -0
  158. package/Source/Scene/VoxelPrimitive.js +245 -53
  159. package/Source/Scene/VoxelProvider.js +44 -29
  160. package/Source/Scene/VoxelRenderResources.js +30 -7
  161. package/Source/Scene/VoxelShape.js +10 -3
  162. package/Source/Scene/VoxelTraversal.js +326 -166
  163. package/Source/Scene/WebMapTileServiceImageryProvider.js +2 -2
  164. package/Source/Scene/createGooglePhotorealistic3DTileset.js +5 -8
  165. package/Source/Scene/processVoxelProperties.js +3 -0
  166. package/Source/Shaders/GlobeFS.glsl +10 -1
  167. package/Source/Shaders/GlobeFS.js +10 -1
  168. package/Source/Shaders/PolylineCommon.glsl +1 -1
  169. package/Source/Shaders/PolylineCommon.js +1 -1
  170. package/Source/Shaders/Voxels/Megatexture.glsl +4 -16
  171. package/Source/Shaders/Voxels/Megatexture.js +4 -16
  172. package/Source/Shaders/Voxels/Octree.glsl +44 -7
  173. package/Source/Shaders/Voxels/Octree.js +44 -7
  174. package/Source/Shaders/Voxels/VoxelFS.glsl +9 -15
  175. package/Source/Shaders/Voxels/VoxelFS.js +9 -15
  176. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +15 -15
  177. package/Source/Shaders/Voxels/convertUvToCylinder.js +15 -15
  178. package/Source/Widget/CesiumWidget.js +16 -10
  179. package/Source/Workers/decodeDraco.js +4 -4
  180. package/index.d.ts +321 -110
  181. package/index.js +209 -205
  182. package/package.json +2 -2
  183. package/Source/Scene/TextureAtlas.js +0 -558
@@ -0,0 +1,348 @@
1
+ import Check from "../Core/Check.js";
2
+ import defined from "../Core/defined.js";
3
+ import BillboardLoadState from "./BillboardLoadState.js";
4
+
5
+ /**
6
+ * Tracks a reference to an image and it's loading state, as used in a BillboardCollection and stored in a texture atlas.
7
+ * @constructor
8
+ * @private
9
+ * @see BillboardCollection
10
+ * @see Billboard#image
11
+ * @alias BillboardTexture
12
+ * @param {BillboardCollection} billboardCollection The associated billboard collecion.
13
+ */
14
+ function BillboardTexture(billboardCollection) {
15
+ //>>includeStart('debug', pragmas.debug);
16
+ Check.defined("billboardCollection", billboardCollection);
17
+ //>>includeEnd('debug');
18
+
19
+ this._billboardCollection = billboardCollection;
20
+
21
+ this._id = undefined;
22
+ this._loadState = BillboardLoadState.NONE;
23
+ this._loadError = undefined;
24
+
25
+ this._index = -1;
26
+ this._width = undefined;
27
+ this._height = undefined;
28
+
29
+ this._hasSubregion = false;
30
+
31
+ /**
32
+ * Used by billboardCollection to track whcih billboards to update.
33
+ * @type {boolean}
34
+ * @private
35
+ */
36
+ this.dirty = false;
37
+ }
38
+
39
+ Object.defineProperties(BillboardTexture.prototype, {
40
+ /**
41
+ * If defined, this error was encountered during the loading process.
42
+ * @memberof BillboardTexture.prototype
43
+ * @type {Error|undefined}
44
+ * @readonly
45
+ * @private
46
+ */
47
+ loadError: {
48
+ get: function () {
49
+ return this._loadError;
50
+ },
51
+ },
52
+
53
+ /**
54
+ * The current status of the image load. When <code>BillboardLoadState.LOADED</code>, this billboard is ready to render, i.e., the image
55
+ * has been downloaded and the WebGL resources are created.
56
+ * @memberof BillboardTexture.prototype
57
+ * @type {BillboardLoadState}
58
+ * @readonly
59
+ * @default BillboardLoadState.NONE
60
+ * @private
61
+ */
62
+ loadState: {
63
+ get: function () {
64
+ return this._loadState;
65
+ },
66
+ },
67
+
68
+ /**
69
+ * When <code>true</code>, this texture is ready to render, i.e., the image
70
+ * has been downloaded and the WebGL resources are created.
71
+ * @memberof BillboardTexture.prototype
72
+ * @type {boolean}
73
+ * @readonly
74
+ * @default false
75
+ * @private
76
+ */
77
+ ready: {
78
+ get: function () {
79
+ return this._loadState === BillboardLoadState.LOADED;
80
+ },
81
+ },
82
+
83
+ /**
84
+ * Returns <code>true</code> if there is image data associated with this instance.
85
+ * @memberof BillboardTexture.prototype
86
+ * @type {boolean}
87
+ * @readonly
88
+ * @private
89
+ */
90
+ hasImage: {
91
+ get: function () {
92
+ return this._loadState !== BillboardLoadState.NONE;
93
+ },
94
+ },
95
+
96
+ /**
97
+ * A unique identifier for the image, or undefined if no image data has been associated with this instance.
98
+ * @memberof BillboardTexture.prototype
99
+ * @type {string|undefined}
100
+ * @readonly
101
+ * @private
102
+ */
103
+ id: {
104
+ get: function () {
105
+ return this._id;
106
+ },
107
+ },
108
+
109
+ /**
110
+ * The width of the associated image. Before the instance is <code>ready</code>, this will be <code>undefined</code>.
111
+ * @memberof BillboardTexture.prototype
112
+ * @type {number|undefined}
113
+ * @readonly
114
+ * @private
115
+ */
116
+ width: {
117
+ get: function () {
118
+ return this._width;
119
+ },
120
+ },
121
+
122
+ /**
123
+ * The height of the associated image. Before the instance is <code>ready</code>, this will be <code>undefined</code>.
124
+ * @memberof BillboardTexture.prototype
125
+ * @type {number|undefined}
126
+ * @readonly
127
+ * @private
128
+ */
129
+ height: {
130
+ get: function () {
131
+ return this._height;
132
+ },
133
+ },
134
+ });
135
+
136
+ /**
137
+ * Releases reference to any associated image data.
138
+ * @private
139
+ */
140
+ BillboardTexture.prototype.unload = async function () {
141
+ if (this._loadState === BillboardLoadState.NONE) {
142
+ return;
143
+ }
144
+
145
+ this._id = undefined;
146
+ this._loadError = undefined;
147
+ this._loadState = BillboardLoadState.NONE;
148
+
149
+ this._index = -1;
150
+ this._width = undefined;
151
+ this._height = undefined;
152
+
153
+ this.dirty = true;
154
+ };
155
+
156
+ /**
157
+ * Starts loading an image into the texture atlas.
158
+ * @see {TextureAtlas#addImage}
159
+ * @private
160
+ * @param {string} id An identifier to detect whether the image already exists in the atlas.
161
+ * @param {HTMLImageElement|HTMLCanvasElement|string|Resource|Promise|TextureAtlas.CreateImageCallback} image An image or canvas to add to the texture atlas,
162
+ * or a URL to an Image, or a Promise for an image, or a function that creates an image.
163
+ */
164
+ BillboardTexture.prototype.loadImage = async function (id, image) {
165
+ if (this._id === id) {
166
+ // This image has already been loaded
167
+ return;
168
+ }
169
+
170
+ const collection = this._billboardCollection;
171
+ const cache = collection.billboardTextureCache;
172
+ let billboardTexture = cache.get(id);
173
+ if (
174
+ (defined(billboardTexture) &&
175
+ image.loadState === BillboardLoadState.LOADING) ||
176
+ image.loadState === BillboardLoadState.LOADED
177
+ ) {
178
+ // Use the cached texture if it is in progress or successful.
179
+ BillboardTexture.clone(billboardTexture, this);
180
+ return;
181
+ }
182
+ // Otherwise, load if not yet assigned an image, and try the load again if anything failed during the last billboard creation
183
+ if (!defined(billboardTexture)) {
184
+ billboardTexture = new BillboardTexture(collection);
185
+ cache.set(id, billboardTexture);
186
+ }
187
+
188
+ billboardTexture._id = this._id = id;
189
+ billboardTexture._loadState = this._loadState = BillboardLoadState.LOADING;
190
+ billboardTexture._loadError = this._loadError = undefined;
191
+
192
+ let index;
193
+ const atlas = this._billboardCollection.textureAtlas;
194
+ try {
195
+ index = await atlas.addImage(id, image);
196
+ } catch (error) {
197
+ // There was an error loading the image
198
+ billboardTexture._loadState = BillboardLoadState.ERROR;
199
+ billboardTexture._loadError = error;
200
+
201
+ if (this._id !== id) {
202
+ // Another load was initiated and resolved resolved before this one. This operation is cancelled.
203
+ return;
204
+ }
205
+
206
+ this._loadState = BillboardLoadState.ERROR;
207
+ this._loadError = error;
208
+ return;
209
+ }
210
+
211
+ if (!defined(index) || index === -1) {
212
+ // Resources destroyed or otherwise
213
+ billboardTexture._loadState = BillboardLoadState.FAILED;
214
+ billboardTexture._index = -1;
215
+
216
+ if (this._id !== id) {
217
+ // Another load was initiated and resolved resolved before this one. This operation is cancelled.
218
+ return;
219
+ }
220
+
221
+ this._loadState = BillboardLoadState.FAILED;
222
+ this._index = -1;
223
+
224
+ return;
225
+ }
226
+
227
+ billboardTexture._index = index;
228
+ billboardTexture._loadState = BillboardLoadState.LOADED;
229
+
230
+ const rectangle = atlas.rectangles[index];
231
+ billboardTexture._width = rectangle.width;
232
+ billboardTexture._height = rectangle.height;
233
+
234
+ if (this._id !== id) {
235
+ // Another load was initiated and resolved resolved before this one. This operation is cancelled.
236
+ return;
237
+ }
238
+
239
+ this._index = index;
240
+ this._loadState = BillboardLoadState.LOADED;
241
+ this._width = rectangle.width;
242
+ this._height = rectangle.height;
243
+
244
+ this.dirty = true;
245
+ };
246
+
247
+ /**
248
+ * Track a reference to a sub-region of an existing image.
249
+ * @see {TextureAtlas#addImageSubRegion}
250
+ * @private
251
+ * @param {string} id An identifier to detect whether the image already exists in the atlas.
252
+ * @param {BoundingRectangle} subRegion An {@link BoundingRectangle} defining a region of an existing image, measured in pixels from the bottom-left of the image.
253
+ */
254
+ BillboardTexture.prototype.addImageSubRegion = async function (id, subRegion) {
255
+ this._id = id;
256
+ this._loadState = BillboardLoadState.LOADING;
257
+ this._loadError = undefined;
258
+ this._hasSubregion = true;
259
+
260
+ let index;
261
+ const atlas = this._billboardCollection.textureAtlas;
262
+ try {
263
+ index = await atlas.addImageSubRegion(id, subRegion);
264
+ } catch (error) {
265
+ // There was an error loading the referenced image
266
+ this._loadState = BillboardLoadState.ERROR;
267
+ this._loadError = error;
268
+ return;
269
+ }
270
+
271
+ if (!defined(index) || index === -1) {
272
+ this._loadState = BillboardLoadState.FAILED;
273
+ this._index = -1;
274
+ this._width = undefined;
275
+ this._height = undefined;
276
+ return;
277
+ }
278
+
279
+ this._width = subRegion.width;
280
+ this._height = subRegion.height;
281
+
282
+ this._index = index;
283
+ this._loadState = BillboardLoadState.LOADED;
284
+
285
+ this.dirty = true;
286
+ };
287
+
288
+ /**
289
+ * Get the texture coordinates for reading the loaded texture in shaders.
290
+ * @private
291
+ * @param {BoundingRectangle} [result] The modified result parameter or a new BoundingRectangle instance if one was not provided.
292
+ * @return {BoundingRectangle} The modified result parameter or a new BoundingRectangle instance if one was not provided.
293
+ */
294
+ BillboardTexture.prototype.computeTextureCoordinates = function (result) {
295
+ const atlas = this._billboardCollection.textureAtlas;
296
+ return atlas.computeTextureCoordinates(this._index, result);
297
+ };
298
+
299
+ /**
300
+ * Clones an existing billboard texture, inlcuding any in-flight tracking, into the target billboard texture.
301
+ * @param {BillboardTexture} billboardTexture
302
+ * @param {BillboardTexture} target
303
+ * @returns {BillboardTexture} target
304
+ */
305
+ BillboardTexture.clone = function (billboardTexture, target) {
306
+ target._id = billboardTexture._id;
307
+ target._loadState = billboardTexture._loadState;
308
+ target._loadError = undefined;
309
+ target._index = billboardTexture._index;
310
+ target._width = billboardTexture._width;
311
+ target._height = billboardTexture._height;
312
+ target._hasSubregion = billboardTexture._hasSubregion;
313
+
314
+ if (billboardTexture.ready) {
315
+ target.dirty = true;
316
+ return;
317
+ }
318
+
319
+ const completeLoad = async () => {
320
+ const id = billboardTexture._id;
321
+ const atlas = billboardTexture._billboardCollection.textureAtlas;
322
+ await atlas._indexPromiseById.get(id);
323
+
324
+ // Any errors should have already been handled
325
+ if (target._id !== id) {
326
+ // Another load was initiated and resolved resolved before this one. This operation is cancelled.
327
+ return;
328
+ }
329
+
330
+ if (billboardTexture._hasSubregion) {
331
+ // Subregions must wait an additional frame to be ready
332
+ await Promise.resolve();
333
+ }
334
+
335
+ target._id = id;
336
+ target._loadState = billboardTexture._loadState;
337
+ target._loadError = billboardTexture._loadError;
338
+ target._index = billboardTexture._index;
339
+ target._width = billboardTexture._width;
340
+ target._height = billboardTexture._height;
341
+ target.dirty = true;
342
+ };
343
+
344
+ completeLoad();
345
+ return target;
346
+ };
347
+
348
+ export default BillboardTexture;
@@ -3270,7 +3270,7 @@ const newOptions = {
3270
3270
 
3271
3271
  /**
3272
3272
  * Cancels the current camera flight and leaves the camera at its current location.
3273
- * If no flight is in progress, this this function does nothing.
3273
+ * If no flight is in progress, this function does nothing.
3274
3274
  */
3275
3275
  Camera.prototype.cancelFlight = function () {
3276
3276
  if (defined(this._currentFlight)) {
@@ -3281,7 +3281,7 @@ Camera.prototype.cancelFlight = function () {
3281
3281
 
3282
3282
  /**
3283
3283
  * Completes the current camera flight and moves the camera immediately to its final destination.
3284
- * If no flight is in progress, this this function does nothing.
3284
+ * If no flight is in progress, this function does nothing.
3285
3285
  */
3286
3286
  Camera.prototype.completeFlight = function () {
3287
3287
  if (defined(this._currentFlight)) {
@@ -319,6 +319,24 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
319
319
  */
320
320
  this.hasImplicitContent = false;
321
321
 
322
+ /**
323
+ * Determines whether the tile has renderable content.
324
+ *
325
+ * The loading starts with the assumption that the tile does have
326
+ * renderable content, if the content is not empty.<br>
327
+ * <br>
328
+ * This turns <code>false</code> only when the tile content is loaded
329
+ * and turns out to be a single content that points to an external
330
+ * tileset or implicit content
331
+ * </p>
332
+ *
333
+ * @type {boolean}
334
+ * @readonly
335
+ *
336
+ * @private
337
+ */
338
+ this.hasRenderableContent = !hasEmptyContent;
339
+
322
340
  /**
323
341
  * When <code>true</code>, the tile contains content metadata from implicit tiling. This flag is set
324
342
  * for tiles transcoded by <code>Implicit3DTileContent</code>.
@@ -653,27 +671,6 @@ Object.defineProperties(Cesium3DTile.prototype, {
653
671
  },
654
672
  },
655
673
 
656
- /**
657
- * Determines if the tile's content is renderable. <code>false</code> if the
658
- * tile has empty content or if it points to an external tileset or implicit content
659
- *
660
- * @memberof Cesium3DTile.prototype
661
- *
662
- * @type {boolean}
663
- * @readonly
664
- *
665
- * @private
666
- */
667
- hasRenderableContent: {
668
- get: function () {
669
- return (
670
- !this.hasEmptyContent &&
671
- !this.hasTilesetContent &&
672
- !this.hasImplicitContent
673
- );
674
- },
675
- },
676
-
677
674
  /**
678
675
  * Determines if the tile has available content to render. <code>true</code> if the tile's
679
676
  * content is ready or if it has expired content that renders while new content loads; otherwise,
@@ -1346,10 +1343,12 @@ async function makeContent(tile, arrayBuffer) {
1346
1343
  preprocessed.contentType === Cesium3DTileContentType.IMPLICIT_SUBTREE_JSON
1347
1344
  ) {
1348
1345
  tile.hasImplicitContent = true;
1346
+ tile.hasRenderableContent = false;
1349
1347
  }
1350
1348
 
1351
1349
  if (preprocessed.contentType === Cesium3DTileContentType.EXTERNAL_TILESET) {
1352
1350
  tile.hasTilesetContent = true;
1351
+ tile.hasRenderableContent = false;
1353
1352
  }
1354
1353
 
1355
1354
  let content;
@@ -1729,28 +1728,57 @@ function createBoxFromTransformedRegion(
1729
1728
  }
1730
1729
 
1731
1730
  /**
1731
+ * Creates a TileBoundingVolume from the given region and transform
1732
+ * information.
1733
+ *
1734
+ * This may either be a TileBoundingRegion or a TileOrientedBoundingBox.
1735
+ *
1736
+ * If the given transform is the initial transform, then this will return
1737
+ * a TileBoundingRegion. This will either be the given result parameter,
1738
+ * or a new TileBoundingRegion, if the given result parameter was not
1739
+ * a TileBoundingRegion.
1740
+ *
1741
+ * If the given transform deviates from the initial transform, then this
1742
+ * will return a TileOrientedBoundingBox that was computed by applying
1743
+ * the given transform to the given region. This will either be the
1744
+ * given result parameter, or a new TileOrientedBoundingBox, if the given
1745
+ * result parameter was not a TileOrientedBoundingBox
1746
+ *
1732
1747
  * @private
1733
- * @param {Array} region An array of six numbers that define a bounding geographic region in EPSG:4979 coordinates with the order [west, south, east, north, minimum height, maximum height]
1734
- * @param {Matrix4} transform
1735
- * @param {Matrix4} initialTransform
1736
- * @param {TileBoundingVolume} [result]
1737
- * @returns {TileBoundingVolume}
1748
+ * @param {Array} region An array of six numbers that define a bounding
1749
+ * geographic region in EPSG:4979 coordinates with the order
1750
+ * [west, south, east, north, minimum height, maximum height]
1751
+ * @param {Matrix4} transform The current computedTransform of the tile,
1752
+ * which includes the parent transform (which, in turn, includes the
1753
+ * modelMatrix of the containing tileset)
1754
+ * @param {Matrix4} initialTransform The initial transform of the tile,
1755
+ * before any changes to the modelMatrix of the containing tileset
1756
+ * @param {TileBoundingVolume} [result] An optional result.
1757
+ * @returns {TileBoundingVolume} The resulting bounding volume
1738
1758
  */
1739
1759
  function createRegion(region, transform, initialTransform, result) {
1740
1760
  if (
1741
1761
  !Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8)
1742
1762
  ) {
1763
+ if (result instanceof TileOrientedBoundingBox) {
1764
+ return createBoxFromTransformedRegion(
1765
+ region,
1766
+ transform,
1767
+ initialTransform,
1768
+ result,
1769
+ );
1770
+ }
1743
1771
  return createBoxFromTransformedRegion(
1744
1772
  region,
1745
1773
  transform,
1746
1774
  initialTransform,
1747
- result,
1775
+ undefined,
1748
1776
  );
1749
1777
  }
1750
1778
 
1751
1779
  const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
1752
1780
 
1753
- if (defined(result)) {
1781
+ if (result instanceof TileBoundingRegion) {
1754
1782
  result.rectangle = Rectangle.clone(rectangleRegion, result.rectangle);
1755
1783
  result.minimumHeight = region[4];
1756
1784
  result.maximumHeight = region[5];