@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.
- package/Build/Workers/{chunk-APCS5YJI.js → chunk-25TOENEE.js} +7 -7
- package/Build/Workers/{chunk-FNCXBBCF.js → chunk-2AVIUB5H.js} +2 -2
- package/Build/Workers/{chunk-OZTFRHA2.js → chunk-3JZGPJMZ.js} +6 -6
- package/Build/Workers/{chunk-5JY4LYO3.js → chunk-3LHBH4TC.js} +7 -7
- package/Build/Workers/{chunk-MGABCOOH.js → chunk-3LZF23RY.js} +6 -6
- package/Build/Workers/{chunk-AXYZUG4N.js → chunk-5S2B46UQ.js} +1 -1
- package/Build/Workers/{chunk-2SRHVCFD.js → chunk-67ONR44K.js} +6 -6
- package/Build/Workers/{chunk-PBJQFLKS.js → chunk-6EDBC234.js} +11 -11
- package/Build/Workers/{chunk-GSLKQJM2.js → chunk-6EV4VOET.js} +10 -10
- package/Build/Workers/{chunk-OGRXNUR2.js → chunk-7ITUZTFH.js} +1 -1
- package/Build/Workers/{chunk-IP7F2MVW.js → chunk-ARVZCY6X.js} +7 -7
- package/Build/Workers/{chunk-EYZFEJX3.js → chunk-B2UQN3DH.js} +6 -6
- package/Build/Workers/{chunk-WE4KF4AM.js → chunk-B2Y4ZS6X.js} +9 -9
- package/Build/Workers/{chunk-DWIKWWEE.js → chunk-BD2TPFGC.js} +5 -5
- package/Build/Workers/{chunk-5ICYLS6B.js → chunk-CHX2K5AC.js} +10 -10
- package/Build/Workers/{chunk-NQDKNE7V.js → chunk-CJGVEABL.js} +13 -13
- package/Build/Workers/{chunk-B34JXFHF.js → chunk-DYJHEP3B.js} +5 -5
- package/Build/Workers/{chunk-J7BMSSY7.js → chunk-E3H7AVMK.js} +13 -13
- package/Build/Workers/{chunk-TOHDFUJM.js → chunk-EZNAJPP5.js} +4 -4
- package/Build/Workers/{chunk-K62EHZFT.js → chunk-F7ZI463G.js} +15 -15
- package/Build/Workers/{chunk-EJ5DT5BP.js → chunk-FMZ5CX6V.js} +1 -1
- package/Build/Workers/{chunk-OARMSJUU.js → chunk-FRAWHNSR.js} +2 -2
- package/Build/Workers/{chunk-S3UM4OKP.js → chunk-GGV2XJHE.js} +7 -7
- package/Build/Workers/{chunk-SAKQO5NX.js → chunk-GK4QU6QI.js} +2 -2
- package/Build/Workers/{chunk-LFUFGHL3.js → chunk-HYPB7FAV.js} +10 -10
- package/Build/Workers/{chunk-3SCCWLZS.js → chunk-I4HO2ED2.js} +9 -9
- package/Build/Workers/{chunk-K6SQV4IS.js → chunk-IGINOLDX.js} +6 -6
- package/Build/Workers/{chunk-IXNXKVOB.js → chunk-ISQSYLZY.js} +4 -4
- package/Build/Workers/{chunk-PM76TX2X.js → chunk-JZAMRL5I.js} +6 -6
- package/Build/Workers/{chunk-CBE4HRBH.js → chunk-K5G2WELR.js} +7 -7
- package/Build/Workers/{chunk-EHGQQA7C.js → chunk-L5SO4Y5V.js} +1 -1
- package/Build/Workers/{chunk-M2AA2ARJ.js → chunk-LCMJQVIF.js} +11 -11
- package/Build/Workers/{chunk-HI73PIPQ.js → chunk-MWJW37I7.js} +2 -2
- package/Build/Workers/{chunk-WAJNX74N.js → chunk-NAGMYRDW.js} +27 -20
- package/Build/Workers/{chunk-WUIDEXAN.js → chunk-OYO6TKMU.js} +7 -7
- package/Build/Workers/{chunk-YVGU235V.js → chunk-PUTA3AE2.js} +4 -4
- package/Build/Workers/{chunk-ZWSWJYJP.js → chunk-Q5BHMNKU.js} +13 -13
- package/Build/Workers/{chunk-LQT2ZK7D.js → chunk-QTEX3Y4V.js} +17 -17
- package/Build/Workers/{chunk-UBAHTE4Q.js → chunk-QZKN2RXM.js} +1 -1
- package/Build/Workers/{chunk-T34EOLFR.js → chunk-RO2Z3LCR.js} +14 -14
- package/Build/Workers/{chunk-PTFIVVLX.js → chunk-RRN6LRDX.js} +12 -12
- package/Build/Workers/{chunk-B6IJY6AN.js → chunk-SLIA3GQP.js} +7 -7
- package/Build/Workers/{chunk-GIOZHX7U.js → chunk-TFCOEX3W.js} +2 -2
- package/Build/Workers/{chunk-KRVALCCI.js → chunk-TU6ZXHVU.js} +5 -5
- package/Build/Workers/{chunk-54I6VSRP.js → chunk-VJ2PDF64.js} +6 -6
- package/Build/Workers/{chunk-BMFWWTD7.js → chunk-VMVPONIV.js} +5 -5
- package/Build/Workers/{chunk-CNPP6TQ2.js → chunk-WPXU45PH.js} +4 -4
- package/Build/Workers/{chunk-2ONAV62A.js → chunk-XDHM4G3P.js} +7 -7
- package/Build/Workers/{chunk-KO232FLP.js → chunk-XED3RXKO.js} +2 -2
- package/Build/Workers/{chunk-5I3LPAS7.js → chunk-YNYCGTQH.js} +5 -5
- package/Build/Workers/{chunk-THDHWSEJ.js → chunk-Z4SI54EB.js} +4 -4
- package/Build/Workers/{chunk-R2KGFZBA.js → chunk-ZVDLC3T4.js} +13 -13
- package/Build/Workers/combineGeometry.js +22 -22
- package/Build/Workers/createBoxGeometry.js +16 -16
- package/Build/Workers/createBoxOutlineGeometry.js +14 -14
- package/Build/Workers/createCircleGeometry.js +24 -24
- package/Build/Workers/createCircleOutlineGeometry.js +17 -17
- package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
- package/Build/Workers/createCorridorGeometry.js +27 -27
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
- package/Build/Workers/createCylinderGeometry.js +18 -18
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipseGeometry.js +24 -24
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
- package/Build/Workers/createEllipsoidGeometry.js +17 -17
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
- package/Build/Workers/createFrustumGeometry.js +16 -16
- package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
- package/Build/Workers/createGeometry.js +22 -22
- package/Build/Workers/createGroundPolylineGeometry.js +20 -20
- package/Build/Workers/createPlaneGeometry.js +14 -14
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
- package/Build/Workers/createPolygonGeometry.js +30 -30
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createPolylineGeometry.js +23 -23
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
- package/Build/Workers/createRectangleGeometry.js +25 -25
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
- package/Build/Workers/createSimplePolylineGeometry.js +21 -21
- package/Build/Workers/createSphereGeometry.js +17 -17
- package/Build/Workers/createSphereOutlineGeometry.js +16 -16
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
- package/Build/Workers/createVectorTileGeometries.js +22 -22
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -20
- package/Build/Workers/createVectorTilePolylines.js +13 -13
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
- package/Build/Workers/createVerticesFromHeightmap.js +20 -20
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
- package/Build/Workers/createWallGeometry.js +22 -22
- package/Build/Workers/createWallOutlineGeometry.js +21 -21
- package/Build/Workers/decodeDraco.js +15 -14
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/transcodeKTX2.js +50 -43
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
- package/Source/Core/Color.js +3 -3
- package/Source/Core/Credit.js +3 -3
- package/Source/Core/DistanceDisplayCondition.js +3 -3
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/OrientedBoundingBox.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +26 -4
- package/Source/Core/Spherical.js +3 -3
- package/Source/Core/TexturePacker.js +166 -0
- package/Source/Core/writeTextToCanvas.js +0 -1
- package/Source/DataSources/BillboardVisualizer.js +3 -3
- package/Source/DataSources/BoundingSphereState.js +3 -3
- package/Source/DataSources/DataSourceClock.js +1 -1
- package/Source/DataSources/DataSourceDisplay.js +5 -2
- package/Source/DataSources/EntityCluster.js +44 -19
- package/Source/Renderer/AutomaticUniforms.js +2 -2
- package/Source/Renderer/Context.js +0 -4
- package/Source/Renderer/Texture.js +6 -5
- package/Source/Renderer/TextureAtlas.js +802 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +87 -142
- package/Source/Scene/BillboardCollection.js +132 -202
- package/Source/Scene/BillboardLoadState.js +44 -0
- package/Source/Scene/BillboardTexture.js +348 -0
- package/Source/Scene/Camera.js +2 -2
- package/Source/Scene/Cesium3DTile.js +56 -28
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +403 -132
- package/Source/Scene/Cesium3DTilesetStatistics.js +0 -1
- package/Source/Scene/ClippingPolygon.js +2 -2
- package/Source/Scene/Expression.js +1 -0
- package/Source/Scene/GltfDracoLoader.js +45 -0
- package/Source/Scene/GltfIndexBufferLoader.js +5 -0
- package/Source/Scene/GltfLoader.js +22 -9
- package/Source/Scene/GltfVertexBufferLoader.js +13 -0
- package/Source/Scene/ITwinData.js +47 -1
- package/Source/Scene/ImageryLayer.js +1 -1
- package/Source/Scene/ImplicitSubtree.js +2 -0
- package/Source/Scene/KeyframeNode.js +16 -2
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/LabelCollection.js +212 -193
- package/Source/Scene/Megatexture.js +145 -81
- package/Source/Scene/Model/CustomShader.js +0 -2
- package/Source/Scene/Model/Model.js +1 -1
- package/Source/Scene/Model/ModelUtility.js +5 -1
- package/Source/Scene/Multiple3DTileContent.js +21 -8
- package/Source/Scene/PointPrimitive.js +1 -1
- package/Source/Scene/ResourceCache.js +17 -1
- package/Source/Scene/Scene.js +39 -15
- package/Source/Scene/ScreenSpaceCameraController.js +0 -8
- package/Source/Scene/SpatialNode.js +4 -11
- package/Source/Scene/Vector3DTilePoints.js +2 -5
- package/Source/Scene/VoxelBoxShape.js +12 -5
- package/Source/Scene/VoxelCell.js +6 -5
- package/Source/Scene/VoxelContent.js +171 -107
- package/Source/Scene/VoxelCylinderShape.js +65 -58
- package/Source/Scene/VoxelEllipsoidShape.js +15 -5
- package/Source/Scene/VoxelMetadataOrder.js +12 -0
- package/Source/Scene/VoxelPrimitive.js +245 -53
- package/Source/Scene/VoxelProvider.js +44 -29
- package/Source/Scene/VoxelRenderResources.js +30 -7
- package/Source/Scene/VoxelShape.js +10 -3
- package/Source/Scene/VoxelTraversal.js +326 -166
- package/Source/Scene/WebMapTileServiceImageryProvider.js +2 -2
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +5 -8
- package/Source/Scene/processVoxelProperties.js +3 -0
- package/Source/Shaders/GlobeFS.glsl +10 -1
- package/Source/Shaders/GlobeFS.js +10 -1
- package/Source/Shaders/PolylineCommon.glsl +1 -1
- package/Source/Shaders/PolylineCommon.js +1 -1
- package/Source/Shaders/Voxels/Megatexture.glsl +4 -16
- package/Source/Shaders/Voxels/Megatexture.js +4 -16
- package/Source/Shaders/Voxels/Octree.glsl +44 -7
- package/Source/Shaders/Voxels/Octree.js +44 -7
- package/Source/Shaders/Voxels/VoxelFS.glsl +9 -15
- package/Source/Shaders/Voxels/VoxelFS.js +9 -15
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +15 -15
- package/Source/Shaders/Voxels/convertUvToCylinder.js +15 -15
- package/Source/Widget/CesiumWidget.js +16 -10
- package/Source/Workers/decodeDraco.js +4 -4
- package/index.d.ts +321 -110
- package/index.js +209 -205
- package/package.json +2 -2
- 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;
|
package/Source/Scene/Camera.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
1734
|
-
*
|
|
1735
|
-
*
|
|
1736
|
-
* @param {
|
|
1737
|
-
*
|
|
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
|
-
|
|
1775
|
+
undefined,
|
|
1748
1776
|
);
|
|
1749
1777
|
}
|
|
1750
1778
|
|
|
1751
1779
|
const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
|
|
1752
1780
|
|
|
1753
|
-
if (
|
|
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];
|