Skip to content

Commit

Permalink
allow skipping the rtt initial clearing
Browse files Browse the repository at this point in the history
This is important in XR scenarios
  • Loading branch information
RaananW committed Aug 23, 2021
1 parent 9574b5a commit 7dcc937
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Materials/Textures/renderTargetTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ export class RenderTargetTexture extends Texture {
public _generateMipMaps: boolean;
/** @hidden */
public _cleared = false;
/**
* Skip the initial clear of the rtt at the beginning of the frame render loop
*/
public skipInitialClear = false;
protected _renderingManager: RenderingManager;
/** @hidden */
public _waitingRenderList?: string[];
Expand Down
2 changes: 1 addition & 1 deletion src/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4001,7 +4001,7 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
const rtt = camera.outputRenderTarget;
if (rtt.onClearObservable.hasObservers()) {
rtt.onClearObservable.notifyObservers(this._engine);
} else {
} else if (!rtt.skipInitialClear) {
this._engine.clear(rtt.clearColor || this.clearColor, !rtt._cleared, true, true);
rtt._cleared = true;
}
Expand Down

0 comments on commit 7dcc937

Please sign in to comment.