Home Reference Source
import {ShockWaveEffect} from 'postprocessing/src/effects/ShockWaveEffect.js'
public class | source

ShockWaveEffect

Extends:

Effect → 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.

Private Members
private

Indicates whether the shock wave animation is active.

private

screenPosition: Vector3

The object position in screen space.

private

A time accumulator.

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

[key]: *

public

The effect attributes.

public

The blend mode of this effect.

public

Preprocessor macro definitions.

public

The fragment shader.

public

The name of this effect.

public

uniforms: Map<String, Uniform>

Shader uniforms.

public

The vertex shader.

public

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

public

initialize(renderer: WebGLRenderer, alpha: Boolean)

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, delta: Number)

Updates the effect by performing supporting operations.

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.

Private Members

private active: Boolean source

Indicates whether the shock wave animation is active.

private screenPosition: Vector3 source

The object position in screen space.

private time: Number source

A time accumulator.

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.