PointSource

PointSource

A helper class used by the Sight Layer to represent a source of vision or illumination.

Constructor

(abstract) new PointSource(object)

Parameters:
Name Type Description
object PlaceableObject

The object responsible for the PointSource

Members

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

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

Type:
  • Object.<string, boolean>

active :boolean

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

Type:
  • boolean

data :object

The object of data which configures how this source is rendered

Type:
  • object

GEOMETRY :PIXI.Geometry

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

Type:
  • PIXI.Geometry

limited :boolean

Is the angle of emission for this source limited?

Type:
  • boolean

los :PointSourcePolygon

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

Type:

losMask :PIXI.Graphics

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

Type:
  • PIXI.Graphics

object :PlaceableObject

The object responsible for this source.

Type:

radius :number

The maximum radius of emission for this source

Type:
  • number

sourceType :string

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

Type:
  • string

sourceType :string

The type of source represented by this data structure.

Type:
  • string

x :number

The x-coordinate of the point source origin.

Type:
  • number

y :number

The y-coordinate of the point source origin.

Type:
  • number

Methods

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

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}

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}

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

Returns:
Type
PIXI.RenderTexture

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

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}

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()

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

getPowerOf2Size() → {number}

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

Returns:

The computed power of 2 size

Type
number