A shock wave effect.

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

Hierarchy (view full)

Constructors

  • Constructs a new shock wave effect.

    Parameters

    • Optionalcamera: Camera

      The main camera.

    • Optionalposition: Vector3

      The world position of the shock wave.

    • Optionaloptions: {
          amplitude?: number;
          maxRadius?: number;
          speed?: number;
          waveSize?: number;
      }

      The options.

      • Optionalamplitude?: number

        The distortion amplitude.

      • OptionalmaxRadius?: number

        The extent of the shock wave.

      • Optionalspeed?: number

        The animation speed.

      • OptionalwaveSize?: number

        The wave size.

    Returns ShockWaveEffect

Properties

blendMode: BlendMode

The blend mode of this effect.

defines: Map<string, string>

Preprocessor macro definitions.

Call Effect.setChanged after changing macro definitions.

extensions: Set<WebGLExtension>

WebGL extensions that are required by this effect.

Call Effect.setChanged after adding or removing extensions.

name: string

The name of this effect.

position: Vector3

The position of the shock wave.

renderer: WebGLRenderer

The renderer.

speed: number

The speed of the shock wave animation.

uniforms: Map<string, Uniform<any>>

Shader uniforms.

Call Effect.setChanged after adding or removing uniforms.

Accessors

  • get amplitude(): number
  • The amplitude.

    Returns number

  • set amplitude(arg): void
  • Parameters

    • arg: number

    Returns void

  • get epicenter(): Vector3
  • The position of the shock wave.

    Returns Vector3

    Use position instead.

  • set epicenter(arg): void
  • Parameters

    • arg: Vector3

    Returns void

  • get inputColorSpace(): ColorSpace
  • Experimental

    The input color space.

    Returns ColorSpace

  • set inputColorSpace(arg): void
  • Protected Experimental

    Parameters

    • arg: ColorSpace

    Returns void

  • set mainCamera(arg): void
  • Sets the main camera.

    Parameters

    • arg: Camera

    Returns void

  • set mainScene(arg): void
  • Sets the main scene.

    Parameters

    • arg: Scene

    Returns void

  • get maxRadius(): number
  • The maximum radius.

    Returns number

  • set maxRadius(arg): void
  • Parameters

    • arg: number

    Returns void

  • get outputColorSpace(): ColorSpace
  • Experimental

    The output color space.

    Should only be changed if this effect converts the input colors to a different color space.

    Returns ColorSpace

  • set outputColorSpace(arg): void
  • Protected Experimental

    Parameters

    • arg: ColorSpace

    Returns void

  • get waveSize(): number
  • The wave size.

    Returns number

  • set waveSize(arg): void
  • Parameters

    • arg: number

    Returns void

Methods

  • Adds a listener to an event type.

    Type Parameters

    • T extends keyof Event<string, unknown>

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<Event<string, unknown>[T], T, ShockWaveEffect>

      The function that gets called when the event is fired.

    Returns void

  • Fire an event type.

    Type Parameters

    • T extends keyof Event<string, unknown>

    Parameters

    • event: BaseEvent<T> & Event<string, unknown>[T]

      The event that gets fired.

    Returns void

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

    The EffectComposer calls this method when it is being destroyed.

    Returns void

  • Emits the shock wave.

    Returns void

  • Returns the blend mode.

    The result of this effect will be blended with the result of the previous effect using this blend mode.

    Returns BlendMode

    The blend mode.

    Use blendMode instead.

  • Returns the preprocessor macro definitions.

    Returns Map<string, string>

    The extensions.

    Use defines instead.

  • Returns the fragment shader.

    Returns string

    The fragment shader.

  • Returns the name of this effect.

    Returns string

    The name.

    Use name instead.

  • Returns the position of the shock wave.

    Returns Vector3

    The position.

    Use position instead.

  • Returns the speed of the shock wave.

    Returns number

    The speed.

    Use speed instead.

  • Returns the uniforms of this effect.

    Returns Map<string, Uniform<any>>

    The extensions.

    Use uniforms instead.

  • Returns the vertex shader.

    Returns string

    The vertex shader.

  • Checks if listener is added to an event type.

    Type Parameters

    • T extends keyof Event<string, unknown>

    Parameters

    • type: T

      The type of event to listen to.

    • listener: EventListener<Event<string, unknown>[T], T, ShockWaveEffect>

      The function that gets called when the event is fired.

    Returns boolean

  • Performs initialization tasks.

    This method is called when the associated EffectPass is added to an EffectComposer.

    Parameters

    • renderer: WebGLRenderer

      The renderer.

    • alpha: boolean

      Whether the renderer uses the alpha channel or not.

    • frameBufferType: number

      The type of the main frame buffers.

    Returns void

    if(!alpha && frameBufferType === UnsignedByteType) { this.myRenderTarget.texture.format = RGBFormat; }
    
  • Removes a listener from an event type.

    Type Parameters

    • T extends keyof Event<string, unknown>

    Parameters

    • type: T

      The type of the listener that gets removed.

    • listener: EventListener<Event<string, unknown>[T], T, ShockWaveEffect>

      The listener function that gets removed.

    Returns void

  • Protected

    Sets the effect attributes.

    Effects that have the same attributes will be executed in the order in which they were registered. Some attributes imply a higher priority.

    Parameters

    Returns void

  • Protected

    Informs the associated EffectPass that this effect requires a shader recompilation.

    Should be called after changing macros or extensions and after adding/removing uniforms.

    Returns void

  • Sets the depth texture.

    You may override this method if your effect requires direct access to the depth texture that is bound to the associated EffectPass.

    Parameters

    • depthTexture: Texture

      A depth texture.

    • OptionaldepthPacking: DepthPackingStrategies

      The depth packing.

    Returns void

  • Protected

    Sets the fragment shader.

    Parameters

    • fragmentShader: string

      The fragment shader.

    Returns void

  • Sets the position of the shock wave.

    Parameters

    • value: Vector3

      The position.

    Returns void

    Use position instead.

  • Sets the renderer.

    Parameters

    • renderer: WebGLRenderer

      The renderer.

    Returns void

  • Updates the size of this effect.

    You may override this method if you want to be informed about the size of the backbuffer/canvas. This method is called before initialize and every time the size of the EffectComposer changes.

    Parameters

    • width: number

      The width.

    • height: number

      The height.

    Returns void

  • Sets the speed of the shock wave.

    Parameters

    • value: number

      The speed.

    Returns void

    Use speed instead.

  • Protected

    Sets the vertex shader.

    Parameters

    • vertexShader: string

      The vertex shader.

    Returns void

  • Updates this effect.

    Parameters

    • renderer: WebGLRenderer

      The renderer.

    • inputBuffer: WebGLRenderTarget<Texture>

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

    • Optionaldelta: number

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

    Returns void