Options
All
  • Public
  • Public/Protected
  • All
Menu

A specialized subclass of the PointSource abstraction which is used to control the rendering of sound sources.

param object

The AmbientSound object that generates this sound source

Hierarchy

Index

Constructors

Properties

data: SoundSourceData = {}

The object of data which configures how the source is rendered

The restricted line-of-sight polygon that is generated by the origin and radius of this source.

radius: number

The maximum radius of emission for this source

The PlaceableObject which is the origin of this PointSource.

active: boolean = false

A flag for whether this source is currently rendered or not.

The animation configuration applied to this source

losMask: any = ...

A Graphics object with pre-computed geometry used for masking based on line-of-sight.

_flags: Object = {}

Additional information which controls whether certain behaviors of the source must be enforced

_meshesInit: boolean = false

To track meshes initialization

sourceType: string = "sound"

The type of source represented by this data structure. Each subclass must implement this attribute.

EDGE_OFFSET: number = -8

The offset in pixels applied to create soft edges.

Methods

  • Initialize the source with provided object data.

    Parameters

    • data: any = {}

      Initial data provided to the point source

    Returns SoundSource

    A reference to the initialized source

  • _getPolygonConfiguration(): { type: string; radius: number; density: number; source: SoundSource }
  • containsPoint(point: Point): boolean
  • A point is contained with the area of the source if it is within both the FOV circle and the LOS polygon.

    Parameters

    • point: Point

      The point to test

    Returns boolean

    Is the point contained

  • destroy(): void
  • Steps that must be performed when the base source is destroyed.

    Returns void

  • refreshSource(): void
  • _createMeshes(): void
  • animate(dt: number): any
  • Animate the BaseSource, if an animation is enabled and if it currently has rendered containers.

    Parameters

    • dt: number

      Delta time.

    Returns any

  • _updateLosGeometry(polygon: Polygon): void
  • Create or update the source geometry with a polygon shape Triangulate the form and create buffers

    Parameters

    Returns void

  • _initializeMeshes(polygon: Polygon): void
  • _createMesh(shaderCls: Function): Mesh
  • Create a new Mesh for this source using a provided shader class

    Parameters

    • shaderCls: Function

      The subclass of AdaptiveLightingShader being used for this Mesh

    Returns Mesh

    The created Mesh

  • _updateMesh(mesh: Mesh): Mesh
  • Update the position and size of the mesh each time it is drawn.

    Parameters

    • mesh: Mesh

      The Mesh being updated

    Returns Mesh

    The updated Mesh

  • _initializeData(data: any): void
  • Process new input data provided to the SoundSource.

    Parameters

    • data: any

      Initial data provided to the sound source

    Returns void

Accessors

  • get x(): number
  • The x-coordinate of the point source origin.

    Returns number

  • get y(): number
  • The y-coordinate of the point source origin.

    Returns number

  • get sourceType(): string
  • The type of source represented by this data structure.

    Returns string

  • get elevation(): number
  • The elevation of the object bound to this base source, if any. Returns the canvas primary background elevation otherwise.

    Returns number

  • get isAnimated(): boolean
  • If the source is animated or not.

    Returns boolean