@hztxi/cesium-engine 25.0.0 → 25.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/chunk-24H74D3Q.js +102 -0
- package/Build/Workers/chunk-27UNFKLP.js +78 -0
- package/Build/Workers/chunk-2NIRC5FH.js +398 -0
- package/Build/Workers/chunk-2YHL3RU5.js +162 -0
- package/Build/Workers/chunk-327KDYY5.js +241 -0
- package/Build/Workers/chunk-36Y4HYYW.js +1067 -0
- package/Build/Workers/chunk-3EB75M2K.js +2342 -0
- package/Build/Workers/chunk-3HGZ7PIQ.js +1483 -0
- package/Build/Workers/chunk-3S3R4BCY.js +280 -0
- package/Build/Workers/chunk-3TK6563P.js +9230 -0
- package/Build/Workers/chunk-4A34KHP2.js +138 -0
- package/Build/Workers/chunk-4B3I4BQ3.js +454 -0
- package/Build/Workers/chunk-4GKVVYGC.js +124 -0
- package/Build/Workers/chunk-4NOKV4XU.js +301 -0
- package/Build/Workers/chunk-4VMEH443.js +754 -0
- package/Build/Workers/chunk-4VO5KZVX.js +693 -0
- package/Build/Workers/chunk-53ITLB2Q.js +288 -0
- package/Build/Workers/chunk-5523YTNX.js +352 -0
- package/Build/Workers/chunk-562MM6RC.js +682 -0
- package/Build/Workers/chunk-5BQXC3BP.js +837 -0
- package/Build/Workers/chunk-5DHF2GEC.js +497 -0
- package/Build/Workers/chunk-5EN3SEJC.js +44 -0
- package/Build/Workers/chunk-5NSH64L5.js +368 -0
- package/Build/Workers/chunk-5RSLOB22.js +511 -0
- package/Build/Workers/chunk-5SLGYIPO.js +454 -0
- package/Build/Workers/chunk-65RILO72.js +76 -0
- package/Build/Workers/chunk-6A74XDJV.js +1054 -0
- package/Build/Workers/chunk-6CAFY3E7.js +280 -0
- package/Build/Workers/chunk-6IWHUZUQ.js +959 -0
- package/Build/Workers/chunk-6JM3OV5P.js +163 -0
- package/Build/Workers/chunk-6ROOPL5F.js +455 -0
- package/Build/Workers/chunk-6SQMSSOR.js +352 -0
- package/Build/Workers/chunk-6SZK4XE5.js +1800 -0
- package/Build/Workers/chunk-6V5GAERI.js +288 -0
- package/Build/Workers/chunk-6XE6USHI.js +280 -0
- package/Build/Workers/chunk-6YMLC7BS.js +1067 -0
- package/Build/Workers/chunk-7BWPTYVV.js +1992 -0
- package/Build/Workers/chunk-7QXAVVZH.js +9230 -0
- package/Build/Workers/chunk-7SUI2JKP.js +162 -0
- package/Build/Workers/chunk-A4AIHOC7.js +476 -0
- package/Build/Workers/chunk-AFBRALW3.js +3620 -0
- package/Build/Workers/chunk-AGANEUZR.js +305 -0
- package/Build/Workers/chunk-AIA3JN4E.js +171 -0
- package/Build/Workers/chunk-AJ4TSZQD.js +352 -0
- package/Build/Workers/chunk-AMW7Q4HY.js +78 -0
- package/Build/Workers/chunk-ANB53XEA.js +198 -0
- package/Build/Workers/chunk-APAN2W5B.js +630 -0
- package/Build/Workers/chunk-AWP7JHXS.js +58 -0
- package/Build/Workers/chunk-AXAP4UXD.js +973 -0
- package/Build/Workers/chunk-B2MY5ZT4.js +241 -0
- package/Build/Workers/chunk-BUS2WCDM.js +1067 -0
- package/Build/Workers/chunk-BVOP4FBU.js +778 -0
- package/Build/Workers/chunk-CCSHJCGX.js +56 -0
- package/Build/Workers/chunk-CUJKQD6C.js +1287 -0
- package/Build/Workers/chunk-D6XIXIZN.js +57 -0
- package/Build/Workers/chunk-DOJQOYSZ.js +1344 -0
- package/Build/Workers/chunk-DSOWTJU3.js +3201 -0
- package/Build/Workers/chunk-DWNGALVJ.js +147 -0
- package/Build/Workers/chunk-E4SAHWMA.js +1992 -0
- package/Build/Workers/chunk-EJES53XD.js +147 -0
- package/Build/Workers/chunk-FEMEGP72.js +97 -0
- package/Build/Workers/chunk-FPUTHLEQ.js +73 -0
- package/Build/Workers/chunk-FSGWPS5K.js +102 -0
- package/Build/Workers/chunk-FVGN2Y5F.js +414 -0
- package/Build/Workers/chunk-FYOTKGMD.js +38 -0
- package/Build/Workers/chunk-FYOU33DL.js +454 -0
- package/Build/Workers/chunk-FZQTWCZX.js +138 -0
- package/Build/Workers/chunk-G7QZ6W7K.js +56 -0
- package/Build/Workers/chunk-GBYWJNH6.js +455 -0
- package/Build/Workers/chunk-H62GX37Y.js +414 -0
- package/Build/Workers/chunk-HA42BW2W.js +73 -0
- package/Build/Workers/chunk-HGDGYWXB.js +368 -0
- package/Build/Workers/chunk-HLCNW67V.js +162 -0
- package/Build/Workers/chunk-HM6KRMLB.js +682 -0
- package/Build/Workers/chunk-HOOAYVKT.js +754 -0
- package/Build/Workers/chunk-HPRR2MW2.js +9230 -0
- package/Build/Workers/chunk-HVIAU36M.js +124 -0
- package/Build/Workers/chunk-I6PQQIM5.js +257 -0
- package/Build/Workers/chunk-JHL6DEKL.js +1287 -0
- package/Build/Workers/chunk-K3SIFA6H.js +352 -0
- package/Build/Workers/chunk-KFRGYJLT.js +171 -0
- package/Build/Workers/chunk-KGNDVO6V.js +497 -0
- package/Build/Workers/chunk-KIRR4SHO.js +38 -0
- package/Build/Workers/chunk-KKXT553B.js +2719 -0
- package/Build/Workers/chunk-KM3TU6SW.js +101 -0
- package/Build/Workers/chunk-KTHM63AY.js +837 -0
- package/Build/Workers/chunk-LANT2AAI.js +398 -0
- package/Build/Workers/chunk-LC2DM3UY.js +352 -0
- package/Build/Workers/chunk-LDTDF3GI.js +511 -0
- package/Build/Workers/chunk-LFVZBOFT.js +140 -0
- package/Build/Workers/chunk-LPWXXHTU.js +2342 -0
- package/Build/Workers/chunk-LU6LZORF.js +3620 -0
- package/Build/Workers/chunk-LZI4ZK6U.js +97 -0
- package/Build/Workers/chunk-M3YCBXY6.js +97 -0
- package/Build/Workers/chunk-M6XP5U6F.js +959 -0
- package/Build/Workers/chunk-MG54QB2S.js +1287 -0
- package/Build/Workers/chunk-MNKWZJLE.js +754 -0
- package/Build/Workers/chunk-MR7LJQY3.js +1344 -0
- package/Build/Workers/chunk-MVCGWYYA.js +693 -0
- package/Build/Workers/chunk-N4ECLSTH.js +163 -0
- package/Build/Workers/chunk-N52ZLKZ3.js +73 -0
- package/Build/Workers/chunk-N54RGG53.js +398 -0
- package/Build/Workers/chunk-NG6PINOD.js +973 -0
- package/Build/Workers/chunk-NO4VBMKQ.js +387 -0
- package/Build/Workers/chunk-NOOOB6XR.js +76 -0
- package/Build/Workers/chunk-NRIECATP.js +124 -0
- package/Build/Workers/chunk-NSTJ4RH4.js +198 -0
- package/Build/Workers/chunk-NW27SGND.js +2719 -0
- package/Build/Workers/chunk-O7JC67VX.js +1483 -0
- package/Build/Workers/chunk-OGSPRAJN.js +414 -0
- package/Build/Workers/chunk-OI6UMRBT.js +368 -0
- package/Build/Workers/chunk-OJMOQSS5.js +387 -0
- package/Build/Workers/chunk-P2DEQUE6.js +301 -0
- package/Build/Workers/chunk-PAO4TRRA.js +497 -0
- package/Build/Workers/chunk-PEK6L3A2.js +102 -0
- package/Build/Workers/chunk-PLMDKE2G.js +57 -0
- package/Build/Workers/chunk-Q2MV7V3J.js +1344 -0
- package/Build/Workers/chunk-Q3JUKGCA.js +305 -0
- package/Build/Workers/chunk-Q56GS53F.js +455 -0
- package/Build/Workers/chunk-R3E7ZNXL.js +44 -0
- package/Build/Workers/chunk-RGNURFR5.js +1992 -0
- package/Build/Workers/chunk-RHVCL4BF.js +3620 -0
- package/Build/Workers/chunk-S2SZ2HYA.js +101 -0
- package/Build/Workers/chunk-S7NAPXAR.js +305 -0
- package/Build/Workers/chunk-SAFIA66W.js +140 -0
- package/Build/Workers/chunk-SLZBHAWM.js +837 -0
- package/Build/Workers/chunk-SOD6C4T2.js +682 -0
- package/Build/Workers/chunk-SOMBAQ6X.js +3201 -0
- package/Build/Workers/chunk-SOOUWXOJ.js +198 -0
- package/Build/Workers/chunk-SSNBEN3T.js +3201 -0
- package/Build/Workers/chunk-SZONDGD2.js +778 -0
- package/Build/Workers/chunk-TT3NOX52.js +257 -0
- package/Build/Workers/chunk-TT6EXCGT.js +387 -0
- package/Build/Workers/chunk-UA3ZQQGQ.js +352 -0
- package/Build/Workers/chunk-UOXL2W6I.js +1800 -0
- package/Build/Workers/chunk-UQABUNQP.js +301 -0
- package/Build/Workers/chunk-UUN6ELAF.js +476 -0
- package/Build/Workers/chunk-UZ7FDKAX.js +1054 -0
- package/Build/Workers/chunk-VAYNR45Y.js +219 -0
- package/Build/Workers/chunk-VDJVNJXW.js +2342 -0
- package/Build/Workers/chunk-VG4FKBIJ.js +140 -0
- package/Build/Workers/chunk-VU2OEFZS.js +511 -0
- package/Build/Workers/chunk-VYTIQ2Y2.js +630 -0
- package/Build/Workers/chunk-W5MRHFMR.js +288 -0
- package/Build/Workers/chunk-WA2OK3VI.js +76 -0
- package/Build/Workers/chunk-WHJCVALR.js +241 -0
- package/Build/Workers/chunk-WKB3ASRI.js +973 -0
- package/Build/Workers/chunk-WLDDKODU.js +44 -0
- package/Build/Workers/chunk-WMSNHJUP.js +476 -0
- package/Build/Workers/chunk-WWOR75YX.js +778 -0
- package/Build/Workers/chunk-X4A7LVKE.js +219 -0
- package/Build/Workers/chunk-XFMCNWLM.js +2719 -0
- package/Build/Workers/chunk-XGU44EOV.js +219 -0
- package/Build/Workers/chunk-XIIIDBAK.js +171 -0
- package/Build/Workers/chunk-XLMFFASL.js +1483 -0
- package/Build/Workers/chunk-XNSQLK46.js +138 -0
- package/Build/Workers/chunk-Y2TJP7FF.js +959 -0
- package/Build/Workers/chunk-Y7LAUPYL.js +1054 -0
- package/Build/Workers/chunk-YMIPCEQ6.js +1800 -0
- package/Build/Workers/chunk-YQVAKERA.js +57 -0
- package/Build/Workers/chunk-YWXQX4RS.js +147 -0
- package/Build/Workers/chunk-YZTJZDOY.js +693 -0
- package/Build/Workers/chunk-ZOMW6KCQ.js +56 -0
- package/Build/Workers/chunk-ZY636MPN.js +58 -0
- package/Build/Workers/chunk-ZZIFOLD3.js +56 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +23 -23
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
- package/Build/Workers/createVerticesFromHeightmap.js +25 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +29 -29
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Source/DataSources/DynamicGeometryUpdater.js +1 -0
- package/Source/DataSources/GeometryVisualizer.js +5 -0
- package/Source/DataSources/PolylineGeometryUpdater.js +65 -15
- package/Source/DataSources/PolylineVisualizer.js +3 -0
- package/Source/DataSources/StaticGeometryPerMaterialBatch.js +17 -0
- package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +11 -0
- package/Source/Renderer/Context.js +28 -0
- package/Source/Scene/GroundPolylinePrimitive.js +64 -19
- package/Source/Scene/Material.js +51 -7
- package/Source/Scene/Primitive.js +21 -2
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.js +307 -307
- package/package.json +10 -10
|
@@ -16,6 +16,7 @@ const defaultDistanceDisplayCondition = new DistanceDisplayCondition();
|
|
|
16
16
|
|
|
17
17
|
// Encapsulates a Primitive and all the entities that it represents.
|
|
18
18
|
function Batch(
|
|
19
|
+
scene,
|
|
19
20
|
primitives,
|
|
20
21
|
classificationType,
|
|
21
22
|
appearanceType,
|
|
@@ -23,6 +24,7 @@ function Batch(
|
|
|
23
24
|
usingSphericalTextureCoordinates,
|
|
24
25
|
zIndex,
|
|
25
26
|
) {
|
|
27
|
+
this.scene = scene;
|
|
26
28
|
this.primitives = primitives; // scene level primitive collection (each Batch manages its own Primitive from this collection)
|
|
27
29
|
this.classificationType = classificationType;
|
|
28
30
|
this.appearanceType = appearanceType;
|
|
@@ -157,6 +159,9 @@ Batch.prototype.update = function (time) {
|
|
|
157
159
|
this.materialProperty,
|
|
158
160
|
this.material,
|
|
159
161
|
);
|
|
162
|
+
if (defined(this.scene)) {
|
|
163
|
+
this.material.update(this.scene.context);
|
|
164
|
+
}
|
|
160
165
|
|
|
161
166
|
const AppearanceType = this.appearanceType;
|
|
162
167
|
|
|
@@ -200,6 +205,9 @@ Batch.prototype.update = function (time) {
|
|
|
200
205
|
this.materialProperty,
|
|
201
206
|
this.material,
|
|
202
207
|
);
|
|
208
|
+
if (defined(this.scene)) {
|
|
209
|
+
this.material.update(this.scene.context);
|
|
210
|
+
}
|
|
203
211
|
this.primitive.appearance.material = this.material;
|
|
204
212
|
|
|
205
213
|
const updatersWithAttributes = this.updatersWithAttributes.values;
|
|
@@ -331,10 +339,12 @@ Batch.prototype.destroy = function () {
|
|
|
331
339
|
* @private
|
|
332
340
|
*/
|
|
333
341
|
function StaticGroundGeometryPerMaterialBatch(
|
|
342
|
+
scene,
|
|
334
343
|
primitives,
|
|
335
344
|
classificationType,
|
|
336
345
|
appearanceType,
|
|
337
346
|
) {
|
|
347
|
+
this._scene = scene;
|
|
338
348
|
this._items = []; // array of Batch objects, each containing representing a primitive and a set of updaters that manage the visual representation of the primitive.
|
|
339
349
|
this._primitives = primitives; // scene level primitive collection
|
|
340
350
|
this._classificationType = classificationType;
|
|
@@ -377,6 +387,7 @@ StaticGroundGeometryPerMaterialBatch.prototype.add = function (time, updater) {
|
|
|
377
387
|
}
|
|
378
388
|
// If a compatible batch wasn't found, create a new batch.
|
|
379
389
|
const batch = new Batch(
|
|
390
|
+
this._scene,
|
|
380
391
|
this._primitives,
|
|
381
392
|
this._classificationType,
|
|
382
393
|
this._appearanceType,
|
|
@@ -342,6 +342,7 @@ function Context(canvas, options) {
|
|
|
342
342
|
// default emissive texture has a value of (0, 0, 0)
|
|
343
343
|
// default normal texture is +z which is encoded as (0.5, 0.5, 1)
|
|
344
344
|
this._defaultTexture = undefined;
|
|
345
|
+
this._defaultTransparentTexture = undefined;
|
|
345
346
|
this._defaultEmissiveTexture = undefined;
|
|
346
347
|
this._defaultNormalTexture = undefined;
|
|
347
348
|
this._defaultCubeMap = undefined;
|
|
@@ -1032,6 +1033,30 @@ Object.defineProperties(Context.prototype, {
|
|
|
1032
1033
|
return this._defaultTexture;
|
|
1033
1034
|
},
|
|
1034
1035
|
},
|
|
1036
|
+
/**
|
|
1037
|
+
* A 1x1 RGBA texture initialized to [0, 0, 0, 0]. Used as a placeholder for
|
|
1038
|
+
* image uniforms while asynchronous textures are downloaded so geometry does not
|
|
1039
|
+
* briefly appear filled with white.
|
|
1040
|
+
* @memberof Context.prototype
|
|
1041
|
+
* @type {Texture}
|
|
1042
|
+
*/
|
|
1043
|
+
defaultTransparentTexture: {
|
|
1044
|
+
get: function () {
|
|
1045
|
+
if (this._defaultTransparentTexture === undefined) {
|
|
1046
|
+
this._defaultTransparentTexture = new Texture({
|
|
1047
|
+
context: this,
|
|
1048
|
+
source: {
|
|
1049
|
+
width: 1,
|
|
1050
|
+
height: 1,
|
|
1051
|
+
arrayBufferView: new Uint8Array([0, 0, 0, 0]),
|
|
1052
|
+
},
|
|
1053
|
+
flipY: false,
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
return this._defaultTransparentTexture;
|
|
1058
|
+
},
|
|
1059
|
+
},
|
|
1035
1060
|
/**
|
|
1036
1061
|
* A 1x1 RGB texture initialized to [0, 0, 0] representing a material that is
|
|
1037
1062
|
* not emissive. This can be used as a placeholder texture for emissive
|
|
@@ -1714,6 +1739,9 @@ Context.prototype.destroy = function () {
|
|
|
1714
1739
|
this._shaderCache = this._shaderCache.destroy();
|
|
1715
1740
|
this._textureCache = this._textureCache.destroy();
|
|
1716
1741
|
this._defaultTexture = this._defaultTexture && this._defaultTexture.destroy();
|
|
1742
|
+
this._defaultTransparentTexture =
|
|
1743
|
+
this._defaultTransparentTexture &&
|
|
1744
|
+
this._defaultTransparentTexture.destroy();
|
|
1717
1745
|
this._defaultEmissiveTexture =
|
|
1718
1746
|
this._defaultEmissiveTexture && this._defaultEmissiveTexture.destroy();
|
|
1719
1747
|
this._defaultNormalTexture =
|
|
@@ -182,6 +182,9 @@ function GroundPolylinePrimitive(options) {
|
|
|
182
182
|
|
|
183
183
|
this._retainedGeometryInstances = undefined;
|
|
184
184
|
|
|
185
|
+
/** @private Root {@link GroundPolylineGeometry} ref from the last inner {@link Primitive} build. */
|
|
186
|
+
this._lastGroundPolylineRootGeometry = undefined;
|
|
187
|
+
|
|
185
188
|
this._ready = false;
|
|
186
189
|
this._primitive = undefined;
|
|
187
190
|
|
|
@@ -316,19 +319,30 @@ GroundPolylinePrimitive.initializeTerrainHeights = function () {
|
|
|
316
319
|
return ApproximateTerrainHeights.initialize();
|
|
317
320
|
};
|
|
318
321
|
|
|
322
|
+
function normalizeGeometryInstances(instances) {
|
|
323
|
+
if (!defined(instances)) {
|
|
324
|
+
return instances;
|
|
325
|
+
}
|
|
326
|
+
return Array.isArray(instances) ? instances : [instances];
|
|
327
|
+
}
|
|
328
|
+
|
|
319
329
|
function verticalExaggerationMatchesFrameState(geometryInstances, frameState) {
|
|
320
|
-
|
|
330
|
+
const instances = normalizeGeometryInstances(geometryInstances);
|
|
331
|
+
if (!defined(instances)) {
|
|
321
332
|
return true;
|
|
322
333
|
}
|
|
323
334
|
const ex = frameState.verticalExaggeration;
|
|
324
335
|
const exRel = frameState.verticalExaggerationRelativeHeight;
|
|
325
|
-
const length =
|
|
336
|
+
const length = instances.length;
|
|
326
337
|
for (let i = 0; i < length; ++i) {
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
338
|
+
const instance = instances[i];
|
|
339
|
+
if (!defined(instance) || !defined(instance.geometry)) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
const geom = instance.geometry;
|
|
343
|
+
const geomEx = geom._verticalExaggeration ?? 1.0;
|
|
344
|
+
const geomExRel = geom._verticalExaggerationRelativeHeight ?? 0.0;
|
|
345
|
+
if (geomEx !== ex || geomExRel !== exRel) {
|
|
332
346
|
return false;
|
|
333
347
|
}
|
|
334
348
|
}
|
|
@@ -689,6 +703,20 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
|
|
|
689
703
|
return;
|
|
690
704
|
}
|
|
691
705
|
|
|
706
|
+
let i;
|
|
707
|
+
|
|
708
|
+
const that = this;
|
|
709
|
+
const primitiveOptions = this._primitiveOptions;
|
|
710
|
+
|
|
711
|
+
if (
|
|
712
|
+
defined(this.geometryInstances) &&
|
|
713
|
+
!defined(this._retainedGeometryInstances)
|
|
714
|
+
) {
|
|
715
|
+
this._retainedGeometryInstances = Array.isArray(this.geometryInstances)
|
|
716
|
+
? this.geometryInstances.slice()
|
|
717
|
+
: [this.geometryInstances];
|
|
718
|
+
}
|
|
719
|
+
|
|
692
720
|
if (!ApproximateTerrainHeights.initialized) {
|
|
693
721
|
//>>includeStart('debug', pragmas.debug);
|
|
694
722
|
if (!this.asynchronous) {
|
|
@@ -702,23 +730,37 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
|
|
|
702
730
|
return;
|
|
703
731
|
}
|
|
704
732
|
|
|
705
|
-
|
|
733
|
+
const sourceGeometryInstances = normalizeGeometryInstances(
|
|
734
|
+
this.geometryInstances ?? this._retainedGeometryInstances,
|
|
735
|
+
);
|
|
706
736
|
|
|
707
|
-
|
|
708
|
-
|
|
737
|
+
let rootGeometryFromSource;
|
|
738
|
+
if (defined(sourceGeometryInstances)) {
|
|
739
|
+
const src0 = sourceGeometryInstances[0];
|
|
740
|
+
if (defined(src0) && defined(src0.geometry)) {
|
|
741
|
+
rootGeometryFromSource = src0.geometry;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
709
744
|
|
|
745
|
+
// New GeometryInstances (e.g. dynamic Entity polylines) assign a fresh GroundPolylineGeometry
|
|
746
|
+
// each frame. Destroy the inner Primitive when the source geometry object changes; otherwise
|
|
747
|
+
// we would keep rendering the previous combineGeometry result.
|
|
710
748
|
if (
|
|
711
|
-
defined(this.
|
|
712
|
-
|
|
749
|
+
defined(this._primitive) &&
|
|
750
|
+
defined(rootGeometryFromSource) &&
|
|
751
|
+
rootGeometryFromSource !== this._lastGroundPolylineRootGeometry
|
|
713
752
|
) {
|
|
714
|
-
this.
|
|
715
|
-
|
|
716
|
-
|
|
753
|
+
this._primitive = this._primitive.destroy();
|
|
754
|
+
this._primitive = undefined;
|
|
755
|
+
this._ready = false;
|
|
756
|
+
if (defined(this._sp)) {
|
|
757
|
+
this._sp = this._sp.destroy();
|
|
758
|
+
}
|
|
759
|
+
this._sp2D = undefined;
|
|
760
|
+
this._spMorph = undefined;
|
|
761
|
+
this._lastGroundPolylineRootGeometry = undefined;
|
|
717
762
|
}
|
|
718
763
|
|
|
719
|
-
const sourceGeometryInstances =
|
|
720
|
-
this.geometryInstances ?? this._retainedGeometryInstances;
|
|
721
|
-
|
|
722
764
|
if (
|
|
723
765
|
defined(this._primitive) &&
|
|
724
766
|
!verticalExaggerationMatchesFrameState(sourceGeometryInstances, frameState)
|
|
@@ -740,6 +782,7 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
|
|
|
740
782
|
|
|
741
783
|
let attributes;
|
|
742
784
|
|
|
785
|
+
this._hasPerInstanceColors = true;
|
|
743
786
|
// Check if each instance has a color attribute.
|
|
744
787
|
for (i = 0; i < geometryInstancesLength; ++i) {
|
|
745
788
|
attributes = geometryInstances[i].attributes;
|
|
@@ -752,7 +795,7 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
|
|
|
752
795
|
for (i = 0; i < geometryInstancesLength; ++i) {
|
|
753
796
|
const geometryInstance = geometryInstances[i];
|
|
754
797
|
attributes = {};
|
|
755
|
-
const instanceAttributes = geometryInstance.attributes;
|
|
798
|
+
const instanceAttributes = geometryInstance.attributes ?? {};
|
|
756
799
|
for (const attributeKey in instanceAttributes) {
|
|
757
800
|
if (instanceAttributes.hasOwnProperty(attributeKey)) {
|
|
758
801
|
attributes[attributeKey] = instanceAttributes[attributeKey];
|
|
@@ -837,6 +880,7 @@ GroundPolylinePrimitive.prototype.update = function (frameState) {
|
|
|
837
880
|
};
|
|
838
881
|
|
|
839
882
|
this._primitive = new Primitive(primitiveOptions);
|
|
883
|
+
this._lastGroundPolylineRootGeometry = rootGeometryFromSource;
|
|
840
884
|
}
|
|
841
885
|
|
|
842
886
|
if (
|
|
@@ -932,6 +976,7 @@ GroundPolylinePrimitive.prototype.isDestroyed = function () {
|
|
|
932
976
|
* @see GroundPolylinePrimitive#isDestroyed
|
|
933
977
|
*/
|
|
934
978
|
GroundPolylinePrimitive.prototype.destroy = function () {
|
|
979
|
+
this._lastGroundPolylineRootGeometry = undefined;
|
|
935
980
|
this._primitive = this._primitive && this._primitive.destroy();
|
|
936
981
|
this._sp = this._sp && this._sp.destroy();
|
|
937
982
|
|
package/Source/Scene/Material.js
CHANGED
|
@@ -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 (
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
1479
|
+
if (material.uniforms.color.alpha < 1.0) {
|
|
1480
|
+
return true;
|
|
1481
|
+
}
|
|
1482
|
+
const tex = material._textures.image;
|
|
1483
|
+
return (
|
|
1484
|
+
defined(tex) &&
|
|
1485
|
+
defined(material._transparentPlaceholderTexture) &&
|
|
1486
|
+
tex === material._transparentPlaceholderTexture
|
|
1487
|
+
);
|
|
1444
1488
|
},
|
|
1445
1489
|
});
|
|
1446
1490
|
|
|
@@ -485,7 +485,14 @@ function getCommonPerInstanceAttributeNames(instances) {
|
|
|
485
485
|
const length = instances.length;
|
|
486
486
|
|
|
487
487
|
const attributesInAllInstances = [];
|
|
488
|
+
if (length === 0 || !defined(instances[0])) {
|
|
489
|
+
return attributesInAllInstances;
|
|
490
|
+
}
|
|
491
|
+
|
|
488
492
|
const attributes0 = instances[0].attributes;
|
|
493
|
+
if (!defined(attributes0)) {
|
|
494
|
+
return attributesInAllInstances;
|
|
495
|
+
}
|
|
489
496
|
let name;
|
|
490
497
|
|
|
491
498
|
for (name in attributes0) {
|
|
@@ -495,7 +502,13 @@ function getCommonPerInstanceAttributeNames(instances) {
|
|
|
495
502
|
|
|
496
503
|
// Does this same attribute exist in all instances?
|
|
497
504
|
for (let i = 1; i < length; ++i) {
|
|
498
|
-
const
|
|
505
|
+
const otherInstance = instances[i];
|
|
506
|
+
const otherAttributes = defined(otherInstance)
|
|
507
|
+
? otherInstance.attributes
|
|
508
|
+
: undefined;
|
|
509
|
+
const otherAttribute = defined(otherAttributes)
|
|
510
|
+
? otherAttributes[name]
|
|
511
|
+
: undefined;
|
|
499
512
|
|
|
500
513
|
if (
|
|
501
514
|
!defined(otherAttribute) ||
|
|
@@ -537,11 +550,14 @@ function getAttributeValue(value) {
|
|
|
537
550
|
|
|
538
551
|
function createBatchTable(primitive, context) {
|
|
539
552
|
const geometryInstances = primitive.geometryInstances;
|
|
553
|
+
if (!defined(geometryInstances)) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
540
556
|
const instances = Array.isArray(geometryInstances)
|
|
541
557
|
? geometryInstances
|
|
542
558
|
: [geometryInstances];
|
|
543
559
|
const numberOfInstances = instances.length;
|
|
544
|
-
if (numberOfInstances === 0) {
|
|
560
|
+
if (numberOfInstances === 0 || !defined(instances[0])) {
|
|
545
561
|
return;
|
|
546
562
|
}
|
|
547
563
|
|
|
@@ -2109,6 +2125,9 @@ Primitive.prototype.update = function (frameState) {
|
|
|
2109
2125
|
if (!defined(this._batchTable)) {
|
|
2110
2126
|
createBatchTable(this, context);
|
|
2111
2127
|
}
|
|
2128
|
+
if (!defined(this._batchTable)) {
|
|
2129
|
+
return;
|
|
2130
|
+
}
|
|
2112
2131
|
if (this._batchTable.attributes.length > 0) {
|
|
2113
2132
|
if (ContextLimits.maximumVertexTextureImageUnits === 0) {
|
|
2114
2133
|
throw new RuntimeError(
|
|
File without changes
|