Report per-run camera picture readiness milestones
API 30 adds render.camera-status: availability, the last noted frame's mod-camera picture path, the calling run's accepted set-views submission for this world generation, and per-camera prepared flags. A camera is prepared when the renderer encoded its picture into the texture target in a real frame of this generation, or a world frame rendered from it as the set-main-view selection: a host-side encoding milestone, not target registration, not a GPU fence, not a visible pixel. An empty set-views clears the request; a resubmission, world transition or mod reload waits for a new frame. The renderer reports the pictures it drew each frame; the game notes the frame after a successful render. Verified with two real Wasmtime guests sharing local camera id 7: each run's readiness follows only its own submission and main-view choice, and a world transition resets both. Co-Authored-By: Kimi Code <noreply@moonshot.cn>
This commit is contained in:
@@ -811,6 +811,39 @@ API level 27: state for the calling mod and current world generation. Accepted m
|
||||
| `prepared` | `bool` | |
|
||||
| `reason` | `capability-reason` | |
|
||||
|
||||
### enum `camera-reason`
|
||||
|
||||
| Case | |
|
||||
| --- | --- |
|
||||
| `awaiting-frame` | |
|
||||
| `ready` | |
|
||||
|
||||
### record `camera-readiness`
|
||||
|
||||
One `set-views` camera's readiness in the calling run and world generation. `request-accepted` means the run's latest non-empty `set-views` stored this camera this generation. `prepared` means the renderer encoded this camera's picture into its texture target in a real frame of this generation (or the camera is the run's `set-main-view` selection and a world frame rendered from it): a host-side encoding milestone, not GPU completion, not a visible pixel. A rotating per-frame budget may skip a picture camera some frames.
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `id` | `u32` | |
|
||||
| `request-accepted` | `bool` | |
|
||||
| `prepared` | `bool` | |
|
||||
| `reason` | `camera-reason` | |
|
||||
|
||||
### record `camera-state`
|
||||
|
||||
API level 30. State of the calling run's `set-views` cameras for this world. Available means this host implements the API. Enabled means the renderer's mod-camera picture path was live in the last noted frame (a world frame, not a title screen), not that any camera was drawn. `request-accepted` and `prepared` aggregate the per-camera list: accepted means the run's latest `set-views` stored cameras this generation, prepared means at least one was drawn (or rendered as the screen's main view). `main-view` is the camera id the run last selected with `set-main-view`, if any. An empty `set-views` clears the request; a world transition or mod reload invalidates readiness.
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `generation` | `u64` | |
|
||||
| `available` | `bool` | |
|
||||
| `enabled` | `bool` | |
|
||||
| `request-accepted` | `bool` | |
|
||||
| `prepared` | `bool` | |
|
||||
| `reason` | `capability-reason` | |
|
||||
| `cameras` | `list<camera-readiness>` | |
|
||||
| `main-view` | `option<u32>` | |
|
||||
|
||||
### record `spot-light`
|
||||
|
||||
A directional light with a visible beam (AirDef fork): a searchlight, a headlight. The HD lighting lights the surfaces and flying things inside its cone (smoothly from the inner to the outer angle, down to nothing at `range`) and draws the beam as a translucent volume lit from inside: it scatters in the air (more in fog and smoke, a faint artistic one in clear air), the world hides it where it is in front, and the camera may stand inside it. The light does not look for walls: send `range` as far as the beam is free (a cast along the axis) so it stops where the land stops it.
|
||||
@@ -919,6 +952,7 @@ Where a capture is.
|
||||
| `capture-owner-status` | `func() -> capability-state` | The caller's capture request, scoped to its run and world generation. Enabled means a world is present, not that the encoder or GPU is ready. Prepared means recording, encoding, or done; inspect capture-status for completion and errors. Other mods cannot claim it. A world transition invalidates ownership and asks the host to cancel the capture. |
|
||||
| `sound-sources-status` | `func() -> capability-state` | API level 29. State of this run's live persistent sound source changes. Prepared means their changes were applied by the host audio source manager while a live output or offline film mixer was available; it does not mean a sound asset loaded, received a voice, or was audible. Stopping all sources, a source-generation reset, world transition or mod reload invalidates it. |
|
||||
| `point-lights-status` | `func() -> capability-state` | API level 28. The calling run's non-empty point-light submission for this world. Enabled means HD was selected for the last main frame, not GPU availability. Prepared means the host processed its cached submissions for an HD main frame, not that every light survived culling or that a GPU produced visible pixels. Empty submissions clear the request; a new submission awaits another frame. |
|
||||
| `camera-status` | `func() -> camera-state` | The caller's `set-views` cameras and the last noted mod-camera frame. This does not inspect the GPU: prepared is the host encoding the picture, not a fence, a presented frame, or the player seeing the picture. |
|
||||
| `set-spot-lights` | `func(lights: list<spot-light>) -> bool` | Replaces the mod's spot lights: up to 32 (the nearest 16 are drawn), interpolated per id between the last two calls. Returns whether the HD renderer draws them with their beams; when it does not (the effects preset, HD off), the mod draws its own beam if it wants one. |
|
||||
| `capture-start` | `func(options: capture-options) -> result<_, string>` | Records the screen frame by frame (AirDef fork), at a fixed time step whatever the speed of the machine: while it records, the game clock advances exactly `1 / fps` seconds a frame (ticks, interpolation, the mod's `tick`s and the sounds with it), so a slow frame is a longer wait and not a skipped one. The frames are read back from the GPU and encoded to H.264 MP4 by `ffmpeg` (found on the `PATH`, or named by `HORIZON_FFMPEG`) through a bounded queue, never held in memory; with no `ffmpeg` they are written as a PNG sequence. Returns an error for a capture already running, a bad name, or an invalid size. Only the game's own files are written, under its home. |
|
||||
| `capture-stop` | `func(cancel: bool)` | Ends this mod run's capture: finishes the file, or (`cancel`) throws it away. A different mod cannot stop it. World transitions cancel mod-owned captures. |
|
||||
|
||||
Reference in New Issue
Block a user