WorldDetail beta
Class of @v12-engine/client
export declare class WorldDetailLevels of detail for everything on the map (client.detail, the editor's too): the level each thing is drawn at, picked from its distance to the camera and its size on the screen, as its model, the game, the map, the thing itself and the game's code say, in that order (DetailLevel, DetailLook, MapDetail). Drawers hand it what they draw (track) and draw each thing at the level it tells them (DetailTarget.switched); it picks once a frame (frame), a tenth of the things a frame, all of them after the camera jumped, with hysteresis on every threshold so nothing flickers on the line. freeze holds every level, full draws everything at full. Detail is only drawn: the rules, the saves and the replays never see it
Members
constructor
constructor(view: DetailCamera, budget?: FrameBudget);view: the camera it goes by (DetailCamera: the renderer's view, which grows nothing by preloadMargin)
all
get all(): readonly DetailThing[];Every thing looked at, as it is now
budget
readonly budget: FrameBudget;The frame's budget its drawers' switches draw from (DetailTarget.switched: a unit's new level is a copy of its model made then), as switches: past their room, the other things due a level wait for the next frames, the nearest first, drawn a frame or two longer at the one they are at. A zoom takes many units over a line at once, and made each frame of it wait on all of them (frames of 30 to 75 ms). The client's (RenderKit.budget), shared with the other work done in pieces; one of its own, begun with each frame, where it is made alone
dispose
dispose(): void;Lets go of every thing tracked, the preloads and the levels' models
dueModel
dueModel(model: string): void;The things of a model looked at again on the next frame: a level of it has loaded
focus
focus?: () => {
x: number;
z: number;
};Where the camera looks on the ground: under the camera when the client says nothing
frame
frame(): void;Once a frame, before the drawers draw: a tenth of the things looked at (all of them once the camera jumped, or relevel), each drawn at the level it should be from now
freeze
freeze: boolean;Holds every level where it is: the editor's preview, screenshots, tests
full
get full(): boolean;
set full(full: boolean);Everything at full, as made, whatever is said (the editor's View › Full detail); as said again once false
hour
hour?: () => number;The hour of the day
hovered
hovered?: (target: DetailTarget) => boolean;Whether a thing is hovered, as the client says: the pointer is over it. Not hovered when left out
levelOf
levelOf(of: {
entity: number;
} | {
doodad: number;
}): number | undefined;The level an entity or a doodad is drawn at now, by index: nothing for what is not drawn by levels
levelsOf
levelsOf(model: string, kind?: DetailKind): DetailLevelInfo[];A model's levels as everything says, for a kind of thing (scenery when left out): each with whether it can be drawn and its triangles, as the drawer of a thing of it tells
load
load(model: string | ModelDef, files?: readonly string[]): Promise<void>;Loads a model's levels' files now, whatever wants them (a cutscene about to show a far city): all its made levels, or files by their paths, those said to be loaded by code alone (load: 'never') too. Settles once they have loaded
look
look: DetailLook;The game's (GameView.world.detail)
map
map: MapDetail | undefined;The map's (MapEnvironment.detail): over the game's. Set it with relevel after
onSwitch
onSwitch(listener: (thing: DetailThing, level: number, from: number) => void): () => void;Listens to every change of level: the thing, its level and the one before. What it gives back stops listening
overview
overview: number;How many cells farther the view is than where the map is looked at from (RtsCamera.overview): what is left out by its distance (draw: 'none', cull) is left out that much farther off, the other levels as they are, so an editor's view from far has the whole map, at its lightest. 0 for a game's
pick
get pick(): DetailLook['pick'];
set pick(pick: DetailLook['pick']);The game's code picking thing by thing (DetailLook.pick), while the game runs
pictureLight
pictureLight: number;How bright the pictures of the distance are (draw: 'impostor'), times the light the scene's lights give them as they give their models (B32). 1 when left out
preload
preload(models: readonly (string | ModelDef)[]): Promise<void>;Loads every made level of these models now (load): what a scene is about to show from far
preloadMargin
get preloadMargin(): number;
set preloadMargin(cells: number | undefined);How many cells past the edges of the view what is there is drawn already, so that it is ready before the camera brings it in: what code set here, else the map's (MapDetail.preload), else the game's (DetailLook.preload), else 0. Set it to override both while the game runs; undefined gives them back
quality
quality: number;The quality's multiplier on every from (detail: low 0.5, medium 0.75, high 1)
regionsAt
regionsAt?: (x: number, z: number) => readonly string[];The regions of the map the camera is over, by name: none when the client says nothing
relevel
relevel(): void;Every thing's levels worked out again, and looked at on the next frame: after the game, the map or a model changed what it says
scale
get scale(): number;What every from is multiplied by now: the quality's, times the map's or else the game's
screen
screen?: () => number;The screen's height in pixels, at its own size (CSS pixels): the canvas's when left out
selected
selected?: (target: DetailTarget) => boolean;Whether a thing is selected, or hovered: entities, as the client says
stats
get stats(): DetailStats;How many things are at which level now, and what they cost
track
track(target: DetailTarget): DetailThing;Starts looking at a thing a drawer draws: at full until it is first looked at, on the next frame
zoom
zoom?: () => number;How high the camera is over the ground: its height when the client says nothing