Skip to content

FogField beta ​

Class of @v12-engine/client/lite-views

ts
export declare class FogField

The fog of war as a field of brightness a cell, softened at its edges and eased in time, written into the renderer's fogOfWar a square at a time: the CPU half of the client's FogRenderer

Members ​

constructor ​

ts
constructor(source: () => FogState, texture: FogTarget);

Constructs a new instance of the FogField class

at ​

ts
at(x: number, z: number, what: 'visible' | 'explored'): boolean;

Whether a point is seen now, or was seen once, as the fog of war says: all is, where there is no war

brightnessAt ​

ts
brightnessAt(x: number, z: number): number;

Brightness at a point, as currently shown

bytes ​

ts
get bytes(): Uint8Array;

The texture's bytes, a cell each, row by row from z 0: how bright each is drawn

depth ​

ts
readonly depth: number;

The map's depth in cells

dispose ​

ts
dispose(): void;

Lets go of what it read the fog from (the game that ended, whole)

refresh ​

ts
refresh(): void;

Makes the next update work out the whole map again, after the visibility source changed

setBeyond ​

ts
setBeyond(beyond: FogBeyond | undefined): void;

What lies beyond the part of the map play happens in (FogBeyond): as dim as explored ground whatever is seen. None, undefined, for a map that is played all over. Its fade into a colour is the renderer's (beyondShapeOf)

setBrightness ​

ts
setBrightness(brightness: FogBrightness): void;

How bright what was seen once (explored) and what never was (unexplored) are drawn, 0..1

update ​

ts
update(dt: number): void;

Eases the fog's brightness towards the simulation's by dt seconds, and works out and writes the squares that changed

width ​

ts
readonly width: number;

The map's width and depth in cells; the fog's texture is this size

written ​

ts
written: number;

How many squares the last update wrote, and whether it wrote the whole map in one

wroteWhole ​

ts
wroteWhole: boolean;

Whether the last update wrote the whole map in one write