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 in their respective shader materials.
Constructor Summary
Public Constructor | ||
public |
constructor(name: String, scene: Scene, camera: Camera) Constructs a new pass. |
Member Summary
Public Members | ||
public |
[key]: * |
|
public |
Indicates whether this pass should be executed. |
|
public |
The name of this pass. |
|
public |
Indicates whether the EffectComposer should prepare a depth texture for this pass. |
|
public |
Indicates whether the EffectComposer should swap the frame buffers after this pass has finished rendering. |
|
public |
Indicates whether this pass should render to screen. |
Protected Members | ||
protected |
camera: Camera The camera. |
|
protected |
scene: Scene The scene to render. |
Private Members | ||
private |
quad: Mesh A quad mesh that fills the screen. |
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) Performs initialization tasks. |
|
public abstract |
render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget, delta: 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 main render size. 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 |
|
The camera. The default camera perfectly captures the screen mesh. |
Public Members
public [key]: * source
public needsDepthTexture: Boolean source
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
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.
Protected Members
Private 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!
Disposable objects:
- WebGLRenderTarget
- Material
- Texture
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) 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.
Params:
Name | Type | Attribute | Description |
renderer | WebGLRenderer | The renderer. |
|
alpha | Boolean | Whether the renderer uses the alpha channel or not. |
Example:
if(!alpha) { this.myRenderTarget.texture.format = RGBFormat; }
public abstract render(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, outputBuffer: WebGLRenderTarget, delta: 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. |
|
delta | 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.
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 main render size.
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 the quad mesh that fills the screen. The screen quad will be created once a material is assigned via this method.
Params:
Name | Type | Attribute | Description |
material | Material | A fullscreen material. |