ReadonlyonAt the start of every frame, before the upload and the draw.
ReadonlysceneThe objects drawn, given at its creation.
The backend drawing.
Where it draws.
Average time between the frames over the last second, in ms, while frames follow one another (a pause of a quarter second starts it over); 0 before the first second.
What the last frame drew.
Whether the animation loop runs (start): a frame every display refresh.
The engine's settings: its scene's (Scene.settings), the drawing ones applied live.
Stops the loop, frees the GPU resources and stops following the settings (its scene's). The canvas stays the caller's.
Draws one frame now: called by the loop, or alone to draw on demand. Then asks for the next
accumulated frame, unless another frame was asked for meanwhile, the loop runs or the
settings.postProcessing.antialiasing.accumulatedFrames are drawn.
Asks for a frame at the next display refresh: the requests until then give one frame. Nothing more while the animation loop runs. The frames accumulated start over.
Draws from camera from now on, perspective or orthographic; its aspect follows the canvas
(see setSize).
The camera drawn from, the caller's.
Sizes the canvas's drawing buffer, from its size on the page in CSS pixels (the caller's, set
by its CSS), and fits the camera to its aspect: a perspective camera's aspect; an
orthographic camera's left and right, around their centre, its top and bottom kept. The frames
accumulated start over: the next frame is a whole one, not a sample blended into an average
of the former size.
Starts the animation loop: one frame per display refresh, until stop.
Stops the animation loop, and a frame asked for: frames are drawn on demand again.
StaticcreateCreates a renderer of the backend wanted. Asynchronous: a WebGPU adapter and device are asked for.
The scene drawn, where to draw, the backend wanted.
The renderer, without a camera, its loop not started.
Draws a Scene, given at its creation, into the caller's canvas from a camera, frame after frame, with a WebGL2 or a WebGPU backend, chosen at its creation and used inside. The scene is the same for both, its settings the renderer's:
It draws the three.js scene of its scene (
Scene.threeScene), and holds the size and the frames. It draws on demand, as TeiaViewer's viewport: requestFrame asks for one, the requests before the next display refresh giving one frame. The caller asks after its changes: the camera moved (e.g. camera controls that moved, damping included), the objects changed, the size changed (e.g. at the end of a command). The engine asks for the frames of its own work, which the caller does not see: a culling result arrived, the occlusion settles, a buffer grew, the BoxTree or a setting changed (Scene.signals.changed). At a frame, it reads what changed since the last one. start draws every display refresh instead, until stop. Once nothing changes, it drawssettings.postProcessing.antialiasing.accumulatedFramesmore frames by itself, shown averaged: any frame asked for starts over.A frame:
onBeforeFrame, then the backend uploads what changed, culls and draws. Its settings (culling, antialiasing...) hold across backends. The camera belongs to the caller. Its backend is kept: at a change ofsettings.renderer.backend, it reloads the page (a canvas keeps the backend it first drew with), the application saving its settings then. The depth is reversed (1 near, 0 far, float): its precision follows the distance.