Pass
Direct Subclass:
Implements:
An abstract pass.
Passes that do not rely on the depth buffer should explicitly disable the depth test and depth write flags of their fullscreen shader material.
Fullscreen passes use a shared fullscreen triangle: https://michaldrobot.com/2014/04/01/gcn-execution-patterns-in-full-screen-passes/
Constructor Summary
Public Constructor | ||
public |
constructor(name: String, scene: Scene, camera: Camera) Constructs a new pass. |
Member Summary
Public Members | ||
public |
Indicates whether this pass should be executed. |
|
public |
The name of this pass. |
|
public |
Only relevant for subclassing. |
|
public |
Only relevant for subclassing. |
|
public get |
Indicates whether this pass should render to screen. |
|
public set |
Sets the render to screen flag. |
Protected Members | ||
protected |
camera: Camera The camera. |
|
protected |
scene: Scene The scene to render. |
Method Summary
Public Methods | ||
public |
dispose() Performs a shallow search for disposable properties and deletes them. |
|
public |
getDepthTexture(): Texture Returns the current depth texture. |
|
public |
getFullscreenMaterial(): Material Returns the current fullscreen material. |
|
public |
initialize(renderer: WebGLRenderer, alpha: Boolean, frameBufferType: Number) Performs initialization tasks. |
|
public abstract |
render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget, deltaTime: Number, stencilTest: Boolean) Renders the effect. |
|
public |
setDepthTexture(depthTexture: Texture, depthPacking: Number) Sets the depth texture. |
|
public |
Updates this pass with the renderer's size. You may override this method in case you want to be informed about the size of the main frame buffer. The EffectComposer calls this method before this pass is initialized and every time its own size is updated. |
Protected Methods | ||
protected |
setFullscreenMaterial(material: Material) Sets the fullscreen material. |
Public Constructors
public constructor(name: String, scene: Scene, camera: Camera) source
Constructs a new pass.
Params:
Name | Type | Attribute | Description |
name | String |
|
The name of this pass. Does not have to be unique. |
scene | Scene |
|
The scene to render. The default scene contains a single mesh that fills the screen. |
camera | Camera |
|
A camera. Fullscreen effect passes don't require a camera. |
Public Members
public needsDepthTexture: Boolean source
Only relevant for subclassing.
Indicates whether the EffectComposer should prepare a depth texture for this pass.
Set this to true
if this pass relies on depth information from a
preceding RenderPass.
public needsSwap: Boolean source
Only relevant for subclassing.
Indicates whether the EffectComposer should swap the frame buffers after this pass has finished rendering.
Set this to false
if this pass doesn't render to the output buffer or
the screen. Otherwise, the contents of the input buffer will be lost.
public set renderToScreen: Boolean source
Sets the render to screen flag.
If the flag is changed to a different value, the fullscreen material will be updated as well.
Protected Members
Public Methods
public dispose() source
Performs a shallow search for disposable properties and deletes them. The pass will be inoperative after this method was called!
The EffectComposer calls this method when it is being destroyed. You may, however, use it independently to free memory when you are certain that you don't need this pass anymore.
public getDepthTexture(): Texture source
Returns the current depth texture.
Return:
Texture | The current depth texture, or null if there is none. |
public getFullscreenMaterial(): Material source
Returns the current fullscreen material.
Return:
Material | The current fullscreen material, or null if there is none. |
public initialize(renderer: WebGLRenderer, alpha: Boolean, frameBufferType: Number) source
Performs initialization tasks.
By overriding this method you gain access to the renderer. You'll also be able to configure your custom render targets to use the appropriate format (RGB or RGBA).
The provided renderer can be used to warm up special off-screen render targets by performing a preliminary render operation.
The EffectComposer calls this method when this pass is added to its queue, but not before its size has been set.
Example:
if(!alpha && frameBufferType === UnsignedByteType) { this.myRenderTarget.texture.format = RGBFormat; }
public abstract render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget, deltaTime: Number, stencilTest: Boolean) source
Renders the effect.
This is an abstract method that must be overridden.
Params:
Name | Type | Attribute | Description |
renderer | WebGLRenderer | The renderer. |
|
inputBuffer | WebGLRenderTarget | A frame buffer that contains the result of the previous pass. |
|
outputBuffer | WebGLRenderTarget | A frame buffer that serves as the output render target unless this pass renders to screen. |
|
deltaTime | Number |
|
The time between the last frame and the current one in seconds. |
stencilTest | Boolean |
|
Indicates whether a stencil mask is active. |
Throw:
An error is thrown if the method is not overridden. |
public setDepthTexture(depthTexture: Texture, depthPacking: Number) source
Sets the depth texture.
This method will be called automatically by the EffectComposer.
You may override this method if your pass relies on the depth information of a preceding RenderPass.
Params:
Name | Type | Attribute | Description |
depthTexture | Texture | A depth texture. |
|
depthPacking | Number |
|
The depth packing. |
public setSize(width: Number, height: Number) source
Updates this pass with the renderer's size.
You may override this method in case you want to be informed about the size of the main frame buffer.
The EffectComposer calls this method before this pass is initialized and every time its own size is updated.
Example:
this.myRenderTarget.setSize(width, height);
Protected Methods
protected setFullscreenMaterial(material: Material) source
Sets the fullscreen material.
The material will be assigned to a mesh that fills the screen. The mesh will be created once a material is assigned via this method.
Params:
Name | Type | Attribute | Description |
material | Material | A fullscreen material. |