Home Reference Source
import {EffectComposer} from 'postprocessing'
public class | source

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 anti-aliasing.

public set

Sets the amount of MSAA samples.

Method Summary

Public Methods
public

addPass(pass: Pass, index: Number)

Adds a pass, optionally at a specific index.

public

createBuffer(depthBuffer: Boolean, stencilBuffer: Boolean, type: Number, multisampling: Number): WebGLRenderTarget

this method was deprecated. Create buffers manually via WebGLRenderTarget instead.

Creates a new render target.

public

Disposes this composer and all passes.

public

getRenderer(): WebGLRenderer

Returns the renderer.

public

Returns the internal timer.

public

Removes all passes.

public

removePass(pass: Pass)

Removes a pass.

public

render(deltaTime: Number)

Renders all enabled passes in the order in which they were added.

public

replaceRenderer(renderer: WebGLRenderer, updateDOM: Boolean): WebGLRenderer

this method was deprecated. Use setRenderer instead.

Replaces the current renderer with the given one.

public

reset()

Resets this composer by deleting all passes and creating new buffers.

public

setMainCamera(camera: Camera)

Can be used to change the main camera for all registered passes and effects.

public

setMainScene(scene: Scene)

Can be used to change the main scene for all registered passes and effects.

public

setRenderer(renderer: WebGLRenderer)

Sets the renderer.

public

setSize(width: Number, height: Number, updateStyle: Boolean)

Sets the size of the buffers, passes and the renderer.

Public Constructors

public constructor(renderer: WebGLRenderer, options: Object) source

Constructs a new effect composer.

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer that should be used.

options Object
  • optional

The options.

options.depthBuffer Boolean
  • optional
  • default: true

Whether the main render targets should have a depth buffer.

options.stencilBuffer Boolean
  • optional
  • default: false

Whether the main render targets should have a stencil buffer.

options.alpha Boolean
  • optional

Deprecated. Buffers are always RGBA since three r137.

options.multisampling Number
  • optional
  • default: 0

The number of samples used for multisample antialiasing. Requires WebGL 2.

options.frameBufferType Number
  • optional

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 get multisampling: Number source

The current amount of samples used for multisample anti-aliasing.

public set multisampling: Number source

Sets the amount of MSAA samples.

Requires WebGL 2. Set to zero to disable multisampling.

Public Methods

public addPass(pass: Pass, index: Number) source

Adds a pass, optionally at a specific index.

Params:

NameTypeAttributeDescription
pass Pass

A new pass.

index Number
  • optional

An index at which the pass should be inserted.

public createBuffer(depthBuffer: Boolean, stencilBuffer: Boolean, type: Number, multisampling: Number): WebGLRenderTarget source

this method was deprecated. Create buffers manually via WebGLRenderTarget instead.

Creates a new render target.

Params:

NameTypeAttributeDescription
depthBuffer Boolean

Whether the render target should have a depth buffer.

stencilBuffer Boolean

Whether the render target should have a stencil buffer.

type Number

The frame buffer type.

multisampling Number

The number of samples to use for antialiasing.

Return:

WebGLRenderTarget

A new render target that equals the renderer's canvas.

public dispose() source

Disposes this composer and all passes.

public getRenderer(): WebGLRenderer source

Returns the renderer.

Return:

WebGLRenderer

The renderer.

public getTimer(): Timer source

Returns the internal timer.

Return:

Timer

The timer.

public removeAllPasses() source

Removes all passes.

public removePass(pass: Pass) source

Removes a pass.

Params:

NameTypeAttributeDescription
pass Pass

The pass.

public render(deltaTime: Number) source

Renders all enabled passes in the order in which they were added.

Params:

NameTypeAttributeDescription
deltaTime Number
  • optional

The time since the last frame in seconds.

public replaceRenderer(renderer: WebGLRenderer, updateDOM: Boolean): WebGLRenderer source

this method was deprecated. Use setRenderer instead.

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:

NameTypeAttributeDescription
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 reset() source

Resets this composer by deleting all passes and creating new buffers.

public setMainCamera(camera: Camera) source

Can be used to change the main camera for all registered passes and effects.

Params:

NameTypeAttributeDescription
camera Camera

The camera.

public setMainScene(scene: Scene) source

Can be used to change the main scene for all registered passes and effects.

Params:

NameTypeAttributeDescription
scene Scene

The scene.

public setRenderer(renderer: WebGLRenderer) source

Sets the renderer.

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

public setSize(width: Number, height: Number, updateStyle: Boolean) source

Sets the size of the buffers, passes and the renderer.

Params:

NameTypeAttributeDescription
width Number

The width.

height Number

The height.

updateStyle Boolean
  • optional

Determines whether the style of the canvas should be updated.