FogOfWar
Classes
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 - .distanceFieldNeedsUpdate :
boolean - .texture :
DataTexture|null - .scale :
Vector1 - .size :
Vector2 - .fadeMask :
RowFirstTable - .sampler :
Sampler2D - .distanceSampler :
Sampler2D - .updateFade(timeDelta)
- .revealPoint(x, y)
- .reveal(x, y, radius)
- .conceal(x, y, radius)
- .update(timeDelta)
- .computeRevealedGridBoundingRectangle(result)
- .worldToSamplePosition(x, y, result)
- .computeAABBVisibility(aabb, cameraFocalPoint, clearance)
- .getWorldClearance(x, y) ⇒
number - .resize(w, h, scale)
- .textureNeedsUpdate :
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
| Param | Type |
|---|---|
| timeDelta | number |
fogOfWar.revealPoint(x, y)
Kind: instance method of FogOfWar
| Param | Type |
|---|---|
| x | number |
| y | number |
fogOfWar.reveal(x, y, radius)
Kind: instance method of FogOfWar
| Param | Type |
|---|---|
| x | number |
| y | number |
| radius | number |
fogOfWar.conceal(x, y, radius)
Kind: instance method of FogOfWar
| Param | Type |
|---|---|
| x | number |
| y | number |
| radius | number |
fogOfWar.update(timeDelta)
Kind: instance method of FogOfWar
| Param | Type |
|---|---|
| timeDelta | number |
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
| Param | Type |
|---|---|
| result | AABB2 |
fogOfWar.worldToSamplePosition(x, y, result)
Kind: instance method of FogOfWar
| Param | Type |
|---|---|
| x | number |
| y | number |
| result | Array.<number> |
fogOfWar.computeAABBVisibility(aabb, cameraFocalPoint, clearance)
Kind: instance method of FogOfWar
| Param | Type | Description |
|---|---|---|
| aabb | AABB3 | |
| cameraFocalPoint | Vector3 | |
| clearance | number | distance 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
| Param | Type | Description |
|---|---|---|
| x | number | world X coordinate |
| y | number | world Y coordinate |
fogOfWar.resize(w, h, scale)
Kind: instance method of FogOfWar
| Param | Type |
|---|---|
| w | number |
| h | number |
| 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