Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

size

What the engine is drawing at right now.

Returns the drawing surface in both spaces at once: width/height in pixels, logicalWidth/logicalHeight in the window's logical points (ui.screenSize("window"), the space gui.bounds and ui.getLayoutInfo rects are in), plus pixelRatio, the factor between them.

width/height come from the renderer's own configuration, so they are the size in force whether or not anything has been laid out over it, and aspect is the shape the engine is really drawing. The logical size is the window's canvas whether or not a screen is shown on it. A camera-space screen (a HUD) lays out on the camera's canvas, ui.screenSize(), which is the same size wherever the scene fills the window and is fitted to the Scene panel while one presents the scene.

Reading both together is the point. A HUD's budget is written in logical points while every capture, luma reading and ui.getLayoutInfo measurement is in pixels, and the two spaces do not agree by a fixed factor across shapes. A measurement taken at one size can be carried arithmetically to another only if the factor is known, and this reports it.

The logical canvas is normalised to about 1280 points wide, so pixelRatio is not fixed: a surface resized to the same aspect moves the ratio and leaves the logical shape where it was. On a phone or a tablet the ratio is at least the display's density (ui.displayScale()), so the logical canvas there is narrower than 1280 points.

sceneWidth/sceneHeight is the rect the 3D scene is drawn into — the whole surface in a runtime window, a browser canvas and a headless engine, and the editor's viewport panel in an editor layout, where it is smaller than the surface the UI is laid out over.

aspect is width over height — the number a responsive layout branches on. maxExtent is the largest surface this device will draw, per axis, which is the bound viewport.setSize refuses past.