Skip to main content

FogOfWar

Classes

FogOfWar

Constants

FADE_SPEED : number

Measured in Uint8 channel value per second.

INITIAL_FADE_VALUE : number

pre-fade to enable correct distance field calculation

revealMaskTableSpec : RowFirstTableSpec

FogOfWar

Kind: global class

fogOfWar.textureNeedsUpdate : boolean

Kind: instance property of FogOfWar

fogOfWar.distanceFieldNeedsUpdate : boolean

Kind: instance property of FogOfWar

fogOfWar.texture : DataTexture | null

Kind: instance property of FogOfWar

fogOfWar.scale : Vector1

Resolution scale of FoW versus terrain resolution, higher number makes FoW more detailed

Kind: instance property of FogOfWar

fogOfWar.size : Vector2

Size of the fog area

Kind: instance property of FogOfWar

fogOfWar.fadeMask : RowFirstTable

Contains indices of pixes that are currently being updated

Kind: instance property of FogOfWar

fogOfWar.sampler : Sampler2D

Kind: instance property of FogOfWar

fogOfWar.distanceSampler : Sampler2D

Kind: instance property of FogOfWar

fogOfWar.updateFade(timeDelta)

Kind: instance method of FogOfWar

ParamType
timeDeltanumber

fogOfWar.revealPoint(x, y)

Kind: instance method of FogOfWar

ParamType
xnumber
ynumber

fogOfWar.reveal(x, y, radius)

Kind: instance method of FogOfWar

ParamType
xnumber
ynumber
radiusnumber

fogOfWar.conceal(x, y, radius)

Kind: instance method of FogOfWar

ParamType
xnumber
ynumber
radiusnumber

fogOfWar.update(timeDelta)

Kind: instance method of FogOfWar

ParamType
timeDeltanumber

fogOfWar.computeRevealedGridBoundingRectangle(result)

Compute bounding box of revealed area in grid space, where coordinate system maps to discrete texels of the fog

Kind: instance method of FogOfWar

ParamType
resultAABB2

fogOfWar.worldToSamplePosition(x, y, result)

Kind: instance method of FogOfWar

ParamType
xnumber
ynumber
resultArray.<number>

fogOfWar.computeAABBVisibility(aabb, cameraFocalPoint, clearance)

Kind: instance method of FogOfWar

ParamTypeDescription
aabbAABB3
cameraFocalPointVector3
clearancenumberdistance to nearest non-occluding cell

fogOfWar.getWorldClearance(x, y) ⇒ number

Returns fog clearance from a set of world coordinates

Kind: instance method of FogOfWar
Returns: number - clearance value

ParamTypeDescription
xnumberworld X coordinate
ynumberworld Y coordinate

fogOfWar.resize(w, h, scale)

Kind: instance method of FogOfWar

ParamType
wnumber
hnumber
scale

FADE_SPEED : number

Measured in Uint8 channel value per second.

Kind: global constant
Read only: true
Example

255 would mean complete fade happens in 1s, 25.5 would mean fade happens over 10 seconds

INITIAL_FADE_VALUE : number

pre-fade to enable correct distance field calculation

Kind: global constant
Read only: true

revealMaskTableSpec : RowFirstTableSpec

Kind: global constant