EffectComposer
Implements:
The EffectComposer may be used in place of a normal WebGLRenderer.
The auto clear behaviour of the provided renderer will be disabled to prevent unnecessary clear operations.
It is common practice to use a RenderPass as the first pass to automatically clear the buffers and render a scene for further processing.
Constructor Summary
Public Constructor | ||
public |
constructor(renderer: WebGLRenderer, options: Object) Constructs a new effect composer. |
Member Summary
Public Members | ||
public |
Determines whether the last pass automatically renders to screen. |
|
public get |
The current amount of samples used for multisample antialiasing. |
|
public set |
Sets the amount of MSAA samples. |
Method Summary
Public Methods | ||
public |
Adds a pass, optionally at a specific index. |
|
public |
createBuffer(depthBuffer: Boolean, stencilBuffer: Boolean, type: Number, multisampling: Number): WebGLRenderTarget Creates a new render target by replicating the renderer's canvas. The created render target uses a linear filter for texel minification and magnification. Its render texture format depends on whether the renderer uses the alpha channel. Mipmaps are disabled. Note: The buffer format will also be set to RGBA if the frame buffer type is HalfFloatType because RGB16F buffers are not renderable. |
|
public |
dispose() Disposes this composer and all passes. |
|
public |
getRenderer(): WebGLRenderer Returns the WebGL renderer. |
|
public |
Removes all passes without deleting them. |
|
public |
removePass(pass: Pass) Removes a pass. |
|
public |
Renders all enabled passes in the order in which they were added. |
|
public |
replaceRenderer(renderer: WebGLRenderer, updateDOM: Boolean): WebGLRenderer Replaces the current renderer with the given one. |
|
public |
reset() Resets this composer by deleting all passes and creating new buffers. |
|
public |
Sets the size of the buffers and the renderer's output canvas. Every pass will be informed of the new size. It's up to each pass how that information is used. |
Public Constructors
public constructor(renderer: WebGLRenderer, options: Object) source
Constructs a new effect composer.
Params:
Name | Type | Attribute | Description |
renderer | WebGLRenderer | The renderer that should be used. |
|
options | Object |
|
The options. |
options.depthBuffer | Boolean |
|
Whether the main render targets should have a depth buffer. |
options.stencilBuffer | Boolean |
|
Whether the main render targets should have a stencil buffer. |
options.multisampling | Number |
|
The number of samples used for multisample antialiasing. Requires WebGL 2. |
options.frameBufferType | Boolean |
|
The type of the internal frame buffers. It's recommended to use HalfFloatType if possible. |
Public Members
public autoRenderToScreen: Boolean source
Determines whether the last pass automatically renders to screen.
Public Methods
public createBuffer(depthBuffer: Boolean, stencilBuffer: Boolean, type: Number, multisampling: Number): WebGLRenderTarget source
Creates a new render target by replicating the renderer's canvas.
The created render target uses a linear filter for texel minification and magnification. Its render texture format depends on whether the renderer uses the alpha channel. Mipmaps are disabled.
Note: The buffer format will also be set to RGBA if the frame buffer type is HalfFloatType because RGB16F buffers are not renderable.
Return:
WebGLRenderTarget | A new render target that equals the renderer's canvas. |
public getRenderer(): WebGLRenderer source
Returns the WebGL renderer.
You may replace the renderer at any time by using EffectComposer#replaceRenderer.
Return:
WebGLRenderer | The renderer. |
public removePass(pass: Pass) source
Removes a pass.
Params:
Name | Type | Attribute | Description |
pass | Pass | The pass. |
public render(deltaTime: Number) source
Renders all enabled passes in the order in which they were added.
Params:
Name | Type | Attribute | Description |
deltaTime | Number | The time since the last frame in seconds. |
public replaceRenderer(renderer: WebGLRenderer, updateDOM: Boolean): WebGLRenderer source
Replaces the current renderer with the given one.
The auto clear mechanism of the provided renderer will be disabled. If the new render size differs from the previous one, all passes will be updated.
By default, the DOM element of the current renderer will automatically be removed from its parent node and the DOM element of the new renderer will take its place.
Params:
Name | Type | Attribute | Description |
renderer | WebGLRenderer | The new renderer. |
|
updateDOM | Boolean | Indicates whether the old canvas should be replaced by the new one in the DOM. |
Return:
WebGLRenderer | The old renderer. |
public setSize(width: Number, height: Number, updateStyle: Boolean) source
Sets the size of the buffers and the renderer's output canvas.
Every pass will be informed of the new size. It's up to each pass how that information is used.
If no width or height is specified, the render targets and passes will be updated with the current size of the renderer.