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

LAB-1658 Improve ImageryLayer.cancelReprojections() handling #9161

Closed
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
8 changes: 8 additions & 0 deletions Source/Renderer/ComputeCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ function ComputeCommand(options) {
*/
this.postExecute = options.postExecute;

/**
* Function that is called when the command is canceled
*
* @type {Function}
* @default undefined
*/
this.canceled = options.canceled;

/**
* Whether the renderer resources will persist beyond this call. If not, they
* will be destroyed after completion.
Expand Down
9 changes: 9 additions & 0 deletions Source/Scene/ImageryLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,10 @@ ImageryLayer.prototype._reprojectTexture = function (
imagery.state = ImageryState.READY;
imagery.releaseReference();
},
canceled: function () {
imagery.state = ImageryState.TEXTURE_LOADED;
imagery.releaseReference();
},
});
this._reprojectComputeCommands.push(computeCommand);
} else {
Expand Down Expand Up @@ -1268,6 +1272,11 @@ ImageryLayer.prototype.queueReprojectionCommands = function (frameState) {
* @private
*/
ImageryLayer.prototype.cancelReprojections = function () {
this._reprojectComputeCommands.forEach(function (command) {
if (command.canceled) {
command.canceled();
}
});
this._reprojectComputeCommands.length = 0;
};

Expand Down