Skip to content

Commit

Permalink
Check autoClear to fix utility layer rendering on native OpenXR (#12774)
Browse files Browse the repository at this point in the history
Former-commit-id: 3faa363da681e0de8a7567594d9bd5f906053298
  • Loading branch information
rgerd committed Jul 21, 2022
1 parent 6f6fc1b commit 2d26e4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/dev/core/src/Rendering/utilityLayerRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export class UtilityLayerRenderer implements IDisposable {
// Render directly on top of existing scene without clearing
this.utilityLayerScene.autoClear = false;

this._afterRenderObserver = this.originalScene.onAfterCameraRenderObservable.add((camera) => {
this._afterRenderObserver = this.originalScene.onAfterRenderCameraObservable.add((camera) => {
// Only render when the render camera finishes rendering
if (this.shouldRender && camera == this.getRenderCamera()) {
this.render();
Expand Down
4 changes: 3 additions & 1 deletion packages/dev/core/src/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3984,7 +3984,9 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
if (rtt.onClearObservable.hasObservers()) {
rtt.onClearObservable.notifyObservers(this._engine);
} else if (!rtt.skipInitialClear) {
this._engine.clear(rtt.clearColor || this.clearColor, !rtt._cleared, true, true);
if (this.autoClear) {
this._engine.clear(rtt.clearColor || this.clearColor, !rtt._cleared, true, true);
}
rtt._cleared = true;
}
} else {
Expand Down

0 comments on commit 2d26e4b

Please sign in to comment.