Frame and camera
When your code runs, where the camera is, how to turn a world position into a screen position, and what you are drawing onto.
When your code runs, and how fresh what it reads is.
Fires after the game has built its frame and before present, which is the only point where reading world state and drawing over it agree with each other.
Seconds since the last presented frame.
Monotonic frame counter. Useful as a cache key; the core uses it for the entity snapshot.
Frames since the data you are reading was captured. Normally zero. Non-zero on backends that read a snapshot rather than live memory.
if (f.frame().staleness() > 0) // do not lead a target on stale data
The view, as the game has it this frame.
View matrix, column-major, right-handed.
Projection matrix.
The product, when the pack can read it more cheaply than multiplying.
Eye position in metres.
Vertical field of view in radians.
Clip planes.
The one most mods actually want. Runs host-side so matrix conventions never reach the mod.
A world point in screen pixels, DPI-scaled, top-left origin.
camera; nothing involving screen position will work hereThe bulk form. A radar projecting 300 positions should be one call; the scalar version in a loop is the single most common performance mistake in Tier W mods.
The inverse, at a given depth.
Inside the frustum. Cheaper than projecting and discarding.
Line of sight. Often unanswered, because it usually needs calling a game function rather than reading memory.
First solid thing along a ray.
Whether two points can see each other.
What you are drawing onto.
Backbuffer size in pixels.
Multiply authored sizes by this.
srgb, linear, hdr10 or scrgb.
Informational only. It exists so a mod can log it or warn about a known issue, not so a mod can branch into API-specific drawing. A mod that branches on this to issue its own draw calls has left the portable surface.
On an HDR swapchain a color of 1.0 is roughly paper-white
reference level, not white, so naive UI comes out dim or searing. The overlay
handles this for you; a mod using canvas should read
color_space() only if it is doing its own tone mapping.