Skip to content

FoliageView beta ​

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

ts
export declare class FoliageView implements CellLayerView

A layer's grass and bushes as drawn: what a game's code reaches through the layer's part. See the file's comment

Members ​

constructor ​

ts
constructor(given: CellLayerContext, 
    look: FoliageLook);

Constructs a new instance of the FoliageView class

chunks ​

ts
readonly chunks?: FoliageChunks;

The grass's chunks: which wait to be laid, where each is, its level by its distance. None where no style draws grass

cost ​

ts
get cost(): number;

Milliseconds its last frame took on the CPU, the laying in it left out

dispose ​

ts
dispose(): void;

Its batches, materials' textures and uniforms let go of

disturb ​

ts
disturb(x: number, z: number, strength?: number): void;

Shakes the bushes at a place, as one moving through them would (strength 1): what the rules tell of one hidden in them (rustle), or a game's code (an explosion, a deer)

drawn ​

ts
get drawn(): number;

How many tufts or models are laid

drawnLook ​

ts
get drawnLook(): FoliageLookParts;

The look it draws now, by its groups: the one it was given, with this screen's changes over it (setScreen)

fireStats ​

ts
get fireStats(): FoliageFireStats | undefined;

What its fire costs and does now (FoliageFireStats): none where it has none

flatten ​

ts
flatten(cells: readonly number[], amount?: number): void;

Lays grass flat at these cells on this screen, 1 flat, 0 standing again at once, read by the shader, nothing laid again. It stands up again as its style's walked.recover says, never for 0

frame ​

ts
frame(frame: CellLayerFrame): void;

Every frame: the wind moves on, the chunks waiting are laid as the budget allows and each is drawn at its level, and the bushes are shaken by who goes into them, the nearest the camera first; it is see-through around the player's own units in it, and rustles now and then as each moves through it. Nothing made that is let go of

frameState ​

ts
readonly frameState: FoliageFrame;

What every material of it is drawn with this frame

groundChanged ​

ts
groundChanged(cells?: readonly number[]): void;

The ground under these cells changed (or all of it): what stands on it laid again at its new heights

lay ​

ts
lay(changed?: readonly number[]): void;

The grass and the bushes laid out again from its cells: after they changed (these, or all), or the ground under them did. A few chunks' worth at once; a whole map's a few chunks a frame, the nearest the camera first

layState ​

ts
layState(changed?: readonly number[], over?: number, seen?: boolean): void;

What happened to the layer's cells changed (foliageStateLayer): their state written into the texture the shader reads, and when what grows back started and how long it takes (over, as the rules said), when what burns caught (not said where it came into sight burning: seen)

look ​

ts
look: FoliageLook;

The look it was given: made with, or taken since (relook)

models ​

ts
readonly models?: BushModels;

The game's models, where a style of it draws them (draw: 'models')

neverSolid ​

ts
neverSolid: boolean;

Every chunk drawn by the shader that may leave pixels out, whatever it holds: for measuring what solidify saves

pending ​

ts
get pending(): number;

Chunks that wait to be laid: none once a laying is done

ready ​

ts
readonly ready: Promise<void>;

Settles once its textures are on the card and what was asked of it before is laid

relook ​

ts
relook(look: FoliageLook): boolean;

Takes another look in place, this screen's changes still over it: the chunks whose copies it changes laid again, and nothing where it changes only what the shader reads (the sway, the shakes, the levels). The values the game names are read again with it. Whether it could: not between grass and models, nor where the models are laid otherwise (a part is made anew for those)

setDetail ​

ts
setDetail(amount: number): void;

How much of its density is drawn, 0 to 1: the graphics settings' tall grass

setScreen ​

ts
setScreen(screen: ((given: FoliageLookParts) => FoliageLookParts) | undefined): boolean;

This screen's own changes over the look it is given, from now on: a function of that look, by its groups, to the look drawn; none for the look as given. Taken in place as relook takes a look: whether it could

shake ​

ts
readonly shake: BushShake;

Where they are shaken now: disturb shakes them from code

showAway ​

ts
showAway(away: number | undefined): void;

Draws it as the camera would from away cells from where it looks, on the line it looks along: which copies are thinned out and at which level each chunk is drawn, to judge the levels without moving the camera. None (undefined) for where the camera is

showState ​

ts
showState(cells: Uint8Array | undefined, options?: {
        changed?: readonly number[];
        over?: number;
        burns?: (value: number) => number | undefined;
    }): void;

Shows the cells in a state of the caller's in the place of the rules' (FOLIAGE_STATE), on this screen alone and written nowhere: an editor's preview of how a patch burns, is ruined and grows back. cells a value a cell of the map, row by row; changed the cells that changed since it was last shown (all when left out); over the seconds what turns to growing takes. None (undefined) shows the rules' state again

state ​

ts
readonly state: FoliageStateTexture;

What happened to each cell, as the grass's and the bushes' shaders read it

stateShown ​

ts
get stateShown(): boolean;

Whether a state of the caller's is shown in the place of the rules' (showState)

stats ​

ts
get stats(): FoliageStats & {
        solid: number;
        seenThrough: number;
    };

What it costs now (FoliageStats): its chunks, those drawn at a level (the renderer leaves out those out of the view), its copies, those drawn, what its last laying took and its last frame

styleTable ​

ts
readonly styleTable: FoliageStyleTable;

What each style says that the grass's shader reads as it draws

sunStrength ​

ts
sunStrength?: number;

How strong the sun is for what comes through the tips and shines (the client's light's intensity, 2 at most): the brightest of the sun's colour where left out

tileCells ​

ts
readonly tileCells?: FoliageTileCells;

The cells it is drawn from where it grows from the ground's paint (FoliageLook.on): none where it grows where the layer is painted alone

walk ​

ts
readonly walk?: FoliageWalk;

Where the grass is pushed and laid down by who walks in it on this screen. None for models, which only shake

warmFire ​

ts
warmFire(): {
        effects: {
            name: string;
            effect: string | FxDef;
        }[];
    };

What its fire plays, made ahead (the warm-up, behind the loading screen): the effects its looks name, as played, the client's warmFire