API Reference

Class List

PostEffect

Base class for all post effects. Post effects take a a render target as input apply effects to it and then render the result to an output render target or the screen if no output is specified.

Summary

Properties

device

The graphics device of the application.

needsDepthBuffer

The property that should to be set to true (by the custom post effect) if a depth map is necessary (default is false).

quadVertexShader

A simple vertex shader used to render a quad, which requires 'vec2 aPosition' in the vertex buffer, and generates uv coordinates vUv0 for use in the fragment shader.

Methods

drawQuad

Draw a screen-space rectangle in a render target, using a specified shader.

render

Render the post effect using the specified inputTarget to the specified outputTarget.

Details

Constructor

PostEffect(graphicsDevice)

Create a new PostEffect instance.

Parameters

graphicsDeviceGraphicsDevice

The graphics device of the application.

Properties

GraphicsDevicedevice

The graphics device of the application.

booleanneedsDepthBuffer

The property that should to be set to true (by the custom post effect) if a depth map is necessary (default is false).

stringquadVertexShader

A simple vertex shader used to render a quad, which requires 'vec2 aPosition' in the vertex buffer, and generates uv coordinates vUv0 for use in the fragment shader.

Methods

drawQuad(target, shader, [rect])

Draw a screen-space rectangle in a render target, using a specified shader.

Parameters

targetRenderTarget, null

The output render target.

shaderShader

The shader to be used for drawing the rectangle.

rectVec4

The normalized screen-space position (rect.x, rect.y) and size (rect.z, rect.w) of the rectangle. Default is [0, 0, 1, 1].

render(inputTarget, outputTarget, [rect])

Render the post effect using the specified inputTarget to the specified outputTarget.

Parameters

inputTargetRenderTarget

The input render target.

outputTargetRenderTarget

The output render target. If null then this will be the screen.

rectVec4

The rect of the current camera. If not specified, it will default to [0, 0, 1, 1].