mirror of https://github.com/CesiumGS/cesium.git
Merge pull request #12924 from CesiumGS/fix-draped-imagery-removal
Fix draped imagery removal
This commit is contained in:
commit
0ee5670050
|
|
@ -22,6 +22,7 @@
|
|||
- Improved performance when removing primitives. [#3018](https://github.com/CesiumGS/cesium/pull/3018)
|
||||
- Improved performance of terrain Quadtree handling of custom data [#12907](https://github.com/CesiumGS/cesium/pull/12907)
|
||||
- Fixed picking of `GroundPrimitive` with multiple `PolygonGeometry` instances selecting the wrong instance. [#12978](https://github.com/CesiumGS/cesium/pull/12978)
|
||||
- Fixed a bug where the removal of draped imagery layers did not update the rendered state [#12923](https://github.com/CesiumGS/cesium/issues/12923)
|
||||
|
||||
## 1.134.1 - 2025-10-10
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ class ModelImagery {
|
|||
//>>includeEnd('debug');
|
||||
|
||||
if (!this._hasImagery) {
|
||||
// When there is no imagery, make sure to delete any model primitive
|
||||
// imageries that may previously have been created
|
||||
this._deleteModelPrimitiveImageries();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -215,6 +218,7 @@ class ModelImagery {
|
|||
modelPrimitiveImagery.destroy();
|
||||
}
|
||||
delete this._modelPrimitiveImageries;
|
||||
this._model.resetDrawCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -133,4 +133,30 @@ describe("Scene/Model/ModelImagery", function () {
|
|||
const modelPrimitiveImageries = modelImagery._modelPrimitiveImageries;
|
||||
expect(modelPrimitiveImageries.length).toBe(4);
|
||||
});
|
||||
|
||||
it("removes ModelPrimitiveImagery objects when imagery layers are removed", async function () {
|
||||
if (!scene.context.webgl2) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tileset = await loadTilesetWithImagery(scene);
|
||||
|
||||
const root = tileset.root;
|
||||
const content = root.content;
|
||||
const model = content._model;
|
||||
const modelImagery = model._modelImagery;
|
||||
|
||||
// The model has four primitives
|
||||
const modelPrimitiveImageries = modelImagery._modelPrimitiveImageries;
|
||||
expect(modelPrimitiveImageries.length).toBe(4);
|
||||
|
||||
// Remove the imagery layer from the tileset, and trigger an update
|
||||
tileset.imageryLayers.removeAll(false);
|
||||
scene.renderForSpecs();
|
||||
|
||||
// The model imagery should no longer contain any
|
||||
// modelPrimitiveImagery objects now
|
||||
const newModelPrimitiveImageries = modelImagery._modelPrimitiveImageries;
|
||||
expect(newModelPrimitiveImageries).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue