VisionSource

VisionSource

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

Constructor

new VisionSource(object)

Parameters:
Name Type Description
object Token

The Token object that generates this vision source

Extends

Members

(protected) _flags :Object.<string, boolean>

Overrides:

Boolean flags which control whether certain behaviors of the source must be enforced

Type:
  • Object.<string, boolean>

active :boolean

Overrides:

A flag for whether this source is currently active (rendered) or not

Type:
  • boolean

data :VisionSourceData

Overrides:

The object of data which configures how the source is rendered

Type:

fovTexture :PIXI.RenderTexture

The rendered field-of-vision texture for the source for use within shaders.

Type:
  • PIXI.RenderTexture

GEOMETRY :PIXI.Geometry

Overrides:

The default Geometry stored in the GPU for all Point Source meshes.

Type:
  • PIXI.Geometry

illumination :PIXI.Mesh

The current vision mesh for this source

Type:
  • PIXI.Mesh

limited :boolean

Overrides:

Is the angle of emission for this source limited?

Type:
  • boolean

los :PointSourcePolygon

Overrides:

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

Type:

losMask :PIXI.Graphics

Overrides:

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

Type:
  • PIXI.Graphics

object :PlaceableObject

Overrides:

The object responsible for this source.

Type:

radius :number

Overrides:

The maximum radius of emission for this source

Type:
  • number

ratio :number

The ratio of dim:bright as part of the source radius

Type:
  • number

sourceType :string

Overrides:

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

Type:
  • string

x :number

Overrides:

The x-coordinate of the point source origin.

Type:
  • number

y :number

Overrides:

The y-coordinate of the point source origin.

Type:
  • number

Methods

(protected) _createMesh(shaderCls) → {PIXI.Mesh}

Overrides:

Create a new Mesh for this source using a provided shader class

Parameters:
Name Type Description
shaderCls function

The subclass of AdaptiveLightingShader being used for this Mesh

Returns:

The created Mesh

Type
PIXI.Mesh

(protected) _drawRenderTextureContainer() → {PIXI.Container}

Overrides:

Create a container that should be rendered to the fov texture for this source

Returns:

The drawn container for the render texture

Type
PIXI.Container

(protected) _renderTexture() → {PIXI.RenderTexture}

Overrides:

Render this source to a texture which can be used for masking and blurring.

Returns:
Type
PIXI.RenderTexture

(protected) _updateMesh(mesh) → {PIXI.Mesh}

Overrides:

Update the position and size of the mesh each time it is drawn.

Parameters:
Name Type Description
mesh PIXI.Mesh

The Mesh being updated

Returns:

The updated Mesh

Type
PIXI.Mesh

containsPoint(point) → {boolean}

Overrides:

A point is contained with the area of the source if it is within both the FOV circle as well as the LOS polygon.

Parameters:
Name Type Description
point Point

The point to test

Returns:

Is the point contained

Type
boolean

destroy()

Overrides:

Steps that must be performed when the base source is destroyed.

drawSight() → {PIXI.Container}

Draw a Container used for exploring the FOV area of Token sight in the SightLayer

Returns:
Type
PIXI.Container

drawVision() → {PIXI.Container|null}

See:

Draw the display of this source to remove darkness from the LightingLayer illumination container.

Returns:

The rendered light container

Type
PIXI.Container | null

getPowerOf2Size() → {number}

Overrides:

Get power of 2 size pertaining to base-source radius and performance modes

Returns:

The computed power of 2 size

Type
number

initialize(data) → {VisionSource}

Overrides:
  • PointSource#initialize

Initialize the source with provided object data.

Parameters:
Name Type Description
data object

Initial data provided to the point source

Returns:

A reference to the initialized source

Type
VisionSource