ReadonlyonAfter setBackend changed the backend (and the canvas).
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, takes the canvas out of the container and stops following the settings (its scene'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.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 with another backend from now on: a new canvas (in the container, in place of the old one), the settings, size, scene, camera and loop kept (the scene's data uploaded again, not copied) and the old backend's GPU resources freed. Asynchronous: a WebGPU adapter and device are asked for; the frames meanwhile draw with the old backend. Calls run one after the other.
The backend wanted (see detectBackend); nothing changes when it is the one drawing.
Draws from camera from now on; its aspect follows the canvas.
The camera drawn from, the caller's.
Sizes the canvas, in CSS pixels, and the camera aspect.
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, the backend wanted, where to draw.
The renderer, without a camera, its loop not started.
Draws a Scene, given at its creation, into a canvas from a camera, frame after frame, with a WebGL2 or a WebGPU backend, chosen at its creation, used inside, and changed with setBackend. 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 or the backend 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.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. The depth is reversed (1 near, 0 far, float): its precision follows the distance.