Expand description
Declarative <q-viewport> lifecycle — types and pure logic (plan §7.3 W5).
The viewport lifecycle is:
- Detect backend — call
Render.gpu_backend_infoto probe WebGPU/WebGL2. - Init GPU — call
Render.gpu_initwith width/height/particle_cap. - Frame loop — repeatedly call
Render.gpu_render_framewith sim-time. - Resize — call
Render.gpu_resizewhen the canvas dimensions change. - Camera — call
Render.gpu_set_cameraon mouse/wheel input. - Destroy — call
Render.gpu_destroyon unmount. - After resize —
Render.gpu_sync_bloomthenRender.gpu_surface_size. - Pick —
Render.gpu_pick+Render.gpu_poll_pickon click. - Camera readback —
Render.gpu_camera_stateafter orbit.
This module contains only the types and pure logic (no UI dependencies).
The async invoke functions live in the component module, which has access
to the qapp_engine::invoke_json helper.
Structs§
- Viewport
Config - Viewport configuration — declarative props for
<q-viewport>. - Viewport
State - Viewport runtime state — tracks the GPU handle, backend, and frame count.
Enums§
- Viewport
Backend - Backend type detected by
Render.gpu_backend_info.
Functions§
- extract_
backend - Extract the backend string from a
poet_evalresult JSON. - extract_
handle - Extract the GPU handle from a
poet_evalresult JSON. - extract_
pick - Extract pick result from
Render.gpu_poll_pick. - extract_
surface_ size - Extract
{width, height}fromRender.gpu_surface_size. - vibe_
gpu_ script - Workshop-dialect Vibe body for GPU invokes (
using Render;).