LiteWorldView beta
Class of @v12-engine/client/lite-views
export declare class LiteWorldViewThe world as it is drawn on this renderer, without a game: the client's WorldView with its surface, its parts made in its order from a map and a game's view (see the top of this file)
Members
constructor
constructor(options: LiteWorldOptions);Constructs a new instance of the LiteWorldView class
assets
readonly assets: Assets;The files the world draws with: models, textures, sounds
blocksChanged
blocksChanged(area: CellRect): void;Cells under a doodad that blocks, put down or taken away: the layers laid again under it, once a frame
camera
readonly camera: RtsCamera;The camera, the one LiteWorldOptions.camera made: it drives renderer.camera
daylight
readonly daylight: LiteDaylight;The light of the day: told the hour by the caller (a game's clock, the editor's preview)
detailQuality
get detailQuality(): number;
set detailQuality(quality: number);The quality's multiplier on every level's distance (client.detail.quality: low 0.5, medium 0.75, high 1): the scenery levelled again by it
dispose
dispose(): void;Takes every part apart in the reverse order of their making. Safe halfway through being made, and twice: every step is taken whatever the one before it did. The renderer is the caller's to stop and free after
doodads
readonly doodads?: SceneryView;The scenery of the map, which is no entity; none where the world was given no models' files
environment
readonly environment: LiteEnvironment;What the map says it looks like beyond its ground
fog
readonly fog: FogField;The fog of war: every kind of material reads it; what it hides is hidden by each view
fogAt
fogAt(x: number, z: number, what: 'visible' | 'explored'): boolean;Whether a point is seen now, or was seen once, as the fog of war says
frame
frame(dt: number, alpha: number): void;A frame of the world, once the camera stands where it does for it: the camera's maths, the sun's shadows as far as the camera sees ground, the ground, the scenery, the layers of cells, the sounds, the map's look, the fog, the entities and the effects, and what a pick finds. The renderer draws after
Parameters
alpha: how far between the previous and the current simulation tick the frame is: 1 where nothing ticks
frameLight
frameLight(dt: number): void;The lights at the hour the daylight was last told, before the camera moves for the frame: the lamps as dark as it is, and the sun and the sky into the renderer's where the day's light changed
framePicture
framePicture(): void;The picture's look at the hour, the map's as it is and the zones the camera looks into (after the environment's frame)
fx
readonly fx?: FxSlot;TODO(slot)
glow
readonly glow: LiteGlow;What is made to shine glowing past its edges: the renderer's layer, by the game's and the map's look and the hour
groundChanged
groundChanged(area?: CellRect): void;The ground was reshaped: drawn again where it changed (area, in cells) or all over, and what stands on it there with it: the layers of cells, the scenery, the entities, the map's lights, and how low the shadows fall
groundLooks
groundLooks(environment: MapEnvironment | undefined, tileset?: readonly string[]): ReturnType<typeof groundLooks>;What the ground is drawn with: the game's tiles, then the map's own, in the order its world is painted with, and the game's borders with the map's over them. For terrainView.setLooks, as the map's looks change
gust
gust(at: Vec2, gust: WindGust): void;A gust of wind at a place on this world alone (WindGust): its grass and bushes blown. What the editor's preview gusts with, where no game is played
layers
readonly layers?: LayersSlot;TODO(slot)
lights
readonly lights: WorldLamps;The lights besides the sun and the sky: lamps, torches, runes
maths
readonly maths: CameraMaths;The camera's matrices for the frame, without the renderer's jitter: every point projected and every ray
passes
readonly passes: LitePicturePasses;A game's own passes over the picture (GameView.world.passes, client.picture.addPass): WGSL on the renderer's chain
picks
readonly picks: PickIndex;What a ray can hit, written by the views' data: the scenery, the buildings
picture
readonly picture: LitePicture;The picture's look (renderer.post.settings): the game's, the map's over it, the zones looked into, by the hour
placed
placed(): void;The camera stands where it does: its matrices worked out for every point and ray asked until the next, and its tilt and its view without perspective handed to the renderer's. Once a frame (frame does), and by whoever places the camera by hand between two frames and asks the screen something after
prepare
prepare(): Promise<void>;Resolves once what the world draws with is there: the ground's textures, the scenery's models and pictures
projectTo
projectTo(x: number, y: number, z: number, out: {
x: number;
y: number;
}): boolean;Puts where a point of the world is in the view (CSS pixels of the canvas) into out. False, and out left alone, when it is behind the camera. What draws something over the view where a point of the world is: a pin, a label
registry
readonly registry: Registry;The registry of the game's types, which the entities drawn are looked up in
reloaders
readonly reloaders: ((models: readonly string[]) => unknown)[];What else reads models' files, to read them anew once they changed on disk (reloadFiles): the shots', the items'
reloadFiles
reloadFiles(changed: ChangedFiles, ground?: {
environment?: MapEnvironment;
tileset?: readonly string[];
}): Promise<void>;Model and texture files changed on disk (hotFiles): the addresses of them are new (Assets.changed), what is drawn with the models drawn again, and the ground drawn again from its textures where one changed
renderer
readonly renderer: Renderer;The renderer everything of the world is drawn by: the caller's
sceneShadows
readonly sceneShadows: LiteSceneShadows;Which things cast the sun's shadow: the game's say, the map's over it, the game's code thing by thing (client.sceneShadows)
screen
readonly screen: ScreenPick<EntityView>;What is under a point of the view, what a box of it holds (ScreenSpace's rules)
seeThrough
readonly seeThrough: SeeThrough;What stands between the camera and the units the game says is seen through, dithered while it does
selected
selected: () => ReadonlySet<number>;Those selected now, for a see-through of who: 'selected': the caller's (a game's controller), none until said
setDoodads
setDoodads(doodads: readonly MapDoodad[]): void;The scenery of the map as it is now: what is not in doodads goes, what is new or changed comes
shadowFit
readonly shadowFit: ShadowFit;The sun's shadows drawn as far as the camera sees ground
standing
standing(changes: {
readonly added: readonly CellStanding[];
readonly removed: readonly CellStanding[];
}): void;What a snapshot added and removed of the entities: the layers of cells keep off the ground under the buildings among them
state
readonly state: GameState;The entities drawn, as the caller keeps them
sync
sync(changes: StateChanges): void;A snapshot's changes (StateChanges): the units' view, the buildings a pick finds, the grass under what stands
terrain
readonly terrain: Terrain;The ground the world stands on, the one given in the options
terrainView
readonly terrainView: GroundView;Draws the ground: the tiles, cliffs, borders and water
times
times: PhaseTimes;Where the parts of the world's frame are timed: idle until it is turned on
units
readonly units?: UnitsSlot;Draws the entities of the state, where the world was given their looks
view
readonly view: Pick<GameView, 'ground' | 'world'>;How the ground and the world look, as the game says (GameView)
viewCorners
viewCorners(): Vec2[];Where the corners of the view meet the ground, clockwise from the top left
walkers
walkers: (alpha: number) => readonly CellWalker[];Who walks about on the ground, as the layers of cells ask: a game's units; nobody in a world without a game