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

ShockWaveEffect

Extends:

three~EventDispatcherEffect → ShockWaveEffect

Indirect Implements:

A shock wave effect.

Based on a Gist by Jean-Philippe Sarda: https://gist.github.com/jpsarda/33cea67a9f2ecb0a0eda

Warning: This effect cannot be merged with convolution effects.

Constructor Summary

Public Constructor
public

constructor(camera: Camera, epicenter: Vector3, options: Object)

Constructs a new shock wave effect.

Member Summary

Public Members
public

camera: Camera

The main camera.

public

epicenter: Vector3

The epicenter.

public

The speed of the shock wave animation.

Method Summary

Public Methods
public

Emits the shock wave.

public

update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, delta: Number)

Updates this effect.

Inherited Summary

From class Effect
public

The blend mode of this effect.

public

Preprocessor macro definitions.

public

WebGL extensions that are required by this effect.

public

The name of this effect.

public

uniforms: Map<String, Uniform>

Shader uniforms.

public

Performs a shallow search for properties that define a dispose method and deletes them.

public

Returns the effect attributes.

public

Returns the fragment shader.

public

Returns the vertex shader.

public

initialize(renderer: WebGLRenderer, alpha: Boolean, frameBufferType: Number)

Performs initialization tasks.

public

setDepthTexture(depthTexture: Texture, depthPacking: Number)

Sets the depth texture.

public

setSize(width: Number, height: Number)

Updates the size of this effect.

public

update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: Number)

Updates the effect by performing supporting operations.

protected

Sets the effect attributes.

protected

Informs the associated EffectPass that this effect has changed in a way that requires a shader recompilation.

protected

setFragmentShader(fragmentShader: String)

Sets the fragment shader.

protected

setVertexShader(vertexShader: String)

Sets the vertex shader.

Public Constructors

public constructor(camera: Camera, epicenter: Vector3, options: Object) source

Constructs a new shock wave effect.

Override:

Effect#constructor

Params:

NameTypeAttributeDescription
camera Camera

The main camera.

epicenter Vector3
  • optional

The world position of the shock wave epicenter.

options Object
  • optional

The options.

options.speed Number
  • optional
  • default: 2.0

The animation speed.

options.maxRadius Number
  • optional
  • default: 1.0

The extent of the shock wave.

options.waveSize Number
  • optional
  • default: 0.2

The wave size.

options.amplitude Number
  • optional
  • default: 0.05

The distortion amplitude.

Public Members

public camera: Camera source

The main camera.

public epicenter: Vector3 source

The epicenter.

Example:

shockWavePass.epicenter = myMesh.position;

public speed: Number source

The speed of the shock wave animation.

Public Methods

public explode() source

Emits the shock wave.

public update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, delta: Number) source

Updates this effect.

Override:

Effect#update

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

inputBuffer WebGLRenderTarget

A frame buffer that contains the result of the previous pass.

delta Number
  • optional

The time between the last frame and the current one in seconds.