Skip to content

Commit ab99cd1

Browse files
committed
Add needsDepthBlit flag
1 parent 052705d commit ab99cd1

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

src/core/EffectComposer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { ClearMaskPass } from "../passes/ClearMaskPass.js";
1414
import { CopyPass } from "../passes/CopyPass.js";
1515
import { MaskPass } from "../passes/MaskPass.js";
1616
import { Pass } from "../passes/Pass.js";
17-
import { RenderPass } from "../passes/RenderPass.js";
1817
import { Timer } from "./Timer.js"; // TODO Replace with Timer from three, requires r179.
1918

2019
/**
@@ -669,7 +668,7 @@ export class EffectComposer {
669668

670669
pass.render(renderer, inputBuffer, outputBuffer, deltaTime, stencilTest);
671670

672-
if(pass instanceof RenderPass) {
671+
if(pass.needsDepthBlit) {
673672

674673
// Copy depth to the stable depth texture.
675674
if(this.depthRenderTarget !== null) {

src/passes/Pass.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ export class Pass {
116116
/**
117117
* Only relevant for subclassing.
118118
*
119-
* Indicates whether the {@link EffectComposer} should swap the frame buffers after this pass has finished
120-
* rendering. Set this to `false` if this pass doesn't render to the output buffer or the screen. Otherwise, the
121-
* contents of the input buffer will be lost.
119+
* Controls whether the {@link EffectComposer} should swap the frame buffers after this pass has finished rendering.
120+
* Set this to `false` if this pass doesn't render to the output buffer or the screen. Otherwise, the contents of
121+
* the input buffer will be lost.
122122
*
123123
* @type {Boolean}
124124
*/
@@ -128,7 +128,18 @@ export class Pass {
128128
/**
129129
* Only relevant for subclassing.
130130
*
131-
* Indicates whether the {@link EffectComposer} should prepare a depth texture for this pass.
131+
* Controls whether the {@link EffectComposer} should copy the depth buffer after this pass has finished rendering.
132+
* Default is `false`.
133+
*
134+
* @type {Boolean}
135+
*/
136+
137+
this.needsDepthBlit = false;
138+
139+
/**
140+
* Only relevant for subclassing.
141+
*
142+
* Controls whether the {@link EffectComposer} should prepare a depth texture for this pass.
132143
* Set this to `true` if this pass relies on depth information from a preceding {@link RenderPass}.
133144
*
134145
* @type {Boolean}

src/passes/RenderPass.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class RenderPass extends Pass {
2323
super("RenderPass", scene, camera);
2424

2525
this.needsSwap = false;
26+
this.needsDepthBlit = true;
2627

2728
/**
2829
* A clear pass.

types/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,6 +2815,15 @@ export class Pass implements Initializable, Resizable, Disposable {
28152815
* @type {Boolean}
28162816
*/
28172817
needsSwap: boolean;
2818+
/**
2819+
* Only relevant for subclassing.
2820+
*
2821+
* Controls whether the {@link EffectComposer} should copy the depth buffer after this pass has finished rendering.
2822+
* Default is `false`.
2823+
*
2824+
* @type {Boolean}
2825+
*/
2826+
needsDepthBlit: boolean;
28182827
/**
28192828
* Only relevant for subclassing.
28202829
*

0 commit comments

Comments
 (0)