Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where dynamic geometry was not marked as ready #10607

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- Fixed a bug where `Viewer.zoomTo` would continuously throw errors if a `Cesium3DTileset` failed to load.[#10523](https://github.com/CesiumGS/cesium/pull/10523)
- Fixed a bug where styles would not apply to tilesets if they were applied while the tileset was hidden. [#10582](https://github.com/CesiumGS/cesium/pull/10582)
- Fixed a bug where `.i3dm` models with quantized positions were not being correctly loaded by `ModelExperimental`. [#10598](https://github.com/CesiumGS/cesium/pull/10598)
- Fixed a bug where dynamic geometry was not marked as `ready`. [#10517](https://github.com/CesiumGS/cesium/issues/10517)

##### Deprecated :hourglass_flowing_sand:

Expand Down
11 changes: 10 additions & 1 deletion Source/Scene/ClassificationPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ function ClassificationPrimitive(options) {
const classificationPrimitive = this;
this._readyPromise = new Promise((resolve, reject) => {
classificationPrimitive._completeLoad = () => {
if (this._ready) {
return;
}

this._ready = true;

if (this.releaseGeometryInstances) {
Expand Down Expand Up @@ -1297,7 +1301,6 @@ ClassificationPrimitive.prototype.update = function (frameState) {
}

this._primitive = new Primitive(primitiveOptions);
this._primitive.readyPromise.then(this._completeLoad);
}

if (
Expand Down Expand Up @@ -1351,6 +1354,12 @@ ClassificationPrimitive.prototype.update = function (frameState) {
this._primitive.show = this.show;
this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
this._primitive.update(frameState);

frameState.afterRender.push(() => {
if (defined(this._primitive) && this._primitive.ready) {
this._completeLoad();
}
});
};

/**
Expand Down
11 changes: 10 additions & 1 deletion Source/Scene/GroundPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ function GroundPrimitive(options) {
const groundPrimitive = this;
this._readyPromise = new Promise((resolve, reject) => {
groundPrimitive._completeLoad = () => {
if (this._ready) {
return;
}

this._ready = true;

if (this.releaseGeometryInstances) {
Expand Down Expand Up @@ -921,14 +925,19 @@ GroundPrimitive.prototype.update = function (frameState) {
};

this._primitive = new ClassificationPrimitive(primitiveOptions);
this._primitive.readyPromise.then(this._completeLoad);
}

this._primitive.appearance = this.appearance;
this._primitive.show = this.show;
this._primitive.debugShowShadowVolume = this.debugShowShadowVolume;
this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
this._primitive.update(frameState);

frameState.afterRender.push(() => {
if (defined(this._primitive) && this._primitive.ready) {
this._completeLoad();
}
});
};

/**
Expand Down