Closed vanruesc closed 6 years ago
Letting the RenderPass
and ClearPass
render to the inputBuffer
turned out to be more useful after all. This way it's easier to render composite scenes using multiple render passes.
Implemented in postprocessing@4.5.0
.
Passes that render to the provided
writeBuffer
currently have to set a specialneedsSwap
flag totrue
. This tells theEffectComposer
that thewriteBuffer
must be swapped with thereadBuffer
before the next pass can be executed. In reality, though, almost all passes render to thewriteBuffer
. Passes that don't do it are special cases:TexturePass
,RenderPass
,ClearPass
,MaskPass
,ClearMaskPass
andSavePass
.Three of these passes, namely the
TexturePass
,RenderPass
andClearPass
, can easily be changed to render to thewriteBuffer
. The other two passes,ClearMaskPass
andSavePass
, are the only ones that can't render to thewriteBuffer
.To reduce boilerplate code, the default value of the
needsSwap
flag should be inverted. Then, only the special passes that deviate from the usual input-output flow need to change the flag. It might also be a good idea to rename thereadBuffer
andwriteBuffer
toinputBuffer
andoutputBuffer
to further clarify their purpose.