@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
|
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"
|
|
7
|
+
"AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmR-yn9MvzP-kKlsEftvba-Ksa9fy6DfgprKJvVPrYflNktZkc_R1DWiCclyPfJDVoQFVG5RAYgC6zo1Y0tjygPXWzKh6a7QBgk7gX6xm7vkHmbExafWckqkicqYw9UkxFf1Fjya64KizMRumKKV-VXV6_CwU0hR7Zv4pDhQDz4bwoyMxi_abRmOIS58oUlATyE.AT1_X4rsxcr3";
|
|
8
8
|
/**
|
|
9
9
|
* Default options for accessing the ArcGIS image tile service.
|
|
10
10
|
*
|
|
@@ -14,6 +14,7 @@ import Ellipsoid from "../Core/Ellipsoid.js";
|
|
|
14
14
|
import Matrix4 from "../Core/Matrix4.js";
|
|
15
15
|
import NearFarScalar from "../Core/NearFarScalar.js";
|
|
16
16
|
import Resource from "../Core/Resource.js";
|
|
17
|
+
import BillboardTexture from "./BillboardTexture.js";
|
|
17
18
|
import HeightReference, {
|
|
18
19
|
isHeightReferenceRelative,
|
|
19
20
|
} from "./HeightReference.js";
|
|
@@ -194,20 +195,17 @@ function Billboard(options, billboardCollection) {
|
|
|
194
195
|
this._distanceDisplayCondition = distanceDisplayCondition;
|
|
195
196
|
this._disableDepthTestDistance = options.disableDepthTestDistance;
|
|
196
197
|
this._id = options.id;
|
|
197
|
-
this._collection = defaultValue(options.collection, billboardCollection);
|
|
198
|
+
this._collection = defaultValue(options.collection, billboardCollection); // Used only for pick ids
|
|
198
199
|
|
|
199
200
|
this._pickId = undefined;
|
|
200
201
|
this._pickPrimitive = defaultValue(options._pickPrimitive, this);
|
|
202
|
+
|
|
201
203
|
this._billboardCollection = billboardCollection;
|
|
202
204
|
this._dirty = false;
|
|
203
|
-
this._index = -1; //Used only by BillboardCollection
|
|
205
|
+
this._index = -1; // Used only by BillboardCollection
|
|
204
206
|
this._batchIndex = undefined; // Used only by Vector3DTilePoints and BillboardCollection
|
|
205
207
|
|
|
206
|
-
this.
|
|
207
|
-
this._imageIndexPromise = undefined;
|
|
208
|
-
this._imageId = undefined;
|
|
209
|
-
this._image = undefined;
|
|
210
|
-
this._imageSubRegion = undefined;
|
|
208
|
+
this._imageTexture = new BillboardTexture(billboardCollection);
|
|
211
209
|
this._imageWidth = undefined;
|
|
212
210
|
this._imageHeight = undefined;
|
|
213
211
|
|
|
@@ -228,17 +226,11 @@ function Billboard(options, billboardCollection) {
|
|
|
228
226
|
}
|
|
229
227
|
}
|
|
230
228
|
|
|
231
|
-
this.
|
|
232
|
-
this._image = image;
|
|
229
|
+
this._imageTexture.loadImage(imageId, image);
|
|
233
230
|
}
|
|
234
231
|
|
|
235
232
|
if (defined(options.imageSubRegion)) {
|
|
236
|
-
this.
|
|
237
|
-
this._imageSubRegion = options.imageSubRegion;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (defined(this._billboardCollection._textureAtlas)) {
|
|
241
|
-
this._loadImage();
|
|
233
|
+
this._imageTexture.addImageSubRegion(imageId, options.imageSubRegion);
|
|
242
234
|
}
|
|
243
235
|
|
|
244
236
|
this._actualClampedPosition = undefined;
|
|
@@ -775,18 +767,19 @@ Object.defineProperties(Billboard.prototype, {
|
|
|
775
767
|
/**
|
|
776
768
|
* Gets or sets a width for the billboard. If undefined, the image width will be used.
|
|
777
769
|
* @memberof Billboard.prototype
|
|
778
|
-
* @type {number}
|
|
770
|
+
* @type {number|undefined}
|
|
779
771
|
*/
|
|
780
772
|
width: {
|
|
781
773
|
get: function () {
|
|
782
|
-
return defaultValue(this._width, this.
|
|
774
|
+
return defaultValue(this._width, this._imageTexture.width);
|
|
783
775
|
},
|
|
784
776
|
set: function (value) {
|
|
785
777
|
//>>includeStart('debug', pragmas.debug);
|
|
786
778
|
if (defined(value)) {
|
|
787
|
-
Check.typeOf.number("
|
|
779
|
+
Check.typeOf.number("width", value);
|
|
788
780
|
}
|
|
789
781
|
//>>includeEnd('debug');
|
|
782
|
+
|
|
790
783
|
if (this._width !== value) {
|
|
791
784
|
this._width = value;
|
|
792
785
|
makeDirty(this, IMAGE_INDEX_INDEX);
|
|
@@ -797,18 +790,19 @@ Object.defineProperties(Billboard.prototype, {
|
|
|
797
790
|
/**
|
|
798
791
|
* Gets or sets a height for the billboard. If undefined, the image height will be used.
|
|
799
792
|
* @memberof Billboard.prototype
|
|
800
|
-
* @type {number}
|
|
793
|
+
* @type {number|undefined}
|
|
801
794
|
*/
|
|
802
795
|
height: {
|
|
803
796
|
get: function () {
|
|
804
|
-
return defaultValue(this._height, this.
|
|
797
|
+
return defaultValue(this._height, this._imageTexture.height);
|
|
805
798
|
},
|
|
806
799
|
set: function (value) {
|
|
807
800
|
//>>includeStart('debug', pragmas.debug);
|
|
808
801
|
if (defined(value)) {
|
|
809
|
-
Check.typeOf.number("
|
|
802
|
+
Check.typeOf.number("height", value);
|
|
810
803
|
}
|
|
811
804
|
//>>includeEnd('debug');
|
|
805
|
+
|
|
812
806
|
if (this._height !== value) {
|
|
813
807
|
this._height = value;
|
|
814
808
|
makeDirty(this, IMAGE_INDEX_INDEX);
|
|
@@ -964,42 +958,69 @@ Object.defineProperties(Billboard.prototype, {
|
|
|
964
958
|
*/
|
|
965
959
|
image: {
|
|
966
960
|
get: function () {
|
|
967
|
-
return this.
|
|
961
|
+
return this._imageTexture.id;
|
|
968
962
|
},
|
|
969
963
|
set: function (value) {
|
|
970
964
|
if (!defined(value)) {
|
|
971
|
-
this.
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
this.setImage(value, value);
|
|
965
|
+
this._imageTexture.unload();
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
let id;
|
|
970
|
+
if (typeof value === "string") {
|
|
971
|
+
id = value;
|
|
979
972
|
} else if (value instanceof Resource) {
|
|
980
|
-
|
|
973
|
+
id = value._url;
|
|
981
974
|
} else if (defined(value.src)) {
|
|
982
|
-
|
|
975
|
+
id = value.src;
|
|
983
976
|
} else {
|
|
984
|
-
|
|
977
|
+
id = createGuid();
|
|
985
978
|
}
|
|
979
|
+
|
|
980
|
+
this._imageTexture.loadImage(id, value);
|
|
986
981
|
},
|
|
987
982
|
},
|
|
988
983
|
|
|
989
984
|
/**
|
|
990
985
|
* When <code>true</code>, this billboard is ready to render, i.e., the image
|
|
991
986
|
* has been downloaded and the WebGL resources are created.
|
|
992
|
-
*
|
|
993
987
|
* @memberof Billboard.prototype
|
|
994
|
-
*
|
|
995
988
|
* @type {boolean}
|
|
996
989
|
* @readonly
|
|
997
|
-
*
|
|
998
990
|
* @default false
|
|
999
991
|
*/
|
|
1000
992
|
ready: {
|
|
1001
993
|
get: function () {
|
|
1002
|
-
return this.
|
|
994
|
+
return this._imageTexture.ready;
|
|
995
|
+
},
|
|
996
|
+
},
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* If defined, this error was encountered during the loading process.
|
|
1000
|
+
* @memberof Billboard.prototype
|
|
1001
|
+
* @type {Error|undefined}
|
|
1002
|
+
* @readonly
|
|
1003
|
+
* @private
|
|
1004
|
+
*/
|
|
1005
|
+
loadError: {
|
|
1006
|
+
get: function () {
|
|
1007
|
+
return this._imageTexture.loadError;
|
|
1008
|
+
},
|
|
1009
|
+
},
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Used by <code>billboardCollection</code> to track which billboards to update based on image load status.
|
|
1013
|
+
* @memberof Billboard.prototype
|
|
1014
|
+
* @type {boolean}
|
|
1015
|
+
* @private
|
|
1016
|
+
* @default false
|
|
1017
|
+
*/
|
|
1018
|
+
textureDirty: {
|
|
1019
|
+
get: function () {
|
|
1020
|
+
return this._imageTexture.dirty;
|
|
1021
|
+
},
|
|
1022
|
+
set: function (value) {
|
|
1023
|
+
this._imageTexture.dirty = value;
|
|
1003
1024
|
},
|
|
1004
1025
|
},
|
|
1005
1026
|
|
|
@@ -1120,8 +1141,7 @@ Billboard.prototype._updateClamping = function () {
|
|
|
1120
1141
|
|
|
1121
1142
|
const scratchCartographic = new Cartographic();
|
|
1122
1143
|
Billboard._updateClamping = function (collection, owner) {
|
|
1123
|
-
|
|
1124
|
-
if (!defined(scene)) {
|
|
1144
|
+
if (!defined(collection) || !defined(collection._scene)) {
|
|
1125
1145
|
//>>includeStart('debug', pragmas.debug);
|
|
1126
1146
|
if (owner._heightReference !== HeightReference.NONE) {
|
|
1127
1147
|
throw new DeveloperError(
|
|
@@ -1131,11 +1151,10 @@ Billboard._updateClamping = function (collection, owner) {
|
|
|
1131
1151
|
//>>includeEnd('debug');
|
|
1132
1152
|
return;
|
|
1133
1153
|
}
|
|
1134
|
-
|
|
1154
|
+
const scene = collection._scene;
|
|
1135
1155
|
const ellipsoid = defaultValue(scene.ellipsoid, Ellipsoid.default);
|
|
1136
1156
|
|
|
1137
1157
|
const mode = scene.frameState.mode;
|
|
1138
|
-
|
|
1139
1158
|
const modeChanged = mode !== owner._mode;
|
|
1140
1159
|
owner._mode = mode;
|
|
1141
1160
|
|
|
@@ -1201,68 +1220,14 @@ Billboard._updateClamping = function (collection, owner) {
|
|
|
1201
1220
|
updateFunction(scratchCartographic);
|
|
1202
1221
|
};
|
|
1203
1222
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
const that = this;
|
|
1213
|
-
function completeImageLoad(index) {
|
|
1214
|
-
if (
|
|
1215
|
-
that._imageId !== imageId ||
|
|
1216
|
-
that._image !== image ||
|
|
1217
|
-
!BoundingRectangle.equals(that._imageSubRegion, imageSubRegion)
|
|
1218
|
-
) {
|
|
1219
|
-
// another load occurred before this one finished, ignore the index
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
// fill in imageWidth and imageHeight
|
|
1224
|
-
const textureCoordinates = atlas.textureCoordinates[index];
|
|
1225
|
-
that._imageWidth = atlas.texture.width * textureCoordinates.width;
|
|
1226
|
-
that._imageHeight = atlas.texture.height * textureCoordinates.height;
|
|
1227
|
-
|
|
1228
|
-
that._imageIndex = index;
|
|
1229
|
-
that._ready = true;
|
|
1230
|
-
that._image = undefined;
|
|
1231
|
-
that._imageIndexPromise = undefined;
|
|
1232
|
-
makeDirty(that, IMAGE_INDEX_INDEX);
|
|
1233
|
-
|
|
1234
|
-
const scene = that._billboardCollection._scene;
|
|
1235
|
-
if (!defined(scene)) {
|
|
1236
|
-
return;
|
|
1237
|
-
}
|
|
1238
|
-
// Request a new render in request render mode
|
|
1239
|
-
scene.frameState.afterRender.push(() => true);
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
if (defined(image)) {
|
|
1243
|
-
imageIndexPromise = atlas.addImage(imageId, image);
|
|
1244
|
-
}
|
|
1245
|
-
if (defined(imageSubRegion)) {
|
|
1246
|
-
imageIndexPromise = atlas.addSubRegion(imageId, imageSubRegion);
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
this._imageIndexPromise = imageIndexPromise;
|
|
1250
|
-
|
|
1251
|
-
if (!defined(imageIndexPromise)) {
|
|
1252
|
-
return;
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
// If the promise has already successfully resolved, we can return immediately without waiting a frame
|
|
1256
|
-
const index = atlas.getImageIndex(imageId);
|
|
1257
|
-
if (defined(index) && !defined(imageSubRegion)) {
|
|
1258
|
-
completeImageLoad(index);
|
|
1259
|
-
return;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
imageIndexPromise.then(completeImageLoad).catch(function (error) {
|
|
1263
|
-
console.error(`Error loading image for billboard: ${error}`);
|
|
1264
|
-
that._imageIndexPromise = undefined;
|
|
1265
|
-
});
|
|
1223
|
+
/**
|
|
1224
|
+
* Get the texture coordinates for reading the loaded texture in shaders.
|
|
1225
|
+
* @param {BoundingRectangle} [result] The modified result parameter or a new BoundingRectangle instance if one was not provided.
|
|
1226
|
+
* @return {BoundingRectangle} The modified result parameter or a new BoundingRectangle instance if one was not provided.
|
|
1227
|
+
* @private
|
|
1228
|
+
*/
|
|
1229
|
+
Billboard.prototype.computeTextureCoordinates = function (result) {
|
|
1230
|
+
return this._imageTexture.computeTextureCoordinates(result);
|
|
1266
1231
|
};
|
|
1267
1232
|
|
|
1268
1233
|
/**
|
|
@@ -1301,26 +1266,24 @@ Billboard.prototype._loadImage = function () {
|
|
|
1301
1266
|
*/
|
|
1302
1267
|
Billboard.prototype.setImage = function (id, image) {
|
|
1303
1268
|
//>>includeStart('debug', pragmas.debug);
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
if (!defined(image)) {
|
|
1308
|
-
throw new DeveloperError("image is required.");
|
|
1309
|
-
}
|
|
1269
|
+
Check.typeOf.string("id", id);
|
|
1270
|
+
Check.defined("image", image);
|
|
1310
1271
|
//>>includeEnd('debug');
|
|
1311
1272
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1273
|
+
this._imageTexture.loadImage(id, image);
|
|
1274
|
+
};
|
|
1315
1275
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1276
|
+
/**
|
|
1277
|
+
* Copy the values of an existing billboard texture into this one. Useful for prevent downtime for images that have already been loaded.
|
|
1278
|
+
* @private
|
|
1279
|
+
* @param {BillboardTexture} billboardTexture
|
|
1280
|
+
*/
|
|
1281
|
+
Billboard.prototype.setImageTexture = function (billboardTexture) {
|
|
1282
|
+
//>>includeStart('debug', pragmas.debug);
|
|
1283
|
+
Check.defined("billboardTexture", billboardTexture);
|
|
1284
|
+
//>>includeEnd('debug');
|
|
1320
1285
|
|
|
1321
|
-
|
|
1322
|
-
this._loadImage();
|
|
1323
|
-
}
|
|
1286
|
+
BillboardTexture.clone(billboardTexture, this._imageTexture);
|
|
1324
1287
|
};
|
|
1325
1288
|
|
|
1326
1289
|
/**
|
|
@@ -1334,28 +1297,11 @@ Billboard.prototype.setImage = function (id, image) {
|
|
|
1334
1297
|
*/
|
|
1335
1298
|
Billboard.prototype.setImageSubRegion = function (id, subRegion) {
|
|
1336
1299
|
//>>includeStart('debug', pragmas.debug);
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
}
|
|
1340
|
-
if (!defined(subRegion)) {
|
|
1341
|
-
throw new DeveloperError("subRegion is required.");
|
|
1342
|
-
}
|
|
1300
|
+
Check.typeOf.string("id", id);
|
|
1301
|
+
Check.defined("subRegion", subRegion);
|
|
1343
1302
|
//>>includeEnd('debug');
|
|
1344
1303
|
|
|
1345
|
-
|
|
1346
|
-
this._imageId === id &&
|
|
1347
|
-
BoundingRectangle.equals(this._imageSubRegion, subRegion)
|
|
1348
|
-
) {
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
this._imageIndex = -1;
|
|
1353
|
-
this._imageId = id;
|
|
1354
|
-
this._imageSubRegion = BoundingRectangle.clone(subRegion);
|
|
1355
|
-
|
|
1356
|
-
if (defined(this._billboardCollection._textureAtlas)) {
|
|
1357
|
-
this._loadImage();
|
|
1358
|
-
}
|
|
1304
|
+
this._imageTexture.addImageSubRegion(id, subRegion);
|
|
1359
1305
|
};
|
|
1360
1306
|
|
|
1361
1307
|
Billboard.prototype._setTranslate = function (value) {
|
|
@@ -1562,7 +1508,7 @@ Billboard.getScreenSpaceBoundingBox = function (
|
|
|
1562
1508
|
* Determines if this billboard equals another billboard. Billboards are equal if all their properties
|
|
1563
1509
|
* are equal. Billboards in different collections can be equal.
|
|
1564
1510
|
*
|
|
1565
|
-
* @param {Billboard} other The billboard to compare for equality.
|
|
1511
|
+
* @param {Billboard} [other] The billboard to compare for equality.
|
|
1566
1512
|
* @returns {boolean} <code>true</code> if the billboards are equal; otherwise, <code>false</code>.
|
|
1567
1513
|
*/
|
|
1568
1514
|
Billboard.prototype.equals = function (other) {
|
|
@@ -1571,13 +1517,12 @@ Billboard.prototype.equals = function (other) {
|
|
|
1571
1517
|
(defined(other) &&
|
|
1572
1518
|
this._id === other._id &&
|
|
1573
1519
|
Cartesian3.equals(this._position, other._position) &&
|
|
1574
|
-
this.
|
|
1520
|
+
this.image === other.image &&
|
|
1575
1521
|
this._show === other._show &&
|
|
1576
1522
|
this._scale === other._scale &&
|
|
1577
1523
|
this._verticalOrigin === other._verticalOrigin &&
|
|
1578
1524
|
this._horizontalOrigin === other._horizontalOrigin &&
|
|
1579
1525
|
this._heightReference === other._heightReference &&
|
|
1580
|
-
BoundingRectangle.equals(this._imageSubRegion, other._imageSubRegion) &&
|
|
1581
1526
|
Color.equals(this._color, other._color) &&
|
|
1582
1527
|
Cartesian2.equals(this._pixelOffset, other._pixelOffset) &&
|
|
1583
1528
|
Cartesian2.equals(this._translate, other._translate) &&
|