gfx

Methods
27
Fields
None

Getting one

gfx

Methods

MethodReturnsDescription
isHdActive()booleanWhether the client is drawing with its HD renderer right now (client.HD_ACTIVE). Raises on a build that does not place that field, rather…
isHdRequested()booleanWhether HD has been asked for (client.HD_REQUESTED). It can differ from isHdActive: the client picks the request up when it next applie…
isDeferredRendering()booleanWhether the GL context records its draws for the deferred-render thread to replay (the render preferences' deferred-rendering flag). Raises…
hasHdRenderer()booleanWhether the client holds an HD renderer (its renderer global is non-zero). False in SD. Raises on a build that does not place the global, o…
setHdRequested(boolean)()Ask the client for HD (true) or SD (false) through its own switch, applied at the top of the next client tick, which clears its model c…
setHdLook(boolean)()Which look HD draws with: the full one (true: sun, skybox, the map's environment), or the client's flat-lit default (false). Holds for…
isAvailable()booleanWhether the post-process pipeline can run on this client.
getCapabilities(){string}What holds on this client: any of "postfx", "environment" and "depth" (the fog and sky passes may read scene depth on this build), "lights"…
getUnavailableReason()stringWhy the pipeline cannot run here, for a settings page: "" when it can.
getPasses(){string}Every pass, in the order they run.
setPassEnabled(string, boolean)()Ask for a pass or stop asking. Asking again brings back a pass the frame budget dropped. Raises on a pass that does not exist.
isPassEnabled(string)booleanWhether a pass is asked for.
getPassState(string)stringWhat a pass is doing: "off", "on", "failed" (its shader or GL failed, off for the session) or "dropped" (over the frame budget, ask again t…
setParam(string, number)()Set a param, pass.knob, or budget.ms. Raises on a name that does not exist and on a value outside its range, rather than clamping, so a…
getParam(string)numberA param's value.
setLights({number})()Replace the lights: a flat list of x, y, z, radius, r, g, b, strength. x and y are world tiles (fractions allowed), z is height above the g…
clearLights()()Remove every light.
setLut({number}, number)()Replace the colour LUT: packed ARGB of a size by size by size cube, as a size*size by size strip. grade.lut says how much of it shows.
getDepthSource()stringWhere the depth passes got depth last frame: "none", "sd-copy", "sd-resolve" or "hd".
getFrameMs()numberThe last frame's post-process cost in milliseconds.
getAntiAliasing()number?The client's own anti-aliasing level, with 2 ^ level samples. nil where it cannot run on this build.
getAntiAliasingMax()number?The highest level setAntiAliasing takes. nil where it cannot run on this build.
setAntiAliasing(number)booleanAsk for the client's own anti-aliasing at a level, set at the top of the next client tick through its own setting, so it is the player's se…
setRetexture(string, number, {number}, {number})booleanReplace textures on a type: kind is "loc", "npc", "obj", "spotanim" or "kit", find and replace are the client's texture ids, paired.…
setOverlayTexture(number, number)booleanSet an overlay's texture, shown from the next scene build. False when the overlay does not exist or overlays are not loaded yet.
clearOverrides()()Forget every retexture and put every overlay back. Types the client already rebuilt keep their lists until flushOverrides.
flushOverrides()booleanHave the client rebuild its types and reload the scene at the top of the next tick, with its loading screen. For types it had already loade…

Method details

isHdActive

isHdActive: (Gfx) -> boolean

Whether the client is drawing with its HD renderer right now (client.HD_ACTIVE). Raises on a build that does not place that field, rather than answering false: false is SD.

isHdRequested

isHdRequested: (Gfx) -> boolean

Whether HD has been asked for (client.HD_REQUESTED). It can differ from isHdActive: the client picks the request up when it next applies it. Raises on a build that does not place that field.

isDeferredRendering

isDeferredRendering: (Gfx) -> boolean

Whether the GL context records its draws for the deferred-render thread to replay (the render preferences' deferred-rendering flag). Raises on a build that does not place it, or before the client has its render preferences.

hasHdRenderer

hasHdRenderer: (Gfx) -> boolean

Whether the client holds an HD renderer (its renderer global is non-zero). False in SD. Raises on a build that does not place the global, or when it cannot be read.

setHdRequested

setHdRequested: (Gfx, boolean) -> ()

Ask the client for HD (true) or SD (false) through its own switch, applied at the top of the next client tick, which clears its model caches and reloads the scene; nothing happens if it is already in that mode. Not a write of the request byte: that alone would leave the request and isHdActive disagreeing. Game thread only; raises when not logged in, when the client forbids HD, and on a client whose table has the switch off.

setHdLook

setHdLook: (Gfx, boolean) -> ()

Which look HD draws with: the full one (true: sun, skybox, the map's environment), or the client's flat-lit default (false). Holds for the session, including the default the client puts back at each login, and waits for HD if asked in SD. Changing it while HD is on reloads the scene. Raises on a client whose table has the switch off.

isAvailable

isAvailable: (Gfx) -> boolean

Whether the post-process pipeline can run on this client.

getCapabilities

getCapabilities: (Gfx) -> {string}

What holds on this client: any of "postfx", "environment" and "depth" (the fog and sky passes may read scene depth on this build), "lights" and "typeOverrides". Empty where the pipeline cannot run. Cheap enough for every tick. It is about the build, not a frame: getPassState says when a pass stood aside, getDepthSource where depth came from.

getUnavailableReason

getUnavailableReason: (Gfx) -> string

Why the pipeline cannot run here, for a settings page: "" when it can.

getPasses

getPasses: (Gfx) -> {string}

Every pass, in the order they run.

setPassEnabled

setPassEnabled: (Gfx, string, boolean) -> ()

Ask for a pass or stop asking. Asking again brings back a pass the frame budget dropped. Raises on a pass that does not exist.

isPassEnabled

isPassEnabled: (Gfx, string) -> boolean

Whether a pass is asked for.

getPassState

getPassState: (Gfx, string) -> string

What a pass is doing: "off", "on", "failed" (its shader or GL failed, off for the session) or "dropped" (over the frame budget, ask again to bring it back).

setParam

setParam: (Gfx, string, number) -> ()

Set a param, pass.knob, or budget.ms. Raises on a name that does not exist and on a value outside its range, rather than clamping, so a data bug shows.

getParam

getParam: (Gfx, string) -> number

A param's value.

setLights

setLights: (Gfx, {number}) -> ()

Replace the lights: a flat list of x, y, z, radius, r, g, b, strength. x and y are world tiles (fractions allowed), z is height above the ground in tiles, radius is in tiles and rgb is 0 to 1. A light off the loaded scene is left out. Call it when the set changes and after a scene load.

setLut

setLut: (Gfx, {number}, number) -> ()

Replace the colour LUT: packed ARGB of a size by size by size cube, as a size*size by size strip. grade.lut says how much of it shows.

getDepthSource

getDepthSource: (Gfx) -> string

Where the depth passes got depth last frame: "none", "sd-copy", "sd-resolve" or "hd".

getFrameMs

getFrameMs: (Gfx) -> number

The last frame's post-process cost in milliseconds.

getAntiAliasing

getAntiAliasing: (Gfx) -> number?

The client's own anti-aliasing level, with 2 ^ level samples. nil where it cannot run on this build.

getAntiAliasingMax

getAntiAliasingMax: (Gfx) -> number?

The highest level setAntiAliasing takes. nil where it cannot run on this build.

setAntiAliasing

setAntiAliasing: (Gfx, number) -> boolean

Ask for the client's own anti-aliasing at a level, set at the top of the next client tick through its own setting, so it is the player's setting too and is saved with their preferences. A renderer switch can put back the level the client cached, so set it after one. False where it cannot run on this build, or for a negative level.

setRetexture

setRetexture: (Gfx, string, number, {number}, {number}) -> boolean

Replace textures on a type: kind is "loc", "npc", "obj", "spotanim" or "kit", find and replace are the client's texture ids, paired. Put back each time the client builds that type, so one call at startup lasts; a type it already loaded takes it at the next flushOverrides. An NPC only changes textures it already replaces. In SD an untextured model cannot gain a texture. False when overrides cannot run here, the kind is unknown, or the lists do not pair up; an id that never loads is simply never used.

setOverlayTexture

setOverlayTexture: (Gfx, number, number) -> boolean

Set an overlay's texture, shown from the next scene build. False when the overlay does not exist or overlays are not loaded yet.

clearOverrides

clearOverrides: (Gfx) -> ()

Forget every retexture and put every overlay back. Types the client already rebuilt keep their lists until flushOverrides.

flushOverrides

flushOverrides: (Gfx) -> boolean

Have the client rebuild its types and reload the scene at the top of the next tick, with its loading screen. For types it had already loaded when their overrides were registered. False where overrides cannot run, or the client is not logged in by then.