Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

raea is developed here now (public-first)

shane3381690416ed
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..db619a37
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,91 @@
+# A release, built here where anyone can read how (public #6; docs/public-first.feature PF5): for a v* tag, macOS on
+# Apple Silicon and Linux on x86_64 are built from the tag on GitHub's runners, packed by tools/release.sh, checked by
+# tools/release-check.sh, attested (anyone can check a download with
+# `gh attestation verify raea-VERSION-macos-arm64.tar.gz -R shinyobjectz/raea`) and attached to the tag's release.
+# Windows builds in windows.yml's release mode. The release's notes and whether it's a pre-release are set by hand.
+name: release
+
+on:
+ push:
+ tags: ["v*"]
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: the tag to build (v0.1.0-canary.4)
+ required: true
+ type: string
+
+permissions:
+ contents: write
+ id-token: write
+ attestations: write
+
+env:
+ CARGO_TERM_COLOR: never
+ CARGO_INCREMENTAL: "0"
+ TAG: ${{ inputs.tag || github.ref_name }}
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: macos-15
+ lib: libraea_bundle.dylib
+ extra: raea-perceive
+ - os: ubuntu-24.04
+ lib: libraea_bundle.so
+ extra: ""
+ runs-on: ${{ matrix.os }}
+ # a cold thin-LTO build of raea-cli with the plugin catalog is the long part; GitHub's own limit is 6 hours
+ timeout-minutes: 340
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ env.TAG }}
+ submodules: true
+ lfs: false
+ - name: Linux libraries
+ if: runner.os == 'Linux'
+ run: sudo apt-get update && sudo apt-get install -y cmake ninja-build libasound2-dev libfontconfig1-dev libvulkan-dev libudev-dev mesa-vulkan-drivers xvfb
+ - name: macOS tools
+ if: runner.os == 'macOS'
+ run: brew install cmake ninja
+ - uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: 1.4.2
+ - name: The runtime's packages
+ run: for d in sdk/react/js sdk/react/tw; do (cd "$d" && bun install --frozen-lockfile); done
+ - name: Models (pinned by URL and sha256 in tools/release/models.tsv)
+ run: |
+ while IFS=$'\t' read -r path url sha; do
+ case $path in ''|'#'*) continue ;; esac
+ mkdir -p "$HOME/.local/share/raea-models/$(dirname "$path")"
+ curl -fsSL "$url" -o "$HOME/.local/share/raea-models/$path"
+ echo "$sha $HOME/.local/share/raea-models/$path" | shasum -a 256 -c -
+ done < tools/release/models.tsv
+ - name: Build
+ run: |
+ feat=$(bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)
+ cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features --features "$feat"
+ cargo build --profile dist --locked -p raea-rune-host
+ cargo build --profile dist --locked -p raea-page-host --features window
+ if [ -n "${{ matrix.extra }}" ]; then cargo build --profile dist --locked -p ${{ matrix.extra }}; fi
+ mkdir ship
+ cp target/dist/raea target/dist/${{ matrix.lib }} target/dist/raea-rune-host target/dist/raea-page-host ship/
+ if [ -n "${{ matrix.extra }}" ]; then cp target/dist/${{ matrix.extra }} ship/; fi
+ - name: Pack and check (tools/release.sh)
+ run: |
+ v=${TAG#v}
+ if [ "$RUNNER_OS" = Linux ]; then xvfb-run -a -s "-screen 0 1280x1024x24" bash tools/release.sh "$v" ship HEAD
+ else bash tools/release.sh "$v" ship HEAD; fi
+ - uses: actions/attest-build-provenance@v2
+ with:
+ subject-path: dist/raea-*.tar.gz
+ - name: Attach to the release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --prerelease --title "raea ${TAG#v}" --notes "Built by .github/workflows/release.yml; notes follow."
+ gh release upload "$TAG" dist/raea-*.tar.gz dist/raea-*.tar.gz.sha256 --clobber
diff --git a/.gitignore b/.gitignore
index deca5b81..62ab35a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,7 +81,7 @@ content/**/*.db
content/**/*.bak
content/**/*.physics.json
-# local footage catalogues and eval takes (client data on Shane's drives, from the host app's era): never committed; raea
+# local footage catalogues and eval takes (client data, kept off git): never committed; raea
# keeps no UGC data (10-24), so they're for moving out of the repo, not into it
engine/media/library/
engine/media/real/
@@ -101,3 +101,5 @@ sdk/raea/.scratch-*/
# the Tripo CLI writes its last task id into the directory it runs in
.tripo/
+# tools/bevy-parity links each example folder's assets/ to Bevy's checkout at run time (an absolute, per-machine path)
+/sdk/raea/bench/bevy-parity/**/assets
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..33e11db8
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "tools/rask"]
+ path = tools/rask
+ url = https://github.com/shinyobjectz/rask.git
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..42220fbc
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,16 @@
+# Contributing
+
+raea is a canary release, and it changes a lot from day to day. The best way to help right now is to file an issue.
+Every one gets read, and a good bug report usually gets fixed sooner than a pull request can be reviewed against code
+that has moved on.
+
+- **Bugs:** say what you ran, what happened, and what you expected. Include the raea version (`raea --version`), your
+ OS and machine, and the smallest page or composition that shows the problem. Comparing against a reference render,
+ such as the same page in a browser, and naming the frame where it differs helps a lot.
+- **Ideas and questions:** open an issue and describe what you're trying to make.
+
+## Pull requests
+
+Pull requests are taken case by case. Open an issue first and say what you'd like to change, so we can agree on it
+before you spend time on code. A contribution that lands keeps you as the author of your commits in this repository's
+history.
diff --git a/Cargo.lock b/Cargo.lock
index 4f6b6a4c..cbed57b0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -13625,6 +13625,18 @@ dependencies = [
"winit",
]
+[[package]]
+name = "raea-app-judge"
+version = "0.1.0"
+dependencies = [
+ "base64 0.22.1",
+ "image",
+ "raea-io-home",
+ "raea-runtime-bundle",
+ "serde_json",
+ "ureq 2.12.1",
+]
+
[[package]]
name = "raea-app-media"
version = "0.1.0"
@@ -13655,6 +13667,18 @@ dependencies = [
"winit",
]
+[[package]]
+name = "raea-app-solid"
+version = "0.1.0"
+dependencies = [
+ "raea-app-judge",
+ "raea-core-meshcheck",
+ "raea-core-shape",
+ "raea-core-solidinfo",
+ "raea-runtime-bundle",
+ "serde_json",
+]
+
[[package]]
name = "raea-app-targets"
version = "0.1.0"
@@ -13895,8 +13919,10 @@ dependencies = [
"raea-app-check",
"raea-app-ci",
"raea-app-game",
+ "raea-app-judge",
"raea-app-media",
"raea-app-play",
+ "raea-app-solid",
"raea-app-targets",
"raea-app-tools",
"raea-app-workspace",
@@ -13966,14 +13992,44 @@ dependencies = [
"wuff",
]
+[[package]]
+name = "raea-core-grow"
+version = "0.1.0"
+dependencies = [
+ "raea-core-sdf",
+]
+
[[package]]
name = "raea-core-k"
version = "0.1.0"
+[[package]]
+name = "raea-core-meshcheck"
+version = "0.1.0"
+dependencies = [
+ "serde_json",
+]
+
+[[package]]
+name = "raea-core-place"
+version = "0.1.0"
+dependencies = [
+ "serde_json",
+]
+
[[package]]
name = "raea-core-program"
version = "0.1.0"
+[[package]]
+name = "raea-core-review"
+version = "0.1.0"
+dependencies = [
+ "bevy",
+ "raea-core-scene",
+ "serde_json",
+]
+
[[package]]
name = "raea-core-scene"
version = "0.1.0"
@@ -13983,16 +14039,32 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "raea-core-sdf"
+version = "0.1.0"
+
[[package]]
name = "raea-core-shape"
version = "0.1.0"
dependencies = [
"manifold-rust",
"raea-core-fonts",
+ "raea-core-grow",
+ "raea-core-sdf",
"serde_json",
"skrifa 0.44.0",
]
+[[package]]
+name = "raea-core-solidinfo"
+version = "0.1.0"
+dependencies = [
+ "manifold-rust",
+ "raea-core-place",
+ "raea-core-shape",
+ "serde_json",
+]
+
[[package]]
name = "raea-core-wire"
version = "0.1.0"
@@ -14101,6 +14173,7 @@ name = "raea-io-gen"
version = "0.1.0"
dependencies = [
"image",
+ "raea-core-meshcheck",
"raea-io-gen-comfy",
"raea-io-gen-core",
"raea-io-home",
@@ -14406,6 +14479,7 @@ dependencies = [
"raea-sys-page",
"raea-sys-parity",
"raea-sys-post",
+ "raea-sys-procmat",
"raea-sys-rt",
"raea-sys-sampler",
"raea-sys-screen",
@@ -14431,24 +14505,47 @@ dependencies = [
"wgpu",
]
+[[package]]
+name = "raea-rune-bevy"
+version = "0.1.0"
+dependencies = [
+ "bevy",
+ "rune",
+ "wgpu",
+]
+
[[package]]
name = "raea-rune-host"
version = "0.1.0"
dependencies = [
+ "bevy",
"png 0.18.1",
"raea-core-wire",
"raea-io-net-calls",
"raea-io-os",
+ "raea-rune-bevy",
+ "raea-rune-js",
"raea-rune-look",
"raea-rune-media",
"raea-rune-page",
"raea-runtime-bundle-lib",
- "raea-runtime-jsengine",
"rune",
"serde",
"serde_json",
]
+[[package]]
+name = "raea-rune-js"
+version = "0.1.0"
+dependencies = [
+ "raea-core-wire",
+ "raea-io-net-calls",
+ "raea-io-os",
+ "raea-rune-page",
+ "raea-runtime-jsengine",
+ "serde_json",
+]
+
[[package]]
name = "raea-rune-look"
version = "0.1.0"
@@ -14522,6 +14619,7 @@ name = "raea-runtime-bundle-lib"
version = "0.1.0"
dependencies = [
"libloading",
+ "raea-io-home",
"serde_json",
]
@@ -14533,6 +14631,7 @@ dependencies = [
"bevy",
"image",
"manifold-rust",
+ "raea-core-place",
"raea-core-scene",
"raea-core-shape",
"raea-io-media",
@@ -14605,6 +14704,7 @@ dependencies = [
"bevy",
"image",
"raea-core-program",
+ "raea-core-review",
"raea-core-scene",
"raea-gpu-device",
"raea-io-assets",
@@ -14616,6 +14716,7 @@ dependencies = [
"raea-runtime-page",
"raea-runtime-react",
"raea-runtime-scene",
+ "raea-runtime-scene3d",
"raea-runtime-sound",
"raea-runtime-view",
"raea-sys-contact",
@@ -14798,8 +14899,10 @@ version = "0.1.0"
dependencies = [
"bevy",
"raea-core-program",
+ "raea-core-review",
"raea-core-scene",
"raea-runtime-look",
+ "raea-sys-procmat",
"raea-sys-wear",
"serde_json",
]
@@ -14985,6 +15088,7 @@ name = "raea-sys-contact"
version = "0.1.0"
dependencies = [
"bevy",
+ "raea-core-meshcheck",
"raea-core-scene",
"raea-core-shape",
"serde_json",
@@ -15281,6 +15385,16 @@ dependencies = [
"raea-sys-frame",
]
+[[package]]
+name = "raea-sys-procmat"
+version = "0.1.0"
+dependencies = [
+ "bevy",
+ "raea-core-program",
+ "raea-sys-frame",
+ "serde_json",
+]
+
[[package]]
name = "raea-sys-rt"
version = "0.1.0"
@@ -20204,6 +20318,8 @@ dependencies = [
"once_cell",
"rustls",
"rustls-pki-types",
+ "serde",
+ "serde_json",
"url",
"webpki-roots 0.26.11",
]
diff --git a/Cargo.toml b/Cargo.toml
index 9a057e4f..7c1296e1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,6 +10,12 @@ members = [
"core/program",
"core/scene",
"core/shape",
+ "core/meshcheck",
+ "core/sdf",
+ "core/grow",
+ "core/solidinfo",
+ "core/review",
+ "core/place",
"core/wire",
"io/net",
"io/net/calls",
@@ -40,6 +46,8 @@ members = [
"engine/rune/media",
"engine/rune/look",
"engine/rune/style",
+ "engine/rune/bevy",
+ "engine/rune/js",
"engine/page/stage",
"engine/page/window",
"io/trace",
@@ -77,6 +85,7 @@ members = [
"systems/tweak",
"systems/filters",
"systems/wear",
+ "systems/procmat",
"systems/page",
"systems/page-net",
"systems/frame",
@@ -134,6 +143,8 @@ members = [
"apps/workspace",
"apps/ci",
"apps/tools",
+ "apps/judge",
+ "apps/solid",
"apps/media",
"apps/targets",
"apps/game",
diff --git a/LICENSES/asn1-rs-0.7.2/LICENSE-APACHE b/LICENSES/asn1-rs-0.7.2/LICENSE-APACHE
new file mode 100644
index 00000000..16fe87b0
--- /dev/null
+++ b/LICENSES/asn1-rs-0.7.2/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/asn1-rs-0.7.2/LICENSE-MIT b/LICENSES/asn1-rs-0.7.2/LICENSE-MIT
new file mode 100644
index 00000000..290e7b9b
--- /dev/null
+++ b/LICENSES/asn1-rs-0.7.2/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2017 Pierre Chifflier
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/asn1-rs-derive-0.6.0/LICENSE-APACHE b/LICENSES/asn1-rs-derive-0.6.0/LICENSE-APACHE
new file mode 100644
index 00000000..16fe87b0
--- /dev/null
+++ b/LICENSES/asn1-rs-derive-0.6.0/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/asn1-rs-derive-0.6.0/LICENSE-MIT b/LICENSES/asn1-rs-derive-0.6.0/LICENSE-MIT
new file mode 100644
index 00000000..290e7b9b
--- /dev/null
+++ b/LICENSES/asn1-rs-derive-0.6.0/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2017 Pierre Chifflier
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/asn1-rs-impl-0.2.0/LICENSE.txt b/LICENSES/asn1-rs-impl-0.2.0/LICENSE.txt
new file mode 100644
index 00000000..adc72603
--- /dev/null
+++ b/LICENSES/asn1-rs-impl-0.2.0/LICENSE.txt
@@ -0,0 +1,20 @@
+asn1-rs-impl 0.2.0 ships no licence file of its own. Its Cargo.toml declares MIT/Apache-2.0, by Pierre Chifflier <[email protected]>.
+
+---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
+
+---- MIT ----
+
+Copyright (c) Pierre Chifflier <[email protected]>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/aws-lc-rs-1.18.2/LICENSE b/LICENSES/aws-lc-rs-1.18.2/LICENSE
index 2e1f9b4d..58d28381 100644
--- a/LICENSES/aws-lc-rs-1.18.2/LICENSE
+++ b/LICENSES/aws-lc-rs-1.18.2/LICENSE
@@ -199,4 +199,4 @@ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR an agent session OF THIS SOFTWARE.
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/LICENSES/aws-lc-sys-0.46.0/LICENSE b/LICENSES/aws-lc-sys-0.46.0/LICENSE
index 8694b671..5e3526d0 100644
--- a/LICENSES/aws-lc-sys-0.46.0/LICENSE
+++ b/LICENSES/aws-lc-sys-0.46.0/LICENSE
@@ -257,7 +257,7 @@ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-an agent session OF THIS SOFTWARE.
+PERFORMANCE OF THIS SOFTWARE.
MIT License
-----------
diff --git a/LICENSES/ciborium-0.2.2/LICENSE b/LICENSES/ciborium-0.2.2/LICENSE
new file mode 100644
index 00000000..261eeb9e
--- /dev/null
+++ b/LICENSES/ciborium-0.2.2/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/LICENSES/ciborium-io-0.2.2/LICENSE b/LICENSES/ciborium-io-0.2.2/LICENSE
new file mode 100644
index 00000000..261eeb9e
--- /dev/null
+++ b/LICENSES/ciborium-io-0.2.2/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/LICENSES/ciborium-ll-0.2.2/LICENSE b/LICENSES/ciborium-ll-0.2.2/LICENSE
new file mode 100644
index 00000000..261eeb9e
--- /dev/null
+++ b/LICENSES/ciborium-ll-0.2.2/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/LICENSES/der-parser-10.0.0/LICENSE-APACHE b/LICENSES/der-parser-10.0.0/LICENSE-APACHE
new file mode 100644
index 00000000..16fe87b0
--- /dev/null
+++ b/LICENSES/der-parser-10.0.0/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/der-parser-10.0.0/LICENSE-MIT b/LICENSES/der-parser-10.0.0/LICENSE-MIT
new file mode 100644
index 00000000..290e7b9b
--- /dev/null
+++ b/LICENSES/der-parser-10.0.0/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2017 Pierre Chifflier
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/deranged-0.5.9/LICENSE-Apache b/LICENSES/deranged-0.5.9/LICENSE-Apache
new file mode 100644
index 00000000..c763a0c9
--- /dev/null
+++ b/LICENSES/deranged-0.5.9/LICENSE-Apache
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2024 Jacob Pratt et al.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/LICENSES/deranged-0.5.9/LICENSE-MIT b/LICENSES/deranged-0.5.9/LICENSE-MIT
new file mode 100644
index 00000000..5cc097f1
--- /dev/null
+++ b/LICENSES/deranged-0.5.9/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) 2024 Jacob Pratt et al.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/dyn-clone-1.0.20/LICENSE-APACHE b/LICENSES/dyn-clone-1.0.20/LICENSE-APACHE
new file mode 100644
index 00000000..1b5ec8b7
--- /dev/null
+++ b/LICENSES/dyn-clone-1.0.20/LICENSE-APACHE
@@ -0,0 +1,176 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
diff --git a/LICENSES/dyn-clone-1.0.20/LICENSE-MIT b/LICENSES/dyn-clone-1.0.20/LICENSE-MIT
new file mode 100644
index 00000000..31aa7938
--- /dev/null
+++ b/LICENSES/dyn-clone-1.0.20/LICENSE-MIT
@@ -0,0 +1,23 @@
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/earcut-0.4.5/LICENSE.txt b/LICENSES/earcut-0.4.5/LICENSE.txt
index c8eb0012..fd23752b 100644
--- a/LICENSES/earcut-0.4.5/LICENSE.txt
+++ b/LICENSES/earcut-0.4.5/LICENSE.txt
@@ -12,5 +12,5 @@ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR an agent session OF
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
diff --git a/LICENSES/mock_instant-0.6.1/LICENSE.txt b/LICENSES/mock_instant-0.6.1/LICENSE.txt
index 48827a45..2a28e2b9 100644
--- a/LICENSES/mock_instant-0.6.1/LICENSE.txt
+++ b/LICENSES/mock_instant-0.6.1/LICENSE.txt
@@ -8,5 +8,5 @@ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR an agent session OF
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
diff --git a/LICENSES/num-conv-0.2.2/LICENSE-Apache b/LICENSES/num-conv-0.2.2/LICENSE-Apache
new file mode 100644
index 00000000..f433b1a5
--- /dev/null
+++ b/LICENSES/num-conv-0.2.2/LICENSE-Apache
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/LICENSES/num-conv-0.2.2/LICENSE-MIT b/LICENSES/num-conv-0.2.2/LICENSE-MIT
new file mode 100644
index 00000000..3738d287
--- /dev/null
+++ b/LICENSES/num-conv-0.2.2/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) Jacob Pratt
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/oid-registry-0.8.1/LICENSE-APACHE b/LICENSES/oid-registry-0.8.1/LICENSE-APACHE
new file mode 100644
index 00000000..16fe87b0
--- /dev/null
+++ b/LICENSES/oid-registry-0.8.1/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/oid-registry-0.8.1/LICENSE-MIT b/LICENSES/oid-registry-0.8.1/LICENSE-MIT
new file mode 100644
index 00000000..290e7b9b
--- /dev/null
+++ b/LICENSES/oid-registry-0.8.1/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2017 Pierre Chifflier
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/pem-4.0.0/LICENSE.md b/LICENSES/pem-4.0.0/LICENSE.md
new file mode 100644
index 00000000..8d7f4383
--- /dev/null
+++ b/LICENSES/pem-4.0.0/LICENSE.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Jonathan Creekmore
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/powerfmt-0.2.1/LICENSE-Apache b/LICENSES/powerfmt-0.2.1/LICENSE-Apache
new file mode 100644
index 00000000..ddde1f9a
--- /dev/null
+++ b/LICENSES/powerfmt-0.2.1/LICENSE-Apache
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2023 Jacob Pratt et al.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/LICENSES/powerfmt-0.2.1/LICENSE-MIT b/LICENSES/powerfmt-0.2.1/LICENSE-MIT
new file mode 100644
index 00000000..89c1f78c
--- /dev/null
+++ b/LICENSES/powerfmt-0.2.1/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) 2023 Jacob Pratt et al.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/proc-macro-error-1.0.4/LICENSE-APACHE b/LICENSES/proc-macro-error-1.0.4/LICENSE-APACHE
new file mode 100644
index 00000000..cc17374b
--- /dev/null
+++ b/LICENSES/proc-macro-error-1.0.4/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright 2019-2020 CreepySkeleton <[email protected]>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/proc-macro-error-1.0.4/LICENSE-MIT b/LICENSES/proc-macro-error-1.0.4/LICENSE-MIT
new file mode 100644
index 00000000..fc73e591
--- /dev/null
+++ b/LICENSES/proc-macro-error-1.0.4/LICENSE-MIT
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019-2020 CreepySkeleton
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/proc-macro-error-attr-1.0.4/LICENSE-APACHE b/LICENSES/proc-macro-error-attr-1.0.4/LICENSE-APACHE
new file mode 100644
index 00000000..658240a8
--- /dev/null
+++ b/LICENSES/proc-macro-error-attr-1.0.4/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright 2019-2020 CreepySkeleton <[email protected]>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/proc-macro-error-attr-1.0.4/LICENSE-MIT b/LICENSES/proc-macro-error-attr-1.0.4/LICENSE-MIT
new file mode 100644
index 00000000..fc73e591
--- /dev/null
+++ b/LICENSES/proc-macro-error-attr-1.0.4/LICENSE-MIT
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019-2020 CreepySkeleton
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/rusticata-macros-4.1.0/LICENSE-APACHE b/LICENSES/rusticata-macros-4.1.0/LICENSE-APACHE
new file mode 100644
index 00000000..16fe87b0
--- /dev/null
+++ b/LICENSES/rusticata-macros-4.1.0/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/rusticata-macros-4.1.0/LICENSE-MIT b/LICENSES/rusticata-macros-4.1.0/LICENSE-MIT
new file mode 100644
index 00000000..290e7b9b
--- /dev/null
+++ b/LICENSES/rusticata-macros-4.1.0/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2017 Pierre Chifflier
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/rustls-native-certs-0.8.5/LICENSE-ISC b/LICENSES/rustls-native-certs-0.8.5/LICENSE-ISC
index 844fff81..03acf1bd 100644
--- a/LICENSES/rustls-native-certs-0.8.5/LICENSE-ISC
+++ b/LICENSES/rustls-native-certs-0.8.5/LICENSE-ISC
@@ -11,5 +11,5 @@ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR an agent session OF
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
diff --git a/LICENSES/rustls-pemfile-2.2.0/LICENSE-ISC b/LICENSES/rustls-pemfile-2.2.0/LICENSE-ISC
index 844fff81..03acf1bd 100644
--- a/LICENSES/rustls-pemfile-2.2.0/LICENSE-ISC
+++ b/LICENSES/rustls-pemfile-2.2.0/LICENSE-ISC
@@ -11,5 +11,5 @@ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR an agent session OF
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
diff --git a/LICENSES/sha2-0.11.1/LICENSE-APACHE b/LICENSES/sha2-0.11.1/LICENSE-APACHE
new file mode 100644
index 00000000..78173fa2
--- /dev/null
+++ b/LICENSES/sha2-0.11.1/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/sha2-0.11.1/LICENSE-MIT b/LICENSES/sha2-0.11.1/LICENSE-MIT
new file mode 100644
index 00000000..9ce242ce
--- /dev/null
+++ b/LICENSES/sha2-0.11.1/LICENSE-MIT
@@ -0,0 +1,28 @@
+Copyright (c) 2016-2026 The RustCrypto Project Developers
+Copyright (c) 2016 Artyom Pavlov
+Copyright (c) 2009-2013 Mozilla Foundation
+Copyright (c) 2006-2009 Graydon Hoare
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/syn-1.0.109/LICENSE-APACHE b/LICENSES/syn-1.0.109/LICENSE-APACHE
new file mode 100644
index 00000000..16fe87b0
--- /dev/null
+++ b/LICENSES/syn-1.0.109/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/syn-1.0.109/LICENSE-MIT b/LICENSES/syn-1.0.109/LICENSE-MIT
new file mode 100644
index 00000000..31aa7938
--- /dev/null
+++ b/LICENSES/syn-1.0.109/LICENSE-MIT
@@ -0,0 +1,23 @@
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/LICENSES/time-0.3.55/LICENSE-Apache b/LICENSES/time-0.3.55/LICENSE-Apache
new file mode 100644
index 00000000..f433b1a5
--- /dev/null
+++ b/LICENSES/time-0.3.55/LICENSE-Apache
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/LICENSES/time-0.3.55/LICENSE-MIT b/LICENSES/time-0.3.55/LICENSE-MIT
new file mode 100644
index 00000000..663cb2a1
--- /dev/null
+++ b/LICENSES/time-0.3.55/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) Jacob Pratt et al.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/time-core-0.1.9/LICENSE-Apache b/LICENSES/time-core-0.1.9/LICENSE-Apache
new file mode 100644
index 00000000..f433b1a5
--- /dev/null
+++ b/LICENSES/time-core-0.1.9/LICENSE-Apache
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/LICENSES/time-core-0.1.9/LICENSE-MIT b/LICENSES/time-core-0.1.9/LICENSE-MIT
new file mode 100644
index 00000000..663cb2a1
--- /dev/null
+++ b/LICENSES/time-core-0.1.9/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) Jacob Pratt et al.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/time-macros-0.2.32/LICENSE-Apache b/LICENSES/time-macros-0.2.32/LICENSE-Apache
new file mode 100644
index 00000000..f433b1a5
--- /dev/null
+++ b/LICENSES/time-macros-0.2.32/LICENSE-Apache
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/LICENSES/time-macros-0.2.32/LICENSE-MIT b/LICENSES/time-macros-0.2.32/LICENSE-MIT
new file mode 100644
index 00000000..663cb2a1
--- /dev/null
+++ b/LICENSES/time-macros-0.2.32/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) Jacob Pratt et al.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/LICENSES/x509-parser-0.18.1/LICENSE-APACHE b/LICENSES/x509-parser-0.18.1/LICENSE-APACHE
new file mode 100644
index 00000000..16fe87b0
--- /dev/null
+++ b/LICENSES/x509-parser-0.18.1/LICENSE-APACHE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/LICENSES/x509-parser-0.18.1/LICENSE-MIT b/LICENSES/x509-parser-0.18.1/LICENSE-MIT
new file mode 100644
index 00000000..290e7b9b
--- /dev/null
+++ b/LICENSES/x509-parser-0.18.1/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2017 Pierre Chifflier
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/NOTICE b/NOTICE
index 273fd5ef..f3c1f2b1 100644
--- a/NOTICE
+++ b/NOTICE
@@ -17,3 +17,426 @@ muxide: vendor/muxide, MIT OR Apache-2.0 (its LICENSE-MIT and LICENSE-APACHE).
animato (MIT OR Apache-2.0), usvg and resvg (Apache-2.0 OR MIT), mediabunny (MPL-2.0, used unmodified), manifold-rust
(Apache-2.0), Bevy (MIT OR Apache-2.0) and the other crates and packages in each Cargo.lock and package.json, each under its own licence.
+
+The Windows build (docs/ports.feature PT20) adds: junction 1.4.2 (MIT, node_modules' links in io/npm) and windows-sys
+0.61.2 (Microsoft, MIT OR Apache-2.0, in io/trace); every build has dunce 1.0.5 (CC0-1.0 OR MIT-0 OR Apache-2.0, plain
+paths for Windows in runtime/bundle). It ships none of Microsoft's C runtime or SDK files: the runtime comes from the
+Microsoft Visual C++ Redistributable, installed on the machine.
+The native target (engine/rune, docs/targets.feature) builds on Rune (https://github.com/anomalyco/rune, Copyright
+2026 Anomaly, MIT; LICENSES/rune-0.0.1/repository-LICENSE): rune, rune-kit and their crates, by a pinned rev.
+
+---- the plugin catalog's crates (tools/licenses.sh; don't edit by hand) ----
+The plugin catalog (engine/bevy-plugins, built with tools/bevy-plugins.sh) and the native target's host (engine/rune,
+raea-rune-host) bring in these crates beyond raea's own build. Each is under its own licence, its files in
+LICENSES/<crate>-<version>/.
+ accesskit_atspi_common 0.21.1: MIT OR Apache-2.0
+ accesskit_consumer 0.39.2: MIT OR Apache-2.0
+ accesskit_macos 0.27.2: MIT OR Apache-2.0
+ accesskit_unix 0.24.1: MIT OR Apache-2.0
+ accesskit_windows 0.35.2: MIT OR Apache-2.0
+ accesskit 0.25.2: MIT OR Apache-2.0
+ aead 0.5.2: MIT OR Apache-2.0
+ aeronet_io 0.22.0-rc.1: MIT OR Apache-2.0
+ aeronet_steam 0.22.0-rc.1: MIT OR Apache-2.0
+ aeronet_tokio_runtime 0.22.0-rc.1: MIT OR Apache-2.0
+ aeronet_websocket 0.22.0-rc.1: MIT OR Apache-2.0
+ aeronet_webtransport 0.22.0-rc.1: MIT OR Apache-2.0
+ anes 0.1.6: MIT OR Apache-2.0
+ ansi-parser 0.9.1: MPL-2.0
+ any_vec 0.15.0: MIT OR Apache-2.0
+ arbitrary-chunks 0.4.1: Apache-2.0 OR MIT
+ ariadne 0.6.0: MIT
+ aseprite-loader 0.4.2: MIT OR Apache-2.0
+ asn1-rs-derive 0.6.0: MIT OR Apache-2.0
+ asn1-rs-impl 0.2.0: MIT/Apache-2.0
+ asn1-rs 0.7.2: MIT OR Apache-2.0
+ async-process 2.5.0: Apache-2.0 OR MIT
+ async-recursion 1.2.0: MIT OR Apache-2.0
+ async-signal 0.2.14: Apache-2.0 OR MIT
+ atomic-arena 0.1.2: MIT OR Apache-2.0
+ atomic-polyfill 1.0.3: MIT OR Apache-2.0
+ atspi-common 0.13.0: Apache-2.0 OR MIT
+ atspi-proxies 0.13.0: Apache-2.0 OR MIT
+ atspi 0.29.0: Apache-2.0 OR MIT
+ atterate 0.0.2: MIT OR Apache-2.0
+ avian_derive 0.2.3: MIT OR Apache-2.0
+ avian2d 0.8.0: MIT OR Apache-2.0
+ avian3d 0.8.0: MIT OR Apache-2.0
+ aws-lc-rs 1.18.2: ISC AND (Apache-2.0 OR ISC)
+ aws-lc-sys 0.46.0: ISC AND (Apache-2.0 OR ISC) AND Apache-2.0 AND MIT AND BSD-3-Clause AND (Apache-2.0 OR ISC OR MIT) AND (Apache-2.0 OR ISC OR MIT-0)
+ az 1.3.0: MIT/Apache-2.0
+ basis-universal-sys 0.3.1: MIT OR Apache-2.0
+ basis-universal 0.3.1: MIT OR Apache-2.0
+ better-bae-macros 0.1.9: MIT
+ better-bae 0.1.9: MIT
+ bevy_aseprite_ultra 0.10.0: MIT
+ bevy_asset_loader_derive 0.28.1: MIT OR Apache-2.0
+ bevy_asset_loader 0.28.1: MIT OR Apache-2.0
+ bevy_common_assets 0.18.0: MIT OR Apache-2.0
+ bevy_console_derive 0.6.0: MIT
+ bevy_console 0.19.0: MIT
+ bevy_easings 0.20.0: MIT OR Apache-2.0
+ bevy_ecs_ldtk_macros 0.16.0: MIT OR Apache-2.0
+ bevy_ecs_ldtk 0.16.0: MIT OR Apache-2.0
+ bevy_ecs_tiled 0.14.0: MIT
+ bevy_ecs_tilemap 0.20.0: MIT
+ bevy_egui 0.43.1: MIT
+ bevy_enhanced_input_macros 0.27.0: MIT OR Apache-2.0
+ bevy_enhanced_input 0.27.0: MIT OR Apache-2.0
+ bevy_enoki 0.8.0: MIT
+ bevy_flair_core_macros 0.9.0: MIT OR Apache-2.0
+ bevy_flair_core 0.9.0: MIT OR Apache-2.0
+ bevy_flair_css_parser 0.9.0: MIT OR Apache-2.0
+ bevy_flair_style 0.9.0: MIT OR Apache-2.0
+ bevy_flair 0.9.0: MIT OR Apache-2.0
+ bevy_flipbook 0.1.0: MIT
+ bevy_ghx_grid 0.10.0: MIT OR Apache-2.0
+ bevy_ghx_proc_gen 0.10.0: MIT OR Apache-2.0
+ bevy_hanabi 0.20.0-dev: MIT OR Apache-2.0
+ bevy_heavy 0.6.0: MIT OR Apache-2.0
+ bevy_http_client 0.12.0: MIT OR Apache-2.0
+ bevy_hui 0.8.0: MIT OR Apache-2.0
+ bevy_kira_audio 0.27.1: MIT OR Apache-2.0
+ bevy_light_2d 0.11.0: MIT
+ bevy_lookup_curve 0.13.0: MIT OR Apache-2.0
+ bevy_materialize 0.12.0: MIT OR Apache-2.0
+ bevy_mod_debugdump 0.17.0: MIT OR Apache-2.0
+ bevy_northstar 0.8.0: MIT
+ bevy_obj 0.20.0: MIT OR Apache-2.0
+ bevy_pancam 0.22.0: MIT OR Apache-2.0
+ bevy_panorbit_camera 0.36.0: MIT OR Apache-2.0
+ bevy_prng 0.16.0: MIT OR Apache-2.0
+ bevy_quinnet 0.22.0: MIT OR Apache-2.0
+ bevy_rand 0.16.0: MIT OR Apache-2.0
+ bevy_rapier2d 0.37.0: Apache-2.0
+ bevy_rapier3d 0.37.0: Apache-2.0
+ bevy_replicon 0.45.2: MIT OR Apache-2.0
+ bevy_simple_tilemap 0.21.0: MIT/Apache-2.0
+ bevy_skein 0.7.0-rc.1: MIT OR Apache-2.0
+ bevy_smud 0.15.0: MIT OR Apache-2.0
+ bevy_sprite3d 10.1.0: MIT
+ bevy_spritesheet_animation 8.0.1: MIT
+ bevy_time_runner 0.8.0: MIT OR Apache-2.0
+ bevy_transform_interpolation 0.6.0: MIT OR Apache-2.0
+ bevy_trauma_shake 0.9.0: MIT OR Apache-2.0
+ bevy_trenchbroom_macros 0.15.0: MIT OR Apache-2.0
+ bevy_trenchbroom 0.15.0: MIT OR Apache-2.0
+ bevy_tween 0.14.1: MIT OR Apache-2.0
+ bevy_tweening 0.16.0: MIT OR Apache-2.0
+ bevy_vector_shapes 0.14.0: MIT OR Apache-2.0
+ bevy_vox_scene 0.23.0: MIT
+ bevy-inspector-egui-derive 0.38.0: MIT OR Apache-2.0
+ bevy-inspector-egui 0.38.0: MIT OR Apache-2.0
+ bevy-settings 0.20.0: MIT OR Apache-2.0
+ bevy-tnua-avian3d 0.13.0: MIT OR Apache-2.0
+ bevy-tnua-macros 0.3.0: MIT OR Apache-2.0
+ bevy-tnua-physics-integration-layer 0.14.0: MIT OR Apache-2.0
+ bevy-tnua 0.33.0: MIT OR Apache-2.0
+ bevy-yoleck-macros 0.10.0: MIT OR Apache-2.0
+ bevy-yoleck 0.34.0: MIT OR Apache-2.0
+ big_space 0.14.0-rc.0: MIT OR Apache-2.0
+ bitfield-macros 0.19.5: MIT OR Apache-2.0
+ bitfield 0.19.5: MIT OR Apache-2.0
+ block-mesh 0.2.0: MIT OR Apache-2.0
+ block-pseudorand 0.1.2: Apache-2.0 OR MIT
+ cast 0.3.0: MIT OR Apache-2.0
+ chacha20 0.9.1: Apache-2.0 OR MIT
+ chacha20poly1305 0.10.1: Apache-2.0 OR MIT
+ chiapos-chacha8 0.1.0: Apache-2.0 OR MIT
+ ciborium-io 0.2.2: Apache-2.0
+ ciborium-ll 0.2.2: Apache-2.0
+ ciborium 0.2.2: Apache-2.0
+ cipher 0.4.4: MIT OR Apache-2.0
+ claxon 0.4.3: Apache-2.0
+ convert_case 0.11.0: MIT
+ copyless 0.1.5: MIT OR Apache-2.0
+ criterion-plot 0.5.0: MIT/Apache-2.0
+ criterion 0.5.1: Apache-2.0 OR MIT
+ cssparser-color 0.5.0: MPL-2.0
+ cssparser 0.37.0: MPL-2.0
+ csv-core 0.1.13: Unlicense/MIT
+ csv 1.4.0: Unlicense/MIT
+ ctt-astcenc 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND Apache-2.0
+ ctt-bc7enc-rdo-prebuilt 0.5.0: (MIT OR Apache-2.0) AND Apache-2.0
+ ctt-bc7enc-rdo 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND Apache-2.0
+ ctt-compressonator 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND MIT
+ ctt-etcpak 0.5.0: (MIT OR Apache-2.0 OR Zlib) AND BSD-3-Clause
+ ctt-intel-texture-compressor-prebuilt 0.5.0: (MIT OR Apache-2.0) AND MIT
+ ctt-intel-texture-compressor 0.5.0: (MIT OR Apache-2.0) AND MIT
+ ctt 0.5.0: MIT OR Apache-2.0 OR Zlib
+ dashmap 6.2.1: MIT
+ default-struct-builder 0.5.1: MIT OR Apache-2.0
+ deluxe-core 0.5.0: MIT
+ deluxe-macros 0.5.0: MIT
+ deluxe 0.5.0: MIT
+ der_derive 0.8.0: Apache-2.0 OR MIT
+ der-parser 10.0.0: MIT OR Apache-2.0
+ deranged 0.5.9: MIT OR Apache-2.0
+ derive-getters 0.5.0: MIT
+ deterministic-hash 1.0.2: MIT
+ disjoint-sets 0.4.2: MIT/Apache-2.0
+ dot_vox 5.2.0: MIT
+ dyn-clone 1.0.20: MIT OR Apache-2.0
+ dyn-eq 0.1.3: MPL-2.0
+ dyn-hash 1.0.0: MIT OR Apache-2.0
+ earcut 0.4.5: ISC
+ ecolor 0.36.2: MIT OR Apache-2.0
+ egui 0.36.2: MIT OR Apache-2.0
+ ehttp 0.5.0: MIT OR Apache-2.0
+ emath 0.36.2: MIT OR Apache-2.0
+ endi 1.1.1: MIT
+ endian-type 0.1.2: MIT
+ enumflags2_derive 0.7.12: MIT OR Apache-2.0
+ enumflags2 0.7.12: MIT OR Apache-2.0
+ epaint_default_fonts 0.36.2: (MIT OR Apache-2.0) AND OFL-1.1 AND Ubuntu-font-1.0
+ epaint 0.36.2: MIT OR Apache-2.0
+ fast_image_resize 6.1.0: MIT OR Apache-2.0
+ fastbloom 0.17.0: MIT OR Apache-2.0
+ fastnoise-lite 1.1.1: MIT
+ fearless_simd 0.4.1: Apache-2.0 OR MIT
+ fid-rs 0.2.0: MIT OR Apache-2.0
+ file-id 0.2.3: MIT OR Apache-2.0
+ fixed 1.31.0: MIT/Apache-2.0
+ flagset 0.4.7: Apache-2.0
+ float_next_after 2.0.0: MIT
+ float-cmp 0.10.0: MIT
+ float-ord 0.3.2: MIT / Apache-2.0
+ fs_extra 1.3.0: MIT
+ fsevent-sys 4.1.0: MIT
+ futures-timer 3.0.4: MIT/Apache-2.0
+ fuzzy-matcher 0.3.7: MIT
+ geo-types 0.7.20: MIT OR Apache-2.0
+ geo 0.33.1: MIT OR Apache-2.0
+ geographiclib-rs 0.2.7: MIT
+ ghx_grid 0.10.0: MIT OR Apache-2.0
+ ghx_proc_gen 0.10.0: MIT OR Apache-2.0
+ glam_matrix_extras 0.4.0: MIT OR Apache-2.0
+ glam 0.19.0: MIT OR Apache-2.0
+ glifo 0.2.0: Apache-2.0 OR MIT
+ gloo-timers 0.3.0: MIT OR Apache-2.0
+ governor 0.10.4: MIT
+ hash32 0.2.1: MIT OR Apache-2.0
+ heapless 0.7.17: MIT OR Apache-2.0
+ heck 0.4.1: MIT OR Apache-2.0
+ httlib-huffman 0.3.4: MIT
+ i_float 1.16.0: MIT
+ i_key_sort 0.10.3: MIT
+ i_overlay 4.5.2: MIT OR Apache-2.0
+ i_shape 1.18.0: MIT
+ i_tree 0.18.0: MIT
+ ilattice 0.1.0: MIT OR Apache-2.0
+ imagesize 0.13.0: MIT
+ inout 0.1.4: MIT OR Apache-2.0
+ interpolation 0.3.0: MIT
+ is-terminal 0.4.17: MIT
+ ispc-build-utils 0.5.0: MIT OR Apache-2.0 OR Zlib
+ itertools 0.10.5: MIT/Apache-2.0
+ iyes_progress 0.18.0: MIT OR Apache-2.0
+ jzon 0.12.5: MIT/Apache-2.0
+ kira 0.12.1: MIT OR Apache-2.0
+ kqueue-sys 1.1.2: MIT
+ kqueue 1.2.1: MIT
+ kurbo 0.11.3: Apache-2.0 OR MIT
+ leafwing_input_manager_macros 0.17.0: MIT OR Apache-2.0
+ leafwing-input-manager 0.22.0: MIT OR Apache-2.0
+ lightyear_aeronet 0.31.0: MIT OR Apache-2.0
+ lightyear_avian2d 0.31.0: MIT OR Apache-2.0
+ lightyear_avian3d 0.31.0: MIT OR Apache-2.0
+ lightyear_connection 0.31.0: MIT OR Apache-2.0
+ lightyear_core 0.31.0: MIT OR Apache-2.0
+ lightyear_crossbeam 0.31.0: MIT OR Apache-2.0
+ lightyear_deterministic_replication 0.31.0: MIT OR Apache-2.0
+ lightyear_frame_interpolation 0.31.0: MIT OR Apache-2.0
+ lightyear_inputs_bei 0.31.0: MIT OR Apache-2.0
+ lightyear_inputs_leafwing 0.31.0: MIT OR Apache-2.0
+ lightyear_inputs_native 0.31.0: MIT OR Apache-2.0
+ lightyear_inputs 0.31.0: MIT OR Apache-2.0
+ lightyear_interpolation 0.31.0: MIT OR Apache-2.0
+ lightyear_link 0.31.0: MIT OR Apache-2.0
+ lightyear_messages 0.31.0: MIT OR Apache-2.0
+ lightyear_metrics 0.31.0: MIT OR Apache-2.0
+ lightyear_netcode 0.31.0: MIT OR Apache-2.0
+ lightyear_p2p 0.31.0: MIT OR Apache-2.0
+ lightyear_prediction 0.31.0: MIT OR Apache-2.0
+ lightyear_raw_connection 0.31.0: MIT OR Apache-2.0
+ lightyear_replication 0.31.0: MIT OR Apache-2.0
+ lightyear_serde 0.31.0: MIT OR Apache-2.0
+ lightyear_steam 0.31.0: MIT OR Apache-2.0
+ lightyear_sync 0.31.0: MIT OR Apache-2.0
+ lightyear_tools 0.31.0: MIT OR Apache-2.0
+ lightyear_transport 0.31.0: MIT OR Apache-2.0
+ lightyear_udp 0.31.0: MIT OR Apache-2.0
+ lightyear_utils 0.31.0: MIT OR Apache-2.0
+ lightyear_web 0.31.0: MIT OR Apache-2.0
+ lightyear_websocket 0.31.0: MIT OR Apache-2.0
+ lightyear_webtransport 0.31.0: MIT OR Apache-2.0
+ lightyear 0.31.0: MIT OR Apache-2.0
+ linked-hash-map 0.5.6: MIT/Apache-2.0
+ louds-rs 0.7.0: MIT OR Apache-2.0
+ lz4_flex 0.13.1: MIT
+ memoffset 0.9.1: MIT
+ meshopt 0.6.2: MIT OR Apache-2.0
+ metis-sys 0.3.2: MIT OR Apache-2.0
+ metis 0.2.2: MIT OR Apache-2.0
+ metrics-util 0.20.4: MIT
+ metrics 0.24.6: MIT
+ mint 0.5.9: MIT
+ mock_instant 0.6.1: 0BSD
+ moonshine-save 0.8.0: MIT
+ moonshine-util 0.6.0: MIT
+ nanorand 0.6.1: Zlib
+ ndarray 0.15.6: MIT OR Apache-2.0
+ ndcopy 0.3.0: MIT OR Apache-2.0
+ ndshape 0.3.0: MIT OR Apache-2.0
+ nibble_vec 0.1.0: MIT
+ nohash-hasher 0.2.0: Apache-2.0 OR MIT
+ noise 0.9.0: Apache-2.0/MIT
+ noisy_bevy 0.15.0: MIT
+ nonzero_ext 0.3.0: Apache-2.0
+ notify-debouncer-full 0.7.0: MIT OR Apache-2.0
+ notify-types 2.1.0: MIT OR Apache-2.0
+ notify 8.2.0: CC0-1.0
+ ntapi 0.4.3: Apache-2.0 OR MIT
+ num-conv 0.2.2: MIT OR Apache-2.0
+ obvhs 0.4.0: MIT OR Apache-2.0
+ octets 0.3.7: BSD-2-Clause
+ oid-registry 0.8.1: MIT OR Apache-2.0
+ oneshot 0.1.13: MIT OR Apache-2.0
+ oorandom 11.1.5: MIT
+ opaque-debug 0.3.1: MIT OR Apache-2.0
+ opuscule 0.2.2: MPL-2.0
+ ordered-stream 0.2.0: MIT OR Apache-2.0
+ owo-colors 4.4.0: MIT
+ parry2d-f64 0.31.1: Apache-2.0
+ parry2d 0.31.1: Apache-2.0
+ parry3d-f64 0.31.1: Apache-2.0
+ partition 0.1.2: MIT OR Apache-2.0
+ path-slash 0.2.1: MIT
+ pem 3.0.6: MIT
+ pem 4.0.0: MIT
+ plotters-backend 0.3.7: MIT
+ plotters-svg 0.3.7: MIT
+ plotters 0.3.7: MIT
+ pollster 1.0.1: Apache-2.0/MIT
+ poly1305 0.8.0: Apache-2.0 OR MIT
+ polyanya 0.18.0: MIT OR Apache-2.0
+ postcard-derive 0.2.2: MIT OR Apache-2.0
+ powerfmt 0.2.1: MIT OR Apache-2.0
+ proc-macro-crate 1.3.1: MIT OR Apache-2.0
+ proc-macro-error-attr 1.0.4: MIT OR Apache-2.0
+ proc-macro-error-attr3 3.1.1: MIT OR Apache-2.0
+ proc-macro-error 1.0.4: MIT OR Apache-2.0
+ proc-macro-error3 3.1.1: MIT OR Apache-2.0
+ quake-map 0.6.1: CC0-1.0 OR MIT OR Apache-2.0
+ quanta 0.12.6: MIT
+ quick-xml 0.31.0: MIT
+ quick-xml 0.38.4: MIT
+ radix_trie 0.2.1: MIT
+ rand_xorshift 0.3.0: MIT OR Apache-2.0
+ rand_xoshiro 0.7.0: MIT OR Apache-2.0
+ rapidhash 4.5.1: MIT OR Apache-2.0
+ rapier2d 0.36.1: Apache-2.0
+ rcgen 0.14.10: MIT OR Apache-2.0
+ rdst 0.20.14: Apache-2.0 OR MIT
+ rerecast 0.5.0: MIT OR Apache-2.0
+ resvg 0.45.1: Apache-2.0 OR MIT
+ ringbuffer 0.16.0: MIT
+ rmp-serde 1.3.1: MIT
+ rmp 0.8.15: MIT
+ rstar 0.12.2: MIT OR Apache-2.0
+ rtrb 0.3.5: MIT OR Apache-2.0
+ rune-kit 0.0.1: MIT
+ rune-motion 0.1.0: MIT
+ rune-staging 0.0.1: MIT
+ rune-taffy 0.0.1: MIT
+ rune 0.0.1: MIT
+ rusticata-macros 4.1.0: MIT/Apache-2.0
+ rustls-native-certs 0.8.5: Apache-2.0 OR ISC OR MIT
+ rustls-pemfile 2.2.0: Apache-2.0 OR ISC OR MIT
+ rustls-platform-verifier-android 0.2.0: MIT OR Apache-2.0
+ rustls-platform-verifier 0.7.1: MIT OR Apache-2.0
+ seahash 4.1.0: MIT
+ selectors 0.38.0: MPL-2.0
+ serde_arrays 0.2.0: MIT OR Apache-2.0
+ serde_flexitos 0.2.2: Apache-2.0
+ serde_regex 1.2.0: MIT OR Apache-2.0
+ serde_repr 0.1.21: MIT OR Apache-2.0
+ serde_yaml 0.9.34+deprecated: MIT OR Apache-2.0
+ servo_arc 0.4.3: MIT OR Apache-2.0
+ sha2 0.11.1: MIT OR Apache-2.0
+ sif-itree 0.4.1: MIT OR Apache-2.0
+ sketches-ddsketch 0.3.1: Apache-2.0
+ smart-default 0.7.1: MIT
+ spinning_top 0.3.0: MIT/Apache-2.0
+ spki 0.8.1: Apache-2.0 OR MIT
+ steamworks-sys 0.13.0: MIT / Apache-2.0
+ steamworks 0.13.1: MIT / Apache-2.0
+ strip-ansi-escapes 0.2.1: Apache-2.0/MIT
+ strsim 0.10.0: MIT
+ strum_macros 0.27.2: MIT
+ strum 0.27.2: MIT
+ svgtypes 0.15.3: Apache-2.0 OR MIT
+ symphonia-codec-alac 0.5.5: MPL-2.0
+ symphonia-format-caf 0.5.5: MPL-2.0
+ syn 1.0.109: MIT OR Apache-2.0
+ sysinfo 0.39.6: MIT
+ tikv-jemalloc-sys 0.5.4+5.3.0-patched: MIT/Apache-2.0
+ tikv-jemallocator 0.5.4: MIT/Apache-2.0
+ tiled 0.16.0: MIT
+ time-core 0.1.9: MIT OR Apache-2.0
+ time-macros 0.2.32: MIT OR Apache-2.0
+ time 0.3.55: MIT OR Apache-2.0
+ tinytemplate 1.2.1: Apache-2.0 OR MIT
+ tls_codec_derive 0.4.2: Apache-2.0 OR MIT
+ tls_codec 0.4.2: Apache-2.0 OR MIT
+ tokio-tungstenite 0.30.0: MIT
+ toml_datetime 0.6.11: MIT OR Apache-2.0
+ toml_edit 0.19.15: MIT OR Apache-2.0
+ trie-rs 0.4.2: MIT OR Apache-2.0
+ uds_windows 1.2.1: MIT
+ unicode-general-category 1.1.0: Apache-2.0
+ universal-hash 0.5.1: MIT OR Apache-2.0
+ unsafe-libyaml 0.2.11: MIT
+ urlencoding 2.1.3: MIT
+ usvg 0.45.1: Apache-2.0 OR MIT
+ vello_common 0.1.0: Apache-2.0 OR MIT
+ vello_cpu 0.1.0: Apache-2.0 OR MIT
+ vleue_navigator 0.17.0: MIT OR Apache-2.0
+ voracious_radix_sort 1.2.0: MIT
+ vox_bake 0.1.0: MIT
+ vte 0.14.1: Apache-2.0 OR MIT
+ web-sys-async-io 0.6.0: MIT
+ web-sys-stream-utils 0.2.6: MIT
+ web-wt-sys 0.3.1: MIT
+ winnow 0.5.40: MIT
+ wobj 0.3.1: MIT OR Apache-2.0
+ wtransport-proto 0.7.2: MIT OR Apache-2.0
+ wtransport 0.7.2: MIT OR Apache-2.0
+ wyrand 0.5.0: Apache-2.0 OR MIT
+ x509-cert 0.3.0: Apache-2.0 OR MIT
+ x509-parser 0.18.1: MIT OR Apache-2.0
+ xkbcommon 0.9.0: MIT
+ xwt-core 0.10.0: MIT
+ xwt-web 0.22.1: MIT
+ xwt-wtransport 0.20.1: MIT
+ xxhash-rust 0.8.19: BSL-1.0
+ yansi 1.0.1: MIT OR Apache-2.0
+ yasna 0.6.0: MIT OR Apache-2.0
+ zbus_macros 5.19.0: MIT
+ zbus_macros 6.2.1: MIT
+ zbus_names 4.3.4: MIT
+ zbus_utils 6.1.0: MIT
+ zbus_xml 5.2.1: MIT
+ zbus-lockstep-macros 0.5.2: MIT
+ zbus-lockstep 0.5.2: MIT
+ zbus 5.19.0: MIT
+ zbus 6.2.1: MIT
+ zcheapstr 1.1.0: MIT
+ zruntime 0.2.2: MIT
+ zstd-safe 7.4.0: BSD-3-Clause
+ zstd-sys 2.1.2+zstd.1.5.7: BSD-3-Clause
+ zstd 0.13.4: BSD-3-Clause
+ zvariant_derive 5.15.0: MIT
+ zvariant_utils 4.2.0: MIT
+ zvariant 5.15.0: MIT
+---- end of the plugin catalog's crates ----
diff --git a/apps/judge/Cargo.toml b/apps/judge/Cargo.toml
new file mode 100644
index 00000000..b882cca4
--- /dev/null
+++ b/apps/judge/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "raea-app-judge"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "raea judge: a review's sheets judged by clef-omni on a frozen rubric, the pass decided in code, calibrated against the person's eye before it gates"
+
+[dependencies]
+raea-io-home = { path = "../../io/home" }
+serde_json = "1"
+raea-runtime-bundle = { path = "../../runtime/bundle" }
+ureq = { version = "2", features = ["json"] }
+base64 = "0.22"
+image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
diff --git a/apps/judge/src/agent.rs b/apps/judge/src/agent.rs
new file mode 100644
index 00000000..f532c956
--- /dev/null
+++ b/apps/judge/src/agent.rs
@@ -0,0 +1,149 @@
+//! A judge that is an agent CLI rather than clef-omni: `raea judge DIR --by kimi|claude` (Shane, 11-06: "use claude or
+//! kimi cli as the judge"). Each call is a new session, run in DIR with only the sheets to look at (kimi's media tool;
+//! claude with Read alone), given the fresh-context judge prompt (sdk/guides/craft/bevy/prompts.md section 3) and
+//! never the code or the builder's notes. It answers JSON: the seven scores 0-10, the blind read and every defect named;
+//! the pass, done and stall are still decided in code (rubric::pass, progress). `raea judge eye DIR --by kimi` records
+//! its reading as the eye clef is calibrated against.
+
+use std::path::Path;
+
+use serde_json::{Map, Value, json};
+
+use crate::rubric::SCORES;
+
+pub const BY: [&str; 2] = ["kimi", "claude"];
+
+/// The judge prompt: the sheets by name, the brief's words, and the JSON to answer.
+pub fn prompt(dir: &Path, brief: &Value, target: Option<&Path>) -> String {
+ let words = ["look", "logline", "notDoing"].iter().filter_map(|k| brief.get(*k).map(|v| format!("{k}: {}", v.as_str().map(str::to_string).unwrap_or_else(|| v.to_string())))).collect::<Vec<_>>().join("; ");
+ let target = target.map(|t| format!(" The target picture, what it must read as, is {}.", t.display())).unwrap_or_default();
+ format!(
+ "You review a 3D scene from images only, as the person who will use it would. You have never seen how it was built and you never will. \
+Judge what is in the pixels; do not guess at intentions. Only look at images; change no file.\n\n\
+PART 1, BLIND: open {d}/hero-colour.png first, one frame. In one sentence: what place is this, what time, what era? List five objects you can name. \
+Is it a photograph or a render, and which three tells decided it?\n\n\
+PART 2, SCORED. The brief: \"{words}\".{target} This round's sheets: {d}/colour.png and {d}/clay.png, each six tiles, left to right, top to bottom: \
+hero, front, right, top, iso, low (0.3 m off the floor). Clay is every surface light grey and matte. Open both.\n\n\
+Score each 0-10 (5 = a believable draft; 7 = a production base an artist would accept; 9 = indistinguishable from real). Halves are allowed.\n\
+- composition: camera, framing, layout, the position and scale of every major object.\n\
+- form, judged on CLAY: silhouettes read at a glance; parts have real thickness; nothing blobby, melted or a primitive standing in for a thing; repeated things vary.\n\
+- assembly, judged on CLAY first: nothing floats, sinks, pokes through or rests on the wrong thing; joints touch; the low tile shows the feet.\n\
+- materials: every surface reads as its real material, with wear where use puts it; nothing a flat default colour.\n\
+- light: motivated by the place's own sources; exposure and contrast believable.\n\
+- detail: close views hold real geometry or texture, not a smooth stand-in; printed matter reads.\n\
+- world: one coherent real place; nothing off-era or invented beyond the brief.\n\n\
+Then list the defects, most damaging first: at most 8, each field one short sentence. \"blocking\" means someone using this scene would notice it in the views it will be seen in. \
+Name exactly what gives it away (not \"the dryer looks fake\" but \"the dryer door is a flat disc with no rim or glass depth\").\n\n\
+End your answer with only this JSON, nothing after it:\n\
+{{\"blind\": {{\"place\": \"\", \"objects\": [], \"photo\": \"yes|no\", \"tells\": []}}, \
+\"scores\": {{\"composition\": 0, \"form\": 0, \"assembly\": 0, \"materials\": 0, \"light\": 0, \"detail\": 0, \"world\": 0}}, \
+\"defects\": [{{\"tile\": \"\", \"where\": \"\", \"wrong\": \"\", \"real\": \"\", \"fix\": \"\", \"level\": \"blocking|detail\"}}], \
+\"show_as_is\": \"\"}}",
+ d = dir.display()
+ )
+}
+
+/// The last JSON object in the text that has scores (an agent may think aloud, or draft the JSON twice).
+pub fn last_verdict(text: &str) -> Option<Value> {
+ let starts: Vec<usize> = text.match_indices('{').map(|(i, _)| i).collect();
+ for &s in starts.iter().rev() {
+ let mut de = serde_json::Deserializer::from_str(&text[s..]).into_iter::<Value>();
+ if let Some(Ok(v)) = de.next()
+ && v.get("scores").is_some_and(Value::is_object)
+ {
+ return Some(v);
+ }
+ }
+ None
+}
+
+/// The verdict read into the judge's own shape: scores (0-10, the seven categories), defects (present, level, named
+/// by what is wrong), the blind read's photo (1 a photo, 0 a render) and the agent's own words.
+pub fn read(v: &Value) -> (Map<String, Value>, Vec<Value>, Value) {
+ let mut scores = Map::new();
+ for (k, _, _) in SCORES {
+ if let Some(x) = v["scores"][k].as_f64().filter(|x| (0.0..=10.0).contains(x)) {
+ scores.insert(k.into(), json!(x));
+ }
+ }
+ let defects = v["defects"].as_array().into_iter().flatten().filter(|d| d["wrong"].as_str().is_some_and(|w| !w.trim().is_empty())).map(|d| {
+ let level = if d["level"].as_str().unwrap_or("").starts_with("block") { "blocking" } else { "detail" };
+ let wrong = d["wrong"].as_str().unwrap_or("");
+ json!({"defect": wrong.chars().take(80).collect::<String>(), "present": true, "level": level, "sheet": d["tile"], "asked": wrong,
+ "where": d["where"], "real": d["real"], "fix": d["fix"]})
+ }).collect();
+ let photo = match v["blind"]["photo"].as_str() {
+ Some(p) if p.starts_with('y') => json!(1.0),
+ Some(p) if p.starts_with('n') => json!(0.0),
+ _ => Value::Null,
+ };
+ (scores, defects, photo)
+}
+
+/// One fresh judging session by `by` over DIR's sheets: its verdict JSON. Its steps stream (kimi's stream-json), each
+/// said on stderr as it comes, so a watcher sees it working through a judgement that can take minutes.
+pub fn ask(by: &str, dir: &Path, brief: &Value, target: Option<&Path>) -> Result<Value, String> {
+ use std::io::BufRead as _;
+ let dir = dir.canonicalize().map_err(|e| format!("judge: {}: {e}", dir.display()))?;
+ let p = prompt(&dir, brief, target);
+ let mut cmd = match by {
+ "kimi" => {
+ let mut c = std::process::Command::new("kimi");
+ c.args(["-p", &p, "--output-format", "stream-json"]);
+ c
+ }
+ "claude" => {
+ let mut c = std::process::Command::new("claude");
+ c.args(["-p", &p, "--allowedTools", "Read", "--output-format", "stream-json", "--verbose"]);
+ c
+ }
+ o => return Err(format!("judge: --by {o}: the judges are clef (the default), {}", BY.join(", "))),
+ };
+ let mut child = cmd.current_dir(&dir).stdout(std::process::Stdio::piped()).stderr(std::process::Stdio::piped()).spawn()
+ .map_err(|e| format!("judge: couldn't run {by}: {e} (is the {by} CLI installed and signed in?)"))?;
+ let mut said = Vec::new();
+ let mut last = String::new();
+ for line in std::io::BufReader::new(child.stdout.take().ok_or("judge: no output pipe")?).lines().map_while(Result::ok) {
+ let Ok(v) = serde_json::from_str::<Value>(&line) else { continue };
+ said.extend(texts(&v));
+ let step = match (v["role"].as_str(), v["type"].as_str()) {
+ (Some("tool") | Some("user"), _) => "looked at a picture".to_string(),
+ (Some("assistant"), _) | (_, Some("assistant")) => texts(&v).last().map_or_else(|| "thinking".into(), |t| t[..t.floor_char_boundary(100)].to_string()),
+ _ => continue,
+ };
+ if step != last {
+ eprintln!("judge ({by}): {}", step.replace('\n', " "));
+ last = step;
+ }
+ }
+ let out = child.wait_with_output().map_err(|e| format!("judge: {by}: {e}"))?;
+ let text = said.join("\n");
+ if !out.status.success() && last_verdict(&text).is_none() {
+ return Err(format!("judge: {by} failed: {}", String::from_utf8_lossy(&out.stderr).lines().rev().find(|l| !l.trim().is_empty()).unwrap_or("no output")));
+ }
+ last_verdict(&text).ok_or_else(|| format!("judge: {by} answered no verdict JSON: {}", text.trim().chars().rev().take(300).collect::<String>().chars().rev().collect::<String>()))
+}
+
+/// The words in one streamed line: kimi's {role: assistant, content: "..."}; claude's {type: assistant, message:
+/// {content: [{type: text, text}]}} and its final {type: result, result}.
+fn texts(v: &Value) -> Vec<String> {
+ let mut out = Vec::new();
+ if v["role"] == "assistant"
+ && let Some(s) = v["content"].as_str()
+ {
+ out.push(s.to_string());
+ }
+ for c in v["message"]["content"].as_array().into_iter().flatten() {
+ if c["type"] == "text"
+ && let Some(s) = c["text"].as_str()
+ {
+ out.push(s.to_string());
+ }
+ }
+ if v["type"] == "result"
+ && let Some(s) = v["result"].as_str()
+ {
+ out.push(s.to_string());
+ }
+ out
+}
diff --git a/apps/judge/src/clef.rs b/apps/judge/src/clef.rs
new file mode 100644
index 00000000..0af66436
--- /dev/null
+++ b/apps/judge/src/clef.rs
@@ -0,0 +1,37 @@
+//! One clef-omni call on Workers AI (as apps/app/host/critique.ts makes it): the state paragraph, the questions by id,
+//! the images as data URLs (each made a JPEG at most 1600 px wide first). Keys: CLOUDFLARE_ACCOUNT_ID and
+//! CLOUDFLARE_API_TOKEN from raea's settings (the environment, then ~/.raea/env).
+
+use std::path::PathBuf;
+
+use base64::Engine as _;
+use serde_json::{Value, json};
+
+fn jpeg(p: &PathBuf) -> Result<String, String> {
+ let img = image::open(p).map_err(|e| format!("{}: {e}", p.display()))?;
+ let img = if img.width() > 1600 { img.resize(1600, u32::MAX, image::imageops::FilterType::Triangle) } else { img };
+ let mut buf = std::io::Cursor::new(Vec::new());
+ img.to_rgb8().write_to(&mut buf, image::ImageFormat::Jpeg).map_err(|e| e.to_string())?;
+ Ok(format!("data:image/jpeg;base64,{}", base64::engine::general_purpose::STANDARD.encode(buf.into_inner())))
+}
+
+/// The answers by question id, and the call's cost in dollars ($0.15 a million input tokens).
+pub fn ask(state: &str, questions: &Value, images: &[PathBuf]) -> Result<(Value, f64), String> {
+ let (Some(acct), Some(token)) = (raea_io_home::setting("CLOUDFLARE_ACCOUNT_ID"), raea_io_home::setting("CLOUDFLARE_API_TOKEN")) else {
+ return Err("judge: clef-omni on Workers AI needs CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (the environment or ~/.raea/env)".into());
+ };
+ let imgs: Vec<String> = images.iter().map(jpeg).collect::<Result<_, _>>()?;
+ let body = json!({"state": state, "questions": questions, "images": imgs});
+ let url = format!("https://api.cloudflare.com/client/v4/accounts/{acct}/ai/run/@cf/cloudflare/clef-omni");
+ let res = ureq::post(&url).set("authorization", &format!("Bearer {token}")).timeout(std::time::Duration::from_secs(180)).send_json(body);
+ let j: Value = match res {
+ Ok(r) => r.into_json().map_err(|e| format!("clef: {e}"))?,
+ Err(ureq::Error::Status(code, r)) => return Err(format!("clef: HTTP {code}: {}", r.into_string().unwrap_or_default().chars().take(300).collect::<String>())),
+ Err(e) => return Err(format!("clef: {e}")),
+ };
+ if j["success"] != true {
+ return Err(format!("clef: {}", j["errors"].to_string().chars().take(300).collect::<String>()));
+ }
+ let cost = j["result"]["usage"]["input_tokens"].as_f64().unwrap_or(0.0) * 0.15 / 1e6;
+ Ok((j["result"]["answers"].clone(), cost))
+}
diff --git a/apps/judge/src/eye.rs b/apps/judge/src/eye.rs
new file mode 100644
index 00000000..e34a98ef
--- /dev/null
+++ b/apps/judge/src/eye.rs
@@ -0,0 +1,150 @@
+//! Shane's eye, the judge's calibration. `raea judge eye DIR form=5 light=7 ... [--pass yes|no]` records his scores for a
+//! round the judge has already judged (DIR/judge.json), with the judge's raw scores beside them, in
+//! ~/.raea/judge/eye.jsonl. `raea judge calibrate` fits, per category, a line from the judge's score to his
+//! (least squares), and says how often the mapped judge's pass agrees with his. The judge gates only once it has 10
+//! rounds or more, some passed by the eye and some not, and agrees on 8 in 10 or better; until then `gating` is false and its verdict is advice
+//! (clef has rated almost everything acceptable: docs/craft-system.md). `raea judge eye DIR --by kimi|claude` records a
+//! fresh agent session's reading instead (Shane, 11-06), each row saying whose eye it is.
+
+use std::path::PathBuf;
+
+use serde_json::{Map, Value, json};
+
+use crate::rubric::{SCORES, pass};
+
+fn home() -> PathBuf {
+ raea_io_home::env_path("RAEA_JUDGE_DIR", ".raea/judge")
+}
+
+/// The calibration in force, if one was made.
+pub fn calibration() -> Option<Value> {
+ serde_json::from_str(&std::fs::read_to_string(home().join("calibration.json")).ok()?).ok()
+}
+
+/// The judge's scores mapped through the calibration's lines, kept to 0-10.
+pub fn apply(c: &Value, scores: &mut Map<String, Value>) {
+ for (k, v) in scores.iter_mut() {
+ if let (Some(x), Some(a), Some(b)) = (v.as_f64(), c["maps"][k]["a"].as_f64(), c["maps"][k]["b"].as_f64()) {
+ *v = json!(((a * x + b).clamp(0.0, 10.0) * 100.0).round() / 100.0);
+ }
+ }
+}
+
+pub fn record(args: &[String]) -> Result<String, String> {
+ let dir = args.get(2).map(PathBuf::from).ok_or("raea judge eye DIR CATEGORY=SCORE... [--pass yes|no]")?;
+ let verdict: Value = serde_json::from_str(&std::fs::read_to_string(dir.join("judge.json")).map_err(|_| format!("judge eye: no {}: judge the round first (raea judge {})", dir.join("judge.json").display(), dir.display()))?).map_err(|e| e.to_string())?;
+ // an agent's reading as the eye (`--by kimi`): a fresh session's scores, and its pass by the same rule in code
+ if let Some(by) = args.iter().position(|a| a == "--by").and_then(|i| args.get(i + 1)) {
+ let v = crate::agent::ask(by, &dir, &json!({}), None)?;
+ let (eye, defects, _) = crate::agent::read(&v);
+ if eye.len() < SCORES.len() {
+ return Err(format!("judge eye: {by} scored only {} of {} categories", eye.len(), SCORES.len()));
+ }
+ let eye_pass = pass(&eye, &defects).0;
+ let row = json!({"dir": verdict["dir"], "by": by, "judge": verdict["raw"], "judge_pass": verdict["pass"], "defects": verdict["defects"], "eye": eye, "eye_pass": eye_pass, "eye_defects": defects});
+ append(&row)?;
+ let shown: Vec<String> = eye.iter().map(|(k, v)| format!("{k} {v}")).collect();
+ return Ok(format!("APPLIED {by}'s eye on {} recorded ({}): {}; raea judge calibrate fits clef to it", dir.display(), if eye_pass { "a pass" } else { "not yet" }, shown.join(", ")));
+ }
+ let mut eye = Map::new();
+ let mut said_pass = None;
+ let mut i = 3;
+ while i < args.len() {
+ if args[i] == "--pass" {
+ said_pass = Some(matches!(args.get(i + 1).map(String::as_str), Some("yes" | "true" | "y")));
+ i += 2;
+ continue;
+ }
+ let (k, v) = args[i].split_once('=').ok_or_else(|| format!("judge eye: {:?} isn't CATEGORY=SCORE", args[i]))?;
+ if !SCORES.iter().any(|s| s.0 == k) {
+ return Err(format!("judge eye: no category {k}: {}", SCORES.iter().map(|s| s.0).collect::<Vec<_>>().join(", ")));
+ }
+ let x: f64 = v.parse().ok().filter(|x| (0.0..=10.0).contains(x)).ok_or_else(|| format!("judge eye: {k} is a score 0-10, got {v:?}"))?;
+ eye.insert(k.into(), json!(x));
+ i += 1;
+ }
+ if eye.is_empty() {
+ return Err("judge eye: give your scores, e.g. composition=6 form=5 assembly=7 materials=4 light=6 detail=5 world=6".into());
+ }
+ // his pass: as he says it, else the same rule on his scores with the judge's defects
+ let eye_pass = said_pass.unwrap_or_else(|| pass(&eye, verdict["defects"].as_array().map(Vec::as_slice).unwrap_or(&[])).0);
+ let row = json!({"dir": verdict["dir"], "by": "shane", "judge": verdict["raw"], "judge_pass": verdict["pass"], "defects": verdict["defects"], "eye": eye, "eye_pass": eye_pass});
+ append(&row)?;
+ Ok(format!("APPLIED your eye on {} recorded ({}): raea judge calibrate fits the judge to it", dir.display(), if eye_pass { "a pass" } else { "not yet" }))
+}
+
+/// One eye row onto ~/.raea/judge/eye.jsonl; a newer reading of the same round by the same eye replaces the older.
+fn append(row: &Value) -> Result<(), String> {
+ std::fs::create_dir_all(home()).map_err(|e| e.to_string())?;
+ let path = home().join("eye.jsonl");
+ let mut rows: Vec<Value> = std::fs::read_to_string(&path).unwrap_or_default().lines().filter_map(|l| serde_json::from_str(l).ok()).filter(|r: &Value| !(r["dir"] == row["dir"] && whose(r) == whose(&row))).collect();
+ rows.push(row.clone());
+ std::fs::write(&path, rows.iter().map(Value::to_string).collect::<Vec<_>>().join("\n") + "\n").map_err(|e| e.to_string())
+}
+
+/// Least squares y = a x + b; flat x (one value) maps by the mean offset.
+fn fit(xy: &[(f64, f64)]) -> (f64, f64) {
+ let n = xy.len() as f64;
+ let (mx, my) = (xy.iter().map(|p| p.0).sum::<f64>() / n, xy.iter().map(|p| p.1).sum::<f64>() / n);
+ let sxx: f64 = xy.iter().map(|p| (p.0 - mx).powi(2)).sum();
+ if sxx < 1e-9 {
+ return (1.0, my - mx);
+ }
+ let a = xy.iter().map(|p| (p.0 - mx) * (p.1 - my)).sum::<f64>() / sxx;
+ (a, my - a * mx)
+}
+
+/// The fit over rows of {judge, eye, defects, eye_pass}: per-category maps and errors, and the pass agreement.
+pub fn fit_rows(rows: &[Value]) -> Value {
+ let mut maps = Map::new();
+ for (k, _, _) in SCORES {
+ let xy: Vec<(f64, f64)> = rows.iter().filter_map(|r| Some((r["judge"][k].as_f64()?, r["eye"][k].as_f64()?))).collect();
+ if xy.len() < 2 {
+ continue;
+ }
+ let (a, b) = fit(&xy);
+ let mae = |f: &dyn Fn(f64) -> f64| xy.iter().map(|(x, y)| (f(*x) - y).abs()).sum::<f64>() / xy.len() as f64;
+ let r2 = |x: f64| (x * 1000.0).round() / 1000.0;
+ maps.insert(k.into(), json!({"a": r2(a), "b": r2(b), "n": xy.len(), "maeRaw": r2(mae(&|x| x)), "maeMapped": r2(mae(&|x| (a * x + b).clamp(0.0, 10.0)))}));
+ }
+ let cal = json!({"maps": maps});
+ let mut agree = 0;
+ for r in rows {
+ let mut s = r["judge"].as_object().cloned().unwrap_or_default();
+ apply(&cal, &mut s);
+ let p = pass(&s, r["defects"].as_array().map(Vec::as_slice).unwrap_or(&[])).0;
+ if Value::Bool(p) == r["eye_pass"] {
+ agree += 1;
+ }
+ }
+ let n = rows.len();
+ let agreement = if n == 0 { 0.0 } else { agree as f64 / n as f64 };
+ // agreement means something only when the eye passed some rounds and failed others: all fails agree trivially
+ let passes = rows.iter().filter(|r| r["eye_pass"] == true).count();
+ let both = passes > 0 && passes < n;
+ json!({"maps": maps, "rounds": n, "eyePasses": passes, "agreement": (agreement * 1000.0).round() / 1000.0, "gate": n >= 10 && agreement >= 0.8 && both})
+}
+
+pub fn calibrate(args: &[String]) -> Result<String, String> {
+ let rows: Vec<Value> = std::fs::read_to_string(home().join("eye.jsonl")).unwrap_or_default().lines().filter_map(|l| serde_json::from_str(l).ok()).collect();
+ if rows.is_empty() {
+ return Err("judge calibrate: no rounds with your eye yet (raea judge eye DIR form=5 ...)".into());
+ }
+ let mut cal = fit_rows(&rows);
+ let mut eyes: Vec<String> = rows.iter().map(whose).map(str::to_string).collect();
+ eyes.sort();
+ eyes.dedup();
+ cal["eyes"] = json!(eyes);
+ std::fs::write(home().join("calibration.json"), serde_json::to_string_pretty(&cal).unwrap_or_default()).map_err(|e| e.to_string())?;
+ if args.iter().any(|a| a == "--json") {
+ return Ok(serde_json::to_string_pretty(&cal).unwrap_or_default());
+ }
+ let mut t: Vec<String> = cal["maps"].as_object().into_iter().flatten().map(|(k, m)| format!("{k:<12} eye = {} x judge {:+} (off by {} raw, {} mapped, {} rounds)", m["a"], m["b"], m["maeRaw"], m["maeMapped"], m["n"])).collect();
+ t.push(format!("agreement on the pass: {} over {} rounds (eyes: {}); {}", cal["agreement"], cal["rounds"], eyes.join(", "), if cal["gate"] == true { "the judge gates now".to_string() } else if cal["rounds"].as_u64() >= Some(10) && cal["agreement"].as_f64() >= Some(0.8) { format!("advice only: the eye passed {} of {} rounds, and agreement means something only with passes and fails both (judge a scene that is good)", cal["eyePasses"], cal["rounds"]) } else { "advice only until 10 rounds agree 8 in 10, with passes and fails both".to_string() }));
+ Ok(t.join("\n"))
+}
+
+/// Whose eye a row records: Shane's when it doesn't say.
+fn whose(r: &Value) -> &str {
+ r["by"].as_str().unwrap_or("shane")
+}
diff --git a/apps/judge/src/lib.rs b/apps/judge/src/lib.rs
new file mode 100644
index 00000000..3fae3e97
--- /dev/null
+++ b/apps/judge/src/lib.rs
@@ -0,0 +1,171 @@
+//! `raea judge`: a review's sheets (`raea render --review DIR`) judged by clef-omni on the frozen rubric (rubric.rs),
+//! fresh every round and blind to the code, with the pass decided here in code. Until it is calibrated against Shane's
+//! eye (`raea judge eye`, `raea judge calibrate`, eye.rs) its verdict is advice: `gating` says which.
+//!
+//! raea judge DIR [--by clef|kimi|claude] [--brief brief.ts] [--target T.png] [--json] [--dry]
+//! raea judge eye DIR composition=6 form=5 ... [--pass yes|no] (or --by kimi: an agent's reading as the eye)
+//! raea judge calibrate [--json]
+//!
+//! DIR/judge.json is the verdict; DIR's parent's judge.log.jsonl holds every round's, so "done" (two passes in a row,
+//! each a fresh call) and the stall (the mean up by less than a point over two rounds) are read from it.
+
+mod agent;
+mod clef;
+mod eye;
+pub mod rubric;
+
+pub use agent::BY;
+
+use std::path::{Path, PathBuf};
+
+use raea_runtime_bundle::flag;
+use serde_json::{Value, json};
+
+pub const USAGE: &str = "raea judge DIR [--by clef|kimi|claude] [--brief brief.ts] [--target T.png] [--json] [--dry] | judge eye DIR (CATEGORY=SCORE ... [--pass yes|no] | --by kimi|claude) | judge calibrate [--json] (a --review folder's sheets judged blind: clef-omni on the frozen rubric, or a fresh kimi or claude session on the judge prompt; the pass decided in code; clef advises until calibrated against your eye or an agent's)";
+
+/// The brief's words, from `raea spec brief.ts --as brief` (look, logline, notDoing), or nothing.
+fn brief_of(path: Option<&str>) -> Result<Value, String> {
+ let Some(p) = path else { return Ok(json!({})) };
+ let exe = std::env::current_exe().map_err(|e| e.to_string())?;
+ let out = std::process::Command::new(exe).args(["spec", p, "--as", "brief"]).output().map_err(|e| e.to_string())?;
+ let text = String::from_utf8_lossy(&out.stdout);
+ let start = text.find('{').ok_or_else(|| format!("judge: {p} didn't read as a brief: {}", String::from_utf8_lossy(&out.stderr).lines().last().unwrap_or("")))?;
+ let v: Value = serde_json::from_str(&text[start..]).map_err(|e| format!("judge: {p}: {e}"))?;
+ Ok(v.get("brief").cloned().unwrap_or(v))
+}
+
+/// The rounds judged so far beside this one (DIR's parent's judge.log.jsonl).
+fn log_of(dir: &Path) -> PathBuf {
+ dir.parent().unwrap_or(dir).join("judge.log.jsonl")
+}
+
+/// Done and stall, from the log's rounds (oldest first), in code.
+pub fn progress(rounds: &[Value]) -> Value {
+ let passes = rounds.iter().rev().take_while(|r| r["pass"] == true).count();
+ let means: Vec<f64> = rounds.iter().filter_map(|r| r["mean"].as_f64()).collect();
+ let stall = means.len() >= 3 && {
+ let best_before = means[..means.len() - 2].iter().cloned().fold(f64::MIN, f64::max);
+ let best_now = means[means.len() - 2..].iter().cloned().fold(f64::MIN, f64::max);
+ best_now - best_before < 1.0
+ };
+ // the same blocking defect present in the last two rounds
+ let named = |r: &Value| -> Vec<String> { rubric::blocking(r["defects"].as_array().map(Vec::as_slice).unwrap_or_default()).into_iter().map(str::to_string).collect() };
+ let again: Vec<String> = match rounds {
+ [.., a, b] => named(a).into_iter().filter(|d| named(b).contains(d)).collect(),
+ _ => Vec::new(),
+ };
+ json!({"rounds": rounds.len(), "passesInARow": passes, "done": passes >= 2, "stall": stall || !again.is_empty(), "again": again})
+}
+
+pub fn cli(args: &[String]) -> Result<String, String> {
+ match args.get(1).map(String::as_str) {
+ Some("eye") => return eye::record(args),
+ Some("calibrate") => return eye::calibrate(args),
+ Some(_) => {}
+ None => return Err(USAGE.into()),
+ }
+ let dir = PathBuf::from(&args[1]);
+ let (colour, clay, hero) = (dir.join("colour.png"), dir.join("clay.png"), dir.join("hero-colour.png"));
+ for f in [&colour, &clay] {
+ if !f.is_file() {
+ return Err(format!("judge: no {} (make the sheets with raea render EDIT.tsx --review {})", f.display(), dir.display()));
+ }
+ }
+ let brief = brief_of(flag(args, "--brief").as_deref())?;
+ let target = flag(args, "--target").map(PathBuf::from);
+ let dry = args.iter().any(|a| a == "--dry");
+ let by = flag(args, "--by").unwrap_or_else(|| "clef".into());
+ if by != "clef" {
+ if dry {
+ return Ok(agent::prompt(&dir, &brief, target.as_deref()));
+ }
+ let v = agent::ask(&by, &dir, &brief, target.as_deref())?;
+ let (scores, defects, photo) = agent::read(&v);
+ return finish(args, &dir, scores.clone(), scores, defects, photo, 0.0, &by, false, json!({"blind": v["blind"], "show_as_is": v["show_as_is"]}));
+ }
+ let mut calls = Vec::new();
+ for (sheet, img) in [("colour", &colour), ("clay", &clay)] {
+ let mut images = vec![img.clone()];
+ if sheet == "colour" {
+ images.extend(target.clone());
+ }
+ calls.push((sheet, rubric::state(sheet, &brief), rubric::questions(sheet), images));
+ }
+ if hero.is_file() {
+ calls.push(("blind", "One frame. Judge only what is in the pixels.".into(), rubric::blind(), vec![hero.clone()]));
+ }
+ if dry {
+ let shown: Vec<Value> = calls.iter().map(|(s, st, q, im)| json!({"sheet": s, "state": st, "questions": q, "images": im.iter().map(|p| p.display().to_string()).collect::<Vec<_>>()})).collect();
+ return Ok(serde_json::to_string_pretty(&json!({"would_ask": shown})).unwrap_or_default());
+ }
+ let mut scores = serde_json::Map::new();
+ let mut defects = Vec::new();
+ let mut photo = Value::Null;
+ let mut cost = 0.0;
+ for (sheet, st, q, images) in &calls {
+ let (answers, c) = clef::ask(st, q, images)?;
+ cost += c;
+ if *sheet == "blind" {
+ photo = json!(answers["photo"]["noul"].as_f64().map(|p| (p * 1000.0).round() / 1000.0));
+ continue;
+ }
+ let (s, d) = rubric::read(&answers);
+ scores.extend(s);
+ defects.extend(d.into_iter().map(|mut x| {
+ x["sheet"] = json!(sheet);
+ x
+ }));
+ }
+ let raw = scores.clone();
+ let cal = eye::calibration();
+ if let Some(c) = &cal {
+ eye::apply(c, &mut scores);
+ }
+ let gating = cal.as_ref().is_some_and(|c| c["gate"] == true);
+ finish(args, &dir, scores, raw, defects, photo, cost, "clef", !gating, json!({"calibrated": cal.is_some()}))
+}
+
+/// The verdict decided in code, written (DIR/judge.json for clef, DIR/judge.BY.json for an agent; every round in the
+/// log), and said. `advice` marks a judge not yet trusted to gate (clef before calibration).
+#[allow(clippy::too_many_arguments)]
+fn finish(args: &[String], dir: &Path, scores: serde_json::Map<String, Value>, raw: serde_json::Map<String, Value>, defects: Vec<Value>, photo: Value, cost: f64, by: &str, advice: bool, extra: Value) -> Result<String, String> {
+ let (pass, why) = rubric::pass(&scores, &defects);
+ let vals: Vec<f64> = scores.values().filter_map(Value::as_f64).collect();
+ let mean = if vals.is_empty() { 0.0 } else { (vals.iter().sum::<f64>() / vals.len() as f64 * 100.0).round() / 100.0 };
+ let model = if by == "clef" { "@cf/cloudflare/clef-omni".to_string() } else { format!("{by} cli") };
+ let mut verdict = json!({"dir": dir.display().to_string(), "by": by, "scores": scores, "raw": raw, "mean": mean, "defects": defects, "photo": photo,
+ "pass": pass, "why": why, "gating": !advice, "cost": cost, "model": model});
+ if let (Some(v), Some(e)) = (verdict.as_object_mut(), extra.as_object()) {
+ v.extend(e.clone());
+ }
+ let log = log_of(dir);
+ let mut rounds: Vec<Value> = std::fs::read_to_string(&log).unwrap_or_default().lines().filter_map(|l| serde_json::from_str(l).ok()).filter(|r: &Value| r["dir"] != verdict["dir"]).collect();
+ rounds.push(verdict.clone());
+ verdict["progress"] = progress(&rounds);
+ let file = if by == "clef" { "judge.json".to_string() } else { format!("judge.{by}.json") };
+ std::fs::write(dir.join(file), serde_json::to_string_pretty(&verdict).unwrap_or_default()).map_err(|e| e.to_string())?;
+ let lines: Vec<String> = rounds.iter().map(|r| serde_json::to_string(&json!({"dir": r["dir"], "pass": r["pass"], "mean": r["mean"], "defects": r["defects"]})).unwrap_or_default()).collect();
+ std::fs::write(&log, lines.join("\n") + "\n").map_err(|e| e.to_string())?;
+ if cost > 0.0 {
+ let _ = std::process::Command::new("antsy").args(["spend", &format!("{cost:.6}"), "raea judge (clef-omni)"]).output();
+ }
+ if args.iter().any(|a| a == "--json") {
+ return Ok(serde_json::to_string_pretty(&verdict).unwrap_or_default());
+ }
+ let who = if by == "clef" { String::new() } else { format!("({by}) ") };
+ let mut t = vec![format!("{} {who}{}{}", if pass { "PASS" } else { "NOT YET" }, if advice { "(advice: the judge isn't calibrated against your eye yet) " } else { "" }, why.join("; "))];
+ t.push(format!("scores: {}", scores.iter().map(|(k, v)| format!("{k} {v}")).collect::<Vec<_>>().join(", ")));
+ for d in verdict["defects"].as_array().into_iter().flatten().filter(|d| d["present"] == true) {
+ if by == "clef" {
+ t.push(format!(" {:<8} {} (p {}, {} sheet): {}", d["level"].as_str().unwrap_or(""), d["defect"].as_str().unwrap_or(""), d["p"], d["sheet"].as_str().unwrap_or(""), d["asked"].as_str().unwrap_or("")));
+ } else {
+ t.push(format!(" {:<8} {} tile: {} (fix: {})", d["level"].as_str().unwrap_or(""), d["sheet"].as_str().unwrap_or(""), d["asked"].as_str().unwrap_or(""), d["fix"].as_str().unwrap_or("")));
+ }
+ }
+ let p = &verdict["progress"];
+ t.push(format!("round {}: {} passes in a row{}{}; ${cost:.4}", p["rounds"], p["passesInARow"], if p["done"] == true { ", done" } else { "" }, if p["stall"] == true { ", stalled: change the approach for the part, not the dose" } else { "" }));
+ Ok(t.join("\n"))
+}
+
+#[cfg(test)]
+mod tests;
diff --git a/apps/judge/src/rubric.rs b/apps/judge/src/rubric.rs
new file mode 100644
index 00000000..348b401d
--- /dev/null
+++ b/apps/judge/src/rubric.rs
@@ -0,0 +1,133 @@
+//! The frozen rubric (the 11-06 prompt pack, section 3, in clef-omni's native question types): a 0-10 score per category
+//! as an ordered six-level rubric, and every named defect as a yes/no question, so a defect is a probability rather
+//! than prose. clef-omni answers questions, not essays; the defects it can name are the ones asked. Nothing here says
+//! where the pass line is (the loop decides, in code: `pass`).
+
+use serde_json::{Value, json};
+
+/// The six levels each category is scored on, lowest first (clef's `score`: the probability-weighted level), read as
+/// 0, 2, 4, 6, 8, 10.
+fn levels(what: &str) -> Value {
+ json!([
+ format!("0: no {what} to speak of; broken or missing"),
+ format!("2: {what} is crude: primitives and placeholders"),
+ format!("4: {what} is a rough draft, plainly unfinished"),
+ format!("6: {what} is a believable draft"),
+ format!("8: {what} is a production base an artist would accept"),
+ format!("10: {what} is indistinguishable from the real thing"),
+ ])
+}
+
+/// (id, the sheet it is judged on, the question)
+pub const SCORES: [(&str, &str, &str); 7] = [
+ ("composition", "colour", "Composition: the camera, framing and layout; every major object's position and scale against the brief's space."),
+ ("form", "clay", "Form, judged on these grey clay tiles: silhouettes read at a glance, parts have real thickness, nothing blobby or melted, no primitive standing in for a thing, repeated things vary."),
+ ("assembly", "clay", "Assembly, judged on these grey clay tiles: nothing floats, sinks, pokes through or rests on the wrong thing; joints touch; the low tile shows the feet resting."),
+ ("materials", "colour", "Materials: every surface reads as its real material with wear where use puts it; nothing a flat default colour; glass is glass."),
+ ("light", "colour", "Light: motivated by the place's own sources; exposure and contrast believable; no surface implausibly dark or bright."),
+ ("detail", "colour", "Detail: close surfaces hold real geometry or texture at that distance, not smooth stand-ins; printed matter reads."),
+ ("world", "colour", "World: one coherent real place matching the brief; nothing off-era, no real brands, nothing invented beyond the brief."),
+];
+
+/// (id, sheet, the yes/no question, blocking when yes)
+pub const DEFECTS: [(&str, &str, &str, bool); 12] = [
+ ("floating", "clay", "Does any object float above the surface it should rest on, with a visible gap under it?", true),
+ ("intersecting", "clay", "Does any object pass through another object, a wall or the floor?", true),
+ ("blobby", "clay", "Is any object a blobby, melted or lumpy shape where the real thing has crisp form?", true),
+ ("stand_in", "clay", "Is any object just a plain box, ball or cylinder standing in for a more detailed real thing?", true),
+ ("clones", "clay", "Are several copies of one thing identical and evenly spaced in an obviously artificial way?", false),
+ ("flat_colour", "colour", "Is any large surface a flat, uniform default colour with no texture, variation or wear?", true),
+ ("plastic", "colour", "Do the surfaces look like shiny uniform plastic or CG rather than their real materials?", true),
+ ("garbled_text", "colour", "Is any visible text garbled, tiled or unreadable where it should read?", false),
+ ("too_dark", "colour", "Is the scene so dark that important objects are hard to see?", true),
+ ("too_bright", "colour", "Is the scene washed out, with large areas blown to white?", true),
+ ("brands", "colour", "Is a real brand name or logo visible?", true),
+ ("not_doing", "colour", "Does the scene show anything the brief says it must not contain?", true),
+];
+
+/// The paragraph clef reads before the sheet: what it is looking at, and the brief's words (no code, no log, no line).
+pub fn state(sheet: &str, brief: &Value) -> String {
+ let look = brief["look"].as_str().unwrap_or("");
+ let logline = brief["logline"].as_str().unwrap_or("");
+ let not: Vec<&str> = brief["notDoing"].as_array().into_iter().flatten().filter_map(Value::as_str).collect();
+ let tiles = "six tiles of one 3D scene, left to right and top to bottom: hero (the shot's own camera), front, right, top, iso, and low (a camera 0.3 m off the floor)";
+ let what = if sheet == "clay" { format!("The image is {tiles}, rendered in clay: every surface plain grey, so only form and assembly show.") } else { format!("The image is {tiles}, in full colour.") };
+ let target = if sheet == "colour" { " A second image, when given, is the target picture the scene should read as." } else { "" };
+ let mut s = format!("{what}{target} Judge only what is in the pixels, as the person who will use the scene would.");
+ if !logline.is_empty() || !look.is_empty() {
+ s.push_str(&format!(" The brief: {logline} Look: {look}."));
+ }
+ if !not.is_empty() {
+ s.push_str(&format!(" The scene must not contain: {}.", not.join("; ")));
+ }
+ s
+}
+
+/// The questions for one sheet, by id.
+pub fn questions(sheet: &str) -> Value {
+ let mut q = serde_json::Map::new();
+ for (id, on, ask) in SCORES {
+ if on == sheet {
+ q.insert(format!("score_{id}"), json!({"type": "score", "instructions": ask, "criteria": levels(id)}));
+ }
+ }
+ for (id, on, ask, _) in DEFECTS {
+ if on == sheet {
+ q.insert(format!("defect_{id}"), json!({"type": "noul", "instructions": ask}));
+ }
+ }
+ Value::Object(q)
+}
+
+/// The blind read on the hero tile alone: is this a photograph (reported, never gated, until calibrated).
+pub fn blind() -> Value {
+ json!({"photo": {"type": "noul", "instructions": "Is this a photograph of a real place, rather than a computer render?"}})
+}
+
+/// clef's answers read into scores (0-10) and defects (probability of yes, blocking ones flagged).
+pub fn read(answers: &Value) -> (serde_json::Map<String, Value>, Vec<Value>) {
+ let mut scores = serde_json::Map::new();
+ let mut defects = Vec::new();
+ for (id, _, _) in SCORES {
+ if let Some(a) = answers.get(format!("score_{id}")) {
+ let level = a["score"].as_f64().unwrap_or(0.0);
+ scores.insert(id.into(), json!((level * 2.0 * 100.0).round() / 100.0));
+ }
+ }
+ for (id, _, ask, blocking) in DEFECTS {
+ if let Some(a) = answers.get(format!("defect_{id}")) {
+ let p = a["noul"].as_f64().unwrap_or(0.0);
+ defects.push(json!({"defect": id, "p": (p * 1000.0).round() / 1000.0, "present": p >= 0.5, "level": if blocking { "blocking" } else { "detail" }, "asked": ask}));
+ }
+ }
+ (scores, defects)
+}
+
+/// The loop's pass, in code: no blocking defect present, the lowest score 6 or more and the mean 7 or more (raea's
+/// 0-10 scale; the prompt pack's line). Scores mapped by a calibration first, when there is one.
+pub fn pass(scores: &serde_json::Map<String, Value>, defects: &[Value]) -> (bool, Vec<String>) {
+ let vals: Vec<f64> = scores.values().filter_map(Value::as_f64).collect();
+ let mut why = Vec::new();
+ let blocking = blocking(defects);
+ if !blocking.is_empty() {
+ why.push(format!("blocking: {}", blocking.join(", ")));
+ }
+ let min = vals.iter().cloned().fold(f64::INFINITY, f64::min);
+ let mean = if vals.is_empty() { 0.0 } else { vals.iter().sum::<f64>() / vals.len() as f64 };
+ if vals.len() < SCORES.len() {
+ why.push(format!("only {} of {} categories scored", vals.len(), SCORES.len()));
+ }
+ if min < 6.0 {
+ let low: Vec<String> = scores.iter().filter(|(_, v)| v.as_f64().is_some_and(|x| x < 6.0)).map(|(k, _)| k.clone()).collect();
+ why.push(format!("below a draft: {}", low.join(", ")));
+ }
+ if mean < 7.0 {
+ why.push("the whole is under a production base".into());
+ }
+ (why.is_empty(), why)
+}
+
+/// The blocking defects present, by name.
+pub fn blocking(defects: &[Value]) -> Vec<&str> {
+ defects.iter().filter(|d| d["present"] == true && d["level"] == "blocking").filter_map(|d| d["defect"].as_str()).collect()
+}
diff --git a/apps/judge/src/tests.rs b/apps/judge/src/tests.rs
new file mode 100644
index 00000000..c5615bd3
--- /dev/null
+++ b/apps/judge/src/tests.rs
@@ -0,0 +1,72 @@
+use super::*;
+use serde_json::json;
+
+fn scores(v: f64) -> serde_json::Map<String, Value> {
+ rubric::SCORES.iter().map(|s| (s.0.to_string(), json!(v))).collect()
+}
+
+#[test]
+fn the_pass_is_code_and_a_blocking_defect_holds_it() {
+ assert!(rubric::pass(&scores(7.5), &[]).0);
+ assert!(!rubric::pass(&scores(6.5), &[]).0, "mean under 7");
+ let mut s = scores(8.0);
+ s.insert("form".into(), json!(5.0));
+ let (ok, why) = rubric::pass(&s, &[]);
+ assert!(!ok && why.iter().any(|w| w.contains("form")));
+ let d = vec![json!({"defect": "floating", "present": true, "level": "blocking"})];
+ assert!(!rubric::pass(&scores(9.0), &d).0);
+ // the questions hold no pass line
+ let q = format!("{}{}", rubric::questions("colour"), rubric::questions("clay"));
+ assert!(!q.contains("mean") && !q.contains(">= 6"));
+}
+
+#[test]
+fn answers_are_read_and_rounds_say_done_and_stall() {
+ let a = json!({"score_form": {"score": 3.5}, "defect_floating": {"noul": 0.8}});
+ let (s, d) = rubric::read(&a);
+ assert_eq!(s["form"], 7.0);
+ assert_eq!(d[0]["present"], true);
+ let r = |p: bool, m: f64| json!({"pass": p, "mean": m, "defects": []});
+ assert_eq!(progress(&[r(false, 5.0), r(true, 7.2), r(true, 7.4)])["done"], true);
+ assert_eq!(progress(&[r(false, 5.0), r(false, 5.3), r(false, 5.6)])["stall"], true);
+ assert_eq!(progress(&[r(false, 4.0), r(false, 5.3), r(false, 6.1)])["stall"], false);
+}
+
+#[test]
+fn calibration_maps_a_lenient_judge_onto_the_eye() {
+ // the judge says 8 to everything the eye gives 5, and 9 to what the eye gives 8
+ let row = |j: f64, e: f64, p: bool| json!({"judge": scores(j), "eye": scores(e), "eye_pass": p, "defects": []});
+ let rows: Vec<Value> = (0..12).map(|i| if i % 2 == 0 { row(8.0, 5.0, false) } else { row(9.0, 8.0, true) }).collect();
+ let cal = eye::fit_rows(&rows);
+ assert_eq!(cal["agreement"], 1.0);
+ assert_eq!(cal["gate"], true);
+ assert!((cal["maps"]["form"]["a"].as_f64().unwrap() - 3.0).abs() < 1e-6);
+ let few = eye::fit_rows(&rows[..4]);
+ assert_eq!(few["gate"], false, "too few rounds to gate");
+ // an eye that failed everything agrees with a judge that fails everything, which proves nothing
+ let fails: Vec<Value> = (0..12).map(|_| row(3.0, 2.0, false)).collect();
+ let all_fail = eye::fit_rows(&fails);
+ assert_eq!(all_fail["agreement"], 1.0);
+ assert_eq!(all_fail["gate"], false, "no pass among the eye's rounds");
+}
+
+#[test]
+fn an_agent_verdict_is_read_from_the_end_of_its_thinking() {
+ // an agent thinks aloud, may draft the JSON twice, and ends with the one it means
+ let text = r#"• Looking at the sheets... draft: {"scores": {"form": 1}} then the answer:
+{"blind": {"place": "office", "objects": [], "photo": "no", "tells": []},
+ "scores": {"composition": 6, "form": 5.5, "assembly": 7, "materials": 4, "light": 6, "detail": 5, "world": 6, "vibes": 9},
+ "defects": [{"tile": "iso", "where": "left", "wrong": "the desks are plain boxes", "real": "a desk has legs", "fix": "model legs", "level": "blocking"},
+ {"tile": "low", "wrong": "", "level": "detail"}],
+ "show_as_is": "no"}"#;
+ let v = crate::agent::last_verdict(text).unwrap();
+ let (scores, defects, photo) = crate::agent::read(&v);
+ assert_eq!(scores.len(), 7, "only the seven categories, each 0-10");
+ assert_eq!(scores["form"], serde_json::json!(5.5));
+ assert_eq!(defects.len(), 1, "a defect with nothing wrong named is dropped");
+ assert_eq!(defects[0]["level"], "blocking");
+ assert_eq!(photo, serde_json::json!(0.0));
+ let (pass, why) = crate::rubric::pass(&scores, &defects);
+ assert!(!pass && why[0].starts_with("blocking"));
+ assert!(crate::agent::last_verdict("no json here").is_none());
+}
diff --git a/apps/media/src/frames.rs b/apps/media/src/frames.rs
index 80361fc6..8f13da3e 100644
--- a/apps/media/src/frames.rs
+++ b/apps/media/src/frames.rs
@@ -58,5 +58,5 @@ pub fn frames(out: &Path, size: (u32, u32), fps: f64, quality: Option<f32>, audi
None => None,
};
let stats = enc.finish(sound.as_ref())?;
- Ok(json!({"wrote": out, "frames": frames, "seconds": round3(secs), "width": w, "height": h, "fps": round3(fps), "bytes": stats.bytes, "sound": sound.is_some(), "credentials": if raea_io_media::SIGNS { "signed" } else { "unsigned" }}))
+ Ok(json!({"wrote": out, "frames": frames, "seconds": round3(secs), "width": w, "height": h, "fps": round3(fps), "bytes": stats.bytes, "sound": sound.is_some(), "credentials": if raea_io_media::signs() { "signed" } else { "unsigned" }}))
}
diff --git a/apps/solid/Cargo.toml b/apps/solid/Cargo.toml
new file mode 100644
index 00000000..7a46b16c
--- /dev/null
+++ b/apps/solid/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "raea-app-solid"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "raea solid info and raea solid view: a solid file run, its parts measured (raea-core-solidinfo), and its review sheets in colour and clay"
+
+[dependencies]
+raea-core-solidinfo = { path = "../../core/solidinfo" }
+serde_json = "1"
+# --set's and the CLI's flags, read as the bundler reads them
+raea-runtime-bundle = { path = "../../runtime/bundle" }
+# `raea judge`, dispatched with `raea solid` (verb())
+raea-app-judge = { path = "../judge" }
+# `raea solid export`: the solid built, written as .glb and read back (core/shape), named and coloured (core/meshcheck)
+raea-core-shape = { path = "../../core/shape" }
+raea-core-meshcheck = { path = "../../core/meshcheck" }
diff --git a/apps/solid/src/export.rs b/apps/solid/src/export.rs
new file mode 100644
index 00000000..1c887728
--- /dev/null
+++ b/apps/solid/src/export.rs
@@ -0,0 +1,128 @@
+//! `raea solid export FILE.ts -o OUT.glb [--set k=v,...] [--part NAME] [--colour #RRGGBB]` (docs/blender.feature BL1):
+//! a solid written as one .glb, metres, y up, so a Blender step can take it (bake.py for real UVs and baked maps, a
+//! cloth to fall on). The solid stays the source: the .glb is made again from it whenever it changes. An empty solid,
+//! or one solid info finds an error in, is refused with the findings. The file is read back and measured against the
+//! solid (volume, pieces, box, within 0.5%), and a licence sidecar is written beside it.
+
+use std::path::Path;
+
+use raea_core_shape::Manifold;
+use raea_core_solidinfo::{Measured, measure};
+use raea_runtime_bundle::flag;
+use serde_json::{Value, json};
+
+/// How far the read-back may differ, as a share of the solid's own value.
+const TOLERANCE: f64 = 0.005;
+
+/// `#RRGGBB` as linear RGBA.
+fn linear(hex: &str) -> Result<[f64; 4], String> {
+ let h = hex.trim_start_matches('#');
+ let c = |i: usize| u8::from_str_radix(h.get(i..i + 2).unwrap_or(""), 16).map_err(|_| format!("--colour takes #RRGGBB, got {hex:?}"));
+ let lin = |v: u8| {
+ let s = v as f64 / 255.0;
+ if s <= 0.04045 { s / 12.92 } else { ((s + 0.055) / 1.055).powf(2.4) }
+ };
+ if h.len() != 6 {
+ return Err(format!("--colour takes #RRGGBB, got {hex:?}"));
+ }
+ Ok([lin(c(0)?), lin(c(2)?), lin(c(4)?), 1.0])
+}
+
+/// The read-back's differences from the solid, each over the tolerance: none when they match.
+pub(crate) fn differences(a: &Measured, b: &Measured) -> Vec<String> {
+ let mut d = Vec::new();
+ let off = |x: f64, y: f64, of: f64| (x - y).abs() > TOLERANCE * of.abs().max(1e-9);
+ if off(a.volume, b.volume, a.volume) {
+ d.push(format!("volume {} m³ read back as {}", a.volume, b.volume));
+ }
+ if a.pieces != b.pieces {
+ d.push(format!("{} pieces read back as {}", a.pieces, b.pieces));
+ }
+ let span = (0..3).map(|k| a.max[k] - a.min[k]).fold(0.0, f64::max);
+ if (0..3).any(|k| off(a.min[k], b.min[k], span) || off(a.max[k], b.max[k], span)) {
+ d.push(format!("box {:?}..{:?} read back as {:?}..{:?}", a.min, a.max, b.min, b.max));
+ }
+ d
+}
+
+/// Solid info's findings at one level, as it prints them: all of them, or one part's alone.
+fn said(info: &Value, level: &str, part: Option<&str>) -> Vec<String> {
+ let mine = |f: &&Value| f["level"] == level && part.is_none_or(|p| f["part"].as_str() == Some(p));
+ info["found"].as_array().into_iter().flatten().filter(mine).map(|f| format!("{level:<8} {}", f["says"].as_str().unwrap_or(""))).collect()
+}
+
+pub fn export(file: &Path, parts: &[(String, String)], info: &Value, args: &[String]) -> Result<String, String> {
+ let out = flag(args, "-o").filter(|o| o.ends_with(".glb")).ok_or("raea solid export FILE.ts -o OUT.glb: give the .glb to write")?;
+ let part = flag(args, "--part");
+ let chosen: Vec<&(String, String)> = parts.iter().filter(|(n, _)| part.as_deref().is_none_or(|p| p == n)).collect();
+ if chosen.is_empty() {
+ return Err(format!("solid export: no part {} (the file's parts: {})", part.unwrap_or_default(), parts.iter().map(|p| p.0.as_str()).collect::<Vec<_>>().join(", ")));
+ }
+ // refused on solid info's errors: the whole's, or the part's alone when one is asked for
+ let errors = said(info, "error", part.as_deref());
+ if !errors.is_empty() {
+ return Err(format!("solid export: refused, solid info finds errors:\n{}", errors.join("\n")));
+ }
+ let solids = chosen.iter().map(|(_, e)| raea_core_shape::solid(e)).collect::<Result<Vec<Manifold>, String>>()?;
+ let m = solids.into_iter().reduce(|a, b| a.union(&b)).ok_or("solid export: no part to write")?;
+ let mine = measure(&m);
+ if mine.empty {
+ return Err("solid export: refused, the solid is empty".into());
+ }
+ if let Some(dir) = Path::new(&out).parent().filter(|d| !d.as_os_str().is_empty()) {
+ std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?;
+ }
+ raea_core_shape::export(&m, &out, "glb")?;
+ // its name, and a material when a colour is given (bake.py multiplies its AO into it)
+ let g = raea_core_meshcheck::Glb::read(&out)?;
+ let mut j = g.json.clone();
+ let name = part.clone().unwrap_or_else(|| file.file_stem().and_then(|s| s.to_str()).unwrap_or("solid").to_string());
+ j["nodes"][0]["name"] = json!(name);
+ j["meshes"][0]["name"] = json!(name);
+ j["asset"]["generator"] = json!("raea solid export");
+ if let Some(c) = flag(args, "--colour") {
+ j["materials"] = json!([{"name": name, "pbrMetallicRoughness": {"baseColorFactor": linear(&c)?, "metallicFactor": 0.0, "roughnessFactor": 0.8}}]);
+ j["meshes"][0]["primitives"][0]["material"] = json!(0);
+ }
+ std::fs::write(&out, g.with_json(&j)?).map_err(|e| format!("{out}: {e}"))?;
+ // read back: the file a scene and Blender will load, measured against the solid
+ let (v, t) = raea_core_shape::read_glb(&out)?;
+ let back = measure(&raea_core_shape::from_mesh(&v, &t)?);
+ let diff = differences(&mine, &back);
+ if !diff.is_empty() {
+ return Err(format!("solid export: {out} doesn't read back as the solid: {}", diff.join("; ")));
+ }
+ let side = json!({"source": format!("raea solid export {}{}", file.display(), part.as_ref().map(|p| format!(" --part {p}")).unwrap_or_default()), "license": "built in code for this project", "credit": ""});
+ std::fs::write(format!("{out}.json"), serde_json::to_string_pretty(&side).unwrap_or_default()).map_err(|e| e.to_string())?;
+ let r = |x: f64| (x * 1e5).round() / 1e5;
+ let mut t = vec![format!(
+ "APPLIED {out}: {} triangles, {} m³, {} x {} x {} m, {} piece(s); read back the same (within {}%); licence in {out}.json",
+ mine.tris, r(mine.volume), r(mine.max[0] - mine.min[0]), r(mine.max[1] - mine.min[1]), r(mine.max[2] - mine.min[2]), mine.pieces, TOLERANCE * 100.0
+ )];
+ t.extend(said(info, "warning", None));
+ Ok(t.join("\n"))
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn a_solid_reads_back_as_itself() {
+ let m = raea_core_shape::solid("minus(box(0.4, 0.3, 0.2), cylinder(0.05, 0.4))").unwrap();
+ let dir = std::env::temp_dir().join(format!("raea-solid-export-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let out = dir.join("x.glb");
+ raea_core_shape::export(&m, out.to_str().unwrap(), "glb").unwrap();
+ let (v, t) = raea_core_shape::read_glb(out.to_str().unwrap()).unwrap();
+ let back = raea_core_solidinfo::measure(&raea_core_shape::from_mesh(&v, &t).unwrap());
+ let mine = raea_core_solidinfo::measure(&m);
+ assert!(super::differences(&mine, &back).is_empty(), "{:?}", super::differences(&mine, &back));
+ // a mismatch is named
+ let mut off = raea_core_solidinfo::measure(&m);
+ off.volume *= 1.1;
+ off.pieces = 2;
+ assert_eq!(super::differences(&off, &back).len(), 2);
+ let _ = std::fs::remove_dir_all(&dir);
+ assert_eq!(super::linear("#ffffff").unwrap(), [1.0, 1.0, 1.0, 1.0]);
+ assert!(super::linear("red").is_err());
+ }
+}
diff --git a/apps/solid/src/lib.rs b/apps/solid/src/lib.rs
new file mode 100644
index 00000000..1c9f04cb
--- /dev/null
+++ b/apps/solid/src/lib.rs
@@ -0,0 +1,196 @@
+//! `raea solid info FILE.ts [--json] [--set k=v,...] [--expect E.json] [--walk]`: the file's solid measured
+//! (raea-core-solidinfo). FILE.ts exports `default`: a Solid, an object of named Solids (the parts), or a function
+//! of the params returning either; and optionally `params`, each a number, a boolean, or `[low, high, default]`. The
+//! file is run by `raea run` (a wrapper that prints each part's shape expression), then measured natively. --set
+//! builds it at other params and says what moved from the defaults; --walk moves each ranged param alone to each end
+//! and says which break it (more pieces, empty) and which reach no geometry. FILE.expect.json beside it is read when
+//! --expect isn't given. Errors exit 1, as scene lint. A part's `role` comes from the file's `roles` export ({body:
+//! "contain"}), its `at` from the line that names it. `raea solid view` takes its pictures (view.rs); `raea solid export`
+//! writes it as a .glb for a Blender step (export.rs). Its `needs` export ({textured: true}) asks for what solids can't
+//! give yet: real UVs and baked maps name bake.py (docs/blender.feature BL14).
+
+use std::path::{Path, PathBuf};
+
+use raea_runtime_bundle::flag;
+use serde_json::{Map, Value, json};
+
+mod export;
+mod view;
+
+pub const USAGE: &str = "raea solid info FILE.ts [--json] [--set k=v,...] [--expect E.json] [--walk] (volume, box, pieces, genus per part; joints; predictions and mutants)\n raea solid view FILE.ts -o DIR [--set k=v,...] [--json] (the solid's parts in colour and clay from fixed cameras)\n raea solid export FILE.ts -o OUT.glb [--set k=v,...] [--part NAME] [--colour #RRGGBB] (the solid as one .glb for a Blender step, read back and checked)";
+
+thread_local! {
+ /// the last run file's `roles` and `needs` exports
+ static META: std::cell::RefCell<Value> = const { std::cell::RefCell::new(Value::Null) };
+}
+
+/// The file run with these params: (the params it used, its spec, each part's expression).
+fn made(file: &Path, set: &Map<String, Value>) -> Result<(Value, Value, Vec<(String, String)>), String> {
+ let dir = std::env::temp_dir().join(format!("raea-solid-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?;
+ let w = dir.join("info.ts");
+ let src = format!(
+ r#"import {{ print }} from "raea/native";
+import * as m from {file:?};
+const spec: Record<string, unknown> = (m as any).params ?? {{}};
+const set: Record<string, unknown> = {set};
+const p: Record<string, unknown> = {{}};
+for (const [k, v] of Object.entries(spec)) p[k] = Array.isArray(v) ? v[2] : (v && typeof v === "object" && "default" in (v as any)) ? (v as any).default : v;
+for (const [k, v] of Object.entries(set)) {{ if (!(k in spec)) throw new Error(`--set ${{k}}: the file's params are ${{Object.keys(spec).join(", ") || "none"}}`); p[k] = v; }}
+const made = typeof (m as any).default === "function" ? (m as any).default(p) : (m as any).default;
+if (!made) throw new Error("the file exports no default solid");
+const parts = typeof made.expr === "string" ? {{ solid: made }} : made;
+const exprs: Record<string, string> = {{}};
+for (const [k, v] of Object.entries(parts)) {{ if (typeof (v as any)?.expr !== "string") throw new Error(`part ${{k}} is not a Solid`); exprs[k] = (v as any).expr; }}
+print("RAEA_SOLID_INFO " + JSON.stringify({{ params: p, spec, parts: exprs, roles: (m as any).roles ?? {{}}, needs: (m as any).needs ?? {{}} }}));
+"#,
+ file = file.display().to_string(),
+ set = Value::Object(set.clone()),
+ );
+ std::fs::write(&w, src).map_err(|e| e.to_string())?;
+ let exe = std::env::current_exe().map_err(|e| e.to_string())?;
+ let run = std::process::Command::new(exe).arg("run").arg(&w).current_dir(&dir).output().map_err(|e| e.to_string())?;
+ let _ = std::fs::remove_dir_all(&dir);
+ let out = String::from_utf8_lossy(&run.stdout).to_string();
+ let Some(line) = out.lines().find_map(|l| l.strip_prefix("RAEA_SOLID_INFO ")) else {
+ let err = format!("{}{out}", String::from_utf8_lossy(&run.stderr));
+ return Err(format!("solid info: {} didn't run: {}", file.display(), err.lines().rev().find(|l| !l.trim().is_empty()).unwrap_or("no output")));
+ };
+ let v: Value = serde_json::from_str(line).map_err(|e| e.to_string())?;
+ let parts: Vec<(String, String)> = serde_json::from_value::<std::collections::BTreeMap<String, String>>(v["parts"].clone()).unwrap_or_default().into_iter().collect();
+ META.with(|r| *r.borrow_mut() = json!({"roles": v["roles"], "needs": v["needs"]}));
+ Ok((v["params"].clone(), v["spec"].clone(), parts))
+}
+
+/// Textures asked of a solid: a solid's UVs are box projections, so real UVs and baked maps come from Blender (the
+/// solid exported, then bake.py), and the gap is one to build into solids.
+fn textured(out: &mut Value, file: &Path) {
+ let stem = file.file_stem().and_then(|s| s.to_str()).unwrap_or("solid");
+ let f = raea_core_meshcheck::blender::fix("bake.py", &format!("media/{stem}.glb media/{stem}-baked.glb --into-colour"));
+ let run = format!("raea solid export {} -o media/{stem}.glb --colour #RRGGBB && {}", file.display(), f["run"].as_str().unwrap_or(""));
+ let says = format!("its file asks for textures (needs.textured), and a solid's UVs are box projections: export it and bake real UVs and maps; fix: {run}");
+ if let Some(a) = out["found"].as_array_mut() {
+ a.push(json!({"check": "textures", "level": "warning", "says": says, "fix": {"blender": "bake.py", "run": run}}));
+ }
+ out["warnings"] = json!(out["warnings"].as_u64().unwrap_or(0) + 1);
+}
+
+fn parse_set(s: &str) -> Result<Map<String, Value>, String> {
+ let mut m = Map::new();
+ for kv in s.split(',').filter(|x| !x.trim().is_empty()) {
+ let (k, v) = kv.split_once('=').ok_or_else(|| format!("--set takes k=v,..., got {kv:?}"))?;
+ let v = v.trim();
+ let val = match v {
+ "true" => json!(true),
+ "false" => json!(false),
+ n => json!(n.parse::<f64>().map_err(|_| format!("--set {k}: a number, true or false, got {n:?}"))?),
+ };
+ m.insert(k.trim().to_string(), val);
+ }
+ Ok(m)
+}
+
+/// `raea solid ...` and `raea judge ...`, the scene loop's verbs (engine/cli hands them over), or None for another verb.
+pub fn verb(args: &[String]) -> Option<Result<String, String>> {
+ match args.first().map(String::as_str) {
+ Some("solid") => Some(cli(args)),
+ Some("judge") => Some(raea_app_judge::cli(args)),
+ _ => None,
+ }
+}
+
+pub fn cli(args: &[String]) -> Result<String, String> {
+ let (Some(verb @ ("info" | "view" | "export")), Some(file)) = (args.get(1).map(String::as_str), args.get(2)) else { return Err(USAGE.into()) };
+ let file = PathBuf::from(file).canonicalize().map_err(|e| format!("{file}: {e}"))?;
+ let json_out = args.iter().any(|a| a == "--json");
+ let set = flag(args, "--set").map(|s| parse_set(&s)).transpose()?.unwrap_or_default();
+ let expect_path = flag(args, "--expect").map(PathBuf::from).or_else(|| {
+ let p = file.with_extension("expect.json");
+ p.is_file().then_some(p)
+ });
+ let expect: Option<Value> = expect_path.as_ref().map(|p| std::fs::read_to_string(p).map_err(|e| format!("{}: {e}", p.display())).and_then(|t| serde_json::from_str(&t).map_err(|e| format!("{}: {e}", p.display())))).transpose()?;
+ let (params, spec, parts) = made(&file, &set)?;
+ let mut out = raea_core_solidinfo::info(&parts, expect.as_ref())?;
+ out["file"] = json!(file.display().to_string());
+ let src = std::fs::read_to_string(&file).unwrap_or_default();
+ let meta = META.with(|r| r.borrow().clone());
+ for p in out["parts"].as_array_mut().into_iter().flatten() {
+ let name = p["part"].as_str().unwrap_or("").to_string();
+ if let Some(role) = meta["roles"][&name].as_str() {
+ p["role"] = json!(role);
+ }
+ if let Some(line) = crate::view::at(&src, &name) {
+ p["at"] = json!({"file": file.display().to_string(), "line": line});
+ }
+ }
+ if meta["needs"]["textured"] == true {
+ textured(&mut out, &file);
+ }
+ if verb == "export" {
+ return export::export(&file, &parts, &out, args);
+ }
+ if verb == "view" {
+ let dir = crate::view::out_dir(args).ok_or("raea solid view FILE.ts -o DIR: give the folder for the sheets")?;
+ return crate::view::view(&file, &set, &out, &dir, json_out);
+ }
+ out["params"] = params;
+ if let Some(p) = &expect_path {
+ out["expect"]["file"] = json!(p.display().to_string());
+ }
+ if !set.is_empty() {
+ out["set"] = Value::Object(set.clone());
+ let (_, _, base) = made(&file, &Map::new())?;
+ let was = raea_core_solidinfo::info(&base, None)?;
+ let from = set.iter().map(|(k, v)| format!("{k}={v}")).collect::<Vec<_>>().join(",");
+ out["delta"] = raea_core_solidinfo::delta(&from, &was["solid"], &out["solid"]);
+ }
+ if args.iter().any(|a| a == "--walk") {
+ let base = if set.is_empty() { out["solid"].clone() } else { raea_core_solidinfo::info(&made(&file, &Map::new())?.2, None)?["solid"].clone() };
+ let mut walk = Vec::new();
+ for (k, v) in spec.as_object().into_iter().flatten() {
+ let ends: Vec<Value> = match v {
+ Value::Array(a) if a.len() >= 2 => vec![a[0].clone(), a[1].clone()],
+ Value::Bool(b) => vec![json!(!b)],
+ _ => continue,
+ };
+ for end in ends {
+ let mut one = Map::new();
+ one.insert(k.clone(), end.clone());
+ let row = match made(&file, &one).and_then(|(_, _, p)| raea_core_solidinfo::info(&p, None)) {
+ Ok(r) => {
+ let (verdict, says) = raea_core_solidinfo::walk_verdict(&base, &r["solid"]);
+ json!({"param": k, "value": end, "verdict": verdict, "says": says, "volume": r["solid"]["volume"], "size": r["solid"]["box"]["size"]})
+ }
+ Err(e) => json!({"param": k, "value": end, "verdict": "broken", "says": e}),
+ };
+ if row["verdict"] == "broken" {
+ let says = format!("{k} = {end}: {}", row["says"].as_str().unwrap_or("broken"));
+ out["found"].as_array_mut().unwrap().push(json!({"check": "walk", "level": "warning", "says": says}));
+ out["warnings"] = json!(out["warnings"].as_u64().unwrap_or(0) + 1);
+ }
+ walk.push(row);
+ }
+ }
+ out["walk"] = json!(walk);
+ }
+ let errors = out["errors"].as_u64().unwrap_or(0);
+ let text = if json_out {
+ serde_json::to_string_pretty(&out).unwrap_or_default()
+ } else {
+ let s = &out["solid"];
+ let mut t: Vec<String> = out["found"].as_array().into_iter().flatten().filter(|f| !matches!(f["level"].as_str(), Some("ok"))).map(|f| format!("{:<8} {}{}", f["level"].as_str().unwrap_or(""), f["part"].as_str().map(|p| format!("{p}: ")).unwrap_or_default(), f["says"].as_str().unwrap_or(""))).collect();
+ for p in out["parts"].as_array().into_iter().flatten() {
+ t.push(format!("part {}: {} m³, size {}, {} pieces, genus {}", p["part"].as_str().unwrap_or(""), p["volume"], p["box"]["size"], p["pieces"], p["genus"]));
+ }
+ for w in out["walk"].as_array().into_iter().flatten() {
+ t.push(format!("walk {} = {}: {}{}", w["param"].as_str().unwrap_or(""), w["value"], w["verdict"].as_str().unwrap_or(""), w["says"].as_str().map(|s| format!(" ({s})")).unwrap_or_default()));
+ }
+ t.push(format!("solid: {} m³, size {} m, {} pieces, genus {}, {} triangles; {errors} errors, {} warnings", s["volume"], s["box"]["size"], s["pieces"], s["genus"], s["tris"], out["warnings"]));
+ t.join("\n")
+ };
+ if errors > 0 {
+ println!("{text}");
+ std::process::exit(1);
+ }
+ Ok(text)
+}
diff --git a/apps/solid/src/view.rs b/apps/solid/src/view.rs
new file mode 100644
index 00000000..50ff3e24
--- /dev/null
+++ b/apps/solid/src/view.rs
@@ -0,0 +1,143 @@
+//! `raea solid view FILE.ts -o DIR [--set k=v,...]`: one solid's review sheets (research note agent-tool-surface.md's
+//! `solid view`). The file's parts are put in a small scene, each on its own clay-friendly colour, on a slab under
+//! a key and fill light, with a hero camera from the front-right corner, and `raea render --review` takes the fixed
+//! views of it in colour and clay. It prints a sidecar: the sheets, the solid's box, whether it is in more than one
+//! piece, and solid info's findings, so one call gives the numbers and the pictures. The judge reads the sheets only.
+
+use std::path::{Path, PathBuf};
+
+use serde_json::{Map, Value, json};
+
+const COLOURS: [&str; 8] = ["#c9b79c", "#8fa6b8", "#b48a78", "#9cb48a", "#b8a46a", "#a08cb4", "#7fb0a8", "#c4a0a0"];
+
+/// The scene the sheets are taken of: the file's parts (built with `set` over its params), a slab under them, lights
+/// and a camera from the box.
+fn scene(file: &Path, set: &Map<String, Value>, lo: [f64; 3], hi: [f64; 3]) -> String {
+ let c = [(lo[0] + hi[0]) / 2.0, (lo[1] + hi[1]) / 2.0, (lo[2] + hi[2]) / 2.0];
+ let r = (((hi[0] - lo[0]).powi(2) + (hi[1] - lo[1]).powi(2) + (hi[2] - lo[2]).powi(2)).sqrt() / 2.0).max(0.02);
+ let d = r / (20f64.to_radians().sin()) * 1.1;
+ let k = 1.0 / 3f64.sqrt();
+ let eye = [c[0] + d * k, c[1] + d * k * 0.7, c[2] + d * k];
+ let slab = ((hi[0] - lo[0]).max(hi[2] - lo[2]) * 0.8).max(0.05);
+ let thick = (r * 0.02).max(0.002);
+ format!(
+ r##"import {{ AbsoluteFill, Composition, registerRoot }} from "raea";
+import {{ Cuboid }} from "raea/3d";
+import {{ StandardMaterial }} from "raea/pbr";
+import {{ Mesh3d }} from "raea/mesh";
+import {{ AmbientLight, DirectionalLight }} from "raea/light";
+import {{ Transform }} from "raea/transform";
+import {{ Camera3d }} from "raea/camera";
+import * as m from {file:?};
+const spec: Record<string, unknown> = (m as any).params ?? {{}};
+const p: Record<string, unknown> = {{}};
+for (const [k, v] of Object.entries(spec)) p[k] = Array.isArray(v) ? v[2] : (v && typeof v === "object" && "default" in (v as any)) ? (v as any).default : v;
+Object.assign(p, {set});
+let parts: Record<string, any> | null = null;
+const get = () => {{
+ if (parts) return parts;
+ const made = typeof (m as any).default === "function" ? (m as any).default(p) : (m as any).default;
+ return (parts = typeof made?.expr === "string" ? {{ solid: made }} : made);
+}};
+const COLOURS = {colours:?};
+function View() {{
+ return (
+ <AbsoluteFill style={{{{ background: "#1c1c1e" }}}}>
+ <Camera3d transform={{Transform.fromXyz({ex}, {ey}, {ez}).lookingAt([{cx}, {cy}, {cz}])}} projection={{{{ Perspective: {{ fov: (40 * Math.PI) / 180 }} }}}} />
+ <AmbientLight brightness={{250}} />
+ <DirectionalLight transform={{Transform.fromXyz({lx}, {ly}, {lz}).lookingAt([{cx}, {cy}, {cz}])}} illuminance={{9000}} shadow_maps_enabled />
+ <Mesh3d transform={{Transform.fromXyz({cx}, {sy}, {cz})}}><Cuboid half_size={{[{slab}, {thick}, {slab}]}} /><StandardMaterial base_color="#55565a" perceptual_roughness={{0.9}} /></Mesh3d>
+ {{Object.entries(get()).map(([k, s], i) => (
+ <Mesh3d key={{k}} shape={{s}}><StandardMaterial base_color={{COLOURS[i % COLOURS.length]}} perceptual_roughness={{0.6}} /></Mesh3d>
+ ))}}
+ </AbsoluteFill>
+ );
+}}
+registerRoot(() => <Composition id="solid" component={{View}} width={{1280}} height={{960}} fps={{30}} durationInFrames={{1}} />);
+"##,
+ // relative, as the scene sits beside it: an absolute import is bundled with its raea imports left external
+ file = format!("./{}", file.file_stem().and_then(|s| s.to_str()).unwrap_or("solid")),
+ set = Value::Object(set.clone()),
+ colours = COLOURS,
+ ex = eye[0],
+ ey = eye[1],
+ ez = eye[2],
+ cx = c[0],
+ cy = c[1],
+ cz = c[2],
+ lx = c[0] + d * 0.6,
+ ly = c[1] + d,
+ lz = c[2] + d * 0.8,
+ sy = lo[1] - thick,
+ slab = slab,
+ thick = thick,
+ )
+}
+
+/// The sheets made and the sidecar said, from the file's solid info (`info`, its JSON).
+pub(crate) fn view(file: &Path, set: &Map<String, Value>, info: &Value, out: &Path, json_out: bool) -> Result<String, String> {
+ let b = &info["solid"]["box"];
+ let v3 = |k: &str| -> Result<[f64; 3], String> {
+ let a = b[k].as_array().filter(|a| a.len() == 3).ok_or("solid view: the solid is empty: nothing to look at")?;
+ Ok([a[0].as_f64().unwrap_or(0.0), a[1].as_f64().unwrap_or(0.0), a[2].as_f64().unwrap_or(0.0)])
+ };
+ let (lo, hi) = (v3("min")?, v3("max")?);
+ std::fs::create_dir_all(out).map_err(|e| format!("{}: {e}", out.display()))?;
+ // the scene sits beside the file, so its import resolves as the file's own do
+ let tsx = file.with_file_name(format!(".{}.view.tsx", file.file_stem().and_then(|s| s.to_str()).unwrap_or("solid")));
+ std::fs::write(&tsx, scene(file, set, lo, hi)).map_err(|e| format!("{}: {e}", tsx.display()))?;
+ let exe = std::env::current_exe().map_err(|e| e.to_string())?;
+ let run = std::process::Command::new(exe).arg("render").arg(&tsx).arg("--review").arg(out).current_dir(tsx.parent().unwrap_or(Path::new("."))).output().map_err(|e| e.to_string())?;
+ let said = format!("{}{}", String::from_utf8_lossy(&run.stdout), String::from_utf8_lossy(&run.stderr));
+ if !run.status.success() || !out.join("colour.png").is_file() {
+ // the scene is left for a look: what failed is in it or in the file
+ let why: Vec<&str> = said.lines().filter(|l| l.contains("Error") || l.contains("REFUSED") || l.contains("error")).take(3).collect();
+ return Err(format!("solid view: the review render of {} failed: {}", tsx.display(), if why.is_empty() { said.lines().rev().find(|l| !l.trim().is_empty()).unwrap_or("no output").to_string() } else { why.join(" | ") }));
+ }
+ let _ = std::fs::remove_file(&tsx);
+ let review: Value = serde_json::from_str(&std::fs::read_to_string(out.join("review.json")).unwrap_or_default()).unwrap_or(Value::Null);
+ let found: Vec<Value> = info["found"].as_array().into_iter().flatten().filter(|f| f["level"] != "ok").cloned().chain(review["found"].as_array().into_iter().flatten().cloned()).collect();
+ let side = json!({
+ "file": file.display().to_string(), "set": set, "sheets": {"colour": out.join("colour.png"), "clay": out.join("clay.png")},
+ "box": info["solid"]["box"], "disjoint": info["solid"]["pieces"].as_u64().unwrap_or(0) > 1,
+ "parts": info["parts"].as_array().into_iter().flatten().enumerate().map(|(i, p)| json!({"part": p["part"], "colour": COLOURS[i % COLOURS.len()]})).collect::<Vec<_>>(),
+ "tiles": review["tiles"], "errors": info["errors"], "found": found,
+ "caption": format!("{} Each part in its own colour on the colour sheet (parts[].colour).", review["caption"].as_str().unwrap_or("")),
+ });
+ std::fs::write(out.join("view.json"), serde_json::to_string_pretty(&side).unwrap_or_default()).map_err(|e| e.to_string())?;
+ if json_out {
+ return Ok(serde_json::to_string_pretty(&side).unwrap_or_default());
+ }
+ let mut t = vec![format!("APPLIED {} and {} (hero, front, right, top, iso, low), the sidecar in {}", out.join("colour.png").display(), out.join("clay.png").display(), out.join("view.json").display())];
+ t.push(format!("parts: {}", side["parts"].as_array().into_iter().flatten().map(|p| format!("{} {}", p["part"].as_str().unwrap_or(""), p["colour"].as_str().unwrap_or(""))).collect::<Vec<_>>().join(", ")));
+ for f in &found {
+ t.push(format!(" {}: {}", f["level"].as_str().unwrap_or(""), f["says"].as_str().unwrap_or("")));
+ }
+ Ok(t.join("\n"))
+}
+
+/// Where a part is named in the file: the first line that gives it as a key or a binding (`body:`, `const body =`).
+pub(crate) fn at(src: &str, part: &str) -> Option<usize> {
+ let word = |l: &str, i: usize| i == 0 || !l[..i].ends_with(|c: char| c.is_alphanumeric() || c == '_');
+ src.lines().position(|l| {
+ l.match_indices(part).any(|(i, _)| {
+ let rest = l[i + part.len()..].trim_start();
+ word(l, i) && (rest.starts_with(':') || (rest.starts_with('=') && !rest.starts_with("==")) || rest.starts_with(','))
+ })
+ }).map(|n| n + 1)
+}
+
+pub(crate) fn out_dir(args: &[String]) -> Option<PathBuf> {
+ args.iter().position(|a| a == "-o").and_then(|i| args.get(i + 1)).map(PathBuf::from)
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn a_part_is_found_where_it_is_named() {
+ let src = "import x from 'y';\nconst body = a();\nreturn { body, handle: h, handlebar: 2 };\n";
+ assert_eq!(super::at(src, "body"), Some(2));
+ assert_eq!(super::at(src, "handle"), Some(3));
+ assert_eq!(super::at(src, "spout"), None);
+ }
+}
diff --git a/apps/targets/src/native.rs b/apps/targets/src/native.rs
index 8f292365..e281464b 100644
--- a/apps/targets/src/native.rs
+++ b/apps/targets/src/native.rs
@@ -71,7 +71,7 @@ pub fn host(args: &[String]) -> Result<String, String> {
// the app's folder (relative media and fonts) and the CSS it imported (its @font-face rules), T3d
let sheet = script.with_extension("css");
std::fs::write(&sheet, css).map_err(|e| format!("{}: {e}", sheet.display()))?;
- let dir = p.canonicalize().ok().and_then(|c| c.parent().map(Path::to_path_buf)).unwrap_or_default();
+ let dir = p.canonicalize().ok().map(raea_io_home::plain).and_then(|c| c.parent().map(Path::to_path_buf)).unwrap_or_default();
extra.extend(["--base".to_string(), dir.display().to_string(), "--css".to_string(), sheet.display().to_string()]);
} else {
handed.push(a.clone());
diff --git a/apps/targets/src/web.rs b/apps/targets/src/web.rs
index 2c2d21ca..6d349d2d 100644
--- a/apps/targets/src/web.rs
+++ b/apps/targets/src/web.rs
@@ -22,7 +22,7 @@ pub struct Built {
/// `app` bundled into `dir` (made if missing): app.js and app.css (Tailwind's, for the classes the app's folder uses, after
/// any CSS the app imports)
pub fn build(app: &Path, dir: &Path) -> Result<Built, String> {
- let app = app.canonicalize().map_err(|e| format!("{}: {e}", app.display()))?;
+ let app = raea_io_home::plain(app.canonicalize().map_err(|e| format!("{}: {e}", app.display()))?);
std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?;
let (js, imported) = raea_runtime_bundle::inproc::app::bundle(&app, &raea_io_home::home())?;
let folder = app.parent().unwrap_or(Path::new("."));
diff --git a/apps/tools/Cargo.toml b/apps/tools/Cargo.toml
index 4214cadd..9b998b3b 100644
--- a/apps/tools/Cargo.toml
+++ b/apps/tools/Cargo.toml
@@ -6,10 +6,6 @@ license = "FSL-1.1-ALv2"
publish = false
description = "The `raea` verbs that run raea's model tools: sao, tokensynth, setup-audio, sounds, splat, song and gen"
-[features]
-# a made sound signed as generated (raea's own API; the public engine goes without)
-service = []
-
[dependencies]
raea-io-assets = { path = "../../io/assets" }
# generation flows: made.app, fal, Replicate, OpenRouter, Modal, ComfyUI (`raea gen`)
diff --git a/apps/tools/src/blender.rs b/apps/tools/src/blender.rs
index 3af96b14..361aa865 100644
--- a/apps/tools/src/blender.rs
+++ b/apps/tools/src/blender.rs
@@ -7,7 +7,7 @@ use std::process::Command;
type R<T> = Result<T, String>;
-pub const USAGE: &str = "raea setup blender [--check] [--download] (find Blender or download the LTS into ~/.raea/tools/blender, and install its MCP add-on)\n raea blender run SCRIPT.py [ARGS...] (blender --background --python SCRIPT.py -- ARGS, headless)";
+pub const USAGE: &str = "raea setup blender [--check] [--download] (find Blender or download the LTS into ~/.raea/tools/blender, and install its MCP add-on)\n raea blender run SCRIPT.py [ARGS...] (blender --background --python SCRIPT.py -- ARGS, headless; blender/X.py missing from the project is copied from the library: convert, decimate, repair, split, bake, rig, cloth)";
/// The LTS series raea downloads; the newest patch in blender.org/release/Blender<LTS>/ is taken. Moved when Blender
/// ships a new LTS (blender.org/download/lts).
@@ -189,6 +189,25 @@ pub fn setup(args: &[String]) -> R<String> {
Ok(format!("{head} {v} ({from})\n {}\n {add}\n headless: raea blender run SCRIPT.py; live: start Blender and the agent's `blender` MCP server connects (raea skills install adds it)", bin.display()))
}
+/// The library's scripts (sdk/guides/craft/bevy/blender: convert, decimate, repair, split, bake, rig, cloth): a fix
+/// names `blender/X.py`, and the first run copies the library's X.py into the project's blender/ folder, where it is
+/// kept with the project and edited for it (docs/blender.feature, Background). A script already there is never replaced.
+fn library(script: &str) -> R<()> {
+ let p = Path::new(script);
+ let (Some(name), Some(dir)) = (p.file_name(), p.parent()) else { return Ok(()) };
+ if p.exists() || dir.file_name().is_none_or(|d| d != "blender") {
+ return Ok(());
+ }
+ let from = raea_io_home::home().join("sdk/guides/craft/bevy/blender").join(name);
+ if !from.is_file() {
+ return Ok(());
+ }
+ std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?;
+ std::fs::copy(&from, p).map_err(|e| format!("{}: {e}", p.display()))?;
+ eprintln!("copied the library's {} into {} (it is the project's now: edit it there)", name.to_string_lossy(), dir.display());
+ Ok(())
+}
+
/// `raea blender run SCRIPT.py [ARGS...]`: the script in a windowless Blender, its args after `--` (sys.argv), its
/// output passed through. Exits as Blender's Python did: --python-exit-code makes an uncaught error fail the run.
pub fn blender(args: &[String]) -> R<String> {
@@ -196,6 +215,7 @@ pub fn blender(args: &[String]) -> R<String> {
return Err(format!("usage: {USAGE}"));
}
let script = args.get(2).ok_or_else(|| format!("which script: {USAGE}"))?;
+ library(script)?;
if !Path::new(script).is_file() {
return Err(format!("no script {script}"));
}
diff --git a/apps/tools/src/sound.rs b/apps/tools/src/sound.rs
index b2855da7..7cb2010d 100644
--- a/apps/tools/src/sound.rs
+++ b/apps/tools/src/sound.rs
@@ -121,6 +121,8 @@ fn deliver(from: &Path, to: &Path) -> R<()> {
std::fs::create_dir_all(d).map_err(|e| format!("{}: {e}", d.display()))?;
}
std::fs::copy(from, to).map_err(|e| format!("{}: {e}", to.display()))?;
+ // signed as generated, when this program signs (raea_io_media::sign)
+ raea_io_media::sign::sign_file(to, raea_io_media::sign::Made::Generated);
Ok(())
}
diff --git a/bench/bevy-parity/Cargo.toml b/bench/bevy-parity/Cargo.toml
index c2420954..ed26f290 100644
--- a/bench/bevy-parity/Cargo.toml
+++ b/bench/bevy-parity/Cargo.toml
@@ -10,7 +10,7 @@ description = "Bevy's own examples, built against raea's Bevy with the parity pr
# the feature list engine/render's bevy has (its bevy-all: dfg_lut and bluenoise_texture too, which stock Bevy's defaults
# leave out; without the DFG table rough surfaces at grazing angles take less ambient, many_cubes' box srgb 64 for 88), so the
# examples build against the Bevy raea already compiled, and winit: the examples open a window (raea's renders don't), and bevy_scene: Bevy 0.20's examples write their scenes in BSN
-bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "default_font", "multi_threaded", "3d_bevy_render", "ui_bevy_render", "png", "jpeg", "tonemapping_luts", "ktx2", "zstd_rust", "smaa_luts", "experimental_pbr_pcss", "area_light_luts", "dfg_lut", "bluenoise_texture", "bevy_gilrs", "bevy_winit", "bevy_scene", "bevy_camera_controller", "free_camera", "pan_camera", "pan_orbit_camera", "bevy_gizmos", "bevy_gizmos_render", "bevy_state", "picking", "mesh_picking", "sprite_picking", "ui_picking", "hdr", "exr", "webp", "bevy_dev_tools", "bevy_ui_widgets", "bevy_feathers", "bevy_audio", "vorbis", "wav", "mp3", "morph_animation", "bevy_input_focus", "custom_cursor", "serialize", "reflect_functions"] }
+bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "default_font", "multi_threaded", "3d_bevy_render", "ui_bevy_render", "png", "jpeg", "tonemapping_luts", "ktx2", "zstd_rust", "smaa_luts", "experimental_pbr_pcss", "area_light_luts", "dfg_lut", "bluenoise_texture", "bevy_gilrs", "bevy_winit", "bevy_scene", "bevy_camera_controller", "free_camera", "pan_camera", "pan_orbit_camera", "bevy_gizmos", "bevy_gizmos_render", "bevy_state", "picking", "mesh_picking", "sprite_picking", "ui_picking", "hdr", "exr", "webp", "bevy_dev_tools", "bevy_ui_widgets", "bevy_feathers", "bevy_audio", "vorbis", "wav", "mp3", "morph_animation", "bevy_input_focus", "custom_cursor", "serialize", "reflect_functions", "pbr_multi_layer_material_textures"] }
raea-sys-parity = { path = "../../systems/parity" }
# Bevy's examples' own dependencies (bevy v0.20.0's dev-dependencies)
argh = "0.1.12"
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.list
index d8c8fb84..5e683915 100644
--- a/bench/bevy-parity/examples.list
+++ b/bench/bevy-parity/examples.list
@@ -30,3 +30,29 @@ camera/projection_zoom
3d/spherical_area_lights
3d/fog_volumes
3d/bloom_3d
+transforms/transform
+3d/transparency_3d
+animation/eased_motion
+animation/color_animation
+3d/rect_light
+3d/shadow_caster_receiver
+3d/spotlight
+transforms/align
+3d/3d_viewport_to_world
+3d/atmospheric_fog
+2d/rotate_to_cursor
+movement/smooth_follow
+3d/mesh_ray_cast
+3d/rotate_environment_map
+2d/mesh2d_alpha_mode
+2d/mesh2d_vertex_color_texture
+3d/lightmaps
+ui/styling/transparency_ui
+ui/layout/fixed_node
+ui/images/image_node
+ui/text/font_weights
+ui/text/font_variations
+ui/text/text_background_colors
+ui/text/strikethrough_and_underline
+ui/scroll_and_overflow/overflow
+ui/images/ui_texture_atlas
diff --git a/bench/bevy-parity/lib/rand.test.ts b/bench/bevy-parity/lib/rand.test.ts
new file mode 100644
index 00000000..736aee58
--- /dev/null
+++ b/bench/bevy-parity/lib/rand.test.ts
@@ -0,0 +1,21 @@
+// lib/rand.ts against chacha20 0.10.2 and rand 0.10.3's own output (a scratch crate printing ChaCha8Rng::seed_from_u64(
+// 19878367467713), spotlight.rs's seed: its first words, the words after the first refill of its 64-word buffer, and
+// random_range(-5.0..5.0) as f32 bits).
+import { expect, test } from "bun:test";
+import { ChaCha8Rng } from "./rand";
+
+const bits = (x: number) => new Uint32Array(new Float32Array([x]).buffer)[0]!.toString(16).padStart(8, "0");
+
+test("ChaCha8Rng's words and random_range are the crates' own", () => {
+ const r = ChaCha8Rng.seed_from_u64(19878367467713n);
+ const w = Array.from({ length: 70 }, () => r.next_u32());
+ expect(w.slice(0, 4)).toEqual([2045446710, 148267730, 2984187155, 4078822190]);
+ expect(w.slice(64, 70)).toEqual([3322331382, 1283986520, 4195170605, 2259972292, 328924921, 2056473586]);
+ const g = ChaCha8Rng.seed_from_u64(19878367467713n);
+ expect(Array.from({ length: 6 }, () => bits(g.random_range(-5, 5)))).toEqual(["be734680", "c094f406", "3ff95b64", "408fe55a", "c0396a22", "bf7365c0"]);
+});
+
+test("random_dir3 is bevy_math's random::<Dir3>() (align.rs's seed)", () => {
+ const r = ChaCha8Rng.seed_from_u64(19878367467712n);
+ expect([r.random_dir3().map(bits), r.random_dir3().map(bits)]).toEqual([["be848688", "3e9c2559", "3f6aa088"], ["bf2dc30a", "beef6b4a", "bf10f4e8"]]);
+});
diff --git a/bench/bevy-parity/lib/rand.ts b/bench/bevy-parity/lib/rand.ts
new file mode 100644
index 00000000..b9558f2e
--- /dev/null
+++ b/bench/bevy-parity/lib/rand.ts
@@ -0,0 +1,76 @@
+// The random numbers Bevy's examples draw (30 of them seed a ChaCha8Rng): chacha20 0.10's ChaCha8Rng, seeded by
+// rand_core 0.10's seed_from_u64 (PCG32 filling the 32-byte key), and rand 0.10's random_range over an f32 range (23
+// random bits as a float in [1, 2), less 1, times the span, plus the low end, in f32). Checked against the crates'
+// own output (bench/bevy-parity/lib/rand.test.ts).
+
+const M64 = (1n << 64n) - 1n;
+
+/** rand_core's seed_from_u64: eight PCG32 outputs, the key's words */
+function seedWords(seed: bigint): number[] {
+ let state = seed & M64;
+ const words: number[] = [];
+ for (let i = 0; i < 8; i++) {
+ state = (state * 0x5851f42d4c957f2dn + 0xa17654e46fbe17f3n) & M64;
+ const xorshifted = Number((((state >> 18n) ^ state) >> 27n) & 0xffffffffn);
+ const rot = Number(state >> 59n);
+ words.push(((xorshifted >>> rot) | (xorshifted << ((32 - rot) & 31))) >>> 0);
+ }
+ return words;
+}
+
+const rotl = (x: number, n: number) => ((x << n) | (x >>> (32 - n))) >>> 0;
+
+/** chacha20's ChaCha8Rng: the key from the seed, a 64-bit block counter, stream 0, four blocks buffered at a time */
+export class ChaCha8Rng {
+ private state: number[];
+ private buf: number[] = [];
+ private at = 64;
+ private constructor(key: number[]) {
+ this.state = [0x61707865, 0x3320646e, 0x79622d32, 0x6b206574, ...key, 0, 0, 0, 0];
+ }
+ static seed_from_u64(seed: number | bigint): ChaCha8Rng {
+ return new ChaCha8Rng(seedWords(BigInt(seed)));
+ }
+ private block(): number[] {
+ const x = this.state.slice();
+ const qr = (a: number, b: number, c: number, d: number) => {
+ x[a] = (x[a]! + x[b]!) >>> 0; x[d] = rotl(x[d]! ^ x[a]!, 16);
+ x[c] = (x[c]! + x[d]!) >>> 0; x[b] = rotl(x[b]! ^ x[c]!, 12);
+ x[a] = (x[a]! + x[b]!) >>> 0; x[d] = rotl(x[d]! ^ x[a]!, 8);
+ x[c] = (x[c]! + x[d]!) >>> 0; x[b] = rotl(x[b]! ^ x[c]!, 7);
+ };
+ for (let i = 0; i < 4; i++) {
+ qr(0, 4, 8, 12); qr(1, 5, 9, 13); qr(2, 6, 10, 14); qr(3, 7, 11, 15);
+ qr(0, 5, 10, 15); qr(1, 6, 11, 12); qr(2, 7, 8, 13); qr(3, 4, 9, 14);
+ }
+ const out = x.map((v, i) => (v + this.state[i]!) >>> 0);
+ // the 64-bit block counter, words 12 and 13
+ this.state[12] = (this.state[12]! + 1) >>> 0;
+ if (this.state[12] === 0) this.state[13] = (this.state[13]! + 1) >>> 0;
+ return out;
+ }
+ next_u32(): number {
+ if (this.at >= 64) {
+ this.buf = [...this.block(), ...this.block(), ...this.block(), ...this.block()];
+ this.at = 0;
+ }
+ return this.buf[this.at++]!;
+ }
+ /** rand's random_range(low..high) for f32 */
+ random_range(low: number, high: number): number {
+ const f = Math.fround;
+ const bits = (this.next_u32() >>> 9) | 0x3f800000;
+ const v = new Float32Array(new Uint32Array([bits]).buffer)[0]!;
+ return f(f(f(v - 1) * f(high - low)) + low);
+ }
+ /** bevy_math's random::<Dir3>() (sample_unit_sphere_boundary): z in [-1, 1], an angle in [-PI, PI] (rand's inclusive
+ * range is the same draw as the half-open one) */
+ random_dir3(): [number, number, number] {
+ const f = Math.fround;
+ const pi = f(Math.PI);
+ const z = this.random_range(-1, 1);
+ const a = this.random_range(-pi, pi);
+ const c = f(Math.sqrt(f(1 - f(z * z))));
+ return [f(f(Math.sin(a)) * c), f(f(Math.cos(a)) * c), z];
+ }
+}
diff --git a/bench/bevy-parity/lib/smooth_follow.test.ts b/bench/bevy-parity/lib/smooth_follow.test.ts
new file mode 100644
index 00000000..cb8741b9
--- /dev/null
+++ b/bench/bevy-parity/lib/smooth_follow.test.ts
@@ -0,0 +1,19 @@
+// lib/smooth_follow.ts against bevy_math 0.20's own run of smooth_follow.rs's systems (a scratch crate on bevy_math,
+// rand 0.10.3 and chacha20 0.10.2): target, follower and the point it heads for, as f32 bits, at the frames probed.
+import { expect, test } from "bun:test";
+import { smoothFollow } from "./smooth_follow";
+
+const bits = (x: number) => new Uint32Array(new Float32Array([x]).buffer)[0]!.toString(16).padStart(8, "0");
+const TRUTH: Record<number, string> = {
+ 1: "3d52f770 bd155d9a bd5eea76 3add526d bff7c2a6 bae9db9a 3fe0971c bf9f02e4 bfed4fac",
+ 10: "3f03daa6 bebab4ff bf0b5289 3dacaa0c bfbf128a bdb671af 3fe0971c bf9f02e4 bfed4fac",
+ 30: "3fc5c7fb bf8c07c1 bfd0fbd0 3f15a9de bf93288f bf1e23fe 3fe0971c bf9f02e4 bfed4fac",
+ 60: "3e238854 be540699 bf9deedd 3f4e07ea bf5eefa2 bf98e54a bfda49d4 3f807360 bf0237b0",
+ 90: "bfda49d4 3f807360 bf0237b0 beb3c37b 3d0ca65c bf6db132 bff66ebc 3fe101ec bf700c38",
+ 120: "bf55f53e 3f3ed6e3 bf90ffa1 bf86169e 3f4f3053 bf74ccb4 be807650 3e4ed200 bf9e67e8",
+ 180: "be967d1e 3f35c1b6 bc528d20 be611fd8 3f01e743 3d52d8c0 bfa6ca70 3f520018 bfc64714",
+};
+
+test("smoothFollow is bevy_math's run, bit for bit", () => {
+ for (const [frame, want] of Object.entries(TRUTH)) expect(`${frame} ${smoothFollow(Number(frame)).flat().map(bits).join(" ")}`).toBe(`${frame} ${want}`);
+});
diff --git a/bench/bevy-parity/lib/smooth_follow.ts b/bench/bevy-parity/lib/smooth_follow.ts
new file mode 100644
index 00000000..08fdc611
--- /dev/null
+++ b/bench/bevy-parity/lib/smooth_follow.ts
@@ -0,0 +1,37 @@
+// examples/movement/smooth_follow.rs's two systems in f32, on the harness's clock (an update a frame, none of it on the
+// first): move_target walks the blue sphere at 5 m/s to a point Cuboid(4 m).sample_interior draws from the example's
+// ChaCha8Rng (seed 68941654987813521), drawing the next once it's there (Dir3::new fails on a zero vector), and
+// move_follower smooth_nudges the red one towards it at decay rate 2 (bevy_math's VectorSpace::lerp, self * (1 - t) +
+// rhs * t). Checked against bevy_math's own run (lib/smooth_follow.test.ts).
+import { ChaCha8Rng } from "./rand";
+
+export type V3 = [number, number, number];
+const f = Math.fround;
+const sub = (a: V3, b: V3): V3 => [f(a[0] - b[0]), f(a[1] - b[1]), f(a[2] - b[2])];
+/** glam's Vec3::length: sqrt of the dot, summed x, y, z in order */
+const length = (v: V3) => f(Math.sqrt(f(f(f(v[0] * v[0]) + f(v[1] * v[1])) + f(v[2] * v[2]))));
+
+/** the spheres after the updates up to frame `frame`: [target, follower, the point it's heading for] */
+export function smoothFollow(frame: number): [V3, V3, V3] {
+ const rng = ChaCha8Rng.seed_from_u64(68941654987813521n);
+ const dtFull = f(16_666_667e-9);
+ let target: V3 = [0, 0, 0];
+ let pos: V3 = [0, 0, 0];
+ let follow: V3 = [0, -2, 0];
+ for (let k = 0; k <= frame; k++) {
+ const dt = k === 0 ? 0 : dtFull;
+ const d = sub(pos, target);
+ const len = length(d);
+ if (Number.isFinite(len) && len > 0) {
+ const dir: V3 = [f(d[0] / len), f(d[1] / len), f(d[2] / len)];
+ const m = Math.min(len, f(dt * 5));
+ target = [f(target[0] + f(dir[0] * m)), f(target[1] + f(dir[1] * m)), f(target[2] + f(dir[2] * m))];
+ } else {
+ pos = [rng.random_range(-2, 2), rng.random_range(-2, 2), rng.random_range(-2, 2)];
+ }
+ const t = f(1 - f(Math.exp(f(-2 * dt))));
+ const keep = f(1 - t);
+ follow = [0, 1, 2].map((i) => f(f(follow[i]! * keep) + f(target[i]! * t))) as V3;
+ }
+ return [target, follow, pos];
+}
diff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsv
index b7270178..42198921 100644
--- a/bench/bevy-parity/runs.tsv
+++ b/bench/bevy-parity/runs.tsv
@@ -29,3 +29,29 @@ camera/projection_zoom - 30
3d/spherical_area_lights - 10
3d/fog_volumes - 10,60
3d/bloom_3d - 10,60
+transforms/transform - 10,120
+3d/transparency_3d - 10,90
+animation/eased_motion - 60,150,240
+animation/color_animation - 30,120,200
+3d/rect_light - 10
+3d/shadow_caster_receiver - 10
+3d/spotlight - 10,90
+transforms/align - 10,30
+3d/3d_viewport_to_world - 5,10
+3d/atmospheric_fog - 5,10
+2d/rotate_to_cursor - 5,10
+movement/smooth_follow - 30,120
+3d/mesh_ray_cast - 300,900
+# 3d/rotate_environment_map - 5,60 (out until raea renders its clearcoat normal map by default: raea-sys-material's multi-layer feature, off as Bevy's three clearcoat samplers pass Metal's 16 for <Material> and froxel glass; with it on, it passes at 0.9993)
+2d/mesh2d_alpha_mode - 5,10
+3d/lightmaps - 5,10
+ui/styling/transparency_ui - 5,10
+ui/layout/fixed_node - 5,10
+ui/images/image_node - 5,10
+ui/text/font_weights - 5,10
+ui/text/font_variations - 5,10
+ui/text/text_background_colors - 5,10
+ui/text/strikethrough_and_underline - 5,10
+ui/scroll_and_overflow/overflow - 5,10
+ui/images/ui_texture_atlas - 5,10
+2d/mesh2d_vertex_color_texture - 10
diff --git a/bench/bridge/examples/plain_page.rs b/bench/bridge/examples/plain_page.rs
index d22500bc..cfa5a323 100644
--- a/bench/bridge/examples/plain_page.rs
+++ b/bench/bridge/examples/plain_page.rs
@@ -2,7 +2,7 @@
//! any headless Bevy program sets them, then raea in one RaeaPlugin: raea's plugins (RaeaPlugins, Scene3dPlugin), React
//! (ReactPlugin, running the bundle in this App's World), ScenePlugin, which turns React's <Canvas3D> tree into the
//! scene's rows, and raea-page's PagePlugin and WorldPagePlugin, which draw its HTML layer on Blitz over the scene's
-//! camera. No Engine and no second App: the App is the founder's own. --scene-only leaves the page out (the 3D alone). The
+//! camera. No Engine and no second App: the App is the user's own. --scene-only leaves the page out (the 3D alone). The
//! frame is saved as a PNG, to compare with raea's own render on the Blitz page (RAEA_PAGE=blitz).
//!
//! --window draws into a window in place of an image (S6a's window target): a winit window made here, never shown and
diff --git a/bench/lightspeed/all.sh b/bench/lightspeed/all.sh
new file mode 100755
index 00000000..75726a9c
--- /dev/null
+++ b/bench/lightspeed/all.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Every lightspeed harness in turn (docs/lightspeed.feature), each timing step in its own turn at the shared lock on a
+# quiet machine (bench/lightspeed/lib.sh), then the scoreboard. The iPhone rows need the phone unlocked; they're
+# skipped with a note when it isn't.
+# bench/lightspeed/all.sh [quick] quick: 30 s game runs and 2 repeats instead of 60 s and 3
+# Build first: raea (sdk/react/) and void (apps/legacy/shell/), release.
+cd "$(dirname "$0")"
+secs=60; runs=3
+[ "${1:-}" = quick ] && { secs=30; runs=2; }
+status=0
+bash startup.sh --runs $((runs + 2)) || status=1
+bash feel.sh --seconds $secs || status=1
+bash jsheap.sh pong pong-stepfold pong-view --seconds 12 --runs $runs || status=1
+bash export.sh --runs $runs || status=1
+bash quality.sh || status=1
+bash gpumem.sh || status=1
+bash energy.sh --seconds 30 || status=1
+bash ../scoreboard.sh
+exit $status
diff --git a/bench/lightspeed/animate-twin/edit.tsx b/bench/lightspeed/animate-twin/edit.tsx
new file mode 100644
index 00000000..d4cc82fe
--- /dev/null
+++ b/bench/lightspeed/animate-twin/edit.tsx
@@ -0,0 +1,87 @@
+// The ANIMATE fixture's twin, written the way agents write today: interpolate and spring per frame, the same timings.
+import { AbsoluteFill, Composition, Easing, Sequence, interpolate, registerRoot, spring, useCurrentFrame, useVideoConfig } from "raea";
+const INK = "#14121f", PAPER = "#fbf7ef", ACCENT = "#ff5a7a";
+const OUT = Easing.out(Easing.cubic), IN = Easing.in(Easing.cubic);
+const c = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;
+const GROUPS: { from: number; words: [string, number, number][] }[] = [
+ { from: 0, words: [["Your", 0, 8], ["afternoon", 8, 22], ["slump", 22, 40]] },
+ { from: 44, words: [["has", 0, 6], ["a", 6, 10], ["new", 10, 20]] },
+ { from: 70, words: [["enemy.", 0, 30]] },
+ { from: 110, words: [["Steeped", 0, 14], ["twenty", 14, 26], ["hours,", 26, 46]] },
+ { from: 160, words: [["smooth,", 0, 18], ["never", 18, 28], ["bitter.", 28, 52]] },
+ { from: 220, words: [["Twelve", 0, 12], ["grams", 12, 22], ["protein,", 22, 44]] },
+ { from: 270, words: [["zero", 0, 12], ["added", 12, 22], ["sugar.", 22, 48]] },
+ { from: 330, words: [["Crack", 0, 12], ["one", 12, 18], ["open.", 18, 44]] },
+ { from: 390, words: [["Finish", 0, 14], ["the", 14, 18], ["list.", 18, 46]] },
+ { from: 450, words: [["First", 0, 12], ["case", 12, 22], ["half", 22, 30]] },
+ { from: 486, words: [["off.", 0, 40]] },
+];
+function Caption({ words, length }: { words: [string, number, number][]; length: number }) {
+ const f = useCurrentFrame();
+ const s = interpolate(f, [0, 4, 8], [0.92, 1.03, 1], { ...c, easing: OUT });
+ const o = Math.min(interpolate(f, [0, 3], [0, 1], { ...c, easing: OUT }), interpolate(f, [length - 6, length], [1, 0], { ...c, easing: IN }));
+ return (
+ <AbsoluteFill style={{ justifyContent: "flex-end", alignItems: "center", paddingBottom: 220 }}>
+ <div style={{ display: "flex", opacity: o, transform: `scale(${s})`, backgroundColor: PAPER, borderRadius: 32, padding: "18px 28px", fontFamily: "Helvetica", fontWeight: 900, fontSize: 64, color: INK }}>
+ {words.map(([w, a, b], i) => {
+ const k = interpolate(f, [a, a + 3, b, b + 3], [0, 1, 1, 0], { ...c, easing: OUT });
+ return <span key={i} style={{ padding: "2px 12px", margin: "0 2px", borderRadius: 999, backgroundColor: `rgba(255, 90, 122, ${k})` }}>{w}</span>;
+ })}
+ </div>
+ </AbsoluteFill>
+ );
+}
+const chip = { display: "inline-flex", alignItems: "center", gap: 14, backgroundColor: INK, color: PAPER, borderRadius: 999, padding: "12px 30px 12px 14px", fontFamily: "Helvetica", fontWeight: 900, fontSize: 48, marginBottom: 14 } as const;
+const num = { minWidth: 120, textAlign: "center", backgroundColor: ACCENT, color: INK, borderRadius: 999, padding: "4px 18px" } as const;
+function Badge({ i, children }: { i: number; children: React.ReactNode }) {
+ const f = useCurrentFrame();
+ const at = 110 + i * 24, ex = 430 + i * 2;
+ const x = interpolate(f, [at, at + 8], [-64, 0], { ...c, easing: OUT }) + interpolate(f, [ex, ex + 8], [0, -64], { ...c, easing: IN });
+ const o = Math.min(interpolate(f, [at, at + 5], [0, 1], { ...c, easing: OUT }), interpolate(f, [ex + 3, ex + 8], [1, 0], { ...c, easing: IN }));
+ return <div style={{ opacity: o, transform: `translateX(${x}px)` }}>{children}</div>;
+}
+function Badges() {
+ const f = useCurrentFrame();
+ const n = Math.round(interpolate(f, [124, 154], [0, 20], { ...c, easing: OUT }));
+ return (
+ <div style={{ position: "absolute", left: 56, top: 120, display: "flex", flexDirection: "column", alignItems: "flex-start" }}>
+ <Badge i={0}><div style={chip}><span style={num}>{n}</span> HRS STEEPED</div></Badge>
+ <Badge i={1}><div style={chip}><span style={num}>12</span> G PROTEIN</div></Badge>
+ <Badge i={2}><div style={chip}><span style={num}>0</span> G SUGAR</div></Badge>
+ </div>
+ );
+}
+function Card() {
+ const f = useCurrentFrame();
+ const { fps } = useVideoConfig();
+ const y = interpolate(f, [0, 10], [80, 0], { ...c, easing: OUT });
+ const s = spring({ frame: f, fps, from: 0.86, to: 1, durationInFrames: 18, config: { damping: 15, stiffness: 120 } });
+ const t = interpolate(f, [18, 22, 26], [0.6, 1.08, 1], { ...c, easing: OUT });
+ const fillW = interpolate(f, [20, 50], [0, 100], { ...c, easing: OUT });
+ const wipe = interpolate(f, [18, 30], [100, 0], { ...c, easing: Easing.inOut(Easing.cubic) });
+ const cta = interpolate(f, [24, 30], [0, 1], { ...c, easing: OUT });
+ return (
+ <AbsoluteFill style={{ alignItems: "center", justifyContent: "center", paddingBottom: 200 }}>
+ <div style={{ opacity: interpolate(f, [0, 5], [0, 1], { ...c, easing: OUT }), transform: `translateY(${y}px) scale(${s})`, width: 860, backgroundColor: PAPER, borderRadius: 44, padding: 52, display: "flex", flexDirection: "column", gap: 26 }}>
+ <div style={{ opacity: interpolate(f, [18, 21], [0, 1], c), transform: `scale(${t})`, fontFamily: "Helvetica", fontWeight: 900, fontSize: 96, color: INK, lineHeight: 1 }}>First case half off</div>
+ <div style={{ height: 26, borderRadius: 13, backgroundColor: "#e9e2d6", overflow: "hidden" }}><div style={{ width: `${fillW}%`, height: 26, borderRadius: 13, backgroundColor: ACCENT }} /></div>
+ <div style={{ height: 8, backgroundColor: INK, clipPath: `inset(0% ${wipe}% 0% 0%)` }} />
+ <div style={{ opacity: cta, fontFamily: "Helvetica", fontSize: 44, color: INK }}>brightside.coffee</div>
+ </div>
+ </AbsoluteFill>
+ );
+}
+export default function Edit() {
+ return (
+ <AbsoluteFill style={{ backgroundColor: "#3b2f5c" }}>
+ <AbsoluteFill style={{ background: "linear-gradient(160deg, #3b2f5c, #1d1730)" }} />
+ <Badges />
+ <Sequence from={450} durationInFrames={150} name="card"><Card /></Sequence>
+ {GROUPS.map((g, i) => {
+ const length = (GROUPS[i + 1]?.from ?? 600) - g.from;
+ return <Sequence key={i} from={g.from} durationInFrames={length}><Caption words={g.words} length={length} /></Sequence>;
+ })}
+ </AbsoluteFill>
+ );
+}
+registerRoot(() => <Composition id="twin" component={Edit} width={1080} height={1920} fps={30} durationInFrames={600} />);
diff --git a/bench/lightspeed/colour/edit.tsx b/bench/lightspeed/colour/edit.tsx
new file mode 100644
index 00000000..64adbaad
--- /dev/null
+++ b/bench/lightspeed/colour/edit.tsx
@@ -0,0 +1,29 @@
+// COLOUR: flat patches of known sRGB values, the colour-accuracy fixture of lightspeed's Q3
+// (bench/lightspeed/export.sh): primaries and secondaries at full and half strength, a grey ramp, skin tones and the
+// near-black and near-white steps where range and matrix mistakes show first. Rendered, encoded and decoded back, each
+// patch's centre must come back as the value it was painted with.
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+
+export const PATCHES = [
+ "#ff0000", "#00ff00", "#0000ff", "#00ffff", "#ff00ff", "#ffff00",
+ "#800000", "#008000", "#000080", "#008080", "#800080", "#808000",
+ "#000000", "#101010", "#404040", "#808080", "#c0c0c0", "#ffffff",
+ "#050505", "#f5f5f5", "#e0ac69", "#8d5524", "#c68642", "#ffdbac",
+];
+const COLS = 6;
+const W = 1920;
+const H = 1080;
+
+function Patches() {
+ const w = W / COLS;
+ const h = H / (PATCHES.length / COLS);
+ return (
+ <AbsoluteFill style={{ background: "#000000" }}>
+ {PATCHES.map((c, i) => (
+ <div key={i} style={{ position: "absolute", left: (i % COLS) * w, top: Math.floor(i / COLS) * h, width: w, height: h, background: c }} />
+ ))}
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="colour" component={Patches} width={W} height={H} fps={30} durationInFrames={30} />);
diff --git a/bench/lightspeed/energy.sh b/bench/lightspeed/energy.sh
new file mode 100644
index 00000000..ed3330fa
--- /dev/null
+++ b/bench/lightspeed/energy.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+# R6, energy (docs/lightspeed.feature): watts while playing pong and playing a timeline (the legacy app's idle
+# stage retired with apps/legacy).
+#
+# bench/lightspeed/energy.sh [--seconds 30]
+#
+# Without root (powermetrics needs it), from two counters (`raea ci energy`):
+# process watts the process's own energy (proc_pid_rusage's ri_energy_nj, rusage_info_v6: the CPU energy the kernel
+# attributes to it) over the run past its first 5 s. GPU energy isn't attributed per process, so this is
+# the CPU's part; it's the row's value
+# system watts the whole Mac's input power (the battery controller's SystemPowerIn, mW) sampled each second: context
+# only, since everything else running counts too; with the load recorded beside it
+# pong raea play pong --offscreen at its 120 fps, keys pressed as gate.sh presses them
+# timeline titles played from its bake (--baked), 30 fps
+. "$(dirname "$0")/lib.sh"
+H=bench/lightspeed/energy.sh
+set -o pipefail
+GAMES=$ROOT/sdk/react/bench/games
+TIMELINES=$ROOT/sdk/react/bench/timelines
+
+seconds=30
+while [ $# -gt 0 ]; do
+ case $1 in
+ --seconds) seconds=$2; shift ;;
+ *) echo "usage: bench/lightspeed/energy.sh [--seconds S]" >&2; exit 2 ;;
+ esac
+ shift
+done
+seconds=$(pyf "$seconds")
+# the play runs 2 s past the watch (Python: str(seconds + 2))
+secs2=$(pyf "$(awk -v s="$seconds" 'BEGIN { print s + 2 }')")
+
+# the watch's raw numbers rounded as the rows keep them
+rounded() { LS_JQ -c 'include "lib"; {process_w: (.process_w | pyround(3)), system_w: (.system_w | if . == null then null else pyround(1) end), span_s: (.span_s | pyround(1))}'; }
+
+# motion EDIT MODE: play it (MODE --input or --baked) and watch its energy
+motion() {
+ (cd "$ROOT/sdk/react" && RAEA_AUDIO_MUTE=1 RAEA_INPUT_KEYS="" "$MOTION" ci energy --seconds "$seconds" -- "$MOTION" play "$1" \
+ --offscreen --size 1280x720 --seconds "$secs2" "$2") | rounded
+}
+
+trap cleanup_turn EXIT
+
+turn_begin energy
+pong=$(motion "$GAMES/pong/edit.tsx" --input) || { turn_end; exit 1; }
+timeline=$(motion "$TIMELINES/titles/edit.tsx" --baked) || { turn_end; exit 1; }
+turn_end
+res=$(jq -nc --argjson p "$pong" --argjson t "$timeline" '{pong: $p, timeline: $t}')
+record R6 "$(echo "$res" | LS_JQ -c 'include "lib"; "\(.pong.process_w | pyf) / \(.timeline.process_w | pyf)"')" \
+ "W (CPU, process) pong / timeline" "$res" $H
diff --git a/bench/lightspeed/export.sh b/bench/lightspeed/export.sh
new file mode 100644
index 00000000..93c25999
--- /dev/null
+++ b/bench/lightspeed/export.sh
@@ -0,0 +1,195 @@
+#!/bin/bash
+# Throughput and export fidelity (docs/lightspeed.feature): T1, T2, T4 and Q3.
+#
+# bench/lightspeed/export.sh [--runs 3] [--only T1,T2,T4,Q3]
+#
+# T1 ts1 (the 20 s, 595-frame 1080x1920 edit on real footage) rendered to MP4, warm: wall time, p50 of RUNS, with the
+# render's own split (frames, sound, finish) from RAEA_TIMES
+# T2 bench/lightspeed/t3d600 (a lit cube under moving text, 1080x1920, 600 frames) rendered to MP4, warm
+# T4 batch: titles (600 frames, no footage) rendered by K processes at once, for K = 1, 2, 4, 8 (2K renders each):
+# renders per hour and how it scales from K = 1
+# Q3 VMAF of ts1's MP4 against the same frames rendered losslessly (PNG), pooled mean and the worst frame; and
+# colour: bench/lightspeed/colour's patches rendered to MP4, decoded with the matrix and range the file declares,
+# each patch's centre against the value it was painted with (worst channel error, 8-bit; `raea ci
+# patches`), plus the tags. Both for the default export (H.264, 8-bit) and for `render --10bit` (HEVC Main10).
+# Q3.colour is the 10-bit export's (the exact one; 8-bit limited range's own round trip errs up to 2), with the
+# H.264 export's in its detail; Q3.vmaf is the default export's, with the 10-bit export's in its detail. The colour
+# decode is swscale with full_chroma_int+accurate_rnd: its default 10-bit -> RGB path errs 3-4 on ideal planes
+# (exact with these), and on 8-bit these give the exact round trip's own floor
+#
+# The footage fixtures (ts1, k4) are in RAEA_LIGHTSPEED_FIXTURES (~/Library/Caches/raea-lightspeed/fixtures): ts1's
+# footage isn't in git. Wall times come from `raea ci time` (the clock just before the spawn to the exit).
+. "$(dirname "$0")/lib.sh"
+H=bench/lightspeed/export.sh
+TS1=$FIXTURES/ts1/edit.tsx
+T3D=$ROOT/bench/lightspeed/t3d600/edit.tsx
+TITLES=$ROOT/sdk/react/bench/timelines/titles/edit.tsx
+COLOUR=$ROOT/bench/lightspeed/colour/edit.tsx
+
+runs=3; only=T1,T2,T4,Q3
+while [ $# -gt 0 ]; do
+ case $1 in
+ --runs) runs=$2; shift ;;
+ --only) only=$2; shift ;;
+ *) echo "usage: bench/lightspeed/export.sh [--runs N] [--only T1,T2,T4,Q3]" >&2; exit 2 ;;
+ esac
+ shift
+done
+has() { case ",$only," in *",$1,"*) return 0 ;; esac; return 1; }
+
+TMPS=()
+trap 'cleanup_turn; [ ${#TMPS[@]} -gt 0 ] && rm -rf "${TMPS[@]}"' EXIT
+newtmp() { local d; d=$(mktemp -d "${TMPDIR:-/tmp}/$1XXXXXX"); TMPS+=("$d"); echo "$d"; }
+
+# render EDIT OUT [ARGS...]: prints the wall seconds, a tab, the start (unix ms), a tab, and the render's own split
+# (RAEA_TIMES' JSON line, null without it). Every render renders: the export cache (3479eea) would answer a repeat
+# in ~0.02 s, which isn't T1, T2 or T4. TIMES=1 asks for the split.
+render() {
+ local edit=$1 out=$2; shift 2
+ local log=$out.log clock=$out.clock
+ if [ "${TIMES:-}" = 1 ]; then
+ RAEA_EXPORT_CACHE=0 RAEA_TIMES=1 "$MOTION" ci time --to "$clock" -- "$MOTION" render "$edit" -o "$out" "$@" > "$log.out" 2> "$log.err"
+ else
+ RAEA_EXPORT_CACHE=0 "$MOTION" ci time --to "$clock" -- "$MOTION" render "$edit" -o "$out" "$@" > "$log.out" 2> "$log.err"
+ fi
+ if [ $? != 0 ]; then
+ if [ -s "$log.err" ]; then say_tail "render $edit: " 600 "$log.err" >&2; else say_tail "render $edit: " 600 "$log.out" >&2; fi
+ return 1
+ fi
+ cat "$log.out" "$log.err" > "$log"
+ jq -r --rawfile t "$log" '"\(.wall_s)\t\(.start_unix_ms)\t\([$t | split("\n")[] | select(startswith("{") and contains("\"frames\"")) | fromjson?] | last | tojson)"' "$clock"
+ rm -f "$log" "$log.out" "$log.err" "$clock"
+}
+
+# timed EDIT RUNS [ARGS...]: a warm render, then RUNS timed ones; their lines (render's) on stdout
+timed() {
+ local edit=$1 n=$2 tmp; shift 2
+ tmp=$(newtmp lightspeed-export-)
+ render "$edit" "$tmp/warm.mp4" "$@" > /dev/null || return 1
+ for i in $(seq 0 $((n - 1))); do TIMES=1 render "$edit" "$tmp/$i.mp4" "$@" || return 1; done
+ rm -rf "$tmp"
+}
+
+t1_t2() {
+ local d; d=$(newtmp lightspeed-t1t2-)
+ turn_begin export:T1T2
+ if has T1; then timed "$TS1" "$runs" > "$d/T1" || { turn_end; return 1; }; fi
+ if has T2; then timed "$T3D" "$runs" > "$d/T2" || { turn_end; return 1; }; fi
+ turn_end
+ for row in T1 T2; do
+ [ -f "$d/$row" ] || continue
+ local detail
+ detail=$(LS_JQ -Rsc 'include "lib"; [split("\n")[] | select(. != "") | split("\t") | {wall: (.[0] | tonumber), split: (.[2] | fromjson)}] as $r
+ | [$r[].wall] as $w
+ | {p50_s: ($w | pct(0.5) | pyround(3)), max_s: ($w | max | pyround(3)), runs: ($w | map(pyround(3))),
+ split: ($r[($r | length) / 2 | floor].split | if . == null then null else
+ {setup_s: .setup_s, frames_s: (if .times then (.times.ms_per_frame.wall * .frames / 1e3 | pyround(3)) else null end),
+ sound_s: .sound_s, finish_s: .finish_s, fps: .fps_incl_encode, video: .video} end)}' "$d/$row")
+ record $row "$(echo "$detail" | LS_JQ -r 'include "lib"; .p50_s | pyf')" s "$detail" $H
+ done
+}
+
+t4() {
+ local tmp res="" k i w
+ tmp=$(newtmp lightspeed-batch-)
+ render "$TITLES" "$tmp/warm.mp4" > /dev/null || return 1
+ turn_begin export:T4
+ for k in 1 2 4 8; do
+ # K workers at once over the 2K renders, as a pool of K threads takes them
+ local pids=""
+ for w in $(seq 0 $((k - 1))); do
+ ( for i in $w $((w + k)); do render "$TITLES" "$tmp/k$k-$i.mp4" > "$tmp/k$k-$i.line" || exit 1; done ) &
+ pids="$pids $!"
+ done
+ # the workers only (a bare wait would wait for the turn's watcher too)
+ for p in $pids; do wait $p; done
+ for i in $(seq 0 $((2 * k - 1))); do [ -s "$tmp/k$k-$i.line" ] || { turn_end; echo "T4: a render failed (K=$k)" >&2; return 1; }; done
+ res="$res$(cat "$tmp"/k$k-*.line | LS_JQ -Rsc --argjson k $k 'include "lib";
+ [split("\n")[] | select(. != "") | split("\t") | {wall: (.[0] | tonumber), start: (.[1] | tonumber)}] as $r
+ # the batch: the first spawn to the last exit
+ | ((([$r[] | .start + .wall * 1e3] | max) - ([$r[].start] | min)) / 1e3) as $secs
+ | {("\($k)"): {renders: (2 * $k), wall_s: ($secs | pyround(2)), per_hour: (2 * $k * 3600 / $secs | pyround(0)),
+ render_p50_s: ([$r[].wall] | pct(0.5) | pyround(2))}}')"$'\n'
+ rm -f "$tmp"/k$k-*
+ done
+ turn_end
+ local detail
+ detail=$(printf '%s' "$res" | LS_JQ -sc --argjson cores "$(getconf _NPROCESSORS_ONLN)" 'include "lib"; add as $by
+ | (reduce ($by | to_entries[]) as $e (null; if . == null or $e.value.per_hour > .per_hour then $e.value else . end)) as $best
+ | {by_processes: $by, scaling_vs_1: ($best.per_hour / $by["1"].per_hour | pyround(2)), cores: $cores, best: $best.per_hour}')
+ record T4 "$(echo "$detail" | jq .best)" "renders/hour (titles, 600 frames)" "$(echo "$detail" | jq -c 'del(.best)')" $H
+}
+
+probe_tags() {
+ ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt,color_range,color_space,color_transfer,color_primaries,bit_rate \
+ -of json "$1" | jq -c '.streams[0]'
+}
+
+# vmaf MP4 PNGDIR FPS: pooled mean, the 1st percentile, the worst frame
+vmaf() {
+ local mp4=$1 png=$2 fps=$3 log=$2/vmaf.json pf=yuv420p
+ # a 10-bit file is compared at 10 bits (the reference made 10-bit too), an 8-bit one as before
+ case $(probe_tags "$mp4" | jq -r '.pix_fmt // ""') in *10*) pf=yuv420p10le ;; esac
+ if ! nice -n 15 ffmpeg -v error -i "$mp4" -framerate "$fps" -i "$png/frame-%05d.png" \
+ -filter_complex "[0:v]setpts=PTS-STARTPTS,format=$pf[d];[1:v]scale=out_color_matrix=bt709:out_range=tv,format=$pf,setpts=PTS-STARTPTS[r];[d][r]libvmaf=log_fmt=json:log_path=$log:n_threads=4" \
+ -f null - 2> "$png/vmaf.err"; then
+ say_tail "vmaf: " 400 "$png/vmaf.err" >&2; return 1
+ fi
+ LS_JQ -c 'include "lib"; ([.frames[].metrics.vmaf] | sort) as $v
+ | (reduce .frames[] as $f (null; if . == null or $f.metrics.vmaf < .metrics.vmaf then $f else . end)) as $worst
+ | {mean: (.pooled_metrics.vmaf.mean | pyround(2)), p1: ($v[($v | length) / 100 | floor] | pyround(2)), min: ($v[0] | pyround(2)),
+ worst_frame: $worst.frameNum, frames: ($v | length)}' "$log"
+}
+
+# colour TMP [ARGS...]: the colour fixture rendered (ARGS: --10bit), decoded as its tags say, each patch against its value
+colour() {
+ local tmp=$1; shift
+ local mp4=$tmp/colour.mp4 tags matrix rng
+ render "$COLOUR" "$mp4" "$@" > /dev/null || return 1
+ tags=$(probe_tags "$mp4")
+ matrix=$(echo "$tags" | jq -r '{"bt709": "bt709", "smpte170m": "bt601", "bt470bg": "bt601", "bt2020nc": "bt2020"}[.color_space // ""] // "bt709"')
+ rng=$(echo "$tags" | jq -r 'if (.color_range // "tv") == "tv" then "tv" else "pc" end')
+ ffmpeg -v error -i "$mp4" -vf "select=eq(n\\,15),scale=in_color_matrix=$matrix:in_range=$rng:out_range=pc:flags=full_chroma_int+accurate_rnd,format=rgb24" \
+ -frames:v 1 -f rawvideo - > "$tmp/colour.rgb" 2> /dev/null
+ # the patches as painted: the "#rrggbb" strings from PATCHES to the file's first "];"
+ local hexes
+ hexes=$(jq -rn --rawfile s "$COLOUR" '($s | split("PATCHES")) as $p
+ | if ($p | length) < 2 or ($p[0] | contains("];")) then empty
+ else ("PATCHES" + ($p[1:] | join("PATCHES"))) | split("];")[0] | [match("\"#([0-9a-f]{6})\""; "g") | .captures[0].string][] end')
+ "$MOTION" ci patches "$tmp/colour.rgb" 1920 1080 6 $hexes > "$tmp/patches.json" || return 1
+ jq -c --argjson tags "$tags" --arg as "$matrix $rng" --argjson bytes "$(stat -f %z "$mp4")" '
+ (reduce .patches[] as $p ({}; .[$p[0]] = {want: $p[1], got: $p[2], err: $p[3]})) as $errs
+ | {worst_err_8bit: .worst, tags: $tags, decoded_as: $as, bytes: $bytes,
+ worst_patches: ([$errs | to_entries[] | [.key, .value.err]] | sort_by(-.[1]) | .[:5]), patches: $errs}' "$tmp/patches.json"
+}
+
+q3() {
+ local tmp mp4 mp4_10 png w8 w10 vm vm10 col8 col
+ tmp=$(newtmp lightspeed-q3-)
+ mp4=$tmp/ts1.mp4; mp4_10=$tmp/ts1-10bit.mp4; png=$tmp/png
+ mkdir -p "$png"
+ turn_begin export:Q3
+ w8=$(render "$TS1" "$mp4") || { turn_end; return 1; }; w8=${w8%%$'\t'*}
+ w10=$(render "$TS1" "$mp4_10" --10bit) || { turn_end; return 1; }; w10=${w10%%$'\t'*}
+ render "$TS1" "$png" > /dev/null || { turn_end; return 1; }
+ vm=$(vmaf "$mp4" "$png" 30) || { turn_end; return 1; }
+ vm=$(echo "$vm" | LS_JQ -c --argjson tags "$(probe_tags "$mp4")" --argjson b "$(stat -f %z "$mp4")" --argjson w "$w8" \
+ 'include "lib"; .tags = $tags | .bytes = $b | .render_s = ($w | pyround(2))')
+ vm10=$(vmaf "$mp4_10" "$png" 30) || { turn_end; return 1; }
+ vm10=$(echo "$vm10" | LS_JQ -c --argjson tags "$(probe_tags "$mp4_10")" --argjson b "$(stat -f %z "$mp4_10")" --argjson w "$w10" \
+ 'include "lib"; .tags = $tags | .bytes = $b | .render_s = ($w | pyround(2))')
+ vm=$(echo "$vm" | jq -c --argjson t "$vm10" '.ten_bit = $t')
+ rm -rf "$png" # 1.4 GB of frames
+ col8=$(colour "$tmp") || { turn_end; return 1; }
+ col=$(colour "$tmp" --10bit) || { turn_end; return 1; }
+ col=$(echo "$col" | jq -c --argjson c "$col8" '.h264_8bit = ($c | {worst_err_8bit, tags, decoded_as, bytes, worst_patches})')
+ turn_end
+ record Q3.vmaf "$(echo "$vm" | LS_JQ -r 'include "lib"; .mean | pyf')" "VMAF mean (ts1, MP4 vs lossless frames; --10bit in detail)" "$vm" $H
+ record Q3.colour "$(echo "$col" | jq .worst_err_8bit)" "worst patch error /255 (render --10bit, HEVC Main10; H.264 8-bit in detail)" "$col" $H
+}
+
+status=0
+if has T1 || has T2; then t1_t2 || exit 1; fi
+if has T4; then t4 || exit 1; fi
+if has Q3; then q3 || exit 1; fi
+exit $status
diff --git a/bench/lightspeed/feel.sh b/bench/lightspeed/feel.sh
new file mode 100644
index 00000000..bb76e1b4
--- /dev/null
+++ b/bench/lightspeed/feel.sh
@@ -0,0 +1,136 @@
+#!/bin/bash
+# The feel rows and the GC rows (docs/lightspeed.feature): F1, F2, F3, F4, F6, R1, R2.
+#
+# bench/lightspeed/feel.sh [--seconds 60] [--only games,gc,scrub]
+#
+# games sdk/react/bench/games/gate.sh SECONDS pong platformer arena3d (the 3D one), offscreen at 120 fps with keys
+# pressed: F1 input to present p99 (offscreen; the in-window gate, apps/legacy/shell/bench/gates.py, went with the
+# Dioxus window in 222ed773: void's bevy_ui window measures input to frame through sdk/ui/conformance),
+# F2 work p99 and p99.9, F3 missed frames, F6 hitches (frames past
+# the first second over 2 ms)
+# gc pong again with JSC_logGC=1 (lib.jq's gc parse): R2 collections a minute and the worst pause, R1's JS layer as
+# the garbage freed a frame (the other layers aren't counted yet: ZeroHeap Z1)
+# scrub 60 shuffled seeks of ts1 (1080x1920) and k4 (4K) from their bakes (play --scrub, as
+# sdk/react/bench/video/gate.sh): F4 scrub p99
+. "$(dirname "$0")/lib.sh"
+H=bench/lightspeed/feel.sh
+REACT=$ROOT/sdk/react
+
+seconds=60; only=games,gc,scrub
+while [ $# -gt 0 ]; do
+ case $1 in
+ --seconds) seconds=$2; shift ;;
+ --only) only=$2; shift ;;
+ *) echo "usage: bench/lightspeed/feel.sh [--seconds S] [--only games,gc,scrub]" >&2; exit 2 ;;
+ esac
+ shift
+done
+# Python's float: the harness passed str(float) on (60 -> 60.0)
+seconds=$(pyf "$seconds")
+has() { case ",$only," in *",$1,"*) return 0 ;; esac; return 1; }
+
+games() {
+ local tmp out
+ tmp=$(mktemp -d "${TMPDIR:-/tmp}/lightspeed-feel-XXXXXX")
+ turn_begin feel:games
+ out=$(cd "$REACT" && TMPDIR=$tmp sh bench/games/gate.sh "$seconds" pong platformer arena3d 2> /dev/null)
+ turn_end
+ # Python's str.strip()
+ say "$(printf '%s' "$out" | awk '{ l[NR] = $0 } END { s = 1; while (s <= NR && l[s] ~ /^[ \t\r]*$/) s++; e = NR; while (e >= s && l[e] ~ /^[ \t\r]*$/) e--
+ for (i = s; i <= e; i++) { x = l[i]; if (i == s) sub(/^[ \t\r]+/, "", x); if (i == e) sub(/[ \t\r]+$/, "", x); print x } }')"
+ local files=()
+ for g in pong platformer arena3d; do
+ [ -f "$tmp/raea-games-gate/$g.json" ] && files+=("$g" "$tmp/raea-games-gate/$g.json")
+ done
+ local per rows
+ per=$(for ((i = 0; i < ${#files[@]}; i += 2)); do jq -c --arg g "${files[i]}" '{($g): .}' "${files[i + 1]}"; done | LS_JQ -sc 'include "lib";
+ add // {} | map_values(
+ {input_p99_ms: (.input_to_present_ms.p99 | pyround(2)), input_p99_frames: (.input_to_present_ms.p99_frames | pyround(2)),
+ work_p99_ms: (.work_ms.p99 | pyround(2)), work_p999_ms: ((.work_ms.p999 // 0) | pyround(2)),
+ missed: .missed_vs_display, presented: .presented,
+ work_p50_ms: (.work_ms.p50 | pyround(2)), hitches: (.hitches_over_2ms // {} | .count),
+ hitch_max_ms: ((.hitches_over_2ms // {} | .max // 0) | pyround(2)),
+ first_hitches: ((.hitches_over_2ms // {} | .first // [])[:6])})')
+ if [ "$per" = "{}" ]; then echo "feel: no game ran (gate.sh: $out)" >&2; rm -rf "$tmp"; return 1; fi
+ # a hitch is a frame over 2 ms in a game whose frames are well under it; a game whose median frame is already near
+ # 2 ms (arena3d's 3D frame, ~3 ms) is F2's steady cost, not first-use stalls, so it's listed, not counted
+ rows=$(echo "$per" | LS_JQ -c --arg s "$seconds" 'include "lib";
+ def worst($k): [.[][$k]] | max;
+ (with_entries(select((.value.work_p50_ms // 0) < 1.5))) as $first
+ | ([keys[] as $k | select($first | has($k) | not) | $k] | sort) as $steady
+ | ([$first[].hitch_max_ms] | if length == 0 then 0 else max end) as $hmax
+ | {F1: (worst("input_p99_ms") | pyf),
+ F2: ("\(worst("work_p99_ms") | pyf) / \(worst("work_p999_ms") | pyf)" | tojson),
+ F3: ([.[].missed] | add | tostring),
+ F3u: "missed frames in \($s | tonumber | fixed(0)) s x \(length) games",
+ F6: ("\([$first[].hitches] | add // 0) (max \(if ($first | length) == 0 then "0" else $hmax | pyf end) ms)"
+ + (if ($steady | length) > 0 then "; \($steady | join(", ")) steady over 2 ms, in F2" else "" end) | tojson)}')
+ rm -rf "$tmp"
+ record F1 "$(echo "$rows" | jq -r .F1)" "ms input to present p99, offscreen 120 fps (worst game)" "$per" $H
+ record F2 "$(echo "$rows" | jq -r .F2)" "ms work p99 / p99.9 (worst game)" "$per" $H
+ record F3 "$(echo "$rows" | jq -r .F3)" "$(echo "$rows" | jq -r .F3u)" "$per" $H
+ record F6 "$(echo "$rows" | jq -r .F6)" "hitches over 2 ms past the first second" "$per" $H
+}
+
+gc() {
+ local s=$1 tmp detail
+ tmp=$(mktemp -d "${TMPDIR:-/tmp}/lightspeed-gc-XXXXXX")
+ turn_begin feel:gc
+ (cd "$REACT" && JSC_logGC=1 RAEA_AUDIO_MUTE=1 "$MOTION" play bench/games/pong/edit.tsx --input --offscreen --size 1280x720 \
+ --seconds "$s" --json "$tmp/pong.json" > "$tmp/out" 2> "$tmp/err")
+ turn_end
+ cat "$tmp/out" "$tmp/err" > "$tmp/all"
+ detail=$(LS_JQ -c --rawfile t "$tmp/all" 'include "lib";
+ [$t | match("START \\w (\\d+)kb => (\\w+),.*?=> (\\d+)kb, p=([0-9.]+)ms \\(max [0-9.]+\\), cycle ([0-9.]+)ms END\\]"; "g")
+ | [.captures[].string]] as $gcs
+ | [$gcs[][3] | tonumber] as $pauses
+ | ([$gcs[] | (.[0] | tonumber) - (.[2] | tonumber)] | add // 0) as $freed
+ | {collections: ($gcs | length), per_minute: (($gcs | length) * 60 / .seconds | pyround(1)),
+ pause_max_ms: ($pauses | max // 0), pause_total_ms: ($pauses | add // 0 | pyround(1)),
+ freed_kb_per_frame: ($freed / ([.presented, 1] | max) | pyround(1)),
+ kinds: ([$gcs[][1]] | unique), frames: .presented, seconds: .seconds}' "$tmp/pong.json") || { rm -rf "$tmp"; return 1; }
+ rm -rf "$tmp"
+ local r2 r1
+ r2=$(echo "$detail" | LS_JQ -c 'include "lib"; "\(.per_minute | pyf)/min (max pause \(if .collections > 0 then .pause_max_ms | pyf else "0" end) ms)"')
+ r1=$(echo "$detail" | LS_JQ -c 'include "lib"; "JS \(.freed_kb_per_frame | pyf) KB/frame"')
+ record R2 "$r2" "JSC collections, pong" "$detail" $H
+ record R1 "$r1" "garbage a frame, pong (JS layer; others uncounted)" "$detail" $H
+}
+
+scrub() {
+ local res="" name size edit t
+ t=$(mktemp "${TMPDIR:-/tmp}/lightspeed-scrub.XXXXXX")
+ turn_begin feel:scrub
+ for spec in "ts1 1080x1920" "k4 2160x3840"; do
+ set -- $spec; name=$1; size=$2
+ edit=$FIXTURES/$name/edit.tsx
+ if [ ! -f "$edit" ]; then say "F4: $edit missing; skipped"; continue; fi
+ (cd "$REACT" && RAEA_AUDIO_MUTE=1 "$MOTION" play "$edit" --baked --offscreen --size "$size" --scrub 60 > "$t.out" 2> "$t.err")
+ cat "$t.out" "$t.err" > "$t"
+ # the JSON after SCRUBBED: from the first { after it to the text's last }
+ local j
+ if ! j=$(jq -c --rawfile t "$t" -n --arg n "$name" '
+ ($t | split("SCRUBBED")) as $p | if ($p | length) < 2 then error("no SCRUBBED") else
+ ($p[1:] | join("SCRUBBED")) as $rest | ($rest | split("{")) as $q
+ | ("{" + ($q[1:] | join("{"))) as $from | ($from | split("}")) as $r
+ | ($r[:-1] | join("}") + "}") | fromjson end' 2> /dev/null); then
+ say_tail "F4 $name: the scrub failed: " 400 "$t"; continue
+ fi
+ res="$res$(echo "$j" | LS_JQ -c --arg n "$name" 'include "lib"; {($n): {scrub_p50_ms: (.scrub_ms.p50 | pyround(1)),
+ scrub_p99_ms: (.scrub_ms.p99 | pyround(1)), scrub_max_ms: (.scrub_ms.max | pyround(1)), first_frame_ms: .first_frame_ms,
+ seeks: .seeks}}')"$'\n'
+ done
+ turn_end
+ rm -f "$t" "$t.out" "$t.err"
+ [ -n "$res" ] || return 0
+ res=$(printf '%s' "$res" | jq -sc add)
+ record F4 "$(echo "$res" | LS_JQ -c 'include "lib"; [to_entries[] | "\(.key) \(.value.scrub_p99_ms | pyf)"] | join(" / ")')" \
+ "ms scrub p99 (1080p / 4K)" "$res" $H
+}
+
+status=0
+if has games; then games || status=1; fi
+# Python's min(seconds, 60): the float up to 60, the int 60 past it
+if has gc; then gc "$(awk -v s="$seconds" 'BEGIN { print (s + 0 <= 60 ? s : "60") }')" || status=1; fi
+if has scrub; then scrub || status=1; fi
+exit $status
diff --git a/bench/lightspeed/gpumem.sh b/bench/lightspeed/gpumem.sh
new file mode 100644
index 00000000..393d8576
--- /dev/null
+++ b/bench/lightspeed/gpumem.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# R4, GPU memory per stage (docs/lightspeed.feature).
+#
+# bench/lightspeed/gpumem.sh
+#
+# On Apple silicon the GPU's memory is the process's own: footprint(1) files Metal's buffers and textures under its
+# "(graphics)" categories (owned, unmapped graphics memory and IOAccelerator). Each stage is played offscreen and read
+# 5 s in, once it's steady (`raea ci graphics`):
+# pong live, 1280x720
+# titles from its bake, 1080x1920
+# ts1 from its bake, 1080x1920 (footage: the decoder's surfaces count)
+# The value is each stage's graphics memory (dirty, MB). Not timed, so it takes no lock; the load is still recorded.
+. "$(dirname "$0")/lib.sh"
+H=bench/lightspeed/gpumem.sh
+
+ST_START=$(load1)
+res=""
+for spec in "pong $ROOT/sdk/react/bench/games/pong/edit.tsx 1280x720 0" \
+ "titles $ROOT/sdk/react/bench/timelines/titles/edit.tsx 1080x1920 1" \
+ "ts1 $FIXTURES/ts1/edit.tsx 1080x1920 1"; do
+ set -- $spec; name=$1; edit=$2; size=$3; baked=$4
+ if [ ! -f "$edit" ]; then say "R4 $name: $edit missing; skipped"; continue; fi
+ mode=--input; [ "$baked" = 1 ] && mode=--baked
+ g=$(cd "$ROOT/sdk/react" && RAEA_AUDIO_MUTE=1 "$MOTION" ci graphics --after 5 -- "$MOTION" play "$edit" --offscreen --size "$size" --seconds 9 $mode) || exit 1
+ res="$res$(echo "$g" | LS_JQ -c --arg n "$name" 'include "lib";
+ {($n): {graphics_mb: (.graphics_mb | pyround(1)), footprint_mb: (.footprint_mb | if . == null then null else pyround(1) end),
+ parts: (reduce .parts[] as $p ({}; .[$p[0]] = ($p[1] | pyround(1))))}}')"$'\n'
+done
+# memory, not time: the load doesn't change it much
+ST_END=$(load1); ST_QUIET=true; ST_OTHERS='[]'
+res=$(printf '%s' "$res" | jq -sc 'add // {}')
+record R4 "$(echo "$res" | LS_JQ -c 'include "lib"; [to_entries[] | "\(.key) \(.value.graphics_mb | fixed(0))"] | join(" / ")')" \
+ "MB GPU (graphics footprint) per stage" "$res" $H
diff --git a/bench/lightspeed/jsalloc.ts b/bench/lightspeed/jsalloc.ts
new file mode 100644
index 00000000..26be2fb6
--- /dev/null
+++ b/bench/lightspeed/jsalloc.ts
@@ -0,0 +1,78 @@
+// What a live bundle's own JS allocates a frame (R1's JS layer, lightspeed Z3), without Bevy or a page: the bundle run
+// in bun's JavaScriptCore with the bridge stubbed, frames handed to it as raea hands them, and the garbage
+// counted from JSC's GC log (BUN_JSC_logGC, as jsheap.sh reads JSC_logGC) between the first and last measured frame.
+// Quick and repeatable enough to split a frame's garbage by taking parts of an edit away.
+// bun bench/lightspeed/jsalloc.ts BUNDLE.js [--frames 3000] [--warm 240] [--from 600] [--live] [--span N] [--set NAME=JSON]
+// BUNDLE is a lite bundle as raea bundles it (RAEA_BUNDLE_CACHE=DIR keeps one in DIR).
+const args = process.argv.slice(2);
+const opt = (k: string, d: number) => {
+ const i = args.indexOf(k);
+ return i >= 0 ? Number(args[i + 1]) : d;
+};
+const file = args[0];
+const FRAMES = opt("--frames", 3000), WARM = opt("--warm", 240), FROM = opt("--from", 600);
+const LIVE = args.includes("--live");
+if (!file) {
+ console.error("bun jsalloc.ts BUNDLE.js [--frames N] [--warm N] [--from F]");
+ process.exit(2);
+}
+
+if (!args.includes("--child")) {
+ // the run, with JSC's GC log on: what each eden collection freed, between the marks
+ const p = Bun.spawnSync(["bun", import.meta.path, ...args, "--child"], { env: { ...process.env, BUN_JSC_logGC: "1" }, stderr: "pipe", stdout: "pipe" });
+ const log = p.stderr.toString() + p.stdout.toString();
+ const from = log.indexOf("jsalloc: measuring"), to = log.indexOf("jsalloc: done");
+ if (from < 0 || to < 0) {
+ console.error(log.split("\n").filter((l) => !l.startsWith("[GC")).slice(-12).join("\n"));
+ process.exit(1);
+ }
+ const gc = /START \w (\d+)kb => \w+,.*?=> (\d+)kb, p=([0-9.]+)ms/g;
+ let freed = 0, n = 0;
+ for (const m of log.slice(from, to).matchAll(gc)) {
+ freed += Number(m[1]) - Number(m[2]);
+ n++;
+ }
+ const bridge = /bridge ([0-9.]+) KB/.exec(log.slice(to))?.[1];
+ console.log(`${file.split("/").pop()}: ${(freed / FRAMES).toFixed(1)} KB a frame (${n} collections over ${FRAMES} frames); bridge ${bridge} KB a frame`);
+ process.exit(0);
+}
+
+let wake: ((m: any) => void) | null = null;
+let flushed = 0;
+(globalThis as any).__bevyHost = {
+ op_flush(batch: string) {
+ flushed += batch.length;
+ },
+ op_next_event: () => new Promise((r) => (wake = r)),
+ op_emit() {},
+ op_request: () => Promise.resolve(null),
+ op_animate() {},
+};
+// --set NAME=JSON: a global set before the bundle runs (globalThis.__raea_lite_bailout=false, say)
+for (let i = 0; i < args.length; i++) if (args[i] === "--set") {
+ const [k, v] = args[i + 1].split("=");
+ (globalThis as any)[k] = JSON.parse(v);
+}
+(0, eval)(await Bun.file(file).text());
+
+const tick = () => new Promise<void>((r) => setImmediate(r));
+async function frame(f: number) {
+ await tick();
+ const w = wake;
+ wake = null;
+ if (!w) throw new Error("the bundle isn't waiting for an event");
+ // --live: as live play sends a frame (live.rs step_inner), with this moment's input; else a timeline's frame number
+ w({ t: "event", name: "raea-frame", value: LIVE ? { frame: f, input: { keys: [] } } : f });
+ await tick();
+}
+
+for (let i = 0; i < WARM; i++) await frame(FROM + i);
+Bun.gc(true);
+console.error("jsalloc: measuring");
+flushed = 0;
+// --span N: the frames FROM .. FROM+N played over and over (live play's first seconds, measured long enough to count)
+const SPAN = opt("--span", 0);
+for (let i = 0; i < FRAMES; i++) await frame(SPAN > 0 ? FROM + ((WARM + i) % SPAN) : FROM + WARM + i);
+console.error("jsalloc: done");
+console.error(`bridge ${(flushed / FRAMES / 1024).toFixed(2)} KB a frame`);
+process.exit(0);
diff --git a/bench/lightspeed/jsheap.sh b/bench/lightspeed/jsheap.sh
new file mode 100644
index 00000000..11e33a78
--- /dev/null
+++ b/bench/lightspeed/jsheap.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+# R1's JS layer and R2 (docs/lightspeed.feature): the garbage a frame and the collections, per edit, on the live
+# runtime (sdk/react/js/lite: every frame rendered in JS, as a game plays).
+#
+# bench/lightspeed/jsheap.sh [--seconds 20] [--runs 3] [--label NAME] [EDIT.tsx ...]
+#
+# Each edit is played offscreen with JSC_logGC=1 (no bake: timelines step their JS each frame too) and its GC log read:
+# garbage freed a frame (KB), collections a minute, the worst pause, and JS time a frame (p50, p99). Defaults: the
+# animate fixture, its interpolate twin, titles and pong, and pong's Z3 variants. The medians of RUNS go in the rows.
+. "$(dirname "$0")/lib.sh"
+H=bench/lightspeed/jsheap.sh
+
+# NAME -> edit; Z3's fixtures: pong's step and fold alone (its view renders nothing), its view alone over a frozen state
+edit_of() {
+ case $1 in
+ animate) echo sdk/react/bench/timelines/animate/edit.tsx ;;
+ twin) echo bench/lightspeed/animate-twin/edit.tsx ;;
+ titles) echo sdk/react/bench/timelines/titles/edit.tsx ;;
+ pong) echo sdk/react/bench/games/pong/edit.tsx ;;
+ pong-stepfold) echo sdk/react/bench/games/pong/edit.stepfold.tsx ;;
+ pong-view) echo sdk/react/bench/games/pong/edit.view.tsx ;;
+ *) echo "$1" ;;
+ esac
+}
+
+seconds=20; runs=3; label=""; names=()
+while [ $# -gt 0 ]; do
+ case $1 in
+ --seconds) seconds=$2; shift ;;
+ --runs) runs=$2; shift ;;
+ --label) label=$2; shift ;;
+ -*) echo "usage: bench/lightspeed/jsheap.sh [--seconds S] [--runs N] [--label NAME] [EDIT ...]" >&2; exit 2 ;;
+ *) names+=("$1") ;;
+ esac
+ shift
+done
+seconds=$(pyf "$seconds")
+[ ${#names[@]} = 0 ] && names=(animate twin titles pong pong-stepfold pong-view)
+
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/lightspeed-jsheap.XXXXXX")
+trap 'cleanup_turn; rm -rf "$TMP"' EXIT
+
+# once EDIT: one run's numbers, a JSON line
+once() {
+ local edit=$1 input=""
+ case $edit in *games*) input=--input ;; esac
+ (cd "$ROOT/sdk/react" && JSC_logGC=1 RAEA_AUDIO_MUTE=1 RAEA_ZEROHEAP=1 "$MOTION" play "$edit" $input --offscreen --size 1280x720 \
+ --seconds "$seconds" --json "$TMP/run.json" > "$TMP/out" 2> "$TMP/err")
+ cat "$TMP/out" "$TMP/err" > "$TMP/all"
+ jq -c --rawfile t "$TMP/all" '
+ [$t | match("START \\w (\\d+)kb => (\\w+),.*?=> (\\d+)kb, p=([0-9.]+)ms \\(max [0-9.]+\\), cycle ([0-9.]+)ms END\\]"; "g")
+ | [.captures[].string]] as $gcs
+ | ([.presented, 1] | max) as $frames
+ | {kb_frame: (([$gcs[] | (.[0] | tonumber) - (.[2] | tonumber)] | add // 0) / $frames),
+ gc_min: (($gcs | length) * 60 / ([.seconds, 0.1] | max)),
+ pause_max: ([$gcs[][3] | tonumber] | max // 0.0), js_p50: .js_ms.p50, js_p99: .js_ms.p99,
+ work_p99: .work_ms.p99, frames: .presented,
+ # ZeroHeap Z1: Rust allocations a frame applying the ops (raea counting allocator)
+ rust_apply: (.rust_allocs.apply_per_frame // 0.0), rust_apply_kb: ((.rust_allocs.apply_bytes_per_frame // 0.0) / 1024)}' "$TMP/run.json"
+ local rc=$?
+ rm -f "$TMP/run.json"
+ return $rc
+}
+
+res=""
+turn_begin jsheap
+for n in "${names[@]}"; do
+ edit=$(edit_of "$n"); case $edit in /*) ;; *) edit=$ROOT/$edit ;; esac
+ : > "$TMP/runs"
+ for _ in $(seq 1 "$runs"); do once "$edit" >> "$TMP/runs" || { turn_end; say_tail "$n: the play failed: " 400 "$TMP/err" >&2; exit 1; }; done
+ med=$(LS_JQ -sc 'include "lib"; . as $runs | reduce ($runs[0] | keys_unsorted[]) as $k ({}; .[$k] = ([$runs[][$k]] | median | pyround(3)))
+ | .runs_kb_frame = [$runs[].kb_frame | pyround(1)]' "$TMP/runs")
+ say "$(echo "$med" | LS_JQ -r --arg n "$n" 'include "lib"; "\($n): \(.kb_frame | fixed(1)) KB/frame (\(.runs_kb_frame | pylist)), \(.gc_min | fixed(0)) GC/min, max pause \(.pause_max | fixed(2)) ms, js p50 \(.js_p50 | fixed(3)) / p99 \(.js_p99 | fixed(3)) ms"')"
+ res="$res$(echo "$med" | jq -c --arg n "$n" '{($n): .}')"$'\n'
+done
+turn_end
+res=$(printf '%s' "$res" | jq -sc add)
+lab=""; [ -n "$label" ] && lab=" ($label)"
+record R1.js "$(echo "$res" | LS_JQ -c 'include "lib"; [to_entries[] | "\(.key) \(.value.kb_frame | fixed(0))"] | join(" / ")')" \
+ "KB JS garbage a frame$lab" "$res" $H
+record R1.rust "$(echo "$res" | LS_JQ -c 'include "lib"; [to_entries[] | "\(.key) \(.value.rust_apply | fixed(0))"] | join(" / ")')" \
+ "Rust allocations a frame applying ops$lab" "$res" $H
diff --git a/bench/lightspeed/lib.jq b/bench/lightspeed/lib.jq
new file mode 100644
index 00000000..d6afab54
--- /dev/null
+++ b/bench/lightspeed/lib.jq
@@ -0,0 +1,22 @@
+# Number formatting for lightspeed's harnesses (bench/lightspeed/*.sh, `jq -L bench/lightspeed 'include "lib"; ...'`), so
+# their rows read exactly as the Python harnesses' did (the history in results.jsonl stays comparable):
+# pyround($n) Python's round(x, n): half to even on x's exact value (fma takes x * 10^n - the tie without rounding),
+# n = 0 for round(x)
+# pyf a float as Python's str() writes it (12.0, not 12)
+# pystr a number read from JSON as Python's str() writes it: a float if its text has a point or an exponent
+# (jq 1.7 keeps a number's text until it's computed with), an int otherwise; null is None
+# fixed($n) Python's f"{x:.nf}"
+# pct($p) the harnesses' percentile: the sorted list's element round((n - 1) * p)
+# median statistics.median
+# pylist a list of floats as Python's str() writes it ([1.0, 2.5])
+
+def pyround($n): . as $x | pow(10; $n) as $m | ($x * $m | floor) as $f | fma($x; $m; -($f + 0.5)) as $r
+ | (if $r > 0 then $f + 1 elif $r < 0 then $f elif ($f % 2) == 0 then $f else $f + 1 end) / $m;
+def pyf: if . == null then "None" else (. + 0 | tostring) as $t | if ($t | test("^-?[0-9]+$")) then $t + ".0" else $t end end;
+def pystr: if . == null then "None" elif type == "number" then (if (tostring | test("[.eE]")) then pyf else tostring end)
+ elif type == "boolean" then (if . then "True" else "False" end) else tostring end;
+def fixed($n): pyround($n) | tostring | split(".") as $p
+ | if $n == 0 then $p[0] else $p[0] + "." + ((($p[1] // "") + ([range($n)] | map("0") | join("")))[:$n]) end;
+def pct($p): sort as $s | if ($s | length) == 0 then null else $s[(($s | length) - 1) * $p | pyround(0)] end;
+def median: sort as $s | ($s | length) as $n | if $n % 2 == 1 then $s[($n - 1) / 2] else ($s[$n / 2 - 1] + $s[$n / 2]) / 2 end;
+def pylist: "[" + (map(pyf) | join(", ")) + "]";
diff --git a/bench/lightspeed/lib.sh b/bench/lightspeed/lib.sh
new file mode 100644
index 00000000..99c508ca
--- /dev/null
+++ b/bench/lightspeed/lib.sh
@@ -0,0 +1,183 @@
+# Shared by lightspeed's harnesses (docs/lightspeed.feature), sourced: the quiet-machine turn at the shared measurement
+# lock, the load recorded beside every number, and one results log the scoreboard reads.
+#
+# Results: ~/Library/Logs/raea/lightspeed/results.jsonl, one line per measured row:
+# {"date", "commit", "row", "value", "unit", "detail", "load": {"start", "end"}, "quiet", "others", "harness"}
+# "others": other agents' busy antsy jobs seen during the run (any makes it NOT QUIET).
+# RAEA_LIGHTSPEED_MOTION: the raea to measure (default target/release/raea under this checkout).
+# Bash 3.2 (macOS's /bin/bash, what launchd's CI runs); jq for JSON (lib.jq: Python's rounding, so rows read as the
+# Python harnesses' did), awk for arithmetic, and `raea ci` (apps/ci) for what a shell can't time or
+# read: milliseconds from a spawn, a process's energy, footprint(1)'s graphics memory.
+
+LS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+ROOT=$(cd "$LS_DIR/../.." && pwd)
+MOTION=${RAEA_LIGHTSPEED_MOTION:-$ROOT/target/release/raea}
+LOCK=/tmp/raea-measure.lock
+LOGDIR=$HOME/Library/Logs/raea/lightspeed
+RESULTS=$LOGDIR/results.jsonl
+FIXTURES=${RAEA_LIGHTSPEED_FIXTURES:-$HOME/Library/Caches/raea-lightspeed/fixtures}
+QUIET=${RAEA_CI_QUIET_LOAD:-6}
+# another agent's job counts against a run once it has used this much memory: idle waiters and lock polls (a few MB)
+# don't, a build, render, export or model run does
+BUSY_MB=100
+# set in a turn's environment, so every process the harness starts carries it, even one that leaves the parent chain
+# (a helper that detaches is re-parented to launchd): one once marked its run NOT QUIET
+MARK=RAEA_LIGHTSPEED_TURN
+
+LS_JQ() { jq -L "$LS_DIR" "$@"; }
+
+say() { echo "$*"; }
+
+# say_tail PREFIX N FILE: PREFIX and the file's last N characters, as print(prefix + text[-N:]) writes them (characters,
+# not bytes; the text's own trailing newline kept)
+say_tail() { LS_JQ -rn --rawfile t "$3" --argjson n "$2" --arg p "$1" '$p + ($t | .[-$n:])'; }
+
+# a decimal as Python's str(float(...)) writes it: 2.00 -> 2.0, 6 -> 6.0, 2.10 -> 2.1
+pyf() {
+ case $1 in
+ *.*) echo "$1" | sed -e 's/\(\.[0-9]*[1-9]\)0*$/\1/' -e 's/\.0*$/.0/' ;;
+ '') echo None ;;
+ *) echo "$1.0" ;;
+ esac
+}
+
+load1() { sysctl -n vm.loadavg | awk '{print $2}'; }
+
+commit() { git -C "$ROOT" rev-parse --short=9 HEAD 2>/dev/null; }
+
+# Other agents' jobs running now, one name a line: from `antsy board`, those that reached BUSY_MB, leaving out this
+# harness's own job (ANTSY_JOB); and raea's own engines run outside antsy (an agent's quick A/B of raea plays):
+# raea, raea-game and raea-page-host processes this harness didn't start (not its descendants, not carrying its turn's
+# mark) that are busy (BUSY_MB resident, or a quarter of a core). An idle one (a `shell-serve` an exited app left behind,
+# ~45 MB at 2-3% of a core) doesn't count.
+other_jobs() {
+ antsy board 2>/dev/null | awk -v me="${ANTSY_JOB:-}" -v busy=$BUSY_MB '
+ match($0, /^[ \t]*job [^ \t]+ \[[^]]*\] /) {
+ split(substr($0, 1, RLENGTH), w, " "); name = w[2]
+ rest = substr($0, RLENGTH + 1)
+ if (!match(rest, / peak [0-9.]+ (MB|GB)/)) next
+ split(substr(rest, RSTART + 1, RLENGTH - 1), p, " ")
+ mb = p[2] * (p[3] == "GB" ? 1024 : 1)
+ if (name != me && mb >= busy) print name
+ }'
+ ps -Ao pid=,ppid=,rss=,pcpu=,comm= 2>/dev/null | awk -v me=$$ -v busy=$BUSY_MB '
+ $1 ~ /^[0-9]+$/ && $2 ~ /^[0-9]+$/ && NF >= 5 {
+ n++; pid[n] = $1; ppid[n] = $2; rss[n] = ($3 ~ /^[0-9]+$/) ? $3 : 0; cpu[n] = $4 + 0
+ c = $0; for (i = 1; i <= 4; i++) sub(/^[ \t]*[^ \t]+/, "", c); sub(/^[ \t]+/, "", c)
+ k = split(c, parts, "/"); comm[n] = parts[k]
+ }
+ END {
+ mine[me] = 1
+ do { grew = 0; for (i = 1; i <= n; i++) if (!(pid[i] in mine) && (ppid[i] in mine)) { mine[pid[i]] = 1; grew = 1 } } while (grew)
+ for (i = 1; i <= n; i++)
+ if ((comm[i] == "raea" || comm[i] == "raea-game" || comm[i] == "raea-page-host") && !(pid[i] in mine) && (rss[i] / 1024 >= busy || cpu[i] >= 25))
+ print pid[i], comm[i]
+ }' | while read -r pid name; do ours "$pid" || echo "$name pid $pid"; done
+}
+
+# whether process PID was started inside this harness's turn: its environment carries the turn's mark (ps -E shows the
+# environment of the person's own processes)
+ours() {
+ local mark
+ eval "mark=\${$MARK:-}"
+ [ -n "$mark" ] || return 1
+ ps -Ewwo command= -p "$1" 2>/dev/null | grep -qF "$MARK=$mark"
+}
+
+# Other agents' busy jobs seen during a run: at the start, every 5 s, and at the end (a 65 s export that began and
+# finished inside a game's run once put a 19 ms step on the platformer the load average never showed)
+watch_start() {
+ WATCH_FILE=$(mktemp "${TMPDIR:-/tmp}/lightspeed-watch.XXXXXX")
+ other_jobs > "$WATCH_FILE"
+ # the poller stops at its next tick once WATCH_FILE.stop exists (a poll under way finishes, as the Python thread's did)
+ ( trap 'exit 0' TERM; while [ ! -e "$WATCH_FILE.stop" ]; do sleep 5 & wait $!; [ -e "$WATCH_FILE.stop" ] || other_jobs >> "$WATCH_FILE"; done ) &
+ WATCH_PID=$!
+}
+
+# the names seen, as a JSON array: a job's name without antsy's run suffix (stress-r5-9da29 -> stress-r5), sorted, once
+watch_end() {
+ if [ -n "${WATCH_PID:-}" ]; then
+ : > "$WATCH_FILE.stop"; pkill -TERM -x -P "$WATCH_PID" sleep 2>/dev/null; wait "$WATCH_PID" 2>/dev/null
+ WATCH_PID=
+ fi
+ other_jobs >> "$WATCH_FILE"
+ sed -E 's/-[0-9a-f]{5}$//' "$WATCH_FILE" | LC_ALL=C sort -u | jq -Rsc 'split("\n") | map(select(. != ""))'
+ rm -f "$WATCH_FILE" "$WATCH_FILE.stop"
+}
+
+HELD_LOCK=0
+cleanup_turn() {
+ [ -n "${WATCH_PID:-}" ] && { : > "$WATCH_FILE.stop"; kill -TERM "$WATCH_PID" 2>/dev/null; pkill -TERM -x -P "$WATCH_PID" sleep 2>/dev/null; rm -f "$WATCH_FILE" "$WATCH_FILE.stop"; }
+ [ "$HELD_LOCK" = 1 ] && rmdir "$LOCK" 2>/dev/null
+ HELD_LOCK=0
+}
+# a harness stopped from outside (antsy, CI's timeout) still gives the lock back
+trap 'cleanup_turn; exit 143' TERM
+trap 'cleanup_turn; exit 130' INT
+trap cleanup_turn EXIT
+
+# turn_begin NAME [WAIT_S] ... turn_end: a measurement's turn. Sets ST_START, then ST_END, ST_OTHERS (a JSON array) and
+# ST_QUIET (under QUIET at both ends and no other agent's busy job seen). The user, 2026-10-18: nobody waits for a quiet
+# machine; a row is marked with the load it was measured under, and levers are judged by paired A/Bs and by counts (CPU
+# time, allocations, frames), which hold under load. So by default there's no wait and no lock. RAEA_LIGHTSPEED_QUIET=1
+# (the nightly pass in bench/ci.sh) waits up to WAIT_S (600) for a quiet machine and takes the shared lock;
+# RAEA_LIGHTSPEED_LOCK=1 takes the lock alone (a short paired A/B).
+turn_begin() {
+ TURN_NAME=$1
+ local wait_s=${2:-600} t=0
+ if [ "${RAEA_LIGHTSPEED_QUIET:-}" = 1 ] || [ "${RAEA_LIGHTSPEED_LOCK:-}" = 1 ]; then
+ while [ "${RAEA_LIGHTSPEED_QUIET:-}" = 1 ] && awk -v l="$(load1)" -v q="$QUIET" 'BEGIN { exit !(l + 0 >= q + 0) }' && [ $t -lt "$wait_s" ]; do
+ [ $((t % 60)) = 0 ] && say "$TURN_NAME: waiting for a load under $(pyf "$QUIET") (now $(pyf "$(load1)"), $t s of $wait_s)"
+ sleep 15; t=$((t + 15))
+ done
+ t=0
+ until mkdir "$LOCK" 2>/dev/null; do
+ [ $((t % 60)) = 0 ] && say "$TURN_NAME: waiting for the measurement lock ($t s)"
+ sleep 5; t=$((t + 5))
+ done
+ HELD_LOCK=1
+ fi
+ TURN_HELD=$(date +%s)
+ ST_START=$(load1)
+ export $MARK="$$-$(date +%s)-$RANDOM"
+ watch_start
+}
+
+turn_end() {
+ unset $MARK
+ if [ "$HELD_LOCK" = 1 ]; then rmdir "$LOCK" 2>/dev/null; HELD_LOCK=0; local locked=1; else local locked=0; fi
+ ST_END=$(load1)
+ ST_OTHERS=$(watch_end)
+ # quiet only when the load stayed under the line at both ends and no other agent's busy job ran meanwhile: a run the
+ # machine got busy during isn't clean
+ if [ "$ST_OTHERS" = "[]" ] && awk -v a="$ST_START" -v b="$ST_END" -v q="$QUIET" 'BEGIN { exit !((a > b ? a : b) + 0 < q + 0) }'; then
+ ST_QUIET=true
+ else
+ ST_QUIET=false
+ fi
+ local secs=$(( $(date +%s) - TURN_HELD ))
+ [ $locked = 1 ] && [ $secs -gt 600 ] && say "$TURN_NAME: held the measurement lock $secs s (over a 10 minute turn)"
+ return 0
+}
+
+# record ROW VALUE UNIT DETAIL HARNESS: one row to results.jsonl, and its line on stdout. VALUE is JSON as Python's str()
+# writes it (12.0, "a string", null); DETAIL is JSON. The turn's ST_START, ST_END (empty: null), ST_QUIET, ST_OTHERS.
+record() {
+ local row=$1 value=$2 unit=$3 detail=$4 harness=$5
+ mkdir -p "$LOGDIR"
+ # the loads as Python's floats (sysctl's 2.00 -> 2.0)
+ local start=null end=null
+ [ -n "${ST_START:-}" ] && start=$(pyf "$ST_START")
+ [ -n "${ST_END:-}" ] && end=$(pyf "$ST_END")
+ LS_JQ -nc --arg date "$(date +%Y-%m-%dT%H:%M:%S)" --arg commit "$(commit)" --arg row "$row" --argjson value "$value" \
+ --arg unit "$unit" --argjson detail "$detail" --argjson start "$start" --argjson end "$end" \
+ --argjson quiet "${ST_QUIET:-null}" --argjson others "${ST_OTHERS:-[]}" --arg harness "$harness" \
+ '{date: $date, commit: $commit, row: $row, value: $value, unit: $unit, detail: $detail, load: {start: $start, end: $end},
+ quiet: $quiet, others: $others, harness: $harness}' >> "$RESULTS"
+ local shown q=""
+ shown=$(LS_JQ -rn --argjson v "$value" 'include "lib"; if ($v | type) == "string" then $v else $v | pystr end')
+ if [ "${ST_QUIET:-}" != true ]; then
+ q=$(jq -rn --argjson o "${ST_OTHERS:-[]}" 'if ($o | length) > 0 then " (NOT QUIET: other jobs " + ($o | join(", ")) + ")" else " (NOT QUIET)" end')
+ fi
+ say "$row: $shown $unit load $( [ "$start" = null ] && echo None || pyf "$start") -> $( [ "$end" = null ] && echo None || pyf "$end")$q"
+}
diff --git a/bench/lightspeed/quality.sh b/bench/lightspeed/quality.sh
new file mode 100644
index 00000000..bdb29518
--- /dev/null
+++ b/bench/lightspeed/quality.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+# The rows CI's gates answer, measured on this tree and quiet (docs/lightspeed.feature): Q1, Q4, T3.
+#
+# bench/lightspeed/quality.sh [--only replay,timelines,audio]
+#
+# CI's history can be many commits old or taken on a busy machine; this runs the same gates on HEAD's build, each in its
+# own turn at the lock, and reads their numbers with CI's own parser (bench/ci/record.jq):
+# replay sdk/react/bench/games/replay.sh: pong and platformer played with logged input, frames against renders
+# timelines sdk/react/bench/timelines/check.sh titles: render = baked play (SSIM), bake ms, incremental re-bake ms (T3)
+# audio sdk/react/bench/games/audio.sh: tap = bounce, loudness and true peak, clicks (Q4)
+# Q1 is the worst SSIM over replay and timelines.
+. "$(dirname "$0")/lib.sh"
+H=bench/lightspeed/quality.sh
+REACT=$ROOT/sdk/react
+
+only=replay,timelines,audio
+while [ $# -gt 0 ]; do
+ case $1 in
+ --only) only=$2; shift ;;
+ *) echo "usage: bench/lightspeed/quality.sh [--only replay,timelines,audio]" >&2; exit 2 ;;
+ esac
+ shift
+done
+
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/lightspeed-quality.XXXXXX")
+trap 'cleanup_turn; rm -rf "$TMP"' EXIT
+
+# gate NAME: runs it in its own turn; leaves $TMP/NAME.json ({status, numbers, lines, st: the turn's load and quiet})
+gate() {
+ local name=$1 tmp log t0 secs status rc
+ tmp=$(mktemp -d "${TMPDIR:-/tmp}/lightspeed-$name-XXXXXX")
+ log=$tmp/$name.log
+ turn_begin "quality:$name"
+ t0=$(date +%s)
+ case $name in
+ replay) (cd "$REACT" && TMPDIR=$tmp bash bench/games/replay.sh > "$log.out" 2> "$log.err") ;;
+ timelines) (cd "$REACT" && TMPDIR=$tmp sh bench/timelines/check.sh titles > "$log.out" 2> "$log.err") ;;
+ audio) (cd "$REACT" && TMPDIR=$tmp bash bench/games/audio.sh > "$log.out" 2> "$log.err") ;;
+ *) echo "quality: no gate $name" >&2; turn_end; return 1 ;;
+ esac
+ rc=$?
+ secs=$(( $(date +%s) - t0 ))
+ turn_end
+ cat "$log.out" "$log.err" > "$log"
+ status=PASS; [ $rc = 0 ] || status=FAIL
+ CI_DATE=$(date +%Y-%m-%dT%H:%M:%S) CI_COMMIT="" CI_TIER=lightspeed \
+ jq -nc --arg gate "$name" --arg status $status --arg secs "$secs" --arg log "$log" --rawfile text "$log" \
+ -f "$ROOT/bench/ci/record.jq" > "$TMP/$name.rec"
+ jq -c --arg s "$ST_START" --arg e "$ST_END" --argjson q "$ST_QUIET" --argjson o "$ST_OTHERS" \
+ '{status, numbers: (.numbers // {}), lines: (.lines // []), st: {start: $s, end: $e, quiet: $q, others: $o}}' "$TMP/$name.rec" > "$TMP/$name.json"
+ say "$name: $status $(jq -r '.lines[:4] | join(" | ")' "$TMP/$name.json")"
+ rm -rf "$tmp"
+}
+
+# use_st NAME: the turn of gate NAME is the one a row records
+use_st() {
+ ST_START=$(jq -r .st.start "$TMP/$1.json"); ST_END=$(jq -r .st.end "$TMP/$1.json")
+ ST_QUIET=$(jq -c .st.quiet "$TMP/$1.json"); ST_OTHERS=$(jq -c .st.others "$TMP/$1.json")
+}
+
+IFS=, read -r -a gates <<< "$only"
+for g in "${gates[@]}"; do gate "$g" || exit 1; done
+got() { [ -f "$TMP/$1.json" ]; }
+
+if got replay || got timelines; then
+ # every gate run, in the order run (the detail's status lists them all)
+ q1=$(for g in "${gates[@]}"; do got "$g" && jq -c --arg g "$g" '{($g): .}' "$TMP/$g.json"; done | LS_JQ -sc 'include "lib"; add as $got
+ | [("replay", "timelines") as $g | select($got[$g]) | $got[$g].numbers | to_entries[]
+ | select((.value | type) == "object" and (.value | has("worst_ssim"))) | [.value.worst_ssim, "\($g):\(.key)"]] as $ss
+ | if ($ss | length) == 0 then null else ($ss | min) as $w
+ | {value: ("\($w[0] | fixed(6)) (\($w[1]))"), detail: {all: $ss, status: ($got | map_values(.status))}} end')
+ if [ "$q1" != null ]; then
+ if got replay; then use_st replay; else use_st timelines; fi
+ record Q1 "$(echo "$q1" | jq -c .value)" "worst SSIM, replay + timelines on HEAD" "$(echo "$q1" | jq -c .detail)" $H
+ fi
+fi
+if got timelines; then
+ use_st timelines
+ record T3 "$(LS_JQ -c 'include "lib"; "\(.numbers.titles.bake_ms | pystr) / \(.numbers.titles_edited.incremental.ms | pystr)"' "$TMP/timelines.json")" \
+ "ms bake / incremental re-bake (titles)" "$(jq -c '{numbers, lines}' "$TMP/timelines.json")" $H
+fi
+if got audio; then
+ use_st audio
+ record Q4 "$(LS_JQ -c 'include "lib"; "\(.status) (pong live \(.numbers.pong.live_lufs | pystr) / render \(.numbers.pong.render_lufs | pystr) LUFS, clicks \(.numbers.tones.live_clicks | pystr))"' "$TMP/audio.json")" \
+ "audio gate on HEAD" "$(jq -c '{numbers, lines}' "$TMP/audio.json")" $H
+fi
+exit 0
diff --git a/bench/lightspeed/record.jq b/bench/lightspeed/record.jq
new file mode 100644
index 00000000..3c30debb
--- /dev/null
+++ b/bench/lightspeed/record.jq
@@ -0,0 +1,71 @@
+# One gate's result as a JSON line, with the key numbers read from its log (bench/ci.sh runs this after each gate):
+# jq -nc --arg gate GATE --arg status STATUS --arg secs SECONDS --arg log LOG --rawfile text LOG|/dev/null \
+# -f bench/ci/record.jq (env: CI_DATE, CI_COMMIT, CI_TIER, CI_LOAD_START, CI_LOAD_END, CI_QUIET, RETRY)
+# STATUS is PASS, FAIL, FLAKY or SKIP. The numbers are whatever the gate's PASS/FAIL lines carry (frame time p99s,
+# SSIMs, loudness, failing counts, test counts); "lines" keeps those lines verbatim.
+# (jq's regexes are Oniguruma's Ruby syntax: ^ and $ match at every line, and . never crosses a newline.)
+
+def num: try tonumber catch null;
+def int: tonumber;
+# every match's capture groups, as strings (null for a group that didn't take part)
+# Python's re.M: a leading ^ and a trailing $ hold at every line
+def ml: sub("^\\^"; "(?:\\A|(?<=\\n))") | sub("\\$$"; "(?=\\n|\\z)");
+def groups($re): [$text | match($re | ml; "g") | [.captures[].string]];
+def first_groups($re): (groups($re) | .[0]) // null;
+# Python's round(x, 1): half to even on x's exact value (fma takes x * 10 - the tie without rounding)
+def round1: . as $x | ($x * 10 | floor) as $f | fma($x; 10; -($f + 0.5)) as $r
+ | (if $r > 0 then $f + 1 elif $r < 0 then $f elif ($f % 2) == 0 then $f else $f + 1 end) / 10;
+
+# Python's splitlines, then rstrip
+([$text | splits("\r\n|[\n\r\u000b\u000c\u001c\u001d\u001e\u0085\u2028\u2029]")] | if last == "" then .[:-1] else . end | map(sub("\\s+$"; ""))) as $all
+| [$all[] | select(test("\\b(PASS|FAIL|FAILED|REGRESSIONS|SKIP)\\b|^gate: |^frames: |failed \\(see|test result:"))] as $lines
+| if ($gate | startswith("unit:")) or ($gate | startswith("build:")) then
+ ([groups("test result: \\w+\\. (\\d+) passed")[] | .[0] | int] | add // 0) as $p
+ | ([groups("(\\d+) failed;")[] | .[0] | int] | add // 0) as $fl
+ | (if $p > 0 or $fl > 0 then {passed: $p, failed: $fl} else {} end)
+ | (groups("Finished `release` profile .* in (?:(\\d+)m )?([0-9.]+)s") | last) as $m
+ | if $m then .cargo_s = ((($m[0] // "0") | int) * 60 + ($m[1] | int) | round1) else . end
+ | {num: ., lines: $lines}
+ elif $gate | startswith("games") then
+ {num: (reduce groups("^(\\w+): (PASS|FAIL)\\s+frames (\\d+) presented, (\\d+) missed; work p99 ([0-9.]+) ms.*?; input p99 ([0-9.]+) frames.*?; rss .*?\\(max (\\d+)\\)")[] as $g
+ ({}; .[$g[0]] = {presented: ($g[2] | int), missed: ($g[3] | int), work_p99_ms: ($g[4] | num),
+ input_p99_frames: ($g[5] | num), rss_max_mb: ($g[6] | int)})), lines: $lines}
+ elif $gate == "replay" then
+ {num: (reduce groups("^(PASS|FAIL) (\\w+):.*\\(worst ([0-9.]+)")[] as $g ({}; .[$g[1]] = {worst_ssim: ($g[2] | num)})), lines: $lines}
+ elif $gate == "audio" then
+ {num: ({}
+ | (first_groups("pong: \\w+\\s+live (-?[0-9.]+) LUFS, true peak (-?[0-9.]+) dBTP; render (-?[0-9.]+) LUFS") as $m
+ | if $m then .pong = {live_lufs: ($m[0] | num), live_true_peak: ($m[1] | num), render_lufs: ($m[2] | num)} else . end)
+ | (first_groups("tones: \\w+\\s+live clicks (\\d+) \\(render (\\d+)\\)") as $m
+ | if $m then .tones = {live_clicks: ($m[0] | int), render_clicks: ($m[1] | int)} else . end)), lines: $lines}
+ elif $gate == "tone" then
+ {num: (reduce groups("^(\\w+): (PASS|FAIL)\\s+bounce vs live max diff (\\S+) over ([0-9.]+) s")[] as $g
+ ({}; .[$g[0]] = {max_diff: ($g[2] | num), seconds: ($g[3] | num)})
+ | (first_groups("ducking: \\w+\\s+the music under the voice (-?[0-9.]+) dB") as $m | if $m then .ducking_db = ($m[0] | num) else . end)),
+ lines: $lines}
+ elif $gate == "timelines" then
+ {num: (reduce ($text | match("^([\\w, ]+?): (PASS|FAIL) .*\\(worst ([0-9.]+)\\)(?:; opened and baked in (\\d+) ms)?" | ml; "g")) as $m ({};
+ ([$m.captures[].string]) as $g
+ | ({worst_ssim: ($g[2] | num)}
+ | if $g[3] then .bake_ms = ($g[3] | int) else . end
+ | (first(($m.string | match("\\((\\d+) of (\\d+) frames stepped, (\\d+) ms\\)")) | [.captures[].string]) // null) as $inc
+ | if $inc then .incremental = {stepped: ($inc[0] | int), of: ($inc[1] | int), ms: ($inc[2] | int)} else . end) as $e
+ | .[$g[0] | gsub(", "; "_") | gsub(" "; "_")] = $e)), lines: $lines}
+ elif $gate | startswith("video") then
+ {num: (reduce groups("^([\\w.-]+): (PASS|FAIL)\\s+scrub p99 ([0-9.]+) ms.*?missed (\\d+) of (\\d+).*?drift max ([0-9.]+|none).*?rss max (\\d+)")[] as $g
+ ({}; .[$g[0]] = {scrub_p99_ms: ($g[2] | num), missed: ($g[3] | int), presented: ($g[4] | int),
+ drift_max_ms: ($g[5] | num), rss_max_mb: ($g[6] | int)})), lines: $lines}
+ elif $gate == "substrate" then
+ {num: {failing: (first_groups("^gate: (\\d+) failing") | if . then .[0] | int else null end),
+ passing: ([$text | match("^PASS " | ml; "g")] | length)}, lines: $lines}
+ elif $gate | startswith("parity") then
+ ([groups("^ (\\S+ @[0-9.]+s: [0-9.]+ -> [0-9.]+)$")[] | .[0]]) as $regs
+ | {num: (first_groups("frames: (\\d+) exact, (\\d+) ok, (\\d+) fail; cases without result: (\\d+)") as $m
+ | (if $m then {exact: ($m[0] | int), ok: ($m[1] | int), fail: ($m[2] | int), no_result: ($m[3] | int)} else {} end)
+ | .regressions = ($regs | length)),
+ lines: ([$lines[] | select(contains("--") | not)] + $regs[:20])}
+ else {num: {}, lines: $lines} end
+| {date: $ENV.CI_DATE, at: (now | strftime("%Y-%m-%dT%H:%M:%SZ")), commit: $ENV.CI_COMMIT, tier: $ENV.CI_TIER,
+ gate: $gate, status: $status, attempt: (if ($ENV.RETRY // "") != "" then 2 else 1 end), seconds: ($secs | tonumber | round1),
+ load: {start: ($ENV.CI_LOAD_START | num), end: ($ENV.CI_LOAD_END | num)},
+ quiet: ({"true": true, "false": false}[$ENV.CI_QUIET // ""]), numbers: .num, lines: .lines[:40], log: $log}
diff --git a/bench/lightspeed/scoreboard.jq b/bench/lightspeed/scoreboard.jq
new file mode 100644
index 00000000..bf16f09a
--- /dev/null
+++ b/bench/lightspeed/scoreboard.jq
@@ -0,0 +1,155 @@
+# lightspeed's scoreboard (docs/lightspeed.feature, L0): every row's newest value, its target, the gap and the trend.
+# bench/scoreboard.sh runs it:
+# jq -nr -L bench/lightspeed --rawfile results R --rawfile ci C --argjson evals E --argjson behind B --arg json 0|1 \
+# -f bench/lightspeed/scoreboard.jq
+# R: ~/Library/Logs/raea/lightspeed/results.jsonl; C: ~/Library/Logs/raea/ci/history.jsonl; E: the legacy app's newest eval run (retired with apps/legacy: null)
+# ({file, rows}, or null); B: {commit: commits HEAD is past it} for the CI rows' commits. Sources, newest first:
+# results.jsonl the lightspeed harnesses (bench/lightspeed/*.sh): each row's newest value, marked "under load N" when
+# the machine was busy, with its newest quiet value beside it (bench/ci.sh's nightly quiet pass)
+# history.jsonl bench/ci.sh's gates (Q1, Q2, Q4, T3): quiet results only, marked STALE more than 10 commits behind
+# HEAD; quality.sh's newer quiet run of the same gate on this tree wins
+# evals the legacy app's newest eval run (Q6; retired with apps/legacy, so null)
+# carried the value in lightspeed.feature, for a row no harness could measure yet (the phone locked, say),
+# marked as carried
+# Rows are ranked by gap weighted by how much a person feels them (feel 4, throughput 3, resources 2, quality 1); a row
+# whose newest quiet value is >10% worse than the one before it is flagged REGRESSED.
+include "lib";
+
+# a JSON line a line; a line that isn't JSON is skipped
+def lines: [split("\n")[] | fromjson? | select(type == "object")];
+# the first number in a value's text, as a float
+def num: pystr | [match("-?\\d+(?:\\.\\d+)?") | .string] | if length == 0 then null else .[0] | tonumber end;
+# Python's str() of a value as the scoreboard shows it
+def show: if type == "string" then . else pystr end;
+def ljust($n): . + ([range([$n - length, 0] | max)] | map(" ") | join(""));
+def rjust($n): ([range([$n - length, 0] | max)] | map(" ") | join("")) + .;
+
+# row: [title, target text, target number (null: none), lower is better]; the number the gap is judged on is value($row)
+def ROWS: [
+ ["F1", "input to present p99 (offscreen; window needs consent)", "<= 1 refresh + 1 frame (25 ms at 60 Hz)", 25.0, true],
+ ["F2", "frame work p99 / p99.9, games 120 fps", "p99.9 <= 4 ms", 4.0, true],
+ ["F3", "missed frames, pong + platformer", "0", 0.0, true],
+ ["F4", "scrub p99, 1080p / 4K", "<= 16.7 / 33 ms", 1.0, true],
+ ["F5.game", "spawn to first frame: game", "< 100 ms", 100.0, true],
+ ["F5.timeline", "spawn to first frame: timeline (bake inside)", "< 100 ms", 100.0, true],
+ ["F5.bake", "timeline bake (titles)", "< 100 ms", 100.0, true],
+ ["F6", "first-use hitches over 2 ms", "none", 0.0, true],
+ ["T1", "ts1 export, warm", "<= 1 s", 1.0, true],
+ ["T2", "3D export, 600 frames", "<= 1 s", 1.0, true],
+ ["T3", "bake 20 s edit / incremental re-bake", "<= 50 / 10 ms", 1.0, true],
+ ["T4", "batch renders per hour (titles)", "encoder-bound on every core", 1.0, true],
+ ["R1", "bytes allocated a frame after warmup", "0 every layer", 0.0, true],
+ ["R2", "GC collections during play", "0", 0.0, true],
+ ["R4", "GPU memory per stage", "1 texture per page (~4-8 MB)", 1.0, true],
+ ["R5", "iPhone peak footprint", "<= 200 MB", 200.0, true],
+ ["R7", "exported game size", "<= 65 MB", 65.0, true],
+ ["R6", "CPU watts pong / timeline", "pong halved", null, true],
+ ["Q1", "render = play, worst SSIM", "1.000000 everywhere", 1.0, false],
+ ["Q2", "Chrome parity exact / ok / fail", "all exact", 1.0, false],
+ ["Q3.vmaf", "export VMAF vs lossless (ts1)", ">= 95 (mean and worst)", 95.0, false],
+ ["Q3.colour", "colour patches after encode, worst 8-bit error", "BT.709 exact (0)", 0.0, true],
+ ["Q4", "audio tap = bounce, LUFS, peak, clicks", "exact, -14, 0 clicks", 1.0, false],
+ ["Q5", "Mac = iPhone, byte for byte", "byte-identical", 0.0, true],
+ ["Q6", "agent first-try pass rate", "measured nightly; rising", 1.0, false]
+];
+def WEIGHT: {"F": 4, "T": 3, "R": 2, "Q": 1};
+def CARRIED: {"R7": ["66.77 MB", "sdk/react/bench/games/export.sh app_MB, 9012fdc (2026-10-18)"],
+ "R5": ["373 MB", "sdk/react/ios probe, 4279d3f (2026-10-17)"],
+ "Q5": ["frame 0 exact; glyph edges <= 14/255", "sdk/react/ios probe, 4279d3f"]};
+# a dict's key a Python lambda would index: missing is an error (the gap is then None)
+def key($k): if type == "object" and has($k) then .[$k] else error("KeyError") end;
+
+# the number a row's gap is judged on (an error where Python's lambda raised)
+def value($row):
+ if $row == "F2" then (.value | show | split("/")) as $p | if ($p | length) < 2 then error("IndexError") else $p[1] | num end
+ elif $row == "F4" then key("detail") as $d
+ | [(($d.ts1 // {}).scrub_p99_ms // 0) / 16.7, (($d.k4 // {}).scrub_p99_ms // 0) / 33] | max
+ elif $row == "T3" then key("n") | [.[0] / 50, .[1] / 10] | max
+ elif $row == "T4" then key("detail") | key("cores") / ([key("scaling_vs_1"), 0.01] | max)
+ elif $row == "R4" then [key("detail")[] | key("graphics_mb")] | max / 8
+ elif $row == "Q3.vmaf" then key("detail") | key("min")
+ elif ($row | IN("Q1", "Q2", "Q4", "Q6")) then key("n")
+ else .value | num end;
+
+def gap($row):
+ (ROWS[] | select(.[0] == $row)) as [$_, $title, $target, $tnum, $lower]
+ | (try value($row) catch null) as $v
+ | if $v == null or $tnum == null then null
+ elif $lower then (if $tnum == 0 then (if $v > 0 then 1.0 + $v else 1.0 end) else [$v / $tnum, 1.0] | max end)
+ elif $v != 0 then [$tnum / $v, 1.0] | max else 99.0 end;
+
+($results | lines) as $res
+# each row's newest value, quiet or under load (the user, 2026-10-18: rows are marked with their load, not held for a
+# quiet machine), and its newest quiet one beside it when that's older (the nightly pass confirms them)
+| (reduce $res[] as $r ({best: {}, prev: {}, quiet: {}};
+ (if .best[$r.row] then .prev[$r.row] = .best[$r.row] else . end)
+ | .best[$r.row] = $r
+ | if $r.quiet then .quiet[$r.row] = $r else . end)) as $s
+| ($s.best | map_values(. + {src: ((.harness // "") | split("/") | last)})) as $rows0
+# CI's gates: quiet results only (a gate timed on a busy machine says nothing about the code), the newest a gate
+| (reduce ($ci | lines)[] as $r ({}; if $r.quiet != false then .[$r.gate] = $r else . end)) as $latest
+| ({}
+ | ($latest.timelines) as $tl
+ | if $tl and (($tl.numbers // {}) | length) > 0 then
+ ($tl.numbers.titles.bake_ms) as $bake | ($tl.numbers.titles_edited.incremental.ms) as $inc
+ | if $bake != null and $inc != null then
+ .T3 = {value: "\($bake | pystr) / \($inc | pystr)", unit: "ms (titles; CI)", n: [$bake, $inc], date: $tl.date,
+ commit: $tl.commit[:9], quiet: $tl.quiet, src: "ci timelines"} else . end
+ else . end
+ | ([("replay", "timelines") as $g | $latest[$g] | select(. and ((.numbers // {}) | length) > 0) as $r
+ | $r.numbers | to_entries[] | select((.value | type) == "object" and (.value | has("worst_ssim")))
+ | [.value.worst_ssim, "\($g):\(.key)", $r]]) as $ss
+ | if ($ss | length) > 0 then ($ss | min_by(.[0:2])) as $w
+ | .Q1 = {value: "\($w[0] | fixed(6)) (\($w[1]))", unit: "worst SSIM over CI's replay and timelines", n: $w[0],
+ date: $w[2].date, commit: $w[2].commit[:9], quiet: $w[2].quiet, src: "ci"} else . end
+ | ([$latest | to_entries[] | select(.key | startswith("parity:")) | .value]) as $par
+ | if ($par | length) > 0 then
+ ([$par[] | .numbers.exact // 0] | add) as $e | ([$par[] | .numbers.ok // 0] | add) as $o | ([$par[] | .numbers.fail // 0] | add) as $f
+ | .Q2 = {value: "\($e) / \($o) / \($f)", unit: "exact / ok / fail (\([$par[].gate] | sort | join(", ")))",
+ n: ($e / ([$e + $o + $f, 1] | max)), date: ([$par[].date] | max), commit: $par[-1].commit[:9],
+ quiet: (all($par[]; .quiet)), src: "ci"} else . end
+ | ($latest.audio) as $a
+ | if $a then ($a.numbers // {}) as $n
+ | .Q4 = {value: "\($a.status) (pong live \($n.pong.live_lufs | pystr) / render \($n.pong.render_lufs | pystr) LUFS, clicks \($n.tones.live_clicks | pystr))",
+ unit: "CI audio gate", n: (if $a.status == "PASS" then 1.0 else 0.5 end), date: $a.date, commit: $a.commit[:9],
+ quiet: $a.quiet, src: "ci"} else . end) as $from_ci
+| (if $evals == null then {} else
+ ([$evals.rows[] | select(type == "object" and has("pass") and (.infra | not))]) as $rs
+ | if ($rs | length) == 0 then {} else ([$rs[] | select(.pass)] | length) as $p | ([$rs[] | .cost_usd // 0] | add) as $cost
+ | {Q6: {value: "\($p)/\($rs | length) pass", unit: "\($evals.file), $\($cost | fixed(2))", n: ($p / ($rs | length)),
+ date: "", commit: "", quiet: true, src: "legacy evals"}} end end) as $from_evals
+| (reduce (($from_ci + $from_evals) | to_entries[]) as $e ($rows0;
+ .[$e.key] as $mine
+ | if $mine and $mine.quiet and (($mine.date // "") >= (($e.value.date // "")[:19])) then . # quality.sh measured it on this tree since
+ else ($behind[$e.value.commit // ""]) as $b
+ | .[$e.key] = ($e.value | if $b != null and $b > 10 then .stale = $b else . end) end)) as $rows1
+| (reduce (CARRIED | to_entries[]) as $c ($rows1;
+ if has($c.key) then . else .[$c.key] = {value: $c.value[0], unit: "", quiet: true, src: "carried: \($c.value[1])", carried: true, date: "", commit: ""} end)) as $rows
+| [ROWS[] as [$row, $title, $target] | $rows[$row] as $r
+ | if $r == null then {score: 0, row: $row, title: $title, value: "UNMEASURED", target: $target, gap: "", notes: ""}
+ else (if $r.carried then null else $r | gap($row) end) as $g
+ | (if $g then WEIGHT[$row[0:1]] * ($g | log2) else 0 end) as $score
+ | ([ (if ($r.quiet | not) and ($r.load // {}).start != null then
+ "under load \([$r.load.start, ($r.load.end // 0)] | max | fixed(0))",
+ ($s.quiet[$row] | select(.) | "(quiet \(.value | show), \(.date[:10]))")
+ else empty end),
+ (if $r.carried then "CARRIED" else empty end),
+ (if $r.stale then "STALE (\($r.stale) commits behind HEAD)" else empty end),
+ (if $s.prev[$row] then ($s.prev[$row] | gap($row)) as $g0
+ | if $g and $g0 and $g > $g0 * 1.1 then "REGRESSED (was \($s.prev[$row].value | show))"
+ elif $g and $g0 and $g < $g0 / 1.1 then "improved (was \($s.prev[$row].value | show))" else empty end
+ else empty end) ]) as $flag
+ # r.get("unit", ""): a key that's there with null shows None
+ | ("\($r.value | show) \(if $r | has("unit") then $r.unit | show else "" end)" | sub("^\\s+"; "") | sub("\\s+$"; "")) as $val
+ | ("\(($r.date // "")[:16]) \(if $r | has("commit") then $r.commit | show else "" end)" | sub("^\\s+"; "") | sub("\\s+$"; "")) as $when
+ | {score: $score, row: $row, title: $title, value: $val, target: $target, gap: (if $g then "x\($g | fixed(1))" else "-" end),
+ notes: (($flag | join(" ")) + (if ($flag | length) > 0 then " " else "" end) + "[\($r.src)\(if $when != "" then " " + $when else "" end)]")}
+ end] as $table
+| if $json == "1" then $table
+ else ($table | sort_by(-.score)) as $sorted
+ | ([$table[] | select(.value == "UNMEASURED") | .row]) as $um
+ | ("row" | ljust(15)) + " " + ("gap" | rjust(6)) + " " + ("score" | rjust(5)) + " " + ("value" | ljust(58)) + " target",
+ ($sorted[] | (.row | ljust(15)) + " " + (.gap | rjust(6)) + " " + (.score | fixed(1) | rjust(5)) + " " + (.value[:58] | ljust(58)) + " " + .target,
+ ("" | ljust(15)) + " " + ("" | rjust(6)) + " " + ("" | rjust(5)) + " " + .title + " " + .notes),
+ "\n\(($table | length) - ($um | length)) of \($table | length) rows have a value" + (if ($um | length) > 0 then "; unmeasured: \($um | join(", "))" else "" end)
+ end
diff --git a/bench/lightspeed/startup.sh b/bench/lightspeed/startup.sh
new file mode 100644
index 00000000..63830621
--- /dev/null
+++ b/bench/lightspeed/startup.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+# F5, open to first frame (docs/lightspeed.feature; its legacy-app rows and R3 retired with apps/legacy).
+#
+# bench/lightspeed/startup.sh [--runs 5]
+#
+# Every time is measured from the moment the harness spawns the process (or sends the open) to the end of the first
+# frame's present, on a quiet machine at the shared lock:
+# motion open, game raea play pong --offscreen: spawn to frame 0 presented (play's first_frame_unix_ms
+# less `raea ci time`'s clock just before the spawn)
+# motion open, timeline the same for titles played from its bake (--baked), so the bake is inside it
+# timeline bake the baked play's open_ms alone (React stepped through every frame, the bake written)
+. "$(dirname "$0")/lib.sh"
+H=bench/lightspeed/startup.sh
+GAMES=$ROOT/sdk/react/bench/games
+TIMELINES=$ROOT/sdk/react/bench/timelines
+
+runs=5
+while [ $# -gt 0 ]; do
+ case $1 in
+ --runs) runs=$2; shift ;;
+ *) echo "usage: bench/lightspeed/startup.sh [--runs N]" >&2; exit 2 ;;
+ esac
+ shift
+done
+
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/lightspeed-startup.XXXXXX")
+trap 'cleanup_turn; rm -rf "$TMP"' EXIT
+
+# motion_first_frame EDIT BAKED: prints "first_ms open_ms"
+motion_first_frame() {
+ local edit=$1 baked=$2 out=$TMP/play.json clock=$TMP/clock.json
+ rm -f "$out"
+ local extra=""
+ [ "$baked" = 1 ] && extra=--baked
+ RAEA_AUDIO_MUTE=1 "$MOTION" ci time --to "$clock" -- "$MOTION" play "$edit" $extra --offscreen --size 1280x720 --seconds 0.5 \
+ --json "$out" > "$TMP/play.log" 2> "$TMP/play.err"
+ if [ $? != 0 ] || [ ! -f "$out" ]; then
+ say_tail "$edit: play failed: " 400 "$TMP/play.err" >&2; exit 1
+ fi
+ jq -r --slurpfile c "$clock" 'if .first_frame_unix_ms then "\(.first_frame_unix_ms - $c[0].start_unix_ms) \(.open_ms)"
+ else "none" end' "$out" | { read -r a b; [ "$a" = none ] && { echo "raea has no first_frame_unix_ms: rebuild it" >&2; exit 1; }; echo "$a $b"; } || exit 1
+}
+
+# summary: {"p50", "max", "runs"} of the numbers on stdin, one a line
+summary() { LS_JQ -sc 'include "lib"; {p50: (pct(0.5) | pyround(1)), max: (max | pyround(1)), runs: map(pyround(1))}'; }
+
+pong=$GAMES/pong/edit.tsx; titles=$TIMELINES/titles/edit.tsx
+r=$(motion_first_frame "$pong" 0) || exit 1 # warm the file cache and the shader cache: F5 is the warm open
+: > "$TMP/game"; : > "$TMP/tl"
+turn_begin startup:motion
+for _ in $(seq 1 "$runs"); do r=$(motion_first_frame "$pong" 0) || exit 1; echo "${r% *}" >> "$TMP/game"; done
+for _ in $(seq 1 "$runs"); do r=$(motion_first_frame "$titles" 1) || exit 1; echo "$r" >> "$TMP/tl"; done
+turn_end
+game=$(summary < "$TMP/game")
+tl=$(awk '{print $1}' "$TMP/tl" | summary)
+bake=$(awk '{print $2}' "$TMP/tl" | summary)
+p50() { LS_JQ -r 'include "lib"; .p50 | pyf'; }
+record F5.game "$(echo "$game" | p50)" ms "$game" $H
+record F5.timeline "$(echo "$tl" | p50)" ms "$tl" $H
+record F5.bake "$(echo "$bake" | p50)" ms "$bake" $H
diff --git a/bench/lightspeed/t3d600/edit.tsx b/bench/lightspeed/t3d600/edit.tsx
new file mode 100644
index 00000000..31101fce
--- /dev/null
+++ b/bench/lightspeed/t3d600/edit.tsx
@@ -0,0 +1,30 @@
+// T3D600: a lit cube turning under moving text, 1080x1920 at 30 fps for 600 frames, lightspeed T2's 3D export
+// fixture (bench/lightspeed/export.sh); the 60-frame t3d it grew from is the same scene
+
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { Quat, Transform } from "raea/transform";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Camera3d } from "raea/camera";
+function Edit() {
+ const f = useCurrentFrame();
+ return (
+ <AbsoluteFill style={{ background: "#202040" }}>
+ <div style={{ position: "absolute", left: 0, top: 0, width: 1080, height: 1920 }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 0, 6).lookingAt([0, 0, 0])} projection={{ Perspective: { fov: 0.872664625997165 } }} />
+ <AmbientLight brightness={160} />
+ <DirectionalLight transform={Transform.fromXyz(2, 3, 4).lookingAt([0, 0, 0])} illuminance={24000} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(0, 0, 0).withRotation(Quat.fromEuler("XYZ", f * 0.05, f * 0.08, 0))}>
+ <Cuboid half_size={[1, 1, 1]} />
+ <StandardMaterial base_color="#e05030" />
+ </Mesh3d>
+ </>
+ </div>
+ <div style={{ position: "absolute", left: 100, top: 300 + (f % 300) * 4, fontSize: 120, color: "white", fontFamily: "Helvetica" }}>Hello {f}</div>
+ </AbsoluteFill>
+ );
+}
+registerRoot(() => <Composition id="t3d600" component={Edit} width={1080} height={1920} fps={30} durationInFrames={600} />);
diff --git a/bench/p26-baseline/binary.json b/bench/p26-baseline/binary.json
new file mode 100644
index 00000000..3a80f49f
--- /dev/null
+++ b/bench/p26-baseline/binary.json
@@ -0,0 +1 @@
+{"binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","head":"8b812636","date":"2026-10-23T00:43:53Z","dylib_sha256":"cd2ef7c1f26ad10be8d76744520b9ada98f8b7738370c53537e8eaf100351623","dylib_note":"rebuilt 10-22 with the run bundler fixes (exports subpaths, media imports); it resolves imports only, the first capture used libraea_bundle.capture1.dylib"}
diff --git a/bench/p26-baseline/capture.sh b/bench/p26-baseline/capture.sh
new file mode 100755
index 00000000..064114b0
--- /dev/null
+++ b/bench/p26-baseline/capture.sh
@@ -0,0 +1,106 @@
+#!/bin/bash
+# P26's baseline (docs/ts-native.feature P26): frames of every composition in list.txt rendered by the Blitz page, the
+# reference the bevy_ui page must match (SSIM >= 0.98 per frame, fonts and brand styles included).
+#
+# bench/p26-baseline/capture.sh [RAEA_BIN] (default: the Blitz build kept at
+# ~/Library/Caches/raea/p26-baseline/bin, P26_STORE to move it)
+#
+# For each composition: its length probed (getCompositions, through `raea run`), nine frames rendered with
+# --manifest (0 to the last, evenly), and four kept: the first, the middle, the last and the one with the most text in
+# its manifest (a composition whose length couldn't be probed is taken as 60 frames: probed false). Kept under $P26_STORE/frames/<slug>/<frame>.png (not in git: the frames are 89 MB; each one's sha256 is in the manifest), each listed in
+# manifest.jsonl with the composition, frame, why it was kept, the PNG's sha256 and the binary's. Failures go to failures.txt.
+# ONLY=substring limits the list (LIST=file takes the compositions from a file instead): the other compositions'
+# entries in manifest.jsonl and failures.txt are kept and the listed ones replaced. Runs one render at a time (the GPU
+# is shared). A composition's props, if it takes any, come from props/<slug>/wrap.tsx, a wrapper giving it its documented example props.
+set -uo pipefail
+HERE=$(cd "$(dirname "$0")" && pwd)
+. "$HERE/lib.sh"
+ROOT=$(cd "$HERE/../.." && pwd)
+# the baseline's home outside the checkout and /tmp (Blitz is deleted at P27, so it can't be made again): the Blitz
+# binary and its libraea_bundle.dylib under bin/, the frames under frames/
+STORE=${P26_STORE:-$HOME/Library/Caches/raea/p26-baseline}
+BIN=${1:-$STORE/bin/raea-motion}
+[ -x "$BIN" ] || { echo "capture.sh: no raea at $BIN" >&2; exit 2; }
+SHA=$(shasum -a 256 "$BIN" | cut -d' ' -f1)
+BIN_SHOWN="~${BIN#"$HOME"}"; [ "${BIN#"$HOME"}" = "$BIN" ] && BIN_SHOWN=$BIN
+OUT=$STORE/frames
+WORK=$(mktemp -d "${TMPDIR:-/tmp}/p26-baseline.XXXXXX")
+trap 'rm -rf "$WORK"' EXIT
+mkdir -p "$OUT"
+LIST=${LIST:-$HERE/list.txt}
+touch "$HERE/manifest.jsonl" "$HERE/failures.txt"
+# the compositions this run takes, and the earlier entries kept (everything else's)
+picked=$(grep -v '^$' "$LIST" | { [ -n "${ONLY:-}" ] && grep -F -- "$ONLY" || cat; })
+if [ -z "${ONLY:-}" ] && [ "$LIST" = "$HERE/list.txt" ]; then
+ : > "$HERE/manifest.jsonl"; : > "$HERE/failures.txt"
+else
+ for f in manifest.jsonl failures.txt; do
+ while read -r rel; do
+ [ -n "$rel" ] || continue
+ rel=${rel%% #*}; rel=${rel%% @*}
+ grep -v -F -- "\"composition\":\"$rel\"" "$HERE/$f" | grep -v -F -- "$rel:" > "$WORK/keep" || true
+ cat "$WORK/keep" > "$HERE/$f"
+ done <<< "$picked"
+ done
+ while read -r rel; do rel=${rel%% #*}; rel=${rel%% @*}; slug=$(echo "$rel" | sed 's#/#__#g; s#\.tsx#@#; s#@$##; s#@\##@#'); [ -n "$rel" ] && rm -rf "$OUT/$slug"; done <<< "$picked"
+fi
+[ -f "$HERE/binary.json" ] && [ -n "${ONLY:-}${LIST#$HERE/list.txt}" ] || echo "{\"binary\":\"$BIN_SHOWN\",\"sha256\":\"$SHA\",\"dylib_sha256\":\"$(shasum -a 256 "$(dirname "$BIN")/libraea_bundle.dylib" 2>/dev/null | cut -d' ' -f1)\",\"head\":\"$(git -C "$ROOT" rev-parse --short HEAD)\",\"date\":\"$(date -u +%FT%TZ)\"}" > "$HERE/binary.json"
+n=0
+while read -r rel; do
+ [ -z "$rel" ] && continue
+ # list.txt's "path # excluded: why": listed in failures.txt with its reason, not rendered
+ if [[ "$rel" == *"# excluded:"* ]]; then
+ echo "${rel%% #*}: EXCLUDED ${rel##*# excluded: }" >> "$HERE/failures.txt"
+ echo "skip ${rel%% #*}"
+ continue
+ fi
+ # "path @A,B,C": frames to keep besides the four (a screen's picture, a cut's busiest moment)
+ asked=""
+ if [[ "$rel" == *" @"* ]]; then asked=${rel##* @}; rel=${rel%% @*}; fi
+ p26_src "$rel"
+ # its length: the first registered composition's, else its `config`, else the CLI's default (60 frames)
+ cat > "$WORK/probe.ts" <<EOF
+import * as M from "$src";
+import { getCompositions } from "raea";
+import { native } from "raea/native";
+export default function () {
+ const c: any = getCompositions().find((x: any) => "$comp" === "" || x.id === "$comp") ?? null;
+ const cfg: any = (M as any).config ?? {};
+ native("print" as never, { text: "P26PROBE " + JSON.stringify({ id: c?.id ?? null, frames: c?.durationInFrames ?? cfg.durationInFrames ?? 60 }) } as never);
+}
+EOF
+ probe=$(cd "$dir" && "$BIN" run "$WORK/probe.ts" 2>&1 | grep -o 'P26PROBE .*' | head -1 | cut -d' ' -f2-)
+ total=$(echo "$probe" | jq -r '.frames // 60' 2>/dev/null)
+ # unprobed: the script bundler couldn't take it (a subpath only the render bundler has); its length is the default
+ probed=$([ -n "$probe" ] && echo true || echo false)
+ [[ "$total" =~ ^[0-9]+$ ]] || total=60
+ [ "$total" -lt 1 ] && total=1
+ last=$((total - 1))
+ cands=$({ for i in 0 1 2 3 4 5 6 7 8; do echo $((last * i / 8)); done; echo "$asked" | tr ',' '\n' | grep . | awk -v l=$last '$1 <= l'; } | sort -n | awk '!seen[$0]++' | paste -sd, -)
+ rm -rf "$WORK/r" && mkdir -p "$WORK/r"
+ if ! (cd "$dir" && "$BIN" render "$src" ${copt[@]+"${copt[@]}"} --at "$cands" -o "$WORK/r/" --manifest "$WORK/r/m.json") > "$WORK/log" 2>&1; then
+ echo "$rel: $(grep -E 'REFUSED|error|Error' "$WORK/log" | head -2 | tr '\n' ' ')" >> "$HERE/failures.txt"
+ echo "MISS $rel"
+ continue
+ fi
+ # the frame with the most text (its manifest's words), among the candidates
+ texty=$(jq -r '[.frames[] | {f: .frame, n: ([.text[]?.text | length] | add // 0)}] | max_by(.n) | .f' "$WORK/r/m.json" 2>/dev/null)
+ mid=$(echo "$cands" | tr ',' '\n' | sed -n 5p)
+ IFS=, read -ra list <<< "$cands"
+ mkdir -p "$OUT/$slug"
+ for keep in "0:first" "$mid:middle" "$last:last" "$texty:text" $(echo "$asked" | tr ',' '\n' | grep . | sed 's/$/:asked/'); do
+ f=${keep%%:*}; why=${keep##*:}
+ [ -z "$f" ] || [ "$f" = "null" ] && continue
+ [ -f "$OUT/$slug/$f.png" ] && continue
+ idx=-1
+ for i in "${!list[@]}"; do [ "${list[$i]}" = "$f" ] && idx=$i; done
+ [ $idx -lt 0 ] && continue
+ png=$(printf "%s/r/frame-%05d.png" "$WORK" "$idx")
+ [ -f "$png" ] || continue
+ cp "$png" "$OUT/$slug/$f.png"
+ echo "{\"composition\":\"$rel\",\"id\":$(echo "$probe" | jq -c '.id' 2>/dev/null | grep . || echo null),\"frame\":$f,\"why\":\"$why\",\"frames\":$total,\"cands\":\"$cands\",\"probed\":$probed,\"file\":\"frames/$slug/$f.png\",\"png_sha256\":\"$(shasum -a 256 "$OUT/$slug/$f.png" | cut -d' ' -f1)\",\"sha256\":\"$SHA\",\"binary\":\"$BIN_SHOWN\",\"page\":\"${RAEA_PAGE:-}\"}" >> "$HERE/manifest.jsonl"
+ n=$((n + 1))
+ done
+ echo "ok $rel ($total frames)"
+done <<< "$picked"
+echo "P26 baseline: $n frames, $(wc -l < "$HERE/failures.txt" | tr -d ' ') compositions failed (failures.txt)"
diff --git a/bench/p26-baseline/compare.sh b/bench/p26-baseline/compare.sh
new file mode 100755
index 00000000..dae31440
--- /dev/null
+++ b/bench/p26-baseline/compare.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+# P26's gate (docs/ts-native.feature P26a): each baseline frame (manifest.jsonl, the last Blitz build's) rendered again
+# by raea on the Blitz page (the only page since B5d; P26_PAGE names it in results.jsonl,
+# docs/blitz-bevy.feature B2b) and compared, SSIM >= 0.98 a frame.
+#
+# bench/p26-baseline/compare.sh [RAEA_BIN] (default: target/release/raea)
+#
+# The frames go to $P26_STORE/bevy/frames/<slug>/<frame>.png beside the baseline's ($P26_STORE: ~/Library/Caches/raea/
+# p26-baseline), each frame's SSIM (ffmpeg's, over RGB) to $P26_STORE/bevy/results.jsonl; a composition that didn't
+# render is a failure of all its frames. ONLY=substring limits the compositions. MIN=0.98 is the bar. Prints the pass
+# rate and the worst frames, and exits 1 when any frame is under the bar (CI's p26 gate reads the exit). One render at
+# a time (the GPU is shared).
+#
+# The floor (10-26, one binary, each row rendered twice): rows repeat at SSIM >= 0.99998 run to run. Most are
+# byte-identical or 1/255 apart; look/town and kitchen/wreck differ in about 200 pixels, on house-kit's siding, where
+# the outside and inside skins have coincident faces and which one draws on top follows Bevy's draw order for equal
+# depths, likely the asset-load order (spawning the models' scenes in a fixed order didn't change it). Coincident faces
+# z-fight in any engine: whoever next touches those houses, offset the inner skin.
+set -uo pipefail
+HERE=$(cd "$(dirname "$0")" && pwd)
+. "$HERE/lib.sh"
+# pixel checks: no Content Credentials or TrustMark id in the frames (a still's mark changes its pixels each run)
+export RAEA_SIGN=0 RAEA_MARK=0
+ROOT=$(cd "$HERE/../.." && pwd)
+STORE=${P26_STORE:-$HOME/Library/Caches/raea/p26-baseline}
+BIN=${1:-$ROOT/target/release/raea}
+MIN=${MIN:-0.98}
+# a composition whose baseline came from a plugin build (raea-bevy-sdk: hanabi, avian) renders with one: P26_PLUGIN_BIN
+# (default sdk/raea/bench/bevy-plugins/motion.sh; it must take `render` as raea does)
+PLUGIN_BIN=${P26_PLUGIN_BIN:-$ROOT/sdk/raea/bench/bevy-plugins/motion.sh}
+[ -x "$BIN" ] || { echo "compare.sh: no raea at $BIN" >&2; exit 2; }
+[ -d "$STORE/frames" ] || { echo "compare.sh: no baseline frames at $STORE/frames" >&2; exit 2; }
+# P26_OUT: where this run writes (its frames and results.jsonl), so two runs at once don't write over each other
+PAGE=${P26_PAGE:-blitz}
+OUT=${P26_OUT:-$STORE/$PAGE}
+WORK=$(mktemp -d "${TMPDIR:-/tmp}/p26-compare.XXXXXX")
+trap 'rm -rf "$WORK"' EXIT
+# the run's own copy of raea (and its bundle library): a rebuild of target/release while it runs doesn't mix two
+# binaries into one run's rows
+mkdir -p "$WORK/bin" && cp "$BIN" "$WORK/bin/raea" || exit 2
+[ -f "$(dirname "$BIN")/libraea_bundle.dylib" ] && cp "$(dirname "$BIN")/libraea_bundle.dylib" "$WORK/bin/"
+BIN=$WORK/bin/raea
+mkdir -p "$OUT/frames" "$OUT/logs"
+RES=$OUT/results.jsonl
+: > "$RES"
+for rel in $(jq -r '.composition' "$HERE/manifest.jsonl" | awk '!seen[$0]++'); do
+ [ -n "${ONLY:-}" ] && [[ "$rel" != *"$ONLY"* ]] && continue
+ p26_src "$rel"
+ bin=$BIN
+ jq -r --arg c "$rel" 'select(.composition == $c) | .binary' "$HERE/manifest.jsonl" | grep -qE 'bevy-plugins|bin-avian' && bin=$PLUGIN_BIN
+ frames=$(jq -r --arg c "$rel" 'select(.composition == $c) | .frame' "$HERE/manifest.jsonl" | sort -n | paste -sd, -)
+ # rendered at the same nine frames the baseline's render took (capture.sh): a render's 3D rows are keyed by the
+ # frames it samples, so the kept frames alone would draw another animation (a box springing from scale 0 at frame 0
+ # was still at 0 at frame 59 when only those two were sampled, in Blitz as here)
+ total=$(jq -r --arg c "$rel" 'select(.composition == $c) | .frames' "$HERE/manifest.jsonl" | head -1)
+ last=$((total - 1))
+ cands=$(jq -r --arg c "$rel" 'select(.composition == $c) | .cands // empty' "$HERE/manifest.jsonl" | head -1)
+ [ -n "$cands" ] || cands=$(for i in 0 1 2 3 4 5 6 7 8; do echo $((last * i / 8)); done | awk '!seen[$0]++' | paste -sd, -)
+ rm -rf "$WORK/r" && mkdir -p "$WORK/r" "$OUT/frames/$slug"
+ # each row's render log kept at $OUT/logs/<slug>.log (a frame that came out black and was redrawn says so there)
+ if ! (cd "$dir" && RAEA_PAGE=$PAGE "$bin" render "$src" ${copt[@]+"${copt[@]}"} --at "$cands" -o "$WORK/r/") > "$WORK/log" 2>&1; then
+ cp "$WORK/log" "$OUT/logs/$slug.log"
+ why=$(grep -E 'REFUSED|error|Error|panicked' "$WORK/log" | head -1 | cut -c1-300)
+ for f in ${frames//,/ }; do
+ jq -nc --arg c "$rel" --argjson f "$f" --arg why "$why" '{composition: $c, frame: $f, ssim: null, pass: false, why: $why}' >> "$RES"
+ done
+ echo "MISS $rel: $why"
+ continue
+ fi
+ cp "$WORK/log" "$OUT/logs/$slug.log"
+ IFS=, read -ra list <<< "$cands"
+ for f in ${frames//,/ }; do
+ idx=-1
+ for i in "${!list[@]}"; do [ "${list[$i]}" = "$f" ] && idx=$i; done
+ got=$(printf "%s/r/frame-%05d.png" "$WORK" "$idx")
+ ref=$STORE/frames/$slug/$f.png
+ if [ ! -f "$got" ]; then
+ jq -nc --arg c "$rel" --argjson f "$f" '{composition: $c, frame: $f, ssim: null, pass: false, why: "no frame came out"}' >> "$RES"
+ continue
+ fi
+ cp "$got" "$OUT/frames/$slug/$f.png"
+ s=$(ffmpeg -hide_banner -nostats -i "$ref" -i "$got" -lavfi "[0:v]format=rgb24[a];[1:v]format=rgb24[b];[a][b]ssim" -f null - 2>&1 | grep -o 'All:[0-9.]*' | cut -d: -f2)
+ [ -n "$s" ] || s=0
+ pass=$(awk -v s="$s" -v m="$MIN" 'BEGIN { print (s >= m) ? "true" : "false" }')
+ jq -nc --arg c "$rel" --argjson f "$f" --argjson s "$s" --argjson p "$pass" '{composition: $c, frame: $f, ssim: $s, pass: $p}' >> "$RES"
+ done
+ echo "ok $rel"
+done
+n=$(wc -l < "$RES" | tr -d ' ')
+ok=$(jq -s '[.[] | select(.pass)] | length' "$RES")
+echo "P26: $ok of $n frames at SSIM >= $MIN ($(jq -s '[.[] | .composition] | unique | length' "$RES") compositions)"
+echo "worst:"
+jq -s -r 'sort_by(.ssim // -1) | .[:15][] | " \(.ssim // "none") \(.composition) @\(.frame)\(if .why then " " + .why else "" end)"' "$RES"
+[ "$ok" = "$n" ]
diff --git a/bench/p26-baseline/failures.txt b/bench/p26-baseline/failures.txt
new file mode 100644
index 00000000..cd5f8868
--- /dev/null
+++ b/bench/p26-baseline/failures.txt
@@ -0,0 +1 @@
+examples/games/animated-character.tsx: EXCLUDED a 3D game (no page) whose model, media/RobotExpressive.glb, is not in the checkout; P26 is the page
diff --git a/bench/p26-baseline/fixtures/broll.tsx b/bench/p26-baseline/fixtures/broll.tsx
new file mode 100644
index 00000000..b2f033d5
--- /dev/null
+++ b/bench/p26-baseline/fixtures/broll.tsx
@@ -0,0 +1,120 @@
+// Synthetic b-roll, from the legacy app's ad eval, kept as a P26 fixture (bench/p26-baseline/list.txt): a fictional cold brew
+// can ("Plumquiver", invented) in three 5 s shots, 1080x1920. No real brand, no person, no creator's footage: it's drawn here.
+// Rendered once per shot with --composition.
+import { AbsoluteFill, Composition, interpolate, registerRoot, useCurrentFrame } from "raea";
+import { Cylinder, Sphere } from "raea/3d";
+import { AmbientLight, DirectionalLight, PointLight } from "raea/light";
+import { Camera3d } from "raea/camera";
+import { StandardMaterial } from "raea/pbr";
+import { Quat, Transform } from "raea/transform";
+import { Cuboid, Mesh3d, ConicalFrustum } from "raea/mesh";
+import { LinearRgba, Srgba } from "raea/color";
+
+const ORANGE = "#ff7a1a";
+const CREAM = "#f6ead8";
+const BROWN = "#3b2416";
+
+function Can({ x = 0, z = 0, spin = 0, name }: { x?: number; z?: number; spin?: number; name: string }) {
+ return (
+ <>
+ <Mesh3d transform={Transform.fromXyz(x, 0.62, z).withRotation(Quat.fromEuler("XYZ", 0, spin, 0))} name={`${name}-body`}>
+ <Cylinder radius={0.33} half_height={0.62} />
+ <StandardMaterial base_color={ORANGE} perceptual_roughness={0.35} metallic={0.35} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(x, 0.7, z).withRotation(Quat.fromEuler("XYZ", 0, spin, 0))} name={`${name}-band`}>
+ <Cylinder radius={0.335} half_height={0.18} />
+ <StandardMaterial base_color={CREAM} perceptual_roughness={0.5} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(x, 1.26, z)} name={`${name}-lid`}>
+ <ConicalFrustum radius_top={0.3} radius_bottom={0.33} height={0.05} />
+ <StandardMaterial base_color="#c9ccd1" perceptual_roughness={0.25} metallic={0.6} />
+ </Mesh3d>
+ </>
+ );
+}
+
+/** Shot 1: the can turns on a warm table, the camera eases in. */
+function Turn() {
+ const f = useCurrentFrame();
+ const z = interpolate(f, [0, 149], [4.4, 3.4]);
+ return (
+ <AbsoluteFill style={{ background: "#f3c89a" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 1.2, z).lookingAt([0, 0.65, 0])} projection={{ Perspective: { fov: 0.663225115757845 } }} />
+ <AmbientLight brightness={200} />
+ <DirectionalLight transform={Transform.fromXyz(2.5, 4, 3).lookingAt([0, 0, 0])} illuminance={11200} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[4, 0.05, 4]} />
+ <StandardMaterial base_color="#c98b5a" perceptual_roughness={0.8} />
+ </Mesh3d>
+ <Can name="hero" spin={f * 0.03} />
+ </>
+ </AbsoluteFill>
+ );
+}
+
+/** Shot 2: ice cubes fall around the can, low and close. */
+function Ice() {
+ const f = useCurrentFrame();
+ const cubes = Array.from({ length: 9 }, (_, i) => {
+ const r = ((i * 9301 + 49297) % 233280) / 233280;
+ const start = i * 9;
+ const y = Math.max(0.12, 3 - Math.max(0, f - start) * 0.06);
+ return { i, x: (r - 0.5) * 1.6 + (r > 0.5 ? 0.4 : -0.4), z: ((i * 7) % 5) * 0.18 - 0.3, y, rot: f * 0.02 + i };
+ });
+ return (
+ <AbsoluteFill style={{ background: "#16202b" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 0.9, 3.3).lookingAt([0, 0.6, 0])} projection={{ Perspective: { fov: 0.733038285837618 } }} />
+ <AmbientLight brightness={140} />
+ <DirectionalLight transform={Transform.fromXyz(-2, 4, 2).lookingAt([0, 0, 0])} illuminance={8800} shadow_maps_enabled />
+ <PointLight color="#ffd2a8" transform={Transform.fromXyz(1.2, 1.4, 1.2)} intensity={2250000} />
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[4, 0.05, 4]} />
+ <StandardMaterial base_color="#22313f" perceptual_roughness={0.6} />
+ </Mesh3d>
+ <Can name="hero" spin={0.4} />
+ {cubes.map((c) => (
+ <Mesh3d key={c.i} transform={Transform.fromXyz(c.x, c.y, c.z).withRotation(Quat.fromEuler("XYZ", c.rot, c.rot * 0.7, 0))} name={`ice-${c.i}`}>
+ <Cuboid half_size={[0.1, 0.1, 0.1]} />
+ <StandardMaterial base_color={Srgba.hex("#dff3ff").with_alpha(0.75)} perceptual_roughness={0.1} alpha_mode="Blend" />
+ </Mesh3d>
+ ))}
+ </>
+ </AbsoluteFill>
+ );
+}
+
+/** Shot 3: three cans in a row, a slow dolly along them, a warm sun disc behind. */
+function Row() {
+ const f = useCurrentFrame();
+ const x = interpolate(f, [0, 149], [-1.2, 1.2]);
+ return (
+ <AbsoluteFill style={{ background: "#ffb36b" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(x, 1.0, 4.2).lookingAt([x * 0.5, 0.7, 0])} projection={{ Perspective: { fov: 0.698131700797732 } }} />
+ <AmbientLight brightness={220} />
+ <DirectionalLight transform={Transform.fromXyz(3, 5, 4).lookingAt([0, 0, 0])} illuminance={10400} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(0, 1.6, -3)}>
+ <Sphere radius={1.1} />
+ <StandardMaterial base_color="#fff1c2" emissive={LinearRgba.from(Srgba.hex("#ffd27a")).mul(1.2)} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[5, 0.05, 4]} />
+ <StandardMaterial base_color={BROWN} perceptual_roughness={0.7} />
+ </Mesh3d>
+ <Can name="a" x={-0.9} spin={0.2} />
+ <Can name="b" x={0} spin={0.6} />
+ <Can name="c" x={0.9} spin={1.0} />
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => (
+ <>
+ <Composition id="turn" component={Turn} width={1080} height={1920} fps={30} durationInFrames={150} />
+ <Composition id="ice" component={Ice} width={1080} height={1920} fps={30} durationInFrames={150} />
+ <Composition id="row" component={Row} width={1080} height={1920} fps={30} durationInFrames={150} />
+ </>
+));
diff --git a/bench/p26-baseline/lib.sh b/bench/p26-baseline/lib.sh
new file mode 100644
index 00000000..5b3e8a72
--- /dev/null
+++ b/bench/p26-baseline/lib.sh
@@ -0,0 +1,35 @@
+# P26 baseline: what capture.sh and compare.sh share. Needs HERE (this folder), ROOT (the checkout) and WORK (a scratch
+# folder of the caller's).
+
+# The file a composition renders from (src), its folder (dir) and its slug: the composition itself, or a copy of its
+# folder with props/<slug>/ laid over it.
+p26_src() {
+ local rel=$1
+ # "file.tsx#ID": one composition of a file that registers several (a film's cut), rendered with --composition ID
+ comp=""
+ copt=()
+ if [[ "$rel" == *"#"* ]]; then
+ comp=${rel#*#}
+ rel=${rel%%#*}
+ copt=(--composition "$comp")
+ fi
+ src=$ROOT/$rel
+ slug=$(echo "$rel" | sed 's#/#__#g; s#\.tsx$##')${comp:+@$comp}
+ # props/<slug>/ laid over a copy of its folder (@ROOT@ in those files is the checkout): a project file that imports
+ # what its tool writes (the template's edit.tsx and cuts.ts), or a component that takes props rendered through
+ # wrap.tsx, which gives it its documented example props
+ if [ -d "$HERE/props/$slug" ]; then
+ rm -rf "$WORK/proj" && mkdir -p "$WORK/proj"
+ find "$(dirname "$src")" -maxdepth 1 -type f -exec cp {} "$WORK/proj/" \;
+ for f in "$HERE/props/$slug"/*; do sed "s#@ROOT@#$ROOT#g" "$f" > "$WORK/proj/$(basename "$f")"; done
+ src=$WORK/proj/$(basename "$src")
+ # a part's example: the brand kit its styles.gen is compiled from (props/brand.css as the project's brand/brand.css)
+ if [ -f "$WORK/proj/wrap.tsx" ]; then
+ src=$WORK/proj/wrap.tsx
+ mkdir -p "$WORK/proj/brand" && cp "$HERE/props/brand.css" "$WORK/proj/brand/brand.css"
+ # a stub older than everything, so the probe can import it and the render compiles it
+ echo 'export const css = "";' > "$WORK/proj/styles.gen.ts" && touch -t 200001010000 "$WORK/proj/styles.gen.ts"
+ fi
+ fi
+ dir=$(dirname "$src")
+}
diff --git a/bench/p26-baseline/list.txt b/bench/p26-baseline/list.txt
new file mode 100644
index 00000000..8ee2050b
--- /dev/null
+++ b/bench/p26-baseline/list.txt
@@ -0,0 +1,71 @@
+bench/p26-baseline/fixtures/broll.tsx
+bench/lightspeed/animate-twin/edit.tsx
+bench/lightspeed/colour/edit.tsx
+bench/lightspeed/t3d600/edit.tsx
+sdk/raea/bench/bevy/animate3d/edit.tsx
+sdk/raea/bench/bevy/character/edit.tsx
+sdk/raea/bench/bevy/cinema/edit.tsx
+sdk/raea/bench/bevy/classbg/edit.tsx
+sdk/raea/bench/bevy/datamaps/edit.tsx
+sdk/raea/bench/bevy/environment/edit.tsx
+sdk/raea/bench/bevy/fire/edit.tsx
+sdk/raea/bench/bevy/layers/edit.tsx
+sdk/raea/bench/bevy/lens/edit.tsx
+sdk/raea/bench/bevy/lights/edit.tsx
+sdk/raea/bench/bevy/materials/edit.tsx
+sdk/raea/bench/bevy/model/edit.tsx
+sdk/raea/bench/bevy/paint/edit.tsx
+sdk/raea/bench/bevy/planes/edit.tsx
+sdk/raea/bench/bevy/shadows/edit.tsx
+sdk/raea/bench/bevy/splat/edit.tsx
+sdk/raea/bench/bevy/ssao/edit.tsx
+sdk/raea/bench/bevy/studio/edit.tsx
+sdk/raea/bench/bevy/texmaps/edit.tsx
+sdk/raea/bench/bevy/toon/edit.tsx
+sdk/raea/bench/bevy/volume-light/edit.tsx
+sdk/raea/bench/bevy/volumetric-dither/edit.tsx
+sdk/raea/bench/bevy/volumetric-froxel/edit.tsx
+sdk/raea/bench/bevy/volumetric-glass/edit.tsx
+sdk/raea/bench/bevy/volumetric-grid/edit.tsx
+sdk/raea/bench/bevy/volumetric-half/edit.tsx
+sdk/raea/bench/bevy/volumetric/edit.tsx
+sdk/raea/conformance/golden/01-card-fade/edit.tsx
+sdk/raea/conformance/golden/02-sequence-timing/edit.tsx
+sdk/raea/conformance/golden/04-mesh-sign/edit.tsx
+sdk/raea/conformance/golden/05-world-solid/edit.tsx
+sdk/raea/conformance/golden/06-world-entities/edit.tsx
+examples/games/animated-character.tsx # excluded: a 3D game (no page) whose model, media/RobotExpressive.glb, is not in the checkout; P26 is the page
+examples/games/breakout.tsx
+examples/games/camera-orbit.tsx
+examples/games/fog-bloom.tsx
+examples/games/lighting.tsx
+examples/games/pbr.tsx
+examples/games/platformer-feel.tsx
+examples/games/screenshake.tsx
+examples/games/shapes.tsx
+sdk/react/bench/corpus/fixtures/box3d/edit.tsx
+sdk/react/bench/corpus/fixtures/deck/edit.tsx
+sdk/react/bench/css/anim.tsx
+sdk/react/bench/css/edit.tsx
+sdk/react/bench/css/svg.tsx
+sdk/react/bench/games/arena3d/edit.tsx
+sdk/react/bench/games/music/edit.tsx
+sdk/react/bench/games/platformer/edit.tsx
+sdk/react/bench/games/pong/edit.stepfold.tsx
+sdk/react/bench/games/pong/edit.tsx
+sdk/react/bench/games/pong/edit.view.tsx
+sdk/react/bench/games/room3d/edit.tsx
+sdk/react/bench/games/seedling/edit.tsx
+sdk/react/bench/games/tones/edit.tsx
+sdk/react/bench/ml/chaser/edit.tsx
+sdk/react/bench/ml/chaser/orbit.tsx
+sdk/react/bench/playtest/fixtures/ledge-fixed/edit.tsx
+sdk/react/bench/speech/game/edit.tsx
+sdk/react/bench/speech/game/quiet.tsx
+sdk/react/bench/timelines/animate/edit.tsx
+sdk/react/bench/timelines/solids/edit.tsx
+sdk/react/bench/timelines/titles/edit.tsx
+sdk/react/bench/tone/game/edit.tsx
+sdk/react/bench/tone/gaps/edit.tsx
+sdk/react/bench/tone/song/edit.tsx
+sdk/react/bench/tone/tokensynth/edit.tsx
diff --git a/bench/p26-baseline/manifest.jsonl b/bench/p26-baseline/manifest.jsonl
new file mode 100644
index 00000000..521c99ee
--- /dev/null
+++ b/bench/p26-baseline/manifest.jsonl
@@ -0,0 +1,215 @@
+{"composition":"bench/p26-baseline/fixtures/broll.tsx","id":"turn","frame":0,"why":"first","frames":150,"probed":true,"file":"frames/bench__p26-baseline__fixtures__broll/0.png","png_sha256":"38dcf4a2057186dca4b5ee70f8372b28f4c85daa2f40f4ee2e7aea95df5f556b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/p26-baseline/fixtures/broll.tsx","id":"turn","frame":74,"why":"middle","frames":150,"probed":true,"file":"frames/bench__p26-baseline__fixtures__broll/74.png","png_sha256":"00e6db4729934766adedbda90ae9adb0b32408b94dbbdc560b7ace3e6c18eed1","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/p26-baseline/fixtures/broll.tsx","id":"turn","frame":149,"why":"last","frames":150,"probed":true,"file":"frames/bench__p26-baseline__fixtures__broll/149.png","png_sha256":"980e5ffd8880ee666e2c7cca4ec3fafd32a65968217deaecd871f9e54f73188b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/lightspeed/animate-twin/edit.tsx","id":"twin","frame":0,"why":"first","frames":600,"probed":true,"file":"frames/bench__lightspeed__animate-twin__edit/0.png","png_sha256":"19a772ab65cc744ee80eea4a761d3aa2fc3db24a0a411e7d08b4a77879ea46dc","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/lightspeed/animate-twin/edit.tsx","id":"twin","frame":299,"why":"middle","frames":600,"probed":true,"file":"frames/bench__lightspeed__animate-twin__edit/299.png","png_sha256":"60f79e7103d85b35261929c5323304e847b5920bd0270d6212d194017aed83e7","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/lightspeed/animate-twin/edit.tsx","id":"twin","frame":599,"why":"last","frames":600,"probed":true,"file":"frames/bench__lightspeed__animate-twin__edit/599.png","png_sha256":"ac6b188ecbd98365570d9194ef28596b941341e68a1c55b2f85ffc09eea52541","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/lightspeed/animate-twin/edit.tsx","id":"twin","frame":224,"why":"text","frames":600,"probed":true,"file":"frames/bench__lightspeed__animate-twin__edit/224.png","png_sha256":"578803dcbf0da509cc92d93b02f05fb914cd62eec7b210b4f4f0d61eb626d192","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/lightspeed/colour/edit.tsx","id":"colour","frame":0,"why":"first","frames":30,"probed":true,"file":"frames/bench__lightspeed__colour__edit/0.png","png_sha256":"c36efff78cbd0c2b80a27783ac0c2d45e65f0de6d80e88ddc00b09710e8cf2b0","sha256":"3c2dfa83f5f4ad9fd9df9989968acae4c1bc3e674ffccd632fb41c4accb57a44","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-3c2dfa83f5f4/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: its reference was read back through NV12 (pure red 255,1,0; grey 192,192,190); now RGBA as raea reads frames since 3c7d15cf, every swatch the exact colour the composition names, as Chrome draws it"}
+{"composition":"bench/lightspeed/colour/edit.tsx","id":"colour","frame":14,"why":"middle","frames":30,"probed":true,"file":"frames/bench__lightspeed__colour__edit/14.png","png_sha256":"c36efff78cbd0c2b80a27783ac0c2d45e65f0de6d80e88ddc00b09710e8cf2b0","sha256":"3c2dfa83f5f4ad9fd9df9989968acae4c1bc3e674ffccd632fb41c4accb57a44","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-3c2dfa83f5f4/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: its reference was read back through NV12 (pure red 255,1,0; grey 192,192,190); now RGBA as raea reads frames since 3c7d15cf, every swatch the exact colour the composition names, as Chrome draws it"}
+{"composition":"bench/lightspeed/colour/edit.tsx","id":"colour","frame":29,"why":"last","frames":30,"probed":true,"file":"frames/bench__lightspeed__colour__edit/29.png","png_sha256":"c36efff78cbd0c2b80a27783ac0c2d45e65f0de6d80e88ddc00b09710e8cf2b0","sha256":"3c2dfa83f5f4ad9fd9df9989968acae4c1bc3e674ffccd632fb41c4accb57a44","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-3c2dfa83f5f4/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: its reference was read back through NV12 (pure red 255,1,0; grey 192,192,190); now RGBA as raea reads frames since 3c7d15cf, every swatch the exact colour the composition names, as Chrome draws it"}
+{"composition":"bench/lightspeed/t3d600/edit.tsx","id":"t3d600","frame":0,"why":"first","frames":600,"probed":true,"file":"frames/bench__lightspeed__t3d600__edit/0.png","png_sha256":"c7f101d59f260503ac5214a7b4bc4f93ebce4b993e1470d9aac152f445986d0d","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/lightspeed/t3d600/edit.tsx","id":"t3d600","frame":299,"why":"middle","frames":600,"probed":true,"file":"frames/bench__lightspeed__t3d600__edit/299.png","png_sha256":"dd6cb5e9cb9c42ec44439da294ae70e909801b4fb4f5ba3a7c116f2088ba5fcd","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"bench/lightspeed/t3d600/edit.tsx","id":"t3d600","frame":599,"why":"last","frames":600,"probed":true,"file":"frames/bench__lightspeed__t3d600__edit/599.png","png_sha256":"89bf7e3f0b6345aef90f89dbdd25276613ab17453e749a3141152491503877dd","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/animate3d/edit.tsx","id":"animate3d","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__animate3d__edit/0.png","png_sha256":"7b0ff2f78056ee0ecd7ad41f54fcf54c1b20af13d54bb8dde9c10ef551d59415","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/animate3d/edit.tsx","id":"animate3d","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__animate3d__edit/29.png","png_sha256":"3f497b4b42fe738e237e9bc9a527a636d0edd8a4861c483d29737e4de5953201","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/animate3d/edit.tsx","id":"animate3d","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__animate3d__edit/59.png","png_sha256":"5780e8445a4935df8616cba268c2067ebc688214f9f9761dee6be67ccc3e0b14","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/character/edit.tsx","id":"character","frame":0,"why":"first","frames":90,"probed":true,"file":"frames/sdk__motion__bench__bevy__character__edit/0.png","png_sha256":"bab3fe74dd8555c98b96c14b0bce61d1473e61f7f6f28024354f10f99b422393","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/character/edit.tsx","id":"character","frame":44,"why":"middle","frames":90,"probed":true,"file":"frames/sdk__motion__bench__bevy__character__edit/44.png","png_sha256":"9968f48e5c5a9e8ff2475949ec660a5e4c3cc6673bb554e4eeeab1c595d15a6a","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/character/edit.tsx","id":"character","frame":89,"why":"last","frames":90,"probed":true,"file":"frames/sdk__motion__bench__bevy__character__edit/89.png","png_sha256":"044cc20a46eba6170da1c688ec74f7e45c8e7c4bf8831bff874cd4d4873d4558","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/cinema/edit.tsx","id":"cinema","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__cinema__edit/0.png","png_sha256":"555d669fc5fc1143829ee6960c7ad6958df6894351d57bda2d2612ea8500918d","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/cinema/edit.tsx","id":"cinema","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__cinema__edit/29.png","png_sha256":"cd327de0924b972adafab401a15151487b33410c5aaeea503dc58cdd28bdb8cc","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/cinema/edit.tsx","id":"cinema","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__cinema__edit/59.png","png_sha256":"b4cccd0fca0b475c1b234b536fae0ce95aec332bbf21e63c8bcc007de0aae3d9","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/classbg/edit.tsx","id":"classbg","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__classbg__edit/0.png","png_sha256":"3ca0f47abd5b600e06e711db5f2ca747afa52b4d872662f3f4697d21b018e6e6","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/classbg/edit.tsx","id":"classbg","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__classbg__edit/29.png","png_sha256":"fcf8d5f3023c56e4dfb96e9261ee9935f3919398ea0a8c98999e1d14cb6dc223","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/classbg/edit.tsx","id":"classbg","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__classbg__edit/59.png","png_sha256":"a01e331ba7d511d57f78f5f2475f7a23cbf0d66a5835855033ca21e68eccc98d","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/datamaps/edit.tsx","id":"datamaps","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__datamaps__edit/0.png","png_sha256":"81c6cea57952f2b23e6c5c98a368ee99e275676991ef6d5b219646f7c0de780c","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/datamaps/edit.tsx","id":"datamaps","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__datamaps__edit/29.png","png_sha256":"330d2905b86c51fad5f4b2a0b34cd9d0d537b23b586c3f31cd6481383acd4695","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/datamaps/edit.tsx","id":"datamaps","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__datamaps__edit/59.png","png_sha256":"44092b6b63d5f5468f05ea2efa8b7943567937847460876edbed659e5b1a1f05","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/environment/edit.tsx","id":"environment","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__environment__edit/0.png","png_sha256":"cf6cfebf3f169868b06718173f941cef743582024a778f3e99be6430ca577f33","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/environment/edit.tsx","id":"environment","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__environment__edit/29.png","png_sha256":"d77b904c1c266418c3fb426efe1b0278e1686098f0f6260d2b48bb8ff0bf53d3","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/environment/edit.tsx","id":"environment","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__environment__edit/59.png","png_sha256":"71010f2c6654f1d9bf8725d99962a9ab1359756a80cc80018221121b86c64890","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference was read back through NV12 (BT.709 4:2:0, a level or so off in each channel); now RGBA, as raea reads frames since 3c7d15cf (the Blitz frame through the same NV12 trip already passed)"}
+{"composition":"sdk/raea/bench/bevy/fire/edit.tsx","id":"fire","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__fire__edit/0.png","png_sha256":"c15dad5ac0780250dd3623a7e7a109df38155ec2fa09eb851e3c63747bf91a72","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/fire/edit.tsx","id":"fire","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__fire__edit/29.png","png_sha256":"c9cd433508a817a36e86b83ab95aeda379347d343a0f9728a64e83f646b26f8a","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/fire/edit.tsx","id":"fire","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__fire__edit/59.png","png_sha256":"83fa86e1b07e9865bafdc591bf9bc6d834664a92359423fbf3c45758fa4716e6","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/lens/edit.tsx","id":"lens","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__lens__edit/0.png","png_sha256":"a77adcf18b31a63ad45f67c277f6b4ab11f7323782cd1ab825f3686ea10f8717","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/lens/edit.tsx","id":"lens","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__lens__edit/29.png","png_sha256":"d75258e5db22e981c905bc922347af964aad5c48eb2e7f073de249f70be5463d","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/lens/edit.tsx","id":"lens","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__lens__edit/59.png","png_sha256":"d3f871d75e020ef06e389b19d1355f888cc1bcbc5f9f5eef54d7496243d0c61e","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/lights/edit.tsx","id":"lights","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__lights__edit/0.png","png_sha256":"77ffaae6a6e3c33303ef473d26c5a312743ba46cc8f48915e9543269e7ff905b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/lights/edit.tsx","id":"lights","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__lights__edit/29.png","png_sha256":"6aee7939691120aa018f1cdd0e4ddbb6caf99b9e4ff78011343f2b031af023d9","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/lights/edit.tsx","id":"lights","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__lights__edit/59.png","png_sha256":"561204e738afda1dbb346287e1b6c2a9b03d3bcf8cce8d8fa2d2d2cf1ce7652f","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/model/edit.tsx","id":"model","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__model__edit/0.png","png_sha256":"e7b3ee282a9c4203b31715c857f3a733ce86221442db3f9986b2e18544503bf1","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/model/edit.tsx","id":"model","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__model__edit/29.png","png_sha256":"ba1589390b6721f96e16208ac6da1ba55f5b166924f31e777f8a0c9c4d840856","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/model/edit.tsx","id":"model","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__model__edit/59.png","png_sha256":"ba1589390b6721f96e16208ac6da1ba55f5b166924f31e777f8a0c9c4d840856","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/paint/edit.tsx","id":"paint","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__paint__edit/0.png","png_sha256":"52285a60052e2fcf247b3fdf774686857d86785df7510d712867266371ed1941","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/paint/edit.tsx","id":"paint","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__paint__edit/29.png","png_sha256":"6a3235238712f96cdc92121fd19f0d2b882b6fc7cf9746c5d95b2b5ecf53f0af","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/paint/edit.tsx","id":"paint","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__paint__edit/59.png","png_sha256":"7658ef1911268f1bcc8145684e8978f5b2a3284cbb69ff278753300a3c7ce7c1","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/planes/edit.tsx","id":"planes","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__planes__edit/0.png","png_sha256":"042ed10066e27d4984d934d698f8999c9696ea8283f3156ee00886577796cde2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/planes/edit.tsx","id":"planes","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__planes__edit/29.png","png_sha256":"71b4507ac5c597a577193ed80cd376a663c0f3d86cae96c5a1f49ad80ac7e02d","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference was read back through NV12 (BT.709 4:2:0, a level or so off in each channel); now RGBA, as raea reads frames since 3c7d15cf (the Blitz frame through the same NV12 trip already passed)"}
+{"composition":"sdk/raea/bench/bevy/planes/edit.tsx","id":"planes","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__planes__edit/59.png","png_sha256":"90cbb2dc28965fc343d75d6842ac565765fb95b1873bbed28fc1988cb29336f1","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference was read back through NV12 (BT.709 4:2:0, a level or so off in each channel); now RGBA, as raea reads frames since 3c7d15cf (the Blitz frame through the same NV12 trip already passed)"}
+{"composition":"sdk/raea/bench/bevy/shadows/edit.tsx","id":"shadows","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__shadows__edit/0.png","png_sha256":"e214966b5dc19d5d349022601cd62ca08fd60a7aada32f9ab5e72d016b770ac2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/shadows/edit.tsx","id":"shadows","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__shadows__edit/29.png","png_sha256":"ebe03d2f275361ff70c095e97b3efd752b01d11c50a6d022362f06a013aa2c44","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/shadows/edit.tsx","id":"shadows","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__shadows__edit/59.png","png_sha256":"378a53880f704ff2de4420e94a27de28143a17225aab2bc839c8e5c7878dd931","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/splat/edit.tsx","id":"splat","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__splat__edit/0.png","png_sha256":"d03fcd3098c02e63230dd04ebec16b64d13379abbf0362d21e64068ebd6fa6a3","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/splat/edit.tsx","id":"splat","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__splat__edit/29.png","png_sha256":"f6d79e3bccead9ca80a20dea15f99c74bce092d3f4b91a93f61e476158288fdc","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/splat/edit.tsx","id":"splat","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__splat__edit/59.png","png_sha256":"2780a95e114f21d70f1e361e3719c7e13c6397475ae3d611a308a3b2527d3121","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/ssao/edit.tsx","id":"ssao","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__ssao__edit/0.png","png_sha256":"97684e13237dfcf096f874bfef4aad76c2f419bb1ba467a261f31f8378a780ec","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/ssao/edit.tsx","id":"ssao","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__ssao__edit/29.png","png_sha256":"ab6d6a1c917789784a185b089fc429ddca8fa132cb4364caa7d9e06caece07f1","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/ssao/edit.tsx","id":"ssao","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__ssao__edit/59.png","png_sha256":"f5dedb498598e72def24cbf48a8bd7fd45bf4ec52f32159dff2be141b5091dee","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/studio/edit.tsx","id":"studio","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__studio__edit/0.png","png_sha256":"27d78ef9d8c0578fa4e295db47750c00552c56a6bdd91661355dc09287cf5aac","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/studio/edit.tsx","id":"studio","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__studio__edit/29.png","png_sha256":"bdfd12292020c500ad1110a75b55fd308efdb9815c4596146b998c16212ea62a","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/studio/edit.tsx","id":"studio","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__studio__edit/59.png","png_sha256":"166dd02398054c25a695feb292d32572e61a5cd7b7141421117f525fd2c88308","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/texmaps/edit.tsx","id":"texmaps","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__texmaps__edit/0.png","png_sha256":"647216f3c8a8dafe3c0eb15b2727952eedc7c06ab257db49917114f47d97e684","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/texmaps/edit.tsx","id":"texmaps","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__texmaps__edit/29.png","png_sha256":"9ab29bf979e918d851c6289e916117d1b7319722fdc560cd5940d2be1dc8e6f8","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/texmaps/edit.tsx","id":"texmaps","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__texmaps__edit/59.png","png_sha256":"befc9bb63bb65ca2dcb097361d9177cbce23c453fbf807396a79be519a29008f","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/toon/edit.tsx","id":"toon","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__toon__edit/0.png","png_sha256":"85ef5bf580ecb38a139878e49005e3bffd5979d1cee2d648e8fb91b2e43278d2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/toon/edit.tsx","id":"toon","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__toon__edit/29.png","png_sha256":"f8157aac160daa015c0c213c76a876339859ff5a9de3e3d05531734870a805e5","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/toon/edit.tsx","id":"toon","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__toon__edit/59.png","png_sha256":"243e64fd4770dc911b2a6f314f6444dfd39372c5f63e8f70913687df0fc6517a","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volume-light/edit.tsx","id":"volume-light","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volume-light__edit/0.png","png_sha256":"ac8bb1b5de321890b7c78198641356ede531cee841b28a0e6ecf305e650858c5","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volume-light/edit.tsx","id":"volume-light","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volume-light__edit/29.png","png_sha256":"6a605cfffebea0db7537b24babf3e283cf5336c5e2afb9bdc545d0c4db14471e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volume-light/edit.tsx","id":"volume-light","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volume-light__edit/59.png","png_sha256":"f05fa49bc62431a72dc1ac30ad90121ccd2a74d0e909ba8122fb867413b690d2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric-dither/edit.tsx","id":"volumetric","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-dither__edit/0.png","png_sha256":"f320465dda1530a1cd9919ce2c5300b7c367aa84e0e1ce5c741264cfa6133220","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference was read back through NV12 (BT.709 4:2:0, a level or so off in each channel); now RGBA, as raea reads frames since 3c7d15cf (the Blitz frame through the same NV12 trip already passed)"}
+{"composition":"sdk/raea/bench/bevy/volumetric-dither/edit.tsx","id":"volumetric","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-dither__edit/29.png","png_sha256":"4d4daccab093e4a9a968d7ff8515e8487825675588d8f212c3782ba7c1c41609","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/volumetric-dither/edit.tsx","id":"volumetric","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-dither__edit/59.png","png_sha256":"0a194c3df0e03df9256d6abc09699da779fa39fe24ec5fb044cd071bdda669a4","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/volumetric-glass/edit.tsx","id":"volumetric-glass","frame":0,"why":"first","frames":90,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-glass__edit/0.png","png_sha256":"964b7a4aa26ecc3db98ce226434a475d93a0bc8c82a5bbad206fc556ae6d2a76","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric-glass/edit.tsx","id":"volumetric-glass","frame":44,"why":"middle","frames":90,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-glass__edit/44.png","png_sha256":"0e21b7993c2c57cd71a0e5bd7ccfa2c32447add07be6da879c9f3a08f61af8a0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric-glass/edit.tsx","id":"volumetric-glass","frame":89,"why":"last","frames":90,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-glass__edit/89.png","png_sha256":"d3ea60e9681b616421c7b77f1bd26f17d6de5dd4a55636cf1b02cf2bfc62beb0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric-half/edit.tsx","id":"volumetric-half","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-half__edit/0.png","png_sha256":"e4e03c775487db3be69735b7996b9e3ba739ee3edfaaa04599e3cca18086976a","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric-half/edit.tsx","id":"volumetric-half","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-half__edit/29.png","png_sha256":"4260b31e098199cf3d5df3ffccdf955a05bf7bd7cd69ccc5d5a79842079e3ba1","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric-half/edit.tsx","id":"volumetric-half","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-half__edit/59.png","png_sha256":"9d9a6e62c89f5427c757ed8e07b4b024b1aa16d9f2f4385ec733e8a3463243e3","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/bench/bevy/volumetric/edit.tsx","id":"volumetric","frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric__edit/0.png","png_sha256":"fad198686fed3ccb726b0040aa7ae0a80838c2fb106c8788dde64d4a44ca2efc","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric/edit.tsx","id":"volumetric","frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric__edit/29.png","png_sha256":"d643944fd2d377d2565f0b7d811f4765da2c9fa5d4dbd74ca8e58f3f242a423b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/volumetric/edit.tsx","id":"volumetric","frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric__edit/59.png","png_sha256":"64b1dec787139144bd34703eeffe5f983999a758b39de5d830bb7b39f9bf37cb","sha256":"feae904cc626e5d62d54e89ac1aab5f2d0c751be248cf7e2e19c253046b8e479","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-feae904cc626/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: 2cd3dc9f (B3 H10): the 3D drawn at the frame's true w x h view (was 0.14% larger and half a pixel low); A/B in one binary, every one of these rows passes with the sub view off"}
+{"composition":"sdk/raea/conformance/golden/01-card-fade/edit.tsx","id":null,"frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__01-card-fade__edit/0.png","png_sha256":"e96950295c59987a3cea1a0b05490b4a06a97d6c9979863752d866974d121ae3","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/01-card-fade/edit.tsx","id":null,"frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__01-card-fade__edit/29.png","png_sha256":"4940997a8d98489f91163a3315921be61edf9456c826829ab648c11528a79693","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/01-card-fade/edit.tsx","id":null,"frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__01-card-fade__edit/59.png","png_sha256":"4940997a8d98489f91163a3315921be61edf9456c826829ab648c11528a79693","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/02-sequence-timing/edit.tsx","id":null,"frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__02-sequence-timing__edit/0.png","png_sha256":"d58500a0788a02d273ce8a28b21ea801573a38d4faeaea968f92fd2e8fe0b96b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/02-sequence-timing/edit.tsx","id":null,"frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__02-sequence-timing__edit/29.png","png_sha256":"d58500a0788a02d273ce8a28b21ea801573a38d4faeaea968f92fd2e8fe0b96b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/02-sequence-timing/edit.tsx","id":null,"frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__02-sequence-timing__edit/59.png","png_sha256":"bb16673e654fee61f00764bec619f10c3bdb569d9ad232a62a17f54546913062","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/02-sequence-timing/edit.tsx","id":null,"frame":36,"why":"text","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__02-sequence-timing__edit/36.png","png_sha256":"79141928ff2841dffe279411bfeb95c6c212e570d275f368ee5594f269b19f98","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/04-mesh-sign/edit.tsx","id":null,"frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__04-mesh-sign__edit/0.png","png_sha256":"61cc3830411881ca2b201ee2b1a7167f84320b60598471da0fe2f6e102a00b6e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/04-mesh-sign/edit.tsx","id":null,"frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__04-mesh-sign__edit/29.png","png_sha256":"b75d9087508593bc48787dd34dbdf54737c64bf18b3a58e296c5dcbb7e610d76","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/04-mesh-sign/edit.tsx","id":null,"frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__04-mesh-sign__edit/59.png","png_sha256":"5cda21fa812f719ce956c0f319ccd00a093b9a6bf1880a9f39e33577cd71d20f","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/05-world-solid/edit.tsx","id":null,"frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__05-world-solid__edit/0.png","png_sha256":"61cc3830411881ca2b201ee2b1a7167f84320b60598471da0fe2f6e102a00b6e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/05-world-solid/edit.tsx","id":null,"frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__05-world-solid__edit/29.png","png_sha256":"b75d9087508593bc48787dd34dbdf54737c64bf18b3a58e296c5dcbb7e610d76","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/05-world-solid/edit.tsx","id":null,"frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__05-world-solid__edit/59.png","png_sha256":"5cda21fa812f719ce956c0f319ccd00a093b9a6bf1880a9f39e33577cd71d20f","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/06-world-entities/edit.tsx","id":null,"frame":0,"why":"first","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__06-world-entities__edit/0.png","png_sha256":"3c6302a16f9348b6ab9a69e09d607d274c065cb9b345ec65da4c91cc73b1edb8","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/06-world-entities/edit.tsx","id":null,"frame":29,"why":"middle","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__06-world-entities__edit/29.png","png_sha256":"29d8e4fe76b7881b0b71f591a87b4d32a9be4d4f316b11a0a62e522f177d9aac","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/conformance/golden/06-world-entities/edit.tsx","id":null,"frame":59,"why":"last","frames":60,"probed":true,"file":"frames/sdk__motion__conformance__golden__06-world-entities__edit/59.png","png_sha256":"b7b305836c3b22f00b2de1658d69b807b7e81c47e629fb72e835f4b258b1e7ed","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/breakout.tsx","id":"breakout3d","frame":0,"why":"first","frames":240,"probed":true,"file":"frames/examples__games__breakout/0.png","png_sha256":"4d2db9aaec1d62c088f5d8dd06ace217f852bcf3c0278fe3c9eddcbfeb4702ae","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/breakout.tsx","id":"breakout3d","frame":119,"why":"middle","frames":240,"probed":true,"file":"frames/examples__games__breakout/119.png","png_sha256":"36b1be167d9a5d89ff44d4eeb13a1d693400e9af9a03f5c45c2cfb4226e855c4","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/breakout.tsx","id":"breakout3d","frame":239,"why":"last","frames":240,"probed":true,"file":"frames/examples__games__breakout/239.png","png_sha256":"2e4d47841c4abe67c402b055292a1d7e02cbe211bc4a043c76bc077e013864a0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/camera-orbit.tsx","id":"orbit","frame":0,"why":"first","frames":150,"probed":true,"file":"frames/examples__games__camera-orbit/0.png","png_sha256":"60f5f3a4ef6e6759fed295f55463537cbfbd6697a9be6c67470ab68845c7d1a5","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/camera-orbit.tsx","id":"orbit","frame":74,"why":"middle","frames":150,"probed":true,"file":"frames/examples__games__camera-orbit/74.png","png_sha256":"0397787377ff8bc7b6aafeb676de241226fff861fbcd53fdcbddc80a6e19dc4e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/camera-orbit.tsx","id":"orbit","frame":149,"why":"last","frames":150,"probed":true,"file":"frames/examples__games__camera-orbit/149.png","png_sha256":"3a1c362b18adaa503be6f079bf46d6f5cceec28d7624e2dad6495af65ed4a124","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/fog-bloom.tsx","id":"fogbloom","frame":0,"why":"first","frames":120,"probed":true,"file":"frames/examples__games__fog-bloom/0.png","png_sha256":"5d284683f39442fd58a080deab07d16c1877948ebd2e62dfbcd9c8c62a58aa96","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/fog-bloom.tsx","id":"fogbloom","frame":59,"why":"middle","frames":120,"probed":true,"file":"frames/examples__games__fog-bloom/59.png","png_sha256":"39c1a07be6af7f3d1407634eddf5d1cf30575bd3a745e84725b11031f1b84910","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/fog-bloom.tsx","id":"fogbloom","frame":119,"why":"last","frames":120,"probed":true,"file":"frames/examples__games__fog-bloom/119.png","png_sha256":"543bd5d758126c3d44f7cdd80356e044e22380b499478d095aa2043950dde0d0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/lighting.tsx","id":"lighting","frame":0,"why":"first","frames":120,"probed":true,"file":"frames/examples__games__lighting/0.png","png_sha256":"c02de9096f1a197db2cb3af53f13a7a2a961ed1de2512552dc96211f2598d7aa","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference was read back through NV12 (BT.709 4:2:0, a level or so off in each channel); now RGBA, as raea reads frames since 3c7d15cf (the Blitz frame through the same NV12 trip already passed)"}
+{"composition":"examples/games/lighting.tsx","id":"lighting","frame":59,"why":"middle","frames":120,"probed":true,"file":"frames/examples__games__lighting/59.png","png_sha256":"9a6702da6c962dc3d4b4afc4d0de28342f33733385c1097973b5d6cf568eaace","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference was read back through NV12 (BT.709 4:2:0, a level or so off in each channel); now RGBA, as raea reads frames since 3c7d15cf (the Blitz frame through the same NV12 trip already passed)"}
+{"composition":"examples/games/lighting.tsx","id":"lighting","frame":119,"why":"last","frames":120,"probed":true,"file":"frames/examples__games__lighting/119.png","png_sha256":"ab751db5af3376bf6dcca34cf173400c6e86fb05acb11ea0dde0149db2a3c051","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference was read back through NV12 (BT.709 4:2:0, a level or so off in each channel); now RGBA, as raea reads frames since 3c7d15cf (the Blitz frame through the same NV12 trip already passed)"}
+{"composition":"examples/games/pbr.tsx","id":"pbr","frame":0,"why":"first","frames":30,"probed":true,"file":"frames/examples__games__pbr/0.png","png_sha256":"8388410a376ed5b052612dd8afde207db5b838e643a15ce6c6a82f21d8ca90b2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/pbr.tsx","id":"pbr","frame":14,"why":"middle","frames":30,"probed":true,"file":"frames/examples__games__pbr/14.png","png_sha256":"8388410a376ed5b052612dd8afde207db5b838e643a15ce6c6a82f21d8ca90b2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/pbr.tsx","id":"pbr","frame":29,"why":"last","frames":30,"probed":true,"file":"frames/examples__games__pbr/29.png","png_sha256":"8388410a376ed5b052612dd8afde207db5b838e643a15ce6c6a82f21d8ca90b2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/platformer-feel.tsx","id":"platformer","frame":0,"why":"first","frames":300,"probed":true,"file":"frames/examples__games__platformer-feel/0.png","png_sha256":"8c04dd69067887da380ae728cd3355842619bc35f74f5fea620e124429cd2270","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/platformer-feel.tsx","id":"platformer","frame":149,"why":"middle","frames":300,"probed":true,"file":"frames/examples__games__platformer-feel/149.png","png_sha256":"74fc7bca6d3cd63c8fa6e5d8791f705301041603d9c5d875fecfc9aeceeff342","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/platformer-feel.tsx","id":"platformer","frame":299,"why":"last","frames":300,"probed":true,"file":"frames/examples__games__platformer-feel/299.png","png_sha256":"510c98aa6a734fa5315832c99b4ff4811c7c80691a70a8fad9eb8ab464a453ef","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/screenshake.tsx","id":"screenshake","frame":0,"why":"first","frames":150,"probed":true,"file":"frames/examples__games__screenshake/0.png","png_sha256":"8ad6213e934134e51725f147d590a465cef69e8a794e2d89f77c116d71c6e88f","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/screenshake.tsx","id":"screenshake","frame":74,"why":"middle","frames":150,"probed":true,"file":"frames/examples__games__screenshake/74.png","png_sha256":"1a53a7088812966e11ad58d46b15d479bdeaf47ee6670f728f159b9457fa0a62","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/screenshake.tsx","id":"screenshake","frame":149,"why":"last","frames":150,"probed":true,"file":"frames/examples__games__screenshake/149.png","png_sha256":"8ad6213e934134e51725f147d590a465cef69e8a794e2d89f77c116d71c6e88f","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/shapes.tsx","id":"shapes","frame":0,"why":"first","frames":90,"probed":true,"file":"frames/examples__games__shapes/0.png","png_sha256":"c90b2f90f447d36aa2e984d72e198d77a177ef610e663b255bf5191c1053014e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/shapes.tsx","id":"shapes","frame":44,"why":"middle","frames":90,"probed":true,"file":"frames/examples__games__shapes/44.png","png_sha256":"2f3b67238e845a0f2fadbe1a1cff7bb95a1ad2f351185344f26549b32f68722e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"examples/games/shapes.tsx","id":"shapes","frame":89,"why":"last","frames":90,"probed":true,"file":"frames/examples__games__shapes/89.png","png_sha256":"09c8de18e9139383bc813ccd90e520ca2f378f006b8791527185de2aebd8a32b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/corpus/fixtures/box3d/edit.tsx","id":"box3d","frame":0,"why":"first","frames":120,"probed":true,"file":"frames/sdk__react__bench__corpus__fixtures__box3d__edit/0.png","png_sha256":"0698a4a1eddc402388fc0c2bfb3f115b01217f168e0562e4da8cf701a2d5dd3e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/corpus/fixtures/box3d/edit.tsx","id":"box3d","frame":59,"why":"middle","frames":120,"probed":true,"file":"frames/sdk__react__bench__corpus__fixtures__box3d__edit/59.png","png_sha256":"5079fa7a9d701e496b0c23d0505ffd495955135002058eec0dba047b09ded437","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/corpus/fixtures/box3d/edit.tsx","id":"box3d","frame":119,"why":"last","frames":120,"probed":true,"file":"frames/sdk__react__bench__corpus__fixtures__box3d__edit/119.png","png_sha256":"b12a30cbaad1f9ec83770fe89ae314978a0260b257bfd1aacdc7ca0b255fbebe","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/corpus/fixtures/deck/edit.tsx","id":"deck","frame":0,"why":"first","frames":270,"probed":true,"file":"frames/sdk__react__bench__corpus__fixtures__deck__edit/0.png","png_sha256":"89465a0f7430f20d9efd23653a7b60876478f1af8559331c547956fd4f9e9245","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/corpus/fixtures/deck/edit.tsx","id":"deck","frame":134,"why":"middle","frames":270,"probed":true,"file":"frames/sdk__react__bench__corpus__fixtures__deck__edit/134.png","png_sha256":"69867e147c8c07a8e62c38ea24f56f8ddceb73b0b2b3686f247b985f501242d4","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/corpus/fixtures/deck/edit.tsx","id":"deck","frame":269,"why":"last","frames":270,"probed":true,"file":"frames/sdk__react__bench__corpus__fixtures__deck__edit/269.png","png_sha256":"e584064f3547cf0a1ede7e5f658f30b838037d6eebed6607878e689994cde8be","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/corpus/fixtures/deck/edit.tsx","id":"deck","frame":168,"why":"text","frames":270,"probed":true,"file":"frames/sdk__react__bench__corpus__fixtures__deck__edit/168.png","png_sha256":"0a1e5e77f1b2b1fc4b1a44f28a444026d4c2a005de7778d2e47a1b083709b013","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/css/anim.tsx","id":"css","frame":0,"why":"first","frames":40,"probed":true,"file":"frames/sdk__react__bench__css__anim/0.png","png_sha256":"d9e0ac155070b6ed48bfbb183bddf1181d0c285f59e261390a39a4b5256ea408","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/css/anim.tsx","id":"css","frame":19,"why":"middle","frames":40,"probed":true,"file":"frames/sdk__react__bench__css__anim/19.png","png_sha256":"564cfd0b90618cfba6e7f84d361bedb29bc7d840fb73b3da02c25162a41a81ce","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/css/anim.tsx","id":"css","frame":39,"why":"last","frames":40,"probed":true,"file":"frames/sdk__react__bench__css__anim/39.png","png_sha256":"4a41cc8e76062c44967fe3cf9a7e4bf30f51d5b6bd52e8e031165933f6f83731","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/css/edit.tsx","id":"edit","frame":0,"why":"first","frames":30,"probed":true,"file":"frames/sdk__react__bench__css__edit/0.png","png_sha256":"4bdf7657b8092ca7d6edb7cd353e8cd1449671adc47fb8d658e78e2d5a0b9b69","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference drew #FF0000 as (255, 1, 0) (read back through NV12); now RGBA, as raea reads frames since 3c7d15cf, and pure red as Chrome draws it"}
+{"composition":"sdk/react/bench/css/edit.tsx","id":"edit","frame":14,"why":"middle","frames":30,"probed":true,"file":"frames/sdk__react__bench__css__edit/14.png","png_sha256":"4bdf7657b8092ca7d6edb7cd353e8cd1449671adc47fb8d658e78e2d5a0b9b69","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference drew #FF0000 as (255, 1, 0) (read back through NV12); now RGBA, as raea reads frames since 3c7d15cf, and pure red as Chrome draws it"}
+{"composition":"sdk/react/bench/css/edit.tsx","id":"edit","frame":29,"why":"last","frames":30,"probed":true,"file":"frames/sdk__react__bench__css__edit/29.png","png_sha256":"4bdf7657b8092ca7d6edb7cd353e8cd1449671adc47fb8d658e78e2d5a0b9b69","sha256":"fc46797b29c04d1b85fe2b4cbaedc86851b049a9e0c37a990ea3b22cbff4b506","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-fc46797b29c0/raea-motion","page":"bevy","recaptured":"10-24 bevy_ui page: its reference drew #FF0000 as (255, 1, 0) (read back through NV12); now RGBA, as raea reads frames since 3c7d15cf, and pure red as Chrome draws it"}
+{"composition":"sdk/react/bench/css/svg.tsx","id":"svg","frame":0,"why":"first","frames":1,"probed":true,"file":"frames/sdk__react__bench__css__svg/0.png","png_sha256":"fea2d59d3f60164eb0558866e8c1cb96bba8ae0d05e264adf840d1eedfae4260","sha256":"ec93ea774e5e9122e0ed0c1ab526731c1b30966a4fe919001db105853f68e3a9","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-ec93ea774e5e/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: NV12-era reference: the Blitz page read back through NV12 (RAEA_READBACK=nv12, as it was taken) scores >= 0.98 against it; stills are RGBA since 3c7d15cf"}
+{"composition":"sdk/react/bench/games/arena3d/edit.tsx","id":"edit","frame":0,"why":"first","frames":7200,"probed":true,"file":"frames/sdk__react__bench__games__arena3d__edit/0.png","png_sha256":"785995ea68bf25024de6192abba9446e37d591a27420baa2961bc1365d789bdc","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/arena3d/edit.tsx","id":"edit","frame":3599,"why":"middle","frames":7200,"probed":true,"file":"frames/sdk__react__bench__games__arena3d__edit/3599.png","png_sha256":"82c8de64f5292d1290b23fb21b853e64cdc8671e3c6c59ad14c19edfeb0cbb7e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/arena3d/edit.tsx","id":"edit","frame":7199,"why":"last","frames":7200,"probed":true,"file":"frames/sdk__react__bench__games__arena3d__edit/7199.png","png_sha256":"51c2a167d1ceb130960cfd9b3056de8eac005ec292c9d4fbed260da2efc441bd","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/arena3d/edit.tsx","id":"edit","frame":5399,"why":"text","frames":7200,"probed":true,"file":"frames/sdk__react__bench__games__arena3d__edit/5399.png","png_sha256":"2f7fbcc6a687700923aa7b547dfe2029fb834b718ccc5f7860fafc93650cee9b","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/platformer/edit.tsx","id":"edit","frame":0,"why":"first","frames":36000,"probed":true,"file":"frames/sdk__react__bench__games__platformer__edit/0.png","png_sha256":"7d39b50865a72604ca2ae443c61d2bbf2a9d9e686c7dc4ce213b16643e86898c","sha256":"bcdfa860b9e3b725ebe2ee0cb04285637aa8e3a4f76c6b94547a0f923a69a634","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-bcdfa860b9e3/raea-motion","page":"bevy","recaptured":"10-23 bevy_ui page: Chrome draws border-radius 450px 450px 0 0 on a 900 px box as a dome (the radii sum to the width, no scaling); Blitz flattened the tops"}
+{"composition":"sdk/react/bench/games/platformer/edit.tsx","id":"edit","frame":17999,"why":"middle","frames":36000,"probed":true,"file":"frames/sdk__react__bench__games__platformer__edit/17999.png","png_sha256":"c9566bf1bc694173eda9919d798b59cebe56c4b24824a2a9bfd1f86675ec3d37","sha256":"bcdfa860b9e3b725ebe2ee0cb04285637aa8e3a4f76c6b94547a0f923a69a634","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-bcdfa860b9e3/raea-motion","page":"bevy","recaptured":"10-23 bevy_ui page: Chrome draws border-radius 450px 450px 0 0 on a 900 px box as a dome (the radii sum to the width, no scaling); Blitz flattened the tops"}
+{"composition":"sdk/react/bench/games/platformer/edit.tsx","id":"edit","frame":35999,"why":"last","frames":36000,"probed":true,"file":"frames/sdk__react__bench__games__platformer__edit/35999.png","png_sha256":"68280512c5e3fe5c1f442d0537dd372a3ecc7e657154935918576be60ebeff49","sha256":"bcdfa860b9e3b725ebe2ee0cb04285637aa8e3a4f76c6b94547a0f923a69a634","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-bcdfa860b9e3/raea-motion","page":"bevy","recaptured":"10-23 bevy_ui page: Chrome draws border-radius 450px 450px 0 0 on a 900 px box as a dome (the radii sum to the width, no scaling); Blitz flattened the tops"}
+{"composition":"sdk/react/bench/games/platformer/edit.tsx","id":"edit","frame":26999,"why":"text","frames":36000,"probed":true,"file":"frames/sdk__react__bench__games__platformer__edit/26999.png","png_sha256":"a70c93795d45437e0402dbafa33373c10fdf3d35a781db83c50b6a91fc3487b3","sha256":"bcdfa860b9e3b725ebe2ee0cb04285637aa8e3a4f76c6b94547a0f923a69a634","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-bcdfa860b9e3/raea-motion","page":"bevy","recaptured":"10-23 bevy_ui page: Chrome draws border-radius 450px 450px 0 0 on a 900 px box as a dome (the radii sum to the width, no scaling); Blitz flattened the tops"}
+{"composition":"sdk/react/bench/games/pong/edit.stepfold.tsx","id":"edit","frame":0,"why":"first","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit.stepfold/0.png","png_sha256":"564fe64317b8abae9bc593ee47aca81a6790fc8fea2e1fbfdb34e093f6a10add","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.stepfold.tsx","id":"edit","frame":2333,"why":"middle","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit.stepfold/2333.png","png_sha256":"564fe64317b8abae9bc593ee47aca81a6790fc8fea2e1fbfdb34e093f6a10add","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.stepfold.tsx","id":"edit","frame":4667,"why":"last","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit.stepfold/4667.png","png_sha256":"564fe64317b8abae9bc593ee47aca81a6790fc8fea2e1fbfdb34e093f6a10add","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.tsx","id":"edit","frame":0,"why":"first","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit/0.png","png_sha256":"ce53a84b1b9976516c61e056bfe8ed9b3248a9c960af399d60f1512cda032caf","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.tsx","id":"edit","frame":2333,"why":"middle","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit/2333.png","png_sha256":"ec07c6aa52b4f5c3283731d95c71653d88f59be3f558019e0caf01f7c9c596ba","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.tsx","id":"edit","frame":4667,"why":"last","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit/4667.png","png_sha256":"ec07c6aa52b4f5c3283731d95c71653d88f59be3f558019e0caf01f7c9c596ba","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.view.tsx","id":"edit","frame":0,"why":"first","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit.view/0.png","png_sha256":"b3e09c685d8e0037d031127d97f9db03f7642338d0572157d2161cd655f6fa66","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.view.tsx","id":"edit","frame":2333,"why":"middle","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit.view/2333.png","png_sha256":"cf64790df03e800779c72ae52e1d594bba8fab7d89e1382cdda308ceb2279925","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/pong/edit.view.tsx","id":"edit","frame":4667,"why":"last","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__pong__edit.view/4667.png","png_sha256":"cf64790df03e800779c72ae52e1d594bba8fab7d89e1382cdda308ceb2279925","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/tones/edit.tsx","id":"tones","frame":0,"why":"first","frames":300,"probed":true,"file":"frames/sdk__react__bench__games__tones__edit/0.png","png_sha256":"5e49c881191abfa64f4d49ce7f871307a87e8e7b2cb0512318d6b7e33ce054e3","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/tones/edit.tsx","id":"tones","frame":149,"why":"middle","frames":300,"probed":true,"file":"frames/sdk__react__bench__games__tones__edit/149.png","png_sha256":"5e49c881191abfa64f4d49ce7f871307a87e8e7b2cb0512318d6b7e33ce054e3","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/tones/edit.tsx","id":"tones","frame":299,"why":"last","frames":300,"probed":true,"file":"frames/sdk__react__bench__games__tones__edit/299.png","png_sha256":"5e49c881191abfa64f4d49ce7f871307a87e8e7b2cb0512318d6b7e33ce054e3","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/ml/chaser/edit.tsx","id":"chaser","frame":0,"why":"first","frames":3600,"probed":true,"file":"frames/sdk__react__bench__ml__chaser__edit/0.png","png_sha256":"2623f97ca8dcb9ce219c169007ce837d7fe85f4011d5418ada18799d98f1bbec","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/ml/chaser/edit.tsx","id":"chaser","frame":1799,"why":"middle","frames":3600,"probed":true,"file":"frames/sdk__react__bench__ml__chaser__edit/1799.png","png_sha256":"36c50b421d6711456d66a0b0d5eddbeffb8a5e6404d70bde4ff5abd10d6f6c2c","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/ml/chaser/edit.tsx","id":"chaser","frame":3599,"why":"last","frames":3600,"probed":true,"file":"frames/sdk__react__bench__ml__chaser__edit/3599.png","png_sha256":"36c50b421d6711456d66a0b0d5eddbeffb8a5e6404d70bde4ff5abd10d6f6c2c","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/ml/chaser/orbit.tsx","id":"orbit","frame":0,"why":"first","frames":360,"probed":true,"file":"frames/sdk__react__bench__ml__chaser__orbit/0.png","png_sha256":"2623f97ca8dcb9ce219c169007ce837d7fe85f4011d5418ada18799d98f1bbec","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/ml/chaser/orbit.tsx","id":"orbit","frame":179,"why":"middle","frames":360,"probed":true,"file":"frames/sdk__react__bench__ml__chaser__orbit/179.png","png_sha256":"f4f3b8ae158fb5e2e7b769b3da0b6c351348a42c99b0b7d05123cef7735f088e","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/ml/chaser/orbit.tsx","id":"orbit","frame":359,"why":"last","frames":360,"probed":true,"file":"frames/sdk__react__bench__ml__chaser__orbit/359.png","png_sha256":"3fefd7b761c72440fb55214e0a44e6c793d09b384561db12601f504c01daf2bb","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/ml/chaser/orbit.tsx","id":"orbit","frame":134,"why":"text","frames":360,"probed":true,"file":"frames/sdk__react__bench__ml__chaser__orbit/134.png","png_sha256":"24226e2655192bab8b46a43020d53179b88dc3137873c5c6cf558901332c2335","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/playtest/fixtures/ledge-fixed/edit.tsx","id":"edit","frame":0,"why":"first","frames":36000,"probed":true,"file":"frames/sdk__react__bench__playtest__fixtures__ledge-fixed__edit/0.png","png_sha256":"ca0cbe45ab6436a3190ab79e79a2b514be2eb8bfd13fddd327d286a26de3ffbc","sha256":"bcdfa860b9e3b725ebe2ee0cb04285637aa8e3a4f76c6b94547a0f923a69a634","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-bcdfa860b9e3/raea-motion","page":"bevy","recaptured":"10-23 bevy_ui page: Chrome draws border-radius 450px 450px 0 0 on a 900 px box as a dome (the radii sum to the width, no scaling); Blitz flattened the tops"}
+{"composition":"sdk/react/bench/playtest/fixtures/ledge-fixed/edit.tsx","id":"edit","frame":17999,"why":"middle","frames":36000,"probed":true,"file":"frames/sdk__react__bench__playtest__fixtures__ledge-fixed__edit/17999.png","png_sha256":"8a8e067208fa5c0e3b51c61356323aecc049299d415c1d3bf68e63bce261cfea","sha256":"bcdfa860b9e3b725ebe2ee0cb04285637aa8e3a4f76c6b94547a0f923a69a634","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-bcdfa860b9e3/raea-motion","page":"bevy","recaptured":"10-23 bevy_ui page: Chrome draws border-radius 450px 450px 0 0 on a 900 px box as a dome (the radii sum to the width, no scaling); Blitz flattened the tops"}
+{"composition":"sdk/react/bench/playtest/fixtures/ledge-fixed/edit.tsx","id":"edit","frame":35999,"why":"last","frames":36000,"probed":true,"file":"frames/sdk__react__bench__playtest__fixtures__ledge-fixed__edit/35999.png","png_sha256":"52c9b0d385421b6d4a5283f5e62dbde6396879a1acb01f4cea4b04c05e89f465","sha256":"bcdfa860b9e3b725ebe2ee0cb04285637aa8e3a4f76c6b94547a0f923a69a634","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-bcdfa860b9e3/raea-motion","page":"bevy","recaptured":"10-23 bevy_ui page: Chrome draws border-radius 450px 450px 0 0 on a 900 px box as a dome (the radii sum to the width, no scaling); Blitz flattened the tops"}
+{"composition":"sdk/react/bench/speech/game/edit.tsx","id":"narrator","frame":0,"why":"first","frames":2400,"probed":true,"file":"frames/sdk__react__bench__speech__game__edit/0.png","png_sha256":"c29772453737f35be4191bf1765dd6e64c3f7cbdaebf6c5c4b9f12cf68c8b62a","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/speech/game/edit.tsx","id":"narrator","frame":1199,"why":"middle","frames":2400,"probed":true,"file":"frames/sdk__react__bench__speech__game__edit/1199.png","png_sha256":"d1247d12ba7c368a7abc34dd42e145e052d1bc8fb72f5745fb8d645e30ca8e0c","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/speech/game/edit.tsx","id":"narrator","frame":2399,"why":"last","frames":2400,"probed":true,"file":"frames/sdk__react__bench__speech__game__edit/2399.png","png_sha256":"7ee5dad7c28bec7d8067ef5f5c8b16e36c6175cf9bf42cacee7e19f393050d09","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/speech/game/quiet.tsx","id":"quiet","frame":0,"why":"first","frames":2400,"probed":true,"file":"frames/sdk__react__bench__speech__game__quiet/0.png","png_sha256":"c29772453737f35be4191bf1765dd6e64c3f7cbdaebf6c5c4b9f12cf68c8b62a","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/speech/game/quiet.tsx","id":"quiet","frame":1199,"why":"middle","frames":2400,"probed":true,"file":"frames/sdk__react__bench__speech__game__quiet/1199.png","png_sha256":"bae8e02090a7a0307edbb90593a1a7a1499bcb264a66a1f7a036ab58c8d89c95","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/speech/game/quiet.tsx","id":"quiet","frame":2399,"why":"last","frames":2400,"probed":true,"file":"frames/sdk__react__bench__speech__game__quiet/2399.png","png_sha256":"7ee5dad7c28bec7d8067ef5f5c8b16e36c6175cf9bf42cacee7e19f393050d09","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/animate/edit.tsx","id":"animate","frame":0,"why":"first","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__animate__edit/0.png","png_sha256":"19a772ab65cc744ee80eea4a761d3aa2fc3db24a0a411e7d08b4a77879ea46dc","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/animate/edit.tsx","id":"animate","frame":299,"why":"middle","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__animate__edit/299.png","png_sha256":"60f79e7103d85b35261929c5323304e847b5920bd0270d6212d194017aed83e7","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/animate/edit.tsx","id":"animate","frame":599,"why":"last","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__animate__edit/599.png","png_sha256":"ac6b188ecbd98365570d9194ef28596b941341e68a1c55b2f85ffc09eea52541","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/animate/edit.tsx","id":"animate","frame":224,"why":"text","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__animate__edit/224.png","png_sha256":"578803dcbf0da509cc92d93b02f05fb914cd62eec7b210b4f4f0d61eb626d192","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/solids/edit.tsx","id":"edit","frame":0,"why":"first","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__solids__edit/0.png","png_sha256":"2c44b625431a13bcc56ed047fa94755e0c2520e46a42dcd164ed8683249a04ff","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/solids/edit.tsx","id":"edit","frame":299,"why":"middle","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__solids__edit/299.png","png_sha256":"67868806ee3984ad0cb952291dcc2b5f7a2f4c6f3e7d2792686000a954bd222c","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/solids/edit.tsx","id":"edit","frame":599,"why":"last","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__solids__edit/599.png","png_sha256":"d301f07881996c7c382f447aa3a3982691f8c71e64da66478a8954106028f4d0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/titles/edit.tsx","id":"edit","frame":0,"why":"first","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__titles__edit/0.png","png_sha256":"0402dc02c726875eac23b650e06c7d37a03dbae9f88e99d12cdd627553c42081","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/titles/edit.tsx","id":"edit","frame":299,"why":"middle","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__titles__edit/299.png","png_sha256":"3d1f33dbaab66ce9771517acfb7b65322a8193a74c44e4324b8be2c5ca040547","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/timelines/titles/edit.tsx","id":"edit","frame":599,"why":"last","frames":600,"probed":true,"file":"frames/sdk__react__bench__timelines__titles__edit/599.png","png_sha256":"eef2532499ef56e0ea5e4b68e1093cfb82d8c3ac7c9d660496d6e417751fd716","sha256":"ec93ea774e5e9122e0ed0c1ab526731c1b30966a4fe919001db105853f68e3a9","binary":"~/Library/Caches/raea/p26-baseline/bin-bevy-ec93ea774e5e/raea-motion","page":"blitz","recaptured":"10-24 Blitz page: NV12-era reference: the Blitz page read back through NV12 (RAEA_READBACK=nv12, as it was taken) scores >= 0.98 against it; stills are RGBA since 3c7d15cf"}
+{"composition":"sdk/react/bench/games/music/edit.tsx","id":"music","frame":0,"why":"first","frames":240,"probed":true,"file":"frames/sdk__react__bench__games__music__edit/0.png","png_sha256":"d42bd7553602f1b3b5ca8b39f0d8da431891ef2b6cf1e1bf042e94cf6bd795a0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/music/edit.tsx","id":"music","frame":119,"why":"middle","frames":240,"probed":true,"file":"frames/sdk__react__bench__games__music__edit/119.png","png_sha256":"d42bd7553602f1b3b5ca8b39f0d8da431891ef2b6cf1e1bf042e94cf6bd795a0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/music/edit.tsx","id":"music","frame":239,"why":"last","frames":240,"probed":true,"file":"frames/sdk__react__bench__games__music__edit/239.png","png_sha256":"d42bd7553602f1b3b5ca8b39f0d8da431891ef2b6cf1e1bf042e94cf6bd795a0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/room3d/edit.tsx","id":"edit","frame":0,"why":"first","frames":7200,"probed":true,"file":"frames/sdk__react__bench__games__room3d__edit/0.png","png_sha256":"6b7d880059a56f8f4b048295d863ae219eeaad366d5040f9dc4b3299892caa07","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/room3d/edit.tsx","id":"edit","frame":3599,"why":"middle","frames":7200,"probed":true,"file":"frames/sdk__react__bench__games__room3d__edit/3599.png","png_sha256":"3f6b89fe9f6c393053403f11b4598068f6f7597a4c551b0bf1a555cbc76fddb0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/room3d/edit.tsx","id":"edit","frame":7199,"why":"last","frames":7200,"probed":true,"file":"frames/sdk__react__bench__games__room3d__edit/7199.png","png_sha256":"b3943831a1766d741a8f8abe4bb942ccde80ea4213fe871b0c5523f5dfd66cf8","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/seedling/edit.tsx","id":"edit","frame":0,"why":"first","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__seedling__edit/0.png","png_sha256":"ce53a84b1b9976516c61e056bfe8ed9b3248a9c960af399d60f1512cda032caf","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/seedling/edit.tsx","id":"edit","frame":2333,"why":"middle","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__seedling__edit/2333.png","png_sha256":"ec07c6aa52b4f5c3283731d95c71653d88f59be3f558019e0caf01f7c9c596ba","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/games/seedling/edit.tsx","id":"edit","frame":4667,"why":"last","frames":4668,"probed":true,"file":"frames/sdk__react__bench__games__seedling__edit/4667.png","png_sha256":"ec07c6aa52b4f5c3283731d95c71653d88f59be3f558019e0caf01f7c9c596ba","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/game/edit.tsx","id":"game","frame":0,"why":"first","frames":300,"probed":true,"file":"frames/sdk__react__bench__tone__game__edit/0.png","png_sha256":"a3637c03bcb12caa119c270b828e2b672277c11d15b195b22787a1cb11551b34","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/game/edit.tsx","id":"game","frame":149,"why":"middle","frames":300,"probed":true,"file":"frames/sdk__react__bench__tone__game__edit/149.png","png_sha256":"67d431098e50189ab90bc711670af37cd741028d845f246ce68867cfb2ce2a32","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/game/edit.tsx","id":"game","frame":299,"why":"last","frames":300,"probed":true,"file":"frames/sdk__react__bench__tone__game__edit/299.png","png_sha256":"d2b280eae5a62c0ab11d3c94d7ba7acab3a95e0f4ec1fd9c89e5c9b95e8f6687","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/gaps/edit.tsx","id":"gaps","frame":0,"why":"first","frames":240,"probed":true,"file":"frames/sdk__react__bench__tone__gaps__edit/0.png","png_sha256":"d6575a94e3e89f717769ecf10515e40fe950cbaca2dc8ed0b2928e62a5e417f5","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/gaps/edit.tsx","id":"gaps","frame":119,"why":"middle","frames":240,"probed":true,"file":"frames/sdk__react__bench__tone__gaps__edit/119.png","png_sha256":"a2a85a1891ddf2c424ee8b3538a9389cb6958d361b796aca97ae32164bc4d3e4","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/gaps/edit.tsx","id":"gaps","frame":239,"why":"last","frames":240,"probed":true,"file":"frames/sdk__react__bench__tone__gaps__edit/239.png","png_sha256":"88cd73071d5d234d35fa6ed43c5d70f1712febd6ec257d450d8aac33fcecfd8f","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/song/edit.tsx","id":"song","frame":0,"why":"first","frames":480,"probed":true,"file":"frames/sdk__react__bench__tone__song__edit/0.png","png_sha256":"b9ffaf213bf21fdd2d393a6057bc44283b6b47e993ac6392e8976a4ec7b9bbf0","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/song/edit.tsx","id":"song","frame":239,"why":"middle","frames":480,"probed":true,"file":"frames/sdk__react__bench__tone__song__edit/239.png","png_sha256":"628d6c367b8aef7b0768e515cba4bf2425486b5a1ee944f3021c9862e1c624b2","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/song/edit.tsx","id":"song","frame":479,"why":"last","frames":480,"probed":true,"file":"frames/sdk__react__bench__tone__song__edit/479.png","png_sha256":"75537b0ee0a351dba23908a10beb4ca5ef534bfb09dd7e122133d203da598fac","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/tokensynth/edit.tsx","id":"tokensynth","frame":0,"why":"first","frames":330,"probed":true,"file":"frames/sdk__react__bench__tone__tokensynth__edit/0.png","png_sha256":"144e07ff1de22a93de7c129924a01d5ef832b2a79d904dc1205ed277f34f32ea","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/tokensynth/edit.tsx","id":"tokensynth","frame":164,"why":"middle","frames":330,"probed":true,"file":"frames/sdk__react__bench__tone__tokensynth__edit/164.png","png_sha256":"144e07ff1de22a93de7c129924a01d5ef832b2a79d904dc1205ed277f34f32ea","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/react/bench/tone/tokensynth/edit.tsx","id":"tokensynth","frame":329,"why":"last","frames":330,"probed":true,"file":"frames/sdk__react__bench__tone__tokensynth__edit/329.png","png_sha256":"144e07ff1de22a93de7c129924a01d5ef832b2a79d904dc1205ed277f34f32ea","sha256":"db30cf97dca8f78486df47c6fb042372ecb4d920d577227d14eb3aea35dc581c","binary":"~/Library/Caches/raea/p26-baseline/bin/raea-motion","page":""}
+{"composition":"sdk/raea/bench/bevy/materials/edit.tsx","id":"materials","frame":0,"why":"first","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__materials__edit/0.png","png_sha256":"1a68e466945d1c859ed3b5d06e3012680493c0d7a45c3f75ed9e5bbbec228d2d","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/materials/edit.tsx","id":"materials","frame":29,"why":"middle","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__materials__edit/29.png","png_sha256":"3297cf517b6fe62df98f5c50faa353c9a58e9f57fa11dd300641bb6aacdd3f45","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/materials/edit.tsx","id":"materials","frame":59,"why":"last","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__materials__edit/59.png","png_sha256":"ca22af5da18b44664643624e8b84c616c25be864d174384e5e2febcd28b6e512","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/volumetric-grid/edit.tsx","id":"volumetric-grid","frame":0,"why":"first","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-grid__edit/0.png","png_sha256":"a6b80976e0afe78e76e225d06b5a63406a5eef783d643b71188089b4cd2dbd04","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/volumetric-grid/edit.tsx","id":"volumetric-grid","frame":29,"why":"middle","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-grid__edit/29.png","png_sha256":"90ce5ad82bf2b2645aede9779dc4602365fe91c60286ccad18abc94d864a59f1","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/volumetric-grid/edit.tsx","id":"volumetric-grid","frame":59,"why":"last","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-grid__edit/59.png","png_sha256":"096c8c161b972da6929a3fc459635d6cced503a431a59ffaaac777bf409faf4c","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/volumetric-froxel/edit.tsx","id":"volumetric-froxel","frame":0,"why":"first","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-froxel__edit/0.png","png_sha256":"6c51c3b19104c9fb61c6381ecd84e9a66d1d8fad1e2ba9218beffe6c60a7520b","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/volumetric-froxel/edit.tsx","id":"volumetric-froxel","frame":29,"why":"middle","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-froxel__edit/29.png","png_sha256":"5b51378955fc5084b4246ae9095b7afaf6a4ea26ad54727a1e140cfc2d4c95bb","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/volumetric-froxel/edit.tsx","id":"volumetric-froxel","frame":59,"why":"last","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__volumetric-froxel__edit/59.png","png_sha256":"9a44050a6a654ccfd35fd4c7ace47740fe9479a3d07b0db968412281e87cca9c","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/layers/edit.tsx","id":"layers","frame":0,"why":"first","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__layers__edit/0.png","png_sha256":"56a6221520a67416024d5c3c805cd8bb0cfa2f3d20d645e1271f970f55df3360","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/layers/edit.tsx","id":"layers","frame":29,"why":"middle","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__layers__edit/29.png","png_sha256":"9c7043d6757bb644a9f47e5ca0980090d4a28c00a6640030dc6539d0ff13bf74","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
+{"composition":"sdk/raea/bench/bevy/layers/edit.tsx","id":"layers","frame":59,"why":"last","frames":60,"cands":"0,7,14,22,29,36,44,51,59","probed":true,"file":"frames/sdk__motion__bench__bevy__layers__edit/59.png","png_sha256":"219f8fab56dad44f7aadaa9c08b4ed94939a0b084d3bb6f66f1fd968edca2744","sha256":"04500a2b764266729c922911d78b175d723d30a615919fa343bcb32f49d37e9d","binary":"~/Library/Caches/raea/p26-baseline/bin-tree/raea-motion","page":"","recaptured":"pin took page-file stills, fed path is the reference (RAEA_MOTION_3D=files today = pin at 1.000000; pin frames in ~/Library/Caches/raea/p26-baseline/frames-pin)"}
diff --git a/bench/p26-baseline/props/brand.css b/bench/p26-baseline/props/brand.css
new file mode 100644
index 00000000..0dd7dc56
--- /dev/null
+++ b/bench/p26-baseline/props/brand.css
@@ -0,0 +1,62 @@
+/* P26 baseline: the brand kit every registry part's example renders with (ai/score/bench/kits/house/brand/brand.css, copied) */
+/* a house kit for the .brief stage-2 gate: a real brand's kit (sizes, type, spacing) with neutral colours, the same for every scenario and both arms */
+/* A brand kit from a website's styleguide (context.dev, 2026-10-17).
+ Link it from an edit: <link rel="stylesheet" href="../assets/brand/brand.css">
+ Sizes are the website's; on a 1080x1920 video, scale them up (about 2.5x for captions and titles).
+ Edit freely: nothing overwrites this file unless the brand kit is refreshed. */
+@import url("https://fonts.googleapis.com/css2?family=Inter:wght@700&family=Oswald:wght@400;700&display=swap");
+
+:root {
+ --brand-accent: #ffd400;
+ --brand-background: #111111;
+ --brand-text: #ffffff;
+ --brand-color-1: #ffd400;
+ --brand-color-2: #ffffff;
+ --brand-color-3: #111111;
+ --brand-color-4: #2b2b2b;
+ --brand-color-5: #e5e5e5;
+ --brand-font-heading: "Inter", sans-serif;
+ --brand-font: "Oswald", sans-serif;
+ --brand-h1-size: 35px;
+ --brand-h1-weight: 700;
+ --brand-h1-line: 42px;
+ --brand-h1-tracking: 0px;
+ --brand-h2-size: 28px;
+ --brand-h2-weight: 700;
+ --brand-h2-line: 34px;
+ --brand-h2-tracking: 0px;
+ --brand-h3-size: 23px;
+ --brand-h3-weight: 700;
+ --brand-h3-line: 34px;
+ --brand-h3-tracking: 1px;
+ --brand-h4-size: 19px;
+ --brand-h4-weight: 700;
+ --brand-h4-line: 25.5px;
+ --brand-h4-tracking: 3px;
+ --brand-p-size: 15px;
+ --brand-p-weight: 400;
+ --brand-p-line: 25.5px;
+ --brand-p-tracking: 1px;
+ --brand-space-xs: 6px;
+ --brand-space-sm: 16px;
+ --brand-space-md: 24px;
+ --brand-space-lg: 40px;
+ --brand-space-xl: 50px;
+ --brand-shadow-sm: rgba(0, 0, 0, 0.12) 0px 4px 6px 0px;
+ --brand-shadow-md: rgba(0, 0, 0, 0.14) 0px 12px 24px 0px;
+ --brand-shadow-lg: rgba(0, 0, 0, 0.18) 0px 24px 48px -12px;
+ --brand-shadow-xl: none;
+ --brand-shadow-inner: none;
+ --brand-radius: 8px;
+}
+
+.brand-h1 { font-family: var(--brand-font-heading); font-size: var(--brand-h1-size); font-weight: var(--brand-h1-weight); line-height: var(--brand-h1-line); letter-spacing: var(--brand-h1-tracking); }
+.brand-h2 { font-family: var(--brand-font-heading); font-size: var(--brand-h2-size); font-weight: var(--brand-h2-weight); line-height: var(--brand-h2-line); letter-spacing: var(--brand-h2-tracking); }
+.brand-h3 { font-family: var(--brand-font-heading); font-size: var(--brand-h3-size); font-weight: var(--brand-h3-weight); line-height: var(--brand-h3-line); letter-spacing: var(--brand-h3-tracking); }
+.brand-h4 { font-family: var(--brand-font-heading); font-size: var(--brand-h4-size); font-weight: var(--brand-h4-weight); line-height: var(--brand-h4-line); letter-spacing: var(--brand-h4-tracking); }
+.brand-text { font-family: var(--brand-font); font-size: var(--brand-p-size); font-weight: var(--brand-p-weight); line-height: var(--brand-p-line); letter-spacing: var(--brand-p-tracking); }
+
+.brand-button-link { color: #000000; font-size: 18px; font-weight: 400; font-family: "Inter", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; text-decoration: none; }
+.brand-button, .brand-button-primary { box-sizing: border-box; display: inline-block; min-width: 86px; min-height: 52px; background-color: #242424; color: #e9c518; border: 2px solid transparent; border-radius: 2px; padding: 11px 10px; font-size: 18px; font-weight: 400; font-family: Oswald, "Arial Black", "Arial Bold", Gadget, sans-serif; text-decoration: none; }
+.brand-button-secondary { box-sizing: border-box; display: inline-block; min-width: 86px; min-height: 52px; background-color: transparent; color: #000000; border: 2px solid #000000; border-radius: 0px; padding: 11px 10px; font-size: 18px; font-weight: 400; font-family: Montserrat; text-decoration: none; }
+.brand-card { background-color: #ffffff; color: #212529; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; }
diff --git a/bench/p26-baseline/recapture.sh b/bench/p26-baseline/recapture.sh
new file mode 100755
index 00000000..ca91ceb8
--- /dev/null
+++ b/bench/p26-baseline/recapture.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+# P26 recapture: baseline frames made again from the bevy_ui page, each with the reason. Chrome is P26's reference
+# (Shane, 10-23: "it renders how typescript/react expect"): where the bevy_ui page differs from a Blitz frame and matches
+# Chrome, that frame is retaken from the bevy_ui page and its row says why. Only the frames named are touched.
+# P26_RECAPTURE_PAGE=blitz retakes them from the Blitz page instead, for a reference whose bevy_ui page disagrees with
+# Chrome where the Blitz page agrees (the reason names the check against Chrome).
+#
+# RECAPTURED="why" [P26_RECAPTURE_PAGE=blitz] bench/p26-baseline/recapture.sh RAEA_MOTION ENTRY...
+#
+# ENTRY is a composition as manifest.jsonl names it (file.tsx or file.tsx#ID), alone (every frame of it) or with
+# @F,G (those frames). Each composition renders as compare.sh renders it (the bevy_ui page, at the baseline's
+# candidate frames, the plugin build for a plugin entry), so a recaptured frame is the one compare.sh will draw.
+# RAEA_MOTION (with its libraea_bundle.dylib beside it) is copied under $P26_STORE/bin-bevy-<sha> and the rows name
+# that copy; the frame each replaces is kept under $P26_STORE/frames-blitz/ (the first one only). A row gets the new
+# PNG's sha256, the binary's, its page ("bevy" or "blitz") and "recaptured": why (the date first).
+# RAEA_MOTION is built without incremental (`lane build -- env CARGO_INCREMENTAL=0 cargo build --release -p raea-cli`;
+# lane's builds are incremental otherwise): an incremental build moves a few frames by up to 5 pixels (Cargo.toml's
+# [profile.release] note), and a baseline is a reference.
+set -uo pipefail
+HERE=$(cd "$(dirname "$0")" && pwd)
+. "$HERE/lib.sh"
+# pixel checks: no Content Credentials or TrustMark id in the frames (a still's mark changes its pixels each run)
+export RAEA_SIGN=0 RAEA_MARK=0
+ROOT=$(cd "$HERE/../.." && pwd)
+STORE=${P26_STORE:-$HOME/Library/Caches/raea/p26-baseline}
+[ $# -ge 2 ] && [ -n "${RECAPTURED:-}" ] || { echo "usage: RECAPTURED=\"why\" recapture.sh RAEA_MOTION ENTRY[@F,G]..." >&2; exit 2; }
+SRC_BIN=$1; shift
+[ -x "$SRC_BIN" ] || { echo "recapture.sh: no raea at $SRC_BIN" >&2; exit 2; }
+SHA=$(shasum -a 256 "$SRC_BIN" | cut -d' ' -f1)
+KEEP=$STORE/bin-bevy-${SHA:0:12}
+if [ ! -x "$KEEP/raea-motion" ]; then
+ mkdir -p "$KEEP" && cp "$SRC_BIN" "$KEEP/raea-motion"
+ [ -f "$(dirname "$SRC_BIN")/libraea_bundle.dylib" ] && cp "$(dirname "$SRC_BIN")/libraea_bundle.dylib" "$KEEP/"
+fi
+BIN=$KEEP/raea-motion
+BIN_SHOWN="~${BIN#"$HOME"}"; [ "${BIN#"$HOME"}" = "$BIN" ] && BIN_SHOWN=$BIN
+PLUGIN_BIN=${P26_PLUGIN_BIN:-$ROOT/sdk/raea/bench/bevy-plugins/motion.sh}
+PAGE=${P26_RECAPTURE_PAGE:-blitz}
+case $PAGE in bevy) SHOWN_PAGE="bevy_ui page" ;; blitz) SHOWN_PAGE="Blitz page" ;; *) echo "recapture.sh: P26_RECAPTURE_PAGE is bevy or blitz" >&2; exit 2 ;; esac
+WHY="$(date +%m-%d) $SHOWN_PAGE: $RECAPTURED"
+WORK=$(mktemp -d "${TMPDIR:-/tmp}/p26-recapture.XXXXXX")
+trap 'rm -rf "$WORK"' EXIT
+M=$HERE/manifest.jsonl
+n=0
+for entry in "$@"; do
+ rel=${entry%%@*}
+ want=""; [[ "$entry" == *@* ]] && want=${entry#*@}
+ rows=$(jq -c --arg c "$rel" 'select(.composition == $c)' "$M")
+ [ -n "$rows" ] || { echo "recapture.sh: $rel isn't in manifest.jsonl" >&2; exit 1; }
+ [ -n "$want" ] || want=$(echo "$rows" | jq -r .frame | paste -sd, -)
+ p26_src "$rel"
+ bin=$BIN; shown=$BIN_SHOWN
+ # a plugin entry stays one (compare.sh picks the plugin build by its row's binary)
+ echo "$rows" | jq -r .binary | grep -qE 'bevy-plugins|bin-avian' && bin=$PLUGIN_BIN && shown=$PLUGIN_BIN
+ cands=$(echo "$rows" | jq -r '.cands // empty' | head -1)
+ if [ -z "$cands" ]; then
+ last=$(( $(echo "$rows" | jq -r .frames | head -1) - 1 ))
+ cands=$(for i in 0 1 2 3 4 5 6 7 8; do echo $((last * i / 8)); done | awk '!seen[$0]++' | paste -sd, -)
+ fi
+ rm -rf "$WORK/r" && mkdir -p "$WORK/r"
+ if ! (cd "$dir" && RAEA_PAGE=$PAGE "$bin" render "$src" ${copt[@]+"${copt[@]}"} --at "$cands" -o "$WORK/r/") > "$WORK/log" 2>&1; then
+ echo "recapture.sh: $rel didn't render: $(grep -E 'REFUSED|error|Error|panicked' "$WORK/log" | head -1 | cut -c1-300)" >&2; exit 1
+ fi
+ IFS=, read -ra list <<< "$cands"
+ for f in ${want//,/ }; do
+ file=$(echo "$rows" | jq -r --argjson f "$f" 'select(.frame == $f) | .file')
+ [ -n "$file" ] || { echo "recapture.sh: $rel has no frame $f in manifest.jsonl" >&2; exit 1; }
+ idx=-1
+ for i in "${!list[@]}"; do [ "${list[$i]}" = "$f" ] && idx=$i; done
+ png=$(printf "%s/r/frame-%05d.png" "$WORK" "$idx")
+ [ $idx -ge 0 ] && [ -f "$png" ] || { echo "recapture.sh: $rel frame $f wasn't rendered" >&2; exit 1; }
+ mkdir -p "$(dirname "$STORE/frames-blitz/${file#frames/}")"
+ [ -f "$STORE/frames-blitz/${file#frames/}" ] || cp "$STORE/$file" "$STORE/frames-blitz/${file#frames/}" 2>/dev/null
+ cp "$png" "$STORE/$file"
+ psha=$(shasum -a 256 "$png" | cut -d' ' -f1)
+ jq -c --arg c "$rel" --argjson f "$f" --arg p "$psha" --arg s "$SHA" --arg b "$shown" --arg w "$WHY" --arg pg "$PAGE" \
+ 'if .composition == $c and .frame == $f then .png_sha256 = $p | .sha256 = $s | .binary = $b | .page = $pg | .recaptured = $w else . end' \
+ "$M" > "$WORK/m" && cat "$WORK/m" > "$M"
+ echo "recaptured $rel@$f"
+ n=$((n + 1))
+ done
+done
+echo "P26 recapture: $n frames"
diff --git a/bench/render-play/pick3d.json b/bench/render-play/pick3d.json
new file mode 100644
index 00000000..3e9a0a57
--- /dev/null
+++ b/bench/render-play/pick3d.json
@@ -0,0 +1,20 @@
+{
+ "0": [
+ "Pointer:480:60"
+ ],
+ "10": [
+ "Pointer:295:270"
+ ],
+ "16": [
+ "Pointer:665:270"
+ ],
+ "24": [
+ "Pointer:480:60"
+ ],
+ "4": [
+ "Pointer:295:270"
+ ],
+ "8": [
+ "Pointer:295:270:down"
+ ]
+}
diff --git a/bench/render-play/rows.tsv b/bench/render-play/rows.tsv
new file mode 100644
index 00000000..20bfaccd
--- /dev/null
+++ b/bench/render-play/rows.tsv
@@ -0,0 +1,23 @@
+# The render = play bench's rows (run.sh): each composition played live offscreen with its input, the input it logged
+# rendered at the same frames, and the two pictures compared. Columns, tab-separated:
+# path the composition, from the repo root
+# input - (none), keys:A,B+C,,D (RAEA_INPUT_KEYS: the play's random input thread picks from these sets) or
+# script:FILE ({"FRAME": [keys]}, "Pointer:X:Y[:down]" for the pointer; FILE from the repo root)
+# seconds the moments compared, space-separated
+# explained empty, or why the row may sit under 1.000000 (it still has to be >= 0.999)
+# React on the page with 3D in the world, picking and input replay are all here: the games (pong and platformer on
+# the page, arena3d's 3D drawn live), bevy-ts' live cases (keys, the pointer, a gamepad, the window and the World's
+# components through useQuery), the bridge's Engine reads (engine3d: a cube the World moves, React's marker reading it)
+# and pick3d (on* on 3D parts: hover, press, leave)
+sdk/react/bench/games/pong/edit.tsx keys:ArrowUp,ArrowDown,,ArrowUp 0.25 0.75 1.25 1.75
+sdk/react/bench/games/platformer/edit.tsx keys:ArrowRight,ArrowRight+ArrowUp,ArrowRight, 0.25 0.75 1.25 1.75
+sdk/react/bench/games/arena3d/edit.tsx keys:ArrowRight,ArrowUp,ArrowLeft+ArrowUp,ArrowDown, 0.25 0.75 1.25 1.75
+sdk/raea/bench/bevy-ts/cases/live-world.tsx script:sdk/raea/bench/bevy-ts/cases/live-world.json 0.2 0.4
+sdk/raea/bench/bevy-ts/cases/live-components.tsx script:sdk/raea/bench/bevy-ts/cases/live-world.json 0.2 0.4
+sdk/raea/bench/bevy-ts/cases/live-input.tsx script:sdk/raea/bench/bevy-ts/cases/live-input.json 0.2 0.4
+sdk/raea/bench/bevy-ts/cases/live-gamepad.tsx script:sdk/raea/bench/bevy-ts/cases/live-world.json 0.4 0.8
+sdk/raea/bench/bevy-ts/cases/live-kinds.tsx script:sdk/raea/bench/bevy-ts/cases/live-world.json 0.3 0.6
+sdk/raea/bench/bevy-ts/cases/live-window.tsx script:sdk/raea/bench/bevy-ts/cases/live-world.json 0.2
+sdk/raea/bench/bevy-ts/cases/text3d-readback.tsx script:sdk/raea/bench/bevy-ts/cases/live-world.json 0.3 0.6
+bench/bridge/engine3d.tsx - 0.3 0.9 1.25
+sdk/raea/bench/bevy/pick3d/edit.tsx script:bench/render-play/pick3d.json 0.1 0.2 0.3 0.4 0.6 0.9
diff --git a/bench/render-play/run.sh b/bench/render-play/run.sh
new file mode 100755
index 00000000..f0101aae
--- /dev/null
+++ b/bench/render-play/run.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+# Render = play (docs/handoff/blitz-bridge.md, done-when 3): each row of rows.tsv is played live offscreen with its
+# input, snapshotted at its moments, and the input the play logged (--input-log) is rendered at the same frames
+# (render --input); the two pictures are compared by SSIM. A row passes at 1.000000 on every frame, or, when rows.tsv
+# explains it, at >= 0.999. One line a row (PASS, EXPLAINED or FAIL, each frame's SSIM), then a tally; exits 1 on a FAIL.
+# bench/render-play/run.sh [ROW-SUBSTRING...] (RAEA_BIN: the raea to run, default target/release/raea)
+# A play keeps stepping to its snapshots' frames however loaded the machine (ovw), so an unreached frame is a failure.
+cd "$(dirname "$0")/../.." || exit 2
+ROOT=$PWD
+# pixel checks: no Content Credentials or TrustMark id in the frames (a still's mark moves its pixels)
+export RAEA_SIGN=0 RAEA_MARK=0 RAEA_AUDIO_MUTE=1
+BIN=${RAEA_BIN:-$ROOT/target/release/raea}
+OUT=${RAEA_RP_OUT:-$(mktemp -d "${TMPDIR:-/tmp}/raea-render-play.XXXXXX")}
+mkdir -p "$OUT"
+# the composition's size and fps from its source: <Composition width height fps>, else the CW/VW and CH/VH constants
+# (the games), else 1920x1080 at 30
+dim() { grep '<Composition' "$1" | grep -oE "$2=\{[0-9]+\}" | head -1 | tr -dc 0-9; }
+const() { grep -oE "const ($2) = [0-9]+" "$1" | head -1 | grep -oE '[0-9]+$'; }
+pass=0 explained=0 fail=0
+while IFS=$'\t' read -r path input secs why; do
+ [[ -z $path || $path == \#* ]] && continue
+ if [ $# -gt 0 ]; then hit=0; for s in "$@"; do [[ $path == *"$s"* ]] && hit=1; done; [ $hit = 1 ] || continue; fi
+ src=$ROOT/$path
+ slug=$(echo "$path" | tr '/' '_' | sed 's/\.tsx$//')
+ w=$(dim "$src" width); w=${w:-$(const "$src" 'CW|VW')}; w=${w:-1920}
+ h=$(dim "$src" height); h=${h:-$(const "$src" 'CH|VH')}; h=${h:-1080}
+ fps=$(dim "$src" fps); fps=${fps:-30}
+ last=$(echo $secs | awk '{ m = $1; for (i = 2; i <= NF; i++) if ($i + 0 > m + 0) m = $i; printf "%.17g", m + 0.25 }')
+ snaps=()
+ for s in $secs; do snaps+=(--snapshot "$s" "$OUT/$slug-play-$s.png"); done
+ rm -f "$OUT/$slug"-play-*.png "$OUT/$slug"-render-*.png
+ how=(); keys=""
+ case $input in
+ -) ;;
+ keys:*) keys=${input#keys:}; how=(--input) ;;
+ script:*) how=(--input-script "$ROOT/${input#script:}") ;;
+ esac
+ if ! (cd "$(dirname "$src")" && RAEA_INPUT_KEYS="$keys" "$BIN" play "$src" --offscreen --size "${w}x$h" --seconds "$last" \
+ ${how[@]+"${how[@]}"} --input-log "$OUT/$slug-input.json" "${snaps[@]}") > "$OUT/$slug-play.log" 2>&1; then
+ echo "FAIL $path: the play failed: $(grep -m1 -E 'REFUSED|error|panicked' "$OUT/$slug-play.log" | cut -c1-200)"; fail=$((fail + 1)); continue
+ fi
+ line="" worst=1 broke=""
+ # the run rendered, frames 0 to the last compared, as play played it and an export renders it: a frame of a
+ # composition that keeps state in its module (a World ask sent once, at frame 3) is the run's frame, which a still of
+ # that frame alone, its page jumping there, isn't (frame purity, motion.feature: the author's to keep)
+ lastf=$(for s in $secs; do awk -v s="$s" -v fps="$fps" 'BEGIN { printf "%.0f\n", s * fps }'; done | sort -n | tail -1)
+ rm -rf "$OUT/$slug-render" && mkdir -p "$OUT/$slug-render"
+ (cd "$(dirname "$src")" && RAEA_READBACK=rgba "$BIN" render "$src" --at "$(seq 0 "$lastf" | paste -sd, -)" --input "$OUT/$slug-input.json" -o "$OUT/$slug-render/") > "$OUT/$slug-render.log" 2>&1
+ for s in $secs; do
+ f=$(awk -v s="$s" -v fps="$fps" 'BEGIN { printf "%.0f", s * fps }')
+ if [ ! -f "$OUT/$slug-play-$s.png" ]; then line="$line $f:unreached"; broke=1; continue; fi
+ if [ ! -f "$OUT/$slug-render/$(printf 'frame-%05d.png' "$f")" ]; then line="$line $f:render-failed"; broke=1; continue; fi
+ cp "$OUT/$slug-render/$(printf 'frame-%05d.png' "$f")" "$OUT/$slug-render-$s.png"
+ v=$(ffmpeg -nostdin -hide_banner -nostats -i "$OUT/$slug-play-$s.png" -i "$OUT/$slug-render-$s.png" \
+ -lavfi "[0:v]format=rgb24[a];[1:v]format=rgb24[b];[a][b]ssim" -f null - 2>&1 | grep -o 'All:[0-9.]*' | cut -d: -f2)
+ line="$line $f:${v:-none}"
+ worst=$(awk -v w="$worst" -v v="${v:-0}" 'BEGIN { print (v + 0 < w + 0) ? v : w }')
+ done
+ if [ -z "$broke" ] && awk -v w="$worst" 'BEGIN { exit !(w + 0 >= 1) }'; then
+ echo "PASS $path:$line"; pass=$((pass + 1))
+ elif [ -z "$broke" ] && [ -n "$why" ] && awk -v w="$worst" 'BEGIN { exit !(w + 0 >= 0.999) }'; then
+ echo "EXPLAINED $path:$line ($why)"; explained=$((explained + 1))
+ else
+ echo "FAIL $path:$line (worst $worst; play and renders in $OUT)"; fail=$((fail + 1))
+ fi
+done < bench/render-play/rows.tsv
+echo "render = play: $pass at 1.000000, $explained explained, $fail failed (out: $OUT)"
+[ $fail = 0 ]
diff --git a/bench/scoreboard.sh b/bench/scoreboard.sh
new file mode 100755
index 00000000..e2df441b
--- /dev/null
+++ b/bench/scoreboard.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# lightspeed's scoreboard (docs/lightspeed.feature): every row's newest value, target, gap and trend, ranked by gap
+# weighted by feel. The harnesses that fill it are bench/lightspeed/*.sh (bench/lightspeed/all.sh runs them all); the
+# table itself is bench/lightspeed/scoreboard.jq.
+# bench/scoreboard.sh [--json]
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+RESULTS=$HOME/Library/Logs/raea/lightspeed/results.jsonl
+CI=$HOME/Library/Logs/raea/ci/history.jsonl
+json=0
+for a in "$@"; do [ "$a" = --json ] && json=1; done
+EMPTY=$(mktemp "${TMPDIR:-/tmp}/scoreboard.XXXXXX")
+trap 'rm -f "$EMPTY"' EXIT
+[ -f "$RESULTS" ] || RESULTS=$EMPTY
+[ -f "$CI" ] || CI=$EMPTY
+
+# Q6, the legacy app's eval runs, retired with apps/legacy (F2b): no rows
+evals=null
+
+# how many commits HEAD is past each CI gate's newest quiet commit (STALE past 10)
+behind=$(jq -Rsr '[split("\n")[] | fromjson? | select(type == "object" and .quiet != false)]
+ | reduce .[] as $r ({}; .[$r.gate] = $r) | .[] | (.commit // "")[:9] | select(. != "")' "$CI" | sort -u |
+ while read -r c; do
+ n=$(git -C "$ROOT" rev-list --count "$c..HEAD" 2> /dev/null) && echo "$c $n"
+ done | jq -Rsc '[split("\n")[] | select(. != "") | split(" ") | {(.[0]): (.[1] | tonumber)}] | add // {}')
+
+if [ $json = 1 ]; then out=(--indent 1); else out=(-r); fi
+jq -n "${out[@]}" -L "$ROOT/bench/lightspeed" --rawfile results "$RESULTS" --rawfile ci "$CI" --argjson evals "$evals" \
+ --argjson behind "$behind" --arg json $json -f "$ROOT/bench/lightspeed/scoreboard.jq"
diff --git a/bench/solids/proto/README.md b/bench/solids/proto/README.md
new file mode 100644
index 00000000..58c6fc27
--- /dev/null
+++ b/bench/solids/proto/README.md
@@ -0,0 +1,10 @@
+# solids prototype (10-27)
+
+The scratch prototype behind docs/handoff/solids.md ("Prototype"): a relations layer over today's manifold API
+(`rel.ts`), the object bench's hidden checks (`checks.ts`), relation-style and coordinate-style objects with red-team
+variants (`objects.ts`), labelled parts into the ECS world with each label checked as a claim (`world.ts`), the run
+(`bench.ts`) and a sheet coloured by material label (`sheet.tsx`). TS only, run on the engine; nothing here is built
+into raea yet. The lane turns it into the SDK shape and the bench proper.
+
+ raea run bench/solids/proto/bench.ts # every object through its checks; ends "bench ok"
+ raea render bench/solids/proto/sheet.tsx --frame 0 -o sheet.png
diff --git a/bench/solids/proto/bench.ts b/bench/solids/proto/bench.ts
new file mode 100644
index 00000000..fd3e5d79
--- /dev/null
+++ b/bench/solids/proto/bench.ts
@@ -0,0 +1,54 @@
+// raea run bench.ts: every object through its category's checks; red-team objects must fail theirs.
+import { print } from "raea/native";
+import * as C from "./checks.ts";
+import { objects, type Obj } from "./objects.ts";
+import { claims, toWorld } from "./world.ts";
+
+const SIZE: Record<Obj["kind"], { h?: C.Range; w?: C.Range }> = {
+ chair: { h: [0.75, 1.1], w: [0.38, 0.75] },
+ stool: { h: [0.4, 0.85], w: [0.25, 0.6] },
+ mug: { h: [0.07, 0.13], w: [0.07, 0.15] },
+ tree: { h: [5, 25], w: [3, 25] },
+};
+
+function run(o: Obj): C.Result[] {
+ const S = C.sample(o.solid);
+ const r = [C.connected(o.solid), C.grounded(S), C.scale(S, SIZE[o.kind])];
+ if (o.kind === "chair" || o.kind === "stool") r.push(C.stands(S), C.seat(S, o.kind === "stool" ? [0.4, 0.8] : [0.38, 0.55], o.kind === "stool" ? 0.25 : 0.3));
+ if (o.kind === "mug") r.push(C.stands(S), C.holdsWater(o.solid, S));
+ if (o.kind === "tree") r.push(C.treeForm(o.solid, S));
+ if (o.asm?.joins.length) r.push(C.joins(o.asm.parts, o.asm.joins));
+ if (o.asm) r.push(...claims(o.asm));
+ return r;
+}
+
+export default function main() {
+ let wrong = 0;
+ for (const o of objects()) {
+ const t0 = Date.now();
+ const rs = run(o);
+ const ms = Date.now() - t0;
+ print(`\n${o.name}${o.redTeam ? ` [red team: must fail "${o.redTeam}"]` : ""} (${ms} ms)`);
+ for (const r of rs) print(` ${r.ok ? "pass" : "FAIL"} ${r.check.padEnd(30)} ${r.got}`);
+ if (o.redTeam) {
+ const target = rs.find((r) => r.check === o.redTeam);
+ if (!target || target.ok) { wrong++; print(` !! red team not caught`); }
+ } else if (o.arm === "A") { if (rs.some((r) => !r.ok)) print(` (arm A sample: its failures are data, not a bench error)`); }
+ else if (rs.some((r) => !r.ok)) { wrong++; print(` !! a good object failed`); }
+ }
+ // the labels in the world: one ECS world holding every good B object, queried as a game would
+ const objs = objects().filter((o) => o.asm && !o.redTeam);
+ let world: any = undefined;
+ for (const o of objs) world = toWorld(o.asm!, world).world;
+ const names = (ids: number[]) => ids.map((id) => {
+ const n = (world.component(id, "Name") as any)?.name, p = world.parent(id);
+ return `${(world.component(p, "Name") as any)?.name}/${n}`;
+ }).join(", ");
+ print(`\nworld: ${world.find({ with: ["Name"] }).length} entities from ${objs.length} objects`);
+ print(` find Sittable: ${names(world.find({ with: ["Sittable"] }))}`);
+ print(` find Graspable: ${names(world.find({ with: ["Graspable"] }))}`);
+ print(` find Container: ${names(world.find({ with: ["Container"] }))}`);
+ print(` find Part.material oak: ${names(world.find({ with: ["Part"], where: [["Part.material", "==", "oak"]] }))}`);
+ print(` find Sittable, Place.y>0.5: ${names(world.find({ with: ["Sittable", "Place"], where: [["Place.y", ">", 0.5]] }))}`);
+ print(`\n${wrong === 0 ? "bench ok" : `bench: ${wrong} wrong`}`);
+}
diff --git a/bench/solids/proto/checks.ts b/bench/solids/proto/checks.ts
new file mode 100644
index 00000000..124c2457
--- /dev/null
+++ b/bench/solids/proto/checks.ts
@@ -0,0 +1,147 @@
+// The object bench's hidden checks, prototyped: everything from the solid itself (y up, metres), nothing from the
+// program that made it. One sampling (a grid of vertical rays) gives the material as columns: centre of mass,
+// footprint, area by height, seat-like surfaces and cavities all come from it.
+import { manifold } from "raea/3d";
+import type { Vec3 } from "./rel.ts";
+
+type Solid = ReturnType<typeof manifold.box>;
+export interface Result { check: string; ok: boolean; got: string }
+
+interface Column { x: number; z: number; segs: [number, number][] } // [bottom, top] heights of material
+export interface Sample { cols: Column[]; cell: number; min: Vec3; max: Vec3 }
+
+export function sample(s: Solid, n = 48): Sample {
+ const { min, max } = s.bounds() as { min: Vec3; max: Vec3 };
+ const span = Math.max(max[0] - min[0], max[2] - min[2]), cell = span / n;
+ const cols: Column[] = [];
+ const top = max[1] + 1, bot = min[1] - 1;
+ for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) {
+ const x = min[0] + (i + 0.5) * cell, z = min[2] + (j + 0.5) * cell;
+ if (x > max[0] || z > max[2]) continue;
+ const hits = s.rayCast([x, top, z], [x, bot, z]).map((h) => h.position[1]).sort((a, b) => b - a);
+ const segs: [number, number][] = [];
+ for (let k = 0; k + 1 < hits.length; k += 2) segs.push([hits[k + 1], hits[k]]);
+ cols.push({ x, z, segs });
+ }
+ return { cols, cell, min, max };
+}
+
+const fmt = (v: number, d = 2) => v.toFixed(d);
+const len = (c: Column) => c.segs.reduce((a, [b, t]) => a + t - b, 0);
+
+export function centerOfMass(S: Sample): [number, number, number] {
+ let w = 0, x = 0, y = 0, z = 0;
+ for (const c of S.cols) for (const [b, t] of c.segs) {
+ const l = t - b; w += l; x += l * c.x; z += l * c.z; y += l * (b + t) / 2;
+ }
+ return [x / w, y / w, z / w];
+}
+/** the area of material at height h */
+export function areaAt(S: Sample, h: number) {
+ return S.cols.filter((c) => c.segs.some(([b, t]) => b <= h && h <= t)).length * S.cell * S.cell;
+}
+/** the xz half-width of material at height h (how far it spreads from its centre) */
+function spreadAt(S: Sample, h: number) {
+ const xs = S.cols.filter((c) => c.segs.some(([b, t]) => b <= h && h <= t));
+ if (!xs.length) return 0;
+ return (Math.max(...xs.map((c) => c.x)) - Math.min(...xs.map((c) => c.x))) / 2;
+}
+
+function hull2(pts: [number, number][]): [number, number][] {
+ const p = [...pts].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
+ if (p.length < 3) return p;
+ const cross = (o: number[], a: number[], b: number[]) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
+ const lo: [number, number][] = [], up: [number, number][] = [];
+ for (const q of p) { while (lo.length >= 2 && cross(lo[lo.length - 2], lo[lo.length - 1], q) <= 0) lo.pop(); lo.push(q); }
+ for (const q of p.reverse()) { while (up.length >= 2 && cross(up[up.length - 2], up[up.length - 1], q) <= 0) up.pop(); up.push(q); }
+ return lo.slice(0, -1).concat(up.slice(0, -1));
+}
+/** signed distance inside a convex polygon (negative outside) */
+function inside(poly: [number, number][], p: [number, number]) {
+ let d = Infinity;
+ for (let i = 0; i < poly.length; i++) {
+ const a = poly[i], b = poly[(i + 1) % poly.length];
+ const ex = b[0] - a[0], ez = b[1] - a[1], l = Math.hypot(ex, ez) || 1;
+ d = Math.min(d, ((p[0] - a[0]) * ez - (p[1] - a[1]) * ex) / -l);
+ }
+ return d;
+}
+
+// --- the checks ---------------------------------------------------------------------------------------------------
+
+export function connected(s: Solid): Result {
+ const n = s.decompose().length;
+ return { check: "one piece", ok: n === 1, got: `${n} piece${n === 1 ? "" : "s"}` };
+}
+export function grounded(S: Sample): Result {
+ return { check: "on the ground", ok: Math.abs(S.min[1]) <= 0.002, got: `bottom at ${fmt(S.min[1], 3)} m` };
+}
+export type Range = [number, number];
+export function scale(S: Sample, spec: { h?: Range; w?: Range }): Result {
+ const h = S.max[1] - S.min[1], w = Math.max(S.max[0] - S.min[0], S.max[2] - S.min[2]);
+ const okH = !spec.h || (h >= spec.h[0] && h <= spec.h[1]), okW = !spec.w || (w >= spec.w[0] && w <= spec.w[1]);
+ return { check: "real-world size", ok: okH && okW, got: `h ${fmt(h)} m, w ${fmt(w)} m` };
+}
+/** the centre of mass over the footprint, with a margin (a stand-in for the physics drop) */
+export function stands(S: Sample): Result {
+ const foot = S.cols.filter((c) => c.segs.length && Math.min(...c.segs.map((s) => s[0])) <= S.min[1] + 0.01);
+ const poly = hull2(foot.map((c) => [c.x, c.z]));
+ const com = centerOfMass(S), d = poly.length >= 3 ? inside(poly, [com[0], com[2]]) : -1;
+ return { check: "stands (mass over footprint)", ok: d > 0.01, got: `margin ${fmt(d * 100, 1)} cm` };
+}
+/** somewhere to sit: a level surface at seat height, open above, covering a body-sized patch */
+export function seat(S: Sample, h: Range = [0.38, 0.55], patch = 0.3): Result {
+ const tops = S.cols.map((c) => (c.segs.length ? c.segs[0][1] : -1)); // the first surface from above
+ const at = S.cols.filter((_, i) => tops[i] >= h[0] && tops[i] <= h[1]);
+ if (!at.length) return { check: "a seat", ok: false, got: "no surface at seat height" };
+ const xs = at.map((c) => c.x), zs = at.map((c) => c.z);
+ const wx = Math.max(...xs) - Math.min(...xs), wz = Math.max(...zs) - Math.min(...zs);
+ const ok = wx >= patch && wz >= patch && at.length * S.cell * S.cell >= patch * patch * 0.8;
+ return { check: "a seat", ok, got: `${fmt(wx)} x ${fmt(wz)} m at ${fmt(Math.min(...at.map((c) => c.segs[0][1])))} m` };
+}
+/** holds water: a floor above the ground under the opening, and walls all round up to near the rim */
+export function holdsWater(s: Solid, S: Sample): Result {
+ // the opening: columns whose first surface from above is well below the rim, or that go straight through
+ const rim = S.max[1], H = rim - S.min[1];
+ // only columns walled in on all four sides count (air beside the cup or through a handle's loop doesn't)
+ const solidCols = S.cols.filter((q) => q.segs.length), e = S.cell / 2;
+ const walled = (q: Column) =>
+ solidCols.some((o) => Math.abs(o.z - q.z) < e && o.x < q.x) && solidCols.some((o) => Math.abs(o.z - q.z) < e && o.x > q.x) &&
+ solidCols.some((o) => Math.abs(o.x - q.x) < e && o.z < q.z) && solidCols.some((o) => Math.abs(o.x - q.x) < e && o.z > q.z);
+ const open = S.cols.filter((q) => (!q.segs.length || q.segs[0][1] < rim - H * 0.3) && walled(q));
+ if (!open.length) return { check: "holds water", ok: false, got: "no cavity" };
+ const cx = open.reduce((a, q) => a + q.x, 0) / open.length, cz = open.reduce((a, q) => a + q.z, 0) / open.length;
+ const holes = open.filter((q) => !q.segs.length);
+ if (holes.length) return { check: "holds water", ok: false, got: `${holes.length} columns go straight through the floor` };
+ const col = open.reduce((a, q) => (Math.hypot(q.x - cx, q.z - cz) < Math.hypot(a.x - cx, a.z - cz) ? q : a));
+ const floor = col.segs[0][1], depth = rim - floor;
+ let leaks = 0, tried = 0;
+ for (let k = 1; k <= 4; k++) {
+ const y = floor + (depth * k) / 5;
+ for (let a = 0; a < 12; a++) {
+ const t = (a / 12) * Math.PI * 2, far = 10;
+ const hits = s.rayCast([col.x, y, col.z], [col.x + Math.cos(t) * far, y, col.z + Math.sin(t) * far]);
+ tried++; if (!hits.length) leaks++;
+ }
+ }
+ return { check: "holds water", ok: leaks === 0, got: `${fmt(depth * 100, 1)} cm deep, ${leaks}/${tried} side rays escape` };
+}
+/** a tree: a trunk at the ground narrower than the crown, thinner going up, the crown above the trunk */
+export function treeForm(s: Solid, S: Sample): Result {
+ // exact horizontal slices (y turned to manifold's z) for the trunk, the column grid for the crown's spread
+ const zUp = s.rotate(90, 0, 0), H = S.max[1] - S.min[1], at = (f: number) => S.min[1] + H * f;
+ const cut = (f: number) => zUp.slice(at(f));
+ const s0 = cut(0.03), s1 = cut(0.2);
+ const trunk = 2 * Math.sqrt(s0.area / Math.PI), crown = 2 * Math.max(...[0.6, 0.7, 0.8].map((f) => spreadAt(S, at(f))));
+ // the crown: how tall the leafy part is against how wide (an oak's is a dome, not a flat table)
+ const levels = Array.from({ length: 20 }, (_, i) => (i + 0.5) / 20).filter((f) => spreadAt(S, at(f)) * 2 > trunk * 3);
+ const crownH = levels.length ? (levels[levels.length - 1] - levels[0] + 0.05) * H : 0, aspect = crownH / crown;
+ const ok = s0.contours === 1 && crown >= trunk * 4 && s0.area >= s1.area && s1.contours === 1 && aspect >= 0.4 && aspect <= 1.6;
+ return { check: "tree form", ok, got: `trunk ${fmt(trunk)} m in ${s0.contours} piece, crown ${fmt(crown)} m wide x ${fmt(crownH)} m tall (${fmt(aspect)}), trunk area ${fmt(s0.area, 3)} -> ${fmt(s1.area, 3)} m2` };
+}
+/** each join in the graph touches */
+export function joins(parts: { name: string; solid: Solid }[], js: { a: string; b: string; kind: string }[]): Result {
+ const by = Object.fromEntries(parts.map((p) => [p.name, p.solid]));
+ const bad = js.filter((j) => by[j.a].minGap(by[j.b], 0.05) > 0.002).map((j) => `${j.a}-${j.b}`);
+ return { check: "joins touch", ok: bad.length === 0, got: bad.length ? `apart: ${bad.join(", ")}` : `${js.length} joins` };
+}
diff --git a/bench/solids/proto/objects.ts b/bench/solids/proto/objects.ts
new file mode 100644
index 00000000..5625c73c
--- /dev/null
+++ b/bench/solids/proto/objects.ts
@@ -0,0 +1,93 @@
+// Objects in two styles. A: coordinates, as an agent writes with today's API (it must know manifold is z-up and
+// work out every centre). B: relations over rel.ts. Plus red-team variants each check has to catch.
+import { manifold } from "raea/3d";
+import {
+ Assembly, Part, assembly, attached, ball, box, cm, corners, deg, ground, limb, m, post, rests, roundedBox, strut, JOIN, type Anchor,
+} from "./rel.ts";
+
+type Solid = ReturnType<typeof manifold.box>;
+export interface Obj { name: string; kind: "chair" | "stool" | "mug" | "tree"; solid: Solid; asm?: Assembly; redTeam?: string; arm?: "A" | "B" }
+
+// ---- A: coordinates. The seat's centre is at y = 0.45 - 0.02, a leg's centre at its half height, and so on.
+function chairA(o: { legGap?: number; seatY?: number } = {}): Solid {
+ const seatY = o.seatY ?? 0.45, legH = seatY - 0.04;
+ const seat = manifold.box(0.45, 0.04, 0.45).move(0, seatY - 0.02, 0);
+ const legs = [[-0.2, -0.2], [0.2, -0.2], [0.2, 0.2], [-0.2, 0.2]].map(([x, z], i) =>
+ manifold.cylinder(0.02, legH).rotate(-90, 0, 0).move(x, legH / 2 + (i === 0 ? (o.legGap ?? 0) : 0), z));
+ const back = manifold.box(0.45, 0.45, 0.03).move(0, seatY + 0.225, -0.21);
+ return manifold.union(seat, back, ...legs);
+}
+
+// ---- B: relations. No centre is computed in the program.
+function chairB(o: { seatHeight?: number; legs?: "under" | "one side"; lie?: boolean } = {}): Assembly {
+ const seatHeight = cm((o.seatHeight ?? 45) * 1);
+ let seat = roundedBox("seat", cm(45), cm(4), cm(45), cm(1)).label({ role: "seat", affords: ["sit"], material: "oak" });
+ const legH = m(seatHeight - cm(4));
+ seat = seat.placeOn(ground, legH);
+ const spots = o.legs === "one side"
+ ? corners(seat, "bottom", cm(3)).map((c, i) => ({ ...c, at: [c.at[0] * 0.15 - 0.17, c.at[1], c.at[2]] as typeof c.at }))
+ : corners(seat, "bottom", cm(3));
+ const legs = spots.map((c, i) => strut(`leg${i}`, [c.at[0], 0, c.at[2]], [c.at[0], c.at[1] + JOIN, c.at[2]], cm(2)).label({ role: "leg", affords: ["support"], material: "oak" }));
+ const back = box("back", cm(45), cm(45), cm(3)).placeOn(seat.top).alignTo(seat, "back")
+ .label({ role: "backrest", material: "oak", ...(o.lie ? { affords: ["sit" as const] } : {}) });
+ return assembly("chair", [seat, ...legs, back], [...legs.map((l) => rests(seat, l)), attached(back, seat)]);
+}
+
+function stoolB(): Assembly {
+ const legH = cm(60);
+ const top = post("top", cm(17), cm(4)).placeOn(ground, legH).label({ role: "seat", affords: ["sit"], material: "walnut" });
+ // three legs splayed from under the top's rim out to the floor, flat at both ends
+ const legs = [0, 120, 240].map((a, i) => {
+ const t = (a * Math.PI) / 180;
+ return strut(`leg${i}`, [Math.cos(t) * 0.2, 0, Math.sin(t) * 0.2], [Math.cos(t) * 0.12, legH + 0.001, Math.sin(t) * 0.12], cm(1.8), cm(1.5)).label({ role: "leg", affords: ["support"], material: "walnut" });
+ });
+ return assembly("stool", [top, ...legs], legs.map((l) => rests(top, l)));
+}
+
+function mugB(o: { hole?: boolean } = {}): Assembly {
+ let body = post("body", cm(4), cm(10)).placeOn(ground).hollow(cm(0.4), "top")
+ .label({ role: "body", affords: ["contain"], material: "glazed ceramic" });
+ if (o.hole) body = new Part("body", body.solid.minus(manifold.cylinder(0.008, 0.05).rotate(-90, 0, 0)), body.own, body.labels);
+ // the handle: a ring (manifold's torus already stands upright, facing front), its inner side sunk into the body's right wall
+ const ring = new Part("handle", manifold.torus(0.028, 0.006)).label({ role: "handle", affords: ["grasp"], material: "glazed ceramic" });
+ const handle = ring.centerOn([0, 0.055, 0], "xyz").beside(body, "right", cm(-1.5));
+ return assembly("mug", [body, handle], [attached(handle, body)]);
+}
+
+function oakB(o: { float?: number; flat?: boolean } = {}): Assembly {
+ const base: Anchor = { ...ground, at: [0, o.float ?? 0, 0] };
+ const trunk = limb("trunk", base, m(4), cm(30), cm(18), deg(0), deg(0), 0).standOn(base).label({ role: "trunk", material: "bark", affords: ["climb"] })
+ const parts: Part[] = [trunk];
+ const grow = (parent: Part, depth: number, len: number, r: number) => {
+ if (depth === 0) return;
+ for (let k = 0; k < 3; k++) {
+ const b = limb(`${parent.name}.${k}`, parent.anchor("tip"), m(len), cm(r), cm(r * 0.6), deg(k * 120 + depth * 37), deg(o.flat ? 85 : 20 + (3 - depth) * 15), 0.1).label({ role: "branch", material: "bark" });
+ parts.push(b);
+ grow(b, depth - 1, len * 0.7, r * 0.6);
+ }
+ };
+ grow(trunk, 3, 3, 16);
+ const tips = parts.filter((p) => !parts.some((q) => q.name.startsWith(p.name + ".")));
+ for (const t of tips) parts.push(ball(`${t.name}.leaves`, m(1.1)).centerOn(t.anchor("tip"), "xyz").label({ role: "foliage", material: "oak leaves" }));
+ return assembly("oak", parts, []);
+}
+
+export function objects(): Obj[] {
+ const asm = (kind: Obj["kind"], a: Assembly, redTeam?: string): Obj => ({ name: a.name, kind, solid: a.solid, asm: a, redTeam });
+ return [
+ { name: "chair (A, coordinates)", kind: "chair", solid: chairA(), arm: "A" },
+ { ...asm("chair", chairB()), name: "chair (B, relations)" },
+ { ...asm("stool", stoolB()), name: "three-legged stool (B)" },
+ { ...asm("mug", mugB()), name: "mug (B)" },
+ { ...asm("tree", oakB()), name: "oak (B)" },
+ // red team: each should fail the check named
+ { name: "chair, a leg 3 cm short", kind: "chair", solid: chairA({ legGap: 0.03 }), redTeam: "one piece" },
+ { name: "chair, seat at 1 m", kind: "chair", solid: chairA({ seatY: 1.0 }), redTeam: "a seat" },
+ { ...asm("chair", chairB({ legs: "one side" })), name: "chair, legs bunched at one side", redTeam: "stands (mass over footprint)" },
+ { name: "chair, built 4x too big", kind: "chair", solid: chairA().scale(4), redTeam: "real-world size" },
+ { ...asm("mug", mugB({ hole: true })), name: "mug, hole in the bottom", redTeam: "holds water" },
+ { ...asm("tree", oakB({ float: 0.5 })), name: "oak, floating 0.5 m", redTeam: "on the ground" },
+ { ...asm("tree", oakB({ flat: true })), name: "oak, branches grown flat (the umbrella)", redTeam: "tree form" },
+ { ...asm("chair", chairB({ lie: true })), name: "chair, its backrest labelled sittable", redTeam: "back affords sit" },
+ ];
+}
diff --git a/bench/solids/proto/rel.ts b/bench/solids/proto/rel.ts
new file mode 100644
index 00000000..0e37bbda
--- /dev/null
+++ b/bench/solids/proto/rel.ts
@@ -0,0 +1,187 @@
+// Prototype of the brief's "SDK shape": units, anchors, relations, patterns, growth, assemblies, over today's
+// manifold API. One frame, Bevy's: +y up, +z front, +x right, metres. Manifold is z-up, so primitives are turned here.
+import { manifold } from "raea/3d";
+
+type Solid = ReturnType<typeof manifold.box>;
+export type Vec3 = [number, number, number];
+
+// 1. units: branded, so a bare number or a radian can't go where a length or degrees belong
+declare const unit: unique symbol;
+export type Metres = number & { [unit]: "m" };
+export type Degrees = number & { [unit]: "deg" };
+export const m = (v: number) => v as Metres;
+export const cm = (v: number) => (v / 100) as Metres;
+export const mm = (v: number) => (v / 1000) as Metres;
+export const deg = (v: number) => v as Degrees;
+
+// directions as words
+export type Side = "top" | "bottom" | "left" | "right" | "front" | "back";
+const NORMAL: Record<Side, Vec3> = {
+ top: [0, 1, 0], bottom: [0, -1, 0], right: [1, 0, 0], left: [-1, 0, 0], front: [0, 0, 1], back: [0, 0, -1],
+};
+const OPPOSITE: Record<Side, Side> = { top: "bottom", bottom: "top", left: "right", right: "left", front: "back", back: "front" };
+
+// 2. anchors: a point and the way it faces
+export interface Anchor { at: Vec3; facing: Vec3; of: string }
+
+const add = (a: Vec3, b: Vec3): Vec3 => [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
+const sub = (a: Vec3, b: Vec3): Vec3 => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
+const scl = (a: Vec3, s: number): Vec3 => [a[0] * s, a[1] * s, a[2] * s];
+
+export class Part {
+ constructor(readonly name: string, readonly solid: Solid, readonly own: Record<string, Anchor> = {}, readonly labels: Labels = {}) {}
+ /** design-level metadata that travels with the part through every relation and into the world */
+ label(l: Labels): Part { return new Part(this.name, this.solid, this.own, { ...this.labels, ...l }); }
+
+ bounds() { return this.solid.bounds() as { min: Vec3; max: Vec3 }; }
+ get center(): Vec3 { const b = this.bounds(); return scl(add(b.min, b.max), 0.5); }
+ get size(): Vec3 { const b = this.bounds(); return sub(b.max, b.min); }
+
+ /** the centre of a side of the bounds, facing out */
+ side(s: Side): Anchor {
+ const b = this.bounds(), c = this.center, n = NORMAL[s];
+ const at: Vec3 = [
+ n[0] > 0 ? b.max[0] : n[0] < 0 ? b.min[0] : c[0],
+ n[1] > 0 ? b.max[1] : n[1] < 0 ? b.min[1] : c[1],
+ n[2] > 0 ? b.max[2] : n[2] < 0 ? b.min[2] : c[2],
+ ];
+ return { at, facing: n, of: `${this.name}.${s}` };
+ }
+ get top() { return this.side("top"); }
+ get bottom() { return this.side("bottom"); }
+ anchor(name: string): Anchor {
+ const a = this.own[name];
+ if (!a) throw new Error(`${this.name} has no anchor "${name}" (it has ${Object.keys(this.own).join(", ") || "none"})`);
+ return a;
+ }
+
+ moved(d: Vec3): Part {
+ const own: Record<string, Anchor> = {};
+ for (const [k, a] of Object.entries(this.own)) own[k] = { ...a, at: add(a.at, d) };
+ return new Part(this.name, this.solid.move(d[0], d[1], d[2]), own, this.labels);
+ }
+ named(name: string) { return new Part(name, this.solid, this.own, this.labels); }
+ with(name: string, at: Vec3, facing: Vec3 = [0, 1, 0]): Part {
+ return new Part(this.name, this.solid, { ...this.own, [name]: { at, facing, of: `${this.name}.${name}` } }, this.labels);
+ }
+
+ // 3. relations: the part moves so that its side opposite the anchor's facing lands on the anchor. Parts sink JOIN
+ // into each other by default, so a union fuses them (faces that only touch stay two pieces); the ground doesn't.
+ placeOn(a: Anchor, gap: Metres = (a.of === "ground" ? m(0) : m(-JOIN))): Part {
+ const side = sideOf(a.facing);
+ const mine = this.side(OPPOSITE[side]).at;
+ return this.moved(add(sub(a.at, mine), scl(a.facing, gap)));
+ }
+ beside(other: Part, s: Side, gap: Metres = m(0)): Part { return this.placeOn(other.side(s), gap); }
+ /** flush with the other's side, keeping the other two axes */
+ alignTo(other: Part, s: Side): Part {
+ const d = sub(other.side(s).at, this.side(s).at), n = NORMAL[s];
+ return this.moved([d[0] * Math.abs(n[0]), d[1] * Math.abs(n[1]), d[2] * Math.abs(n[2])]);
+ }
+ centerOn(p: Vec3 | Anchor, axes: "xz" | "xyz" = "xz"): Part {
+ const at = Array.isArray(p) ? p : p.at, d = sub(at, this.center);
+ return this.moved(axes === "xz" ? [d[0], 0, d[2]] : d);
+ }
+ /** its bottom at the given anchor's height, keeping x and z (a trunk on the ground) */
+ standOn(a: Anchor): Part { return this.moved([0, a.at[1] - this.bottom.at[1], 0]); }
+ /** its top at the anchor's point, sunk JOIN into what it hangs from (a leg under a seat's corner) */
+ hangFrom(a: Anchor): Part { return this.moved(add(sub(a.at, this.top.at), [0, JOIN, 0])); }
+ /** hollowed with walls this thick, open on one side (a mug, a box, a planter) */
+ hollow(wall: Metres, open: Side = "top"): Part {
+ const inner = this.solid.minkowskiDiff(manifold.sphere(wall));
+ const n = NORMAL[open], s = this.size, d: Vec3 = [n[0] * s[0] * 0.5, n[1] * s[1] * 0.5, n[2] * s[2] * 0.5]; // half: the copy overlaps, so no lid is left
+ const anchors = { ...this.own, inside: { at: add(this.side(OPPOSITE[open]).at, scl(n, wall)), facing: n, of: `${this.name}.inside` } };
+ return new Part(this.name, this.solid.minus(inner.union(inner.move(d[0], d[1], d[2]))), anchors, this.labels);
+ }
+}
+
+export const JOIN = 0.001;
+export const ground: Anchor = { at: [0, 0, 0], facing: [0, 1, 0], of: "ground" };
+
+function sideOf(n: Vec3): Side {
+ let best: Side = "top", d = -2;
+ for (const [s, v] of Object.entries(NORMAL) as [Side, Vec3][]) {
+ const dot = v[0] * n[0] + v[1] * n[1] + v[2] * n[2];
+ if (dot > d) { d = dot; best = s; }
+ }
+ return best;
+}
+
+// primitives in the y-up frame, sized in metres, sitting with their centre at the origin
+export const box = (name: string, w: Metres, h: Metres, d: Metres) => new Part(name, manifold.box(w, h, d));
+export const roundedBox = (name: string, w: Metres, h: Metres, d: Metres, r: Metres) =>
+ new Part(name, manifold.roundedBox(w, h, d, r));
+/** a cylinder standing up (manifold's runs along z: turned to y) */
+export const post = (name: string, r: Metres, h: Metres, rTop: Metres = r) =>
+ new Part(name, (rTop === r ? manifold.cylinder(r, h) : manifold.cone(r, rTop, h)).rotate(-90, 0, 0));
+export const ball = (name: string, r: Metres) => new Part(name, manifold.sphere(r));
+
+// 4. patterns by meaning: points, not arithmetic in the program
+/** the four corners of a face (a top or bottom anchor's rectangle), pulled in by inset */
+export function corners(p: Part, s: "top" | "bottom", inset: Metres): Anchor[] {
+ const b = p.bounds(), y = s === "top" ? b.max[1] : b.min[1], f = NORMAL[s];
+ return ([[b.min[0] + inset, b.min[2] + inset], [b.max[0] - inset, b.min[2] + inset],
+ [b.max[0] - inset, b.max[2] - inset], [b.min[0] + inset, b.max[2] - inset]] as [number, number][])
+ .map(([x, z], i) => ({ at: [x, y, z] as Vec3, facing: f, of: `${p.name}.${s}.corner${i}` }));
+}
+export function around(center: Vec3, n: number, radius: Metres, y = center[1]): Anchor[] {
+ return Array.from({ length: n }, (_, i) => {
+ const t = (i / n) * Math.PI * 2;
+ return { at: [center[0] + Math.cos(t) * radius, y, center[2] + Math.sin(t) * radius] as Vec3, facing: [0, -1, 0] as Vec3, of: `around${i}` };
+ });
+}
+
+/** a straight member with flat ends exactly at a and b (a splayed leg, a rung, a strut) */
+export function strut(name: string, a: Vec3, b: Vec3, r0: Metres, r1: Metres = r0): Part {
+ const disc = (p: Vec3, r: number, below: boolean) =>
+ manifold.cylinder(r, 0.001).rotate(-90, 0, 0).move(p[0], p[1] + (below ? 0.0005 : -0.0005), p[2]);
+ const up = b[1] >= a[1];
+ return new Part(name, manifold.hull(disc(a, r0, up), disc(b, r1, !up)), {
+ start: { at: a, facing: [0, up ? -1 : 1, 0], of: `${name}.start` }, end: { at: b, facing: [0, up ? 1 : -1, 0], of: `${name}.end` },
+ });
+}
+
+// 5. growth: a tapered tube along points (a hull chain of spheres), and branching from a tip
+export function tube(name: string, path: Vec3[], radii: number[]): Part {
+ const balls = path.map((p, i) => manifold.sphere(radii[i] ?? radii[radii.length - 1]).move(p[0], p[1], p[2]));
+ const links = balls.slice(1).map((b, i) => manifold.hull(balls[i], b));
+ const s = manifold.union(...links);
+ const end = path[path.length - 1], prev = path[path.length - 2] ?? [0, 0, 0];
+ const dir = sub(end, prev), len = Math.hypot(...dir) || 1;
+ return new Part(name, s, { tip: { at: end, facing: scl(dir, 1 / len), of: `${name}.tip` } });
+}
+/** a limb from an anchor: its own length, turned from the parent's facing by yaw (about up) and pitch (away from up) */
+export function limb(name: string, from: Anchor, length: Metres, r0: Metres, r1: Metres, yaw: Degrees, pitch: Degrees, bend = 0.15): Part {
+ const y = (yaw * Math.PI) / 180, p = (pitch * Math.PI) / 180;
+ const f = from.facing, up = Math.atan2(Math.hypot(f[0], f[2]), f[1]), az = Math.atan2(f[2], f[0]);
+ const tilt = p, a = az + y; // tilt from vertical, not added to the parent's: nested tilts sum to sideways growth
+ const dir: Vec3 = [Math.sin(tilt) * Math.cos(a), Math.cos(tilt), Math.sin(tilt) * Math.sin(a)];
+ const mid = add(add(from.at, scl(dir, length * 0.5)), [0, length * bend, 0]);
+ const end = add(from.at, scl(dir, length));
+ return tube(name, [from.at, mid, end], [r0, (r0 + r1) / 2, r1]);
+}
+
+// 6. assemblies with a joint graph: the checks read the graph
+export type Join = { kind: "rests" | "attached"; a: string; b: string };
+export const rests = (a: Part, b: Part): Join => ({ kind: "rests", a: a.name, b: b.name });
+export const attached = (a: Part, b: Part): Join => ({ kind: "attached", a: a.name, b: b.name });
+export class Assembly {
+ constructor(readonly name: string, readonly parts: Part[], readonly joins: Join[]) {}
+ get solid(): Solid { return manifold.union(...this.parts.map((p) => p.solid)); }
+ part(name: string) {
+ const p = this.parts.find((q) => q.name === name);
+ if (!p) throw new Error(`${this.name} has no part ${name}`);
+ return p;
+ }
+}
+export const assembly = (name: string, parts: Part[], joins: Join[] = []) => new Assembly(name, parts, joins);
+
+// 7. labels: what a part is and what it's for, at the design level. They travel through every relation above and
+// become each part's row in the world (Bevy's ECS through raea's native world), so rules and games query them.
+export type Affordance = "sit" | "support" | "grasp" | "contain" | "walk" | "climb" | "open" | "hang" | "light";
+export interface Labels {
+ role?: string; // "seat", "leg", "handle", "trunk", "foliage"
+ affords?: Affordance[]; // what a person or a game can do with it
+ material?: string; // a material or recipe name, picked up by the material layer
+ [key: string]: unknown; // anything a game wants (hp, team, loot, sound)
+}
diff --git a/bench/solids/proto/sheet.tsx b/bench/solids/proto/sheet.tsx
new file mode 100644
index 00000000..7e9f0217
--- /dev/null
+++ b/bench/solids/proto/sheet.tsx
@@ -0,0 +1,43 @@
+// One still of the B objects side by side, each part coloured by its material label (labels reaching the renderer).
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Entity } from "raea/3d";
+import { objects } from "./objects.ts";
+import { Mesh3d } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+const COLOR: Record<string, string> = {
+ oak: "#b5834a", walnut: "#6b4428", "glazed ceramic": "#e9eef2", bark: "#5a4030", "oak leaves": "#4f7d3a",
+};
+const OBJS = objects().filter((o) => o.asm && !o.redTeam);
+// each object scaled to 1.6 m tall and set in a row
+const ROW = OBJS.map((o, i) => {
+ const b = o.solid.bounds(), h = b.max[1] - b.min[1], s = 1.6 / h;
+ return { o, s, x: (i - (OBJS.length - 1) / 2) * 2.2, cx: (b.min[0] + b.max[0]) / 2, cz: (b.min[2] + b.max[2]) / 2 };
+});
+
+function Sheet() {
+ return (
+ <AbsoluteFill style={{ background: "#dfe3e8" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 2.6, 7.5).lookingAt([0, 0.8, 0])} projection={{ Perspective: { fov: 0.785398163397448 } }} />
+ <AmbientLight brightness={180} />
+ <DirectionalLight transform={Transform.fromXyz(4, 6, 5).lookingAt([0, 0, 0])} illuminance={12800} shadow_maps_enabled />
+ {/* a floor was meant here, an r3f <planeGeometry> the old <Mesh> ignored: it never drew (removed in the M5 move) */}
+ {ROW.map(({ o, s, x, cx, cz }) => (
+ <Entity key={o.name} transform={Transform.fromXyz(x, 0, 0).withScale(s)}>
+ {o.asm!.parts.map((p) => (
+ <Mesh3d key={p.name} transform={Transform.fromXyz(-cx, 0, -cz)} name={`${o.name}/${p.name}`} shape={p.solid}>
+ <StandardMaterial base_color={COLOR[String(p.labels.material)] ?? "#999999"} perceptual_roughness={p.labels.material === "glazed ceramic" ? 0.25 : 0.7} />
+ </Mesh3d>
+ ))}
+ </Entity>
+ ))}
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="sheet" component={Sheet} width={1600} height={700} fps={30} durationInFrames={1} />);
diff --git a/bench/solids/proto/world.ts b/bench/solids/proto/world.ts
new file mode 100644
index 00000000..01a90886
--- /dev/null
+++ b/bench/solids/proto/world.ts
@@ -0,0 +1,50 @@
+// An assembly into raea's native ECS world: a row per part (its labels, place and size), per anchor and per join.
+// Then the labels are claims the bench checks: a part that says it affords "sit" must pass the seat check itself.
+import { createWorld } from "raea/ecs";
+import * as C from "./checks.ts";
+import type { Assembly } from "./rel.ts";
+
+// affordances become marker components, as Bevy games mark things (a Sittable, a Graspable): found by a query
+export const MARKER: Record<string, string> = {
+ sit: "Sittable", support: "Support", grasp: "Graspable", contain: "Container", walk: "Walkable", climb: "Climbable",
+ open: "Openable", hang: "Hangable", light: "LightSource",
+};
+
+/** the object as a parent entity, each part a child: Name, Part (role, material), Place, Size, a marker per affordance */
+export function toWorld(a: Assembly, w = createWorld()) {
+ const root = w.add({ Name: { name: a.name }, Object: { parts: a.parts.length, joins: a.joins.length } });
+ const ids: Record<string, number> = {};
+ for (const p of a.parts) {
+ const c = p.center, s = p.size, l = p.labels;
+ const comps: Record<string, unknown> = {
+ Name: { name: p.name },
+ Part: { role: String(l.role ?? ""), material: String(l.material ?? ""), volume: p.solid.volume() },
+ Place: { x: c[0], y: c[1], z: c[2] }, Size: { w: s[0], h: s[1], d: s[2] },
+ };
+ for (const f of l.affords ?? []) comps[MARKER[f]] = {};
+ for (const [k, v] of Object.entries(l)) if (!["role", "material", "affords"].includes(k)) comps[k] = v;
+ ids[p.name] = w.add(comps, { parent: root });
+ }
+ for (const j of a.joins) w.add({ Join: { kind: j.kind, a: j.a, b: j.b } }, { parent: root });
+ return { world: w, root, ids };
+}
+
+/** each label is a claim; the geometry has to back it */
+export function claims(a: Assembly): C.Result[] {
+ const out: C.Result[] = [];
+ for (const p of a.parts) for (const f of p.labels.affords ?? []) {
+ const S = C.sample(p.solid);
+ if (f === "sit") out.push({ ...C.seat(S, [0.35, 0.85], 0.25), check: `${p.name} affords sit` }); // any sitting height: a chair to a bar stool
+ if (f === "contain") out.push({ ...C.holdsWater(p.solid, S), check: `${p.name} affords contain` });
+ if (f === "support") {
+ const r = C.grounded(S);
+ out.push({ ...r, check: `${p.name} affords support (reaches the ground)` });
+ }
+ if (f === "grasp") {
+ // a hand fits: the part's smallest dimension is finger-sized and it has a hole a finger goes through
+ const s = p.size, thin = Math.min(...s), ok = thin >= 0.005 && thin <= 0.04 && p.solid.genus() >= 1;
+ out.push({ check: `${p.name} affords grasp`, ok, got: `thinnest ${(thin * 100).toFixed(1)} cm, genus ${p.solid.genus()}` });
+ }
+ }
+ return out;
+}
diff --git a/bench/tsc/known.txt b/bench/tsc/known.txt
new file mode 100644
index 00000000..d79d277f
--- /dev/null
+++ b/bench/tsc/known.txt
@@ -0,0 +1,96 @@
+content/anything/assets/breakfast.tsx: TS2322: Type '{ name: string; src: string; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/anything/assets/contact.tsx: TS2322: Type '{ name: string; src: string; position: [number, number, number]; scale: number; animation?: string | undefined; time?: number | undefined; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/anything/film.tsx: TS2503: Cannot find namespace 'JSX'.
+content/anything/film.tsx: TS2503: Cannot find namespace 'JSX'.
+content/anything/intro/fall/city.tsx: TS2503: Cannot find namespace 'JSX'.
+content/anything/intro/fall/paper.tsx: TS2503: Cannot find namespace 'JSX'.
+content/anything/intro/fall/sea.tsx: TS2322: Type 'number' is not assignable to type 'undefined'.
+content/anything/intro/fall/sea.tsx: TS2322: Type 'number' is not assignable to type 'undefined'.
+content/anything/intro/fall/sea.tsx: TS2322: Type 'number' is not assignable to type 'undefined'.
+content/anything/intro/fall/sea.tsx: TS2322: Type 'number' is not assignable to type 'undefined'.
+content/anything/intro/fall/sea.tsx: TS2322: Type 'number' is not assignable to type 'undefined'.
+content/anything/intro/opening-cut.tsx: TS2740: Type '{ room: () => React.JSX.Element; kid: () => React.JSX.Element; hand: () => React.JSX.Element; profile: () => React.JSX.Element; back: () => React.JSX.Element; s: () => React.JSX.Element; wide: () => React.JSX.Element; build: () => React.JSX.Element; stack: () => React.JSX.Element; phone: () => React.JSX.Element; }' is missing the following properties from type 'Record<ShotKind, () => ReactElement<unknown, string | JSXElementConstructor<any>>>': city, flat, paper, pixel, and 3 more.
+content/anything/kitchen/island.tsx: TS2322: Type '{ cam: { pos: V3; look: V3; fov: number; up?: V3 | undefined; }; real: true; set: string; t: number; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & { cam: { pos: V3; look: V3; fov: number; up?: V3 | undefined; }; real?: boolean | undefined; film?: boolean | undefined; ev?: number | undefined; t?: number | undefined; children?: ReactNode; }'.
+content/anything/kitchen/island.tsx: TS2322: Type '{ cam: { pos: V3; look: V3; fov: number; }; real: true; set: string; t: number; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & { cam: { pos: V3; look: V3; fov: number; up?: V3 | undefined; }; real?: boolean | undefined; film?: boolean | undefined; ev?: number | undefined; t?: number | undefined; children?: ReactNode; }'.
+content/anything/kitchen/island.tsx: TS2322: Type '{ cam: { pos: V3; look: V3; fov: number; }; real: true; set: string; t: number; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & { cam: { pos: V3; look: V3; fov: number; up?: V3 | undefined; }; real?: boolean | undefined; film?: boolean | undefined; ev?: number | undefined; t?: number | undefined; children?: ReactNode; }'.
+content/anything/kitchen/remodel-plan.tsx: TS2339: Property 'openings' does not exist on type '{ openings?: Opening[] | undefined; runs?: LaidRun[] | undefined; } | undefined'.
+content/anything/kitchen/remodel-set.tsx: TS2322: Type '{ name: string; position: [number, number, number]; rotation: [number, number, number]; children: Element; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/anything/kitchen/sky/crowd.tsx: TS2339: Property 'extra' does not exist on type '{ thing: "bee" | "boombox" | "box-seadogs" | "camcorder" | "camera" | "cart-crimecity" | "cart-firefist" | "cart-seadogs" | "cassette" | "cassette-2" | "cb-radio" | "clock" | ... 24 more ... | "vhs-2"; } | { ...; }'.
+content/anything/kitchen/sky/crowd.tsx: TS2339: Property 'extra' does not exist on type '{ thing: "bee" | "boombox" | "box-seadogs" | "camcorder" | "camera" | "cart-crimecity" | "cart-firefist" | "cart-seadogs" | "cassette" | "cassette-2" | "cb-radio" | "clock" | ... 24 more ... | "vhs-2"; } | { ...; }'.
+content/anything/kitchen/sky/crowd.tsx: TS2339: Property 'thing' does not exist on type '{ thing: "bee" | "boombox" | "box-seadogs" | "camcorder" | "camera" | "cart-crimecity" | "cart-firefist" | "cart-seadogs" | "cassette" | "cassette-2" | "cb-radio" | "clock" | ... 24 more ... | "vhs-2"; } | { ...; }'.
+content/anything/kitchen/sky/crowd.tsx: TS2339: Property 'thing' does not exist on type '{ thing: "bee" | "boombox" | "box-seadogs" | "camcorder" | "camera" | "cart-crimecity" | "cart-firefist" | "cart-seadogs" | "cassette" | "cassette-2" | "cb-radio" | "clock" | ... 24 more ... | "vhs-2"; } | { ...; }'.
+content/anything/kitchen/sky/crowd.tsx: TS2352: Conversion of type '{ joystick: { src: string; size: number[]; port: number[]; length: number; radius: number; }; console: { src: string; size: number[]; port: number[]; length: number; radius: number; }; tv: { src: string; size: number[]; port: null; length: null; radius: null; }; ... 33 more ...; projector: { src: string; size: numbe...' to type 'Record<string, { pieces?: Piece[] | undefined; }>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+content/anything/kitchen/sky/crowd.tsx: TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{ readonly joystick: { readonly size: readonly [0.0916, 0.123, 0.1101]; readonly port: readonly [-0.0033, -0.0499, -0.0538]; readonly length: 0.744; }; readonly console: { readonly size: readonly [0.3007, 0.0585, 0.2212]; readonly port: readonly [...]; readonly length: 0.23; }; ... 34 more ...; readonly projector: {...'.
+content/anything/kitchen/wreck/core.tsx: TS2353: Object literal may only specify known properties, and 'viscosityBoundary' does not exist in type 'GooObject'.
+content/anything/look/frames.tsx: TS2503: Cannot find namespace 'JSX'.
+content/anything/look/house-kit.tsx: TS2322: Type '{ name: string; children: (false | Element[] | Element)[]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/anything/look/kit.tsx: TS2503: Cannot find namespace 'JSX'.
+content/anything/look/town/core.tsx: TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
+content/anything/look/town/core.tsx: TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
+content/anything/look/town/core.tsx: TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
+content/anything/paint/demo-v2.tsx: TS2503: Cannot find namespace 'JSX'.
+content/anything/paint/demo.tsx: TS2322: Type '{ name: string; src: string; animation: string; time: number; loop: true; look: "pixel"; pixelSize: number; edgeColor: string; position: [number, number, number]; rotation: [number, number, number]; scale: number; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/anything/paint/shots.tsx: TS2322: Type '{ name: string; src: string; animation: string; time: number; loop: true; look: "pixel"; pixelSize: number; edgeColor: string; position: [number, number, number]; rotation: [number, number, number]; scale: number; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/anything/physics/glitch-test.tsx: TS2322: Type '{ name: string; src: string; hide: string[]; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/anything/physics/test.tsx: TS2322: Type '{ name: string; src: string; hide: string[]; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/anything/retro/c64/starfall.tsx: TS2323: Cannot redeclare exported variable 'Starfall'.
+content/anything/retro/c64/starfall.tsx: TS2323: Cannot redeclare exported variable 'Starfall'.
+content/anything/samples/crt.tsx: TS2322: Type '{ src: string; width: number; height: number; position: [number, number, number]; intensity: number; }' is not assignable to type 'IntrinsicAttributes & ImagePlaneProps'.
+content/anything/storyboard/scenes/inside.tsx: TS2503: Cannot find namespace 'JSX'.
+content/reel/edit.tsx: TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
+content/reel/v/daw/break.tsx: TS2339: Property 'feedback' does not exist on type 'C'.
+content/reel/v/daw/break.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/daw/break.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/daw/filter.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/daw/filter.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/game/core.ts: TS2352: Conversion of type '{ name: string; phenotype: { gender: number; age: number; muscle: number; weight: number; height: number; proportions: number; }; mass: number; height: number; parts: ({ name: string; mass: number; inertia: number[]; pos: number[]; rot: number[]; shape: { type: string; r: number; half: number; offset: number; }; } |...' to type 'BodyData' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+content/reel/v/games/heros/hj/game/core.ts: TS2352: Conversion of type '{ name: string; phenotype: { gender: number; age: number; muscle: number; weight: number; height: number; proportions: number; }; mass: number; height: number; parts: ({ name: string; mass: number; inertia: number[]; pos: number[]; rot: number[]; shape: { type: string; r: number; half: number; offset: number; }; } |...' to type 'BodyData' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+content/reel/v/games/heros/hj/game/core.ts: TS2352: Conversion of type '{ name: string; phenotype: { gender: number; age: number; muscle: number; weight: number; height: number; proportions: number; }; mass: number; height: number; parts: ({ name: string; mass: number; inertia: number[]; pos: number[]; rot: number[]; shape: { type: string; r: number; half: number; offset: number; }; } |...' to type 'BodyData' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+content/reel/v/games/heros/hj/game/core.ts: TS2352: Conversion of type '{ name: string; phenotype: { gender: number; age: number; muscle: number; weight: number; height: number; proportions: number; }; mass: number; height: number; parts: ({ name: string; mass: number; inertia: number[]; pos: number[]; rot: number[]; shape: { type: string; r: number; half: number; offset: number; }; } |...' to type 'BodyData' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+content/reel/v/games/heros/hj/game/core.ts: TS2352: Conversion of type '{ name: string; phenotype: { gender: number; age: number; muscle: number; weight: number; height: number; proportions: number; }; mass: number; height: number; parts: ({ name: string; mass: number; inertia: number[]; pos: number[]; rot: number[]; shape: { type: string; r: number; half: number; offset: number; }; } |...' to type 'BodyData' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+content/reel/v/games/heros/hj/game/core.ts: TS2352: Conversion of type '{ name: string; phenotype: { gender: number; age: number; muscle: number; weight: number; height: number; proportions: number; }; mass: number; height: number; parts: ({ name: string; mass: number; inertia: number[]; pos: number[]; rot: number[]; shape: { type: string; r: number; half: number; offset: number; }; } |...' to type 'BodyData' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
+content/reel/v/games/heros/hj/game/step.ts: TS2353: Object literal may only specify known properties, and 'idle' does not exist in type '{ left: boolean; right: boolean; turn: number; }'.
+content/reel/v/games/heros/hj/game/step.ts: TS2353: Object literal may only specify known properties, and 'nod' does not exist in type '{ left: boolean; right: boolean; turn: number; }'.
+content/reel/v/games/heros/hj/game/step.ts: TS2353: Object literal may only specify known properties, and 'shake' does not exist in type '{ left: boolean; right: boolean; turn: number; }'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/games/heros/hj/sound.tsx: TS2339: Property 'frequency' does not exist on type 'C'.
+content/reel/v/looks/colonnade.tsx: TS2322: Type '{ name: string; src: string; animation: string; time: number; loop: true; position: [number, number, number]; scale: number; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/reel/v/looks/ink.tsx: TS2322: Type '{ name: string; src: string; animation: string; time: number; loop: true; position: [number, number, number]; rotation: [number, number, number]; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/reel/v/looks/ink.tsx: TS2322: Type '{ name: string; src: string; attach: { to: string; bone: string; }; position: [number, number, number]; scale: number; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/reel/v/looks/ink.tsx: TS2322: Type '{ name: string; src: string; position: [number, number, number]; rotation: [number, number, number]; scale: number; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/reel/v/looks/pixel.tsx: TS2322: Type '{ name: string; src: string; animation: string; time: number; loop: true; look: "pixel" | "solid"; pixelSize: number; edgeColor: string; castShadow: true; }' is not assignable to type 'IntrinsicAttributes & ModelProps'.
+content/rome/mixed.tsx: TS2322: Type '{ name: string; children: (Element | null)[]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/mixed.tsx: TS2322: Type '{ name: string; children: Element[][]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/mixed.tsx: TS2322: Type '{ name: string; children: Element[][]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/dagger.tsx: TS2322: Type '{ key: number; name: string; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/dagger.tsx: TS2322: Type '{ name: string; position: V; rotation: [number, number, number]; children: Element; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/dagger.tsx: TS2322: Type '{ name: string; rotation: [number, number, number]; children: Element; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/house.tsx: TS2322: Type '{ key: number; name: string; position: [number, number, number]; children: (Element[] | Element)[]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/house.tsx: TS2322: Type '{ name: string; position: [number, number, number]; rotation: [number, number, number]; children: (Element[] | Element)[]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/places.tsx: TS2322: Type '{ name: string; children: (ReactNode[] | Element)[]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/scenes.tsx: TS2322: Type '{ key: number; name: string; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/weather.tsx: TS2322: Type '{ key: number; name: string; position: [number, number, number]; rotation: [number, number, number]; children: Element; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+content/rome/shots/weather.tsx: TS2322: Type '{ name: string; position: [number, number, number]; rotation: [number, number, number]; children: Element; }' is not assignable to type 'IntrinsicAttributes & GroupProps'.
+sdk/audio/src/tone/effects.ts: TS2416: Property 'getValue' in type 'FFT' is not assignable to the same property in base type 'Meter'.
+sdk/audio/src/tone/effects.ts: TS2416: Property 'getValue' in type 'Waveform' is not assignable to the same property in base type 'Meter'.
+sdk/shell/src/fs.ts: TS2305: Module '"just-bash/browser"' has no exported member 'DirentEntry'.
+sdk/shell/src/fs.ts: TS2305: Module '"just-bash/browser"' has no exported member 'ReadFileOptions'.
+sdk/shell/src/fs.ts: TS2305: Module '"just-bash/browser"' has no exported member 'WriteFileOptions'.
+sdk/shell/src/fs.ts: TS2322: Type 'string' is not assignable to type 'BufferEncoding | null | undefined'.
+sdk/ui/src/platform/audio.ts: TS2353: Object literal may only specify known properties, and 'id' does not exist in type '{ ev: string; data?: string | undefined; binary?: boolean | undefined; code?: number | undefined; reason?: string | undefined; clean?: boolean | undefined; protocol?: string | undefined; error?: boolean | undefined; }'.
+sdk/ui/src/platform/audio.ts: TS2353: Object literal may only specify known properties, and 'id' does not exist in type '{ ev: string; data?: string | undefined; binary?: boolean | undefined; code?: number | undefined; reason?: string | undefined; clean?: boolean | undefined; protocol?: string | undefined; error?: boolean | undefined; }'.
+sdk/ui/src/platform/audio.ts: TS2353: Object literal may only specify known properties, and 'id' does not exist in type '{ ev: string; data?: string | undefined; binary?: boolean | undefined; code?: number | undefined; reason?: string | undefined; clean?: boolean | undefined; protocol?: string | undefined; error?: boolean | undefined; }'.
+sdk/ui/src/platform/core.ts: TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
+sdk/ui/src/platform/events.ts: TS7006: Parameter 'x' implicitly has an 'any' type.
+sdk/ui/src/platform/url.ts: TS7023: 'origin' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
+sdk/ui/src/react.ts: TS2307: Cannot find module 'react-reconciler' or its corresponding type declarations.
+sdk/ui/src/react.ts: TS2307: Cannot find module 'react-reconciler/constants' or its corresponding type declarations.
+sdk/video/src/media.tsx: TS2345: Argument of type 'AudioProps' is not assignable to parameter of type 'MediaProps'.
diff --git a/bench/tsc/run.sh b/bench/tsc/run.sh
new file mode 100755
index 00000000..b31a7319
--- /dev/null
+++ b/bench/tsc/run.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# S8a's tsc (docs/sdk.feature): the SDK's library sources (sdk/*/src) and the committed compositions (content/) typed
+# by the SDK umbrella's TypeScript, with bun's own types (sdk/raea/tsconfig.check.json; the packages' tsconfig.json is
+# unchanged). A ratchet: bench/tsc/known.txt lists the errors there were when it started, each as file, code and
+# message (no line or column, so an edit above one doesn't move it). Exits 1 on an error not in the list; one fixed
+# is printed so the list can shrink.
+#
+# bench/tsc/run.sh check
+# bench/tsc/run.sh --accept rewrite known.txt to this run's errors (only to shrink it, or with the owner's say)
+set -uo pipefail
+# one collation for sort and comm, here and in known.txt: under a locale's, comm can misread a sorted list, and a known
+# error reads as both fixed and new
+export LC_ALL=C
+cd "$(dirname "$0")/../.."
+CHECK=sdk/raea/tsconfig.check.json
+TSC=$(dirname "$CHECK")/node_modules/.bin/tsc
+KNOWN=bench/tsc/known.txt
+[ -x "$TSC" ] || { echo "FAIL tsc: $TSC missing (bun install in $(dirname "$CHECK"))"; exit 1; }
+out=$(mktemp -d)
+trap 'rm -rf "$out"' EXIT
+"$TSC" -p "$CHECK" > "$out/raw" 2>&1
+# "path(line,col): error TSn: message" -> "path: TSn: message", paths from the repo root; a message's own lines kept as one
+sed -nE 's|^(\.\./)*([^(]+)\([0-9]+,[0-9]+\): error (TS[0-9]+): (.*)$|\2: \3: \4|p' "$out/raw" \
+ | sed -E 's|^content/|content/|; s|^([a-z]+/src/)|sdk/\1|' | sort > "$out/now"
+if [ "${1:-}" = "--accept" ]; then
+ cp "$out/now" "$KNOWN"
+ echo "tsc: known.txt now $(wc -l < "$KNOWN" | tr -d ' ') errors"
+ exit 0
+fi
+[ -f "$KNOWN" ] || { echo "FAIL tsc: no $KNOWN (run with --accept once)"; exit 1; }
+comm -13 "$KNOWN" "$out/now" > "$out/new"
+comm -23 "$KNOWN" "$out/now" > "$out/gone"
+if [ -s "$out/gone" ]; then
+ echo "tsc: $(wc -l < "$out/gone" | tr -d ' ') known errors fixed (--accept to drop them):"
+ sed 's/^/ /' "$out/gone"
+fi
+if [ -s "$out/new" ]; then
+ echo "FAIL tsc: $(wc -l < "$out/new" | tr -d ' ') new errors:"
+ sed 's/^/ /' "$out/new"
+ exit 1
+fi
+echo "PASS tsc: $(wc -l < "$out/now" | tr -d ' ') errors, all known"
diff --git a/bench/wpt/fetch.sh b/bench/wpt/fetch.sh
new file mode 100755
index 00000000..b2899acd
--- /dev/null
+++ b/bench/wpt/fetch.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# The WPT reftest subset's tests (bench/wpt/run.sh), pinned: web-platform-tests at one commit, only the areas run and
+# what their pages load (fonts/, the css support folders, resources/), fetched once into
+# ~/Library/Caches/raea/wpt/<commit>/ and its path printed. Bumping the pin is a change here, and the pass rates move
+# with it.
+# bench/wpt/fetch.sh prints the checkout's path (fetching it first if it isn't there)
+set -euo pipefail
+COMMIT=5af3c135c9c97381733866150a7ada27d1029c50
+DIRS=(css/css-flexbox css/css-grid css/css-text css/css-backgrounds css/css-borders css/css-transforms css/css-fonts css/css-masking css/compositing css/support css/reference fonts resources/ahem images common)
+ROOT=${RAEA_WPT_DIR:-$HOME/Library/Caches/raea/wpt}/$COMMIT
+if [ ! -e "$ROOT/.fetched" ]; then
+ free=$(df -g "$HOME" | awk 'NR==2 {print $4}')
+ [ "${free:-0}" -ge 3 ] || { echo "fetch.sh: under 3 GB free; not fetching" >&2; exit 2; }
+ rm -rf "$ROOT" && mkdir -p "$ROOT"
+ git -C "$ROOT" init -q
+ git -C "$ROOT" remote add origin https://github.com/web-platform-tests/wpt.git
+ git -C "$ROOT" sparse-checkout set --no-cone "${DIRS[@]/#//}" >&2
+ git -C "$ROOT" fetch -q --depth 1 --filter=blob:none origin "$COMMIT" >&2
+ git -C "$ROOT" checkout -q FETCH_HEAD >&2
+ : > "$ROOT/.fetched"
+fi
+# a checkout from before a folder joined DIRS gets it now (common/: reftest-wait.js's takeScreenshot)
+for d in "${DIRS[@]}"; do [ -e "$ROOT/$d" ] || git -C "$ROOT" sparse-checkout add "/$d" >&2; done
+echo "$ROOT"
diff --git a/core/fonts/fonts.feature b/core/fonts/fonts.feature
index 4ed7371e..e18841bf 100644
--- a/core/fonts/fonts.feature
+++ b/core/fonts/fonts.feature
@@ -1,6 +1,8 @@
+@owner:unicorn @ticket:T-048
Feature: Bundled fonts for deterministic font aliasing
This folder holds the bundled fonts used for deterministic font aliasing (see
- src/fonts.rs). They are Fontsource latin subsets, extracted to woff2 files.
+ src/fonts.rs). They are Fontsource latin subsets
+ (`packages/core/src/fonts/fontData.generated.ts`), extracted to woff2 files.
Each family is licensed under the SIL Open Font License 1.1, and the license texts are in licenses/.
diff --git a/core/fonts/src/lib.rs b/core/fonts/src/lib.rs
index b6b16f1e..41da1a6c 100644
--- a/core/fonts/src/lib.rs
+++ b/core/fonts/src/lib.rs
@@ -1,9 +1,9 @@
//! raea's bundled faces: the Fontsource latin subsets in this folder (index.json), and the aliases that map a requested
-//! family onto one (the composition format's deterministic fonts: Helvetica, Arial and SF Pro draw as Inter, Times and Georgia as EB
+//! family onto one (a deterministic font set: Helvetica, Arial and SF Pro draw as Inter, Times and Georgia as EB
//! Garamond, Courier and Menlo as JetBrains Mono, ...), so a render looks the same on every machine. Each family is
//! under the SIL Open Font License 1.1 (licenses/).
-/// Lower-cased family → canonical bundled family (the composition format's FONT_ALIAS_MAP).
+/// Lower-cased family → canonical bundled family (the original runtime's FONT_ALIAS_MAP).
pub const ALIASES: &[(&str, &str)] = &[
("inter", "inter"), ("montserrat", "montserrat"), ("outfit", "outfit"), ("nunito", "nunito"),
("oswald", "oswald"), ("league gothic", "league-gothic"), ("archivo black", "archivo-black"),
diff --git a/core/grow/Cargo.toml b/core/grow/Cargo.toml
new file mode 100644
index 00000000..60a28f40
--- /dev/null
+++ b/core/grow/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "raea-core-grow"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "Generators for what is too numerous or too organic to place by hand: trees grown by space colonization in a crown envelope (tubes and leaf cards), lofted shapes, terrain, boulders and phyllotaxis rosettes"
+
+[dependencies]
+raea-core-sdf = { path = "../sdf" }
diff --git a/core/grow/src/lib.rs b/core/grow/src/lib.rs
new file mode 100644
index 00000000..f5228e61
--- /dev/null
+++ b/core/grow/src/lib.rs
@@ -0,0 +1,54 @@
+//! Generators for what is too numerous or too organic to place by hand (the 11-06 research: what Blender users get
+//! from Geometry Nodes and Sapling, and what an agent can't fake with a few primitives): trees grown by space
+//! colonization, lofts through outlines, terrain slabs, boulders, and phyllotaxis rosettes. Each returns closed
+//! triangle pieces, which raea-core-shape turns into a solid (`tree("...")`, `loft("...")`, `terrain("...")`,
+//! `boulder("...")`, `rosette("...")`), so the result can be measured, cut and placed like any other solid.
+//!
+//! Frame: the scene's (y up), metres; everything stands on y 0 at the origin.
+
+pub mod loft;
+pub mod mesh;
+pub mod rosette;
+pub mod terrain;
+pub mod tree;
+pub mod tube;
+
+pub use mesh::Mesh;
+
+/// A tree from its settings text; `part` is "wood", "leaves" or "all". The wood is one tube a branch (closed pieces
+/// overlapping at the forks), the leaves thin closed cards: `tree_pieces` gives them apart, to be unioned into one
+/// solid (raea-core-shape does), and this gives them as one mesh.
+pub fn tree(text: &str, part: &str) -> Result<Mesh, String> {
+ let mut m = Mesh::default();
+ for p in tree_pieces(text, part)? {
+ m.append(&p);
+ }
+ Ok(m)
+}
+
+/// A tree's closed pieces: a tube a branch, then a card a leaf.
+pub fn tree_pieces(text: &str, part: &str) -> Result<Vec<Mesh>, String> {
+ let t = tree::Tree::parse(text)?;
+ let s = tree::grow(&t);
+ let out = match part {
+ "wood" => tree::wood(&t, &s),
+ "leaves" => vec![tree::leaves(&t, &s)],
+ "all" | "" => [tree::wood(&t, &s), vec![tree::leaves(&t, &s)]].concat(),
+ o => return Err(format!("tree: part {o:?} isn't wood, leaves or all")),
+ };
+ if out.iter().all(|m| m.t.is_empty()) {
+ return Err("tree: nothing grew (a bare tree's leaves, or too few points)".into());
+ }
+ Ok(out)
+}
+
+/// A loft from its sections text (see `loft`), `n` points around (0: chosen).
+pub fn loft(text: &str, n: usize) -> Result<Mesh, String> {
+ Ok(loft::loft(&loft::parse(text)?, n))
+}
+
+pub use rosette::rosette;
+pub use terrain::{boulder, terrain};
+
+#[cfg(test)]
+mod tests;
diff --git a/core/grow/src/loft.rs b/core/grow/src/loft.rs
new file mode 100644
index 00000000..87395578
--- /dev/null
+++ b/core/grow/src/loft.rs
@@ -0,0 +1,149 @@
+//! A loft: closed outlines at heights, skinned into one closed solid. A vase, a bottle, a lamp base, a handle's grip, a
+//! boat's hull, a column with a swelling (entasis): each outline is resampled to the same count by arc length, starting
+//! from the same angle, so neighbouring outlines join without twisting, and the ends are capped by ear clipping.
+//!
+//! Text form (what `loft("...")` takes in a shape expression): sections by ';', each "y: outline" where the outline is
+//! `circle r`, `ellipse rx rz`, `rect w d`, `ngon n r`, or points `x z, x z, ...` (any winding).
+
+use crate::mesh::Mesh;
+
+pub type Section = (f64, Vec<[f64; 2]>);
+
+pub fn parse(text: &str) -> Result<Vec<Section>, String> {
+ let mut out = Vec::new();
+ for part in text.split(';').map(str::trim).filter(|s| !s.is_empty()) {
+ let (y, shape) = part.split_once(':').ok_or_else(|| format!("loft: a section is \"y: outline\", got {part:?}"))?;
+ let y: f64 = y.trim().parse().map_err(|_| format!("loft: {y:?} isn't a height"))?;
+ let w: Vec<&str> = shape.split_whitespace().collect();
+ let nums = |from: usize, n: usize| -> Result<Vec<f64>, String> {
+ let v: Vec<f64> = w[from..].iter().map(|x| x.parse::<f64>().map_err(|_| format!("loft: bad number {x:?}"))).collect::<Result<_, _>>()?;
+ if v.len() != n || v.iter().any(|x| *x <= 0.0) {
+ return Err(format!("loft: {} takes {n} numbers above 0", w[0]));
+ }
+ Ok(v)
+ };
+ let ring = |n: usize, rx: f64, rz: f64| (0..n).map(|i| { let a = i as f64 / n as f64 * std::f64::consts::TAU; [rx * a.cos(), rz * a.sin()] }).collect::<Vec<_>>();
+ let pts = match w.first().copied() {
+ Some("circle") => { let v = nums(1, 1)?; ring(64, v[0], v[0]) }
+ Some("ellipse") => { let v = nums(1, 2)?; ring(64, v[0], v[1]) }
+ Some("ngon") => { let v = nums(1, 2)?; ring(v[0].round().max(3.0) as usize, v[1], v[1]) }
+ Some("rect") => { let v = nums(1, 2)?; let (x, z) = (v[0] / 2.0, v[1] / 2.0); vec![[x, z], [-x, z], [-x, -z], [x, -z]] }
+ _ => {
+ let mut p = Vec::new();
+ for pt in shape.split(',') {
+ let xz: Vec<f64> = pt.split_whitespace().map(|v| v.parse::<f64>().map_err(|_| format!("loft: bad number {v:?}"))).collect::<Result<_, _>>()?;
+ if xz.len() != 2 {
+ return Err(format!("loft: a point is \"x z\", got {pt:?}"));
+ }
+ p.push([xz[0], xz[1]]);
+ }
+ p
+ }
+ };
+ if pts.len() < 3 {
+ return Err("loft: an outline needs 3 points".into());
+ }
+ out.push((y, pts));
+ }
+ if out.len() < 2 {
+ return Err("loft: 2 or more sections, \"y: outline; y: outline\"".into());
+ }
+ if out.windows(2).any(|w| w[1].0 <= w[0].0) {
+ return Err("loft: sections go up: each y above the one before".into());
+ }
+ Ok(out)
+}
+
+fn area(p: &[[f64; 2]]) -> f64 {
+ (0..p.len()).map(|i| { let (a, b) = (p[i], p[(i + 1) % p.len()]); a[0] * b[1] - b[0] * a[1] }).sum::<f64>() / 2.0
+}
+
+/// The outline as `n` points evenly spaced along it, counter-clockwise (in x-z), starting where it crosses +x from
+/// its centre.
+fn resample(p: &[[f64; 2]], n: usize) -> Vec<[f64; 2]> {
+ let mut p = p.to_vec();
+ if area(&p) < 0.0 {
+ p.reverse();
+ }
+ let c = [p.iter().map(|q| q[0]).sum::<f64>() / p.len() as f64, p.iter().map(|q| q[1]).sum::<f64>() / p.len() as f64];
+ // start at the point nearest angle 0 from the centre
+ let start = (0..p.len()).min_by(|&a, &b| {
+ let ang = |q: [f64; 2]| (q[1] - c[1]).atan2(q[0] - c[0]).abs();
+ ang(p[a]).total_cmp(&ang(p[b]))
+ }).unwrap();
+ p.rotate_left(start);
+ let seg: Vec<f64> = (0..p.len()).map(|i| { let (a, b) = (p[i], p[(i + 1) % p.len()]); ((b[0] - a[0]).powi(2) + (b[1] - a[1]).powi(2)).sqrt() }).collect();
+ let total: f64 = seg.iter().sum();
+ let mut out = Vec::with_capacity(n);
+ let (mut i, mut walked) = (0usize, 0.0);
+ for k in 0..n {
+ let want = k as f64 / n as f64 * total;
+ while walked + seg[i] < want && i < p.len() - 1 {
+ walked += seg[i];
+ i += 1;
+ }
+ let t = if seg[i] > 0.0 { (want - walked) / seg[i] } else { 0.0 };
+ let (a, b) = (p[i], p[(i + 1) % p.len()]);
+ out.push([a[0] + t * (b[0] - a[0]), a[1] + t * (b[1] - a[1])]);
+ }
+ out
+}
+
+/// Ear clipping: the polygon's triangles as index triples (counter-clockwise input).
+fn ears(p: &[[f64; 2]]) -> Vec<[usize; 3]> {
+ let cross = |a: [f64; 2], b: [f64; 2], c: [f64; 2]| (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
+ let mut idx: Vec<usize> = (0..p.len()).collect();
+ let mut out = Vec::new();
+ let mut guard = 0;
+ while idx.len() > 3 && guard < p.len() * p.len() {
+ guard += 1;
+ let n = idx.len();
+ let mut cut = None;
+ for k in 0..n {
+ let (a, b, c) = (idx[(k + n - 1) % n], idx[k], idx[(k + 1) % n]);
+ if cross(p[a], p[b], p[c]) <= 1e-14 {
+ continue;
+ }
+ let inside = idx.iter().any(|&o| o != a && o != b && o != c && cross(p[a], p[b], p[o]) > 0.0 && cross(p[b], p[c], p[o]) > 0.0 && cross(p[c], p[a], p[o]) > 0.0);
+ if !inside {
+ cut = Some(k);
+ out.push([a, b, c]);
+ break;
+ }
+ }
+ match cut {
+ Some(k) => { idx.remove(k); }
+ // degenerate: fan what is left
+ None => break,
+ }
+ }
+ for k in 1..idx.len().saturating_sub(1) {
+ out.push([idx[0], idx[k], idx[k + 1]]);
+ }
+ out
+}
+
+/// One closed solid through the sections, `n` points around each (0: the most any section has, at least 24).
+pub fn loft(sections: &[Section], n: usize) -> Mesh {
+ let n = if n >= 3 { n } else { sections.iter().map(|s| s.1.len()).max().unwrap_or(24).max(24) };
+ let rings: Vec<Vec<[f64; 2]>> = sections.iter().map(|s| resample(&s.1, n)).collect();
+ let mut m = Mesh::default();
+ let ids: Vec<Vec<u32>> = rings.iter().zip(sections).map(|(r, s)| r.iter().map(|q| m.vert([q[0], s.0, q[1]])).collect()).collect();
+ // counter-clockwise in (x, z) seen from +y is clockwise (x right, z down the page): sides wound for that
+ for w in ids.windows(2) {
+ for s in 0..n {
+ let (a, b) = (w[0][s], w[0][(s + 1) % n]);
+ let (c, d) = (w[1][s], w[1][(s + 1) % n]);
+ m.tri(a, c, d);
+ m.tri(a, d, b);
+ }
+ }
+ let (bot, top) = (&ids[0], &ids[ids.len() - 1]);
+ for e in ears(&rings[0]) {
+ m.tri(bot[e[0]], bot[e[1]], bot[e[2]]);
+ }
+ for e in ears(&rings[rings.len() - 1]) {
+ m.tri(top[e[0]], top[e[2]], top[e[1]]);
+ }
+ m
+}
diff --git a/core/grow/src/mesh.rs b/core/grow/src/mesh.rs
new file mode 100644
index 00000000..def4c942
--- /dev/null
+++ b/core/grow/src/mesh.rs
@@ -0,0 +1,72 @@
+//! Triangle meshes as the generators make them: closed pieces appended to one list, and a seeded random stream.
+
+#[derive(Default, Clone, Debug)]
+pub struct Mesh {
+ /// positions flat (x y z)
+ pub v: Vec<f32>,
+ /// triangles by threes, wound outward
+ pub t: Vec<u32>,
+}
+
+impl Mesh {
+ pub fn vert(&mut self, p: [f64; 3]) -> u32 {
+ let i = (self.v.len() / 3) as u32;
+ self.v.extend([p[0] as f32, p[1] as f32, p[2] as f32]);
+ i
+ }
+ pub fn tri(&mut self, a: u32, b: u32, c: u32) {
+ self.t.extend([a, b, c]);
+ }
+ pub fn append(&mut self, o: &Mesh) {
+ let base = (self.v.len() / 3) as u32;
+ self.v.extend_from_slice(&o.v);
+ self.t.extend(o.t.iter().map(|i| i + base));
+ }
+ pub fn triangles(&self) -> usize {
+ self.t.len() / 3
+ }
+}
+
+/// A seeded stream in [0, 1) (splitmix64): the same seed, the same tree.
+pub struct Rng(u64);
+
+impl Rng {
+ pub fn new(seed: u64) -> Rng {
+ Rng(seed.wrapping_mul(0x9e3779b97f4a7c15) ^ 0xd1b54a32d192ed03)
+ }
+ pub fn f(&mut self) -> f64 {
+ self.0 = self.0.wrapping_add(0x9e3779b97f4a7c15);
+ let mut z = self.0;
+ z = (z ^ (z >> 30)).wrapping_mul(0xbf58476d1ce4e5b9);
+ z = (z ^ (z >> 27)).wrapping_mul(0x94d049bb133111eb);
+ ((z ^ (z >> 31)) >> 11) as f64 / (1u64 << 53) as f64
+ }
+ pub fn range(&mut self, lo: f64, hi: f64) -> f64 {
+ lo + (hi - lo) * self.f()
+ }
+ /// a unit vector, uniform on the sphere
+ pub fn dir(&mut self) -> [f64; 3] {
+ let z = self.range(-1.0, 1.0);
+ let a = self.range(0.0, std::f64::consts::TAU);
+ let r = (1.0 - z * z).sqrt();
+ [r * a.cos(), z, r * a.sin()]
+ }
+}
+
+pub fn add(a: [f64; 3], b: [f64; 3]) -> [f64; 3] {
+ [a[0] + b[0], a[1] + b[1], a[2] + b[2]]
+}
+pub fn sub(a: [f64; 3], b: [f64; 3]) -> [f64; 3] {
+ [a[0] - b[0], a[1] - b[1], a[2] - b[2]]
+}
+pub fn mul(a: [f64; 3], s: f64) -> [f64; 3] {
+ [a[0] * s, a[1] * s, a[2] * s]
+}
+pub use raea_core_sdf::{dot, len};
+pub fn cross(a: [f64; 3], b: [f64; 3]) -> [f64; 3] {
+ [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]
+}
+pub fn norm(a: [f64; 3]) -> [f64; 3] {
+ let l = len(a);
+ if l < 1e-12 { [0.0, 1.0, 0.0] } else { mul(a, 1.0 / l) }
+}
diff --git a/core/grow/src/rosette.rs b/core/grow/src/rosette.rs
new file mode 100644
index 00000000..99868403
--- /dev/null
+++ b/core/grow/src/rosette.rs
@@ -0,0 +1,49 @@
+//! A rosette: leaves set around a centre at the golden angle (137.5°, phyllotaxis, as an agave, a succulent, a
+//! lettuce, a pine cone's scales or a flower's petals), the inner ones smaller and more upright, smooth-unioned in the
+//! distance field so the leaves grow out of one heart instead of sitting on it.
+
+use raea_core_sdf::{Node, Rot};
+
+use crate::mesh::Mesh;
+
+/// `leaves=21 length=0.3 width=0.09 thick=0.02 tilt=25 rise=50 blend=0.3 step=0`: `leaves` leaves of up to `length` m,
+/// tilted `tilt` degrees above level at the outside rising to `rise` at the centre; `blend` is the smooth union's reach
+/// as a share of the width.
+pub fn rosette(text: &str) -> Result<Mesh, String> {
+ let (mut n, mut l, mut w, mut th, mut tilt, mut rise, mut blend, mut step) = (21.0, 0.3, 0.09, 0.02, 25.0, 50.0, 0.3, 0.0);
+ for kv in text.split_whitespace() {
+ let (k, v) = kv.split_once('=').ok_or_else(|| format!("rosette: {kv:?} isn't name=value"))?;
+ let v: f64 = v.parse().map_err(|_| format!("rosette: {k} takes a number, got {v:?}"))?;
+ match k {
+ "leaves" => n = v,
+ "length" => l = v,
+ "width" => w = v,
+ "thick" => th = v,
+ "tilt" => tilt = v,
+ "rise" => rise = v,
+ "blend" => blend = v,
+ "step" => step = v,
+ o => return Err(format!("rosette: no setting {o}: leaves, length, width, thick, tilt, rise, blend, step")),
+ }
+ }
+ let n = (n.round() as usize).clamp(1, 400);
+ if l <= 0.0 || w <= 0.0 || th <= 0.0 {
+ return Err("rosette: length, width and thick above 0".into());
+ }
+ let golden = 180.0 * (3.0 - 5f64.sqrt());
+ let leaves: Vec<Node> = (0..n).map(|i| {
+ // the oldest (outermost) leaf is i = n - 1
+ let age = (i as f64 + 1.0) / n as f64;
+ let s = 0.35 + 0.65 * age.sqrt();
+ let up = rise + (tilt - rise) * age;
+ let (ll, ww) = (l * s, w * s.sqrt());
+ let a = up.to_radians();
+ let leaf = Node::Rotate(Box::new(Node::Ellipsoid([ll / 2.0, th / 2.0, ww / 2.0])), Rot::degrees(0.0, 0.0, up));
+ let out = Node::Move(Box::new(leaf), [ll / 2.0 * a.cos(), ll / 2.0 * a.sin(), 0.0]);
+ Node::Rotate(Box::new(out), Rot::degrees(0.0, i as f64 * golden, 0.0))
+ }).collect();
+ let node = Node::SmoothUnion(w * blend, leaves);
+ let step = if step > 0.0 { step } else { (th / 3.0).max(l / 200.0) };
+ let (v, t) = raea_core_sdf::mesh(&node, Some(step))?;
+ Ok(Mesh { v, t })
+}
diff --git a/core/grow/src/terrain.rs b/core/grow/src/terrain.rs
new file mode 100644
index 00000000..cc050ddc
--- /dev/null
+++ b/core/grow/src/terrain.rs
@@ -0,0 +1,133 @@
+//! Ground and rock. `terrain` is a fractal heightfield as a closed slab (a top surface, flat sides and a bottom), so a
+//! hill is a solid that can be cut, carved by a path's `minus`, and stood on. `boulder` is an ellipsoid roughened by
+//! fractal noise through the distance field, so its lumps are part of one closed surface rather than bumps on a ball.
+
+use raea_core_sdf::{Node, fbm};
+
+use crate::mesh::Mesh;
+
+fn kv(what: &str, text: &str, names: &[&str]) -> Result<Vec<(String, f64)>, String> {
+ let mut out = Vec::new();
+ for w in text.split_whitespace() {
+ let (k, v) = w.split_once('=').ok_or_else(|| format!("{what}: {w:?} isn't name=value"))?;
+ if !names.contains(&k) {
+ return Err(format!("{what}: no setting {k}: {}", names.join(", ")));
+ }
+ out.push((k.to_string(), v.parse::<f64>().map_err(|_| format!("{what}: {k} takes a number, got {v:?}"))?));
+ }
+ Ok(out)
+}
+
+/// `size=20 depth=20 height=2 cells=128 freq=0.15 octaves=5 seed=1 base=0.5 flat=0`: a slab `size` wide in x and
+/// `depth` in z, centred at the origin, its surface at y 0 plus up to `height` of noise (`freq` cycles a metre,
+/// `octaves` layers), the bottom `base` below the lowest point. `flat` (0-1) flattens a disc in the middle (a place to
+/// stand things) that wide as a share of the size.
+pub fn terrain(text: &str) -> Result<Mesh, String> {
+ let (mut w, mut d, mut h, mut cells, mut freq, mut oct, mut seed, mut base, mut flat) = (20.0, 0.0, 2.0, 128.0, 0.15, 5.0, 1.0, 0.5, 0.0);
+ for (k, v) in kv("terrain", text, &["size", "depth", "height", "cells", "freq", "octaves", "seed", "base", "flat"])? {
+ match k.as_str() {
+ "size" => w = v,
+ "depth" => d = v,
+ "height" => h = v,
+ "cells" => cells = v,
+ "freq" => freq = v,
+ "octaves" => oct = v,
+ "seed" => seed = v,
+ "base" => base = v,
+ _ => flat = v,
+ }
+ }
+ let d = if d > 0.0 { d } else { w };
+ if w <= 0.0 || h < 0.0 || base <= 0.0 {
+ return Err("terrain: size and base above 0, height 0 or more".into());
+ }
+ let n = (cells.round() as usize).clamp(2, 1024);
+ let nz = ((n as f64 * d / w).round() as usize).clamp(2, 1024);
+ let (oct, seed) = (oct.clamp(1.0, 8.0) as u32, seed as u32);
+ let height = |x: f64, z: f64| {
+ let mut y = h * (fbm([x * freq, 0.37, z * freq], oct, seed) * 0.5 + 0.5);
+ if flat > 0.0 {
+ let r = (x * x + z * z).sqrt() / (w * flat / 2.0);
+ let t = ((r - 0.7) / 0.6).clamp(0.0, 1.0);
+ let s = t * t * (3.0 - 2.0 * t);
+ y *= s;
+ }
+ y
+ };
+ let mut m = Mesh::default();
+ let at = |i: usize, k: usize| (-w / 2.0 + w * i as f64 / n as f64, -d / 2.0 + d * k as f64 / nz as f64);
+ let mut top = vec![0u32; (n + 1) * (nz + 1)];
+ let mut low = f64::MAX;
+ for k in 0..=nz {
+ for i in 0..=n {
+ let (x, z) = at(i, k);
+ let y = height(x, z);
+ low = low.min(y);
+ top[i + (n + 1) * k] = m.vert([x, y, z]);
+ }
+ }
+ let floor = low - base;
+ let mut bot = vec![0u32; (n + 1) * (nz + 1)];
+ for k in 0..=nz {
+ for i in 0..=n {
+ let (x, z) = at(i, k);
+ bot[i + (n + 1) * k] = m.vert([x, floor, z]);
+ }
+ }
+ let id = |i: usize, k: usize| i + (n + 1) * k;
+ for k in 0..nz {
+ for i in 0..n {
+ let (a, b, c, e) = (id(i, k), id(i + 1, k), id(i, k + 1), id(i + 1, k + 1));
+ // the top faces +y, the bottom -y
+ m.tri(top[a], top[c], top[e]);
+ m.tri(top[a], top[e], top[b]);
+ m.tri(bot[a], bot[e], bot[c]);
+ m.tri(bot[a], bot[b], bot[e]);
+ }
+ }
+ // the four sides, each a strip from the top's edge down to the bottom's
+ let side = |edge: Vec<usize>, m: &mut Mesh| {
+ for p in edge.windows(2) {
+ let (a, b) = (p[0], p[1]);
+ m.tri(top[a], bot[b], bot[a]);
+ m.tri(top[a], top[b], bot[b]);
+ }
+ };
+ side((0..=n).map(|i| id(i, 0)).collect(), &mut m);
+ side((0..=nz).map(|k| id(n, k)).collect(), &mut m);
+ side((0..=n).rev().map(|i| id(i, nz)).collect(), &mut m);
+ side((0..=nz).rev().map(|k| id(0, k)).collect(), &mut m);
+ Ok(m)
+}
+
+/// `size=1 squash=0.7 rough=0.15 freq=3 octaves=4 seed=1 step=0`: a rock about `size` across, `squash` as tall as wide,
+/// lumped by noise `rough` (a share of the size) at `freq` cycles across it, resting on y 0.
+pub fn boulder(text: &str) -> Result<Mesh, String> {
+ let (mut size, mut squash, mut rough, mut freq, mut oct, mut seed, mut step) = (1.0, 0.7, 0.15, 3.0, 4.0, 1.0, 0.0);
+ for (k, v) in kv("boulder", text, &["size", "squash", "rough", "freq", "octaves", "seed", "step"])? {
+ match k.as_str() {
+ "size" => size = v,
+ "squash" => squash = v,
+ "rough" => rough = v,
+ "freq" => freq = v,
+ "octaves" => oct = v,
+ "seed" => seed = v,
+ _ => step = v,
+ }
+ }
+ if size <= 0.0 || squash <= 0.0 || rough < 0.0 {
+ return Err("boulder: size and squash above 0, rough 0 or more".into());
+ }
+ let r = size / 2.0;
+ // a little longer one way than the other, from the seed, so a field of them isn't all the same egg
+ let stretch = 1.0 + 0.25 * fbm([seed * 1.7, 0.5, 0.0], 1, seed as u32).abs();
+ let node = Node::Displace(Box::new(Node::Ellipsoid([r * stretch, r * squash, r / stretch])), rough * size, freq / size, oct as u32, seed as u32);
+ let (v, t) = raea_core_sdf::mesh(&node, if step > 0.0 { Some(step) } else { Some(size / 64.0) })?;
+ let mut m = Mesh { v, t };
+ // rest it on the ground
+ let low = m.v.chunks(3).map(|p| p[1]).fold(f32::MAX, f32::min);
+ for p in m.v.chunks_mut(3) {
+ p[1] -= low;
+ }
+ Ok(m)
+}
diff --git a/core/grow/src/tests.rs b/core/grow/src/tests.rs
new file mode 100644
index 00000000..d1af3e2e
--- /dev/null
+++ b/core/grow/src/tests.rs
@@ -0,0 +1,95 @@
+use super::*;
+
+/// The mesh's volume (divergence theorem), its bad halfedges (unpaired or doubled), and its height range.
+fn measure(m: &Mesh) -> (f64, usize, f32, f32) {
+ let p = |i: u32| [m.v[i as usize * 3] as f64, m.v[i as usize * 3 + 1] as f64, m.v[i as usize * 3 + 2] as f64];
+ let mut vol = 0.0;
+ let mut edges = std::collections::HashMap::new();
+ for c in m.t.chunks(3) {
+ let (a, b, d) = (p(c[0]), p(c[1]), p(c[2]));
+ vol += (a[0] * (b[1] * d[2] - b[2] * d[1]) - a[1] * (b[0] * d[2] - b[2] * d[0]) + a[2] * (b[0] * d[1] - b[1] * d[0])) / 6.0;
+ for k in 0..3 {
+ let (x, y) = (c[k], c[(k + 1) % 3]);
+ *edges.entry((x, y)).or_insert(0i32) += 1;
+ }
+ }
+ // directed: each halfedge once and its reverse once, so the winding is consistent (as Manifold checks)
+ let bad = edges.iter().filter(|((x, y), n)| **n != 1 || edges.get(&(*y, *x)) != Some(&1)).count();
+ let ys = m.v.chunks(3).map(|q| q[1]);
+ let (lo, hi) = ys.fold((f32::MAX, f32::MIN), |(a, b), y| (a.min(y), b.max(y)));
+ (vol, bad, lo, hi)
+}
+
+#[test]
+fn a_loft_is_closed_outward_and_its_volume_is_right() {
+ let m = loft("0: circle 0.5; 1: circle 0.5", 64).unwrap();
+ let (vol, open, ..) = measure(&m);
+ assert_eq!(open, 0);
+ let want = std::f64::consts::PI * 0.25;
+ assert!((vol - want).abs() / want < 0.01, "{vol} vs {want}");
+ // a square base to a round top, through a waist; any winding of a point outline
+ let m = loft("0: rect 1 1; 0.5: circle 0.25; 1: 0.4 0, 0 0.4, -0.4 0, 0 -0.4", 0).unwrap();
+ let (vol, open, lo, hi) = measure(&m);
+ assert_eq!(open, 0);
+ assert!(vol > 0.1 && vol < 1.0, "{vol}");
+ assert_eq!((lo, hi), (0.0, 1.0));
+ assert!(loft("1: circle 1; 0: circle 1", 0).unwrap_err().contains("go up"));
+}
+
+#[test]
+fn terrain_is_a_closed_slab_and_flat_terrain_is_a_box() {
+ let m = terrain("size=4 depth=2 height=0 base=0.5 cells=8").unwrap();
+ let (vol, open, ..) = measure(&m);
+ assert_eq!(open, 0);
+ assert!((vol - 4.0).abs() < 1e-4, "{vol}");
+ let m = terrain("size=10 height=2 cells=64 seed=3 flat=0.3").unwrap();
+ let (vol, open, _, hi) = measure(&m);
+ assert_eq!(open, 0);
+ assert!(vol > 50.0 && hi <= 2.0, "{vol} {hi}");
+ let (v0, _, _, h0) = measure(&terrain("size=10 height=2 cells=64 seed=4").unwrap());
+ assert!((v0 - vol).abs() > 1e-3 || h0 != hi, "different seeds, different ground");
+}
+
+#[test]
+fn a_boulder_rests_on_the_ground_and_is_one_closed_piece() {
+ let m = boulder("size=1 seed=2").unwrap();
+ let (vol, open, lo, hi) = measure(&m);
+ assert_eq!(open, 0);
+ assert_eq!(lo, 0.0);
+ assert!(hi > 0.4 && hi < 1.2, "{hi}");
+ assert!(vol > 0.1 && vol < 0.6, "{vol}");
+}
+
+#[test]
+fn a_rosette_is_closed_and_wider_than_tall() {
+ let m = rosette("leaves=13 length=0.3").unwrap();
+ let (vol, open, lo, hi) = measure(&m);
+ assert_eq!(open, 0);
+ assert!(vol > 0.0);
+ let xs: Vec<f32> = m.v.chunks(3).map(|q| q[0]).collect();
+ let span = xs.iter().cloned().fold(f32::MIN, f32::max) - xs.iter().cloned().fold(f32::MAX, f32::min);
+ assert!(span > hi - lo, "{span} vs {}", hi - lo);
+}
+
+#[test]
+fn a_tree_grows_to_its_height_thins_outward_and_is_the_same_twice() {
+ let text = "height=5 points=600 seed=3";
+ let t = tree::Tree::parse(text).unwrap();
+ let s = tree::grow(&t);
+ let tips = s.children.iter().filter(|c| c.is_empty()).count();
+ assert!(tips > 40, "{tips} tips");
+ // the pipe model: the trunk is the thickest, many times a twig
+ let r0 = s.radius[0];
+ assert!(s.radius.iter().all(|r| *r <= r0 + 1e-12));
+ assert!(r0 > t.tip * 8.0, "{r0}");
+ let wood = tree(text, "wood").unwrap();
+ let (vol, open, lo, hi) = measure(&wood);
+ assert_eq!(open, 0);
+ assert!(vol > 0.0);
+ assert!(lo > -0.2 && hi > 3.5 && hi < 5.6, "{lo} {hi}");
+ let leaves = tree(text, "leaves").unwrap();
+ assert_eq!(measure(&leaves).1, 0);
+ assert_eq!(tree(text, "all").unwrap().v, tree(text, "all").unwrap().v);
+ assert!(tree::Tree::parse("crown=blob").unwrap_err().contains("isn't one of"));
+ assert!(tree::Tree::parse("hight=3").unwrap_err().contains("no setting"));
+}
diff --git a/core/grow/src/tree.rs b/core/grow/src/tree.rs
new file mode 100644
index 00000000..ffada4de
--- /dev/null
+++ b/core/grow/src/tree.rs
@@ -0,0 +1,282 @@
+//! Trees grown by space colonization (Runions et al., 2007): attraction points scattered inside a crown envelope, and
+//! branches that grow a step at a time toward the points near them, which are used up as branches reach them. The
+//! crown's shape is the input, so a tree is art-directed by shape (a dome for an oak, a cone for a pine, a column for
+//! a cypress) and the growth fills it: the twigs come from the rule, never from hand placement, so a crown can't be
+//! faked with a few blobs. Radii follow the pipe model (a fork's children's cross-sections add up to about its
+//! parent's: Leonardo's rule), so limbs thin as they go out. Leaves are cards on the outer twigs.
+
+use std::collections::HashMap;
+
+use crate::mesh::{Mesh, Rng, add, cross, len, mul, norm, sub};
+use crate::tube::tube;
+
+#[derive(Clone, Debug)]
+pub struct Tree {
+ /// the whole tree's height, metres
+ pub height: f64,
+ /// the clear trunk below the crown, as a share of the height
+ pub trunk: f64,
+ /// the crown's width as a share of its own height (1: as wide as tall)
+ pub width: f64,
+ /// dome, sphere, cone, column, umbrella, vase
+ pub crown: String,
+ /// attraction points: more is a denser, twiggier crown
+ pub points: usize,
+ /// the growth step, as a share of the height (twig length)
+ pub step: f64,
+ /// the trunk's radius at the ground, metres (0: a fortieth of the height)
+ pub base: f64,
+ /// the outermost twigs' radius, metres
+ pub tip: f64,
+ /// how strongly branches turn up (positive) or droop (negative) as they grow
+ pub tropism: f64,
+ /// leaves per outer twig node (0: a bare tree)
+ pub leaves: usize,
+ /// a leaf's length, metres
+ pub leaf: f64,
+ /// sides of each branch's tube
+ pub sides: usize,
+ pub seed: u64,
+}
+
+impl Default for Tree {
+ fn default() -> Tree {
+ Tree { height: 6.0, trunk: 0.35, width: 0.9, crown: "dome".into(), points: 1200, step: 0.03, base: 0.0, tip: 0.006, tropism: 0.15, leaves: 3, leaf: 0.09, sides: 7, seed: 1 }
+ }
+}
+
+impl Tree {
+ /// `height=8 crown=cone points=2000 seed=4`: settings by name, the rest default.
+ pub fn parse(text: &str) -> Result<Tree, String> {
+ let mut t = Tree::default();
+ for kv in text.split_whitespace() {
+ let (k, v) = kv.split_once('=').ok_or_else(|| format!("tree: {kv:?} isn't name=value"))?;
+ let num = || v.parse::<f64>().map_err(|_| format!("tree: {k} takes a number, got {v:?}"));
+ match k {
+ "height" => t.height = num()?.max(0.05),
+ "trunk" => t.trunk = num()?.clamp(0.0, 0.9),
+ "width" => t.width = num()?.max(0.05),
+ "crown" => t.crown = v.to_string(),
+ "points" => t.points = num()?.clamp(10.0, 20000.0) as usize,
+ "step" => t.step = num()?.clamp(0.005, 0.2),
+ "base" => t.base = num()?.max(0.0),
+ "tip" => t.tip = num()?.max(0.0005),
+ "tropism" => t.tropism = num()?.clamp(-1.0, 1.0),
+ "leaves" => t.leaves = num()?.clamp(0.0, 12.0) as usize,
+ "leaf" => t.leaf = num()?.max(0.005),
+ "sides" => t.sides = num()?.clamp(3.0, 24.0) as usize,
+ "seed" => t.seed = num()? as u64,
+ o => return Err(format!("tree: no setting {o}: height, trunk, width, crown, points, step, base, tip, tropism, leaves, leaf, sides, seed")),
+ }
+ }
+ if !["dome", "sphere", "cone", "column", "umbrella", "vase"].contains(&t.crown.as_str()) {
+ return Err(format!("tree: crown {} isn't one of dome, sphere, cone, column, umbrella, vase", t.crown));
+ }
+ Ok(t)
+ }
+
+ /// Whether a point (in the crown's unit space: y 0 at the crown's bottom, 1 at its top, x and z by its radius) is in
+ /// the crown.
+ fn inside(&self, x: f64, y: f64, z: f64) -> bool {
+ let r = (x * x + z * z).sqrt();
+ match self.crown.as_str() {
+ "sphere" => r * r + (2.0 * y - 1.0).powi(2) <= 1.0,
+ "dome" => y >= 0.0 && r * r + (y * 1.3 - 0.3).max(0.0).powi(2) / 1.0 <= 1.0 && y <= 1.0,
+ "cone" => (0.0..=1.0).contains(&y) && r <= 1.0 - y,
+ "column" => (0.0..=1.0).contains(&y) && r <= 0.55 * (1.0 - (2.0 * y - 1.0).powi(4)).sqrt(),
+ "umbrella" => (0.55..=1.0).contains(&y) && r * r + ((y - 0.55) / 0.45 * 2.0 - 1.0).powi(2) <= 1.0,
+ _ => (0.0..=1.0).contains(&y) && r <= 0.25 + 0.75 * y && r >= 0.15 * y,
+ }
+ }
+}
+
+/// The grown skeleton: each node's position, parent and radius.
+pub struct Skeleton {
+ pub pos: Vec<[f64; 3]>,
+ pub parent: Vec<Option<usize>>,
+ pub radius: Vec<f64>,
+ pub children: Vec<Vec<usize>>,
+}
+
+pub fn grow(t: &Tree) -> Skeleton {
+ let mut rng = Rng::new(t.seed);
+ let h = t.height;
+ let crown_y = h * t.trunk;
+ let crown_h = h - crown_y;
+ let crown_r = crown_h * t.width / 2.0;
+ // attraction points inside the envelope
+ let mut pts: Vec<[f64; 3]> = Vec::with_capacity(t.points);
+ let mut tries = 0;
+ while pts.len() < t.points && tries < t.points * 200 {
+ tries += 1;
+ let (x, y, z) = (rng.range(-1.0, 1.0), rng.f(), rng.range(-1.0, 1.0));
+ if t.inside(x, y, z) {
+ pts.push([x * crown_r, crown_y + y * crown_h, z * crown_r]);
+ }
+ }
+ let step = h * t.step;
+ let influence = step * 9.0;
+ let kill = step * 1.6;
+ let mut pos = vec![[0.0, 0.0, 0.0]];
+ let mut parent: Vec<Option<usize>> = vec![None];
+ // the trunk: straight up until the crown's points are in reach
+ while pos[pos.len() - 1][1] < crown_y - influence * 0.5 && pos.len() < 4000 {
+ let last = pos.len() - 1;
+ let wobble = [rng.range(-0.04, 0.04), 1.0, rng.range(-0.04, 0.04)];
+ pos.push(add(pos[last], mul(norm(wobble), step)));
+ parent.push(Some(last));
+ }
+ let cell = influence;
+ let key = |p: &[f64; 3]| p.map(|x| (x / cell).floor() as i32);
+ let mut grid: HashMap<[i32; 3], Vec<usize>> = HashMap::new();
+ for (i, p) in pos.iter().enumerate() {
+ grid.entry(key(p)).or_default().push(i);
+ }
+ let up = [0.0, 1.0, 0.0];
+ for _ in 0..400 {
+ if pts.is_empty() {
+ break;
+ }
+ // each point pulls on its nearest node within reach
+ let mut pull: HashMap<usize, [f64; 3]> = HashMap::new();
+ for p in &pts {
+ let k = key(p);
+ let mut best: Option<(usize, f64)> = None;
+ for dx in -1..=1 {
+ for dy in -1..=1 {
+ for dz in -1..=1 {
+ for &n in grid.get(&[k[0] + dx, k[1] + dy, k[2] + dz]).into_iter().flatten() {
+ let d = len(sub(*p, pos[n]));
+ if d < influence && best.is_none_or(|b| d < b.1) {
+ best = Some((n, d));
+ }
+ }
+ }
+ }
+ }
+ if let Some((n, _)) = best {
+ let e = pull.entry(n).or_insert([0.0; 3]);
+ *e = add(*e, norm(sub(*p, pos[n])));
+ }
+ }
+ if pull.is_empty() {
+ break;
+ }
+ let mut grew: Vec<(usize, [f64; 3])> = pull.into_iter().collect();
+ grew.sort_by_key(|g| g.0);
+ for (n, d) in grew {
+ let dir = norm(add(norm(d), mul(up, t.tropism)));
+ let p = add(pos[n], mul(dir, step));
+ // two nodes in the same place stall growth: skip a step that lands on its parent's sibling
+ if grid.get(&key(&p)).into_iter().flatten().any(|&o| len(sub(pos[o], p)) < step * 0.3) {
+ continue;
+ }
+ let i = pos.len();
+ pos.push(p);
+ parent.push(Some(n));
+ grid.entry(key(&p)).or_default().push(i);
+ }
+ // points a branch has reached are used up
+ pts.retain(|p| {
+ let k = key(p);
+ !(-1..=1).any(|dx| (-1..=1).any(|dy| (-1..=1).any(|dz| grid.get(&[k[0] + dx, k[1] + dy, k[2] + dz]).into_iter().flatten().any(|&n| len(sub(*p, pos[n])) < kill))))
+ });
+ }
+ let mut children = vec![Vec::new(); pos.len()];
+ for (i, p) in parent.iter().enumerate() {
+ if let Some(p) = p {
+ children[*p].push(i);
+ }
+ }
+ // the pipe model, from the tips in: r^2.5 adds up at every fork
+ let mut radius = vec![t.tip; pos.len()];
+ for i in (0..pos.len()).rev() {
+ if !children[i].is_empty() {
+ radius[i] = children[i].iter().map(|&c| radius[c].powf(2.5)).sum::<f64>().powf(1.0 / 2.5).max(t.tip);
+ }
+ }
+ // the pipe model sets each limb's share; the trunk's size is the art's: tips stay at `tip`, the trunk meets `base`
+ // (by default a fortieth of the height, as a broadleaf tree's), everything between mapped in proportion
+ let base = if t.base > 0.0 { t.base } else { t.height / 40.0 };
+ let r0 = radius[0];
+ if r0 > t.tip {
+ for r in &mut radius {
+ *r = t.tip + (*r - t.tip) / (r0 - t.tip) * (base - t.tip).max(0.0);
+ }
+ }
+ Skeleton { pos, parent, radius, children }
+}
+
+/// The wood: each branch one tube from the fork it leaves to its tip, following its thickest child at every fork.
+/// The wood: one closed tube a branch, each starting inside its parent (so they overlap at the forks: union them).
+pub fn wood(t: &Tree, s: &Skeleton) -> Vec<Mesh> {
+ let mut m = Vec::new();
+ let mut starts = vec![0usize];
+ while let Some(start) = starts.pop() {
+ let mut path = Vec::new();
+ if let Some(p) = s.parent[start] {
+ // begin inside the parent, so the joint is covered
+ path.push((s.pos[p], s.radius[start]));
+ }
+ let mut at = start;
+ loop {
+ path.push((s.pos[at], s.radius[at]));
+ let kids = &s.children[at];
+ if kids.is_empty() {
+ break;
+ }
+ let main = *kids.iter().max_by(|a, b| s.radius[**a].total_cmp(&s.radius[**b])).unwrap();
+ for &k in kids {
+ if k != main {
+ starts.push(k);
+ }
+ }
+ at = main;
+ }
+ if path.len() >= 2 {
+ // thin twigs get fewer sides
+ let r0 = path[0].1;
+ let sides = if r0 < t.tip * 3.0 { 3.max(t.sides / 2) } else { t.sides };
+ m.push(tube(&path, sides));
+ }
+ }
+ m
+}
+
+/// The leaves: flat cards (closed and thin, so they stay a solid) at the outer twigs, facing out and up.
+pub fn leaves(t: &Tree, s: &Skeleton) -> Mesh {
+ let mut m = Mesh::default();
+ if t.leaves == 0 {
+ return m;
+ }
+ let mut rng = Rng::new(t.seed ^ 0x1eaf);
+ let outer = t.tip * 2.5;
+ for i in 0..s.pos.len() {
+ if s.radius[i] > outer {
+ continue;
+ }
+ for _ in 0..t.leaves {
+ let base = s.pos[i];
+ let along = norm(add(rng.dir(), [0.0, 0.3, 0.0]));
+ let side = norm(cross(along, if along[1].abs() < 0.9 { [0.0, 1.0, 0.0] } else { [1.0, 0.0, 0.0] }));
+ let face = norm(cross(along, side));
+ let l = t.leaf * rng.range(0.75, 1.25);
+ let w = l * 0.45;
+ let th = (l * 0.02).max(0.0005);
+ let tipp = add(base, mul(along, l));
+ let mid = add(base, mul(along, l * 0.45));
+ // a flat diamond: base, two sides, tip, each face a pair of triangles, split by thickness
+ let a = m.vert(base);
+ let b = m.vert(add(mid, mul(side, w / 2.0)));
+ let c = m.vert(tipp);
+ let d = m.vert(add(mid, mul(side, -w / 2.0)));
+ let up = m.vert(add(mid, mul(face, th)));
+ let dn = m.vert(add(mid, mul(face, -th)));
+ for (x, y) in [(a, b), (b, c), (c, d), (d, a)] {
+ m.tri(x, y, up);
+ m.tri(y, x, dn);
+ }
+ }
+ }
+ m
+}
diff --git a/core/grow/src/tube.rs b/core/grow/src/tube.rs
new file mode 100644
index 00000000..ae2a54e0
--- /dev/null
+++ b/core/grow/src/tube.rs
@@ -0,0 +1,55 @@
+//! A swept tube along a path of points, each with its radius: rings carried along by parallel transport (no twist
+//! flips at bends), capped at both ends, so each tube is one closed piece. A branch, a root, a cable, a stem.
+
+use crate::mesh::{Mesh, add, cross, dot, mul, norm, sub};
+
+/// One closed tube: `sides` around (6 or more), the path's points and radii.
+pub fn tube(path: &[([f64; 3], f64)], sides: usize) -> Mesh {
+ let mut m = Mesh::default();
+ if path.len() < 2 {
+ return m;
+ }
+ let sides = sides.max(3);
+ // tangents: the mean of the segments meeting at each point
+ let tan: Vec<[f64; 3]> = (0..path.len()).map(|i| {
+ let a = path[i.saturating_sub(1)].0;
+ let b = path[(i + 1).min(path.len() - 1)].0;
+ norm(sub(b, a))
+ }).collect();
+ // a first normal across the first tangent, then carried along
+ let t0 = tan[0];
+ let helper = if t0[1].abs() < 0.9 { [0.0, 1.0, 0.0] } else { [1.0, 0.0, 0.0] };
+ let mut n = norm(cross(t0, helper));
+ let mut rings: Vec<Vec<u32>> = Vec::with_capacity(path.len());
+ for i in 0..path.len() {
+ if i > 0 {
+ // parallel transport: take out the part of n along the new tangent
+ let t = tan[i];
+ n = norm(sub(n, mul(t, dot(n, t))));
+ }
+ let b = cross(tan[i], n);
+ let (c, r) = path[i];
+ let ring: Vec<u32> = (0..sides).map(|s| {
+ let a = s as f64 / sides as f64 * std::f64::consts::TAU;
+ m.vert(add(c, add(mul(n, r * a.cos()), mul(b, r * a.sin()))))
+ }).collect();
+ rings.push(ring);
+ }
+ for w in rings.windows(2) {
+ for s in 0..sides {
+ let (a, b) = (w[0][s], w[0][(s + 1) % sides]);
+ let (c, d) = (w[1][s], w[1][(s + 1) % sides]);
+ m.tri(a, b, d);
+ m.tri(a, d, c);
+ }
+ }
+ // caps: a fan to each end's centre
+ let start = m.vert(path[0].0);
+ let end = m.vert(path[path.len() - 1].0);
+ let (first, last) = (&rings[0], &rings[rings.len() - 1]);
+ for s in 0..sides {
+ m.tri(start, first[(s + 1) % sides], first[s]);
+ m.tri(end, last[s], last[(s + 1) % sides]);
+ }
+ m
+}
diff --git a/core/meshcheck/Cargo.toml b/core/meshcheck/Cargo.toml
new file mode 100644
index 00000000..bbda966b
--- /dev/null
+++ b/core/meshcheck/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "raea-core-meshcheck"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "A model file measured before a scene uses it (size, pivot, facing, triangles, holes, loose pieces, textures) and a fixed copy written: scaled to its real height, its origin at the bottom centre"
+
+[dependencies]
+serde_json = "1"
diff --git a/core/meshcheck/src/blender.rs b/core/meshcheck/src/blender.rs
new file mode 100644
index 00000000..561b07e5
--- /dev/null
+++ b/core/meshcheck/src/blender.rs
@@ -0,0 +1,57 @@
+//! The Blender step a finding calls for (docs/blender.feature BL10-BL16): each finding a script fixes carries it as
+//! text ("fix: raea blender run blender/X.py ...") and in its JSON (`fix.blender`, `fix.run`). The scripts are the
+//! library in sdk/guides/craft/bevy/blender/, which `raea blender run blender/X.py` copies into the project the first
+//! time. Blender is the workshop between an asset's source and media/: these are the only reasons to go there.
+
+use serde_json::{Value, json};
+
+/// A finding's fix through a library script: `args` as the command line takes them.
+pub fn fix(script: &str, args: &str) -> Value {
+ json!({"blender": script, "run": format!("raea blender run blender/{script} {args}")})
+}
+
+/// The finding's words with its fix's command after them.
+pub fn says(words: &str, fix: &Value) -> String {
+ format!("{words}; fix: {}", fix["run"].as_str().unwrap_or(""))
+}
+
+/// The most triangles a model seen from `seen` metres should carry: 150 000 at 1 m or closer (a hero in the hand),
+/// falling with the square of the distance (the screen area it covers), never under 2 000.
+pub fn budget(seen: f64) -> usize {
+ ((150_000.0 / seen.max(1.0).powi(2)) as usize).max(2_000)
+}
+
+/// `dir/name.glb` with `-tag` before its extension, for a fix's output beside its input.
+pub fn beside(file: &str, tag: &str) -> String {
+ let stem = file.rsplit_once('.').map(|(s, _)| s).unwrap_or(file);
+ format!("{stem}-{tag}.glb")
+}
+
+/// The finding for a file raea can't load (FBX, OBJ, .blend, STL, PLY), or None for a glTF.
+pub fn unloadable(file: &str) -> Option<Value> {
+ let ext = file.rsplit_once('.').map(|(_, e)| e.to_ascii_lowercase()).unwrap_or_default();
+ if matches!(ext.as_str(), "glb" | "gltf") {
+ return None;
+ }
+ let stem = file.rsplit_once('.').map(|(s, _)| s).unwrap_or(file);
+ let f = fix("convert.py", &format!("{file} {stem}.glb"));
+ Some(json!({"check": "format", "level": "error", "says": says(&format!("raea loads glTF (.glb); this is .{ext}"), &f), "fix": f}))
+}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn the_budget_falls_with_distance_and_bottoms_out() {
+ assert_eq!(super::budget(0.5), 150_000);
+ assert_eq!(super::budget(2.0), 37_500);
+ assert_eq!(super::budget(40.0), 2_000);
+ }
+
+ #[test]
+ fn a_format_raea_cant_load_names_convert() {
+ let f = super::unloadable("media/src/chair.fbx").unwrap();
+ assert_eq!(f["fix"]["blender"], "convert.py");
+ assert_eq!(f["fix"]["run"], "raea blender run blender/convert.py media/src/chair.fbx media/src/chair.glb");
+ assert!(super::unloadable("media/chair.glb").is_none());
+ }
+}
diff --git a/core/meshcheck/src/glb.rs b/core/meshcheck/src/glb.rs
new file mode 100644
index 00000000..7e9bd4a9
--- /dev/null
+++ b/core/meshcheck/src/glb.rs
@@ -0,0 +1,222 @@
+//! A glTF binary read for measuring: every triangle of every mesh the default scene draws, in world space (node
+//! transforms applied down the tree), and the file's JSON kept so a fixed copy can be written without touching its
+//! buffers, materials or textures.
+
+use serde_json::Value;
+
+pub struct Glb {
+ pub json: Value,
+ /// the whole file, for rewriting with a new JSON chunk
+ pub bytes: Vec<u8>,
+ /// where the BIN chunk's data starts and ends in `bytes`
+ bin: (usize, usize),
+}
+
+/// World-space triangles: positions flat (x y z) and indices by threes, as one welded-free list per primitive.
+pub struct World {
+ pub verts: Vec<[f64; 3]>,
+ pub tris: Vec<[u32; 3]>,
+ /// primitives drawn as something other than triangles, skipped
+ pub skipped: usize,
+}
+
+type M4 = [f64; 16];
+const IDENTITY: M4 = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0];
+
+fn mul(a: &M4, b: &M4) -> M4 {
+ let mut o = [0.0; 16];
+ for c in 0..4 {
+ for r in 0..4 {
+ o[c * 4 + r] = (0..4).map(|k| a[k * 4 + r] * b[c * 4 + k]).sum();
+ }
+ }
+ o
+}
+
+fn apply(m: &M4, p: [f64; 3]) -> [f64; 3] {
+ [m[0] * p[0] + m[4] * p[1] + m[8] * p[2] + m[12], m[1] * p[0] + m[5] * p[1] + m[9] * p[2] + m[13], m[2] * p[0] + m[6] * p[1] + m[10] * p[2] + m[14]]
+}
+
+/// A node's local matrix: its `matrix` (column-major), else translation, rotation (x y z w) and scale.
+fn local(n: &Value) -> M4 {
+ if let Some(m) = n["matrix"].as_array().filter(|m| m.len() == 16) {
+ let mut o = [0.0; 16];
+ for (i, v) in m.iter().enumerate() {
+ o[i] = v.as_f64().unwrap_or(0.0);
+ }
+ return o;
+ }
+ let g = |k: &str, d: &[f64]| -> Vec<f64> { serde_json::from_value(n[k].clone()).unwrap_or_else(|_| d.to_vec()) };
+ let t = g("translation", &[0.0, 0.0, 0.0]);
+ let q = g("rotation", &[0.0, 0.0, 0.0, 1.0]);
+ let s = g("scale", &[1.0, 1.0, 1.0]);
+ let (x, y, z, w) = (q[0], q[1], q[2], q[3]);
+ let r = [
+ 1.0 - 2.0 * (y * y + z * z), 2.0 * (x * y + z * w), 2.0 * (x * z - y * w), 0.0,
+ 2.0 * (x * y - z * w), 1.0 - 2.0 * (x * x + z * z), 2.0 * (y * z + x * w), 0.0,
+ 2.0 * (x * z + y * w), 2.0 * (y * z - x * w), 1.0 - 2.0 * (x * x + y * y), 0.0,
+ 0.0, 0.0, 0.0, 1.0,
+ ];
+ let mut o = r;
+ for c in 0..3 {
+ for k in 0..3 {
+ o[c * 4 + k] *= s[c];
+ }
+ }
+ o[12] = t[0];
+ o[13] = t[1];
+ o[14] = t[2];
+ o
+}
+
+impl Glb {
+ pub fn read(path: &str) -> Result<Glb, String> {
+ let b = std::fs::read(path).map_err(|e| format!("{path}: {e}"))?;
+ Glb::parse(b).map_err(|e| format!("{path}: {e}"))
+ }
+
+ pub fn parse(b: Vec<u8>) -> Result<Glb, String> {
+ if b.len() < 20 || &b[0..4] != b"glTF" {
+ return Err("not a GLB (a .gltf with loose files: export it as .glb first)".into());
+ }
+ let u = |o: usize| u32::from_le_bytes([b[o], b[o + 1], b[o + 2], b[o + 3]]) as usize;
+ let jl = u(12);
+ let json: Value = serde_json::from_slice(b.get(20..20 + jl).ok_or("a cut-off JSON chunk")?).map_err(|e| e.to_string())?;
+ let at = 20 + jl;
+ let bin = if b.len() >= at + 8 { (at + 8, (at + 8 + u(at)).min(b.len())) } else { (at, at) };
+ Ok(Glb { json, bytes: b, bin })
+ }
+
+ fn bin(&self) -> &[u8] {
+ &self.bytes[self.bin.0..self.bin.1]
+ }
+
+ /// An accessor's elements as f64s (`n` components each), reading floats and (normalized or not) integers.
+ fn accessor(&self, i: usize) -> Result<(Vec<f64>, usize), String> {
+ let a = &self.json["accessors"][i];
+ let n = match a["type"].as_str().unwrap_or("") { "SCALAR" => 1, "VEC2" => 2, "VEC3" => 3, "VEC4" => 4, t => return Err(format!("accessor {i}: type {t}")) };
+ let count = a["count"].as_u64().unwrap_or(0) as usize;
+ let Some(view) = a["bufferView"].as_u64() else { return Ok((vec![0.0; count * n], n)) };
+ let view = &self.json["bufferViews"][view as usize];
+ if view["buffer"].as_u64().unwrap_or(0) != 0 {
+ return Err("a buffer outside the file".into());
+ }
+ let ct = a["componentType"].as_u64().unwrap_or(5126);
+ let size = match ct { 5120 | 5121 => 1, 5122 | 5123 => 2, _ => 4 };
+ let off = view["byteOffset"].as_u64().unwrap_or(0) as usize + a["byteOffset"].as_u64().unwrap_or(0) as usize;
+ let stride = match view["byteStride"].as_u64().unwrap_or(0) as usize { 0 => size * n, s => s };
+ let norm = a["normalized"].as_bool().unwrap_or(false);
+ let bin = self.bin();
+ let mut out = Vec::with_capacity(count * n);
+ for k in 0..count {
+ for c in 0..n {
+ let o = off + k * stride + c * size;
+ let x = bin.get(o..o + size).ok_or_else(|| format!("accessor {i} runs past the buffer"))?;
+ let v = match ct {
+ 5126 => f32::from_le_bytes([x[0], x[1], x[2], x[3]]) as f64,
+ 5125 => u32::from_le_bytes([x[0], x[1], x[2], x[3]]) as f64,
+ 5123 => { let v = u16::from_le_bytes([x[0], x[1]]) as f64; if norm { v / 65535.0 } else { v } }
+ 5122 => { let v = i16::from_le_bytes([x[0], x[1]]) as f64; if norm { (v / 32767.0).max(-1.0) } else { v } }
+ 5121 => { let v = x[0] as f64; if norm { v / 255.0 } else { v } }
+ _ => { let v = x[0] as i8 as f64; if norm { (v / 127.0).max(-1.0) } else { v } }
+ };
+ out.push(v);
+ }
+ }
+ Ok((out, n))
+ }
+
+ /// Every triangle the default scene draws, in world space.
+ pub fn world(&self) -> Result<World, String> {
+ let mut w = World { verts: Vec::new(), tris: Vec::new(), skipped: 0 };
+ let scene = self.json["scene"].as_u64().unwrap_or(0) as usize;
+ let roots: Vec<usize> = self.json["scenes"][scene]["nodes"].as_array().map(|a| a.iter().filter_map(|v| v.as_u64().map(|v| v as usize)).collect()).unwrap_or_default();
+ let mut stack: Vec<(usize, M4, usize)> = roots.into_iter().map(|r| (r, IDENTITY, 0)).collect();
+ while let Some((i, parent, depth)) = stack.pop() {
+ if depth > 64 {
+ return Err("the node tree is deeper than 64 (a cycle?)".into());
+ }
+ let node = &self.json["nodes"][i];
+ let m = mul(&parent, &local(node));
+ if let Some(mesh) = node["mesh"].as_u64() {
+ for prim in self.json["meshes"][mesh as usize]["primitives"].as_array().into_iter().flatten() {
+ if prim["mode"].as_u64().unwrap_or(4) != 4 {
+ w.skipped += 1;
+ continue;
+ }
+ let Some(pos) = prim["attributes"]["POSITION"].as_u64() else { continue };
+ let (p, _) = self.accessor(pos as usize)?;
+ let base = w.verts.len() as u32;
+ w.verts.extend(p.chunks_exact(3).map(|c| apply(&m, [c[0], c[1], c[2]])));
+ let count = (p.len() / 3) as u32;
+ let idx: Vec<u32> = match prim["indices"].as_u64() {
+ Some(ix) => self.accessor(ix as usize)?.0.into_iter().map(|v| v as u32).collect(),
+ None => (0..count).collect(),
+ };
+ for t in idx.chunks_exact(3) {
+ if t.iter().all(|&k| k < count) {
+ w.tris.push([base + t[0], base + t[1], base + t[2]]);
+ }
+ }
+ }
+ }
+ for c in node["children"].as_array().into_iter().flatten().filter_map(|c| c.as_u64()) {
+ stack.push((c as usize, m, depth + 1));
+ }
+ }
+ Ok(w)
+ }
+
+ /// The pixel size of each image the file holds (PNG or JPEG headers), and the ones it only names.
+ pub fn images(&self) -> Vec<Option<(u32, u32)>> {
+ let bin = self.bin();
+ self.json["images"].as_array().into_iter().flatten().map(|img| {
+ let view = img["bufferView"].as_u64()?;
+ let v = &self.json["bufferViews"][view as usize];
+ let off = v["byteOffset"].as_u64().unwrap_or(0) as usize;
+ let len = v["byteLength"].as_u64().unwrap_or(0) as usize;
+ image_size(bin.get(off..off + len)?)
+ }).collect()
+ }
+
+ /// The file again with `json` as its JSON chunk; the binary chunk is copied byte for byte.
+ pub fn with_json(&self, json: &Value) -> Result<Vec<u8>, String> {
+ let mut js = serde_json::to_vec(json).map_err(|e| e.to_string())?;
+ while js.len() % 4 != 0 {
+ js.push(b' ');
+ }
+ let rest = &self.bytes[(20 + u32::from_le_bytes([self.bytes[12], self.bytes[13], self.bytes[14], self.bytes[15]]) as usize).min(self.bytes.len())..];
+ let total = 20 + js.len() + rest.len();
+ let mut out = Vec::with_capacity(total);
+ out.extend_from_slice(b"glTF");
+ out.extend_from_slice(&2u32.to_le_bytes());
+ out.extend_from_slice(&(total as u32).to_le_bytes());
+ out.extend_from_slice(&(js.len() as u32).to_le_bytes());
+ out.extend_from_slice(b"JSON");
+ out.extend_from_slice(&js);
+ out.extend_from_slice(rest);
+ Ok(out)
+ }
+}
+
+/// A PNG's or a JPEG's width and height, from its header.
+fn image_size(b: &[u8]) -> Option<(u32, u32)> {
+ if b.len() > 24 && &b[1..4] == b"PNG" {
+ return Some((u32::from_be_bytes([b[16], b[17], b[18], b[19]]), u32::from_be_bytes([b[20], b[21], b[22], b[23]])));
+ }
+ if b.len() > 4 && b[0] == 0xff && b[1] == 0xd8 {
+ let mut i = 2;
+ while i + 9 < b.len() {
+ if b[i] != 0xff {
+ return None;
+ }
+ let marker = b[i + 1];
+ let len = u16::from_be_bytes([b[i + 2], b[i + 3]]) as usize;
+ if matches!(marker, 0xc0..=0xc3 | 0xc5..=0xc7 | 0xc9..=0xcb | 0xcd..=0xcf) {
+ return Some((u16::from_be_bytes([b[i + 7], b[i + 8]]) as u32, u16::from_be_bytes([b[i + 5], b[i + 6]]) as u32));
+ }
+ i += 2 + len;
+ }
+ }
+ None
+}
diff --git a/core/meshcheck/src/lib.rs b/core/meshcheck/src/lib.rs
new file mode 100644
index 00000000..aa1b443e
--- /dev/null
+++ b/core/meshcheck/src/lib.rs
@@ -0,0 +1,242 @@
+//! A model measured before a scene uses it, and fixed on the way in (docs/handoff/solids.md; the 11-06 research on
+//! generated props). Generators and downloads hand over models at any scale, facing any way, with their origin
+//! anywhere, at a million triangles, with loose fragments and holes: every scene that took generated props had to fix
+//! the same things by hand. `check` measures them and says each in scene lint's shape (`found[]` of `{check, level,
+//! says, fix?}`, `errors` counted); `fix` writes a copy scaled to its real height with its origin at the bottom
+//! centre (a parent node added over the file's roots: buffers, materials and textures copied untouched).
+//!
+//! Frames: glTF's, y up, +z the model's front (where a camera in front of it stands).
+
+pub mod blender;
+mod glb;
+mod topo;
+
+pub use glb::Glb;
+use serde_json::{Value, json};
+
+/// What the person says the model should be.
+#[derive(Default, Clone, Debug)]
+pub struct Want {
+ /// its real height, metres (a chair 0.9, a mug 0.1)
+ pub h: Option<f64>,
+ /// its real width, depth, height (x, z, y), metres: boxy things, whose depth generators invent
+ pub dims: Option<[f64; 3]>,
+ /// the most triangles a scene should carry for it (150 000 by default: a hero seen close)
+ pub faces: Option<usize>,
+ /// degrees about y to turn it so its front faces +z (the generator's front was elsewhere)
+ pub turn: f64,
+ /// how far away it's seen, metres: the triangle budget when `faces` isn't given (blender::budget)
+ pub seen: Option<f64>,
+ /// the parts the brief says move on their own (a vise's jaw, a cabinet's door): a blob in fewer pieces is split
+ pub parts: Vec<String>,
+ /// the brief says it moves (bends, turns at joints): it needs a skeleton
+ pub rig: bool,
+ /// meant to be a closed solid (booleans, contact checks, 3D printing): open edges are a fault, not a note
+ pub solid: bool,
+ /// the file, for the fixes' command lines
+ pub file: Option<String>,
+}
+
+fn r(x: f64) -> f64 {
+ (x * 1e5).round() / 1e5
+}
+
+fn r3(p: [f64; 3]) -> Value {
+ json!([r(p[0]), r(p[1]), r(p[2])])
+}
+
+/// The box of points, after turning by `turn` degrees about y and scaling by `s`.
+fn bounds(verts: &[[f64; 3]], turn: f64, s: f64) -> ([f64; 3], [f64; 3]) {
+ let (c, si) = (turn.to_radians().cos(), turn.to_radians().sin());
+ let mut lo = [f64::MAX; 3];
+ let mut hi = [f64::MIN; 3];
+ for p in verts {
+ let q = [s * (c * p[0] + si * p[2]), s * p[1], s * (-si * p[0] + c * p[2])];
+ for k in 0..3 {
+ lo[k] = lo[k].min(q[k]);
+ hi[k] = hi[k].max(q[k]);
+ }
+ }
+ (lo, hi)
+}
+
+/// `--parts jaw,body`: the parts a brief says move on their own, by name.
+pub fn parts(list: &str) -> Vec<String> {
+ list.split(',').map(str::trim).filter(|x| !x.is_empty()).map(String::from).collect()
+}
+
+/// The finding list, the measurements and the fix that `fix` would make, for a model.
+pub fn check(g: &Glb, bytes: usize, want: &Want) -> Result<Value, String> {
+ let mut found: Vec<Value> = Vec::new();
+ let file = want.file.as_deref().unwrap_or("MODEL.glb");
+ fn push(found: &mut Vec<Value>, check: &str, level: &str, says: String, extra: Value) {
+ let mut v = json!({"check": check, "level": level, "says": says});
+ if let (Some(o), Value::Object(e)) = (v.as_object_mut(), extra) {
+ o.extend(e);
+ }
+ found.push(v);
+ }
+ macro_rules! say {
+ ($($a:expr),*) => { push(&mut found, $($a),*) };
+ }
+ let required: Vec<String> = g.json["extensionsRequired"].as_array().into_iter().flatten().filter_map(|e| e.as_str().map(str::to_string)).collect();
+ if let Some(e) = required.iter().find(|e| e.contains("draco") || e.contains("meshopt") || e.contains("quantization")) {
+ let f = blender::fix("convert.py", &format!("{file} {}", blender::beside(file, "plain")));
+ say!("compressed", "error", blender::says(&format!("the file's meshes are compressed ({e}): unpack it first"), &f), json!({"fix": f}));
+ return Ok(report(found, json!({"bytes": bytes}), json!(null)));
+ }
+ let w = g.world()?;
+ if w.tris.is_empty() {
+ say!("empty", "error", "no triangles: the default scene draws no mesh".into(), json!({}));
+ return Ok(report(found, json!({"bytes": bytes}), json!(null)));
+ }
+ let (lo, hi) = bounds(&w.verts, 0.0, 1.0);
+ let size = [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]];
+ let centre = [(lo[0] + hi[0]) / 2.0, (lo[1] + hi[1]) / 2.0, (lo[2] + hi[2]) / 2.0];
+ let topo = topo::measure(&w.verts, &w.tris, size.iter().cloned().fold(0.0, f64::max));
+
+ // size: against the real height, else a sanity range (a model authored in centimetres is 100 times too big)
+ let s = match want.h {
+ Some(h) if size[1] > 1e-9 => {
+ let s = h / size[1];
+ if (s - 1.0).abs() > 0.01 {
+ say!("size", "warning", format!("{:.3} m tall, wants {h} m: scale {:.4}", size[1], s), json!({"fix": {"scale": r(s)}}));
+ } else {
+ say!("size", "ok", format!("{:.3} m tall, as wanted", size[1]), json!({}));
+ }
+ s
+ }
+ _ => {
+ let big = size.iter().cloned().fold(0.0, f64::max);
+ if !(0.01..=50.0).contains(&big) {
+ say!("size", "warning", format!("{:.3} x {:.3} x {:.3}: {} for most props; pass --h with its real height", size[0], size[1], size[2], if big > 50.0 { "too big (authored in cm or mm?)" } else { "tiny" }), json!({}));
+ } else {
+ say!("size", "note", format!("{:.3} x {:.3} x {:.3} (w x h x d); its real height isn't given (--h), so it's kept", size[0], size[1], size[2]), json!({}));
+ }
+ 1.0
+ }
+ };
+ let (flo, fhi) = bounds(&w.verts, want.turn, s);
+ let fsize = [fhi[0] - flo[0], fhi[1] - flo[1], fhi[2] - flo[2]];
+ // dims: generators invent the depth of boxy things
+ if let Some([dw, dd, dh]) = want.dims {
+ for (axis, got, wanted) in [("width (x)", fsize[0], dw), ("depth (z)", fsize[2], dd), ("height (y)", fsize[1], dh)] {
+ if wanted > 0.0 && (got / wanted - 1.0).abs() > 0.15 {
+ say!("dims", "warning", format!("its {axis} is {got:.3} m where the real one is {wanted} m ({:+.0}%): if it's the front-to-back depth, the generator invented it; turn it (--turn) if the axes are swapped, else rebuild it in code", (got / wanted - 1.0) * 100.0), json!({}));
+ }
+ }
+ }
+ // the pivot: raea stands a model at its origin, so the origin belongs at the bottom centre
+ let off = [centre[0], lo[1], centre[2]];
+ let span = size[0].max(size[2]).max(size[1]).max(1e-9);
+ if off[1].abs() > 0.01 * size[1].max(1e-9) || (off[0].hypot(off[2])) > 0.05 * span {
+ say!("pivot", "warning", format!("its origin is {:.3} m from its bottom centre (bottom at y {:.3}, footprint centred at x {:.3}, z {:.3}): placed at y 0 it floats, sinks or sits off its spot", (off[0] * off[0] + off[1] * off[1] + off[2] * off[2]).sqrt(), lo[1], centre[0], centre[2]), json!({"fix": {"origin": "bottom centre"}}));
+ } else {
+ say!("pivot", "ok", "its origin is at its bottom centre".into(), json!({}));
+ }
+ if want.turn != 0.0 {
+ say!("facing", "note", format!("turned {}° about y so its front faces +z", want.turn), json!({"fix": {"turn": want.turn}}));
+ } else {
+ say!("facing", "note", "facing isn't measured: render it from the front (+z) and pass --turn 90|-90|180 if the front faces elsewhere (Tripo's default front is +x; raea asks for align_image)".into(), json!({}));
+ }
+ // weight
+ let faces = want.faces.unwrap_or_else(|| want.seen.map_or(150_000, blender::budget));
+ let n = w.tris.len();
+ if n > faces {
+ let seen = want.seen.map(|d| format!(" seen from {d} m")).unwrap_or_default();
+ let f = blender::fix("decimate.py", &format!("{file} {} {faces}", blender::beside(file, &format!("{}k", faces / 1000))));
+ say!("triangles", "warning", blender::says(&format!("{n} triangles, over the {faces} a scene should carry for it{seen} (or regenerate with a lower face_limit)"), &f), json!({"fix": f}));
+ } else {
+ say!("triangles", "ok", format!("{n} triangles"), json!({}));
+ }
+ if bytes > 20 << 20 {
+ say!("file", "warning", format!("{:.1} MB, over the 20 MB a model should be (bevy/limits): shrink its textures or its mesh", bytes as f64 / 1048576.0), json!({}));
+ }
+ let imgs = g.images();
+ if let Some((tw, th)) = imgs.iter().flatten().max_by_key(|(a, b)| a * b) {
+ if *tw > 4096 || *th > 4096 {
+ say!("textures", "warning", format!("a {tw}x{th} texture: 2048 is plenty for a prop, 4096 for a hero seen close"), json!({}));
+ }
+ }
+ // shape health: the welded surface's open and over-shared edges, and loose bits
+ if topo.pieces > 1 {
+ let loose: Vec<Value> = topo.loose.iter().map(|(c, t)| json!({"center": r3(*c), "triangles": t})).collect();
+ let level = if topo.loose.is_empty() { "note" } else { "warning" };
+ let says = if topo.loose.is_empty() {
+ format!("{} separate pieces (parts modelled apart: fine for a prop drawn as it is)", topo.pieces)
+ } else {
+ format!("{} separate pieces, {} of them loose bits under 0.5% of its triangles (generator debris: floating specks near the model)", topo.pieces, topo.loose.len())
+ };
+ if topo.loose.is_empty() {
+ say!("pieces", level, says, json!({"loose": loose}));
+ } else {
+ let f = blender::fix("repair.py", &format!("{file} {}", blender::beside(file, "clean")));
+ say!("pieces", level, blender::says(&says, &f), json!({"loose": loose, "fix": f}));
+ }
+ }
+ if !want.parts.is_empty() && topo.pieces < want.parts.len() {
+ let boxes: Vec<String> = want.parts.iter().map(|p| format!("{p}=X0,Y0,Z0,X1,Y1,Z1")).collect();
+ let f = blender::fix("split.py", &format!("{file} {} {} --each", blender::beside(file, "parts"), boxes.join(" ")));
+ say!("parts", "warning", blender::says(&format!("{} piece(s) where the brief has {} parts that move on their own ({}): give each part's box from this report's box", topo.pieces, want.parts.len(), want.parts.join(", ")), &f), json!({"fix": f}));
+ }
+ if topo.open_edges > 0 || topo.shared_edges > 0 {
+ let words = format!("{} open edges and {} edges shared by 3+ faces: it draws fine, but it isn't a closed solid (`manifold.import` and contact checks treat it as triangles)", topo.open_edges, topo.shared_edges);
+ if want.solid {
+ let f = blender::fix("repair.py", &format!("{file} {}", blender::beside(file, "closed")));
+ say!("surface", "warning", blender::says(&words, &f), json!({"fix": f}));
+ } else {
+ say!("surface", "note", words, json!({}));
+ }
+ }
+ let skins = g.json["skins"].as_array().map_or(0, Vec::len);
+ if want.rig && skins == 0 {
+ let f = blender::fix("rig.py", &format!("{file} {} --bone NAME=HX,HY,HZ:TX,TY,TZ[:PARENT] ... --pose CLIP=BONE:RX,RY,RZ", blender::beside(file, "rigged")));
+ say!("skeleton", "warning", blender::says("the brief says it moves and it has no skeleton: give it bones from this report's box, joint by joint", &f), json!({"fix": f}));
+ } else if want.rig {
+ say!("skeleton", "ok", format!("{skins} skin(s), clips: {}", g.json["animations"].as_array().map_or(0, Vec::len)), json!({}));
+ }
+ if topo.degenerate > 0 {
+ say!("degenerate", "note", format!("{} triangles with no area", topo.degenerate), json!({}));
+ }
+ if w.skipped > 0 {
+ say!("skipped", "note", format!("{} primitives drawn as lines or points, not measured", w.skipped), json!({}));
+ }
+ let measured = json!({
+ "triangles": n, "vertices": w.verts.len(), "bytes": bytes,
+ "size": r3(size), "box": {"min": r3(lo), "max": r3(hi)}, "center": r3(centre), "bottom": r(lo[1]),
+ "pieces": topo.pieces, "openEdges": topo.open_edges, "sharedEdges": topo.shared_edges,
+ "textures": imgs.iter().map(|i| i.map(|(a, b)| json!([a, b])).unwrap_or(json!(null))).collect::<Vec<_>>(),
+ "materials": g.json["materials"].as_array().map(|m| m.len()).unwrap_or(0),
+ });
+ let t = [-(flo[0] + fhi[0]) / 2.0, -flo[1], -(flo[2] + fhi[2]) / 2.0];
+ let fix = json!({"scale": r(s), "turn": want.turn, "translate": r3(t), "size": r3(fsize)});
+ Ok(report(found, measured, fix))
+}
+
+fn report(found: Vec<Value>, measured: Value, fix: Value) -> Value {
+ let errors = found.iter().filter(|f| f["level"] == "error").count();
+ let warnings = found.iter().filter(|f| f["level"] == "warning").count();
+ json!({"errors": errors, "warnings": warnings, "measured": measured, "fixed": fix, "found": found})
+}
+
+/// The file with a parent node over its scene's roots that scales it by `scale`, turns it `turn` degrees about y and
+/// moves it by `translate` (applied in that order): its JSON rewritten, its buffers untouched.
+pub fn fix(g: &Glb, scale: f64, turn: f64, translate: [f64; 3]) -> Result<Vec<u8>, String> {
+ let mut j = g.json.clone();
+ let scene = j["scene"].as_u64().unwrap_or(0) as usize;
+ let roots = j["scenes"][scene]["nodes"].clone();
+ let nodes = j["nodes"].as_array_mut().ok_or("no nodes")?;
+ let half = turn.to_radians() / 2.0;
+ nodes.push(json!({
+ "name": "raea-fixed",
+ "translation": translate, "rotation": [0.0, half.sin(), 0.0, half.cos()], "scale": [scale, scale, scale],
+ "children": roots,
+ }));
+ let top = nodes.len() - 1;
+ j["scenes"][scene]["nodes"] = json!([top]);
+ j["asset"]["generator"] = json!(format!("{} + raea gen check", j["asset"]["generator"].as_str().unwrap_or("unknown")));
+ g.with_json(&j)
+}
+
+#[cfg(test)]
+mod tests;
diff --git a/core/meshcheck/src/tests.rs b/core/meshcheck/src/tests.rs
new file mode 100644
index 00000000..7a3bb8ac
--- /dev/null
+++ b/core/meshcheck/src/tests.rs
@@ -0,0 +1,134 @@
+use serde_json::json;
+
+use super::*;
+
+/// A GLB of boxes (min, max) under one node moved by `at` and scaled by `s`, with a speck if asked.
+fn glb(boxes: &[([f64; 3], [f64; 3])], at: [f64; 3], s: f64) -> Vec<u8> {
+ let (mut v, mut t): (Vec<f32>, Vec<u32>) = (Vec::new(), Vec::new());
+ for (lo, hi) in boxes {
+ let base = (v.len() / 3) as u32;
+ for i in 0..8 {
+ let p = [if i & 1 == 0 { lo[0] } else { hi[0] }, if i & 2 == 0 { lo[1] } else { hi[1] }, if i & 4 == 0 { lo[2] } else { hi[2] }];
+ v.extend(p.iter().map(|x| *x as f32));
+ }
+ for f in [[0, 2, 3, 1], [4, 5, 7, 6], [0, 1, 5, 4], [2, 6, 7, 3], [0, 4, 6, 2], [1, 3, 7, 5]] {
+ t.extend([f[0], f[1], f[2], f[0], f[2], f[3]].map(|k| base + k));
+ }
+ }
+ let mut bin: Vec<u8> = v.iter().flat_map(|x| x.to_le_bytes()).collect();
+ let il = bin.len();
+ bin.extend(t.iter().flat_map(|x| x.to_le_bytes()));
+ let j = json!({
+ "asset": {"version": "2.0", "generator": "test"}, "scene": 0, "scenes": [{"nodes": [0]}],
+ "nodes": [{"mesh": 0, "translation": at, "scale": [s, s, s]}],
+ "meshes": [{"primitives": [{"attributes": {"POSITION": 0}, "indices": 1}]}],
+ "buffers": [{"byteLength": bin.len()}],
+ "bufferViews": [{"buffer": 0, "byteOffset": 0, "byteLength": il}, {"buffer": 0, "byteOffset": il, "byteLength": bin.len() - il}],
+ "accessors": [{"bufferView": 0, "componentType": 5126, "count": v.len() / 3, "type": "VEC3"}, {"bufferView": 1, "componentType": 5125, "count": t.len(), "type": "SCALAR"}],
+ });
+ let mut js = serde_json::to_vec(&j).unwrap();
+ while js.len() % 4 != 0 {
+ js.push(b' ');
+ }
+ let total = 20 + js.len() + 8 + bin.len();
+ let mut out = Vec::new();
+ out.extend_from_slice(b"glTF");
+ out.extend_from_slice(&2u32.to_le_bytes());
+ out.extend_from_slice(&(total as u32).to_le_bytes());
+ out.extend_from_slice(&(js.len() as u32).to_le_bytes());
+ out.extend_from_slice(b"JSON");
+ out.extend_from_slice(&js);
+ out.extend_from_slice(&(bin.len() as u32).to_le_bytes());
+ out.extend_from_slice(b"BIN\0");
+ out.extend_from_slice(&bin);
+ out
+}
+
+fn level(r: &Value, check: &str) -> String {
+ r["found"].as_array().unwrap().iter().find(|f| f["check"] == check).map(|f| f["level"].as_str().unwrap().to_string()).unwrap_or_default()
+}
+
+#[test]
+fn a_generated_prop_is_measured_and_fixed() {
+ // a 2 x 4 x 1 box authored 10x too big, its origin at its centre, moved off to the side
+ let g = Glb::parse(glb(&[([-1.0, -2.0, -0.5], [1.0, 2.0, 0.5])], [3.0, 1.0, 0.0], 1.0)).unwrap();
+ let r = check(&g, 1000, &Want { h: Some(0.4), ..Default::default() }).unwrap();
+ assert_eq!(r["measured"]["size"], json!([2.0, 4.0, 1.0]));
+ assert_eq!((level(&r, "size"), level(&r, "pivot")), ("warning".into(), "warning".into()));
+ assert!((r["fixed"]["scale"].as_f64().unwrap() - 0.1).abs() < 1e-9);
+ // the fixed copy: 0.4 tall, standing on y 0, centred on the origin
+ let t = r["fixed"]["translate"].as_array().unwrap().iter().map(|v| v.as_f64().unwrap()).collect::<Vec<_>>();
+ let out = Glb::parse(fix(&g, 0.1, 0.0, [t[0], t[1], t[2]]).unwrap()).unwrap();
+ let again = check(&out, 1000, &Want { h: Some(0.4), ..Default::default() }).unwrap();
+ assert_eq!((level(&again, "size"), level(&again, "pivot")), ("ok".into(), "ok".into()), "{again:#}");
+ let b = &again["measured"]["box"];
+ assert!((b["min"][1].as_f64().unwrap()).abs() < 1e-6 && (b["max"][1].as_f64().unwrap() - 0.4).abs() < 1e-6);
+ // the buffers are the same bytes: only the JSON changed
+ assert_eq!(out.world().unwrap().tris.len(), 12);
+}
+
+#[test]
+fn turning_swaps_width_and_depth_and_dims_catch_invented_depth() {
+ // 1 wide, 1 tall, 0.2 deep, wanted 0.2 wide and 1 deep: turned 90 it fits; unturned the dims check says so
+ let g = Glb::parse(glb(&[([-0.5, 0.0, -0.1], [0.5, 1.0, 0.1])], [0.0; 3], 1.0)).unwrap();
+ let want = Want { h: Some(1.0), dims: Some([0.2, 1.0, 1.0]), ..Default::default() };
+ assert_eq!(level(&check(&g, 10, &want).unwrap(), "dims"), "warning");
+ let turned = check(&g, 10, &Want { turn: 90.0, ..want }).unwrap();
+ assert_eq!(level(&turned, "dims"), "", "{turned:#}");
+ let s = &turned["fixed"]["size"];
+ assert!((s[0].as_f64().unwrap() - 0.2).abs() < 1e-6 && (s[2].as_f64().unwrap() - 1.0).abs() < 1e-6, "{s}");
+}
+
+#[test]
+fn loose_specks_and_weight_are_found() {
+ let mut boxes = vec![([-0.5, 0.0, -0.5], [0.5, 1.0, 0.5])];
+ // a big prop of 300 boxes and one speck floating above it
+ for i in 0..300 {
+ let x = (i % 20) as f64 * 0.05 - 0.5;
+ let z = (i / 20) as f64 * 0.05 - 0.5;
+ boxes.push(([x, 1.01, z], [x + 0.04, 1.05, z + 0.04]));
+ }
+ let g = Glb::parse(glb(&boxes, [0.0; 3], 1.0)).unwrap();
+ let r = check(&g, 10, &Want { faces: Some(1000), ..Default::default() }).unwrap();
+ assert_eq!(level(&r, "triangles"), "warning");
+ assert_eq!(r["measured"]["pieces"], 301);
+ // a closed box has no open edges
+ let one = check(&Glb::parse(glb(&boxes[..1], [0.0; 3], 1.0)).unwrap(), 10, &Want::default()).unwrap();
+ assert_eq!((one["measured"]["openEdges"].as_u64(), one["measured"]["pieces"].as_u64()), (Some(0), Some(1)));
+}
+
+fn fix_of(r: &Value, check: &str) -> Value {
+ r["found"].as_array().unwrap().iter().find(|f| f["check"] == check).map(|f| f["fix"].clone()).unwrap_or(Value::Null)
+}
+
+#[test]
+fn each_fault_names_its_blender_script() {
+ // a blob of 301 boxes seen from 30 m: over its budget (blender::budget(30) = 2 000 triangles: 3 612 here)
+ let mut boxes = vec![([-0.5, 0.0, -0.5], [0.5, 1.0, 0.5])];
+ for i in 0..300 {
+ let x = (i % 20) as f64 * 0.05 - 0.5;
+ boxes.push(([x, 1.01, 0.0], [x + 0.04, 1.05, 0.04]));
+ }
+ let g = Glb::parse(glb(&boxes, [0.0; 3], 1.0)).unwrap();
+ let want = Want { seen: Some(30.0), file: Some("media/crate.glb".into()), ..Default::default() };
+ let r = check(&g, 10, &want).unwrap();
+ assert_eq!(fix_of(&r, "triangles")["run"], "raea blender run blender/decimate.py media/crate.glb media/crate-2k.glb 2000");
+ assert!(r["found"].as_array().unwrap().iter().any(|f| f["says"].as_str().unwrap().contains("; fix: raea blender run blender/decimate.py")));
+ // one closed box: the brief's moving parts, a skeleton and a closed surface asked of it
+ let one = Glb::parse(glb(&boxes[..1], [0.0; 3], 1.0)).unwrap();
+ let want = Want { parts: vec!["door".into(), "body".into()], rig: true, file: Some("m.glb".into()), ..Default::default() };
+ let r = check(&one, 10, &want).unwrap();
+ assert_eq!(fix_of(&r, "parts")["blender"], "split.py");
+ assert!(fix_of(&r, "parts")["run"].as_str().unwrap().contains("door=X0,Y0,Z0,X1,Y1,Z1 body=X0,Y0,Z0,X1,Y1,Z1 --each"));
+ assert_eq!(fix_of(&r, "skeleton")["blender"], "rig.py");
+ assert_eq!(level(&r, "surface"), "", "a closed box has no surface finding");
+ // an open box meant to be solid names repair.py; not meant to be solid, it's a note
+ // the box with its last face's two triangles cut off
+ let g = Glb::parse(glb(&boxes[..1], [0.0; 3], 1.0)).unwrap();
+ let mut j = g.json.clone();
+ j["accessors"][1]["count"] = json!(30);
+ let holed = Glb::parse(g.with_json(&j).unwrap()).unwrap();
+ let r = check(&holed, 10, &Want { solid: true, ..Default::default() }).unwrap();
+ assert_eq!(fix_of(&r, "surface")["blender"], "repair.py");
+ assert_eq!(level(&check(&holed, 10, &Want::default()).unwrap(), "surface"), "note");
+}
diff --git a/core/meshcheck/src/topo.rs b/core/meshcheck/src/topo.rs
new file mode 100644
index 00000000..08cc9b34
--- /dev/null
+++ b/core/meshcheck/src/topo.rs
@@ -0,0 +1,71 @@
+//! The surface's health from its triangles welded by position: open edges (one face), edges three or more faces
+//! share, triangles with no area, and the separate pieces, with the small loose ones named by where they are.
+
+use std::collections::HashMap;
+
+pub struct Topo {
+ pub pieces: usize,
+ /// pieces under 0.5% of the triangles: their centre and triangle count
+ pub loose: Vec<([f64; 3], usize)>,
+ pub open_edges: usize,
+ pub shared_edges: usize,
+ pub degenerate: usize,
+}
+
+fn find(p: &mut [u32], mut i: u32) -> u32 {
+ while p[i as usize] != i {
+ p[i as usize] = p[p[i as usize] as usize];
+ i = p[i as usize];
+ }
+ i
+}
+
+pub fn measure(verts: &[[f64; 3]], tris: &[[u32; 3]], span: f64) -> Topo {
+ // weld: positions within a millionth of the model's size are one vertex (UV seams split vertices that touch)
+ let q = (span.max(1e-9) * 1e-6).max(1e-9);
+ let key = |p: &[f64; 3]| ((p[0] / q).round() as i64, (p[1] / q).round() as i64, (p[2] / q).round() as i64);
+ let mut ids: HashMap<(i64, i64, i64), u32> = HashMap::with_capacity(verts.len());
+ let weld: Vec<u32> = verts.iter().map(|p| { let n = ids.len() as u32; *ids.entry(key(p)).or_insert(n) }).collect();
+ let mut parent: Vec<u32> = (0..ids.len() as u32).collect();
+ let mut edges: HashMap<(u32, u32), u32> = HashMap::with_capacity(tris.len() * 2);
+ let mut degenerate = 0;
+ for t in tris {
+ let w = [weld[t[0] as usize], weld[t[1] as usize], weld[t[2] as usize]];
+ if w[0] == w[1] || w[1] == w[2] || w[0] == w[2] {
+ degenerate += 1;
+ continue;
+ }
+ let (a, b, c) = (verts[t[0] as usize], verts[t[1] as usize], verts[t[2] as usize]);
+ let u = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
+ let v = [c[0] - a[0], c[1] - a[1], c[2] - a[2]];
+ let n = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]];
+ if (n[0] * n[0] + n[1] * n[1] + n[2] * n[2]).sqrt() < q * q {
+ degenerate += 1;
+ }
+ for k in 0..3 {
+ let (x, y) = (w[k], w[(k + 1) % 3]);
+ *edges.entry((x.min(y), x.max(y))).or_insert(0) += 1;
+ let (rx, ry) = (find(&mut parent, x), find(&mut parent, y));
+ if rx != ry {
+ parent[rx as usize] = ry;
+ }
+ }
+ }
+ let open_edges = edges.values().filter(|&&c| c == 1).count();
+ let shared_edges = edges.values().filter(|&&c| c > 2).count();
+ // pieces: triangles grouped by their welded root
+ let mut by: HashMap<u32, (usize, [f64; 3])> = HashMap::new();
+ for t in tris {
+ let r = find(&mut parent, weld[t[0] as usize]);
+ let e = by.entry(r).or_insert((0, [0.0; 3]));
+ e.0 += 1;
+ for k in 0..3 {
+ e.1[k] += (verts[t[0] as usize][k] + verts[t[1] as usize][k] + verts[t[2] as usize][k]) / 3.0;
+ }
+ }
+ let small = ((tris.len() as f64) * 0.005).max(1.0) as usize;
+ let mut loose: Vec<([f64; 3], usize)> = by.values().filter(|(n, _)| *n < small && by.len() > 1).map(|(n, s)| ([s[0] / *n as f64, s[1] / *n as f64, s[2] / *n as f64], *n)).collect();
+ loose.sort_by(|a, b| b.1.cmp(&a.1));
+ loose.truncate(12);
+ Topo { pieces: by.len(), loose, open_edges, shared_edges, degenerate }
+}
diff --git a/core/place/Cargo.toml b/core/place/Cargo.toml
new file mode 100644
index 00000000..9e080211
--- /dev/null
+++ b/core/place/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "raea-core-place"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "Placement by relations: boxes moved until on, against, beside, near, apart, facing, align and clear-zone rules hold and nothing on the same support overlaps; what can't hold is found, in scene lint's shape"
+
+[dependencies]
+serde_json = "1"
diff --git a/core/place/src/lib.rs b/core/place/src/lib.rs
new file mode 100644
index 00000000..e15499cb
--- /dev/null
+++ b/core/place/src/lib.rs
@@ -0,0 +1,25 @@
+//! Placement by relations (the 11-06 research: the scene builders that hold up measure placement, never eyeball it;
+//! Infinigen's and Holodeck's layouts are relations solved, not coordinates typed). Objects are boxes with a real size;
+//! rules say how they relate (on, against a wall, beside, near, apart, facing, aligned, a clear zone in front); the
+//! solver moves the free ones until the rules hold and nothing on the same support overlaps, then says what still
+//! doesn't hold, in scene lint's shape. Deterministic: the same input, the same layout.
+//!
+//! Frame: y up, metres. An object's `at` is the centre of its bottom face; its front is local +z, turned by `yaw`
+//! degrees about y. Walls are the room's sides: "-x", "+x", "-z", "+z".
+
+mod rules;
+mod solve;
+
+pub use rules::{Obj, Rule, parse, xyz};
+pub use solve::solve;
+
+use serde_json::Value;
+
+/// `place.solve`'s whole call: JSON in (objects, rules, room), JSON out (objects placed, found, errors).
+pub fn solve_json(v: &Value) -> Result<Value, String> {
+ let (objs, rules, room) = parse(v)?;
+ Ok(solve(objs, &rules, room))
+}
+
+#[cfg(test)]
+mod tests;
diff --git a/core/place/src/rules.rs b/core/place/src/rules.rs
new file mode 100644
index 00000000..0f051fe2
--- /dev/null
+++ b/core/place/src/rules.rs
@@ -0,0 +1,107 @@
+//! The input: objects (id, size, an optional starting place and yaw, fixed or free) and rules, read from JSON.
+//!
+//! {"objects": [{"id": "desk", "size": [1.4, 0.75, 0.7]}, {"id": "lamp", "size": [0.2, 0.5, 0.2]}],
+//! "room": {"min": [-2, -2], "max": [2, 2]},
+//! "rules": [{"against": "desk", "wall": "+z"}, {"on": "lamp", "of": "desk"}, {"near": "chair", "of": "desk", "dist": 0.5},
+//! {"facing": "chair", "of": "desk"}, {"beside": "shelf", "of": "desk", "side": "+x", "gap": 0.1},
+//! {"apart": "a", "of": "b", "min": 1}, {"align": "a", "of": "b", "axis": "x"}, {"clear": "desk", "depth": 0.8}]}
+
+use serde_json::Value;
+
+#[derive(Clone, Debug)]
+pub struct Obj {
+ pub id: String,
+ /// width (x), height (y), depth (z) before the yaw
+ pub size: [f64; 3],
+ pub at: [f64; 3],
+ pub yaw: f64,
+ pub fixed: bool,
+ /// whether a rule set its yaw (else it stays as given)
+ pub turned: bool,
+}
+
+#[derive(Clone, Debug, PartialEq)]
+pub enum Rule {
+ On { a: usize, b: usize },
+ Against { a: usize, wall: [f64; 2] },
+ Beside { a: usize, b: usize, side: [f64; 2], gap: f64 },
+ Near { a: usize, b: usize, dist: f64 },
+ Apart { a: usize, b: usize, min: f64 },
+ Facing { a: usize, b: usize },
+ Align { a: usize, b: usize, axis: usize },
+ Clear { a: usize, depth: f64 },
+}
+
+fn dir(s: &str) -> Result<[f64; 2], String> {
+ Ok(match s {
+ "+x" => [1.0, 0.0],
+ "-x" => [-1.0, 0.0],
+ "+z" => [0.0, 1.0],
+ "-z" => [0.0, -1.0],
+ o => return Err(format!("place: {o:?} isn't a side: +x, -x, +z, -z")),
+ })
+}
+
+/// An [x, y, z] point, or an error naming `what` (place's and solid info expect files').
+pub fn xyz(v: &Value, what: &str) -> Result<[f64; 3], String> {
+ serde_json::from_value(v.clone()).map_err(|_| format!("{what} is [x, y, z], got {v}"))
+}
+
+pub type Room = Option<([f64; 2], [f64; 2])>;
+
+pub fn parse(v: &Value) -> Result<(Vec<Obj>, Vec<Rule>, Room), String> {
+ let mut objs = Vec::new();
+ for o in v["objects"].as_array().ok_or("place: objects is a list of {id, size}")? {
+ let id = o["id"].as_str().ok_or("place: each object has an id")?.to_string();
+ if objs.iter().any(|x: &Obj| x.id == id) {
+ return Err(format!("place: two objects are called {id}"));
+ }
+ let size = xyz(&o["size"], &format!("place: {id}'s size"))?;
+ if size.iter().any(|s| *s <= 0.0) {
+ return Err(format!("place: {id}'s size is above 0 on every axis"));
+ }
+ let at = if o["at"].is_null() { [0.0; 3] } else { xyz(&o["at"], &format!("place: {id}'s at"))? };
+ objs.push(Obj { id, size, at, yaw: o["yaw"].as_f64().unwrap_or(0.0), fixed: o["fixed"] == true, turned: false });
+ }
+ let idx = |name: &Value, role: &str| -> Result<usize, String> {
+ let n = name.as_str().ok_or_else(|| format!("place: a rule's {role} names an object"))?;
+ objs.iter().position(|o| o.id == n).ok_or_else(|| format!("place: no object {n} (the objects: {})", objs.iter().map(|o| o.id.as_str()).collect::<Vec<_>>().join(", ")))
+ };
+ let mut rules = Vec::new();
+ for r in v["rules"].as_array().into_iter().flatten() {
+ let num = |k: &str, d: f64| r[k].as_f64().unwrap_or(d);
+ let rule = if !r["on"].is_null() {
+ Rule::On { a: idx(&r["on"], "on")?, b: idx(&r["of"], "of")? }
+ } else if !r["against"].is_null() {
+ Rule::Against { a: idx(&r["against"], "against")?, wall: dir(r["wall"].as_str().ok_or("place: against takes a wall: +x, -x, +z, -z")?)? }
+ } else if !r["beside"].is_null() {
+ Rule::Beside { a: idx(&r["beside"], "beside")?, b: idx(&r["of"], "of")?, side: dir(r["side"].as_str().unwrap_or("+x"))?, gap: num("gap", 0.0) }
+ } else if !r["near"].is_null() {
+ Rule::Near { a: idx(&r["near"], "near")?, b: idx(&r["of"], "of")?, dist: num("dist", 0.5) }
+ } else if !r["apart"].is_null() {
+ Rule::Apart { a: idx(&r["apart"], "apart")?, b: idx(&r["of"], "of")?, min: num("min", 1.0) }
+ } else if !r["facing"].is_null() {
+ Rule::Facing { a: idx(&r["facing"], "facing")?, b: idx(&r["of"], "of")? }
+ } else if !r["align"].is_null() {
+ let axis = match r["axis"].as_str().unwrap_or("x") { "x" => 0, "z" => 2, o => return Err(format!("place: align's axis is x or z, got {o}")) };
+ Rule::Align { a: idx(&r["align"], "align")?, b: idx(&r["of"], "of")?, axis }
+ } else if !r["clear"].is_null() {
+ Rule::Clear { a: idx(&r["clear"], "clear")?, depth: num("depth", 0.8) }
+ } else {
+ return Err(format!("place: no rule in {r}: on, against, beside, near, apart, facing, align, clear"));
+ };
+ rules.push(rule);
+ }
+ let room = if v["room"].is_null() {
+ None
+ } else {
+ let p = |k: &str| -> Result<[f64; 2], String> {
+ match v["room"][k].as_array().map(|a| a.iter().map(Value::as_f64).collect::<Option<Vec<f64>>>()) {
+ Some(Some(a)) if a.len() == 2 => Ok([a[0], a[1]]),
+ _ => Err(format!("place: room.{k} is [x, z]")),
+ }
+ };
+ Some((p("min")?, p("max")?))
+ };
+ Ok((objs, rules, room))
+}
diff --git a/core/place/src/solve.rs b/core/place/src/solve.rs
new file mode 100644
index 00000000..37c5562c
--- /dev/null
+++ b/core/place/src/solve.rs
@@ -0,0 +1,311 @@
+//! The solver: heights from the `on` chains, yaws from `against` and `facing`, then rounds of projection (each rule moves
+//! the free objects it names just enough to hold), each round ending with overlaps pushed apart along their shallower
+//! axis and everything kept in the room or on its support. What still doesn't hold after the rounds is found.
+
+use serde_json::{Value, json};
+
+use crate::rules::{Obj, Room, Rule};
+
+const ROUNDS: usize = 400;
+const TOL: f64 = 2e-3;
+
+fn front(yaw: f64) -> [f64; 2] {
+ let r = yaw.to_radians();
+ [r.sin(), r.cos()]
+}
+
+/// Half the footprint's extent in x and z, turned by the yaw.
+fn half(o: &Obj) -> [f64; 2] {
+ let r = o.yaw.to_radians();
+ let (c, s) = (r.cos().abs(), r.sin().abs());
+ [(c * o.size[0] + s * o.size[2]) / 2.0, (s * o.size[0] + c * o.size[2]) / 2.0]
+}
+
+/// The footprint gap between two objects (0 when they touch or overlap) and their overlap depth on x and z.
+fn gap_and_pen(a: &Obj, b: &Obj) -> (f64, [f64; 2]) {
+ let (ha, hb) = (half(a), half(b));
+ let d = [b.at[0] - a.at[0], b.at[2] - a.at[2]];
+ let sep = [d[0].abs() - ha[0] - hb[0], d[1].abs() - ha[1] - hb[1]];
+ let gap = (sep[0].max(0.0).powi(2) + sep[1].max(0.0).powi(2)).sqrt();
+ (gap, [-sep[0], -sep[1]])
+}
+
+/// A clear zone in front of an object, as an object of its own (its footprint only).
+fn zone(o: &Obj, depth: f64) -> Obj {
+ let f = front(o.yaw);
+ let hd = (half(o)[0] * f[0].abs() + half(o)[1] * f[1].abs()).max(1e-6);
+ let across = o.size[0];
+ let c = [o.at[0] + f[0] * (hd + depth / 2.0), o.at[2] + f[1] * (hd + depth / 2.0)];
+ Obj { id: format!("{}'s clear zone", o.id), size: [across, 0.01, depth], at: [c[0], o.at[1], c[1]], yaw: o.yaw, fixed: true, turned: true }
+}
+
+fn support_of(rules: &[Rule], n: usize) -> Vec<Option<usize>> {
+ let mut s = vec![None; n];
+ for r in rules {
+ if let Rule::On { a, b } = r {
+ s[*a] = Some(*b);
+ }
+ }
+ s
+}
+
+fn push(objs: &mut [Obj], i: usize, dx: f64, dz: f64) {
+ if !objs[i].fixed {
+ objs[i].at[0] += dx;
+ objs[i].at[2] += dz;
+ }
+}
+
+/// Move a and b apart (or together) by `d` along `n`, split by which are free.
+fn split(objs: &mut [Obj], a: usize, b: usize, n: [f64; 2], d: f64) {
+ let (fa, fb) = (!objs[a].fixed, !objs[b].fixed);
+ let (wa, wb) = match (fa, fb) {
+ (true, true) => (0.5, 0.5),
+ (true, false) => (1.0, 0.0),
+ (false, true) => (0.0, 1.0),
+ _ => return,
+ };
+ push(objs, a, -n[0] * d * wa, -n[1] * d * wa);
+ push(objs, b, n[0] * d * wb, n[1] * d * wb);
+}
+
+pub fn solve(mut objs: Vec<Obj>, rules: &[Rule], room: Room) -> Value {
+ let n = objs.len();
+ let sup = support_of(rules, n);
+ // a start for the free ones given no place: spread on a ring round the room's middle, so none coincide
+ let mid = room.map_or([0.0, 0.0], |(lo, hi)| [(lo[0] + hi[0]) / 2.0, (lo[1] + hi[1]) / 2.0]);
+ let spread = room.map_or(1.0, |(lo, hi)| ((hi[0] - lo[0]).min(hi[1] - lo[1]) / 4.0).max(0.1));
+ for (i, o) in objs.iter_mut().enumerate() {
+ if !o.fixed && o.at == [0.0; 3] {
+ let a = i as f64 * 2.399963;
+ o.at = [mid[0] + spread * a.cos(), 0.0, mid[1] + spread * a.sin()];
+ }
+ }
+ for (i, s) in sup.iter().enumerate() {
+ if let Some(b) = s {
+ if !objs[i].fixed {
+ objs[i].at[0] = objs[*b].at[0] + (i as f64 * 0.37).sin() * 1e-3;
+ objs[i].at[2] = objs[*b].at[2];
+ }
+ }
+ }
+ let heights = |objs: &mut Vec<Obj>| {
+ for _ in 0..n {
+ for (i, s) in sup.iter().enumerate() {
+ if let Some(b) = s {
+ objs[i].at[1] = objs[*b].at[1] + objs[*b].size[1];
+ }
+ }
+ }
+ };
+ let mut wall_err = Vec::new();
+ for _ in 0..ROUNDS {
+ heights(&mut objs);
+ for r in rules {
+ match *r {
+ Rule::Against { a, wall } => {
+ if !objs[a].turned || !objs[a].fixed {
+ objs[a].yaw = (-wall[0]).atan2(-wall[1]).to_degrees();
+ objs[a].turned = true;
+ }
+ let Some((lo, hi)) = room else {
+ if wall_err.is_empty() {
+ wall_err.push(objs[a].id.clone());
+ }
+ continue;
+ };
+ let h = half(&objs[a]);
+ if wall[0] != 0.0 {
+ let x = if wall[0] > 0.0 { hi[0] - h[0] } else { lo[0] + h[0] };
+ let dx = x - objs[a].at[0];
+ push(&mut objs, a, dx, 0.0);
+ } else {
+ let z = if wall[1] > 0.0 { hi[1] - h[1] } else { lo[1] + h[1] };
+ let dz = z - objs[a].at[2];
+ push(&mut objs, a, 0.0, dz);
+ }
+ }
+ Rule::Facing { a, b } => {
+ let d = [objs[b].at[0] - objs[a].at[0], objs[b].at[2] - objs[a].at[2]];
+ if d[0].hypot(d[1]) > 1e-9 && !objs[a].fixed {
+ objs[a].yaw = d[0].atan2(d[1]).to_degrees();
+ objs[a].turned = true;
+ }
+ }
+ Rule::Beside { a, b, side, gap } => {
+ let (ha, hb) = (half(&objs[a]), half(&objs[b]));
+ let want = [objs[b].at[0] + side[0] * (ha[0] + hb[0] + gap), objs[b].at[2] + side[1] * (ha[1] + hb[1] + gap)];
+ // along the side exactly; across it, lined up with b
+ let w = [if side[0] != 0.0 { want[0] } else { objs[b].at[0] }, if side[1] != 0.0 { want[1] } else { objs[b].at[2] }];
+ let d = [w[0] - objs[a].at[0], w[1] - objs[a].at[2]];
+ if objs[a].fixed {
+ push(&mut objs, b, -d[0], -d[1]);
+ } else {
+ push(&mut objs, a, d[0], d[1]);
+ }
+ }
+ Rule::Near { a, b, dist } => {
+ let (gap, _) = gap_and_pen(&objs[a], &objs[b]);
+ if gap > dist {
+ let d = [objs[b].at[0] - objs[a].at[0], objs[b].at[2] - objs[a].at[2]];
+ let l = d[0].hypot(d[1]).max(1e-9);
+ split(&mut objs, a, b, [-d[0] / l, -d[1] / l], (gap - dist) * 0.5);
+ }
+ }
+ Rule::Apart { a, b, min } => {
+ let (gap, _) = gap_and_pen(&objs[a], &objs[b]);
+ if gap < min {
+ let d = [objs[b].at[0] - objs[a].at[0], objs[b].at[2] - objs[a].at[2]];
+ let l = d[0].hypot(d[1]);
+ let nrm = if l > 1e-9 { [d[0] / l, d[1] / l] } else { [1.0, 0.0] };
+ split(&mut objs, a, b, nrm, (min - gap) * 0.5);
+ }
+ }
+ Rule::Align { a, b, axis } => {
+ let d = objs[b].at[axis] - objs[a].at[axis];
+ if axis == 0 { split(&mut objs, a, b, [-1.0, 0.0], d * 0.5) } else { split(&mut objs, a, b, [0.0, -1.0], d * 0.5) }
+ }
+ Rule::On { .. } | Rule::Clear { .. } => {}
+ }
+ }
+ // overlaps among things on the same support, and clear zones kept free
+ let zones: Vec<(usize, Obj)> = rules.iter().filter_map(|r| if let Rule::Clear { a, depth } = r { Some((*a, zone(&objs[*a], *depth))) } else { None }).collect();
+ for i in 0..n {
+ for j in i + 1..n {
+ if sup[i] != sup[j] || sup[i] == Some(j) || sup[j] == Some(i) {
+ continue;
+ }
+ let (_, pen) = gap_and_pen(&objs[i], &objs[j]);
+ if pen[0] > 0.0 && pen[1] > 0.0 {
+ let (k, d) = if pen[0] < pen[1] { (0, pen[0]) } else { (1, pen[1]) };
+ let c = if k == 0 { objs[j].at[0] - objs[i].at[0] } else { objs[j].at[2] - objs[i].at[2] };
+ let s = if c.abs() > 1e-9 { c.signum() } else if (i + j) % 2 == 0 { 1.0 } else { -1.0 };
+ let nrm = if k == 0 { [s, 0.0] } else { [0.0, s] };
+ split(&mut objs, i, j, nrm, d + 1e-4);
+ }
+ }
+ for (owner, z) in &zones {
+ if *owner == i || sup[i] != sup[*owner] || sup[i] == Some(*owner) {
+ continue;
+ }
+ let (_, pen) = gap_and_pen(z, &objs[i]);
+ if pen[0] > 0.0 && pen[1] > 0.0 {
+ let (k, d) = if pen[0] < pen[1] { (0, pen[0]) } else { (1, pen[1]) };
+ let c = if k == 0 { objs[i].at[0] - z.at[0] } else { objs[i].at[2] - z.at[2] };
+ let s = if c.abs() > 1e-9 { c.signum() } else { 1.0 };
+ push(&mut objs, i, if k == 0 { s * (d + 1e-4) } else { 0.0 }, if k == 1 { s * (d + 1e-4) } else { 0.0 });
+ }
+ }
+ }
+ // in the room, or on the support's top
+ for i in 0..n {
+ let h = half(&objs[i]);
+ let bounds = match sup[i] {
+ Some(b) => {
+ let hb = half(&objs[b]);
+ Some(([objs[b].at[0] - hb[0], objs[b].at[2] - hb[1]], [objs[b].at[0] + hb[0], objs[b].at[2] + hb[1]]))
+ }
+ None => room,
+ };
+ if let Some((lo, hi)) = bounds {
+ for (k, ax) in [(0usize, 0usize), (1, 2)] {
+ let (a, b) = (lo[k] + h[k], hi[k] - h[k]);
+ let x = objs[i].at[ax];
+ let c = if a > b { (lo[k] + hi[k]) / 2.0 } else { x.clamp(a, b) };
+ if (c - x).abs() > 0.0 {
+ let mut d = [0.0, 0.0];
+ d[k] = c - x;
+ push(&mut objs, i, d[0], d[1]);
+ }
+ }
+ }
+ }
+ }
+ heights(&mut objs);
+ let found = crate::solve::check(&objs, rules, room, &sup, &wall_err);
+ let errors = found.iter().filter(|f| f["level"] == "error").count();
+ let r = |x: f64| (x * 1e5).round() / 1e5;
+ let placed: Vec<Value> = objs.iter().map(|o| json!({"id": o.id, "at": o.at.map(r), "yaw": r(o.yaw), "size": o.size})).collect();
+ json!({"objects": placed, "found": found, "errors": errors})
+}
+
+fn bx(o: &Obj) -> Value {
+ let h = half(o);
+ json!({"min": [o.at[0] - h[0], o.at[1], o.at[2] - h[1]], "max": [o.at[0] + h[0], o.at[1] + o.size[1], o.at[2] + h[1]]})
+}
+
+/// What holds and what doesn't, after the rounds.
+pub(crate) fn check(objs: &[Obj], rules: &[Rule], room: Room, sup: &[Option<usize>], wall_err: &[String]) -> Vec<Value> {
+ let mut out = Vec::new();
+ let mut f = |part: &str, check: &str, ok: bool, says: String, o: &Obj| out.push(json!({"part": part, "check": check, "level": if ok { "ok" } else { "error" }, "says": says, "box": bx(o)}));
+ for id in wall_err {
+ let o = objs.iter().find(|o| &o.id == id).unwrap();
+ f(id, "against", false, format!("{id} is against a wall, but there's no room to have walls (give room: {{min, max}})"), o);
+ }
+ for r in rules {
+ match *r {
+ Rule::On { a, b } => {
+ let (ha, hb) = (half(&objs[a]), half(&objs[b]));
+ let inside = (objs[a].at[0] - objs[b].at[0]).abs() + ha[0] <= hb[0] + TOL && (objs[a].at[2] - objs[b].at[2]).abs() + ha[1] <= hb[1] + TOL;
+ f(&objs[a].id, "on", inside, if inside { format!("{} on {}", objs[a].id, objs[b].id) } else { format!("{} is wider than {}'s top: it overhangs", objs[a].id, objs[b].id) }, &objs[a]);
+ }
+ Rule::Against { a, wall } => {
+ if let Some((lo, hi)) = room {
+ let h = half(&objs[a]);
+ let d = if wall[0] > 0.0 { hi[0] - (objs[a].at[0] + h[0]) } else if wall[0] < 0.0 { objs[a].at[0] - h[0] - lo[0] } else if wall[1] > 0.0 { hi[1] - (objs[a].at[2] + h[1]) } else { objs[a].at[2] - h[1] - lo[1] };
+ f(&objs[a].id, "against", d.abs() <= TOL, format!("{} is {:.3} m off its wall", objs[a].id, d.abs()), &objs[a]);
+ }
+ }
+ Rule::Beside { a, b, side, gap } => {
+ let (ha, hb) = (half(&objs[a]), half(&objs[b]));
+ let along = if side[0] != 0.0 { (objs[a].at[0] - objs[b].at[0]) * side[0] - ha[0] - hb[0] } else { (objs[a].at[2] - objs[b].at[2]) * side[1] - ha[1] - hb[1] };
+ let ok = (along - gap).abs() <= TOL;
+ f(&objs[a].id, "beside", ok, format!("{} is {:.3} m beside {} (asked {gap})", objs[a].id, along, objs[b].id), &objs[a]);
+ }
+ Rule::Near { a, b, dist } => {
+ let (g, _) = gap_and_pen(&objs[a], &objs[b]);
+ f(&objs[a].id, "near", g <= dist + TOL, format!("{} is {:.3} m from {} (asked within {dist})", objs[a].id, g, objs[b].id), &objs[a]);
+ }
+ Rule::Apart { a, b, min } => {
+ let (g, _) = gap_and_pen(&objs[a], &objs[b]);
+ f(&objs[a].id, "apart", g + TOL >= min, format!("{} is {:.3} m from {} (asked at least {min})", objs[a].id, g, objs[b].id), &objs[a]);
+ }
+ Rule::Facing { a, b } => {
+ let d = [objs[b].at[0] - objs[a].at[0], objs[b].at[2] - objs[a].at[2]];
+ let want = d[0].atan2(d[1]).to_degrees();
+ let off = ((objs[a].yaw - want + 540.0) % 360.0 - 180.0).abs();
+ f(&objs[a].id, "facing", off <= 1.0, format!("{} faces {:.0}° off {}", objs[a].id, off, objs[b].id), &objs[a]);
+ }
+ Rule::Align { a, b, axis } => {
+ let d = (objs[a].at[axis] - objs[b].at[axis]).abs();
+ f(&objs[a].id, "align", d <= TOL, format!("{} is {:.3} m out of line with {}", objs[a].id, d, objs[b].id), &objs[a]);
+ }
+ Rule::Clear { a, depth } => {
+ let z = zone(&objs[a], depth);
+ let inside: Vec<&str> = (0..objs.len()).filter(|&i| i != a && sup[i] == sup[a] && sup[i] != Some(a)).filter(|&i| { let (_, p) = gap_and_pen(&z, &objs[i]); p[0] > TOL && p[1] > TOL }).map(|i| objs[i].id.as_str()).collect();
+ f(&objs[a].id, "clear", inside.is_empty(), if inside.is_empty() { format!("{depth} m clear in front of {}", objs[a].id) } else { format!("{} stand in front of {}", inside.join(", "), objs[a].id) }, &objs[a]);
+ }
+ }
+ }
+ for i in 0..objs.len() {
+ for j in i + 1..objs.len() {
+ if sup[i] != sup[j] || sup[i] == Some(j) || sup[j] == Some(i) {
+ continue;
+ }
+ let (_, p) = gap_and_pen(&objs[i], &objs[j]);
+ if p[0] > TOL && p[1] > TOL {
+ f(&objs[i].id, "overlap", false, format!("{} and {} overlap by {:.3} x {:.3} m: the rules leave no room for both", objs[i].id, objs[j].id, p[0], p[1]), &objs[i]);
+ }
+ }
+ if sup[i].is_none() {
+ if let Some((lo, hi)) = room {
+ let h = half(&objs[i]);
+ let out_of = objs[i].at[0] - h[0] < lo[0] - TOL || objs[i].at[0] + h[0] > hi[0] + TOL || objs[i].at[2] - h[1] < lo[1] - TOL || objs[i].at[2] + h[1] > hi[1] + TOL;
+ if out_of {
+ f(&objs[i].id, "room", false, format!("{} doesn't fit in the room", objs[i].id), &objs[i]);
+ }
+ }
+ }
+ }
+ out
+}
diff --git a/core/place/src/tests.rs b/core/place/src/tests.rs
new file mode 100644
index 00000000..79dd98f0
--- /dev/null
+++ b/core/place/src/tests.rs
@@ -0,0 +1,63 @@
+use super::*;
+use serde_json::json;
+
+fn room() -> serde_json::Value {
+ json!({
+ "room": {"min": [-2, -2], "max": [2, 2]},
+ "objects": [
+ {"id": "desk", "size": [1.4, 0.75, 0.7]},
+ {"id": "chair", "size": [0.5, 0.9, 0.5]},
+ {"id": "lamp", "size": [0.2, 0.45, 0.2]},
+ {"id": "bed", "size": [1.0, 0.5, 2.0]},
+ {"id": "nightstand", "size": [0.45, 0.55, 0.4]},
+ {"id": "wardrobe", "size": [1.2, 2.0, 0.6]}
+ ],
+ "rules": [
+ {"against": "desk", "wall": "+z"},
+ {"near": "chair", "of": "desk", "dist": 0.15},
+ {"facing": "chair", "of": "desk"},
+ {"on": "lamp", "of": "desk"},
+ {"against": "bed", "wall": "-x"},
+ {"beside": "nightstand", "of": "bed", "side": "+z", "gap": 0.05},
+ {"against": "wardrobe", "wall": "+x"},
+ {"clear": "wardrobe", "depth": 0.7},
+ {"apart": "chair", "of": "bed", "min": 0.3}
+ ]
+ })
+}
+
+fn at(out: &serde_json::Value, id: &str) -> (Vec<f64>, f64) {
+ let o = out["objects"].as_array().unwrap().iter().find(|o| o["id"] == id).unwrap();
+ (o["at"].as_array().unwrap().iter().map(|v| v.as_f64().unwrap()).collect(), o["yaw"].as_f64().unwrap())
+}
+
+#[test]
+fn a_bedroom_is_laid_out_by_its_rules() {
+ let out = solve_json(&room()).unwrap();
+ let bad: Vec<&serde_json::Value> = out["found"].as_array().unwrap().iter().filter(|f| f["level"] == "error").collect();
+ assert!(bad.is_empty(), "{bad:#?}");
+ // the desk's back on the +z wall, facing into the room
+ let (desk, yaw) = at(&out, "desk");
+ assert!((desk[2] - 1.65).abs() < 2e-3 && (yaw.abs() - 180.0).abs() < 1e-6, "{desk:?} {yaw}");
+ // the lamp stands on the desk's top
+ let (lamp, _) = at(&out, "lamp");
+ assert!((lamp[1] - 0.75).abs() < 1e-9);
+ // the chair turned to the desk
+ let (chair, cyaw) = at(&out, "chair");
+ let want = (desk[0] - chair[0]).atan2(desk[2] - chair[2]).to_degrees();
+ assert!((cyaw - want).abs() < 1.0, "{cyaw} vs {want}");
+ // the same input, the same layout
+ assert_eq!(solve_json(&room()).unwrap(), out);
+}
+
+#[test]
+fn what_cannot_hold_is_found() {
+ let v = json!({"room": {"min": [-2, -2], "max": [2, 2]},
+ "objects": [{"id": "a", "size": [3, 1, 0.5]}, {"id": "b", "size": [3, 1, 0.5]}, {"id": "cup", "size": [0.5, 0.1, 0.5]}, {"id": "coaster", "size": [0.1, 0.01, 0.1]}],
+ "rules": [{"against": "a", "wall": "+z"}, {"against": "b", "wall": "+z"}, {"on": "cup", "of": "coaster"}]});
+ let out = solve_json(&v).unwrap();
+ let checks: Vec<&str> = out["found"].as_array().unwrap().iter().filter(|f| f["level"] == "error").map(|f| f["check"].as_str().unwrap()).collect();
+ assert!(checks.contains(&"overlap"), "{checks:?}");
+ assert!(checks.contains(&"on"), "the cup overhangs the coaster: {checks:?}");
+ assert!(solve_json(&json!({"objects": [{"id": "a", "size": [1, 1, 1]}], "rules": [{"on": "a", "of": "z"}]})).unwrap_err().contains("no object z"));
+}
diff --git a/core/program/src/eval.rs b/core/program/src/eval.rs
index e4a327bc..3ec2e320 100644
--- a/core/program/src/eval.rs
+++ b/core/program/src/eval.rs
@@ -86,7 +86,8 @@ pub struct Cols {
/// shared between a frame and the base it came from (cloning a frame copies no strings)
pub kind: std::sync::Arc<Vec<String>>,
pub id: std::sync::Arc<Vec<String>>,
- pub cols: HashMap<String, Col>,
+ /// each column shared too, written on copy: a frame was the base cloned, every column of 100 000 lights copied (FC1b)
+ pub cols: HashMap<String, std::sync::Arc<Col>>,
}
impl Cols {
@@ -114,11 +115,11 @@ impl Cols {
pub fn set(&mut self, r: usize, c: &str, v: V) {
let n = self.id.len();
match self.cols.get_mut(c) {
- Some(col) => col.set(r, v),
+ Some(col) => std::sync::Arc::make_mut(col).set(r, v),
None => {
let mut col = Col::empty_for(&v, n);
col.set(r, v);
- self.cols.insert(c.to_string(), col);
+ self.cols.insert(c.to_string(), std::sync::Arc::new(col));
}
}
}
diff --git a/core/program/src/timeline.rs b/core/program/src/timeline.rs
index 5140bd04..cf7b9109 100644
--- a/core/program/src/timeline.rs
+++ b/core/program/src/timeline.rs
@@ -11,7 +11,7 @@ pub struct Timeline {
pub frames: i64,
pub base: Cols,
/// per frame: the columns whose values differ from the base (whole columns)
- written: Vec<HashMap<String, Col>>,
+ written: Vec<HashMap<String, std::sync::Arc<Col>>>,
/// per row: true when no frame changes any of its values from the base, so a system that applies a row's values
/// to the World each frame can apply a still row's once
still: Vec<bool>,
@@ -24,11 +24,11 @@ impl Timeline {
pub fn from_cols(prog: &Program, base: Cols) -> Result<Timeline, String> {
let frames = prog.frames.max(0);
- let per: Vec<(HashMap<String, Col>, Vec<usize>)> = parallel(frames as usize, |f| {
+ let per: Vec<(HashMap<String, std::sync::Arc<Col>>, Vec<usize>)> = parallel(frames as usize, |f| {
let raw = eval::frame_cols(prog, &base, f as i64);
- let w: HashMap<String, Col> = raw.cols.into_iter().filter(|(c, v)| base.cols.get(c) != Some(v)).collect();
+ let w: HashMap<String, std::sync::Arc<Col>> = raw.cols.into_iter().filter(|(c, v)| base.cols.get(c) != Some(v)).collect();
// the rows this frame moves: a written column's value differing from the base's at that row
- let moved = (0..base.len()).filter(|r| w.iter().any(|(c, col)| !col.same_at(base.cols.get(c), *r))).collect();
+ let moved = (0..base.len()).filter(|r| w.iter().any(|(c, col)| !col.same_at(base.cols.get(c).map(|b| &**b), *r))).collect();
Ok((w, moved))
})?;
let mut still = vec![true; base.len()];
@@ -122,4 +122,19 @@ mod tests {
assert!(t.still(2));
assert!(!t.still(3), "a row past the end is never still");
}
+
+ #[test]
+ fn a_frame_shares_its_columns_and_a_value_set_on_it_leaves_the_base_and_other_frames_as_they_were() {
+ let mut prog = Program { frames: 3, ..Default::default() };
+ prog.keys.insert(("moves".into(), "x".into()), vec![(0, 0.0, "linear".into()), (2, 2.0, "linear".into())]);
+ let t = Timeline::new(&prog, &[row("cube", 1.0), row("moves", 0.0)]).unwrap();
+ let (a, mut b) = (t.cols(1), t.cols(1));
+ // a column no frame writes is the base's own, not a copy (100 000 lights' columns were copied each frame)
+ assert!(std::sync::Arc::ptr_eq(&a.cols["x"], &b.cols["x"]) || a.cols["x"] == b.cols["x"]);
+ b.set(0, "x", V::N(9.0));
+ assert_eq!(b.get(0, "x"), Some(V::N(9.0)));
+ assert_eq!(a.get(0, "x"), Some(V::N(1.0)), "a value set on one frame's columns changed another's");
+ assert_eq!(t.cols(1).get(0, "x"), Some(V::N(1.0)), "a value set on a frame's columns changed the timeline");
+ assert_eq!(t.cols(1).get(1, "x"), Some(V::N(1.0)));
+ }
}
diff --git a/core/review/Cargo.toml b/core/review/Cargo.toml
new file mode 100644
index 00000000..d23140d5
--- /dev/null
+++ b/core/review/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "raea-core-review"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "raea render --review's fixed cameras from a frame's part boxes (from inside for an interior), and RAEA_CAMERA's camera in place of the scene's own"
+
+[dependencies]
+bevy = { version = "=0.20.0", default-features = false, features = ["std"] }
+serde_json = "1"
+raea-core-scene = { path = "../scene" }
diff --git a/core/review/src/lib.rs b/core/review/src/lib.rs
new file mode 100644
index 00000000..e847bc02
--- /dev/null
+++ b/core/review/src/lib.rs
@@ -0,0 +1,165 @@
+//! The fixed cameras of `raea render EDIT.tsx --review DIR` (runtime/export's review.rs renders them), and the camera a
+//! review's child render puts in place of the scene's own (RAEA_CAMERA). The cameras come from the frame's parts (scene
+//! lint's boxes; ground slabs and other flat, wide parts left out): hero (the scene's own camera), front (+z looking
+//! -z), right, top, iso, and low (0.3 m off the floor, for feet and floaters); an interior (a ceiling over the plan)
+//! gets the same views from inside, under the ceiling.
+
+use std::sync::{Arc, OnceLock};
+
+use bevy::math::Mat4;
+use raea_core_scene::Item;
+use serde_json::{Map, Value, json};
+
+pub const VIEWS: [&str; 6] = ["hero", "front", "right", "top", "iso", "low"];
+pub const TILE_W: u32 = 640;
+
+/// A fixed camera: (view, eye, target, fov degrees).
+pub type Cam = (&'static str, [f64; 3], [f64; 3], f64);
+/// A part's box: (min, max).
+pub type Box3 = ([f64; 3], [f64; 3]);
+
+/// The fixed cameras, each (view, eye, target, fov degrees), from the parts' box and the picture's aspect.
+pub fn cameras(lo: [f64; 3], hi: [f64; 3], aspect: f64) -> Vec<Cam> {
+ let c = [(lo[0] + hi[0]) / 2.0, (lo[1] + hi[1]) / 2.0, (lo[2] + hi[2]) / 2.0];
+ let r = (((hi[0] - lo[0]).powi(2) + (hi[1] - lo[1]).powi(2) + (hi[2] - lo[2]).powi(2)).sqrt() / 2.0).max(0.05);
+ let fov: f64 = 40.0;
+ let half_v = (fov / 2.0).to_radians();
+ let half_h = (half_v.tan() * aspect).atan();
+ let d = r / half_v.min(half_h).sin() * 1.08;
+ let k = 1.0 / 3f64.sqrt();
+ let low_y = 0.3f64.max(lo[1] + 0.05).min(hi[1]);
+ vec![
+ ("front", [c[0], c[1] + 0.15 * r, c[2] + d], c, fov),
+ ("right", [c[0] + d, c[1] + 0.15 * r, c[2]], c, fov),
+ ("top", [c[0], c[1] + d, c[2] + 0.001 * d], c, fov),
+ ("iso", [c[0] + d * k, c[1] + d * k, c[2] + d * k], c, fov),
+ ("low", [c[0], low_y, c[2] + d], [c[0], low_y, c[2]], fov),
+ ]
+}
+
+/// An interior's cameras: inside the room, under its ceiling (`ceil`, the ceiling's underside), each looking across it,
+/// since from outside an enclosed room every view is its walls and roof.
+pub fn inside(lo: [f64; 3], hi: [f64; 3], ceil: f64) -> Vec<Cam> {
+ let c = [(lo[0] + hi[0]) / 2.0, (lo[1] + hi[1]) / 2.0, (lo[2] + hi[2]) / 2.0];
+ // well in from the box's sides, which can run past a room's walls (columns or a porch outside it)
+ let m = |k: usize| ((hi[k] - lo[k]) * 0.12).clamp(0.5, 6.0);
+ let top = ceil.min(hi[1]);
+ let eye = (lo[1] + 1.6).min(top - 0.2).max(lo[1] + 0.3);
+ // a corner view from about a tall man's reach, under a dropped ceiling too
+ let up = (lo[1] + ((top - lo[1]) * 0.8).min(3.0)).max(eye);
+ let fov = 70.0;
+ vec![
+ ("front", [c[0], eye, hi[2] - m(2)], [c[0], eye - 0.3, lo[2]], fov),
+ ("right", [hi[0] - m(0), eye, c[2]], [lo[0], eye - 0.3, c[2]], fov),
+ ("top", [c[0], top - 0.1, c[2] + 0.001], [c[0], lo[1], c[2]], 90.0),
+ ("iso", [hi[0] - m(0), up, hi[2] - m(2)], [c[0], lo[1] + 0.5, c[2]], fov),
+ ("low", [c[0], (lo[1] + 0.3).min(top), hi[2] - m(2)], [c[0], lo[1] + 0.3, lo[2]], fov),
+ ]
+}
+
+/// The underside of a ceiling over the parts' box, when there is one (a part over most of the plan in the box's top
+/// third): the scene is then an interior, seen from inside.
+pub fn ceiling(boxes: &[Box3], lo: [f64; 3], hi: [f64; 3]) -> Option<f64> {
+ let (w, d, h) = (hi[0] - lo[0], hi[2] - lo[2], hi[1] - lo[1]);
+ boxes.iter().filter(|(a, b)| b[0] - a[0] >= 0.8 * w && b[2] - a[2] >= 0.8 * d && a[1] > lo[1] + h * 0.66 && h > 1.5).map(|(a, _)| a[1]).reduce(f64::min)
+}
+
+/// The box round every part (slabs and ceilings too).
+pub fn whole(boxes: &[Box3]) -> Option<Box3> {
+ boxes.iter().copied().reduce(|(a, b), (c, d)| ([a[0].min(c[0]), a[1].min(c[1]), a[2].min(c[2])], [b[0].max(d[0]), b[1].max(d[1]), b[2].max(d[2])]))
+}
+
+/// Every part's box from scene lint's findings.
+pub fn boxes_of(found: &[Value]) -> Vec<Box3> {
+ found.iter().filter_map(|v| {
+ let b = v.get("box")?;
+ let p = |k: &str| -> Option<[f64; 3]> { let a = b.get(k)?.as_array()?; Some([a.first()?.as_f64()?, a.get(1)?.as_f64()?, a.get(2)?.as_f64()?]) };
+ Some((p("min")?, p("max")?))
+ }).filter(|(lo, hi)| (0..3).all(|k| hi[k].is_finite() && lo[k].is_finite() && hi[k] >= lo[k])).collect()
+}
+
+/// The parts' box from scene lint's findings, flat wide parts (a ground slab) left out when anything else stands.
+pub fn parts_box(found: &[Value]) -> Option<Box3> {
+ let boxes = boxes_of(found);
+ let flat_wide = |(lo, hi): &([f64; 3], [f64; 3])| hi[1] - lo[1] < 0.25 && (hi[0] - lo[0]).max(hi[2] - lo[2]) > 5.0;
+ let standing: Vec<Box3> = boxes.iter().copied().filter(|b| !flat_wide(b)).collect();
+ whole(if standing.is_empty() { &boxes } else { &standing })
+}
+
+/// The arguments a child render keeps: everything but this render's own output, frame and review flags.
+pub fn passed(args: &[String]) -> Vec<String> {
+ let mut out = Vec::new();
+ let mut i = 2;
+ while i < args.len() {
+ match args[i].as_str() {
+ "-o" | "--review" | "--frame" | "--at" => i += 2,
+ "--clay" => i += 1,
+ a => {
+ out.push(a.to_string());
+ i += 1;
+ }
+ }
+ }
+ out
+}
+
+/// RAEA_CAMERA="ex,ey,ez,tx,ty,tz[,fov°]", the camera a review's child render uses.
+fn wanted() -> Option<&'static ([f64; 3], [f64; 3], Option<f64>)> {
+ static CAM: OnceLock<Option<([f64; 3], [f64; 3], Option<f64>)>> = OnceLock::new();
+ CAM.get_or_init(|| {
+ let v: Vec<f64> = std::env::var("RAEA_CAMERA").ok()?.split(',').map(|s| s.trim().parse::<f64>()).collect::<Result<_, _>>().ok()?;
+ (v.len() >= 6).then(|| ([v[0], v[1], v[2]], [v[3], v[4], v[5]], v.get(6).copied()))
+ })
+ .as_ref()
+}
+
+/// A review's fixed camera in place of the scene's own: every frame's camera item is moved there, or one is added when
+/// the scene has none. With RAEA_CAMERA unset, nothing changes.
+pub fn camera_override(out: &mut Vec<Item>) {
+ let Some((eye, at, fov)) = wanted() else { return };
+ let set = |props: &mut Map<String, Value>| {
+ props.insert("position".into(), json!(eye));
+ props.insert("lookAt".into(), json!(at));
+ if let Some(f) = fov {
+ props.insert("fov".into(), json!(f));
+ }
+ };
+ match out.iter_mut().find(|i| i.kind == "camera") {
+ Some(c) => set(Arc::make_mut(&mut c.props)),
+ None => {
+ let mut props = Map::new();
+ set(&mut props);
+ out.push(Item { kind: "camera", props: Arc::new(props), shape: None, material: None, world: Mat4::IDENTITY });
+ }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn the_cameras_frame_the_box_and_the_low_one_is_at_the_floor() {
+ let cams = cameras([-1.0, 0.0, -1.0], [1.0, 2.0, 1.0], 16.0 / 9.0);
+ assert_eq!(cams.iter().map(|c| c.0).collect::<Vec<_>>(), ["front", "right", "top", "iso", "low"]);
+ let (_, eye, at, fov) = cams[0];
+ // the box's bounding sphere fits the vertical field of view
+ let d = ((eye[0] - at[0]).powi(2) + (eye[1] - at[1]).powi(2) + (eye[2] - at[2]).powi(2)).sqrt();
+ // the box's half diagonal: sqrt(2^2 + 2^2 + 2^2) / 2
+ let r = 3f64.sqrt();
+ assert!(d * (fov / 2.0).to_radians().sin() >= r * 0.99, "{d} {r}");
+ assert_eq!(cams[4].1[1], 0.3);
+ assert_eq!(passed(&["render", "e.tsx", "-o", "x", "--review", "d", "--clay", "--composition", "A"].map(String::from)), vec!["--composition", "A"]);
+ let found = vec![json!({"box": {"min": [-50, -0.1, -50], "max": [50, 0, 50]}}), json!({"box": {"min": [0, 0, 0], "max": [1, 1, 1]}})];
+ assert_eq!(parts_box(&found), Some(([0.0, 0.0, 0.0], [1.0, 1.0, 1.0])));
+ // a room with a ceiling is seen from inside: every camera within its walls and under its ceiling
+ let room = vec![json!({"box": {"min": [-5, 0, -5], "max": [5, 0.1, 5]}}), json!({"box": {"min": [-5, 2.9, -5], "max": [5, 3, 5]}}), json!({"box": {"min": [0, 0, 0], "max": [1, 1, 1]}})];
+ let (lo, hi) = whole(&boxes_of(&room)).unwrap();
+ let ceil = ceiling(&boxes_of(&room), lo, hi).expect("a ceiling");
+ assert_eq!(ceil, 2.9);
+ for (_, eye, _, _) in inside(lo, hi, ceil) {
+ assert!((0..3).all(|k| eye[k] > lo[k] && eye[k] < hi[k]) && eye[1] < ceil, "{eye:?}");
+ }
+ assert!(ceiling(&boxes_of(&found), [0.0; 3], [1.0; 3]).is_none());
+ }
+}
diff --git a/core/scene/src/props.rs b/core/scene/src/props.rs
index 02a4393a..82ab0974 100644
--- a/core/scene/src/props.rs
+++ b/core/scene/src/props.rs
@@ -106,7 +106,7 @@ pub const EV100: f64 = 9.7;
/// column: the props present, colours as hex (raea-sys-material's fields.rs reads them).
pub fn fields_of(p: &Map<String, Value>) -> Option<String> {
let mut o = Map::new();
- for k in ["specularTint", "anisotropy", "attenuation", "parallax", "depthBias", "fog", "uvTransform", "renderMethod", "diffuseTransmission"] {
+ for k in ["specularTint", "anisotropy", "attenuation", "parallax", "depthBias", "fog", "uvTransform", "renderMethod", "diffuseTransmission", "lightmapExposure"] {
let Some(v) = p.get(k) else { continue };
let v = match (k, v) {
("specularTint", _) => Value::String(hex(Some(v))?),
diff --git a/core/sdf/Cargo.toml b/core/sdf/Cargo.toml
new file mode 100644
index 00000000..30573ec6
--- /dev/null
+++ b/core/sdf/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "raea-core-sdf"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "Organic solids as signed distance fields: round cones, tubes and blobs blended smoothly (smooth union, subtract, intersect), shelled, rounded and displaced, meshed watertight by marching tetrahedra"
+
+[dependencies]
diff --git a/core/sdf/src/lib.rs b/core/sdf/src/lib.rs
new file mode 100644
index 00000000..7b249ddb
--- /dev/null
+++ b/core/sdf/src/lib.rs
@@ -0,0 +1,67 @@
+//! Organic solids as signed distance fields (docs/handoff/solids.md, "Growth for organic shapes"; the 11-06 research:
+//! a plain union of spheres and cylinders tops out at tubes-and-balls, smooth unions are what make a creature, a
+//! limb or a branch read as one thing). A field is a tree of primitives (sphere, box, round cone, tube, torus,
+//! ellipsoid), blends (union, smooth union, subtract, intersect, each smooth with a reach k), and modifiers (move,
+//! rotate, scale, mirror, round, shell, displace by fractal noise). `mesh` samples it on a grid and makes a closed
+//! triangle mesh by marching tetrahedra, which raea-core-shape turns into a Manifold solid (`sdf("...", step)`), so a
+//! blended creature can still be cut, unioned and measured like any solid.
+//!
+//! Frame: the scene's (y up), metres; a cylinder stands along y and a torus lies flat in x-z.
+
+mod many;
+mod nets;
+mod node;
+mod noise;
+mod parse;
+
+pub use node::{Node, Rot, V, dot, len, smin};
+pub use noise::{fbm, noise};
+pub use parse::parse;
+
+/// How fine a field is meshed: its cell size (metres), from the size it spans when not given.
+pub fn step_for(node: &Node, step: Option<f64>) -> f64 {
+ let (lo, hi) = node.bounds();
+ let span = (hi[0] - lo[0]).max(hi[1] - lo[1]).max(hi[2] - lo[2]).max(1e-6);
+ step.filter(|s| *s > 0.0).unwrap_or(span / 96.0)
+}
+
+/// The most cells a field may be meshed in (about 330 a side): beyond it the step is too fine for the size.
+pub const MAX_CELLS: usize = 36_000_000;
+
+/// A closed mesh of the field's surface: positions flat (x y z) and triangles by threes, wound outward.
+pub fn mesh(node: &Node, step: Option<f64>) -> Result<(Vec<f32>, Vec<u32>), String> {
+ let h = step_for(node, step);
+ let (lo, hi) = node.bounds();
+ let pad = 2.0 * h;
+ let min = [lo[0] - pad, lo[1] - pad, lo[2] - pad];
+ let n = [((hi[0] - lo[0] + 2.0 * pad) / h).ceil() as usize + 1, ((hi[1] - lo[1] + 2.0 * pad) / h).ceil() as usize + 1, ((hi[2] - lo[2] + 2.0 * pad) / h).ceil() as usize + 1];
+ let cells = n[0] * n[1] * n[2];
+ if cells > MAX_CELLS {
+ return Err(format!("sdf: a step of {h} m over {:.2} x {:.2} x {:.2} m is {cells} cells (most {MAX_CELLS}): use a coarser step, or mesh the parts apart", hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]));
+ }
+ let g = nets::Grid { min, h, n };
+ // a union of many parts reads only the parts near each sample
+ let band = 4.0 * h;
+ let many = match node {
+ Node::Union(c) if c.len() > 24 => Some(many::Many::new(c.clone(), 0.0, band)),
+ Node::SmoothUnion(k, c) if c.len() > 24 => Some(many::Many::new(c.clone(), *k, band)),
+ _ => None,
+ };
+ let v = match &many {
+ Some(m) => nets::sample(&g, &|p| m.d(p)),
+ None => nets::sample(&g, &|p| node.d(p)),
+ };
+ let (verts, tris) = nets::mesh(&g, &v);
+ if tris.is_empty() {
+ return Err("sdf: the field has no surface (everything outside, or a step coarser than its parts)".into());
+ }
+ Ok((verts, tris))
+}
+
+/// `parse` then `mesh`.
+pub fn mesh_text(text: &str, step: Option<f64>) -> Result<(Vec<f32>, Vec<u32>), String> {
+ mesh(&parse(text)?, step)
+}
+
+#[cfg(test)]
+mod tests;
diff --git a/core/sdf/src/many.rs b/core/sdf/src/many.rs
new file mode 100644
index 00000000..1509f680
--- /dev/null
+++ b/core/sdf/src/many.rs
@@ -0,0 +1,50 @@
+//! A union of many parts (a tree's thousand branches, a bush's leaves) answered from the few near the point: their
+//! boxes hashed into a grid, so a sample reads only the parts whose reach covers its cell. Far from every part the
+//! field is `far` (positive), which is all a mesher needs there.
+
+use std::collections::HashMap;
+
+use crate::node::{Node, V, smin};
+
+pub struct Many {
+ parts: Vec<Node>,
+ k: f64,
+ cell: f64,
+ cells: HashMap<(i32, i32, i32), Vec<u32>>,
+ far: f64,
+}
+
+impl Many {
+ /// `band`: how far from the surface distances must be right (a few mesh cells).
+ pub fn new(parts: Vec<Node>, k: f64, band: f64) -> Many {
+ let reach = k + band;
+ let boxes: Vec<(V, V)> = parts.iter().map(|p| p.bounds()).collect();
+ // a cell about the size of a typical part, and never so small that one part fills thousands
+ let mut sizes: Vec<f64> = boxes.iter().map(|(lo, hi)| (hi[0] - lo[0]).max(hi[1] - lo[1]).max(hi[2] - lo[2]) + 2.0 * reach).collect();
+ sizes.sort_by(f64::total_cmp);
+ let cell = sizes.get(sizes.len() / 2).copied().unwrap_or(1.0).max(1e-6);
+ let mut cells: HashMap<(i32, i32, i32), Vec<u32>> = HashMap::new();
+ for (i, (lo, hi)) in boxes.iter().enumerate() {
+ let a = [((lo[0] - reach) / cell).floor() as i32, ((lo[1] - reach) / cell).floor() as i32, ((lo[2] - reach) / cell).floor() as i32];
+ let b = [((hi[0] + reach) / cell).floor() as i32, ((hi[1] + reach) / cell).floor() as i32, ((hi[2] + reach) / cell).floor() as i32];
+ for x in a[0]..=b[0] {
+ for y in a[1]..=b[1] {
+ for z in a[2]..=b[2] {
+ cells.entry((x, y, z)).or_default().push(i as u32);
+ }
+ }
+ }
+ }
+ Many { parts, k, cell, cells, far: reach }
+ }
+
+ pub fn d(&self, p: V) -> f64 {
+ let key = ((p[0] / self.cell).floor() as i32, (p[1] / self.cell).floor() as i32, (p[2] / self.cell).floor() as i32);
+ let Some(near) = self.cells.get(&key) else { return self.far };
+ let mut d = self.far;
+ for &i in near {
+ d = smin(d, self.parts[i as usize].d(p), self.k);
+ }
+ d
+ }
+}
diff --git a/core/sdf/src/nets.rs b/core/sdf/src/nets.rs
new file mode 100644
index 00000000..18e16fcd
--- /dev/null
+++ b/core/sdf/src/nets.rs
@@ -0,0 +1,165 @@
+//! A distance field sampled on a grid and meshed by marching tetrahedra (see `mesh`). The grid is padded so the surface never meets its border,
+//! which keeps the mesh closed. Blocks far from the surface are skipped from a coarse pass (the field changes by at
+//! most about its distance, so a block whose corners are all far is all outside or all inside).
+
+use crate::node::V;
+
+pub struct Grid {
+ pub min: V,
+ pub h: f64,
+ pub n: [usize; 3],
+}
+
+impl Grid {
+ fn at(&self, i: usize, j: usize, k: usize) -> V {
+ [self.min[0] + i as f64 * self.h, self.min[1] + j as f64 * self.h, self.min[2] + k as f64 * self.h]
+ }
+ fn idx(&self, i: usize, j: usize, k: usize) -> usize {
+ i + self.n[0] * (j + self.n[1] * k)
+ }
+}
+
+/// The field sampled on the grid's points, across threads, skipping far blocks.
+pub fn sample(g: &Grid, f: &(dyn Fn(V) -> f64 + Sync)) -> Vec<f32> {
+ const B: usize = 4;
+ let [nx, ny, nz] = g.n;
+ let threads = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(4).clamp(1, 12);
+ // the coarse pass: every B-th point
+ let (cx, cy, cz) = ((nx - 1) / B + 2, (ny - 1) / B + 2, (nz - 1) / B + 2);
+ let coarse: Vec<f64> = par(cz, threads, |k| {
+ let mut row = Vec::with_capacity(cx * cy);
+ for j in 0..cy {
+ for i in 0..cx {
+ row.push(f(g.at(i * B, j * B, k * B)));
+ }
+ }
+ row
+ });
+ let reach = g.h * B as f64 * 3f64.sqrt() * 1.5;
+ let fine: Vec<f32> = par(nz, threads, |k| {
+ let mut out = vec![0f32; nx * ny];
+ let bk = k / B;
+ for j in 0..ny {
+ let bj = j / B;
+ for i in 0..nx {
+ let bi = i / B;
+ let c = |a: usize, b: usize, cc: usize| coarse[(bi + a).min(cx - 1) + cx * ((bj + b).min(cy - 1) + cy * (bk + cc).min(cz - 1))];
+ let corners = [c(0, 0, 0), c(1, 0, 0), c(0, 1, 0), c(1, 1, 0), c(0, 0, 1), c(1, 0, 1), c(0, 1, 1), c(1, 1, 1)];
+ let all_out = corners.iter().all(|&d| d > reach);
+ let all_in = corners.iter().all(|&d| d < -reach);
+ out[i + nx * j] = if all_out {
+ reach as f32
+ } else if all_in {
+ -reach as f32
+ } else {
+ f(g.at(i, j, k)) as f32
+ };
+ }
+ }
+ out
+ });
+ // the border is outside, so the mesh closes
+ let mut v = fine;
+ for k in 0..nz {
+ for j in 0..ny {
+ for i in 0..nx {
+ if i == 0 || j == 0 || k == 0 || i == nx - 1 || j == ny - 1 || k == nz - 1 {
+ let x = g.idx(i, j, k);
+ v[x] = v[x].abs().max(g.h as f32);
+ }
+ }
+ }
+ }
+ v
+}
+
+/// Rows 0..n made by `f` on `threads` threads, joined in order.
+fn par<T: Send, F: Fn(usize) -> Vec<T> + Sync>(n: usize, threads: usize, f: F) -> Vec<T> {
+ let per = n.div_ceil(threads.max(1));
+ std::thread::scope(|s| {
+ let hs: Vec<_> = (0..threads).map(|t| {
+ let f = &f;
+ s.spawn(move || (t * per..((t + 1) * per).min(n)).flat_map(f).collect::<Vec<T>>())
+ }).collect();
+ hs.into_iter().flat_map(|h| h.join().unwrap()).collect()
+ })
+}
+
+/// The mesh: positions flat (x y z) and triangles by threes, wound outward. Marching tetrahedra: each cell cut into
+/// six tetrahedra along its main diagonal (the same cut in every cell, so neighbours share their faces' splits), and
+/// the field taken as linear inside each: the surface of a piecewise-linear field over tetrahedra is always a closed
+/// 2-manifold, which Manifold needs (surface nets join two sheets at a vertex where a thin part pinches).
+pub fn mesh(g: &Grid, v: &[f32]) -> (Vec<f32>, Vec<u32>) {
+ let [nx, ny, nz] = g.n;
+ // no sample exactly on the surface: a zero would put a vertex on a grid point, shared by sheets
+ let val = |i: usize| { let x = v[i]; if x == 0.0 { 1e-9 } else { x } };
+ let mut verts: Vec<f32> = Vec::new();
+ let mut at: std::collections::HashMap<(u32, u32), u32> = std::collections::HashMap::new();
+ let mut tris: Vec<u32> = Vec::new();
+ const TETS: [[usize; 4]; 6] = [[0, 1, 3, 7], [0, 1, 5, 7], [0, 2, 3, 7], [0, 2, 6, 7], [0, 4, 5, 7], [0, 4, 6, 7]];
+ let pos = |i: usize| { let x = i % nx; let y = (i / nx) % ny; let z = i / (nx * ny); g.at(x, y, z) };
+ let mut vert = |a: usize, b: usize, verts: &mut Vec<f32>| -> u32 {
+ let key = (a.min(b) as u32, a.max(b) as u32);
+ if let Some(&k) = at.get(&key) {
+ return k;
+ }
+ let (fa, fb) = (val(a) as f64, val(b) as f64);
+ let t = fa / (fa - fb);
+ let (pa, pb) = (pos(a), pos(b));
+ let k = (verts.len() / 3) as u32;
+ for q in 0..3 {
+ verts.push((pa[q] + t * (pb[q] - pa[q])) as f32);
+ }
+ at.insert(key, k);
+ k
+ };
+ for k in 0..nz - 1 {
+ for j in 0..ny - 1 {
+ for i in 0..nx - 1 {
+ let c = |b: usize| g.idx(i + (b & 1), j + ((b >> 1) & 1), k + ((b >> 2) & 1));
+ let corners = [c(0), c(1), c(2), c(3), c(4), c(5), c(6), c(7)];
+ let inside = corners.iter().filter(|&&x| val(x) < 0.0).count();
+ if inside == 0 || inside == 8 {
+ continue;
+ }
+ for tet in TETS {
+ // corners by their place in the cell (bits x, y, z), split inside and outside
+ let (ins, outs): (Vec<usize>, Vec<usize>) = tet.iter().partition(|&&b| val(corners[b]) < 0.0);
+ let g = |b: usize| corners[b];
+ let mut emit = |tri: [u32; 3], keep: bool| if keep { tris.extend(tri) } else { tris.extend([tri[0], tri[2], tri[1]]) };
+ // winding from the sign of the corners' determinant, exact on the cell's integer offsets (a
+ // triangle's own normal flips on slivers, which breaks the halfedge pairing Manifold checks)
+ match ins.len() {
+ 1 => {
+ let a = ins[0];
+ let t = [vert(g(a), g(outs[0]), &mut verts), vert(g(a), g(outs[1]), &mut verts), vert(g(a), g(outs[2]), &mut verts)];
+ emit(t, det(outs[0], outs[1], outs[2], a) > 0);
+ }
+ 3 => {
+ let o = outs[0];
+ let t = [vert(g(ins[0]), g(o), &mut verts), vert(g(ins[1]), g(o), &mut verts), vert(g(ins[2]), g(o), &mut verts)];
+ emit(t, det(ins[0], ins[1], ins[2], o) < 0);
+ }
+ 2 => {
+ let (a, b) = (ins[0], ins[1]);
+ let (c0, d0) = (outs[0], outs[1]);
+ let q = [vert(g(a), g(c0), &mut verts), vert(g(a), g(d0), &mut verts), vert(g(b), g(d0), &mut verts), vert(g(b), g(c0), &mut verts)];
+ let keep = det(b, c0, d0, a) > 0;
+ emit([q[0], q[1], q[2]], keep);
+ emit([q[0], q[2], q[3]], keep);
+ }
+ _ => {}
+ }
+ }
+ }
+ }
+ }
+ (verts, tris)
+}
+
+/// det(p - o, q - o, r - o) over the cell's corners as integer offsets (bit 0 x, bit 1 y, bit 2 z).
+fn det(p: usize, q: usize, r: usize, o: usize) -> i32 {
+ let off = |b: usize, o: usize| [(b & 1) as i32 - (o & 1) as i32, ((b >> 1) & 1) as i32 - ((o >> 1) & 1) as i32, ((b >> 2) & 1) as i32 - ((o >> 2) & 1) as i32];
+ let (u, v, w) = (off(p, o), off(q, o), off(r, o));
+ u[0] * (v[1] * w[2] - v[2] * w[1]) - u[1] * (v[0] * w[2] - v[2] * w[0]) + u[2] * (v[0] * w[1] - v[1] * w[0])
+}
diff --git a/core/sdf/src/node.rs b/core/sdf/src/node.rs
new file mode 100644
index 00000000..f24ec8eb
--- /dev/null
+++ b/core/sdf/src/node.rs
@@ -0,0 +1,222 @@
+//! The distance field's tree: primitives, blends and modifiers, each with its bounds and its distance at a point.
+
+use crate::noise::fbm;
+
+pub type V = [f64; 3];
+
+fn sub(a: V, b: V) -> V {
+ [a[0] - b[0], a[1] - b[1], a[2] - b[2]]
+}
+pub fn dot(a: V, b: V) -> f64 {
+ a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
+}
+pub fn len(a: V) -> f64 {
+ dot(a, a).sqrt()
+}
+
+/// A rotation as a 3x3 matrix (rows), from x, y, z degrees applied in that order (as Manifold's rotate).
+#[derive(Clone, Copy, Debug)]
+pub struct Rot(pub [[f64; 3]; 3]);
+
+impl Rot {
+ pub fn degrees(x: f64, y: f64, z: f64) -> Rot {
+ let (sx, cx) = x.to_radians().sin_cos();
+ let (sy, cy) = y.to_radians().sin_cos();
+ let (sz, cz) = z.to_radians().sin_cos();
+ let rx = [[1.0, 0.0, 0.0], [0.0, cx, -sx], [0.0, sx, cx]];
+ let ry = [[cy, 0.0, sy], [0.0, 1.0, 0.0], [-sy, 0.0, cy]];
+ let rz = [[cz, -sz, 0.0], [sz, cz, 0.0], [0.0, 0.0, 1.0]];
+ let m = |a: [[f64; 3]; 3], b: [[f64; 3]; 3]| {
+ let mut o = [[0.0; 3]; 3];
+ for (i, row) in o.iter_mut().enumerate() {
+ for (j, v) in row.iter_mut().enumerate() {
+ *v = (0..3).map(|k| a[i][k] * b[k][j]).sum();
+ }
+ }
+ o
+ };
+ Rot(m(rz, m(ry, rx)))
+ }
+ pub fn apply(&self, p: V) -> V {
+ let m = &self.0;
+ [dot(m[0], p), dot(m[1], p), dot(m[2], p)]
+ }
+ /// the inverse (the transpose, for a rotation)
+ pub fn back(&self, p: V) -> V {
+ let m = &self.0;
+ [m[0][0] * p[0] + m[1][0] * p[1] + m[2][0] * p[2], m[0][1] * p[0] + m[1][1] * p[1] + m[2][1] * p[2], m[0][2] * p[0] + m[1][2] * p[1] + m[2][2] * p[2]]
+ }
+}
+
+#[derive(Clone, Debug)]
+pub enum Node {
+ Sphere(f64),
+ /// width, height, depth, edge radius
+ Box(V, f64),
+ /// a cylinder along y: radius, height
+ Cylinder(f64, f64),
+ /// a ring in the x-z plane (lying flat): major, minor radius
+ Torus(f64, f64),
+ /// radii along x, y, z
+ Ellipsoid(V),
+ /// a round cone from a (radius ra) to b (radius rb): a capsule when ra = rb, a limb or a branch when they differ
+ Cone(V, V, f64, f64),
+ /// a polyline of round cones, each point with its radius: a tube, a tentacle, a root, a stem
+ Tube(Vec<(V, f64)>),
+ Union(Vec<Node>),
+ /// blended joins: k is how far the blend reaches (metres)
+ SmoothUnion(f64, Vec<Node>),
+ Subtract(Box<Node>, Box<Node>),
+ SmoothSubtract(f64, Box<Node>, Box<Node>),
+ Intersect(Vec<Node>),
+ SmoothIntersect(f64, Vec<Node>),
+ Move(Box<Node>, V),
+ Rotate(Box<Node>, Rot),
+ Scale(Box<Node>, f64),
+ /// the x < 0 half mirrored from the x > 0 half: a face, a body, a vase's symmetry
+ MirrorX(Box<Node>),
+ /// grown by r (rounded): every edge rounded by r
+ Round(Box<Node>, f64),
+ /// a skin of thickness t (hollow, open nowhere)
+ Shell(Box<Node>, f64),
+ /// the surface moved by fractal noise: amplitude (m), frequency (per m), octaves, seed
+ Displace(Box<Node>, f64, f64, u32, u32),
+}
+
+/// A smooth minimum (polynomial, Inigo Quilez's): equal to min far from the join, rounded within k of it.
+pub fn smin(a: f64, b: f64, k: f64) -> f64 {
+ if k <= 0.0 {
+ return a.min(b);
+ }
+ let h = (k - (a - b).abs()).max(0.0) / k;
+ a.min(b) - h * h * k * 0.25
+}
+
+fn cone(p: V, a: V, b: V, ra: f64, rb: f64) -> f64 {
+ // a round cone between two spheres (IQ's exact form)
+ let ba = sub(b, a);
+ let l2 = dot(ba, ba);
+ if l2 < 1e-18 {
+ return len(sub(p, a)) - ra.max(rb);
+ }
+ let rr = ra - rb;
+ let a2 = l2 - rr * rr;
+ let il2 = 1.0 / l2;
+ let pa = sub(p, a);
+ let y = dot(pa, ba);
+ let z = y - l2;
+ let xv = [pa[0] * l2 - ba[0] * y, pa[1] * l2 - ba[1] * y, pa[2] * l2 - ba[2] * y];
+ let x2 = dot(xv, xv);
+ let y2 = y * y * l2;
+ let z2 = z * z * l2;
+ let k = rr.signum() * rr * rr * x2;
+ if z.signum() * a2 * z2 > k {
+ return (x2 + z2).sqrt() * il2 - rb;
+ }
+ if y.signum() * a2 * y2 < k {
+ return (x2 + y2).sqrt() * il2 - ra;
+ }
+ ((x2 * a2 * il2).sqrt() + y * rr) * il2 - ra
+}
+
+impl Node {
+ /// The distance from p to the surface (negative inside). Exact for primitives, a bound for blends.
+ pub fn d(&self, p: V) -> f64 {
+ match self {
+ Node::Sphere(r) => len(p) - r,
+ Node::Box(s, r) => {
+ let q = [p[0].abs() - s[0] / 2.0 + r, p[1].abs() - s[1] / 2.0 + r, p[2].abs() - s[2] / 2.0 + r];
+ len([q[0].max(0.0), q[1].max(0.0), q[2].max(0.0)]) + q[0].max(q[1]).max(q[2]).min(0.0) - r
+ }
+ Node::Cylinder(r, h) => {
+ let d = [(p[0] * p[0] + p[2] * p[2]).sqrt() - r, p[1].abs() - h / 2.0];
+ d[0].max(d[1]).min(0.0) + (d[0].max(0.0).powi(2) + d[1].max(0.0).powi(2)).sqrt()
+ }
+ Node::Torus(big, small) => {
+ let q = (p[0] * p[0] + p[2] * p[2]).sqrt() - big;
+ (q * q + p[1] * p[1]).sqrt() - small
+ }
+ Node::Ellipsoid(r) => {
+ let k0 = len([p[0] / r[0], p[1] / r[1], p[2] / r[2]]);
+ let k1 = len([p[0] / (r[0] * r[0]), p[1] / (r[1] * r[1]), p[2] / (r[2] * r[2])]);
+ if k1 < 1e-12 { -r[0].min(r[1]).min(r[2]) } else { k0 * (k0 - 1.0) / k1 }
+ }
+ Node::Cone(a, b, ra, rb) => cone(p, *a, *b, *ra, *rb),
+ Node::Tube(pts) => pts.windows(2).map(|w| cone(p, w[0].0, w[1].0, w[0].1, w[1].1)).fold(f64::MAX, f64::min),
+ Node::Union(c) => c.iter().map(|n| n.d(p)).fold(f64::MAX, f64::min),
+ Node::SmoothUnion(k, c) => c.iter().map(|n| n.d(p)).reduce(|a, b| smin(a, b, *k)).unwrap_or(f64::MAX),
+ Node::Subtract(a, b) => a.d(p).max(-b.d(p)),
+ Node::SmoothSubtract(k, a, b) => -smin(-a.d(p), b.d(p), *k),
+ Node::Intersect(c) => c.iter().map(|n| n.d(p)).fold(f64::MIN, f64::max),
+ Node::SmoothIntersect(k, c) => c.iter().map(|n| n.d(p)).reduce(|a, b| -smin(-a, -b, *k)).unwrap_or(f64::MAX),
+ Node::Move(n, t) => n.d(sub(p, *t)),
+ Node::Rotate(n, r) => n.d(r.back(p)),
+ Node::Scale(n, s) => n.d([p[0] / s, p[1] / s, p[2] / s]) * s,
+ Node::MirrorX(n) => n.d([p[0].abs(), p[1], p[2]]),
+ Node::Round(n, r) => n.d(p) - r,
+ Node::Shell(n, t) => n.d(p).abs() - t,
+ Node::Displace(n, amp, freq, oct, seed) => n.d(p) + amp * fbm([p[0] * freq, p[1] * freq, p[2] * freq], *oct, *seed),
+ }
+ }
+
+ /// A box holding the surface: (min, max).
+ pub fn bounds(&self) -> (V, V) {
+ let cube = |r: f64| ([-r, -r, -r], [r, r, r]);
+ let grow = |(lo, hi): (V, V), g: f64| ([lo[0] - g, lo[1] - g, lo[2] - g], [hi[0] + g, hi[1] + g, hi[2] + g]);
+ let join = |v: &[Node]| v.iter().map(|n| n.bounds()).reduce(|(a, b), (c, d)| ([a[0].min(c[0]), a[1].min(c[1]), a[2].min(c[2])], [b[0].max(d[0]), b[1].max(d[1]), b[2].max(d[2])])).unwrap_or(([0.0; 3], [0.0; 3]));
+ match self {
+ Node::Sphere(r) => cube(*r),
+ Node::Box(s, _) => ([-s[0] / 2.0, -s[1] / 2.0, -s[2] / 2.0], [s[0] / 2.0, s[1] / 2.0, s[2] / 2.0]),
+ Node::Cylinder(r, h) => ([-r, -h / 2.0, -r], [*r, h / 2.0, *r]),
+ Node::Torus(a, b) => ([-a - b, -b, -a - b], [a + b, *b, a + b]),
+ Node::Ellipsoid(r) => ([-r[0], -r[1], -r[2]], *r),
+ Node::Cone(a, b, ra, rb) => {
+ let r = ra.max(*rb);
+ ([a[0].min(b[0]) - r, a[1].min(b[1]) - r, a[2].min(b[2]) - r], [a[0].max(b[0]) + r, a[1].max(b[1]) + r, a[2].max(b[2]) + r])
+ }
+ Node::Tube(pts) => {
+ let mut lo = [f64::MAX; 3];
+ let mut hi = [f64::MIN; 3];
+ for (q, r) in pts {
+ for k in 0..3 {
+ lo[k] = lo[k].min(q[k] - r);
+ hi[k] = hi[k].max(q[k] + r);
+ }
+ }
+ (lo, hi)
+ }
+ Node::Union(c) | Node::Intersect(c) | Node::SmoothIntersect(_, c) => join(c),
+ Node::SmoothUnion(k, c) => grow(join(c), k * 0.25),
+ Node::Subtract(a, _) | Node::SmoothSubtract(_, a, _) => a.bounds(),
+ Node::Move(n, t) => {
+ let (lo, hi) = n.bounds();
+ ([lo[0] + t[0], lo[1] + t[1], lo[2] + t[2]], [hi[0] + t[0], hi[1] + t[1], hi[2] + t[2]])
+ }
+ Node::Rotate(n, r) => {
+ let (lo, hi) = n.bounds();
+ let mut a = [f64::MAX; 3];
+ let mut b = [f64::MIN; 3];
+ for i in 0..8 {
+ let c = r.apply([if i & 1 == 0 { lo[0] } else { hi[0] }, if i & 2 == 0 { lo[1] } else { hi[1] }, if i & 4 == 0 { lo[2] } else { hi[2] }]);
+ for k in 0..3 {
+ a[k] = a[k].min(c[k]);
+ b[k] = b[k].max(c[k]);
+ }
+ }
+ (a, b)
+ }
+ Node::Scale(n, s) => {
+ let (lo, hi) = n.bounds();
+ ([lo[0] * s, lo[1] * s, lo[2] * s], [hi[0] * s, hi[1] * s, hi[2] * s])
+ }
+ Node::MirrorX(n) => {
+ let (lo, hi) = n.bounds();
+ let x = lo[0].abs().max(hi[0].abs());
+ ([-x, lo[1], lo[2]], [x, hi[1], hi[2]])
+ }
+ Node::Round(n, r) => grow(n.bounds(), *r),
+ Node::Shell(n, t) => grow(n.bounds(), *t),
+ Node::Displace(n, amp, ..) => grow(n.bounds(), amp.abs()),
+ }
+ }
+}
diff --git a/core/sdf/src/noise.rs b/core/sdf/src/noise.rs
new file mode 100644
index 00000000..ce34c2ae
--- /dev/null
+++ b/core/sdf/src/noise.rs
@@ -0,0 +1,36 @@
+//! Seeded value noise in 3D and its fractal sum: the same seed gives the same surface, every run.
+
+fn hash(x: i32, y: i32, z: i32, seed: u32) -> f64 {
+ let mut h = (x as u32).wrapping_mul(0x8da6b343) ^ (y as u32).wrapping_mul(0xd8163841) ^ (z as u32).wrapping_mul(0xcb1ab31f) ^ seed.wrapping_mul(0x9e3779b9);
+ h ^= h >> 13;
+ h = h.wrapping_mul(0x5bd1e995);
+ h ^= h >> 15;
+ (h as f64 / u32::MAX as f64) * 2.0 - 1.0
+}
+
+/// Smooth value noise in [-1, 1].
+pub fn noise(p: [f64; 3], seed: u32) -> f64 {
+ let i = [p[0].floor(), p[1].floor(), p[2].floor()];
+ let f = [p[0] - i[0], p[1] - i[1], p[2] - i[2]];
+ let s = f.map(|t| t * t * (3.0 - 2.0 * t));
+ let (x, y, z) = (i[0] as i32, i[1] as i32, i[2] as i32);
+ let mut acc = 0.0;
+ for c in 0..8 {
+ let (dx, dy, dz) = (c & 1, (c >> 1) & 1, (c >> 2) & 1);
+ let w = (if dx == 1 { s[0] } else { 1.0 - s[0] }) * (if dy == 1 { s[1] } else { 1.0 - s[1] }) * (if dz == 1 { s[2] } else { 1.0 - s[2] });
+ acc += w * hash(x + dx, y + dy, z + dz, seed);
+ }
+ acc
+}
+
+/// Fractal noise: `octaves` layers, each twice the frequency and half the amplitude, summed to about [-1, 1].
+pub fn fbm(p: [f64; 3], octaves: u32, seed: u32) -> f64 {
+ let (mut sum, mut amp, mut norm, mut q) = (0.0, 1.0, 0.0, p);
+ for o in 0..octaves.clamp(1, 8) {
+ sum += amp * noise(q, seed.wrapping_add(o * 1013));
+ norm += amp;
+ amp *= 0.5;
+ q = [q[0] * 2.03 + 17.1, q[1] * 2.03 - 4.7, q[2] * 2.03 + 9.3];
+ }
+ sum / norm
+}
diff --git a/core/sdf/src/parse.rs b/core/sdf/src/parse.rs
new file mode 100644
index 00000000..83360a07
--- /dev/null
+++ b/core/sdf/src/parse.rs
@@ -0,0 +1,139 @@
+//! The field written as calls, as raea's shape expressions are: `smooth_union(0.04, sphere(0.3), move(cone(0, 0, 0,
+//! 0, 0.6, 0, 0.12, 0.05), 0, 0.2, 0))`. Numbers in metres and degrees.
+
+use crate::node::{Node, Rot};
+
+enum A {
+ N(f64),
+ S(Node),
+}
+
+impl A {
+ fn shape(self) -> Option<Node> {
+ if let A::S(s) = self { Some(s) } else { None }
+ }
+}
+
+struct P<'a> {
+ s: &'a [u8],
+ i: usize,
+}
+
+impl P<'_> {
+ fn ws(&mut self) {
+ while self.i < self.s.len() && self.s[self.i].is_ascii_whitespace() {
+ self.i += 1;
+ }
+ }
+ fn eat(&mut self, c: u8) -> bool {
+ self.ws();
+ if self.s.get(self.i) == Some(&c) {
+ self.i += 1;
+ true
+ } else {
+ false
+ }
+ }
+ fn arg(&mut self) -> Result<A, String> {
+ self.ws();
+ let start = self.i;
+ let c = *self.s.get(self.i).ok_or("sdf: the field ends too early")?;
+ if c.is_ascii_digit() || c == b'-' || c == b'.' || c == b'+' {
+ self.i += 1;
+ while self.i < self.s.len() && (self.s[self.i].is_ascii_digit() || matches!(self.s[self.i], b'.' | b'e' | b'E') || (matches!(self.s[self.i], b'-' | b'+') && matches!(self.s[self.i - 1], b'e' | b'E'))) {
+ self.i += 1;
+ }
+ let t = std::str::from_utf8(&self.s[start..self.i]).unwrap_or("");
+ return t.parse().map(A::N).map_err(|_| format!("sdf: not a number: {t}"));
+ }
+ while self.i < self.s.len() && (self.s[self.i].is_ascii_alphanumeric() || self.s[self.i] == b'_') {
+ self.i += 1;
+ }
+ let name = std::str::from_utf8(&self.s[start..self.i]).unwrap_or("").to_string();
+ if name.is_empty() {
+ return Err(format!("sdf: unexpected {:?}", c as char));
+ }
+ if !self.eat(b'(') {
+ return Err(format!("sdf: {name} takes arguments: {name}(...)"));
+ }
+ let mut args = Vec::new();
+ if !self.eat(b')') {
+ loop {
+ args.push(self.arg()?);
+ if self.eat(b',') {
+ continue;
+ }
+ if self.eat(b')') {
+ break;
+ }
+ return Err(format!("sdf: {name}(...): a comma or a closing parenthesis"));
+ }
+ }
+ node(&name, args).map(A::S)
+ }
+}
+
+fn node(f: &str, a: Vec<A>) -> Result<Node, String> {
+ let n: Vec<f64> = a.iter().filter_map(|x| if let A::N(v) = x { Some(*v) } else { None }).collect();
+ let mut kids: Vec<Node> = a.into_iter().filter_map(A::shape).collect();
+ let need = |k: usize| -> Result<(), String> { if n.len() < k { Err(format!("sdf: {f} needs {k} numbers, got {}", n.len())) } else { Ok(()) } };
+ let one = |kids: &mut Vec<Node>| -> Result<Box<Node>, String> { if kids.is_empty() { Err(format!("sdf: {f} needs a field")) } else { Ok(Box::new(kids.remove(0))) } };
+ let pos = |x: f64| -> Result<f64, String> { if x > 0.0 && x.is_finite() { Ok(x) } else { Err(format!("sdf: {f}: sizes must be above 0, got {x}")) } };
+ Ok(match f {
+ "sphere" => { need(1)?; Node::Sphere(pos(n[0])?) }
+ "box" => { need(3)?; Node::Box([pos(n[0])?, pos(n[1])?, pos(n[2])?], n.get(3).copied().unwrap_or(0.0).clamp(0.0, n[0].min(n[1]).min(n[2]) / 2.0)) }
+ "cylinder" => { need(2)?; Node::Cylinder(pos(n[0])?, pos(n[1])?) }
+ "torus" => { need(2)?; Node::Torus(pos(n[0])?, pos(n[1])?) }
+ "ellipsoid" => { need(3)?; Node::Ellipsoid([pos(n[0])?, pos(n[1])?, pos(n[2])?]) }
+ // cone(ax, ay, az, bx, by, bz, ra [, rb]): rb = ra is a capsule
+ "cone" | "capsule" => { need(7)?; Node::Cone([n[0], n[1], n[2]], [n[3], n[4], n[5]], n[6].max(0.0), n.get(7).copied().unwrap_or(n[6]).max(0.0)) }
+ // tube(x, y, z, r, x, y, z, r, ...): two points or more
+ "tube" => {
+ if n.len() < 8 || n.len() % 4 != 0 {
+ return Err(format!("sdf: tube takes x, y, z, radius for each of 2 or more points, got {} numbers", n.len()));
+ }
+ Node::Tube(n.chunks(4).map(|c| ([c[0], c[1], c[2]], c[3].max(0.0))).collect())
+ }
+ "union" => Node::Union(nonempty(f, kids)?),
+ "smooth_union" => { need(1)?; Node::SmoothUnion(n[0].max(0.0), nonempty(f, kids)?) }
+ "intersect" => Node::Intersect(nonempty(f, kids)?),
+ "smooth_intersect" => { need(1)?; Node::SmoothIntersect(n[0].max(0.0), nonempty(f, kids)?) }
+ "subtract" | "minus" => {
+ if kids.len() < 2 { return Err(format!("sdf: {f}(a, b): two fields")); }
+ let b = kids.remove(1);
+ Node::Subtract(Box::new(kids.remove(0)), Box::new(b))
+ }
+ "smooth_subtract" | "smooth_minus" => {
+ need(1)?;
+ if kids.len() < 2 { return Err(format!("sdf: {f}(k, a, b): two fields")); }
+ let b = kids.remove(1);
+ Node::SmoothSubtract(n[0].max(0.0), Box::new(kids.remove(0)), Box::new(b))
+ }
+ "move" => { need(3)?; Node::Move(one(&mut kids)?, [n[0], n[1], n[2]]) }
+ "rotate" => { need(3)?; Node::Rotate(one(&mut kids)?, Rot::degrees(n[0], n[1], n[2])) }
+ "scale" => { need(1)?; Node::Scale(one(&mut kids)?, pos(n[0])?) }
+ "mirror_x" => Node::MirrorX(one(&mut kids)?),
+ "round" => { need(1)?; Node::Round(one(&mut kids)?, n[0]) }
+ "shell" => { need(1)?; Node::Shell(one(&mut kids)?, pos(n[0])?) }
+ // displace(field, amplitude, frequency [, octaves, seed])
+ "displace" => { need(2)?; Node::Displace(one(&mut kids)?, n[0], n[1], n.get(2).copied().unwrap_or(4.0) as u32, n.get(3).copied().unwrap_or(1.0) as u32) }
+ o => return Err(format!("sdf: no field {o}: sphere, box, cylinder, torus, ellipsoid, cone, capsule, tube, union, smooth_union, intersect, smooth_intersect, subtract, smooth_subtract, move, rotate, scale, mirror_x, round, shell, displace")),
+ })
+}
+
+fn nonempty(f: &str, v: Vec<Node>) -> Result<Vec<Node>, String> {
+ if v.is_empty() { Err(format!("sdf: {f} needs fields")) } else { Ok(v) }
+}
+
+pub fn parse(text: &str) -> Result<Node, String> {
+ let mut p = P { s: text.as_bytes(), i: 0 };
+ let a = p.arg()?;
+ p.ws();
+ if p.i < p.s.len() {
+ return Err(format!("sdf: unexpected {:?} after the field", &text[p.i..(p.i + 12).min(text.len())]));
+ }
+ match a {
+ A::S(n) => Ok(n),
+ A::N(_) => Err("sdf: a field, not a number".into()),
+ }
+}
diff --git a/core/sdf/src/tests.rs b/core/sdf/src/tests.rs
new file mode 100644
index 00000000..285afab0
--- /dev/null
+++ b/core/sdf/src/tests.rs
@@ -0,0 +1,93 @@
+use super::*;
+
+/// A closed mesh's volume (the divergence theorem over its triangles) and its open edges.
+fn volume_and_open(v: &[f32], t: &[u32]) -> (f64, usize) {
+ let p = |i: u32| [v[i as usize * 3] as f64, v[i as usize * 3 + 1] as f64, v[i as usize * 3 + 2] as f64];
+ let mut vol = 0.0;
+ let mut edges = std::collections::HashMap::new();
+ for c in t.chunks(3) {
+ let (a, b, d) = (p(c[0]), p(c[1]), p(c[2]));
+ vol += (a[0] * (b[1] * d[2] - b[2] * d[1]) - a[1] * (b[0] * d[2] - b[2] * d[0]) + a[2] * (b[0] * d[1] - b[1] * d[0])) / 6.0;
+ // directed: each halfedge once, and its reverse once (consistent winding, as Manifold checks)
+ for k in 0..3 {
+ let (x, y) = (c[k], c[(k + 1) % 3]);
+ *edges.entry((x, y)).or_insert(0i32) += 1;
+ }
+ }
+ let bad = edges.iter().filter(|((x, y), n)| **n != 1 || edges.get(&(*y, *x)) != Some(&1)).count();
+ (vol, bad)
+}
+
+#[test]
+fn a_sphere_is_closed_wound_outward_and_the_right_size() {
+ let (v, t) = mesh_text("sphere(0.5)", Some(0.02)).unwrap();
+ let (vol, open) = volume_and_open(&v, &t);
+ let want = 4.0 / 3.0 * std::f64::consts::PI * 0.125;
+ assert_eq!(open, 0);
+ assert!((vol - want).abs() / want < 0.02, "{vol} vs {want}");
+}
+
+#[test]
+fn smooth_union_fills_the_join_and_subtract_cuts() {
+ let hard = mesh_text("union(sphere(0.3), move(sphere(0.3), 0.45, 0, 0))", Some(0.015)).unwrap();
+ let soft = mesh_text("smooth_union(0.15, sphere(0.3), move(sphere(0.3), 0.45, 0, 0))", Some(0.015)).unwrap();
+ let (vh, _) = volume_and_open(&hard.0, &hard.1);
+ let (vs, open) = volume_and_open(&soft.0, &soft.1);
+ assert_eq!(open, 0);
+ // the blend adds material in the neck
+ assert!(vs > vh * 1.02, "{vs} vs {vh}");
+ let cut = mesh_text("subtract(box(1, 1, 1), cylinder(0.25, 2))", Some(0.02)).unwrap();
+ let (vc, open) = volume_and_open(&cut.0, &cut.1);
+ let want = 1.0 - std::f64::consts::PI * 0.0625;
+ assert_eq!(open, 0);
+ assert!((vc - want).abs() / want < 0.03, "{vc} vs {want}");
+}
+
+#[test]
+fn round_cones_tubes_and_modifiers() {
+ // a capsule 1 long, radius 0.1: a cylinder plus a sphere
+ let (v, t) = mesh_text("capsule(0, 0, 0, 0, 1, 0, 0.1)", Some(0.01)).unwrap();
+ let want = std::f64::consts::PI * 0.01 * 1.0 + 4.0 / 3.0 * std::f64::consts::PI * 0.001;
+ let (vol, _) = volume_and_open(&v, &t);
+ assert!((vol - want).abs() / want < 0.04, "{vol} vs {want}");
+ // a bent tube through three points stays one closed piece
+ let (v, t) = mesh_text("tube(0, 0, 0, 0.08, 0, 0.5, 0.1, 0.06, 0.3, 0.8, 0.1, 0.03)", Some(0.01)).unwrap();
+ assert_eq!(volume_and_open(&v, &t).1, 0);
+ // a shell is hollow: |d| - t is a skin 2t thick, 4 pi r^2 2t, far less than the full ball
+ let (v, t) = mesh_text("shell(sphere(0.4), 0.02)", Some(0.01)).unwrap();
+ let (vol, _) = volume_and_open(&v, &t);
+ let skin = 4.0 * std::f64::consts::PI * 0.16 * 0.04;
+ assert!((vol - skin).abs() / skin < 0.05, "{vol} vs {skin}");
+ // mirror_x makes both sides; rotate keeps the volume; displace roughens but stays closed
+ let (v, t) = mesh_text("mirror_x(move(sphere(0.2), 0.5, 0, 0))", Some(0.02)).unwrap();
+ let (vm, _) = volume_and_open(&v, &t);
+ assert!((vm - 2.0 * 4.0 / 3.0 * std::f64::consts::PI * 0.008).abs() < 0.004, "{vm}");
+ let (v, t) = mesh_text("displace(sphere(0.5), 0.03, 6, 3, 7)", Some(0.02)).unwrap();
+ assert_eq!(volume_and_open(&v, &t).1, 0);
+}
+
+#[test]
+fn many_parts_are_quick_and_match_the_plain_union() {
+ // 200 small spheres in a ring: the hashed union gives the same surface as the plain one
+ let parts: Vec<String> = (0..200).map(|i| {
+ let a = i as f64 / 200.0 * std::f64::consts::TAU;
+ format!("move(sphere(0.03), {}, {}, 0)", a.cos(), a.sin())
+ }).collect();
+ let text = format!("smooth_union(0.02, {})", parts.join(", "));
+ let t0 = std::time::Instant::now();
+ let (v, t) = mesh_text(&text, Some(0.01)).unwrap();
+ let (vol, open) = volume_and_open(&v, &t);
+ assert_eq!(open, 0);
+ assert!(vol > 0.0);
+ assert!(t0.elapsed().as_secs_f64() < 30.0, "{:?}", t0.elapsed());
+}
+
+#[test]
+fn bad_fields_say_why() {
+ assert!(parse("blob(1)").unwrap_err().contains("no field blob"));
+ assert!(parse("sphere(-1)").unwrap_err().contains("above 0"));
+ assert!(parse("tube(0, 0, 0, 1)").unwrap_err().contains("2 or more points"));
+ assert!(mesh_text("sphere(10)", Some(0.001)).unwrap_err().contains("cells"));
+ // exponents read
+ assert!(parse("sphere(1e-1)").is_ok());
+}
diff --git a/core/shape/Cargo.toml b/core/shape/Cargo.toml
index 755797b2..d9afc0c4 100644
--- a/core/shape/Cargo.toml
+++ b/core/shape/Cargo.toml
@@ -13,3 +13,6 @@ manifold-rust = "0.16.0"
skrifa = "0.44"
raea-core-fonts = { path = "../fonts" }
serde_json = "1"
+# blended distance fields and generators (trees, lofts, terrain, rosettes), meshed then closed into solids
+raea-core-sdf = { path = "../sdf" }
+raea-core-grow = { path = "../grow" }
diff --git a/core/shape/src/build.rs b/core/shape/src/build.rs
index 09db2415..5dac1812 100644
--- a/core/shape/src/build.rs
+++ b/core/shape/src/build.rs
@@ -63,6 +63,9 @@ pub(crate) fn call(f: &str, a: Vec<Arg>) -> Result<Manifold, String> {
if let Some(r) = space_time(f, &a) {
return r;
}
+ if let Some(r) = crate::grown::call(f, &a) {
+ return r;
+ }
let fold = |v: Vec<Manifold>, op: fn(&Manifold, &Manifold) -> Manifold| v.into_iter().reduce(|x, y| op(&x, &y)).unwrap();
Ok(match f {
"box" | "cube" => {
@@ -70,6 +73,14 @@ pub(crate) fn call(f: &str, a: Vec<Arg>) -> Result<Manifold, String> {
let (w, h, d) = if n.len() >= 3 { (n[0], n[1], n[2]) } else { (n[0], n[0], n[0]) };
Manifold::cube(Vec3::new(w, h, d), true)
}
+ // Bevy's Plane3d (plane(nx, ny, nz, w, h)): drawn with one face by Bevy's builder (sphere.rs plane_of); for CSG
+ // and contacts the box of no depth it lies in, w x h laid out as raea/mesh's <Plane3d> does
+ "plane" => {
+ let n = nums(f, &a, 5)?;
+ let (w, h) = (n[3], n[4]);
+ let size = if n[0] != 0.0 { Vec3::new(0.0, w, h) } else if n[2] != 0.0 { Vec3::new(w, h, 0.0) } else { Vec3::new(w, 0.0, h) };
+ Manifold::cube(size, true)
+ }
"rounded_box" => {
let n = nums(f, &a, 4)?;
let r = n[3].clamp(0.0, n[0].min(n[1]).min(n[2]) / 2.0 - 1e-6);
@@ -223,7 +234,7 @@ pub(crate) fn call(f: &str, a: Vec<Arg>) -> Result<Manifold, String> {
let (verts, tris) = if f == "obj" { read_obj(&path)? } else { read_glb(&path)? };
from_mesh(&verts, &tris)?
}
- o => return Err(format!("no shape {o}: box, rounded_box, sphere, uv_sphere, cylinder, cone, torus, text3d, extrude, revolve, union, minus, intersect, hull, minkowski, minkowski_diff, move, rotate, scale, mirror, transform, trim, refine, smooth, simplify, refine_length, refine_tolerance, obj, glb; in a mask also frame, rect, disc, wipe, during, slide")),
+ o => return Err(format!("no shape {o}: box, rounded_box, sphere, uv_sphere, cylinder, cone, torus, text3d, extrude, revolve, union, minus, intersect, hull, minkowski, minkowski_diff, move, rotate, scale, mirror, transform, trim, refine, smooth, simplify, refine_length, refine_tolerance, obj, glb, sdf, tree, loft, terrain, boulder, rosette; in a mask also frame, rect, disc, wipe, during, slide")),
})
}
diff --git a/core/shape/src/grown.rs b/core/shape/src/grown.rs
new file mode 100644
index 00000000..2b98c103
--- /dev/null
+++ b/core/shape/src/grown.rs
@@ -0,0 +1,84 @@
+//! Shapes from the field and the generators (raea-core-sdf, raea-core-grow), as solids:
+//!
+//! sdf("smooth_union(0.05, sphere(0.3), move(capsule(0,0,0, 0,0.6,0, 0.1), 0, 0.2, 0))" [, step])
+//! a distance field (blended organic shapes), meshed at `step` metres
+//! tree("height=6 crown=dome" [, "wood"|"leaves"|"all"]) a tree grown by space colonization
+//! loft("0: circle 0.3; 0.4: circle 0.18; 1: rect 0.2 0.2" [, n]) outlines at heights, skinned
+//! terrain("size=20 height=2 seed=3") boulder("size=1 seed=2") rosette("leaves=21 length=0.3")
+//!
+//! The settings are one string of name=value words (the strings take no escapes, so they hold no quotes).
+
+use manifold_rust::manifold::Manifold;
+use manifold_rust::types::OpType;
+
+use crate::mesh::from_mesh;
+use crate::parse::Arg;
+
+fn strs(a: &[Arg]) -> Vec<&str> {
+ a.iter().filter_map(|x| if let Arg::Str(s) = x { Some(s.as_str()) } else { None }).collect()
+}
+
+fn num(a: &[Arg]) -> Option<f64> {
+ a.iter().find_map(|x| if let Arg::Num(n) = x { Some(*n) } else { None })
+}
+
+/// The call when it is one of these shapes, else None.
+pub(crate) fn call(f: &str, a: &[Arg]) -> Option<Result<Manifold, String>> {
+ if !matches!(f, "sdf" | "tree" | "loft" | "terrain" | "boulder" | "rosette") {
+ return None;
+ }
+ let s = strs(a);
+ let text = s.first().copied().unwrap_or("");
+ Some((|| {
+ let (v, t) = match f {
+ "sdf" => {
+ if text.is_empty() {
+ return Err("sdf(\"field\" [, step]): give the field, e.g. sdf(\"sphere(0.5)\")".to_string());
+ }
+ raea_core_sdf::mesh_text(text, num(a))?
+ }
+ "tree" => {
+ // each branch its own solid, unioned at the forks into one body
+ let pieces = raea_core_grow::tree_pieces(text, s.get(1).copied().unwrap_or("all"))?;
+ let solids = pieces.iter().filter(|m| !m.t.is_empty()).map(piece).collect::<Result<Vec<_>, _>>().map_err(|e| format!("tree: {e}"))?;
+ return Ok(Manifold::batch_boolean(&solids, OpType::Add));
+ }
+ "loft" => { let m = raea_core_grow::loft(text, num(a).unwrap_or(0.0).max(0.0) as usize)?; (m.v, m.t) }
+ "terrain" => { let m = raea_core_grow::terrain(text)?; (m.v, m.t) }
+ "boulder" => { let m = raea_core_grow::boulder(text)?; (m.v, m.t) }
+ _ => { let m = raea_core_grow::rosette(text)?; (m.v, m.t) }
+ };
+ from_mesh(&v, &t).map_err(|e| format!("{f}: {e}"))
+ })())
+}
+
+#[cfg(test)]
+mod tests {
+ use crate::solid;
+
+ #[test]
+ fn grown_shapes_are_solids_that_cut_and_measure() {
+ let ball = solid("sdf(\"sphere(0.5)\", 0.02)").unwrap();
+ let want = 4.0 / 3.0 * std::f64::consts::PI * 0.125;
+ assert!((ball.volume() - want).abs() / want < 0.02, "{}", ball.volume());
+ // a blended field is a solid like any other: cut a box out of it
+ let cut = solid("minus(sdf(\"smooth_union(0.1, sphere(0.3), move(sphere(0.3), 0.4, 0, 0))\", 0.02), box(2, 2, 2))");
+ assert!(cut.is_err(), "the box takes all of it");
+ let vase = solid("loft(\"0: circle 0.2; 0.3: circle 0.3; 0.6: circle 0.1\")").unwrap();
+ assert!(vase.volume() > 0.05);
+ assert!(solid("terrain(\"size=4 height=0.5 cells=16\")").unwrap().volume() > 2.0);
+ assert!(solid("boulder(\"size=1\")").unwrap().volume() > 0.1);
+ assert!(solid("rosette(\"leaves=8\")").unwrap().volume() > 0.0);
+ let wood = solid("tree(\"height=4 points=300\", \"wood\")").unwrap();
+ assert!(wood.bounding_box().max.y > 2.5);
+ // the branches are unioned at their forks: one body, not a tube each
+ assert_eq!(wood.decompose().len(), 1);
+ assert!(solid("sdf(\"blob(1)\")").err().unwrap().contains("no field blob"));
+ assert!(solid("tree(\"crown=blob\")").err().unwrap().contains("isn't one of"));
+ }
+}
+
+/// One generated piece as a solid.
+fn piece(m: &raea_core_grow::Mesh) -> Result<Manifold, String> {
+ from_mesh(&m.v, &m.t)
+}
diff --git a/core/shape/src/lib.rs b/core/shape/src/lib.rs
index afe53612..40cf1848 100644
--- a/core/shape/src/lib.rs
+++ b/core/shape/src/lib.rs
@@ -11,6 +11,8 @@
//! extrude("x y, ...; ...", h [, divisions, twist°, scale_x, scale_y]) revolve("x y, ...", [degrees, segments])
//! obj("path") / glb("path") a mesh file, closed into a solid
//! sphere(r, n) / uv_sphere(r, sectors, stacks) Bevy's icosphere of n subdivisions, or its UV sphere
+//! sdf("field" [, step]) tree("k=v ..." [, part]) loft("y: outline; ..." [, n]) terrain("k=v ...")
+//! boulder("k=v ...") rosette("k=v ...") blended fields and generated growth (see grown.rs)
//!
//! `minus(rounded_box(2, 1, 0.2, 0.1), text3d("SALE", 0.45, 0.3))` is a sign with the word cut through it.
//!
@@ -26,10 +28,11 @@
mod build;
mod glyphs;
+mod grown;
mod mesh;
mod parse;
mod sphere;
-pub use sphere::{SphereOf, cuboid_of, sphere_of};
+pub use sphere::{SphereOf, cuboid_of, plane_of, sphere_of};
pub use mesh::{export, from_mesh, read_glb, read_obj, to_mesh};
diff --git a/core/shape/src/sphere.rs b/core/shape/src/sphere.rs
index 01caf8f0..02b37a95 100644
--- a/core/shape/src/sphere.rs
+++ b/core/shape/src/sphere.rs
@@ -27,6 +27,17 @@ pub fn sphere_of(expr: &str) -> Option<SphereOf> {
}
}
+/// The plane `expr` is, `plane(nx, ny, nz, w, h)` alone: its normal and full size, drawn as Bevy's Plane3d mesh (one
+/// face, facing the normal, as PlaneMeshBuilder lays it out)
+pub fn plane_of(expr: &str) -> Option<([f32; 3], [f32; 2])> {
+ let inner = expr.trim().strip_prefix("plane(")?.strip_suffix(')')?;
+ let n: Vec<f32> = inner.split(',').map(|s| s.trim().parse().ok()).collect::<Option<_>>()?;
+ match n.as_slice() {
+ &[x, y, z, w, h] => Some(([x, y, z], [w, h])),
+ _ => None,
+ }
+}
+
/// The cuboid `expr` is, `box(w, h, d)` alone with each side above 0 (a 0 side is a plane: Manifold's), as its full
/// size: drawn as Bevy's Cuboid mesh, with its normals and texture coordinates, as a Bevy Mesh3d's is
pub fn cuboid_of(expr: &str) -> Option<[f32; 3]> {
@@ -50,6 +61,20 @@ mod tests {
}
}
+ #[test]
+ fn a_plane_alone_is_read_with_its_normal_and_its_solid_is_the_flat_box() {
+ assert_eq!(plane_of(" plane(0, -1, 0, 4, 6) "), Some(([0.0, -1.0, 0.0], [4.0, 6.0])));
+ for e in ["plane(0, 1, 0, 4)", "box(4, 0, 6)", "move(plane(0, 1, 0, 1, 1), 0, 1, 0)"] {
+ assert_eq!(plane_of(e), None, "{e}");
+ }
+ // laid out as raea/mesh's <Plane3d>: facing y it spans x and z, facing x it spans y and z, facing z x and y
+ for (e, size) in [("plane(0, 1, 0, 4, 6)", (4.0, 0.0, 6.0)), ("plane(-1, 0, 0, 4, 6)", (0.0, 4.0, 6.0)), ("plane(0, 0, 1, 4, 6)", (4.0, 6.0, 0.0))] {
+ let b = crate::solid(e).unwrap().bounding_box();
+ let got = (b.max.x - b.min.x, b.max.y - b.min.y, b.max.z - b.min.z);
+ assert!((got.0 - size.0).abs() < 1e-6 && (got.1 - size.1).abs() < 1e-6 && (got.2 - size.2).abs() < 1e-6, "{e}: {got:?}");
+ }
+ }
+
#[test]
fn a_sphere_alone_is_read_and_anything_more_is_not() {
assert_eq!(sphere_of("sphere(2)"), Some(SphereOf::Ico { radius: 2.0, subdivisions: 5 }));
diff --git a/core/solidinfo/Cargo.toml b/core/solidinfo/Cargo.toml
new file mode 100644
index 00000000..8bb88deb
--- /dev/null
+++ b/core/solidinfo/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "raea-core-solidinfo"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "raea solid info: a solid's parts measured (volume, area, box, centre of mass, pieces, genus), how its parts meet, an expect file's predictions checked and two mutants against them, in scene lint's found shape"
+
+[dependencies]
+raea-core-shape = { path = "../shape" }
+manifold-rust = "0.16.0"
+serde_json = "1"
+# [x, y, z] points read as place reads them
+raea-core-place = { path = "../place" }
diff --git a/core/solidinfo/src/expect.rs b/core/solidinfo/src/expect.rs
new file mode 100644
index 00000000..2f6b0b19
--- /dev/null
+++ b/core/solidinfo/src/expect.rs
@@ -0,0 +1,109 @@
+//! An expect file: predictions about the solid made before it is measured, each checked (`expect.<key>` findings, an
+//! error when wrong). The file's ranges are the author's own guesses, so they are no target for a judge. Mutants: the
+//! whole's box and its convex hull, each checked against the same predictions; a mutant the predictions can't tell
+//! from the object "survives", which says the predictions are too loose to mean anything.
+
+use manifold_rust::linalg::Vec3;
+use raea_core_shape::Manifold;
+use serde_json::{Value, json};
+
+use crate::measure::{Measured, measure, r6};
+
+pub const ACCEPTED: &str = "volume, area, size, box, centerOfMass, pieces, genus, solidPoints, emptyPoints";
+
+fn range(key: &str, v: &Value) -> Result<(f64, f64), String> {
+ match v.as_array().map(|a| a.iter().map(Value::as_f64).collect::<Option<Vec<f64>>>()) {
+ Some(Some(a)) if a.len() == 2 && a[0] <= a[1] => Ok((a[0], a[1])),
+ _ => Err(format!("expect: {key} is a range [low, high], got {v}")),
+ }
+}
+
+/// Whether there is material at the point: a cube a thousandth of the solid's size there, intersected.
+fn solid_at(m: &Manifold, span: f64, p: [f64; 3]) -> bool {
+ let s = (span * 1e-3).max(1e-5);
+ let probe = Manifold::cube(Vec3::new(s, s, s), true).translate(Vec3::new(p[0], p[1], p[2]));
+ m.intersection(&probe).volume() > 0.5 * s * s * s
+}
+
+/// Each prediction checked against the solid: (findings, {passed, failed}).
+pub fn check_expect(e: &Value, m: &Manifold, me: &Measured) -> Result<(Vec<Value>, Value), String> {
+ let obj = e.as_object().ok_or("expect: the file is a JSON object of predictions")?;
+ let mut out = Vec::new();
+ let mut push = |key: &str, ok: bool, expected: Value, measured: Value, says: String| {
+ out.push(json!({"check": format!("expect.{key}"), "level": if ok { "ok" } else { "error" }, "expected": expected, "measured": measured, "says": says}));
+ };
+ let size = me.size();
+ let span = size.iter().cloned().fold(0.0, f64::max).max(1e-6);
+ let axes = ["x", "y", "z"];
+ for (key, v) in obj {
+ match key.as_str() {
+ "volume" | "area" => {
+ let (lo, hi) = range(key, v)?;
+ let got = if key == "volume" { me.volume } else { me.area };
+ let ok = (lo..=hi).contains(&got);
+ push(key, ok, v.clone(), json!(r6(got)), format!("{key} {} {} [{lo}, {hi}]", r6(got), if ok { "within" } else { "outside" }));
+ }
+ "size" | "centerOfMass" => {
+ let o = v.as_object().ok_or_else(|| format!("expect: {key} is {{\"x\": [lo, hi], \"y\": ..., \"z\": ...}}"))?;
+ for (ax, rv) in o {
+ let k = axes.iter().position(|a| a == ax).ok_or_else(|| format!("expect: {key}.{ax}: the axes are x, y, z"))?;
+ let (lo, hi) = range(&format!("{key}.{ax}"), rv)?;
+ let got = if key == "size" { size[k] } else { me.center_of_mass[k] };
+ let ok = (lo..=hi).contains(&got);
+ push(&format!("{key}.{ax}"), ok, rv.clone(), json!(r6(got)), format!("{key} {ax} {} {} [{lo}, {hi}]", r6(got), if ok { "within" } else { "outside" }));
+ }
+ }
+ "box" => {
+ let tol = v.get("tol").and_then(Value::as_f64).unwrap_or(0.002);
+ for (side, got) in [("min", me.min), ("max", me.max)] {
+ if let Some(want) = v.get(side) {
+ let want = raea_core_place::xyz(want, &format!("expect: box.{side}"))?;
+ let ok = (0..3).all(|k| (want[k] - got[k]).abs() <= tol);
+ push(&format!("box.{side}"), ok, json!(want), json!(got.map(r6)), format!("box {side} {:?} {} {:?} (±{tol})", got.map(r6), if ok { "at" } else { "not at" }, want));
+ }
+ }
+ }
+ "pieces" | "genus" => {
+ let want = v.as_i64().ok_or_else(|| format!("expect: {key} is a whole number"))?;
+ let got = if key == "pieces" { me.pieces as i64 } else { me.genus as i64 };
+ push(key, got == want, json!(want), json!(got), format!("{key} {got}{}", if got == want { " as expected".to_string() } else { format!(", expected {want}") }));
+ }
+ "solidPoints" | "emptyPoints" => {
+ let want_solid = key == "solidPoints";
+ for (i, pv) in v.as_array().ok_or_else(|| format!("expect: {key} is a list of [x, y, z]"))?.iter().enumerate() {
+ let p = raea_core_place::xyz(pv, &format!("expect: a point of {key}"))?;
+ let got = !me.empty && solid_at(m, span, p);
+ let ok = got == want_solid;
+ push(&format!("{key}[{i}]"), ok, json!(p), json!(if got { "solid" } else { "empty" }), format!("{p:?} is {}{}", if got { "solid" } else { "empty" }, if ok { "" } else { if want_solid { ", expected material there" } else { ", expected no material there" } }));
+ }
+ }
+ "mutants" | "note" => {}
+ o => return Err(format!("expect: no prediction {o}: {ACCEPTED}")),
+ }
+ }
+ let failed = out.iter().filter(|f| f["level"] == "error").count();
+ let summary = json!({"passed": out.len() - failed, "failed": failed});
+ Ok((out, summary))
+}
+
+/// The box and the hull, each checked against the predictions.
+pub fn mutants(e: &Value, m: &Manifold, me: &Measured) -> Result<Vec<Value>, String> {
+ if me.empty {
+ return Ok(Vec::new());
+ }
+ let s = me.size();
+ let block = Manifold::cube(Vec3::new(s[0].max(1e-6), s[1].max(1e-6), s[2].max(1e-6)), false).translate(Vec3::new(me.min[0], me.min[1], me.min[2]));
+ let hull = Manifold::hull_manifolds(std::slice::from_ref(m));
+ let mut out = Vec::new();
+ for (name, mm) in [("block", block), ("hull", hull)] {
+ let mm_me = measure(&mm);
+ let (checks, _) = check_expect(e, &mm, &mm_me)?;
+ let by: Vec<Value> = checks.iter().filter(|c| c["level"] == "error").map(|c| c["check"].clone()).collect();
+ out.push(if by.is_empty() {
+ json!({"name": name, "status": "survived", "says": format!("the expect file can't tell the solid from its {}: add an emptyPoints probe where the {name} has material and the object has none (a cavity, a gap, under a handle), or a tighter volume", if name == "block" { "bounding box" } else { "convex hull" })})
+ } else {
+ json!({"name": name, "status": "killed", "by": by})
+ });
+ }
+ Ok(out)
+}
diff --git a/core/solidinfo/src/lib.rs b/core/solidinfo/src/lib.rs
new file mode 100644
index 00000000..975843db
--- /dev/null
+++ b/core/solidinfo/src/lib.rs
@@ -0,0 +1,137 @@
+//! `raea solid info`: a solid measured, part by part, in scene lint's shape (docs/handoff/solids.md, Next 1; the
+//! 11-06 research: numbers before renders for geometry, and a prediction checked rather than a threshold judged). It
+//! takes each named part's shape expression (what a Solid knows of itself) and answers volume, area, box, centre of
+//! mass, pieces, genus and triangles for each part and for the whole; how each pair of parts meets; and `found`, each
+//! finding as `{part, check, level, says}` with `level` ok, note, warning or error. An expect file's predictions are
+//! checked (`expect`), and two mutants (the whole's box and its convex hull) test whether those predictions can tell
+//! the object from a crude stand-in. No aggregate pass: errors > 0 fails it, as lint.
+
+mod expect;
+mod measure;
+
+pub use expect::{ACCEPTED, check_expect, mutants};
+pub use measure::{Measured, measure, r6};
+
+use raea_core_shape::Manifold;
+use serde_json::{Value, json};
+
+/// The parts built from their expressions; an expression that doesn't build is an error naming its part.
+pub fn build(parts: &[(String, String)]) -> Result<Vec<(String, Manifold)>, String> {
+ parts.iter().map(|(name, e)| raea_core_shape::solid(e).map(|m| (name.clone(), m)).map_err(|err| format!("{name}: {err}"))).collect()
+}
+
+/// The whole: every part unioned.
+pub fn whole(parts: &[(String, Manifold)]) -> Manifold {
+ parts.iter().map(|(_, m)| m.clone()).reduce(|a, b| a.union(&b)).expect("at least one part")
+}
+
+/// How two parts meet: overlapping (by how much), touching, or apart (by how far, searched to 5 cm).
+pub fn pair(a: &Manifold, b: &Manifold) -> Value {
+ let overlap = a.intersection(b).volume();
+ if overlap > 1e-12 {
+ return json!({"status": "overlap", "gap": 0.0, "overlap": r6(overlap)});
+ }
+ let gap = a.min_gap(b, 0.05);
+ let status = if gap < 1e-4 { "touching" } else { "apart" };
+ json!({"status": status, "gap": r6(gap), "overlap": 0.0})
+}
+
+/// The whole report for the parts (and the expect file's predictions, if any).
+pub fn info(parts: &[(String, String)], expect: Option<&Value>) -> Result<Value, String> {
+ if parts.is_empty() {
+ return Err("solid info: the file made no solid (export default a Solid, an object of Solids, or a function of the params returning either)".into());
+ }
+ let built = build(parts)?;
+ let all = whole(&built);
+ let whole_m = measure(&all);
+ let mut found: Vec<Value> = Vec::new();
+ let mut part_rows = Vec::new();
+ for (name, m) in &built {
+ let pm = measure(m);
+ if pm.empty {
+ found.push(json!({"part": name, "check": "empty", "level": "error", "says": format!("{name} is empty: its boolean left nothing")}));
+ } else if pm.pieces > 1 {
+ found.push(json!({"part": name, "check": "disjoint", "level": "warning", "says": format!("{name} is {} pieces (the largest {} m³, the smallest {} m³)", pm.pieces, pm.piece_volumes.first().copied().unwrap_or(0.0), pm.piece_volumes.last().copied().unwrap_or(0.0))}));
+ }
+ // the part's measures beside its name, as the solid's are (agent-tool-surface.md's shape)
+ let mut row = json!({"part": name});
+ if let (Some(r), Some(m)) = (row.as_object_mut(), pm.json().as_object()) {
+ r.extend(m.clone());
+ }
+ part_rows.push(row);
+ }
+ let mut pairs = Vec::new();
+ for i in 0..built.len() {
+ for j in i + 1..built.len() {
+ let (a, b) = (&built[i], &built[j]);
+ let mut p = pair(&a.1, &b.1);
+ let small = a.1.volume().min(b.1.volume());
+ if p["status"] == "overlap" && small > 0.0 && p["overlap"].as_f64().unwrap_or(0.0) > 0.5 * small {
+ found.push(json!({"part": b.0, "check": "contains", "level": "warning", "says": format!("{} and {} overlap by more than half of the smaller: one is mostly inside the other", a.0, b.0)}));
+ }
+ p["a"] = json!(a.0);
+ p["b"] = json!(b.0);
+ pairs.push(p);
+ }
+ }
+ if whole_m.empty {
+ found.push(json!({"check": "empty", "level": "error", "says": "the solid is empty"}));
+ } else if whole_m.pieces > 1 {
+ // which parts sit apart from everything else
+ let alone: Vec<&str> = built.iter().filter(|(n, _)| !pairs.iter().any(|p| (p["a"] == n.as_str() || p["b"] == n.as_str()) && p["status"] != "apart")).map(|(n, _)| n.as_str()).collect();
+ let says = if alone.is_empty() || built.len() == 1 { format!("the solid is in {} pieces", whole_m.pieces) } else { format!("the solid is in {} pieces: {} reach no other part", whole_m.pieces, alone.join(", ")) };
+ found.push(json!({"check": "disjoint", "level": "error", "says": says, "pieces": whole_m.piece_volumes}));
+ } else {
+ found.push(json!({"check": "disjoint", "level": "ok", "says": "one piece"}));
+ }
+ let mut out = json!({"solid": whole_m.json(), "parts": part_rows, "pairs": pairs});
+ if let Some(e) = expect {
+ let (checks, summary) = check_expect(e, &all, &whole_m)?;
+ found.extend(checks);
+ out["expect"] = summary;
+ out["mutants"] = json!(mutants(e, &all, &whole_m)?);
+ for m in out["mutants"].as_array().into_iter().flatten() {
+ if m["status"] == "survived" {
+ found.push(json!({"check": "mutant", "level": "warning", "says": m["says"]}));
+ }
+ }
+ } else {
+ found.push(json!({"check": "skipped", "level": "note", "says": "no expect file: nothing predicted, so nothing checked against a prediction (--expect E.json)"}));
+ }
+ let errors = found.iter().filter(|f| f["level"] == "error").count();
+ let warnings = found.iter().filter(|f| f["level"] == "warning").count();
+ out["errors"] = json!(errors);
+ out["warnings"] = json!(warnings);
+ out["found"] = json!(found);
+ Ok(out)
+}
+
+/// What changed between two whole solids' measures (`--set` against the defaults).
+pub fn delta(from: &str, was: &Value, now: &Value) -> Value {
+ let pct = |a: f64, b: f64| if a.abs() > 1e-15 { r6((b - a) / a * 100.0) } else { 0.0 };
+ json!({"from": from,
+ "volume": {"was": was["volume"], "now": now["volume"], "pct": pct(was["volume"].as_f64().unwrap_or(0.0), now["volume"].as_f64().unwrap_or(0.0))},
+ "size": {"was": was["box"]["size"], "now": now["box"]["size"]},
+ "pieces": {"was": was["pieces"], "now": now["pieces"]},
+ "genus": {"was": was["genus"], "now": now["genus"]}})
+}
+
+/// A walk's verdict for one parameter moved to one end: broken (empty, or more pieces than at the default), inert
+/// (neither volume nor box moved), or ok.
+pub fn walk_verdict(base: &Value, now: &Value) -> (&'static str, Option<String>) {
+ if now["empty"] == true {
+ return ("broken", Some("the solid is empty".into()));
+ }
+ let (bp, np) = (base["pieces"].as_u64().unwrap_or(1), now["pieces"].as_u64().unwrap_or(1));
+ if np > bp {
+ return ("broken", Some(format!("{np} pieces (at the default {bp})")));
+ }
+ let same_v = (base["volume"].as_f64().unwrap_or(0.0) - now["volume"].as_f64().unwrap_or(0.0)).abs() <= 1e-12;
+ if same_v && base["box"] == now["box"] {
+ return ("inert", Some("neither volume nor box moves: it reaches no geometry".into()));
+ }
+ ("ok", None)
+}
+
+#[cfg(test)]
+mod tests;
diff --git a/core/solidinfo/src/measure.rs b/core/solidinfo/src/measure.rs
new file mode 100644
index 00000000..8d058e86
--- /dev/null
+++ b/core/solidinfo/src/measure.rs
@@ -0,0 +1,99 @@
+//! One solid's measures: volume, area, box, centre of mass (from its triangles, by the divergence theorem), pieces and
+//! their volumes, genus, cavities (shells closed inside a piece), triangles. A Manifold is closed by construction, so a
+//! solid that isn't empty is watertight.
+
+use raea_core_shape::Manifold;
+use serde_json::{Value, json};
+
+pub fn r6(x: f64) -> f64 {
+ if !x.is_finite() {
+ return 0.0;
+ }
+ let m = 1e6;
+ (x * m).round() / m
+}
+
+#[derive(Clone, Debug)]
+pub struct Measured {
+ pub empty: bool,
+ pub volume: f64,
+ pub area: f64,
+ pub min: [f64; 3],
+ pub max: [f64; 3],
+ pub center_of_mass: [f64; 3],
+ pub pieces: usize,
+ /// largest first
+ pub piece_volumes: Vec<f64>,
+ pub genus: i32,
+ /// shells enclosed in a piece (a hollow sealed inside)
+ pub cavities: usize,
+ pub tris: usize,
+}
+
+pub fn measure(m: &Manifold) -> Measured {
+ if m.is_empty() {
+ return Measured { empty: true, volume: 0.0, area: 0.0, min: [0.0; 3], max: [0.0; 3], center_of_mass: [0.0; 3], pieces: 0, piece_volumes: Vec::new(), genus: 0, cavities: 0, tris: 0 };
+ }
+ let b = m.bounding_box();
+ let (v, t) = raea_core_shape::to_mesh(m);
+ let p = |i: u32| vertex(&v, i);
+ let (mut vol, mut c) = (0.0, [0.0; 3]);
+ for tri in t.chunks(3) {
+ let (a, bb, d) = (p(tri[0]), p(tri[1]), p(tri[2]));
+ let six = a[0] * (bb[1] * d[2] - bb[2] * d[1]) - a[1] * (bb[0] * d[2] - bb[2] * d[0]) + a[2] * (bb[0] * d[1] - bb[1] * d[0]);
+ vol += six;
+ for k in 0..3 {
+ c[k] += six * (a[k] + bb[k] + d[k]);
+ }
+ }
+ let com = if vol.abs() > 1e-18 { [c[0] / (4.0 * vol), c[1] / (4.0 * vol), c[2] / (4.0 * vol)] } else { [0.0; 3] };
+ // decompose gives a sealed hollow as its own, inside-out shell: a cavity, not a piece
+ let all: Vec<f64> = m.decompose().iter().map(|x| r6(signed_volume(x))).collect();
+ let cavities = all.iter().filter(|v| **v < 0.0).count();
+ let mut piece_volumes: Vec<f64> = all.into_iter().filter(|v| *v >= 0.0).collect();
+ piece_volumes.sort_by(|a, b| b.total_cmp(a));
+ Measured {
+ empty: false,
+ volume: m.volume(),
+ area: m.surface_area(),
+ min: [b.min.x, b.min.y, b.min.z],
+ max: [b.max.x, b.max.y, b.max.z],
+ center_of_mass: com,
+ pieces: piece_volumes.len(),
+ cavities,
+ piece_volumes,
+ genus: m.genus(),
+ tris: m.num_tri(),
+ }
+}
+
+/// Volume from the triangles' winding (divergence theorem): an inside-out shell, a cavity on its own, is negative.
+fn signed_volume(m: &Manifold) -> f64 {
+ let (v, t) = raea_core_shape::to_mesh(m);
+ let p = |i: u32| vertex(&v, i);
+ t.chunks(3).map(|tri| {
+ let (a, b, d) = (p(tri[0]), p(tri[1]), p(tri[2]));
+ a[0] * (b[1] * d[2] - b[2] * d[1]) - a[1] * (b[0] * d[2] - b[2] * d[0]) + a[2] * (b[0] * d[1] - b[1] * d[0])
+ }).sum::<f64>() / 6.0
+}
+
+impl Measured {
+ pub fn size(&self) -> [f64; 3] {
+ [self.max[0] - self.min[0], self.max[1] - self.min[1], self.max[2] - self.min[2]]
+ }
+
+ pub fn json(&self) -> Value {
+ let s = self.size();
+ let r3 = |a: [f64; 3]| a.map(r6);
+ let c = [(self.min[0] + self.max[0]) / 2.0, (self.min[1] + self.max[1]) / 2.0, (self.min[2] + self.max[2]) / 2.0];
+ json!({"empty": self.empty, "volume": r6(self.volume), "area": r6(self.area),
+ "box": {"min": r3(self.min), "max": r3(self.max), "size": r3(s), "center": r3(c)},
+ "centerOfMass": r3(self.center_of_mass), "pieces": self.pieces, "genus": self.genus, "cavities": self.cavities, "tris": self.tris, "watertight": !self.empty})
+ }
+}
+
+/// Vertex `i` of a flat [x, y, z, ...] position list.
+fn vertex(v: &[f32], i: u32) -> [f64; 3] {
+ let i = i as usize * 3;
+ [v[i] as f64, v[i + 1] as f64, v[i + 2] as f64]
+}
diff --git a/core/solidinfo/src/tests.rs b/core/solidinfo/src/tests.rs
new file mode 100644
index 00000000..d186eb10
--- /dev/null
+++ b/core/solidinfo/src/tests.rs
@@ -0,0 +1,66 @@
+use super::*;
+
+fn mug(handle_x: f64) -> Vec<(String, String)> {
+ vec![
+ ("body".into(), "move(rotate(minus(cylinder(0.045, 0.1), move(cylinder(0.041, 0.1), 0, 0, 0.004)), -90, 0, 0), 0, 0.05, 0)".into()),
+ ("handle".into(), format!("move(rotate(torus(0.025, 0.006), 90, 0, 0), {handle_x}, 0.05, 0)")),
+ ]
+}
+
+#[test]
+fn a_mug_is_measured_and_a_detached_handle_is_an_error() {
+ let ok = info(&mug(0.057), None).unwrap();
+ assert_eq!(ok["errors"], 0, "{ok:#}");
+ assert_eq!(ok["solid"]["pieces"], 1);
+ assert_eq!(ok["solid"]["watertight"], true);
+ assert_eq!(ok["solid"]["cavities"], 0);
+ assert!(ok["parts"][0]["volume"].as_f64().unwrap() > 0.0, "a part's measures sit beside its name");
+ let size = ok["solid"]["box"]["size"].as_array().unwrap();
+ assert!((size[1].as_f64().unwrap() - 0.1).abs() < 1e-3, "{size:?}");
+ assert_eq!(ok["pairs"][0]["status"], "overlap");
+ // the handle moved off the body: two pieces, and the handle named
+ let off = info(&mug(0.1), None).unwrap();
+ assert_eq!(off["errors"], 1);
+ let f = off["found"].as_array().unwrap().iter().find(|f| f["check"] == "disjoint").unwrap().clone();
+ assert!(f["says"].as_str().unwrap().contains("handle"), "{f}");
+ assert_eq!(off["pairs"][0]["status"], "apart");
+}
+
+#[test]
+fn predictions_are_checked_and_loose_ones_let_mutants_survive() {
+ // a cup: the inside is empty, the wall is solid
+ let tight = serde_json::json!({"pieces": 1, "size": {"y": [0.099, 0.101]}, "solidPoints": [[0.043, 0.05, 0]], "emptyPoints": [[0, 0.06, 0]]});
+ let r = info(&mug(0.057), Some(&tight)).unwrap();
+ assert_eq!(r["errors"], 0, "{r:#}");
+ assert_eq!(r["expect"]["failed"], 0);
+ // the empty point inside the cup kills both the block and the hull
+ assert!(r["mutants"].as_array().unwrap().iter().all(|m| m["status"] == "killed"), "{:#}", r["mutants"]);
+ let loose = serde_json::json!({"pieces": 1});
+ let r = info(&mug(0.057), Some(&loose)).unwrap();
+ assert!(r["mutants"].as_array().unwrap().iter().all(|m| m["status"] == "survived"));
+ assert!(r["warnings"].as_u64().unwrap() >= 2);
+ // a wrong prediction is an error; an unknown key says what is accepted
+ let wrong = serde_json::json!({"genus": 3});
+ assert_eq!(info(&mug(0.057), Some(&wrong)).unwrap()["errors"], 1);
+ assert!(info(&mug(0.057), Some(&serde_json::json!({"colour": 1}))).unwrap_err().contains("volume, area"));
+}
+
+#[test]
+fn walks_and_deltas_say_what_moved() {
+ let a = info(&mug(0.057), None).unwrap()["solid"].clone();
+ let b = info(&mug(0.1), None).unwrap()["solid"].clone();
+ assert_eq!(walk_verdict(&a, &b).0, "broken");
+ assert_eq!(walk_verdict(&a, &a).0, "inert");
+ let d = delta("handle=0.1", &a, &b);
+ assert_eq!(d["pieces"]["now"], 2);
+ // centre of mass of a unit box at the origin's corner
+ let m = measure(&raea_core_shape::solid("move(box(1, 1, 1), 0.5, 0.5, 0.5)").unwrap());
+ assert!(m.center_of_mass.iter().all(|c| (c - 0.5).abs() < 1e-6), "{:?}", m.center_of_mass);
+}
+
+#[test]
+fn a_sealed_hollow_is_a_cavity() {
+ let hollow = info(&[("ball".to_string(), "minus(sphere(1), sphere(0.5))".to_string())], None).unwrap();
+ assert_eq!(hollow["solid"]["pieces"], 1);
+ assert_eq!(hollow["solid"]["cavities"], 1, "{}", hollow["solid"]);
+}
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.md
new file mode 100644
index 00000000..e0a818be
--- /dev/null
+++ b/docs/bevy-parity.md
@@ -0,0 +1,135 @@
+# Bevy parity
+
+Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a). Generated by tools/bevy-parity;
+don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys and
+frame time at most 1.25x the example's). Wall time is one machine's, measured in the same run.
+
+Examples: **438**, ported **56**, passing **53**, excluded **16** (docs/bevy-parity/excluded.tsv), left **369**.
+
+raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the example
+doesn't pay.
+
+| example | frame | ssim | worst tile | batch keys (bevy / raea) | entities (bevy / raea) | meshes (bevy / raea) | materials (bevy / raea) | frame ms (bevy / raea = update + step) | pass | why |
+|---|---:|---:|---:|---:|---:|---:|---:|---:|---|---|
+| 3d/rotate_environment_map | 5 | 0.999453 | 1 | 1 / 1 | 442 / 497 | 6 / 8 | 2 / 2 | 84.046 / 6.742 = 5.209 + 1.533 | yes | |
+| 3d/rotate_environment_map | 60 | 0.999279 | 1 | 1 / 1 | 442 / 497 | 6 / 8 | 2 / 2 | 3.628 / 3.199 = 2.733 + 0.466 | yes | |
+| stress_tests/many_cubes | 30 | 0.995176 | 1 | 2 / 2 | 10444 / 10495 | 7 / 9 | 3 / 2 | 11.411 / 2.23 = 1.624 + 0.606 | yes | |
+| stress_tests/many_cubes | 60 | 0.995154 | 1 | 2 / 2 | 10444 / 10495 | 7 / 9 | 3 / 2 | 1.686 / 1.868 = 1.434 + 0.434 | yes | |
+| 3d/3d_scene | 10 | 0.999998 | 0 | 2 / 2 | 443 / 498 | 7 / 9 | 3 / 3 | 16.925 / 1.991 = 1.8 + 0.191 | yes | |
+| 3d/3d_scene | 5 | 0.999998 | 0 | 2 / 2 | 443 / 498 | 7 / 9 | 3 / 3 | 52.554 / 3.037 = 2.854 + 0.183 | yes | |
+| stress_tests/many_lights | 30 | 0.999957 | 0 | 1 / 1 | 100443 / 100495 | 7 / 9 | 3 / 3 | 14.486 / 6.088 = 4.017 + 2.071 | yes | |
+| stress_tests/many_lights | 60 | 0.999954 | 0 | 1 / 1 | 100445 / 100495 | 7 / 9 | 3 / 3 | 2.5 / 5.438 = 3.702 + 1.736 | no | frame 5.438 ms (3.702 update + 1.736 React step) vs 2.5 ms |
+| stress_tests/many_foxes | 30 | 0.989592 | 3 | 2 / 2 | 30464 / 31495 | 7 / 9 | 3 / 3 | 13.802 / 17.934 = 8.34 + 9.594 | no | frame 17.934 ms (8.34 update + 9.594 React step) vs 13.802 ms |
+| stress_tests/many_foxes | 60 | 0.990304 | 3 | 2 / 2 | 30464 / 31495 | 7 / 9 | 3 / 3 | 2.918 / 17.422 = 8.181 + 9.241 | no | frame 17.422 ms (8.181 update + 9.241 React step) vs 2.918 ms |
+| animation/animated_mesh | 30 | 0.996636 | 1 | 2 / 2 | 472 / 526 | 7 / 9 | 3 / 3 | 24.321 / 1.797 = 1.629 + 0.168 | yes | |
+| animation/animated_mesh | 60 | 0.996594 | 1 | 2 / 2 | 472 / 526 | 7 / 9 | 3 / 3 | 16.634 / 1.473 = 1.355 + 0.118 | yes | |
+| shader/extended_material | 30 | 1.000000 | 0 | 0 / 0 | 448 / 495 | 6 / 8 | 1 / 2 | 23.299 / 1.065 = 0.849 + 0.216 | yes | |
+| shader/extended_material | 60 | 1.000000 | 0 | 0 / 0 | 448 / 495 | 6 / 8 | 1 / 2 | 16.738 / 0.937 = 0.781 + 0.156 | yes | |
+| 3d/orthographic | 10 | 0.999503 | 0 | 5 / 2 | 446 / 499 | 10 / 9 | 6 / 3 | 35.837 / 1.307 = 1.107 + 0.200 | yes | |
+| 3d/parenting | 30 | 0.999969 | 0 | 1 / 1 | 443 / 496 | 6 / 8 | 2 / 2 | 23.457 / 1.094 = 0.92 + 0.174 | yes | |
+| 3d/parenting | 60 | 0.999968 | 0 | 1 / 1 | 443 / 496 | 6 / 8 | 2 / 2 | 16.687 / 0.975 = 0.854 + 0.121 | yes | |
+| 2d/mesh2d | 10 | 0.999348 | 0 | 0 / 0 | 441 / 494 | 6 / 8 | 1 / 1 | 33.938 / 1.249 = 1.076 + 0.173 | yes | |
+| 2d/sprite | 10 | 0.998326 | 8 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 34.443 / 1.338 = 1.174 + 0.164 | yes | |
+| transforms/3d_rotation | 30 | 1.000000 | 0 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 23.477 / 1.095 = 0.93 + 0.165 | yes | |
+| transforms/3d_rotation | 60 | 1.000000 | 0 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 16.649 / 0.939 = 0.823 + 0.116 | yes | |
+| 2d/sprite_flipping | 10 | 0.998326 | 8 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 34.344 / 1.234 = 1.098 + 0.136 | yes | |
+| 2d/move_sprite | 120 | 0.998270 | 9 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 16.645 / 0.847 = 0.773 + 0.074 | yes | |
+| 2d/move_sprite | 30 | 0.998261 | 8 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 23.012 / 1.037 = 0.843 + 0.194 | yes | |
+| 2d/transparency_2d | 10 | 0.997674 | 5 | 0 / 0 | 443 / 496 | 5 / 7 | 1 / 1 | 34.576 / 1.21 = 1.074 + 0.136 | yes | |
+| transforms/translation | 180 | 1.000000 | 0 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 16.665 / 0.831 = 0.762 + 0.069 | yes | |
+| transforms/translation | 60 | 1.000000 | 0 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 20.048 / 0.912 = 0.804 + 0.108 | yes | |
+| transforms/scale | 300 | 1.000000 | 0 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 16.67 / 0.837 = 0.765 + 0.072 | yes | |
+| transforms/scale | 60 | 1.000000 | 0 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 20.098 / 0.92 = 0.807 + 0.113 | yes | |
+| 3d/texture | 10 | 0.999547 | 1 | 3 / 3 | 443 / 497 | 6 / 8 | 4 / 4 | 35.41 / 1.327 = 1.127 + 0.200 | yes | |
+| shader/animate_shader | 30 | 1.000000 | 0 | 0 / 0 | 447 / 494 | 6 / 8 | 1 / 2 | 22.794 / 0.944 = 0.834 + 0.110 | yes | |
+| shader/animate_shader | 60 | 1.000000 | 0 | 0 / 0 | 447 / 494 | 6 / 8 | 1 / 2 | 16.6 / 0.913 = 0.828 + 0.085 | yes | |
+| 2d/sprite_sheet | 30 | 0.998820 | 5 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 22.829 / 0.997 = 0.871 + 0.126 | yes | |
+| 2d/sprite_sheet | 60 | 0.999054 | 5 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 16.674 / 0.865 = 0.78 + 0.085 | yes | |
+| 3d/pbr | 30 | 0.997685 | 8 | 56 / 56 | 499 / 550 | 6 / 8 | 57 / 57 | 23.621 / 1.059 = 0.959 + 0.100 | yes | |
+| 3d/pbr | 60 | 0.997685 | 8 | 56 / 56 | 499 / 550 | 6 / 8 | 57 / 57 | 16.707 / 0.901 = 0.839 + 0.062 | yes | |
+| 3d/animated_material | 30 | 0.999892 | 0 | 9 / 9 | 449 / 502 | 6 / 8 | 10 / 19 | 23.431 / 1.385 = 1.008 + 0.377 | yes | |
+| 3d/animated_material | 60 | 0.999940 | 0 | 9 / 9 | 449 / 502 | 6 / 8 | 10 / 19 | 16.682 / 1.179 = 0.915 + 0.264 | yes | |
+| camera/pan_camera_controller | 10 | 0.996838 | 10 | 0 / 0 | 446 / 494 | 5 / 7 | 1 / 1 | 34.381 / 1.192 = 1.047 + 0.145 | yes | |
+| camera/camera_orbit | 10 | 0.999220 | 8 | 2 / 2 | 445 / 496 | 7 / 9 | 3 / 3 | 36.186 / 1.26 = 1.042 + 0.218 | yes | |
+| camera/projection_zoom | 30 | 0.998026 | 8 | 2 / 2 | 473 / 526 | 7 / 9 | 3 / 3 | 24.245 / 1.246 = 1.111 + 0.135 | yes | |
+| 2d/sprite_animation | 12 | 0.997217 | 9 | 0 / 0 | 443 / 495 | 5 / 7 | 1 / 1 | 32.015 / 1.148 = 0.986 + 0.162 | yes | |
+| 2d/sprite_animation | 30 | 0.997017 | 8 | 0 / 0 | 443 / 495 | 5 / 7 | 1 / 1 | 16.77 / 1.013 = 0.881 + 0.132 | yes | |
+| 2d/sprite_animation | 60 | 0.997099 | 8 | 0 / 0 | 443 / 495 | 5 / 7 | 1 / 1 | 16.673 / 0.892 = 0.8 + 0.092 | yes | |
+| 2d/sprite_tile | 30 | 0.998633 | 7 | 0 / 0 | 442 / 494 | 5 / 7 | 1 / 1 | 22.925 / 1.018 = 0.889 + 0.129 | yes | |
+| 2d/sprite_tile | 300 | 0.992213 | 7 | 0 / 0 | 442 / 494 | 5 / 7 | 1 / 1 | 16.666 / 0.83 = 0.771 + 0.059 | yes | |
+| 3d/vertex_colors | 10 | 0.999019 | 0 | 2 / 2 | 443 / 496 | 7 / 9 | 3 / 3 | 38.287 / 2.201 = 1.983 + 0.218 | yes | |
+| 3d/spherical_area_lights | 10 | 0.999738 | 0 | 7 / 2 | 453 / 506 | 7 / 9 | 8 / 3 | 35.843 / 1.733 = 1.533 + 0.200 | yes | |
+| 3d/fog_volumes | 10 | 0.995718 | 14 | 0 / 0 | 442 / 494 | 5 / 7 | 1 / 1 | 35.722 / 1.634 = 1.343 + 0.291 | yes | |
+| 3d/fog_volumes | 60 | 0.995939 | 4 | 0 / 0 | 442 / 494 | 5 / 7 | 1 / 1 | 16.679 / 1.328 = 1.197 + 0.131 | yes | |
+| 3d/bloom_3d | 10 | 0.996668 | 11 | 4 / 4 | 541 / 593 | 6 / 8 | 5 / 5 | 36.436 / 2.905 = 1.823 + 1.082 | yes | |
+| 3d/bloom_3d | 60 | 0.996631 | 12 | 4 / 4 | 541 / 593 | 6 / 8 | 5 / 5 | 16.689 / 2.036 = 1.426 + 0.610 | yes | |
+| transforms/transform | 10 | 0.999999 | 0 | 2 / 2 | 443 / 496 | 7 / 9 | 3 / 3 | 36.165 / 1.627 = 1.291 + 0.336 | yes | |
+| transforms/transform | 120 | 1.000000 | 0 | 2 / 2 | 443 / 496 | 7 / 9 | 3 / 3 | 16.675 / 0.924 = 0.798 + 0.126 | yes | |
+| 3d/transparency_3d | 10 | 0.990065 | 25 | 6 / 6 | 447 / 500 | 11 / 10 | 7 / 11 | 40.183 / 2.673 = 2.118 + 0.555 | no | pixels 0.990065, worst tile 25 |
+| 3d/transparency_3d | 90 | 0.998632 | 0 | 6 / 6 | 447 / 500 | 11 / 10 | 7 / 11 | 16.641 / 1.926 = 1.752 + 0.174 | yes | |
+| animation/eased_motion | 150 | 0.999822 | 0 | 2 / 2 | 443 / 496 | 7 / 9 | 3 / 3 | 16.657 / 1.597 = 1.521 + 0.076 | yes | |
+| animation/eased_motion | 240 | 0.999823 | 0 | 2 / 2 | 443 / 496 | 7 / 9 | 3 / 3 | 16.688 / 1.491 = 1.421 + 0.070 | yes | |
+| animation/eased_motion | 60 | 0.999824 | 0 | 2 / 2 | 443 / 496 | 7 / 9 | 3 / 3 | 20.197 / 1.716 = 1.578 + 0.138 | yes | |
+| animation/color_animation | 120 | 0.998717 | 1 | 0 / 0 | 446 / 499 | 5 / 13 | 1 / 1 | 16.651 / 0.884 = 0.796 + 0.088 | yes | |
+| animation/color_animation | 200 | 0.996870 | 4 | 0 / 0 | 446 / 499 | 5 / 13 | 1 / 1 | 16.676 / 0.858 = 0.786 + 0.072 | yes | |
+| animation/color_animation | 30 | 0.998699 | 2 | 0 / 0 | 446 / 499 | 5 / 13 | 1 / 1 | 23.043 / 1.056 = 0.904 + 0.152 | yes | |
+| 3d/rect_light | 10 | 0.998374 | 8 | 2 / 2 | 446 / 501 | 7 / 9 | 3 / 3 | 36.633 / 1.42 = 1.211 + 0.209 | yes | |
+| 3d/shadow_caster_receiver | 10 | 1.000000 | 0 | 4 / 4 | 446 / 499 | 8 / 9 | 5 / 5 | 36.431 / 1.848 = 1.639 + 0.209 | yes | |
+| 3d/spotlight | 10 | 0.997767 | 10 | 4 / 4 | 530 / 582 | 9 / 11 | 5 / 5 | 37.282 / 5.809 = 4.418 + 1.391 | yes | |
+| 3d/spotlight | 90 | 0.996452 | 10 | 4 / 4 | 530 / 582 | 9 / 11 | 5 / 5 | 16.657 / 4.722 = 4.071 + 0.651 | yes | |
+| transforms/align | 10 | 0.993011 | 11 | 5 / 5 | 453 / 512 | 10 / 12 | 6 / 6 | 36.88 / 2.632 = 2.396 + 0.236 | yes | |
+| transforms/align | 30 | 0.993011 | 11 | 5 / 5 | 453 / 512 | 10 / 12 | 6 / 6 | 16.675 / 1.928 = 1.796 + 0.132 | yes | |
+| 3d/3d_viewport_to_world | 10 | 0.998921 | 1 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 16.636 / 1.25 = 0.995 + 0.255 | yes | |
+| 3d/3d_viewport_to_world | 5 | 0.998921 | 1 | 1 / 1 | 442 / 495 | 6 / 8 | 2 / 2 | 51.852 / 2.098 = 1.915 + 0.183 | yes | |
+| 3d/atmospheric_fog | 10 | 0.998688 | 9 | 2 / 2 | 449 / 504 | 7 / 9 | 3 / 3 | 16.376 / 1.94 = 1.713 + 0.227 | yes | |
+| 3d/atmospheric_fog | 5 | 0.998688 | 9 | 2 / 2 | 449 / 504 | 7 / 9 | 3 / 3 | 52.938 / 2.981 = 2.281 + 0.700 | yes | |
+| 2d/rotate_to_cursor | 10 | 0.999835 | 3 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 16.745 / 1.364 = 1.237 + 0.127 | yes | |
+| 2d/rotate_to_cursor | 5 | 0.999835 | 3 | 0 / 0 | 441 / 494 | 5 / 7 | 1 / 1 | 48.804 / 2.047 = 1.864 + 0.183 | yes | |
+| movement/smooth_follow | 120 | 0.998129 | 0 | 3 / 3 | 448 / 497 | 8 / 9 | 4 / 4 | 16.667 / 1.646 = 1.515 + 0.131 | yes | |
+| movement/smooth_follow | 30 | 0.998157 | 0 | 3 / 3 | 448 / 497 | 8 / 9 | 4 / 4 | 23.464 / 1.861 = 1.648 + 0.213 | yes | |
+| 3d/mesh_ray_cast | 300 | 0.999715 | 1 | 1 / 1 | 447 / 4658 | 6 / 8 | 2 / 2 | 17.406 / 5.1 = 1.336 + 3.764 | yes | |
+| 3d/mesh_ray_cast | 900 | 0.999608 | 1 | 1 / 1 | 447 / 44258 | 6 / 8 | 2 / 2 | 16.665 / 4.966 = 3.53 + 1.436 | yes | |
+| 2d/mesh2d_alpha_mode | 10 | 0.989355 | 8 | 0 / 0 | 446 / 499 | 6 / 13 | 1 / 1 | 16.696 / 1.177 = 1.041 + 0.136 | yes | |
+| 2d/mesh2d_alpha_mode | 5 | 0.989355 | 8 | 0 / 0 | 446 / 499 | 6 / 13 | 1 / 1 | 50.322 / 2.189 = 1.972 + 0.217 | yes | |
+| 3d/lightmaps | 10 | 1.000000 | 0 | 6 / 6 | 453 / 506 | 11 / 13 | 6 / 10 | 16.629 / 2.176 = 1.912 + 0.264 | yes | |
+| 3d/lightmaps | 5 | 1.000000 | 0 | 6 / 6 | 453 / 506 | 11 / 13 | 6 / 10 | 58.102 / 2.333 = 2.133 + 0.200 | yes | |
+| ui/styling/transparency_ui | 10 | 0.999700 | 3 | 0 / 0 | 445 / 492 | 5 / 7 | 1 / 1 | 16.572 / 1.13 = 1.003 + 0.127 | yes | |
+| ui/styling/transparency_ui | 5 | 0.999700 | 3 | 0 / 0 | 445 / 492 | 5 / 7 | 1 / 1 | 49.637 / 1.925 = 1.742 + 0.183 | yes | |
+| ui/layout/fixed_node | 10 | 1.000000 | 0 | 0 / 0 | 444 / 492 | 5 / 7 | 1 / 1 | 16.265 / 1.191 = 1.036 + 0.155 | yes | |
+| ui/layout/fixed_node | 5 | 1.000000 | 0 | 0 / 0 | 444 / 492 | 5 / 7 | 1 / 1 | 49.648 / 1.995 = 1.795 + 0.200 | yes | |
+| ui/images/image_node | 10 | 0.999893 | 1 | 0 / 0 | 442 / 492 | 5 / 7 | 1 / 1 | 16.32 / 1.2 = 1.055 + 0.145 | yes | |
+| ui/images/image_node | 5 | 0.999893 | 1 | 0 / 0 | 442 / 492 | 5 / 7 | 1 / 1 | 48.238 / 2.017 = 1.834 + 0.183 | yes | |
+| ui/text/font_weights | 10 | 0.990279 | 17 | 0 / 0 | 454 / 492 | 5 / 7 | 1 / 1 | 16.718 / 1.104 = 0.968 + 0.136 | yes | |
+| ui/text/font_weights | 5 | 0.990279 | 17 | 0 / 0 | 454 / 492 | 5 / 7 | 1 / 1 | 49.234 / 2.161 = 2.011 + 0.150 | yes | |
+| ui/text/font_variations | 10 | 0.992845 | 21 | 0 / 0 | 452 / 492 | 5 / 7 | 1 / 1 | 16.423 / 1.024 = 0.897 + 0.127 | yes | |
+| ui/text/font_variations | 5 | 0.992845 | 21 | 0 / 0 | 452 / 492 | 5 / 7 | 1 / 1 | 49.923 / 1.854 = 1.687 + 0.167 | yes | |
+| ui/text/text_background_colors | 10 | 0.997735 | 8 | 0 / 0 | 505 / 492 | 5 / 7 | 1 / 1 | 16.75 / 1.245 = 1.09 + 0.155 | yes | |
+| ui/text/text_background_colors | 5 | 0.997735 | 8 | 0 / 0 | 505 / 492 | 5 / 7 | 1 / 1 | 49.491 / 2.123 = 1.973 + 0.150 | yes | |
+| ui/text/strikethrough_and_underline | 10 | 0.990152 | 14 | 0 / 0 | 454 / 492 | 5 / 7 | 1 / 1 | 16.37 / 0.994 = 0.885 + 0.109 | yes | |
+| ui/text/strikethrough_and_underline | 5 | 0.990152 | 14 | 0 / 0 | 454 / 492 | 5 / 7 | 1 / 1 | 51.356 / 1.954 = 1.787 + 0.167 | yes | |
+| ui/scroll_and_overflow/overflow | 10 | 0.998143 | 5 | 0 / 0 | 461 / 492 | 5 / 7 | 1 / 1 | 16.737 / 1.58 = 1.407 + 0.173 | yes | |
+| ui/scroll_and_overflow/overflow | 5 | 0.998143 | 5 | 0 / 0 | 461 / 492 | 5 / 7 | 1 / 1 | 48.451 / 1.909 = 1.759 + 0.150 | yes | |
+| ui/images/ui_texture_atlas | 10 | 0.999601 | 7 | 0 / 0 | 445 / 492 | 5 / 7 | 1 / 1 | 16.722 / 1.119 = 0.983 + 0.136 | yes | |
+| ui/images/ui_texture_atlas | 5 | 0.999601 | 7 | 0 / 0 | 445 / 492 | 5 / 7 | 1 / 1 | 50.405 / 1.882 = 1.732 + 0.150 | yes | |
+| 2d/mesh2d_vertex_color_texture | 10 | 0.998651 | 6 | 0 / 0 | 442 / 495 | 6 / 9 | 1 / 1 | 60.317 / 1.195 = 1.05 + 0.145 | yes | |
+
+## Excluded
+
+| example | why |
+|---|---|
+| no_std/library | a no_std library crate, no app: nothing runs or draws |
+| app/no_renderer | no renderer: draws no frame (its behaviour is a schedule, the world check's, not a picture) |
+| app/headless | no window or renderer: draws no frame |
+| app/without_winit | no window: the app runs its schedule once and draws no frame |
+| app/drag_and_drop | the OS's file drops: window-manager-only |
+| window/monitor_info | lists the OS's monitors: window-manager-only |
+| window/multiple_windows | several OS windows: window-manager-only |
+| window/window_drag_move | the OS moving and resizing the window: window-manager-only |
+| window/custom_cursor_image | the OS cursor's image: window-manager-only |
+| window/low_power | winit's power-saving update modes: window-manager-only |
+| window/scale_factor_override | the OS window's scale factor: window-manager-only |
+| window/transparent_window | the compositor showing through a transparent window: window-manager-only |
+| window/persisting_window_settings | the OS window's position and size saved between runs: window-manager-only |
+| window/resizing | (a test) the OS resizing the window: window-manager-only |
+| window/minimizing | (a test) the OS minimizing the window: window-manager-only |
+| window/desktop_request_redraw | (a test) the OS asking for redraws: window-manager-only |
diff --git a/docs/bevy-parity/excluded.tsv b/docs/bevy-parity/excluded.tsv
new file mode 100644
index 00000000..0e6c7ee5
--- /dev/null
+++ b/docs/bevy-parity/excluded.tsv
@@ -0,0 +1,17 @@
+# path reason (docs/control.feature FC0a: a no_std or window-manager-only example is out, the way WPT exclusions are kept)
+no_std/library a no_std library crate, no app: nothing runs or draws
+app/no_renderer no renderer: draws no frame (its behaviour is a schedule, the world check's, not a picture)
+app/headless no window or renderer: draws no frame
+app/without_winit no window: the app runs its schedule once and draws no frame
+app/drag_and_drop the OS's file drops: window-manager-only
+window/monitor_info lists the OS's monitors: window-manager-only
+window/multiple_windows several OS windows: window-manager-only
+window/window_drag_move the OS moving and resizing the window: window-manager-only
+window/custom_cursor_image the OS cursor's image: window-manager-only
+window/low_power winit's power-saving update modes: window-manager-only
+window/scale_factor_override the OS window's scale factor: window-manager-only
+window/transparent_window the compositor showing through a transparent window: window-manager-only
+window/persisting_window_settings the OS window's position and size saved between runs: window-manager-only
+window/resizing (a test) the OS resizing the window: window-manager-only
+window/minimizing (a test) the OS minimizing the window: window-manager-only
+window/desktop_request_redraw (a test) the OS asking for redraws: window-manager-only
diff --git a/docs/bevy-parity/results.jsonl b/docs/bevy-parity/results.jsonl
new file mode 100644
index 00000000..b640b8dc
--- /dev/null
+++ b/docs/bevy-parity/results.jsonl
@@ -0,0 +1,101 @@
+{"example":"3d/rotate_environment_map","frame":5,"ssim":0.999453,"tile":1,"bevy":{"batch_keys":1,"entities":442,"extents":["0.9945 1.0000 1.0000"],"frame":5,"frame_ms":84.046,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":12,"entities":497,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.9945 1.0000 1.0000"],"frame_ms":5.209,"step_ms":1.533,"cost_ms":6.742},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/rotate_environment_map","frame":60,"ssim":0.999279,"tile":1,"bevy":{"batch_keys":1,"entities":442,"extents":["0.9945 1.0000 1.0000"],"frame":60,"frame_ms":3.628,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":67,"entities":497,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.9945 1.0000 1.0000"],"frame_ms":2.733,"step_ms":0.466,"cost_ms":3.199},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"stress_tests/many_cubes","frame":30,"ssim":0.995176,"tile":1,"bevy":{"batch_keys":2,"entities":10444,"extents":["0.3620 0.3620 0.3620","550.0000 550.0000 550.0000"],"frame":30,"frame_ms":11.411,"materials":3,"mesh_entities":10001,"meshes":7,"other_material":0,"visible":729},"raea":{"frame":37,"entities":10495,"mesh_entities":10001,"visible":729,"meshes":9,"materials":2,"batch_keys":2,"other_material":0,"extents":["0.3620 0.3620 0.3620","550.0000 550.0000 550.0000"],"frame_ms":1.624,"step_ms":0.606,"cost_ms":2.23},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"stress_tests/many_cubes","frame":60,"ssim":0.995154,"tile":1,"bevy":{"batch_keys":2,"entities":10444,"extents":["0.3620 0.3620 0.3620","550.0000 550.0000 550.0000"],"frame":60,"frame_ms":1.686,"materials":3,"mesh_entities":10001,"meshes":7,"other_material":0,"visible":734},"raea":{"frame":67,"entities":10495,"mesh_entities":10001,"visible":733,"meshes":9,"materials":2,"batch_keys":2,"other_material":0,"extents":["0.3620 0.3620 0.3620","550.0000 550.0000 550.0000"],"frame_ms":1.434,"step_ms":0.434,"cost_ms":1.868},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/3d_scene","frame":10,"ssim":0.999998,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["0.5000 0.5000 0.5000","4.0000 4.0000 0.0000"],"frame":10,"frame_ms":16.925,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":17,"entities":498,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","4.0000 4.0000 0.0000"],"frame_ms":1.8,"step_ms":0.191,"cost_ms":1.991},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/3d_scene","frame":5,"ssim":0.999998,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["0.5000 0.5000 0.5000","4.0000 4.0000 0.0000"],"frame":5,"frame_ms":52.554,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":12,"entities":498,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","4.0000 4.0000 0.0000"],"frame_ms":2.854,"step_ms":0.183,"cost_ms":3.037},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"stress_tests/many_lights","frame":30,"ssim":0.999957,"tile":0,"bevy":{"batch_keys":1,"entities":100443,"extents":["49.9006 50.0000 50.0000"],"frame":30,"frame_ms":14.486,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":1},"raea":{"frame":37,"entities":100495,"mesh_entities":2,"visible":1,"meshes":9,"materials":3,"batch_keys":1,"other_material":0,"extents":["49.9006 50.0000 50.0000"],"frame_ms":4.017,"step_ms":2.071,"cost_ms":6.088},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"stress_tests/many_lights","frame":60,"ssim":0.999954,"tile":0,"bevy":{"batch_keys":1,"entities":100445,"extents":["49.9006 50.0000 50.0000"],"frame":60,"frame_ms":2.5,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":1},"raea":{"frame":67,"entities":100495,"mesh_entities":2,"visible":1,"meshes":9,"materials":3,"batch_keys":1,"other_material":0,"extents":["49.9006 50.0000 50.0000"],"frame_ms":3.702,"step_ms":1.736,"cost_ms":5.438},"pixels":true,"draws":true,"time":false,"pass":false,"why":"frame 5.438 ms (3.702 update + 1.736 React step) vs 2.5 ms"}
+{"example":"stress_tests/many_foxes","frame":30,"ssim":0.989592,"tile":3,"bevy":{"batch_keys":2,"entities":30464,"extents":["17.4810 42.8200 84.6165","2500.0000 0.0000 2500.0000","50.9020 42.8200 89.1329","54.3371 42.8200 89.5665","81.3309 42.8200 92.9734","85.2965 42.8200 93.4739","94.6316 42.8200 94.6520","94.6316 42.8200 94.6521"],"frame":30,"frame_ms":13.802,"materials":3,"mesh_entities":1001,"meshes":7,"other_material":0,"visible":1001},"raea":{"frame":39,"entities":31495,"mesh_entities":1001,"visible":1001,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["17.4809 42.8200 84.6165","2500.0000 0.0000 2500.0000","50.9021 42.8200 89.1329","50.9021 42.8200 89.1330","54.3371 42.8200 89.5665","81.3310 42.8200 92.9734","85.2964 42.8200 93.4738","94.6316 42.8200 94.6520"],"frame_ms":8.34,"step_ms":9.594,"cost_ms":17.934},"pixels":true,"draws":true,"time":false,"pass":false,"why":"frame 17.934 ms (8.34 update + 9.594 React step) vs 13.802 ms"}
+{"example":"stress_tests/many_foxes","frame":60,"ssim":0.990304,"tile":3,"bevy":{"batch_keys":2,"entities":30464,"extents":["23.6615 34.9370 84.2011","23.6615 34.9370 84.2012","2500.0000 0.0000 2500.0000","78.2183 34.9370 91.5996","80.4108 34.9370 91.8799","84.3248 34.9370 92.3804","86.0376 34.9370 92.5995","86.0377 34.9371 92.5995"],"frame":60,"frame_ms":2.918,"materials":3,"mesh_entities":1001,"meshes":7,"other_material":0,"visible":1001},"raea":{"frame":69,"entities":31495,"mesh_entities":1001,"visible":1001,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["21.9974 34.9370 83.6309","23.6613 34.9370 84.2011","2500.0000 0.0000 2500.0000","78.2186 34.9370 91.5996","80.4110 34.9370 91.8800","84.3247 34.9370 92.3804","86.0374 34.9370 92.5994","86.0374 34.9371 92.5994"],"frame_ms":8.181,"step_ms":9.241,"cost_ms":17.422},"pixels":true,"draws":true,"time":false,"pass":false,"why":"frame 17.422 ms (8.181 update + 9.241 React step) vs 2.918 ms"}
+{"example":"animation/animated_mesh","frame":30,"ssim":0.996636,"tile":1,"bevy":{"batch_keys":2,"entities":472,"extents":["15.4187 42.8200 84.0474","250000.0000 0.0000 250000.0000"],"frame":30,"frame_ms":24.321,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":40,"entities":526,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["15.4187 42.8200 84.0474","250000.0000 0.0000 250000.0000"],"frame_ms":1.629,"step_ms":0.168,"cost_ms":1.797},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"animation/animated_mesh","frame":60,"ssim":0.996594,"tile":1,"bevy":{"batch_keys":2,"entities":472,"extents":["19.9546 34.9370 82.9540","250000.0000 0.0000 250000.0000"],"frame":60,"frame_ms":16.634,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":70,"entities":526,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["19.9546 34.9370 82.9540","250000.0000 0.0000 250000.0000"],"frame_ms":1.355,"step_ms":0.118,"cost_ms":1.473},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/extended_material","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.9945 1.0000 1.0000"],"frame":30,"frame_ms":23.299,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.9945 1.0000 1.0000"],"frame_ms":0.849,"step_ms":0.216,"cost_ms":1.065},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/extended_material","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":448,"extents":["0.9945 1.0000 1.0000"],"frame":60,"frame_ms":16.738,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.9945 1.0000 1.0000"],"frame_ms":0.781,"step_ms":0.156,"cost_ms":0.937},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/orthographic","frame":10,"ssim":0.999503,"tile":0,"bevy":{"batch_keys":5,"entities":446,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":35.837,"materials":6,"mesh_entities":5,"meshes":10,"other_material":0,"visible":5},"raea":{"frame":17,"entities":499,"mesh_entities":5,"visible":5,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":1.107,"step_ms":0.200,"cost_ms":1.307},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/parenting","frame":30,"ssim":0.999969,"tile":0,"bevy":{"batch_keys":1,"entities":443,"extents":["1.0000 1.0000 1.0000"],"frame":30,"frame_ms":23.457,"materials":2,"mesh_entities":2,"meshes":6,"other_material":0,"visible":2},"raea":{"frame":37,"entities":496,"mesh_entities":2,"visible":2,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["1.0000 1.0000 1.0000"],"frame_ms":0.92,"step_ms":0.174,"cost_ms":1.094},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/parenting","frame":60,"ssim":0.999968,"tile":0,"bevy":{"batch_keys":1,"entities":443,"extents":["1.0000 1.0000 1.0000"],"frame":60,"frame_ms":16.687,"materials":2,"mesh_entities":2,"meshes":6,"other_material":0,"visible":2},"raea":{"frame":67,"entities":496,"mesh_entities":2,"visible":2,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["1.0000 1.0000 1.0000"],"frame_ms":0.854,"step_ms":0.121,"cost_ms":0.975},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/mesh2d","frame":10,"ssim":0.999348,"tile":0,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":33.938,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":494,"mesh_entities":0,"visible":0,"meshes":8,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.076,"step_ms":0.173,"cost_ms":1.249},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite","frame":10,"ssim":0.998326,"tile":8,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":34.443,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.174,"step_ms":0.164,"cost_ms":1.338},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/3d_rotation","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":23.477,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":37,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.93,"step_ms":0.165,"cost_ms":1.095},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/3d_rotation","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":16.649,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":67,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.823,"step_ms":0.116,"cost_ms":0.939},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_flipping","frame":10,"ssim":0.998326,"tile":8,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":34.344,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.098,"step_ms":0.136,"cost_ms":1.234},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/move_sprite","frame":120,"ssim":0.998270,"tile":9,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":120,"frame_ms":16.645,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":127,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.773,"step_ms":0.074,"cost_ms":0.847},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/move_sprite","frame":30,"ssim":0.998261,"tile":8,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":30,"frame_ms":23.012,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.843,"step_ms":0.194,"cost_ms":1.037},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/transparency_2d","frame":10,"ssim":0.997674,"tile":5,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":10,"frame_ms":34.576,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":496,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.074,"step_ms":0.136,"cost_ms":1.21},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/translation","frame":180,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":180,"frame_ms":16.665,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":187,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.762,"step_ms":0.069,"cost_ms":0.831},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/translation","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":20.048,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":67,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.804,"step_ms":0.108,"cost_ms":0.912},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/scale","frame":300,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":300,"frame_ms":16.67,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":307,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.765,"step_ms":0.072,"cost_ms":0.837},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/scale","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":1,"entities":442,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":20.098,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":67,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.807,"step_ms":0.113,"cost_ms":0.92},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/texture","frame":10,"ssim":0.999547,"tile":1,"bevy":{"batch_keys":3,"entities":443,"extents":["4.0000 1.0000 0.0000"],"frame":10,"frame_ms":35.41,"materials":4,"mesh_entities":3,"meshes":6,"other_material":0,"visible":3},"raea":{"frame":17,"entities":497,"mesh_entities":3,"visible":3,"meshes":8,"materials":4,"batch_keys":3,"other_material":0,"extents":["4.0000 0.0000 1.0000"],"frame_ms":1.127,"step_ms":0.200,"cost_ms":1.327},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/animate_shader","frame":30,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":30,"frame_ms":22.794,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":37,"entities":494,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.834,"step_ms":0.110,"cost_ms":0.944},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"shader/animate_shader","frame":60,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":447,"extents":["0.5000 0.5000 0.5000"],"frame":60,"frame_ms":16.6,"materials":1,"mesh_entities":1,"meshes":6,"other_material":1,"visible":1},"raea":{"frame":67,"entities":494,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":0,"other_material":1,"extents":["0.5000 0.5000 0.5000"],"frame_ms":0.828,"step_ms":0.085,"cost_ms":0.913},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_sheet","frame":30,"ssim":0.998820,"tile":5,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":30,"frame_ms":22.829,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.871,"step_ms":0.126,"cost_ms":0.997},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_sheet","frame":60,"ssim":0.999054,"tile":5,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":60,"frame_ms":16.674,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.78,"step_ms":0.085,"cost_ms":0.865},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/pbr","frame":30,"ssim":0.997685,"tile":8,"bevy":{"batch_keys":56,"entities":499,"extents":["0.4475 0.4500 0.4500"],"frame":30,"frame_ms":23.621,"materials":57,"mesh_entities":56,"meshes":6,"other_material":0,"visible":56},"raea":{"frame":37,"entities":550,"mesh_entities":56,"visible":56,"meshes":8,"materials":57,"batch_keys":56,"other_material":0,"extents":["0.4475 0.4500 0.4500"],"frame_ms":0.959,"step_ms":0.100,"cost_ms":1.059},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/pbr","frame":60,"ssim":0.997685,"tile":8,"bevy":{"batch_keys":56,"entities":499,"extents":["0.4475 0.4500 0.4500"],"frame":60,"frame_ms":16.707,"materials":57,"mesh_entities":56,"meshes":6,"other_material":0,"visible":56},"raea":{"frame":67,"entities":550,"mesh_entities":56,"visible":56,"meshes":8,"materials":57,"batch_keys":56,"other_material":0,"extents":["0.4475 0.4500 0.4500"],"frame_ms":0.839,"step_ms":0.062,"cost_ms":0.901},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/animated_material","frame":30,"ssim":0.999892,"tile":0,"bevy":{"batch_keys":9,"entities":449,"extents":["0.2500 0.2500 0.2500"],"frame":30,"frame_ms":23.431,"materials":10,"mesh_entities":9,"meshes":6,"other_material":0,"visible":9},"raea":{"frame":37,"entities":502,"mesh_entities":9,"visible":9,"meshes":8,"materials":19,"batch_keys":9,"other_material":0,"extents":["0.2500 0.2500 0.2500"],"frame_ms":1.008,"step_ms":0.377,"cost_ms":1.385},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/animated_material","frame":60,"ssim":0.999940,"tile":0,"bevy":{"batch_keys":9,"entities":449,"extents":["0.2500 0.2500 0.2500"],"frame":60,"frame_ms":16.682,"materials":10,"mesh_entities":9,"meshes":6,"other_material":0,"visible":9},"raea":{"frame":67,"entities":502,"mesh_entities":9,"visible":9,"meshes":8,"materials":19,"batch_keys":9,"other_material":0,"extents":["0.2500 0.2500 0.2500"],"frame_ms":0.915,"step_ms":0.264,"cost_ms":1.179},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"camera/pan_camera_controller","frame":10,"ssim":0.996838,"tile":10,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":10,"frame_ms":34.381,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.047,"step_ms":0.145,"cost_ms":1.192},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"camera/camera_orbit","frame":10,"ssim":0.999220,"tile":8,"bevy":{"batch_keys":2,"entities":445,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":36.186,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":17,"entities":496,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":1.042,"step_ms":0.218,"cost_ms":1.26},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"camera/projection_zoom","frame":30,"ssim":0.998026,"tile":8,"bevy":{"batch_keys":2,"entities":473,"extents":["12.5927 39.5145 77.3599","2.5000 0.0000 2.5000"],"frame":30,"frame_ms":24.245,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":40,"entities":526,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["12.5927 39.5145 77.3599","2.5000 0.0000 2.5000"],"frame_ms":1.111,"step_ms":0.135,"cost_ms":1.246},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_animation","frame":12,"ssim":0.997217,"tile":9,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":12,"frame_ms":32.015,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":19,"entities":495,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.986,"step_ms":0.162,"cost_ms":1.148},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_animation","frame":30,"ssim":0.997017,"tile":8,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":30,"frame_ms":16.77,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":495,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.881,"step_ms":0.132,"cost_ms":1.013},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_animation","frame":60,"ssim":0.997099,"tile":8,"bevy":{"batch_keys":0,"entities":443,"extents":[],"frame":60,"frame_ms":16.673,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":495,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.8,"step_ms":0.092,"cost_ms":0.892},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_tile","frame":30,"ssim":0.998633,"tile":7,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":30,"frame_ms":22.925,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.889,"step_ms":0.129,"cost_ms":1.018},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/sprite_tile","frame":300,"ssim":0.992213,"tile":7,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":300,"frame_ms":16.666,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":307,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.771,"step_ms":0.059,"cost_ms":0.83},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/vertex_colors","frame":10,"ssim":0.999019,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":38.287,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":17,"entities":496,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":1.983,"step_ms":0.218,"cost_ms":2.201},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/spherical_area_lights","frame":10,"ssim":0.999738,"tile":0,"bevy":{"batch_keys":7,"entities":453,"extents":["1.0000 1.0000 1.0000","50.0000 0.0000 50.0000"],"frame":10,"frame_ms":35.843,"materials":8,"mesh_entities":7,"meshes":7,"other_material":0,"visible":7},"raea":{"frame":17,"entities":506,"mesh_entities":7,"visible":7,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["1.0000 1.0000 1.0000","50.0000 0.0000 50.0000"],"frame_ms":1.533,"step_ms":0.200,"cost_ms":1.733},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/fog_volumes","frame":10,"ssim":0.995718,"tile":14,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":10,"frame_ms":35.722,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.343,"step_ms":0.291,"cost_ms":1.634},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/fog_volumes","frame":60,"ssim":0.995939,"tile":4,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":60,"frame_ms":16.679,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":67,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.197,"step_ms":0.131,"cost_ms":1.328},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/bloom_3d","frame":10,"ssim":0.996668,"tile":11,"bevy":{"batch_keys":4,"entities":541,"extents":["0.3978 0.4000 0.4000"],"frame":10,"frame_ms":36.436,"materials":5,"mesh_entities":100,"meshes":6,"other_material":0,"visible":46},"raea":{"frame":17,"entities":593,"mesh_entities":100,"visible":46,"meshes":8,"materials":5,"batch_keys":4,"other_material":0,"extents":["0.3978 0.4000 0.4000"],"frame_ms":1.823,"step_ms":1.082,"cost_ms":2.905},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/bloom_3d","frame":60,"ssim":0.996631,"tile":12,"bevy":{"batch_keys":4,"entities":541,"extents":["0.3978 0.4000 0.4000"],"frame":60,"frame_ms":16.689,"materials":5,"mesh_entities":100,"meshes":6,"other_material":0,"visible":46},"raea":{"frame":67,"entities":593,"mesh_entities":100,"visible":46,"meshes":8,"materials":5,"batch_keys":4,"other_material":0,"extents":["0.3978 0.4000 0.4000"],"frame_ms":1.426,"step_ms":0.610,"cost_ms":2.036},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/transform","frame":10,"ssim":0.999999,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["0.5000 0.5000 0.5000","3.0000 3.0000 2.9996"],"frame":10,"frame_ms":36.165,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":17,"entities":496,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","3.0000 3.0000 2.9996"],"frame_ms":1.291,"step_ms":0.336,"cost_ms":1.627},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/transform","frame":120,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["0.5000 0.5000 0.5000","3.0000 3.0000 2.9996"],"frame":120,"frame_ms":16.675,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":127,"entities":496,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","3.0000 3.0000 2.9996"],"frame_ms":0.798,"step_ms":0.126,"cost_ms":0.924},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/transparency_3d","frame":10,"ssim":0.990065,"tile":25,"bevy":{"batch_keys":6,"entities":447,"extents":["0.5000 0.5000 0.5000","3.0000 0.0000 3.0000"],"frame":10,"frame_ms":40.183,"materials":7,"mesh_entities":6,"meshes":11,"other_material":0,"visible":6},"raea":{"frame":17,"entities":500,"mesh_entities":6,"visible":6,"meshes":10,"materials":11,"batch_keys":6,"other_material":0,"extents":["0.5000 0.5000 0.5000","3.0000 0.0000 3.0000"],"frame_ms":2.118,"step_ms":0.555,"cost_ms":2.673},"pixels":false,"draws":true,"time":true,"pass":false,"why":"pixels 0.990065, worst tile 25"}
+{"example":"3d/transparency_3d","frame":90,"ssim":0.998632,"tile":0,"bevy":{"batch_keys":6,"entities":447,"extents":["0.5000 0.5000 0.5000","3.0000 0.0000 3.0000"],"frame":90,"frame_ms":16.641,"materials":7,"mesh_entities":6,"meshes":11,"other_material":0,"visible":6},"raea":{"frame":97,"entities":500,"mesh_entities":6,"visible":6,"meshes":10,"materials":11,"batch_keys":6,"other_material":0,"extents":["0.5000 0.5000 0.5000","3.0000 0.0000 3.0000"],"frame_ms":1.752,"step_ms":0.174,"cost_ms":1.926},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"animation/eased_motion","frame":150,"ssim":0.999822,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["1.0000 1.0000 1.0000","25.0000 0.0000 25.0000"],"frame":150,"frame_ms":16.657,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":157,"entities":496,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["1.0000 1.0000 1.0000","25.0000 0.0000 25.0000"],"frame_ms":1.521,"step_ms":0.076,"cost_ms":1.597},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"animation/eased_motion","frame":240,"ssim":0.999823,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["1.0000 1.0000 1.0000","25.0000 0.0000 25.0000"],"frame":240,"frame_ms":16.688,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":247,"entities":496,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["1.0000 1.0000 1.0000","25.0000 0.0000 25.0000"],"frame_ms":1.421,"step_ms":0.070,"cost_ms":1.491},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"animation/eased_motion","frame":60,"ssim":0.999824,"tile":0,"bevy":{"batch_keys":2,"entities":443,"extents":["1.0000 1.0000 1.0000","25.0000 0.0000 25.0000"],"frame":60,"frame_ms":20.197,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":67,"entities":496,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["1.0000 1.0000 1.0000","25.0000 0.0000 25.0000"],"frame_ms":1.578,"step_ms":0.138,"cost_ms":1.716},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"animation/color_animation","frame":120,"ssim":0.998717,"tile":1,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":120,"frame_ms":16.651,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":127,"entities":499,"mesh_entities":0,"visible":0,"meshes":13,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.796,"step_ms":0.088,"cost_ms":0.884},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"animation/color_animation","frame":200,"ssim":0.996870,"tile":4,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":200,"frame_ms":16.676,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":207,"entities":499,"mesh_entities":0,"visible":0,"meshes":13,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.786,"step_ms":0.072,"cost_ms":0.858},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"animation/color_animation","frame":30,"ssim":0.998699,"tile":2,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":30,"frame_ms":23.043,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":37,"entities":499,"mesh_entities":0,"visible":0,"meshes":13,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.904,"step_ms":0.152,"cost_ms":1.056},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/rect_light","frame":10,"ssim":0.998374,"tile":8,"bevy":{"batch_keys":2,"entities":446,"extents":["0.9945 1.0000 1.0000","10.0000 0.0000 10.0000"],"frame":10,"frame_ms":36.633,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":17,"entities":501,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.9945 1.0000 1.0000","10.0000 0.0000 10.0000"],"frame_ms":1.211,"step_ms":0.209,"cost_ms":1.42},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/shadow_caster_receiver","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":4,"entities":446,"extents":["0.2486 0.2500 0.2500","10.0000 0.0000 10.0000"],"frame":10,"frame_ms":36.431,"materials":5,"mesh_entities":4,"meshes":8,"other_material":0,"visible":4},"raea":{"frame":17,"entities":499,"mesh_entities":4,"visible":4,"meshes":9,"materials":5,"batch_keys":4,"other_material":0,"extents":["0.2486 0.2500 0.2500","10.0000 0.0000 10.0000"],"frame_ms":1.639,"step_ms":0.209,"cost_ms":1.848},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/spotlight","frame":10,"ssim":0.997767,"tile":10,"bevy":{"batch_keys":4,"entities":530,"extents":["0.0500 0.0500 0.0500","0.1000 0.1000 0.1000","0.2500 0.2500 0.2500","50.0000 0.0000 50.0000"],"frame":10,"frame_ms":37.282,"materials":5,"mesh_entities":73,"meshes":9,"other_material":0,"visible":73},"raea":{"frame":17,"entities":582,"mesh_entities":73,"visible":73,"meshes":11,"materials":5,"batch_keys":4,"other_material":0,"extents":["0.0500 0.0500 0.0500","0.1000 0.1000 0.1000","0.2500 0.2500 0.2500","50.0000 0.0000 50.0000"],"frame_ms":4.418,"step_ms":1.391,"cost_ms":5.809},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/spotlight","frame":90,"ssim":0.996452,"tile":10,"bevy":{"batch_keys":4,"entities":530,"extents":["0.0500 0.0500 0.0500","0.1000 0.1000 0.1000","0.2500 0.2500 0.2500","50.0000 0.0000 50.0000"],"frame":90,"frame_ms":16.657,"materials":5,"mesh_entities":73,"meshes":9,"other_material":0,"visible":73},"raea":{"frame":97,"entities":582,"mesh_entities":73,"visible":73,"meshes":11,"materials":5,"batch_keys":4,"other_material":0,"extents":["0.0500 0.0500 0.0500","0.1000 0.1000 0.1000","0.2500 0.2500 0.2500","50.0000 0.0000 50.0000"],"frame_ms":4.071,"step_ms":0.651,"cost_ms":4.722},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/align","frame":10,"ssim":0.993011,"tile":11,"bevy":{"batch_keys":5,"entities":453,"extents":["1.4000 0.4500 1.1128","50.0000 0.0000 50.0000"],"frame":10,"frame_ms":36.88,"materials":6,"mesh_entities":5,"meshes":10,"other_material":0,"visible":5},"raea":{"frame":19,"entities":512,"mesh_entities":5,"visible":5,"meshes":12,"materials":6,"batch_keys":5,"other_material":0,"extents":["1.4000 0.4500 1.1128","50.0000 0.0000 50.0000"],"frame_ms":2.396,"step_ms":0.236,"cost_ms":2.632},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"transforms/align","frame":30,"ssim":0.993011,"tile":11,"bevy":{"batch_keys":5,"entities":453,"extents":["1.4000 0.4500 1.1128","50.0000 0.0000 50.0000"],"frame":30,"frame_ms":16.675,"materials":6,"mesh_entities":5,"meshes":10,"other_material":0,"visible":5},"raea":{"frame":39,"entities":512,"mesh_entities":5,"visible":5,"meshes":12,"materials":6,"batch_keys":5,"other_material":0,"extents":["1.4000 0.4500 1.1128","50.0000 0.0000 50.0000"],"frame_ms":1.796,"step_ms":0.132,"cost_ms":1.928},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/3d_viewport_to_world","frame":10,"ssim":0.998921,"tile":1,"bevy":{"batch_keys":1,"entities":442,"extents":["10.0000 0.0000 10.0000"],"frame":10,"frame_ms":16.636,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":17,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["10.0000 0.0000 10.0000"],"frame_ms":0.995,"step_ms":0.255,"cost_ms":1.25},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/3d_viewport_to_world","frame":5,"ssim":0.998921,"tile":1,"bevy":{"batch_keys":1,"entities":442,"extents":["10.0000 0.0000 10.0000"],"frame":5,"frame_ms":51.852,"materials":2,"mesh_entities":1,"meshes":6,"other_material":0,"visible":1},"raea":{"frame":12,"entities":495,"mesh_entities":1,"visible":1,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["10.0000 0.0000 10.0000"],"frame_ms":1.915,"step_ms":0.183,"cost_ms":2.098},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/atmospheric_fog","frame":10,"ssim":0.998688,"tile":9,"bevy":{"batch_keys":2,"entities":449,"extents":["1.0000 0.1674 1.0026","1.0000 0.5000 0.5000"],"frame":10,"frame_ms":16.376,"materials":3,"mesh_entities":3,"meshes":7,"other_material":0,"visible":3},"raea":{"frame":19,"entities":504,"mesh_entities":3,"visible":3,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["1.0000 0.1674 1.0026","1.0000 0.5000 0.5000"],"frame_ms":1.713,"step_ms":0.227,"cost_ms":1.94},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/atmospheric_fog","frame":5,"ssim":0.998688,"tile":9,"bevy":{"batch_keys":2,"entities":449,"extents":["1.0000 0.1674 1.0026","1.0000 0.5000 0.5000"],"frame":5,"frame_ms":52.938,"materials":3,"mesh_entities":3,"meshes":7,"other_material":0,"visible":3},"raea":{"frame":14,"entities":504,"mesh_entities":3,"visible":3,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["1.0000 0.1674 1.0026","1.0000 0.5000 0.5000"],"frame_ms":2.281,"step_ms":0.700,"cost_ms":2.981},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/rotate_to_cursor","frame":10,"ssim":0.999835,"tile":3,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":10,"frame_ms":16.745,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.237,"step_ms":0.127,"cost_ms":1.364},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/rotate_to_cursor","frame":5,"ssim":0.999835,"tile":3,"bevy":{"batch_keys":0,"entities":441,"extents":[],"frame":5,"frame_ms":48.804,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":494,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.864,"step_ms":0.183,"cost_ms":2.047},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"movement/smooth_follow","frame":120,"ssim":0.998129,"tile":0,"bevy":{"batch_keys":3,"entities":448,"extents":["0.2983 0.3000 0.3000","6.0000 0.0000 6.0000"],"frame":120,"frame_ms":16.667,"materials":4,"mesh_entities":3,"meshes":8,"other_material":0,"visible":3},"raea":{"frame":127,"entities":497,"mesh_entities":3,"visible":3,"meshes":9,"materials":4,"batch_keys":3,"other_material":0,"extents":["0.2983 0.3000 0.3000","6.0000 0.0000 6.0000"],"frame_ms":1.515,"step_ms":0.131,"cost_ms":1.646},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"movement/smooth_follow","frame":30,"ssim":0.998157,"tile":0,"bevy":{"batch_keys":3,"entities":448,"extents":["0.2983 0.3000 0.3000","6.0000 0.0000 6.0000"],"frame":30,"frame_ms":23.464,"materials":4,"mesh_entities":3,"meshes":8,"other_material":0,"visible":3},"raea":{"frame":37,"entities":497,"mesh_entities":3,"visible":3,"meshes":9,"materials":4,"batch_keys":3,"other_material":0,"extents":["0.2983 0.3000 0.3000","6.0000 0.0000 6.0000"],"frame_ms":1.648,"step_ms":0.213,"cost_ms":1.861},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/mesh_ray_cast","frame":300,"ssim":0.999715,"tile":1,"bevy":{"batch_keys":1,"entities":447,"extents":["0.5000 0.0000 0.5000"],"frame":300,"frame_ms":17.406,"materials":2,"mesh_entities":6,"meshes":6,"other_material":0,"visible":6},"raea":{"frame":307,"entities":4658,"mesh_entities":6,"visible":6,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.0000 0.5000"],"frame_ms":1.336,"step_ms":3.764,"cost_ms":5.1},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/mesh_ray_cast","frame":900,"ssim":0.999608,"tile":1,"bevy":{"batch_keys":1,"entities":447,"extents":["0.5000 0.0000 0.5000"],"frame":900,"frame_ms":16.665,"materials":2,"mesh_entities":6,"meshes":6,"other_material":0,"visible":6},"raea":{"frame":907,"entities":44258,"mesh_entities":6,"visible":6,"meshes":8,"materials":2,"batch_keys":1,"other_material":0,"extents":["0.5000 0.0000 0.5000"],"frame_ms":3.53,"step_ms":1.436,"cost_ms":4.966},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/mesh2d_alpha_mode","frame":10,"ssim":0.989355,"tile":8,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":10,"frame_ms":16.696,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":499,"mesh_entities":0,"visible":0,"meshes":13,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.041,"step_ms":0.136,"cost_ms":1.177},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/mesh2d_alpha_mode","frame":5,"ssim":0.989355,"tile":8,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":5,"frame_ms":50.322,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":12,"entities":499,"mesh_entities":0,"visible":0,"meshes":13,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.972,"step_ms":0.217,"cost_ms":2.189},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/lightmaps","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":6,"entities":453,"extents":["0.0001 274.4000 279.6000","102.6464 82.5000 102.6464","103.2390 165.0000 103.2390","278.0000 274.4000 279.6001","3.2000 274.4000 279.6000","65.0000 0.0000 52.5000"],"frame":10,"frame_ms":16.629,"materials":6,"mesh_entities":6,"meshes":11,"other_material":0,"visible":6},"raea":{"frame":19,"entities":506,"mesh_entities":6,"visible":6,"meshes":13,"materials":10,"batch_keys":6,"other_material":0,"extents":["0.0001 274.4000 279.6000","102.6464 82.5000 102.6464","103.2390 165.0000 103.2390","278.0000 274.4000 279.6001","3.2000 274.4000 279.6000","65.0000 0.0000 52.5000"],"frame_ms":1.912,"step_ms":0.264,"cost_ms":2.176},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"3d/lightmaps","frame":5,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":6,"entities":453,"extents":["0.0001 274.4000 279.6000","102.6464 82.5000 102.6464","103.2390 165.0000 103.2390","278.0000 274.4000 279.6001","3.2000 274.4000 279.6000","65.0000 0.0000 52.5000"],"frame":5,"frame_ms":58.102,"materials":6,"mesh_entities":6,"meshes":11,"other_material":0,"visible":6},"raea":{"frame":14,"entities":506,"mesh_entities":6,"visible":6,"meshes":13,"materials":10,"batch_keys":6,"other_material":0,"extents":["0.0001 274.4000 279.6000","102.6464 82.5000 102.6464","103.2390 165.0000 103.2390","278.0000 274.4000 279.6001","3.2000 274.4000 279.6000","65.0000 0.0000 52.5000"],"frame_ms":2.133,"step_ms":0.200,"cost_ms":2.333},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/styling/transparency_ui","frame":10,"ssim":0.999700,"tile":3,"bevy":{"batch_keys":0,"entities":445,"extents":[],"frame":10,"frame_ms":16.572,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.003,"step_ms":0.127,"cost_ms":1.13},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/styling/transparency_ui","frame":5,"ssim":0.999700,"tile":3,"bevy":{"batch_keys":0,"entities":445,"extents":[],"frame":5,"frame_ms":49.637,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.742,"step_ms":0.183,"cost_ms":1.925},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/layout/fixed_node","frame":10,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":444,"extents":[],"frame":10,"frame_ms":16.265,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.036,"step_ms":0.155,"cost_ms":1.191},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/layout/fixed_node","frame":5,"ssim":1.000000,"tile":0,"bevy":{"batch_keys":0,"entities":444,"extents":[],"frame":5,"frame_ms":49.648,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.795,"step_ms":0.200,"cost_ms":1.995},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/images/image_node","frame":10,"ssim":0.999893,"tile":1,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":10,"frame_ms":16.32,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.055,"step_ms":0.145,"cost_ms":1.2},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/images/image_node","frame":5,"ssim":0.999893,"tile":1,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":5,"frame_ms":48.238,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.834,"step_ms":0.183,"cost_ms":2.017},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/font_weights","frame":10,"ssim":0.990279,"tile":17,"bevy":{"batch_keys":0,"entities":454,"extents":[],"frame":10,"frame_ms":16.718,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.968,"step_ms":0.136,"cost_ms":1.104},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/font_weights","frame":5,"ssim":0.990279,"tile":17,"bevy":{"batch_keys":0,"entities":454,"extents":[],"frame":5,"frame_ms":49.234,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":2.011,"step_ms":0.150,"cost_ms":2.161},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/font_variations","frame":10,"ssim":0.992845,"tile":21,"bevy":{"batch_keys":0,"entities":452,"extents":[],"frame":10,"frame_ms":16.423,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.897,"step_ms":0.127,"cost_ms":1.024},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/font_variations","frame":5,"ssim":0.992845,"tile":21,"bevy":{"batch_keys":0,"entities":452,"extents":[],"frame":5,"frame_ms":49.923,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.687,"step_ms":0.167,"cost_ms":1.854},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/text_background_colors","frame":10,"ssim":0.997735,"tile":8,"bevy":{"batch_keys":0,"entities":505,"extents":[],"frame":10,"frame_ms":16.75,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.09,"step_ms":0.155,"cost_ms":1.245},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/text_background_colors","frame":5,"ssim":0.997735,"tile":8,"bevy":{"batch_keys":0,"entities":505,"extents":[],"frame":5,"frame_ms":49.491,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.973,"step_ms":0.150,"cost_ms":2.123},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/strikethrough_and_underline","frame":10,"ssim":0.990152,"tile":14,"bevy":{"batch_keys":0,"entities":454,"extents":[],"frame":10,"frame_ms":16.37,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.885,"step_ms":0.109,"cost_ms":0.994},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/text/strikethrough_and_underline","frame":5,"ssim":0.990152,"tile":14,"bevy":{"batch_keys":0,"entities":454,"extents":[],"frame":5,"frame_ms":51.356,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.787,"step_ms":0.167,"cost_ms":1.954},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/scroll_and_overflow/overflow","frame":10,"ssim":0.998143,"tile":5,"bevy":{"batch_keys":0,"entities":461,"extents":[],"frame":10,"frame_ms":16.737,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.407,"step_ms":0.173,"cost_ms":1.58},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/scroll_and_overflow/overflow","frame":5,"ssim":0.998143,"tile":5,"bevy":{"batch_keys":0,"entities":461,"extents":[],"frame":5,"frame_ms":48.451,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.759,"step_ms":0.150,"cost_ms":1.909},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/images/ui_texture_atlas","frame":10,"ssim":0.999601,"tile":7,"bevy":{"batch_keys":0,"entities":445,"extents":[],"frame":10,"frame_ms":16.722,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.983,"step_ms":0.136,"cost_ms":1.119},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/images/ui_texture_atlas","frame":5,"ssim":0.999601,"tile":7,"bevy":{"batch_keys":0,"entities":445,"extents":[],"frame":5,"frame_ms":50.405,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":12,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.732,"step_ms":0.150,"cost_ms":1.882},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"2d/mesh2d_vertex_color_texture","frame":10,"ssim":0.998651,"tile":6,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":10,"frame_ms":60.317,"materials":1,"mesh_entities":0,"meshes":6,"other_material":0,"visible":0},"raea":{"frame":17,"entities":495,"mesh_entities":0,"visible":0,"meshes":9,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.05,"step_ms":0.145,"cost_ms":1.195},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
diff --git a/docs/blender.feature b/docs/blender.feature
new file mode 100644
index 00000000..daa66ee0
--- /dev/null
+++ b/docs/blender.feature
@@ -0,0 +1,82 @@
+@spec
+Feature: Blender as a measured workshop step: an asset passes through it on its way into media/
+ Shane, 2026-11-07: "how do we correctly utilize blender AND how do we correctly prompt in the skill how and when to
+ use blender versus our manifold/3d-mesh building in typescript". The 11-06 research (REPORT.md sections 1, 2, 4, 8):
+ Claude models badly in bpy (CADClamp: 0.889 in code-CAD, 0.499 in bpy) and well in code-shaped work on assets that
+ are already good (rigs, bakes, LODs, batch fixes); a live Blender session is a bad source of truth (five agents on a
+ shared MCP stacked their props at the origin; headless won the edit round). So TSX is the scene; solids, sdf and grow
+ make what numbers or rules define; raea gen and CC0 libraries make what looks define; and Blender is the workshop
+ between an asset's source and media/. It never places, lights, frames, materials or animates a scene.
+
+ Background:
+ Given a Blender step is a saved script in the project's blender/ folder, run by `raea blender run`, re-run when
+ its source changes; the library ships in sdk/guides/craft/bevy/blender/ and `raea blender run blender/X.py`
+ copies a library script there the first time
+ And every script takes its arguments after `--`, writes one .glb with the source's licence sidecar beside it
+ (MODEL.glb.json), and exits non-zero with the reason when it can't do its job
+ And a step is triggered by a measured finding, never by taste: each finding below carries its fix as text
+ ("fix: raea blender run blender/X.py ...") and in its JSON (`fix.blender`, `fix.run`)
+
+ Rule: Getting a solid out
+
+ @done
+ Scenario: BL1. raea solid export writes a solid as one .glb
+ Given a solid file and `raea solid export FILE.ts -o OUT.glb [--set k=v,...] [--part NAME]`
+ Then the solid (or the one part) is written as a .glb, metres, y up
+ And an empty or non-watertight solid is refused, with solid info's findings printed
+ And the .glb read back has the same volume, pieces and box as the solid, within 0.5%
+
+ Rule: The script library
+
+ @done
+ Scenario: BL2. convert.py: FBX, OBJ or .blend to one .glb
+ @done
+ Scenario: BL3. decimate.py: to a triangle budget (a ratio or a count), with LOD copies for far placements
+ @done
+ Scenario: BL4. repair.py: merged doubles, loose debris dropped, holes filled, normals out, or a voxel remesh
+ @done
+ Scenario: BL5. split.py: one blob into named parts by boxes, each its own node (a door that opens)
+ @done
+ Scenario: BL6. bake.py: unwrapped UVs, ambient occlusion baked, and a normal map from a high-poly source
+ @done
+ Scenario: BL7. rig.py: a bone chain and rigid or automatic weights for a model with no skeleton, and named pose clips
+ @done
+ Scenario: BL8. cloth.py: a cloth simulated and baked to a morph-target clip
+ @done
+ Scenario: BL9. Each script has run once on a real asset and its output passes raea gen check
+
+ Rule: Measured triggers
+
+ @done
+ Scenario: BL10. Triangles over the budget for the viewing distance name decimate.py
+ Given gen check's --seen M (or scene lint's camera distance to the model)
+ Then the budget is 150 000 triangles at 1 m or closer, falling with the square of the distance, at least 2 000
+ @done
+ Scenario: BL11. A wrong piece count names repair.py (generator debris) or split.py (fewer parts than --parts)
+ @done
+ Scenario: BL12. Open or over-shared edges on a model meant to be solid name repair.py
+ @done
+ Scenario: BL13. A blob the brief says moves in parts (--parts door,body) names split.py
+ @done
+ Scenario: BL14. Textures wanted on a solid (its file's `needs.textured`) name solid export then bake.py
+ @done
+ Scenario: BL15. A model the brief says moves (--rig) with no skin names rig.py
+ @done
+ Scenario: BL16. A format raea can't load (gen check FILE.fbx, a Model src .obj) names convert.py
+
+ Rule: The skill
+
+ @done
+ Scenario: BL17. scenes.md routes by what defines an object and says when it then goes through Blender
+ @done
+ Scenario: BL18. blender.md is written around the triggers: headless, saved scripts, live MCP to inspect only
+ @done
+ Scenario: BL19. prompts.md's builder prompt routes and uses Blender the same way
+
+ Rule: Proven
+
+ @done
+ Scenario: BL20. A workbench corner uses a solid baked in Blender, a CC0 model converted and decimated, a Tripo
+ model split into parts and a model rigged in Blender and posed in raea; every step re-runs from scratch
+ @done
+ Scenario: BL21. Its review sheets are judged by Kimi and clef every round until Kimi passes or 8 rounds stall (11-07: 8 rounds, stalled; best Kimi round 4)
diff --git a/docs/engine.md b/docs/engine.md
new file mode 100644
index 00000000..544a9403
--- /dev/null
+++ b/docs/engine.md
@@ -0,0 +1,65 @@
+# Where raea's engine is going
+
+raea plans its engine work in feature files kept outside this repository. This page summarizes each area so you can
+see what is being built and why. Issues about any of it are welcome (CONTRIBUTING.md).
+
+## Bevy is the only engine
+
+Bevy schedules, stores and renders everything. React and TypeScript run on JavaScriptCore inside a Bevy app and
+render as Bevy entities and systems. There is no second engine or browser beside it. raea is on Bevy 0.20.
+
+## Everything Bevy does, from TypeScript
+
+Anything you can do in Bevy should be possible from raea's TypeScript SDK: components, materials, lights, cameras,
+post-processing, assets and ECS worlds. Each gap is written as a small headless case first, so it closes only when that
+case renders correctly. Work in progress:
+
+- **Full control without house conventions.** Custom shaders, complex lighting strategies, instancing and live
+ control of games, each measured against Bevy's own examples rendered by Bevy.
+- **Shaders, materials, textures and frame passes.** These work the way Bevy has them: WGSL and GLSL, material
+ extensions, render targets and passes.
+- **The plugin catalog.** Third-party Bevy plugins are declared, typed and usable from TSX through the same SDK.
+
+## One SDK, laid out like Bevy and written like React
+
+The SDK follows Bevy's taxonomy (`raea/3d`, `raea/ui` and so on), so people and agents who know Bevy find things where
+they expect them. Authoring has no split between 2D and 3D, or between CPU and GPU. Recipes such as paint looks and
+retro shaders live in `examples/`, not in the engine, and import only `raea` and `raea/<part>`.
+
+## HTML, CSS and React at browser parity
+
+Blitz runs inside Bevy. It resolves CSS with Stylo and lays the page out with Taffy, and Vello paints it on Bevy's GPU
+device. One bridge joins the page to the world, so any element can become a layer in 3D. Parity is measured, not
+judged: the same TSX is rendered by Chrome as the reference and by raea, then compared pixel by pixel. Full React
+parity with the browser is a long-term goal, not a promise of the canary releases.
+
+## Rendering: ray tracing and denoising
+
+raea is adding Bevy's Solari path tracer and MetalFX denoising and upscaling on the Mac. It also has an optional
+integration for MLX-DLSS, whose weights are the user's own and never ship with raea. All of these need motion vectors
+and depth from raea's render, so those come first.
+
+## Characters
+
+There is one character skeleton, MakeHuman's game_engine rig, used natively by the character SDK for clips, retargeting,
+foot placement, motion matching, grasping and ragdolls.
+
+## Targets and ports
+
+An app targets the web or native by a setting, with one SDK. Releases build for macOS and Linux. A Windows build is in
+progress.
+
+## Rune as a second UI host
+
+raea's React-to-host op wire is not tied to a framework. Rune (a native GPU UI framework in Rust) is being tried as a
+second host beside Blitz, for native apps, video and layers in Bevy.
+
+## Skills that stay true
+
+The public agent skills (`raea`, `raea-bevy` and the craft guides) are generated from the code where they can be and
+checked against it where they can't, so they don't drift from the engine.
+
+## Releases
+
+Releases are built from a tag on GitHub's runners with attested provenance, and the binaries are attached to the
+GitHub release.
diff --git a/docs/lightspeed.feature b/docs/lightspeed.feature
index e0c3dd5c..20614782 100644
--- a/docs/lightspeed.feature
+++ b/docs/lightspeed.feature
@@ -6,7 +6,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
difference between play and render. Each will never quite reach zero, which is the point: every row below has a
measured value, a target, and a path toward zero.
- Owner: the lightspeed agent (session "lightspeed"), orchestrated by an agent session. It loops: pick the row with the biggest
+ Owner: the lightspeed agent (session "lightspeed"), orchestrated by the orchestrator. It loops: pick the row with the biggest
measured gap, attribute where the time or bytes go, take the structural lever that moves it, measure before and after,
commit, update this file. Individual spikes are knocked down only after the structural levers. Companion plan:
docs/zeroheap.feature (lever L4).
@@ -34,8 +34,8 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
Rule: Lightspeed's goals (set 2026-10-19, after the four multi-day levers; the user: "just focus on lightspeed work")
Scenario: Who owns what now
Then lightspeed owns performance and optimization end to end: it builds its levers itself, not only measures them
- (the user moved an agent session off them, 2026-10-19)
- And an agent session owns docs/vite-in-raea.md: A, Bun's build crates in process (the 7 places raea starts the bun CLI);
+ (the user moved the orchestrator off them, 2026-10-19)
+ And the orchestrator owns docs/vite-in-raea.md: A, Bun's build crates in process (the 7 places raea starts the bun CLI);
B, bun_jsc as raea's JS engine, an evaluation; C, the page engine's 11 gaps from jetway. Lightspeed measures B
the way T3 was (check.sh titles full and incremental, pong's three jsheap fixtures) and counts its bytes against
R7; the exported player keeps the system JSC unless the user accepts those bytes; B tells lightspeed before it
@@ -127,7 +127,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
quiet nightly has measured anything yet (see "The quiet nightly that didn't run")
And G9, quality polish: Q2's last 2. Met 2026-10-19: the full corpus has 0 failing (95 exact, 75 ok)
Scenario: The second goal list (set 2026-10-19 evening, after G5: the best moves aside from Bevy, in order)
- Given the founder's list: 1 compositor-only motion, 2 an incremental paint record, 3 the quads compositor on wgpu-hal,
+ Given the user's list: 1 compositor-only motion, 2 an incremental paint record, 3 the quads compositor on wgpu-hal,
4 a binary path for 3D transforms, 5 Bevy trims by configuration only, 6 frame time and power as the scoreboard
with allocations as a guard, 7 the Stylo and Blitz patches offered upstream
Then 1, step 1 (5843067): a left/top-only change moves the box where it's laid out (no restyle, no relayout),
@@ -154,7 +154,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
Scenario: What waits on the user
Then F1 in the app's window needs a visible window the user agrees to (lightspeed never shows one unasked)
And R5 and Q5 need the iPhone unlocked and connected
- And R7 above 65 MB, if B ships a vendored WebKit in the player, is the founder's call on the counted bytes
+ And R7 above 65 MB, if B ships a vendored WebKit in the player, is the user's call on the counted bytes
Scenario: What stays blocked, with its reason
Then T1, T2, T4: the media engine's encode floor (~275 fps at 1080x1920 for H.264, 261 for HEVC Main10), one
engine on this chip; G6 is the only lever left on our side
@@ -170,7 +170,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
| F2 | frame work p99 / p99.9, games at 120 fps | clean run (load 3-5, no other jobs, 02b4852): arena3d p99 3.87 / p99.9 4.58 ms (its steady 3D frame; Bevy's render ~2 ms), pong 1.72 / 2.80, platformer 1.12 / 1.52 | settle race fixed (aa4f78a: p99.9 507 -> 18-36 ms paired); arena3d p99 3.7-4.1 -> 2.7-3.2 ms (single-threaded Bevy, 4353e23), under load | p99.9 <= 4 ms |
| F3 | missed frames in 5 min, pong and platformer | met: 0 missed frames in 3 x 60 s (clean run, load 3-5, 02b4852) | 3 in 2 x 60 s at load 7 (aa4f78a); 0 needs a quiet run | 0 at load <= 6 and at load 20 |
| F4 | scrub / seek p99 | met: 1080p (ts1) 25.8 -> 12.5-14.6 ms (range copies 5cd890d, font reload skipped on seeks b0f6e8e); 4K (k4) 61.1 -> 16.6-26.6 ms (f83ae45, b4e7cc8); seeks = render 1.000000, load 3-6 | 1080p 25.8 ms (quiet, e0498ab); 4K 52.2 -> 17.7-28.2 ms, p50 18 -> 5 ms from a ProRes 422 copy (f83ae45, paired, load ~15; 3.1 GB for k4's 61 s, VMAF 99.78) | 1080p <= 16.7 ms; 4K <= 33 ms |
- | F5 | spawn to first frame: game, timeline, bake, app launch, app object open (measured on the legacy app; the targets carry over to the feed); a 3D export's first launch | game 70, timeline 81, bake 28 ms (44028f1: frame 0 before the sound), the legacy app's object open 74-81 ms; the legacy app's launch 1187 -> 265-272 -> 206-220 ms (an agent session's 56cc5ac: the launch object opened before the app mounts, and the stage paints frame 0 before its sound; paired, under load; video.sh ts1 PASS, seeks 1.000000), the legacy app's ~200 ms launch accepted by the user (2026-10-19), masked by a launch reveal instead of restructured | the legacy app's launch 1187 -> ~310 ms (under load 10-27), 275 ms at load 3-6 (f894348's run: game 291, timeline 217, bake 30, object open 76 ms); exported 3D game: first paint 55 ms, playable 343 ms warm / 4.4 s cold (Metal compiles ~35 pipelines) | each < 100 ms; app launch ~200 ms with a pixel reveal over its first frame |
+ | F5 | spawn to first frame: game, timeline, bake, app launch, app object open (measured on the legacy app; the targets carry over to the feed); a 3D export's first launch | game 70, timeline 81, bake 28 ms (44028f1: frame 0 before the sound), the legacy app's object open 74-81 ms; the legacy app's launch 1187 -> 265-272 -> 206-220 ms (the orchestrator's 56cc5ac: the launch object opened before the app mounts, and the stage paints frame 0 before its sound; paired, under load; video.sh ts1 PASS, seeks 1.000000), the legacy app's ~200 ms launch accepted by the user (2026-10-19), masked by a launch reveal instead of restructured | the legacy app's launch 1187 -> ~310 ms (under load 10-27), 275 ms at load 3-6 (f894348's run: game 291, timeline 217, bake 30, object open 76 ms); exported 3D game: first paint 55 ms, playable 343 ms warm / 4.4 s cold (Metal compiles ~35 pipelines) | each < 100 ms; app launch ~200 ms with a pixel reveal over its first frame |
| F6 | first-use hitches: frames past the first second over 2 ms | 37 in 60 s (max 7.26 ms), all pong's score card appearing (its first GPU work at clocked-down clocks); platformer 0; arena3d's steady frames are F2's | pong 2-3 in 8 s, max 7-8 ms: the score card's full-page group arriving with the GPU clocked down (attributed: no cache or buffer misses there); pong's page pass 3.48 -> 2.82 ms GPU (4b76f93), then 2.99 -> 2.45 ms (d06d52e), groups p90 0.93 -> 0.35 ms (eae9f02), paired under load | none > 2 ms |
Scenario: Throughput
Then these rows are tracked
@@ -194,7 +194,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
Then these rows are tracked
| id | metric | harness | value | target |
| Q1 | render = play, every medium (SSIM per frame, seeks included) | quality.sh, check.sh, replay.sh, video/gate.sh, bevy check | 1.000000 on HEAD: replay (pong, platformer, arena3d), timelines (aa4f78a); the legacy app's stage = render on ts1's full-page seeks, 0.997160-0.998681 -> 1.000000 (4100b50: emboldening per document), stage scale 0.9995 -> 0.9998 | exact everywhere, every fixture in the corpus |
- | Q2 | Chrome parity | now docs/ts-native.feature's parity suite (sdk/ui/parity); these values were the Blitz corpus (engine/html/bench/parity.sh, deleted in f1b4a17e; after an agent session's page fixes 2e9ca65, 81e4a25): 95 exact, 75 ok, 0 fail; CI's react group 8 / 8 / 0 | 93 exact, 75 ok, 2 fail | all exact |
+ | Q2 | Chrome parity | now docs/ts-native.feature's parity suite (sdk/ui/parity); these values were the Blitz corpus (engine/html/bench/parity.sh, deleted in f1b4a17e; after the orchestrator's page fixes 2e9ca65, 81e4a25): 95 exact, 75 ok, 0 fail; CI's react group 8 / 8 / 0 | 93 exact, 75 ok, 2 fail | all exact |
| Q3 | export fidelity against the source (VMAF), colour accuracy | --10bit (HEVC Main10, f1ca6ee): colour patches 0/255, 1024 random colours worst 1, ts1 VMAF 99.52 (worst frame 89.22); H.264 8-bit, still the default: colour 2/255 (its format's floor), VMAF 98.95 | export.sh --only Q3 measures both exports (exact 10-bit decode: swscale accurate_rnd+full_chroma_int); floors over all 16.7M colours: 8-bit limited 2, full range 1, 10-bit limited 0 | visually lossless (VMAF >= 95), BT.709 / P3 exact |
| Q4 | audio: tap = bounce, LUFS, true peak, clicks | quality.sh (audio.sh) | PASS: live = render -14.9 LUFS, tap = bounce exact, 0 clicks (quiet, e0498ab) | holds for every edit |
| Q5 | cross-device determinism: Mac = iPhone, byte for byte | ios.sh | frame 0 exact; glyph edges differ (<= 14/255) (4279d3f); needs the phone unlocked | byte-identical |
@@ -240,7 +240,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And done: R6 measured, idle stage ~0 W, pong's watts halved
Scenario: L9 Quality to exact
Then colour managed end to end (BT.709 / Display P3, tone mapping), text rendered exactly as Chrome (Q2's last 2:
- regenerate the shadcn reference through the composition format's render), the iPhone byte-identical to the Mac (Q5), and
+ regenerate the shadcn reference through a browser render), the iPhone byte-identical to the Mac (Q5), and
exports checked by VMAF (Q3)
And done: Q2 all exact, Q3 >= 95, Q5 byte-identical
Scenario: L10 Experiments: the fun part (try, measure, keep or drop)
@@ -261,15 +261,15 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
builds are capped at -j 6 so three agents' builds don't drive the machine to load 100
And it commits only its own hunks (check `git diff --cached`, stage explicit paths, filtered patches for shared
files), with "Co-Authored-By: Claude Opus 5.5 <[email protected]>"
- And it never restarts, kills or quits an app the user may be using, and never shows a window on the founder's
+ And it never restarts, kills or quits an app the user may be using, and never shows a window on the user's
screen: test apps run headless or windowless
And only two API models exist: GLM 5.3 Flash and clef-omni. Small local models are fine. Spend under $10 without
asking
- And areas other agents are working on as of 2026-10-18 (coordinate through an agent session before touching them): live
+ And areas other agents are working on as of 2026-10-18 (coordinate through the orchestrator before touching them): live
3D games in the legacy app, export-game, the legacy app's video and re-bake on change, the new-stack agent eval, the Tone.js layer and
systems/mix/. Video playback is always fixed scale, never responsive
Scenario: Reporting
- Then after each turn lightspeed messages an agent session one line: the row, before and after, the commit
+ Then after each turn lightspeed messages the orchestrator one line: the row, before and after, the commit
And it never claims a row moved without a quiet-machine measurement behind it
Rule: Log (newest first; lightspeed appends)
@@ -328,7 +328,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
useLocalTime built a new object per call outside a Sequence, and validate a new fold.checked (3c36ba8). step+fold
9.2 -> 1.4 KB, 30 -> 12 GC/min; pong 36.9 -> 33.4 KB; gates exact (replay, check.sh 360 of 600, audio.sh)
And put (f3b0005): a changed prop's value is set in place, not insert(key.clone()): pong's op apply 87 -> 74.6
- And an agent session's f60e0b7 (Rolldown) had raised pong's op apply 87 -> 159 (git bisect run, clean worktree builds): its
+ And the orchestrator's f60e0b7 (Rolldown) had raised pong's op apply 87 -> 159 (git bisect run, clean worktree builds): its
crates turned on serde_json's preserve_order and arbitrary_precision for the whole binary, which also changed key
order and number handling everywhere raea uses serde_json. Fixed in d91a34f (an opt-in feature) and 18d2801
(raea-bundle loaded at run time, never a Cargo dependency); confirmed back at baseline
@@ -353,7 +353,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And so frames still cross to the CPU (3.1 MB a frame, 1.85 GB for ts1), but the copies are ~0.13 ms of ~3.8: the media
engine bounds T1 and an IOSurface path would move it ~nothing. Measured no: 8 frames in flight against 3, paired x3,
258-264 fps both
- And Q2 on HEAD, the full corpus: 95 exact, 75 ok, 0 fail (an agent session's page fixes landed meanwhile), G9's last two gone
+ And Q2 on HEAD, the full corpus: 95 exact, 75 ok, 0 fail (the orchestrator's page fixes landed meanwhile), G9's last two gone
Scenario: 2026-10-19 midday: Z1's Rust counter, Z4 step 1, and T3's re-bake regression fixed (f910193, cd367dd)
Then Z1: core/alloc counts each thread's allocations under RAEA_ZEROHEAP=1 (raea only; off it costs
one relaxed load), and play's report carries rust_allocs: pong's op apply 172 allocations and 17.0 KB a frame, the
@@ -380,7 +380,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
platformer 65.5 -> 62.3; export.sh self-test PASS and SSIM 1.000000 on all five
And opt-level z cost nothing measurable: paired on pong (4 pairs, load ~4), open 102-106 ms both, work p50 0.82-0.98
against 0.83-1.04 ms, p99 the same within noise
- Scenario: 2026-10-19 morning: Q3.colour met with 10-bit export (an agent session's Q3 agent, f1ca6ee)
+ Scenario: 2026-10-19 morning: Q3.colour met with 10-bit export (the orchestrator's Q3 agent, f1ca6ee)
Then `raea render --10bit` (RAEA_EXPORT_10BIT=1) exports HEVC Main10: a GPU P010
conversion (GPU kernel p010buf.k) into VideoToolbox; H.264 8-bit stays the default for playback reach
And turn 3's muxer failure is fixed: muxide read HEVC's profile and level at fixed byte offsets of the stream
@@ -391,7 +391,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And paired, H.264 -> --10bit (the agent's runs, load 7-8): colour patches 2 -> 0/255, 1024 random colours worst
4 -> 1; ts1 VMAF 98.95 -> 99.52 (worst frame 88.31 -> 89.22), 263 -> 252.5 fps (-4%), 25.09 -> 25.20 MB; t3d600
275 -> 261 fps (-5%), 15.31 -> 9.89 MB
- And an agent session's check on the merged build: export.sh --only Q3 gives Q3.colour 0, Q3.vmaf 98.95 (H.264); titles' check
+ And the orchestrator's check on the merged build: export.sh --only Q3 gives Q3.colour 0, Q3.vmaf 98.95 (H.264); titles' check
and replay x3 1.000000
And what's left is the codec's, not a lever: ~20 of 1024 busy colours miss by 1 (VideoToolbox's compression; an
ideal 10-bit input misses the same ones), and AVFoundation's own RGB conversion errs 1 on Main10 (Apple's decoder)
@@ -399,7 +399,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
Then Z3 is closed (pong 120.3 -> 34.6 KB a frame; the rest is Z4's and Z2's), T3 is blocked on the system
JavaScriptCore (incremental 24-27 ms against 10), F5's app launch is decided by the user (~200 ms behind the
launch reveal; edit-to-swap 132-163 -> 33-61 ms), and Q3 is met (10-bit export)
- Scenario: 2026-10-19 morning: the legacy app's launch reveal (an agent session, f329b0f)
+ Scenario: 2026-10-19 morning: the legacy app's launch reveal (the orchestrator, f329b0f)
Then a last pass in quads' window.rs, opt-in, turned on only by the legacy app's vendored dioxus-native (renders, exports and
play never reach it): 280 ms from the first present, 12 px cells, Bayer x fbm thresholds ranked so the share shown
follows a smoothstepped t, unrevealed cells black stepping through the site's greys 14 / 30 / 62; a plain fade
@@ -412,7 +412,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And a headless legacy app's window is created invisible, so the MCP screenshot shows nothing of it: the look is checked
offscreen through the quads compositor (window.rs's test runs the real mask: 0.1 / 6 / 28 / 65 / 100% shown at 0 /
15 / 35 / 60 / 100%; RAEA_REVEAL_OUT=DIR writes the frames)
- Scenario: 2026-10-19 morning: the legacy app's edit path, 132-163 -> 33-61 ms (an agent session, 0857a00)
+ Scenario: 2026-10-19 morning: the legacy app's edit path, 132-163 -> 33-61 ms (the orchestrator, 0857a00)
Then the legacy app's edit-to-swap is 33-61 ms (one run of five at 105), from 132-163, in two parts
And a session-long bundler (react/js/lite/serve.ts, a line per request) keeps each source's compile by content:
bundle 38-41 -> 10-13 ms (a fresh bundle's compile alone was 12-15, bun's start ~11); no bundler outlives the legacy app
@@ -425,29 +425,29 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
Then the user: ~200 ms to the legacy app's first frame is standard and happens once, so it isn't restructured; a quick launch
animation masks it instead, the website's pixel diffusion (apps/site/src/components/effects/dither-field.tsx: 4x4
Bayer ordered dither, square cells, an fbm field)
- And so an agent session's remaining step (window and stage painted before the chrome mounts) is dropped, step 1 was a
+ And so the orchestrator's remaining step (window and stage painted before the chrome mounts) is dropped, step 1 was a
measured no (the stage's box waits on the chrome's first style, layout and render: 215-222 ms either way), and
Phase A stays out of the tree
- And the reveal is an agent session's, after the session-long bundler: the legacy app's window only (engine/html/src/quads/window.rs, a
+ And the reveal is the orchestrator's, after the session-long bundler: the legacy app's window only (engine/html/src/quads/window.rs, a
flag only the legacy app sets), never renders or exports; done when first paint is unchanged within noise, the reveal's
pass costs < 0.2 ms a frame while it runs and nothing after, and it plays once a launch (not on workspace
switches), a plain fade under Reduce Motion
- Scenario: 2026-10-19 morning: F5's app launch design, measured (an agent session, 26edce8: a launch design doc since deleted)
+ Scenario: 2026-10-19 morning: F5's app launch design, measured (the orchestrator, 26edce8: a launch design doc since deleted)
Then the critical path to first paint is no longer the stage's open (its 63-75 ms runs off the path since 56cc5ac):
it is the window and chrome mount (~100-130 ms), the chrome's first render, the launch's enter (a task spawned at
mount, so a render late), the stage's box laid out (its rect at mount + ~80), then the paint
And measured no: the stage thread started in main() before the window (Phase A) finishes the open at ~92 ms,
before mount, but first paint doesn't move (`RAEA_FEED_EARLY_STAGE` on/off on one build, paired: 226 / 230 / 253
against 211 / 220 / 228 ms); the patch is kept outside the tree until step 2
- And the steps, both in the legacy app's launch (raea-01's, waiting on it or the user): 1, the recent workspace entered in
+ And the steps, both in the legacy app's launch (the legacy app's lane's, waiting on it or the user): 1, the recent workspace entered in
the app's initial state so the stage's box is in the chrome's first frame (~60-80 ms off); 2, window and stage
painted before the chrome mounts, in dioxus-native and stage_native (~90-100 ms off)
And the edit path: an uncached bundle is 35-39 ms, bun's start only ~7 of it; a session-long bundler with in-place
- resolution and the compile plugin cached by content should take it to ~10-15 ms (an agent session's, scheduled now)
+ resolution and the compile plugin cached by content should take it to ~10-15 ms (the orchestrator's, scheduled now)
And Q3's encoder agent hit its weekly limit (~08:30) and resumes after the 10:00 reset. Its route is HEVC Main10
on the media engine: this M5 Pro's VideoToolbox lists HEVC and ProRes hardware encoders and no AV1 encoder at
all (AV1 decode only), and rav1e measured 547 ms a frame against H.264's 0.75 at the same bytes (bakeoff)
- Scenario: 2026-10-19 morning: T3 step 2, and T3 blocked on the system JavaScriptCore (an agent session, e0452c6)
+ Scenario: 2026-10-19 morning: T3 step 2, and T3 blocked on the system JavaScriptCore (the orchestrator, e0452c6)
Then titles' Counter calls toLocaleString every frame, and the system JSC built a new Intl.NumberFormat each call
(56-64% of titles' frame, sampled in bun); the engine prelude keeps one formatter per locale and options
(identical strings over 91 cases): full bake JS 26.5 -> 19.8 ms, check.sh's incremental 25-27 ms ("incremental,
@@ -463,7 +463,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
ships inside every exported player, already at 65.28 MB against 65
And the legacy app's edit-to-swap is 132-163 ms, of which bun bundling is 38-41 and the bake 23-29: the bundle step is the
larger and the cheaper lever (an incremental or cached bundle), a row for F5's edit path
- Scenario: 2026-10-19 morning: T3 step 1, the range bake (an agent session, ec41abe)
+ Scenario: 2026-10-19 morning: T3 step 1, the range bake (the orchestrator, ec41abe)
Then check.sh's titles edit at 4 / 8 runtimes: incremental 47-58 -> 25-29 ms (paired: 1 runtime 25-42, 4 runtimes
27-30), full bake ~50 -> 25-32 ms; RAEA_BAKE_TRACE "incremental, 360 of 600 frames stepped", and per range
"frames 240..600 in 19.0 ms: waited on React 6.1 ms, applying 3.6 ms, JS 19.0 ms"
@@ -478,7 +478,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
prelude and install 0.9, bundle eval 2.6, first render). Under 10 ms: less JS a frame in titles first (no
footprint), then a warm spare JSC context (~4 ms), held only while a timeline is open so it counts against a
stage's +40 MB (26 used), never against idle (215 against 200), and let go when the stage closes
- Scenario: 2026-10-19 morning: Z3 step 2, and where Z3 stops (an agent session, c59c6f7)
+ Scenario: 2026-10-19 morning: Z3 step 2, and where Z3 stops (the orchestrator, c59c6f7)
Then pong under jsheap.sh (12 s x 2, load ~3), whole / step+fold / view alone: 34.6 / 9.2 / 18.0 KB a frame and
58 / 30 / 48 GC/min; an empty edit is 5.2 KB, so view alone sits 12.8 above the floor (74.5 before Z3); view
alone's JS p50 0.087 -> 0.043 ms
@@ -493,8 +493,8 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
typed bridge or the time model), ~2.0 pong's own body (closures in render, Score and Paddle re-rendering), ~2.7
the floor (Clock state, the marker op, the flush JSON)
And Z3 stops here: the rest is Z4 (a typed bridge, no per-frame JSON) and Z2 (fixed state), not the view compile.
- an agent session moves to T3
- Scenario: 2026-10-19 morning: Z3 step 1, pong's garbage a third of what it was (an agent session, 36d4b06)
+ the orchestrator moves to T3
+ Scenario: 2026-10-19 morning: Z3 step 1, pong's garbage a third of what it was (the orchestrator, 36d4b06)
Then pong under jsheap.sh (12 s x 2, load ~4), whole / step+fold / view alone, re-baselined at HEAD on the committed
fixtures (sdk/react/bench/games/pong/edit.stepfold.tsx, edit.view.tsx): 120.3 / 9.7 / 81.3 -> 39.4 / 9.6 / 26.4 KB a
frame, 192 / 30 / 170 -> 72 / 30 / 60 GC/min; JS p50 0.106 -> 0.094 ms
@@ -505,37 +505,37 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
ended, which was 39 of view alone's 48 KB
And Q1 holds (replay.sh pong, platformer, arena3d 1.000000; check.sh titles 1.000000 with the incremental re-bake;
audio.sh max diff 0); Q2's React render path isn't touched
- And view alone has ~20 KB a frame left above an empty edit's 6.8 KB floor: an agent session's next Z3 step. A new tool,
+ And view alone has ~20 KB a frame left above an empty edit's 6.8 KB floor: the orchestrator's next Z3 step. A new tool,
bench/lightspeed/jsalloc.ts, runs a lite bundle in bun's JSC and reads about half of live KB, the same proportions
Scenario: 2026-10-19 early: R7 reopened, an exact lever
Then R7's value is export-game's total_mb, the whole app: pong's now carries 2.9 MB of uncompressed WAV assets (one
2.1 MB) and fonts.css 0.49 MB of base64. Encoding the assets losslessly at export (ALAC or FLAC: the same PCM, so
tap = bounce) halves them, and fonts as files save ~0.12 MB more, with no feature dropped (not WebP). Handed to
- an agent session (export-game). Until it lands, R7 stays blocked as logged (the player's last 0.66 MB is WebP or rdb's
+ the orchestrator (export-game). Until it lands, R7 stays blocked as logged (the player's last 0.66 MB is WebP or rdb's
SQL); if the apps measure under 65 MB with it, the row is met
Scenario: 2026-10-19 early: where the loop stops
Then every row is met (F3, F4, F5 game/timeline/bake/object open, F1 offscreen, R3's stage, Q1, Q2) or blocked with
- its reason in this log and sent to an agent session (F5's app launch, F2, F6, T1, T2, T3, T4, R1, R2, R3's idle, R4, R5, R6,
+ its reason in this log and sent to the orchestrator (F5's app launch, F2, F6, T1, T2, T3, T4, R1, R2, R3's idle, R4, R5, R6,
R7, Q3, Q5, Q6, F1 in a window)
And the targets changed tonight (R7 <= 65 MB, R3 <= 200 MB idle footprint) and the offline player were decided
- under the founder's own instruction while out ("take executive decision", 2026-10-18 night), recorded with their
+ under the user's own instruction while out ("take executive decision", 2026-10-18 night), recorded with their
reasons above; they stand unless the user changes them
And the next multi-day levers, in order of what they unblock: Z3, the view compiled at bundle time (R1, R2, and
pong's R6 watts); a bake that steps a range of frames per round trip, with helper-level coverage (T3); the legacy app's
launch restructured so a native window and the stage come before dioxus mounts the chrome (F5's app launch, with
- raea-01); 10-bit or full-range export (Q3 colour, T1 via HEVC once its muxer works)
- Scenario: 2026-10-19 early: F5's app launch, blocked above 100 ms (final; an agent session's measurements)
- Then a headless legacy app's launch (an agent session's marks, two runs): app mounted 106-121 ms (the window, winit and AppKit, and
+ the legacy app's lane); 10-bit or full-range export (Q3 colour, T1 via HEVC once its muxer works)
+ Scenario: 2026-10-19 early: F5's app launch, blocked above 100 ms (final; the orchestrator's measurements)
+ Then a headless legacy app's launch (the orchestrator's marks, two runs): app mounted 106-121 ms (the window, winit and AppKit, and
dioxus's first render), stage show 117-130 (the early open of the launch's object fires), stage ready 178-182
(titles' open, ~50 ms), frame 0 stepped 185-200, first paint 254-267: the ~60 ms between them is the first
frame's sound waiting on the mixer's startup clock (RAEA_LIVE_TRACE "sound 62.0/67.7 ms")
- And an agent session paints frame 0 before its sound, as play does (44028f1; step_world and sync_sound made pub in 31d5bf6):
+ And the orchestrator paints frame 0 before its sound, as play does (44028f1; step_world and sync_sound made pub in 31d5bf6):
launch 265.0 / 271.8 -> 219.9 / 206.4 ms, paired under load (another agent's stress job); object open 78-81
unchanged
And below that it's blocked: the window and dioxus mount alone (106-121 ms) are past 100 before the stage can show
anything, and the object's open (~50 ms) follows; under 100 needs the window and the chrome's first render
restructured (a native window up before dioxus mounts, the chrome rendered after the stage's first paint), a
- change to the legacy app's launch architecture and look (raea-01's), not tonight's
+ change to the legacy app's launch architecture and look (the legacy app's lane's), not tonight's
Scenario: 2026-10-19 early: R6, the paused stage's audio rests
Then the stage rests its mixer's device stream a second into a pause, and its spare 2 s after it opens (31d5bf6):
the legacy app paused, sampled 3 s shows no Firewheel processing; a 3 s pause advanced the device clock 1.01 s (the
@@ -543,7 +543,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
idle stage 0.047-0.05 -> 0.039 W; the audio gate 4/4
And what's left of the idle stage's 0.039 W is its threads' wakeups (the stage's 250 ms wait, the event loop):
the target's "~0" would mean an idle app with nothing waking, the app parked; that's where R6 stops
- Scenario: 2026-10-19 early: more blocked rows, final (sent to an agent session)
+ Scenario: 2026-10-19 early: more blocked rows, final (sent to the orchestrator)
Then R7 (65.66 against 65) is blocked on features: what's left in the player that it could drop is image-webp
(0.34 MB, anyrender_svg's image_format_webp: WebP images in a game's pages and SVGs would stop drawing) and
sqlparser (2.3 MB, rdb's core: a refactor); tokenizers isn't in the player. 0.66 MB isn't worth losing WebP
@@ -559,12 +559,12 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And T4 (1553 renders an hour, titles at 4 processes; 311 before the blur work) is encoder-bound as T1 and T2 are,
which is its target's own wording
And Q6 (the agent's first-try rate) is the new-stack eval's, measured nightly by its own agent: not lightspeed's
- And F5's app launch (~280 against 100) and R6's idle stage are open, an agent session's next items
+ And F5's app launch (~280 against 100) and R6's idle stage are open, the orchestrator's next items
Scenario: 2026-10-19 early: R6's idle stage and Q3's colour floor
Then a headless legacy app with titles paused (energy.sh's idle, 0.047-0.05 W): nearly every thread waits, but CoreAudio's
IOThread calls Firewheel's process each callback (VoicesProc zeroing buffers, the master limiter on silence),
the output stream open while paused; stopping it while paused and starting it again on play is the lever,
- an agent session's (mixer/ and the stage). Measured no: the voice speak thread's 20 ms wakeups (sleeping while idle left
+ the orchestrator's (mixer/ and the stage). Measured no: the voice speak thread's 20 ms wakeups (sleeping while idle left
idle W unchanged, reverted)
And Q3.colour is blocked on the format: an exact 8-bit limited-range BT.709 round trip (RGB -> Y'CbCr -> RGB, no
encoder) has a worst error of 2/255 and 1 on 83% of 200,000 random colours, so the export's 2 is that floor;
@@ -582,12 +582,12 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
Then play presents frame 0 as soon as the object is open, the sound readied after it (44028f1): pong's spawn to
first frame 339 -> 91-94 ms; startup.sh F5.game 70.2, F5.timeline 81.3 ms (load 26-30); the audio gate's
seedling passes both ways (its one failure was load 32)
- And R7 (an agent session, e0f14b3): the exported player runs offline, fonts inlined at export: 65.66 MB
- And F2's arena3d frame on the GPU (an agent session's Metal trace): ~1.8 ms (quads 0.52, opaque 0.48, four shadow
+ And R7 (the orchestrator, e0f14b3): the exported player runs offline, fonts inlined at export: 65.66 MB
+ And F2's arena3d frame on the GPU (the orchestrator's Metal trace): ~1.8 ms (quads 0.52, opaque 0.48, four shadow
cascades 0.38, wgpu internals 0.21, clustering 0.11); the CPU side (Bevy's update, extract and encode) is the
- larger half of its ~3 ms. an agent session takes the exact GPU items (indirect-draw validation off in release, batched
+ larger half of its ~3 ms. the orchestrator takes the exact GPU items (indirect-draw validation off in release, batched
staging), then the CPU side
- Scenario: 2026-10-18 night: blocked rows, final for tonight (sent to an agent session)
+ Scenario: 2026-10-18 night: blocked rows, final for tonight (sent to the orchestrator)
Then T1 and T2 are blocked on the hardware: H.264 on the media engine is ~275 fps at 1080x1920 with speed already
prioritized and non-realtime, and there's one engine (two sessions halve each other); 600 frames can't go under
~2.2 s. Unblocks with another encode path: HEVC (the muxer failed, turn 3) or an export split across the
@@ -603,18 +603,18 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And F6 is blocked on the GPU's clocks: pong's card frame is its first GPU work after the light game let clocks fall
(the same group pass is 0.9 ms the first frame, 0.38 two frames later); the app can't hold clocks up, and making
the card's work smaller didn't move it (two measured noes)
- And R7 is in progress, not blocked: an agent session's offline player (no rustls/ureq, fonts embedded at export) should
+ And R7 is in progress, not blocked: the orchestrator's offline player (no rustls/ureq, fonts embedded at export) should
take 66.77 MB under 65
Scenario: 2026-10-18 night: executive decisions (the user, out until morning: "take executive decision")
Then R7's target is <= 65 MB, not 50: opt-level s reached 53.8 MB at +20-22% frame work, and feel outranks bytes
And the exported player runs offline: export-game embeds every font the game uses and the player drops the
- network (rustls/ureq, ~1 MB), taking it under 65 MB (an agent session)
+ network (rustls/ureq, ~1 MB), taking it under 65 MB (the orchestrator)
And R3's target is an idle footprint <= 200 MB (a stage <= +40): offscreen raea alone is 149-151 MB, so
100 MB needs JSC or the GPU work out of process, logged as a later lever, not tonight's
And ZeroHeap Z2 goes in as an opt-in fixed-state API beside today's SDK (games written today keep working),
pong first, measured on R1/R2 (lightspeed). Revised after measuring (below): Z3 first, Z2 after
Scenario: 2026-10-18 night: the clean feel run, and pong's card frame
- Then an agent session's clean run (no other jobs, load 5.2 -> 3.0): F3 met (0 missed), F2 worst arena3d 4.58 ms p99.9, F6
+ Then the orchestrator's clean run (no other jobs, load 5.2 -> 3.0): F3 met (0 missed), F2 worst arena3d 4.58 ms p99.9, F6
37 (pong's card; the logged 7117 predates da1dbe3, which adds the work p50 3d1ecde's rule reads), R1 125 KB, R2
196/min
And pong's card frame: the frame after the card first draws waits 4.3 ms with ~2.4 ms of timed GPU passes; its
@@ -638,39 +638,39 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And so the lever for R1/R2 is Z3, the view compiled at bundle time into update functions bound to what changed
(no per-frame elements), with Z2's fixed state after it for the last ~10 KB. useGameEvents' per-frame copies of
its frame lists are a few KB and returning a shared array would break a game that mutates it: left as is
- And F1 in a window stays blocked: no window on the founder's screen without their consent
+ And F1 in a window stays blocked: no window on the user's screen without their consent
Scenario: 2026-10-18 night: where each open row stands, and what blocks it
Then met: F4 (scrub 12.5-14.6 / 16.6-26.6 ms), Q1 (render = play 1.000000 everywhere checked), Q2 (react/ 0 fail)
And blocked on the hardware: T1 and T2 sit at the H.264 engine's floor (~275 fps at 1080x1920, one engine, speed
already prioritized, non-realtime); <= 1 s needs another encode path (HEVC failed in the muxer, turn 3)
And blocked on the person: F1 in the app's window needs a visible window the user agrees to (the lever to try:
desired_maximum_frame_latency 1); R5 and Q5 need the iPhone unlocked; R7's target (50 MB costs +20-22% frame work
- with opt-level s; ~66-67 MB without it) and the offline player (rustls, ~1 MB) are the founder's calls; R1/R2 to 0
+ with opt-level s; ~66-67 MB without it) and the offline player (rustls, ~1 MB) are the user's calls; R1/R2 to 0
need ZeroHeap Z2 (game state in one fixed buffer), which changes the SDK games are written against
And F2 arena3d attributed further: offscreen, a frame's present is Live::prepare (Bevy's update and render
submit), the quads composite (now 0.72 ms GPU) and the wait for the frame before (two in flight), so its work
is about one frame's GPU time, ~2 ms of it Bevy's render at low clocks. Measured no: MSAA off (work and present
unchanged, 3 pairs). Bevy's main passes report no GPU time (Apple GPUs time only at pass boundaries), so the next
- step is a Metal trace of arena3d's frame, in the live-3D area an agent session coordinates
+ step is a Metal trace of arena3d's frame, in the live-3D area the orchestrator coordinates
And L0 complete: bench/scoreboard.sh fills 27 of 27 rows. Two harness faults fixed: export.sh timed export-cache
hits since 3479eea (4fce2f0: T1 read 0.024 s, T4 1.1 M/h; now 2.456 s, T2 2.702 s, T4 1553/h), and F6 counted
- every arena3d frame (3d1ecde: games whose median frame is near 2 ms are F2's, listed). an agent session's e051025 marks a
+ every arena3d frame (3d1ecde: games whose median frame is near 2 ms are F2's, listed). the orchestrator's e051025 marks a
run NOT QUIET when another agent's job overlapped it
And F6/F2 attributed: platformer's 4.6-18.9 ms steps in the last feel.sh run were another agent's export.sh
- overlapping it (an agent session: four quiet repeats never spiked, GC pauses <= 1.13 ms, p99.9 3.46 ms); the harness is
+ overlapping it (the orchestrator: four quiet repeats never spiked, GC pauses <= 1.13 ms, p99.9 3.46 ms); the harness is
getting a NOT QUIET mark for runs other agents' jobs overlap. Pong's remaining hitch is the score card's first
frame: its group's first GPU work at clocked-down GPU clocks, the next frame waiting 3.5-5.0 ms. Measured no:
page-sized group targets from the start (the regrow at that frame isn't the cost)
And F2 arena3d: a tile one instance covers whole skips the fine pass's staging (0471084, exact): page pass 1.93
-> 0.72 ms GPU, pong 1.5-2.6 -> 1.5-2.2; frame work level (Bevy and the wait are the rest)
- And R7 (an agent session, 9012fdc): blitz-v8-script and raea-modules gated out of the player (default-on features the legacy app,
+ And R7 (the orchestrator, 9012fdc): blitz-v8-script and raea-modules gated out of the player (default-on features the legacy app,
browser and the iOS builds keep): 72.33 -> 66.77 MB, export selftests and renders 1.000000
And R3 against its target: offscreen raea playing pong (no window, no chrome, no app) is already 149-151 MB
of footprint, so an idle app at <= 100 MB needs another process shape (JSC or the GPU work out of process),
a design call for the user. Meanwhile the GPU half keeps falling: blur scratch rings out of the threads
(c68aca2: the legacy app idle 653 -> 272 MB), bounded group targets and a growing atlas (195945d, 5ff5843), the blur's
8-bit scratch (a676f30: titles 56.8 -> 50.1 MB)
- And open, being worked: F6/F2 (pong's card frame on a clocked-down GPU; platformer's step spikes, an agent session
+ And open, being worked: F6/F2 (pong's card frame on a clocked-down GPU; platformer's step spikes, the orchestrator
attributing; arena3d's steady 3D frame: its page pass is one full-coverage texture per tile, 1.9 ms at low
clocks, so a fast path for single-instance tiles is next), F3 (5 missed in 3 x 60 s, at those same frames)
Scenario: 2026-10-18, turn 5: the 2D compositor's GPU time and memory (F6, R4)
@@ -687,10 +687,10 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
And a fill covering a whole tile is only painted there (d06d52e: the bin entry's FULL flag, exact): pong's page
pass 2.99 -> 2.45 ms, frame GPU p99 3.84-3.96 -> 3.03-3.45 ms, paired. Dropped, measured: staging instances in
workgroup memory (~4x slower: occupancy)
- And L9 (an agent session, 4100b50): the legacy app's stage drew thickened glyphs because dioxus-native's default features compiled
+ And L9 (the orchestrator, 4100b50): the legacy app's stage drew thickened glyphs because dioxus-native's default features compiled
blitz-paint's apple-font-embolden into the whole process; it's per document now (on for the legacy app's chrome only).
ts1 full-page seeks vs render 0.997160-0.998681 -> 1.000000, paired
- And F4 attributed (an agent session): k4's 4K seeks are the hardware decoder's (1.6-1.8 ms a reference frame, ~25 per seek
+ And F4 attributed (the orchestrator): k4's 4K seeks are the hardware decoder's (1.6-1.8 ms a reference frame, ~25 per seek
deep in a 1-2 s GOP), not restarts. Lever chosen: an intra-only mezzanine for long-GOP sources over 1080p
And R3 attributed: an idle legacy app's footprint was 653 MB, 566 of it GPU memory neither RSS nor Metal's device count
shows: the three-box blur's (00d156f) two 4 KB rings per thread, which the driver backs with scratch for every
@@ -698,7 +698,7 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
titles offscreen 535-542 -> 165-173 MB, a titles render 3.6-3.8 -> 3.4-3.5 s. R3's RSS row never saw it, so R3
now carries footprint too
And the export cache keys the build (7230a2b): a rebuilt engine was answered with the last one's video
- And an agent session: F4's 4K scrub from a ProRes 422 copy made in the background (f83ae45: p99 52.2 -> 17.7-28.2 ms,
+ And the orchestrator: F4's 4K scrub from a ProRes 422 copy made in the background (f83ae45: p99 52.2 -> 17.7-28.2 ms,
seeks = render 1.000000); R7's player keeps a dSYM beside it and crash files carry UUID and slide (af0c12f)
And T2 attributed: a 3D export is the H.264 engine's (frames 3.6-4.3 ms, 3.3 ms of it feeding the encoder, which
already prioritizes speed and runs non-realtime); setup is ~0.5 s. Its 1 s target needs another encode path
@@ -716,21 +716,21 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
Pong's 13-miss frame 1.42 -> 0.47 ms record, the 30-miss one 1.13-1.21 -> 0.52-0.55
And feel.sh at load ~4 after them: pong 57 hitches (its card frame, GPU), platformer 35 (game steps of 4.6-18.9
ms around 14.6 s, being attributed), counts swinging run to run; F3 5 missed in 3 x 60 s
- And R7 (an agent session, bc82df0): AV1 gated out of the player, 74.55 -> 72.33 MB, export selftests and renders 1.000000
- And F4 met (an agent session, b0f6e8e): a seek's present was 6.2 ms of Dom::load_fonts re-parsing every stylesheet (the
+ And R7 (the orchestrator, bc82df0): AV1 gated out of the player, 74.55 -> 72.33 MB, export selftests and renders 1.000000
+ And F4 met (the orchestrator, b0f6e8e): a seek's present was 6.2 ms of Dom::load_fonts re-parsing every stylesheet (the
injected base64 @font-face included) after each reset re-created the <style>s; it's skipped while the font CSS
is unchanged (60/61 hits, 0.02 ms). ts1 scrub p99 12.5-12.8 ms with range copies; check.sh, gate.sh and parity
unchanged. Left in the tail: glyph misses on a caption's first sight (3-5 ms record on 10 of 61 seeks)
- And F4 (an agent session): ProRes copies of just the ranges an edit uses (5cd890d, mapped by time, 449 MB for ts1): ts1
+ And F4 (the orchestrator): ProRes copies of just the ranges an edit uses (5cd890d, mapped by time, 449 MB for ts1): ts1
scrub p99 23.5-24.5 -> 19.7-20.0 ms, step p99 12.4 -> 7.8; present (p99 12 ms) is now the larger half. R3:
decoding 4K copies through AVAssetReaderVideoCompositionOutput kept its own pool of 4K frames (footprint 182
-> 687-705 MB); identity tracks read through AVAssetReaderTrackOutput, pixels identical: 290-292 MB (b4e7cc8)
- And F4/Q1 in the legacy app (an agent session, 9e5f358): copies made mid-session left the stage's decoders on the sources while
+ And F4/Q1 in the legacy app (the orchestrator, 9e5f358): copies made mid-session left the stage's decoders on the sources while
renders opened the copies (seeks vs render 0.993-0.996); the legacy app now reopens the decoders once a copy is made.
k4 in a headless legacy app: scrub p99 52.2 -> 9.1 ms, missed 2 -> 0, seeks 1.000000. R3 cost: RSS max 280 -> 434 MB
with 4K ProRes in the decoder
- And Q2 (an agent session, 71a349d): every react/ parity case passes (8 exact, 8 ok, 0 fail); shadcn 0.9997
- And CI (an agent session, a599687): the games gates failed every CI run since ~13:30 because a Standard launchd agent's GPU
+ And Q2 (the orchestrator, 71a349d): every react/ parity case passes (8 exact, 8 ok, 0 fail); shadcn 0.9997
+ And CI (the orchestrator, a599687): the games gates failed every CI run since ~13:30 because a Standard launchd agent's GPU
work is scheduled low (present p99 11.4 ms, 170-260 missed); the plists are Interactive now (1 missed, p99 3.6
ms). The rest (~3000 hitches over 2 ms in 30 s against 3 from a terminal) is frontmost-app priority, so CI's
F-rows read with the legacy app not frontmost, and F2/F3 history before a599687 is polluted. mezz's cap is min(20 GB, free -
diff --git a/docs/sdk-coverage/bevy.tsv b/docs/sdk-coverage/bevy.tsv
new file mode 100644
index 00000000..4e89ef38
--- /dev/null
+++ b/docs/sdk-coverage/bevy.tsv
@@ -0,0 +1,1087 @@
+# The plugin build's TypeRegistry: every component, resource, event, message, state and asset (tools/sdk-coverage --registry)
+# compiled plugins: aseprite avian avian2d bevy big_space common_assets console debugdump egui enhanced_input enoki flair hanabi http hui inspector kira ldtk leafwing light_2d lightyear lookup_curve noise noisy obj pancam panorbit proc_gen quinnet rand rapier2d rapier3d simple_tilemap skein smud sprite3d spritesheet text3d tiled tilemap tnua trauma_shake trenchbroom tween tweening vector_shapes vox yoleck
+aeronet_io::Session component
+aeronet_io::SessionEndpoint component
+aeronet_io::packet::NoClearBuffers resource
+aeronet_io::packet::PacketRtt component
+aeronet_io::server::Server component
+avian2d::collider_tree::diagnostics::ColliderTreeDiagnostics resource
+avian2d::collision::collider::ColliderAabb component
+avian2d::collision::collider::ColliderAabbMargin component
+avian2d::collision::collider::ColliderDisabled component
+avian2d::collision::collider::CollidingEntities component
+avian2d::collision::collider::CollisionMargin component
+avian2d::collision::collider::EnlargedAabb component
+avian2d::collision::collider::Sensor component
+avian2d::collision::collider::backend::ColliderMarker component
+avian2d::collision::collider::collider_hierarchy::ColliderOf component
+avian2d::collision::collider::collider_hierarchy::RigidBodyColliders component
+avian2d::collision::collider::collider_transform::ColliderTransform component
+avian2d::collision::collider::constructor::ColliderConstructor component
+avian2d::collision::collider::constructor::ColliderConstructorHierarchy component
+avian2d::collision::collider::layers::CollisionLayers component
+avian2d::collision::collision_events::CollisionEventsEnabled component
+avian2d::collision::diagnostics::CollisionDiagnostics resource
+avian2d::collision::narrow_phase::NarrowPhaseConfig resource
+avian2d::dynamics::ccd::SpeculativeCcd component
+avian2d::dynamics::ccd::SweptCcd component
+avian2d::dynamics::integrator::CustomPositionIntegration component
+avian2d::dynamics::integrator::CustomVelocityIntegration component
+avian2d::dynamics::integrator::Gravity resource
+avian2d::dynamics::integrator::VelocityIntegrationData component
+avian2d::dynamics::joints::JointCollisionDisabled component
+avian2d::dynamics::joints::JointDamping component
+avian2d::dynamics::joints::JointDisabled component
+avian2d::dynamics::joints::JointForces component
+avian2d::dynamics::joints::distance::DistanceJoint component
+avian2d::dynamics::joints::fixed::FixedJoint component
+avian2d::dynamics::joints::prismatic::PrismaticJoint component
+avian2d::dynamics::joints::revolute::RevoluteJoint component
+avian2d::dynamics::rigid_body::AngularDamping component
+avian2d::dynamics::rigid_body::AngularVelocity component
+avian2d::dynamics::rigid_body::Dominance component
+avian2d::dynamics::rigid_body::GravityScale component
+avian2d::dynamics::rigid_body::LinearDamping component
+avian2d::dynamics::rigid_body::LinearVelocity component
+avian2d::dynamics::rigid_body::MaxAngularSpeed component
+avian2d::dynamics::rigid_body::MaxLinearSpeed component
+avian2d::dynamics::rigid_body::RigidBody component
+avian2d::dynamics::rigid_body::RigidBodyDisabled component
+avian2d::dynamics::rigid_body::forces::AccumulatedLocalAcceleration component
+avian2d::dynamics::rigid_body::forces::ConstantAngularAcceleration component
+avian2d::dynamics::rigid_body::forces::ConstantForce component
+avian2d::dynamics::rigid_body::forces::ConstantLinearAcceleration component
+avian2d::dynamics::rigid_body::forces::ConstantLocalForce component
+avian2d::dynamics::rigid_body::forces::ConstantLocalLinearAcceleration component
+avian2d::dynamics::rigid_body::forces::ConstantTorque component
+avian2d::dynamics::rigid_body::locked_axes::LockedAxes component
+avian2d::dynamics::rigid_body::mass_properties::components::AngularInertia component
+avian2d::dynamics::rigid_body::mass_properties::components::CenterOfMass component
+avian2d::dynamics::rigid_body::mass_properties::components::Mass component
+avian2d::dynamics::rigid_body::mass_properties::components::NoAutoAngularInertia component
+avian2d::dynamics::rigid_body::mass_properties::components::NoAutoCenterOfMass component
+avian2d::dynamics::rigid_body::mass_properties::components::NoAutoMass component
+avian2d::dynamics::rigid_body::mass_properties::components::collider::ColliderDensity component
+avian2d::dynamics::rigid_body::mass_properties::components::collider::ColliderMassProperties component
+avian2d::dynamics::rigid_body::mass_properties::components::computed::ComputedAngularInertia component
+avian2d::dynamics::rigid_body::mass_properties::components::computed::ComputedCenterOfMass component
+avian2d::dynamics::rigid_body::mass_properties::components::computed::ComputedMass component
+avian2d::dynamics::rigid_body::physics_material::Friction component
+avian2d::dynamics::rigid_body::physics_material::Restitution component
+avian2d::dynamics::rigid_body::sleeping::SleepThreshold component
+avian2d::dynamics::rigid_body::sleeping::SleepTimer component
+avian2d::dynamics::rigid_body::sleeping::Sleeping component
+avian2d::dynamics::rigid_body::sleeping::SleepingDisabled component
+avian2d::dynamics::solver::diagnostics::SolverDiagnostics resource
+avian2d::dynamics::solver::plugin::ContactSoftnessCoefficients resource
+avian2d::dynamics::solver::plugin::PhysicsLengthUnit resource
+avian2d::dynamics::solver::plugin::SolverConfig resource
+avian2d::dynamics::solver::schedule::SubstepCount resource
+avian2d::dynamics::solver::solver_body::SolverBodyIndex component
+avian2d::dynamics::solver::xpbd::joints::distance::DistanceJointSolverData component
+avian2d::dynamics::solver::xpbd::joints::fixed::FixedJointSolverData component
+avian2d::dynamics::solver::xpbd::joints::prismatic::PrismaticJointSolverData component
+avian2d::dynamics::solver::xpbd::joints::revolute::RevoluteJointSolverData component
+avian2d::dynamics::solver::xpbd::plugin::XpbdVelocityProjection component
+avian2d::physics_transform::PhysicsTransformConfig resource
+avian2d::physics_transform::transform::Position component
+avian2d::physics_transform::transform::PreSolveDeltaPosition component
+avian2d::physics_transform::transform::PreSolveDeltaRotation component
+avian2d::physics_transform::transform::Rotation component
+avian2d::schedule::LastPhysicsTick resource
+avian2d::spatial_query::diagnostics::SpatialQueryDiagnostics resource
+avian2d::spatial_query::ray_caster::RayCaster component
+avian2d::spatial_query::ray_caster::RayHits component
+avian2d::spatial_query::shape_caster::ShapeCaster component
+avian2d::spatial_query::shape_caster::ShapeHits component
+avian3d::ancestor_marker::AncestorMarker<avian3d::collision::collider::backend::ColliderMarker> component
+avian3d::collider_tree::diagnostics::ColliderTreeDiagnostics resource
+avian3d::collision::collider::ColliderAabb component
+avian3d::collision::collider::ColliderAabbMargin component
+avian3d::collision::collider::ColliderDisabled component
+avian3d::collision::collider::CollidingEntities component
+avian3d::collision::collider::CollisionMargin component
+avian3d::collision::collider::EnlargedAabb component
+avian3d::collision::collider::Sensor component
+avian3d::collision::collider::backend::ColliderMarker component
+avian3d::collision::collider::collider_hierarchy::ColliderOf component
+avian3d::collision::collider::collider_hierarchy::RigidBodyColliders component
+avian3d::collision::collider::collider_transform::ColliderTransform component
+avian3d::collision::collider::constructor::ColliderConstructor component
+avian3d::collision::collider::constructor::ColliderConstructorHierarchy component
+avian3d::collision::collider::layers::CollisionLayers component
+avian3d::collision::collision_events::CollisionEventsEnabled component
+avian3d::collision::diagnostics::CollisionDiagnostics resource
+avian3d::collision::narrow_phase::NarrowPhaseConfig resource
+avian3d::debug_render::configuration::DebugRender component
+avian3d::dynamics::ccd::SpeculativeCcd component
+avian3d::dynamics::ccd::SweptCcd component
+avian3d::dynamics::integrator::CustomPositionIntegration component
+avian3d::dynamics::integrator::CustomVelocityIntegration component
+avian3d::dynamics::integrator::Gravity resource
+avian3d::dynamics::integrator::VelocityIntegrationData component
+avian3d::dynamics::joints::JointCollisionDisabled component
+avian3d::dynamics::joints::JointDamping component
+avian3d::dynamics::joints::JointDisabled component
+avian3d::dynamics::joints::JointForces component
+avian3d::dynamics::joints::distance::DistanceJoint component
+avian3d::dynamics::joints::fixed::FixedJoint component
+avian3d::dynamics::joints::prismatic::PrismaticJoint component
+avian3d::dynamics::joints::revolute::RevoluteJoint component
+avian3d::dynamics::joints::spherical::SphericalJoint component
+avian3d::dynamics::rigid_body::AngularDamping component
+avian3d::dynamics::rigid_body::AngularVelocity component
+avian3d::dynamics::rigid_body::Dominance component
+avian3d::dynamics::rigid_body::GravityScale component
+avian3d::dynamics::rigid_body::LinearDamping component
+avian3d::dynamics::rigid_body::LinearVelocity component
+avian3d::dynamics::rigid_body::MaxAngularSpeed component
+avian3d::dynamics::rigid_body::MaxLinearSpeed component
+avian3d::dynamics::rigid_body::RigidBody component
+avian3d::dynamics::rigid_body::RigidBodyDisabled component
+avian3d::dynamics::rigid_body::forces::AccumulatedLocalAcceleration component
+avian3d::dynamics::rigid_body::forces::ConstantAngularAcceleration component
+avian3d::dynamics::rigid_body::forces::ConstantForce component
+avian3d::dynamics::rigid_body::forces::ConstantLinearAcceleration component
+avian3d::dynamics::rigid_body::forces::ConstantLocalAngularAcceleration component
+avian3d::dynamics::rigid_body::forces::ConstantLocalForce component
+avian3d::dynamics::rigid_body::forces::ConstantLocalLinearAcceleration component
+avian3d::dynamics::rigid_body::forces::ConstantLocalTorque component
+avian3d::dynamics::rigid_body::forces::ConstantTorque component
+avian3d::dynamics::rigid_body::locked_axes::LockedAxes component
+avian3d::dynamics::rigid_body::mass_properties::components::AngularInertia component
+avian3d::dynamics::rigid_body::mass_properties::components::CenterOfMass component
+avian3d::dynamics::rigid_body::mass_properties::components::Mass component
+avian3d::dynamics::rigid_body::mass_properties::components::NoAutoAngularInertia component
+avian3d::dynamics::rigid_body::mass_properties::components::NoAutoCenterOfMass component
+avian3d::dynamics::rigid_body::mass_properties::components::NoAutoMass component
+avian3d::dynamics::rigid_body::mass_properties::components::collider::ColliderDensity component
+avian3d::dynamics::rigid_body::mass_properties::components::collider::ColliderMassProperties component
+avian3d::dynamics::rigid_body::mass_properties::components::computed::ComputedAngularInertia component
+avian3d::dynamics::rigid_body::mass_properties::components::computed::ComputedCenterOfMass component
+avian3d::dynamics::rigid_body::mass_properties::components::computed::ComputedMass component
+avian3d::dynamics::rigid_body::physics_material::Friction component
+avian3d::dynamics::rigid_body::physics_material::Restitution component
+avian3d::dynamics::rigid_body::sleeping::SleepThreshold component
+avian3d::dynamics::rigid_body::sleeping::SleepTimer component
+avian3d::dynamics::rigid_body::sleeping::Sleeping component
+avian3d::dynamics::rigid_body::sleeping::SleepingDisabled component
+avian3d::dynamics::solver::diagnostics::SolverDiagnostics resource
+avian3d::dynamics::solver::plugin::ContactSoftnessCoefficients resource
+avian3d::dynamics::solver::plugin::PhysicsLengthUnit resource
+avian3d::dynamics::solver::plugin::SolverConfig resource
+avian3d::dynamics::solver::schedule::SubstepCount resource
+avian3d::dynamics::solver::solver_body::SolverBodyIndex component
+avian3d::dynamics::solver::xpbd::joints::distance::DistanceJointSolverData component
+avian3d::dynamics::solver::xpbd::joints::fixed::FixedJointSolverData component
+avian3d::dynamics::solver::xpbd::joints::prismatic::PrismaticJointSolverData component
+avian3d::dynamics::solver::xpbd::joints::revolute::RevoluteJointSolverData component
+avian3d::dynamics::solver::xpbd::joints::spherical::SphericalJointSolverData component
+avian3d::dynamics::solver::xpbd::plugin::XpbdVelocityProjection component
+avian3d::physics_transform::PhysicsTransformConfig resource
+avian3d::physics_transform::transform::Position component
+avian3d::physics_transform::transform::PreSolveDeltaPosition component
+avian3d::physics_transform::transform::PreSolveDeltaRotation component
+avian3d::physics_transform::transform::Rotation component
+avian3d::schedule::LastPhysicsTick resource
+avian3d::spatial_query::diagnostics::SpatialQueryDiagnostics resource
+avian3d::spatial_query::ray_caster::RayCaster component
+avian3d::spatial_query::ray_caster::RayHits component
+avian3d::spatial_query::shape_caster::ShapeCaster component
+avian3d::spatial_query::shape_caster::ShapeHits component
+bevy_a11y::AccessibilityRequested resource
+bevy_a11y::ManageAccessibilityUpdates resource
+bevy_animation::AnimatedBy component
+bevy_animation::AnimationClip asset
+bevy_animation::AnimationPlayer component
+bevy_animation::AnimationTargetId component
+bevy_animation::graph::AnimationGraph asset
+bevy_animation::graph::AnimationGraphHandle component
+bevy_animation::transition::AnimationTransitions component
+bevy_anti_alias::contrast_adaptive_sharpening::ContrastAdaptiveSharpening component
+bevy_anti_alias::contrast_adaptive_sharpening::DenoiseCas component
+bevy_anti_alias::fxaa::Fxaa component
+bevy_anti_alias::smaa::Smaa component
+bevy_anti_alias::taa::TemporalAntiAliasing component
+bevy_app::app::AppExit message
+bevy_aseprite_ultra::animation::AnimationEvents message
+bevy_aseprite_ultra::animation::AnimationState component
+bevy_aseprite_ultra::animation::AseAnimation component
+bevy_aseprite_ultra::slice::AseSlice component
+bevy_audio::audio::DefaultSpatialScale resource
+bevy_audio::audio::PlaybackSettings component
+bevy_audio::audio::SpatialListener component
+bevy_audio::volume::GlobalVolume resource
+bevy_camera::camera::Camera component
+bevy_camera::camera::CameraMainTextureUsages component
+bevy_camera::camera::Exposure component
+bevy_camera::camera::MainPassResolutionOverride component
+bevy_camera::camera::ManualTextureViewHandle component
+bevy_camera::camera::RenderTarget component
+bevy_camera::camera::ShadowLodOrigin component
+bevy_camera::clear_color::ClearColor resource
+bevy_camera::components::Camera2d component
+bevy_camera::components::Camera3d component
+bevy_camera::components::CompositingSpace component
+bevy_camera::components::Hdr component
+bevy_camera::primitives::Aabb component
+bevy_camera::primitives::CascadesFrusta component
+bevy_camera::primitives::CubemapFrusta component
+bevy_camera::primitives::Frustum component
+bevy_camera::primitives::Sphere component
+bevy_camera::projection::Projection component
+bevy_camera::visibility::CascadesVisibleEntities component
+bevy_camera::visibility::CubemapVisibleEntities component
+bevy_camera::visibility::DynamicSkinnedMeshBounds component
+bevy_camera::visibility::InheritedVisibility component
+bevy_camera::visibility::NoFrustumCulling component
+bevy_camera::visibility::ViewVisibility component
+bevy_camera::visibility::Visibility component
+bevy_camera::visibility::VisibilityClass component
+bevy_camera::visibility::VisibleEntities component
+bevy_camera::visibility::VisibleMeshEntities component
+bevy_camera::visibility::range::VisibilityRange component
+bevy_camera::visibility::render_layers::RenderLayers component
+bevy_core_pipeline::prepass::DeferredPrepass component
+bevy_core_pipeline::prepass::DeferredPrepassDoubleBuffer component
+bevy_core_pipeline::prepass::DepthPrepass component
+bevy_core_pipeline::prepass::DepthPrepassDoubleBuffer component
+bevy_core_pipeline::prepass::MotionVectorPrepass component
+bevy_core_pipeline::prepass::NormalPrepass component
+bevy_core_pipeline::prepass::background_motion_vectors::NoBackgroundMotionVectors component
+bevy_core_pipeline::schedule::RootNonCameraView component
+bevy_dev_tools::fps_overlay::FpsOverlayConfig resource
+bevy_dev_tools::infinite_grid::InfiniteGrid component
+bevy_dev_tools::infinite_grid::InfiniteGridSettings component
+bevy_dev_tools::picking_debug::PointerDebugOverlay component
+bevy_dev_tools::picking_debug::PointerDebugOverlayOf component
+bevy_dev_tools::render_debug::GlobalRenderDebugOverlay resource
+bevy_dev_tools::render_debug::RenderDebugOverlay component
+bevy_ecs::entity_disabling::DefaultQueryFilters resource
+bevy_ecs::entity_disabling::Disabled component
+bevy_ecs::hierarchy::ChildOf component
+bevy_ecs::hierarchy::Children component
+bevy_ecs::name::Name component
+bevy_ecs::observer::distributed_storage::ObservedBy component
+bevy_ecs::resource::IsResource component
+bevy_ecs_ldtk::components::GridCoords component
+bevy_ecs_ldtk::components::IntGridCell component
+bevy_ecs_ldtk::components::LayerMetadata component
+bevy_ecs_ldtk::components::LdtkProjectHandle component
+bevy_ecs_ldtk::components::Respawn component
+bevy_ecs_ldtk::components::TileEnumTags component
+bevy_ecs_ldtk::components::TileMetadata component
+bevy_ecs_ldtk::components::Worldly component
+bevy_ecs_ldtk::components::entity_iid::EntityIid component
+bevy_ecs_ldtk::components::level_iid::LevelIid component
+bevy_ecs_tiled::tiled::TiledPluginConfig resource
+bevy_ecs_tiled::tiled::animation::TiledAnimation component
+bevy_ecs_tiled::tiled::event::TiledEvent<bevy_ecs_tiled::tiled::event::LayerCreated> component
+bevy_ecs_tiled::tiled::event::TiledEvent<bevy_ecs_tiled::tiled::event::MapCreated> component
+bevy_ecs_tiled::tiled::event::TiledEvent<bevy_ecs_tiled::tiled::event::ObjectCreated> component
+bevy_ecs_tiled::tiled::event::TiledEvent<bevy_ecs_tiled::tiled::event::TileCreated> component
+bevy_ecs_tiled::tiled::event::TiledEvent<bevy_ecs_tiled::tiled::event::TilemapCreated> component
+bevy_ecs_tiled::tiled::event::TiledEvent<bevy_ecs_tiled::tiled::event::WorldCreated> component
+bevy_ecs_tiled::tiled::filter::TiledName component
+bevy_ecs_tiled::tiled::image::TiledImage component
+bevy_ecs_tiled::tiled::layer::TiledLayer component
+bevy_ecs_tiled::tiled::layer::TiledLayerId component
+bevy_ecs_tiled::tiled::layer::TiledLayerParallax component
+bevy_ecs_tiled::tiled::layer::TiledParallaxCamera component
+bevy_ecs_tiled::tiled::map::RespawnTiledMap component
+bevy_ecs_tiled::tiled::map::TiledMap component
+bevy_ecs_tiled::tiled::map::TiledMapImageRepeatMargin component
+bevy_ecs_tiled::tiled::map::TiledMapLayerZOffset component
+bevy_ecs_tiled::tiled::map::TiledMapReference component
+bevy_ecs_tiled::tiled::map::storage::TiledMapStorage component
+bevy_ecs_tiled::tiled::object::TiledObject component
+bevy_ecs_tiled::tiled::object::TiledObjectId component
+bevy_ecs_tiled::tiled::object::TiledObjectVisualOf component
+bevy_ecs_tiled::tiled::object::TiledObjectVisuals component
+bevy_ecs_tiled::tiled::tile::TiledTile component
+bevy_ecs_tiled::tiled::tile::TiledTileId component
+bevy_ecs_tiled::tiled::tile::TiledTilemap component
+bevy_ecs_tiled::tiled::tile::TiledTilesetId component
+bevy_ecs_tiled::tiled::world::RespawnTiledWorld component
+bevy_ecs_tiled::tiled::world::TiledWorld component
+bevy_ecs_tiled::tiled::world::chunking::TiledWorldChunking component
+bevy_ecs_tiled::tiled::world::storage::TiledWorldStorage component
+bevy_ecs_tilemap::FrustumCulling component
+bevy_ecs_tilemap::anchor::TilemapAnchor component
+bevy_ecs_tilemap::map::TilemapGridSize component
+bevy_ecs_tilemap::map::TilemapId component
+bevy_ecs_tilemap::map::TilemapSize component
+bevy_ecs_tilemap::map::TilemapSpacing component
+bevy_ecs_tilemap::map::TilemapTexture component
+bevy_ecs_tilemap::map::TilemapTextureSize component
+bevy_ecs_tilemap::map::TilemapTileSize component
+bevy_ecs_tilemap::map::TilemapType component
+bevy_ecs_tilemap::tiles::TileColor component
+bevy_ecs_tilemap::tiles::TileFlip component
+bevy_ecs_tilemap::tiles::TilePos component
+bevy_ecs_tilemap::tiles::TilePosOld component
+bevy_ecs_tilemap::tiles::TileTextureIndex component
+bevy_ecs_tilemap::tiles::TileVisible component
+bevy_ecs_tilemap::tiles::storage::TileStorage component
+bevy_egui::EguiContextSettings component
+bevy_egui::EguiGlobalSettings resource
+bevy_enhanced_input::action::ActionSettings component
+bevy_enhanced_input::action::ActionTime component
+bevy_enhanced_input::action::TriggerState component
+bevy_enhanced_input::action::events::ActionEvents component
+bevy_enhanced_input::action::mock::ActionMock component
+bevy_enhanced_input::action::relationship::ActionOf<raea_bevy_plugins::enhanced_input::OnFoot> component
+bevy_enhanced_input::action::relationship::Actions<raea_bevy_plugins::enhanced_input::OnFoot> component
+bevy_enhanced_input::action::value::ActionValue component
+bevy_enhanced_input::binding::Binding component
+bevy_enhanced_input::binding::relationship::BindingOf component
+bevy_enhanced_input::binding::relationship::Bindings component
+bevy_enhanced_input::condition::block_by::BlockBy component
+bevy_enhanced_input::condition::chord::Chord component
+bevy_enhanced_input::condition::combo::Combo component
+bevy_enhanced_input::condition::cooldown::Cooldown component
+bevy_enhanced_input::condition::down::Down component
+bevy_enhanced_input::condition::flick::Flick component
+bevy_enhanced_input::condition::hold::Hold component
+bevy_enhanced_input::condition::hold_and_release::HoldAndRelease component
+bevy_enhanced_input::condition::press::Press component
+bevy_enhanced_input::condition::pulse::Pulse component
+bevy_enhanced_input::condition::release::Release component
+bevy_enhanced_input::condition::tap::Tap component
+bevy_enhanced_input::condition::toggle::Toggle component
+bevy_enhanced_input::context::ContextActivity<raea_bevy_plugins::enhanced_input::OnFoot> component
+bevy_enhanced_input::context::ContextPriority<raea_bevy_plugins::enhanced_input::OnFoot> component
+bevy_enhanced_input::context::GamepadDevice component
+bevy_enhanced_input::context::input_reader::ActionSources resource
+bevy_enhanced_input::modifier::accumulate_by::AccumulateBy component
+bevy_enhanced_input::modifier::clamp::Clamp component
+bevy_enhanced_input::modifier::dead_zone::DeadZone component
+bevy_enhanced_input::modifier::delta_scale::DeltaScale component
+bevy_enhanced_input::modifier::exponential_curve::ExponentialCurve component
+bevy_enhanced_input::modifier::linear_step::LinearStep component
+bevy_enhanced_input::modifier::negate::Negate component
+bevy_enhanced_input::modifier::scale::Scale component
+bevy_enhanced_input::modifier::smooth_nudge::SmoothNudge component
+bevy_enhanced_input::modifier::swizzle_axis::SwizzleAxis component
+bevy_enoki::update::OneShot component
+bevy_extract::sync_world::MainEntity component
+bevy_feathers::alpha_pattern::AlphaPattern component
+bevy_feathers::controls::button::ButtonVariant component
+bevy_feathers::controls::button::FeathersButton component
+bevy_feathers::controls::button::FeathersToolButton component
+bevy_feathers::controls::checkbox::CheckboxFrame component
+bevy_feathers::controls::checkbox::CheckboxMark component
+bevy_feathers::controls::checkbox::CheckboxOutline component
+bevy_feathers::controls::checkbox::FeathersCheckbox component
+bevy_feathers::controls::color_input::ColorInputValue component
+bevy_feathers::controls::color_input::FeathersColorInput component
+bevy_feathers::controls::color_plane::ColorPlaneDragState component
+bevy_feathers::controls::color_plane::ColorPlaneInner component
+bevy_feathers::controls::color_plane::ColorPlaneThumb component
+bevy_feathers::controls::color_plane::ColorPlaneValue component
+bevy_feathers::controls::color_plane::FeathersColorPlane component
+bevy_feathers::controls::color_slider::ColorChannel component
+bevy_feathers::controls::color_slider::ColorSlider component
+bevy_feathers::controls::color_slider::ColorSliderThumb component
+bevy_feathers::controls::color_slider::ColorSliderTrack component
+bevy_feathers::controls::color_slider::FeathersColorSlider component
+bevy_feathers::controls::color_slider::SliderBaseColor component
+bevy_feathers::controls::color_swatch::ColorSwatchFg component
+bevy_feathers::controls::color_swatch::ColorSwatchValue component
+bevy_feathers::controls::color_swatch::FeathersColorSwatch component
+bevy_feathers::controls::color_swatch_grid::ColorSwatchGridCellRing component
+bevy_feathers::controls::color_swatch_grid::FeathersColorSwatchEmptyCell component
+bevy_feathers::controls::color_swatch_grid::FeathersColorSwatchGrid component
+bevy_feathers::controls::color_swatch_grid::FeathersColorSwatchGridCell component
+bevy_feathers::controls::color_wheel::ColorWheelDragState component
+bevy_feathers::controls::color_wheel::ColorWheelInner component
+bevy_feathers::controls::color_wheel::ColorWheelRingThumb component
+bevy_feathers::controls::color_wheel::ColorWheelTriangleThumb component
+bevy_feathers::controls::color_wheel::ColorWheelValue component
+bevy_feathers::controls::color_wheel::FeathersColorWheel component
+bevy_feathers::controls::dialog::FeathersDialog component
+bevy_feathers::controls::dialog::FeathersDialogBody component
+bevy_feathers::controls::dialog::FeathersDialogClose component
+bevy_feathers::controls::dialog::FeathersDialogFooter component
+bevy_feathers::controls::dialog::FeathersDialogHeader component
+bevy_feathers::controls::dialog::FeathersFloatingDialog component
+bevy_feathers::controls::disclosure_toggle::FeathersDisclosureToggle component
+bevy_feathers::controls::listview::ActiveRowOutline component
+bevy_feathers::controls::listview::FeathersListRow component
+bevy_feathers::controls::listview::FeathersListView component
+bevy_feathers::controls::menu::FeathersMenu component
+bevy_feathers::controls::menu::FeathersMenuButton component
+bevy_feathers::controls::menu::FeathersMenuDivider component
+bevy_feathers::controls::menu::FeathersMenuItem component
+bevy_feathers::controls::menu::FeathersMenuPopup component
+bevy_feathers::controls::menu::FeathersMenuToolButton component
+bevy_feathers::controls::number_input::DragState component
+bevy_feathers::controls::number_input::FeathersNumberInput component
+bevy_feathers::controls::number_input::NumberInputDecrement component
+bevy_feathers::controls::number_input::NumberInputIncrement component
+bevy_feathers::controls::number_input::NumberInputPrecision component
+bevy_feathers::controls::number_input::NumberInputStep component
+bevy_feathers::controls::number_input::NumberInputUnits component
+bevy_feathers::controls::number_input::NumberInputWrap component
+bevy_feathers::controls::radio::FeathersRadio component
+bevy_feathers::controls::radio::RadioMark component
+bevy_feathers::controls::radio::RadioOutline component
+bevy_feathers::controls::scrollbar::FeathersScrollbar component
+bevy_feathers::controls::scrollbar::FeathersScrollbarThumb component
+bevy_feathers::controls::scrollbar::ScrollbarGutter component
+bevy_feathers::controls::select::FeathersSelect component
+bevy_feathers::controls::select::OptionIndex component
+bevy_feathers::controls::select::SelectCaption component
+bevy_feathers::controls::slider::FeathersSlider component
+bevy_feathers::controls::slider::SliderValueText component
+bevy_feathers::controls::text_input::FeathersTextInput component
+bevy_feathers::controls::text_input::FeathersTextInputContainer component
+bevy_feathers::controls::toggle_switch::FeathersToggleSwitch component
+bevy_feathers::controls::toggle_switch::ToggleSwitchSlide component
+bevy_feathers::display::icon::ThemedIcon component
+bevy_feathers::focus::FocusIndicator component
+bevy_feathers::focus::FocusWithinIndicator component
+bevy_feathers::font_styles::InheritableFont component
+bevy_feathers::theme::InheritableThemeTextColor component
+bevy_feathers::theme::ThemeBackgroundColor component
+bevy_feathers::theme::ThemeBorderColor component
+bevy_feathers::theme::ThemeTextColor component
+bevy_feathers::theme::ThemedText component
+bevy_feathers::theme::UiTheme resource
+bevy_flair_core::helper_components::text::TextDecoration component
+bevy_flair_core::helper_components::text::TextDecorationLine component
+bevy_flair_style::components::AttributeList component
+bevy_flair_style::components::ClassList component
+bevy_flair_style::components::EffectiveStyleSheet component
+bevy_flair_style::components::PseudoElement component
+bevy_flair_style::components::PseudoElementsSupport component
+bevy_flair_style::components::StyleActiveBlocks component
+bevy_flair_style::components::StyleData component
+bevy_flair_style::components::StyleVars component
+bevy_flair_style::components::Styled component
+bevy_flair_style::components::TypeName component
+bevy_flair_style::components::WindowMediaFeatures component
+bevy_flair_style::components::marker::StyleMarkers component
+bevy_flair_style::components::marker::StyleSystem component
+bevy_gizmos::aabb::ShowAabbGizmo component
+bevy_gizmos::config::GizmoConfigStore resource
+bevy_gizmos::frustum::ShowFrustumGizmo component
+bevy_gizmos::retained::Gizmo component
+bevy_gizmos::skinned_mesh_bounds::ShowSkinnedMeshBoundsGizmo component
+bevy_gizmos::transform_gizmo::TransformGizmoCamera component
+bevy_gizmos::transform_gizmo::TransformGizmoFocus component
+bevy_gizmos::transform_gizmo::TransformGizmoSettings resource
+bevy_gizmos::transform_gizmo::TransformGizmoState resource
+bevy_gizmos_render::LineGizmoEntities resource
+bevy_gltf::assets::GltfExtras component
+bevy_gltf::assets::GltfMaterialExtras component
+bevy_gltf::assets::GltfMaterialName component
+bevy_gltf::assets::GltfMeshExtras component
+bevy_gltf::assets::GltfMeshName component
+bevy_gltf::assets::GltfSceneExtras component
+bevy_gltf::assets::GltfSceneName component
+bevy_hanabi::ParticleEffect component
+bevy_hanabi::properties::EffectProperties component
+bevy_hanabi::spawn::EffectSpawner component
+bevy_hui::build::HtmlNode component
+bevy_hui::build::OnUiChange component
+bevy_hui::build::OnUiEnter component
+bevy_hui::build::OnUiExit component
+bevy_hui::build::OnUiPress component
+bevy_hui::build::OnUiSpawn component
+bevy_hui::build::Tags component
+bevy_hui::build::TemplateProperties component
+bevy_hui::build::TemplateScope component
+bevy_hui::build::UiId component
+bevy_hui::build::UiTarget component
+bevy_hui::build::UiWatch component
+bevy_hui::styles::HoverTimer component
+bevy_hui::styles::HtmlStyle component
+bevy_hui::styles::InteractionTimer component
+bevy_hui::styles::PressedTimer component
+bevy_image::image::Image asset
+bevy_image::texture_atlas::TextureAtlasLayout asset
+bevy_input::button_input::ButtonInput<bevy_input::gamepad::GamepadButton> resource
+bevy_input::button_input::ButtonInput<bevy_input::keyboard::KeyCode> resource
+bevy_input::button_input::ButtonInput<bevy_input::mouse::MouseButton> resource
+bevy_input::gamepad::Gamepad component
+bevy_input::gamepad::GamepadAxisChangedEvent message
+bevy_input::gamepad::GamepadButtonChangedEvent message
+bevy_input::gamepad::GamepadButtonStateChangedEvent message
+bevy_input::gamepad::GamepadConnectionEvent message
+bevy_input::gamepad::GamepadEvent message
+bevy_input::gamepad::GamepadRumbleRequest message
+bevy_input::gamepad::GamepadSettings component
+bevy_input::gamepad::RawGamepadAxisChangedEvent message
+bevy_input::gamepad::RawGamepadButtonChangedEvent message
+bevy_input::gamepad::RawGamepadEvent message
+bevy_input::gestures::DoubleTapGesture message
+bevy_input::gestures::PanGesture message
+bevy_input::gestures::PinchGesture message
+bevy_input::gestures::RotationGesture message
+bevy_input::keyboard::KeyboardFocusLost message
+bevy_input::keyboard::KeyboardInput message
+bevy_input::mouse::AccumulatedMouseMotion resource
+bevy_input::mouse::AccumulatedMouseScroll resource
+bevy_input::mouse::MouseButtonInput message
+bevy_input::mouse::MouseMotion message
+bevy_input::mouse::MouseWheel message
+bevy_input::touch::TouchInput message
+bevy_input_focus::AcquireFocus event
+bevy_input_focus::InputFocus resource
+bevy_input_focus::InputFocusVisible resource
+bevy_input_focus::autofocus::AutoFocus component
+bevy_input_focus::directional_navigation::AutoNavigationConfig resource
+bevy_input_focus::directional_navigation::DirectionalNavigationMap resource
+bevy_input_focus::gained_and_lost::FocusGained event
+bevy_input_focus::gained_and_lost::FocusLost event
+bevy_input_focus::tab_navigation::TabGroup component
+bevy_input_focus::tab_navigation::TabIndex component
+bevy_light::NotShadowCaster component
+bevy_light::NotShadowReceiver component
+bevy_light::ShadowFilteringMethod component
+bevy_light::TransmittedShadowReceiver component
+bevy_light::ambient_light::AmbientLight component
+bevy_light::ambient_light::GlobalAmbientLight resource
+bevy_light::cascade::CascadeShadowConfig component
+bevy_light::cascade::Cascades component
+bevy_light::cluster::ClusterConfig component
+bevy_light::cluster::ClusteredDecal component
+bevy_light::directional_light::DirectionalLight component
+bevy_light::directional_light::DirectionalLightShadowMap resource
+bevy_light::directional_light::DirectionalLightTexture component
+bevy_light::gizmos::ShowLightGizmo component
+bevy_light::point_light::PointLight component
+bevy_light::point_light::PointLightShadowMap resource
+bevy_light::point_light::PointLightTexture component
+bevy_light::probe::EnvironmentMapLight component
+bevy_light::probe::GeneratedEnvironmentMapLight component
+bevy_light::probe::IrradianceVolume component
+bevy_light::probe::LightProbe component
+bevy_light::probe::ParallaxCorrection component
+bevy_light::probe::Skybox component
+bevy_light::rect_light::RectLight component
+bevy_light::spot_light::SpotLight component
+bevy_light::spot_light::SpotLightTexture component
+bevy_light::volumetric::FogVolume component
+bevy_light::volumetric::VolumetricFog component
+bevy_light::volumetric::VolumetricLight component
+bevy_light_2d::light::AmbientLight2d component
+bevy_light_2d::light::PointLight2d component
+bevy_light_2d::light::SpotLight2d component
+bevy_light_2d::occluder::LightOccluder2dVisibility component
+bevy_materialize::generic_material::GenericMaterial3d component
+bevy_materialize::generic_material::GenericMaterialApplied component
+bevy_mesh::components::Mesh2d component
+bevy_mesh::components::Mesh3d component
+bevy_mesh::components::MeshTag component
+bevy_mesh::mesh::Mesh asset
+bevy_mesh::morph::MeshMorphWeights component
+bevy_mesh::morph::MorphWeights component
+bevy_mesh::skinning::SkinnedMesh component
+bevy_obj::scene::MeshGroups component
+bevy_pancam::PanCam component
+bevy_panorbit_camera::PanOrbitCamera component
+bevy_pbr::contact_shadows::ContactShadows component
+bevy_pbr::fog::DistanceFog component
+bevy_pbr::lightmap::Lightmap component
+bevy_pbr::material::DefaultOpaqueRendererMethod resource
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, bevy_pbr::decal::forward::ForwardDecalMaterialExt>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, bevy_trenchbroom::special_textures::LiquidMaterialExt>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_fog::froxel_glass::Glass>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_grid::Grid>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_look::paint::Paint>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_material::toon::ToonExt>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<bevy_trenchbroom::special_textures::QuakeSkyMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_fog::fire::FireMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_look::look::LookMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_material::shader_material::ShaderMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_material::shadow_only::ShadowOnlyMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_material::toon::OutlineMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_screen::CrtMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_splat::SplatMask> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_splat::SplatMaterial> component
+bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_volume::VolumeMaterial> component
+bevy_pbr::meshlet::MeshletMesh3d component
+bevy_pbr::pbr_material::StandardMaterial asset
+bevy_pbr::ssao::ScreenSpaceAmbientOcclusion component
+bevy_pbr::ssr::ScreenSpaceReflections component
+bevy_pbr::transmission::ScreenSpaceTransmission component
+bevy_pbr::wireframe::Mesh3dWireframe component
+bevy_pbr::wireframe::NoWireframe component
+bevy_pbr::wireframe::Wireframe component
+bevy_pbr::wireframe::WireframeColor component
+bevy_pbr::wireframe::WireframeConfig resource
+bevy_pbr::wireframe::WireframeLineWidth component
+bevy_pbr::wireframe::WireframeTopology component
+bevy_pbr::wireframe::WireframeXray component
+bevy_picking::Pickable component
+bevy_picking::PickingSettings resource
+bevy_picking::backend::ray::RayMap resource
+bevy_picking::cursor::DefaultCursor resource
+bevy_picking::cursor::EntityCursor component
+bevy_picking::cursor::OverrideCursor resource
+bevy_picking::events::PointerState resource
+bevy_picking::hover::DirectlyHovered component
+bevy_picking::hover::HoverMap resource
+bevy_picking::hover::Hovered component
+bevy_picking::hover::PickingInteraction component
+bevy_picking::hover::PreviousHoverMap resource
+bevy_picking::input::PointerInputSettings resource
+bevy_picking::mesh_picking::MeshPickingCamera component
+bevy_picking::mesh_picking::MeshPickingSettings resource
+bevy_picking::mesh_picking::ray_cast::RayCastBackfaces component
+bevy_picking::mesh_picking::ray_cast::SimplifiedMesh component
+bevy_picking::pointer::PointerId component
+bevy_picking::pointer::PointerInteraction component
+bevy_picking::pointer::PointerLocation component
+bevy_picking::pointer::PointerMap resource
+bevy_picking::pointer::PointerPressState component
+bevy_post_process::auto_exposure::settings::AutoExposure component
+bevy_post_process::bloom::settings::Bloom component
+bevy_post_process::dof::DepthOfField component
+bevy_post_process::effect_stack::chromatic_aberration::ChromaticAberration component
+bevy_post_process::effect_stack::vignette::Vignette component
+bevy_post_process::motion_blur::MotionBlur component
+bevy_prng::WyRand component
+bevy_rand::seed::RngSeed<bevy_prng::WyRand> component
+bevy_rapier2d::control::controller_filter::ControllerIgnored component
+bevy_rapier2d::control::pid_controller::PdController component
+bevy_rapier2d::control::pid_controller::PidController component
+bevy_rapier2d::dynamics::joint::ImpulseJointDisabled component
+bevy_rapier2d::dynamics::joint::ImpulseJointImpulses component
+bevy_rapier2d::dynamics::multibody::KinematicMultibodyJoint component
+bevy_rapier2d::dynamics::multibody::MultibodyJointArmature component
+bevy_rapier2d::dynamics::multibody::MultibodyJointCouplings component
+bevy_rapier2d::dynamics::multibody::MultibodyJointDamping component
+bevy_rapier2d::dynamics::multibody::MultibodyJointFriction component
+bevy_rapier2d::dynamics::multibody::MultibodyJointSprings component
+bevy_rapier2d::dynamics::multibody::MultibodyJointState component
+bevy_rapier2d::dynamics::multibody::MultibodySelfContactsDisabled component
+bevy_rapier2d::dynamics::rigid_body::AdditionalMassProperties component
+bevy_rapier2d::dynamics::rigid_body::AdditionalPgsIterations component
+bevy_rapier2d::dynamics::rigid_body::AdditionalSolverIterations component
+bevy_rapier2d::dynamics::rigid_body::AllowFastRotation component
+bevy_rapier2d::dynamics::rigid_body::Ccd component
+bevy_rapier2d::dynamics::rigid_body::Damping component
+bevy_rapier2d::dynamics::rigid_body::Dominance component
+bevy_rapier2d::dynamics::rigid_body::ExternalForce component
+bevy_rapier2d::dynamics::rigid_body::ExternalImpulse component
+bevy_rapier2d::dynamics::rigid_body::GravityScale component
+bevy_rapier2d::dynamics::rigid_body::LockedAxes component
+bevy_rapier2d::dynamics::rigid_body::ReadMassProperties component
+bevy_rapier2d::dynamics::rigid_body::ReadWorldMassProperties component
+bevy_rapier2d::dynamics::rigid_body::RigidBody component
+bevy_rapier2d::dynamics::rigid_body::RigidBodyDisabled component
+bevy_rapier2d::dynamics::rigid_body::Sleeping component
+bevy_rapier2d::dynamics::rigid_body::SoftCcd component
+bevy_rapier2d::dynamics::rigid_body::Velocity component
+bevy_rapier2d::dynamics::soft_body::SoftBodyAttachments component
+bevy_rapier2d::dynamics::soft_body::SoftBodyCluster component
+bevy_rapier2d::dynamics::soft_body::SoftBodyClusterKinematicTarget component
+bevy_rapier2d::dynamics::soft_body::SoftBodyClusterPinned component
+bevy_rapier2d::dynamics::soft_body::SoftBodyClusterShapeMatching component
+bevy_rapier2d::dynamics::soft_body::SoftBodyDisabled component
+bevy_rapier2d::dynamics::soft_body::SoftBodyExternalForce component
+bevy_rapier2d::dynamics::soft_body::SoftBodyExternalImpulse component
+bevy_rapier2d::dynamics::soft_body::SoftBodyKinematicTargets component
+bevy_rapier2d::dynamics::soft_body::SoftBodyMaterial component
+bevy_rapier2d::dynamics::soft_body::SoftBodyPinnedParticles component
+bevy_rapier2d::dynamics::soft_body::SoftBodyState component
+bevy_rapier2d::dynamics::soft_body::SoftBodyVolumeFactor component
+bevy_rapier2d::geometry::collider::ActiveCollisionTypes component
+bevy_rapier2d::geometry::collider::ActiveEvents component
+bevy_rapier2d::geometry::collider::ActiveHooks component
+bevy_rapier2d::geometry::collider::ColliderDisabled component
+bevy_rapier2d::geometry::collider::ColliderMassProperties component
+bevy_rapier2d::geometry::collider::CollidingEntities component
+bevy_rapier2d::geometry::collider::CollisionGroups component
+bevy_rapier2d::geometry::collider::ContactForceEventThreshold component
+bevy_rapier2d::geometry::collider::ContactSkin component
+bevy_rapier2d::geometry::collider::Friction component
+bevy_rapier2d::geometry::collider::Group component
+bevy_rapier2d::geometry::collider::ReadColliderMassProperties component
+bevy_rapier2d::geometry::collider::Restitution component
+bevy_rapier2d::geometry::collider::Sensor component
+bevy_rapier2d::geometry::collider::SolverGroups component
+bevy_rapier2d::render::DebugRenderContext resource
+bevy_rapier3d::control::controller_filter::ControllerIgnored component
+bevy_rapier3d::control::pid_controller::PdController component
+bevy_rapier3d::control::pid_controller::PidController component
+bevy_rapier3d::control::vehicle_controller::RayCastVehicleController component
+bevy_rapier3d::dynamics::joint::ImpulseJointDisabled component
+bevy_rapier3d::dynamics::joint::ImpulseJointImpulses component
+bevy_rapier3d::dynamics::multibody::KinematicMultibodyJoint component
+bevy_rapier3d::dynamics::multibody::MultibodyJointArmature component
+bevy_rapier3d::dynamics::multibody::MultibodyJointCouplings component
+bevy_rapier3d::dynamics::multibody::MultibodyJointDamping component
+bevy_rapier3d::dynamics::multibody::MultibodyJointFriction component
+bevy_rapier3d::dynamics::multibody::MultibodyJointSprings component
+bevy_rapier3d::dynamics::multibody::MultibodyJointState component
+bevy_rapier3d::dynamics::multibody::MultibodySelfContactsDisabled component
+bevy_rapier3d::dynamics::rigid_body::AdditionalMassProperties component
+bevy_rapier3d::dynamics::rigid_body::AdditionalPgsIterations component
+bevy_rapier3d::dynamics::rigid_body::AdditionalSolverIterations component
+bevy_rapier3d::dynamics::rigid_body::AllowFastRotation component
+bevy_rapier3d::dynamics::rigid_body::Ccd component
+bevy_rapier3d::dynamics::rigid_body::Damping component
+bevy_rapier3d::dynamics::rigid_body::Dominance component
+bevy_rapier3d::dynamics::rigid_body::ExternalForce component
+bevy_rapier3d::dynamics::rigid_body::ExternalImpulse component
+bevy_rapier3d::dynamics::rigid_body::GravityScale component
+bevy_rapier3d::dynamics::rigid_body::GyroscopicForces component
+bevy_rapier3d::dynamics::rigid_body::LockedAxes component
+bevy_rapier3d::dynamics::rigid_body::ReadMassProperties component
+bevy_rapier3d::dynamics::rigid_body::ReadWorldMassProperties component
+bevy_rapier3d::dynamics::rigid_body::RigidBody component
+bevy_rapier3d::dynamics::rigid_body::RigidBodyDisabled component
+bevy_rapier3d::dynamics::rigid_body::Sleeping component
+bevy_rapier3d::dynamics::rigid_body::SoftCcd component
+bevy_rapier3d::dynamics::rigid_body::Velocity component
+bevy_rapier3d::dynamics::soft_body::SoftBodyAttachments component
+bevy_rapier3d::dynamics::soft_body::SoftBodyCluster component
+bevy_rapier3d::dynamics::soft_body::SoftBodyClusterKinematicTarget component
+bevy_rapier3d::dynamics::soft_body::SoftBodyClusterPinned component
+bevy_rapier3d::dynamics::soft_body::SoftBodyClusterShapeMatching component
+bevy_rapier3d::dynamics::soft_body::SoftBodyDisabled component
+bevy_rapier3d::dynamics::soft_body::SoftBodyExternalForce component
+bevy_rapier3d::dynamics::soft_body::SoftBodyExternalImpulse component
+bevy_rapier3d::dynamics::soft_body::SoftBodyKinematicTargets component
+bevy_rapier3d::dynamics::soft_body::SoftBodyMaterial component
+bevy_rapier3d::dynamics::soft_body::SoftBodyPinnedParticles component
+bevy_rapier3d::dynamics::soft_body::SoftBodyState component
+bevy_rapier3d::dynamics::soft_body::SoftBodyVolumeFactor component
+bevy_rapier3d::geometry::collider::ActiveCollisionTypes component
+bevy_rapier3d::geometry::collider::ActiveEvents component
+bevy_rapier3d::geometry::collider::ActiveHooks component
+bevy_rapier3d::geometry::collider::ColliderDisabled component
+bevy_rapier3d::geometry::collider::ColliderMassProperties component
+bevy_rapier3d::geometry::collider::CollidingEntities component
+bevy_rapier3d::geometry::collider::CollisionGroups component
+bevy_rapier3d::geometry::collider::ContactForceEventThreshold component
+bevy_rapier3d::geometry::collider::ContactSkin component
+bevy_rapier3d::geometry::collider::Friction component
+bevy_rapier3d::geometry::collider::Group component
+bevy_rapier3d::geometry::collider::ReadColliderMassProperties component
+bevy_rapier3d::geometry::collider::Restitution component
+bevy_rapier3d::geometry::collider::Sensor component
+bevy_rapier3d::geometry::collider::SolverGroups component
+bevy_rapier3d::render::DebugRenderContext resource
+bevy_remote::schemas::SchemaTypesMetadata resource
+bevy_render::camera::CameraRenderGraph component
+bevy_render::camera::MipBias component
+bevy_render::camera::TemporalJitter component
+bevy_render::globals::GlobalsUniform resource
+bevy_render::occlusion_culling::OcclusionCulling component
+bevy_render::storage::ShaderBuffer asset
+bevy_render::view::ColorGrading component
+bevy_render::view::DebandDither component
+bevy_render::view::Msaa component
+bevy_render::view::Tonemapping component
+bevy_render::view::visibility::RenderShadowMapVisibleEntities component
+bevy_render::view::window::screenshot::Screenshot component
+bevy_render::view::window::screenshot::ScreenshotCaptured event
+bevy_replicon::client::Remote component
+bevy_replicon::shared::replication::Replicated component
+bevy_rich_text3d::Text3dPlugin resource
+bevy_rich_text3d::atlas::TextAtlasHandle component
+bevy_rich_text3d::fetch::FetchedCondition component
+bevy_rich_text3d::fetch::FetchedText component
+bevy_rich_text3d::fetch::SharedSegment component
+bevy_rich_text3d::misc::Text3dBounds component
+bevy_rich_text3d::misc::Text3dDimensionOut component
+bevy_rich_text3d::styling::Text3dStyle component
+bevy_rich_text3d::text3d::Text3d component
+bevy_scene::scene_component::SceneComponentInfo component
+bevy_smud::components::SmudShape component
+bevy_solari::pathtracer::Pathtracer component
+bevy_solari::realtime::SolariLighting component
+bevy_solari::scene::types::RaytracingMesh3d component
+bevy_sprite::picking_backend::SpritePickingCamera component
+bevy_sprite::picking_backend::SpritePickingSettings resource
+bevy_sprite::sprite::Anchor component
+bevy_sprite::sprite::Sprite component
+bevy_sprite::text2d::Text2d component
+bevy_sprite::text2d::Text2dShadow component
+bevy_sprite_render::mesh2d::color_material::ColorMaterial asset
+bevy_sprite_render::mesh2d::material::MeshMaterial2d<bevy_smud::render::SmudMaterial> component
+bevy_sprite_render::mesh2d::material::MeshMaterial2d<bevy_sprite_render::mesh2d::color_material::ColorMaterial> component
+bevy_sprite_render::mesh2d::material::MeshMaterial2d<bevy_sprite_render::sprite_mesh::sprite_mesh_material::SpriteMeshMaterial> component
+bevy_sprite_render::mesh2d::material::MeshMaterial2d<bevy_sprite_render::tilemap_chunk::tilemap_chunk_material::TilemapChunkMaterial> component
+bevy_sprite_render::mesh2d::wireframe2d::Mesh2dWireframe component
+bevy_sprite_render::mesh2d::wireframe2d::NoWireframe2d component
+bevy_sprite_render::mesh2d::wireframe2d::Wireframe2d component
+bevy_sprite_render::mesh2d::wireframe2d::Wireframe2dColor component
+bevy_sprite_render::mesh2d::wireframe2d::Wireframe2dConfig resource
+bevy_sprite_render::sprite_mesh::sprite_mesh_material::SpriteMeshMaterial asset
+bevy_sprite_render::tilemap_chunk::TilemapChunk component
+bevy_sprite_render::tilemap_chunk::TilemapChunkMeshCache resource
+bevy_sprite_render::tilemap_chunk::TilemapChunkTileData component
+bevy_spritesheet_animation::animator::Animator resource
+bevy_spritesheet_animation::components::sprite3d::Sprite3d component
+bevy_spritesheet_animation::components::spritesheet_animation::SpritesheetAnimation component
+bevy_spritesheet_animation::systems::sprite3d::Cache resource
+bevy_text::bounds::TextBounds component
+bevy_text::pipeline::TextLayoutInfo component
+bevy_text::text::ComputedTextBlock component
+bevy_text::text::EmSize component
+bevy_text::text::FontHinting component
+bevy_text::text::LetterSpacing component
+bevy_text::text::LineHeight component
+bevy_text::text::StrikethroughColor component
+bevy_text::text::TextBackgroundColor component
+bevy_text::text::TextColor component
+bevy_text::text::TextFont component
+bevy_text::text::TextLayout component
+bevy_text::text::TextSpan component
+bevy_text::text::UnderlineColor component
+bevy_time::delayed_commands::DelayedCommandQueue component
+bevy_time::time::Time<()> resource
+bevy_time::time::Time<avian3d::schedule::time::Physics> resource
+bevy_time::time::Time<avian3d::schedule::time::Substeps> resource
+bevy_time::time::Time<bevy_hanabi::time::EffectSimulation> resource
+bevy_time::time::Time<bevy_time::fixed::Fixed> resource
+bevy_time::time::Time<bevy_time::real::Real> resource
+bevy_time::time::Time<bevy_time::virt::Virtual> resource
+bevy_time_runner::time_runner::SkipTimeRunner component
+bevy_time_runner::time_runner::TimeRunner component
+bevy_time_runner::time_span::TimeSpan component
+bevy_time_runner::time_span::TimeSpanProgress component
+bevy_transform::components::global_transform::GlobalTransform component
+bevy_transform::components::transform::Transform component
+bevy_transform::components::transform::TransformTreeChanged component
+bevy_transform_interpolation::NoRotationEasing component
+bevy_transform_interpolation::NoScaleEasing component
+bevy_transform_interpolation::NoTransformEasing component
+bevy_transform_interpolation::NoTranslationEasing component
+bevy_transform_interpolation::NonlinearRotationEasing component
+bevy_transform_interpolation::NonlinearTranslationEasing component
+bevy_transform_interpolation::RotationEasingState component
+bevy_transform_interpolation::ScaleEasingState component
+bevy_transform_interpolation::TranslationEasingState component
+bevy_transform_interpolation::extrapolation::RotationExtrapolation component
+bevy_transform_interpolation::extrapolation::TransformExtrapolation component
+bevy_transform_interpolation::extrapolation::TranslationExtrapolation component
+bevy_transform_interpolation::hermite::RotationHermiteEasing component
+bevy_transform_interpolation::hermite::TransformHermiteEasing component
+bevy_transform_interpolation::hermite::TranslationHermiteEasing component
+bevy_transform_interpolation::interpolation::RotationInterpolation component
+bevy_transform_interpolation::interpolation::ScaleInterpolation component
+bevy_transform_interpolation::interpolation::TransformInterpolation component
+bevy_transform_interpolation::interpolation::TranslationInterpolation component
+bevy_trenchbroom::class::builtin::base::KillTarget component
+bevy_trenchbroom::class::builtin::base::Target component
+bevy_trenchbroom::class::builtin::base::Targetable component
+bevy_trenchbroom::class::builtin::light::basic_impls::DynamicOnlyDirectionalLight component
+bevy_trenchbroom::class::builtin::light::basic_impls::DynamicOnlyPointLight component
+bevy_trenchbroom::class::builtin::light::basic_impls::DynamicOnlySpotLight component
+bevy_trenchbroom::class::builtin::solid::FuncGeneric component
+bevy_trenchbroom::class::builtin::solid::FuncGroup component
+bevy_trenchbroom::class::builtin::solid::Worldspawn component
+bevy_trenchbroom::class::scene_hooks::PreloadedAssets component
+bevy_trenchbroom::geometry::BrushGeometry component
+bevy_trenchbroom::geometry::Brushes component
+bevy_trenchbroom::geometry::LocalSpaceBrushes component
+bevy_tween::interpolation::EaseKind component
+bevy_tween::tween::AnimationTarget component
+bevy_tween::tween::SkipTween component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetAsset<bevy_sprite_render::mesh2d::color_material::ColorMaterial>, bevy_tween::interpolate::sprite::ColorMaterial> component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetComponent, bevy_tween::interpolate::sprite::SpriteColor> component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetComponent, bevy_tween::interpolate::transform::AngleZ> component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetComponent, bevy_tween::interpolate::transform::Rotation> component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetComponent, bevy_tween::interpolate::transform::Scale> component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetComponent, bevy_tween::interpolate::transform::Translation> component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetComponent, bevy_tween::interpolate::ui::BackgroundColor> component
+bevy_tween::tween::Tween<bevy_tween::tween::TargetComponent, bevy_tween::interpolate::ui::BorderColor> component
+bevy_tween::tween::TweenInterpolationValue component
+bevy_tween::tween::TweenPreviousValue component
+bevy_tween::tween_event::EventEmittingTween component
+bevy_ui::UiScale resource
+bevy_ui::accessibility::AccessibleLabel component
+bevy_ui::auto_directional_navigation::AutoDirectionalNavigation component
+bevy_ui::experimental::ghost_hierarchy::GhostNode component
+bevy_ui::focus::DeprecatedInteraction component
+bevy_ui::focus::FocusPolicy component
+bevy_ui::focus::RelativeCursorPosition component
+bevy_ui::gradients::BackgroundGradient component
+bevy_ui::gradients::BorderGradient component
+bevy_ui::interaction_states::Checkable component
+bevy_ui::interaction_states::Checked component
+bevy_ui::interaction_states::InteractionDisabled component
+bevy_ui::interaction_states::Pressed component
+bevy_ui::measurement::ContentSize component
+bevy_ui::picking_backend::UiPickingCamera component
+bevy_ui::picking_backend::UiPickingSettings resource
+bevy_ui::stack::ComputedStackIndex component
+bevy_ui::stack::UiStack resource
+bevy_ui::ui_node::BackgroundColor component
+bevy_ui::ui_node::BorderColor component
+bevy_ui::ui_node::BoxShadow component
+bevy_ui::ui_node::CalculatedClip component
+bevy_ui::ui_node::ComputedNode component
+bevy_ui::ui_node::ComputedUiRenderTargetInfo component
+bevy_ui::ui_node::ComputedUiTargetCamera component
+bevy_ui::ui_node::FixedNode component
+bevy_ui::ui_node::GlobalZIndex component
+bevy_ui::ui_node::IgnoreScroll component
+bevy_ui::ui_node::IsDefaultUiCamera component
+bevy_ui::ui_node::LayoutConfig component
+bevy_ui::ui_node::Node component
+bevy_ui::ui_node::OuterColor component
+bevy_ui::ui_node::Outline component
+bevy_ui::ui_node::OverrideClip component
+bevy_ui::ui_node::ScrollPosition component
+bevy_ui::ui_node::UiTargetCamera component
+bevy_ui::ui_node::ZIndex component
+bevy_ui::ui_transform::UiGlobalTransform component
+bevy_ui::ui_transform::UiTransform component
+bevy_ui::widget::button::DeprecatedButton component
+bevy_ui::widget::image::ImageNode component
+bevy_ui::widget::image::ImageNodeSize component
+bevy_ui::widget::inline_image::InlineImage component
+bevy_ui::widget::label::Label component
+bevy_ui::widget::text::Text component
+bevy_ui::widget::text::TextNodeFlags component
+bevy_ui::widget::text::TextShadow component
+bevy_ui::widget::viewport::ViewportNode component
+bevy_ui_render::BoxShadowSamples component
+bevy_ui_render::UiAntiAlias component
+bevy_ui_render::debug_overlay::GlobalUiDebugOptions resource
+bevy_ui_render::debug_overlay::UiDebugOptions component
+bevy_ui_render::image::ImageNodeTextureAtlasLayout component
+bevy_ui_widgets::Activate event
+bevy_ui_widgets::button::ActivateOnPress component
+bevy_ui_widgets::button::Button component
+bevy_ui_widgets::checkbox::Checkbox component
+bevy_ui_widgets::checkbox::SetChecked event
+bevy_ui_widgets::checkbox::ToggleChecked event
+bevy_ui_widgets::dialog::Dialog component
+bevy_ui_widgets::dialog::DialogDragHandle component
+bevy_ui_widgets::dialog::DialogDragState component
+bevy_ui_widgets::dialog::RequestClose event
+bevy_ui_widgets::list::ActiveDescendant component
+bevy_ui_widgets::list::ListItem component
+bevy_ui_widgets::list::ReselectListRow event
+bevy_ui_widgets::list::SetSelected event
+bevy_ui_widgets::menu::MenuButton component
+bevy_ui_widgets::menu::MenuEvent event
+bevy_ui_widgets::menu::MenuFocusState component
+bevy_ui_widgets::menu::MenuItem component
+bevy_ui_widgets::menu::MenuPopup component
+bevy_ui_widgets::modal::ModalDialog component
+bevy_ui_widgets::modal::ModalDialogBarrier component
+bevy_ui_widgets::popover::Popover component
+bevy_ui_widgets::radio::RadioButton component
+bevy_ui_widgets::radio::RadioGroup component
+bevy_ui_widgets::scrollarea::ScrollArea component
+bevy_ui_widgets::scrollbar::Scrollbar component
+bevy_ui_widgets::scrollbar::ScrollbarDragState component
+bevy_ui_widgets::scrollbar::ScrollbarThumb component
+bevy_ui_widgets::slider::SetSliderValue event
+bevy_ui_widgets::slider::Slider component
+bevy_ui_widgets::slider::SliderDragState component
+bevy_ui_widgets::slider::SliderPrecision component
+bevy_ui_widgets::slider::SliderRange component
+bevy_ui_widgets::slider::SliderStep component
+bevy_ui_widgets::slider::SliderThumb component
+bevy_ui_widgets::slider::SliderValue component
+bevy_ui_widgets::tabs::SelectedTab component
+bevy_ui_widgets::tabs::Tab component
+bevy_ui_widgets::tabs::TabList component
+bevy_ui_widgets::text_input::QueuedSelectAll resource
+bevy_ui_widgets::text_input::SelectAllOnFocus component
+bevy_ui_widgets::text_input::TextInput component
+bevy_vector_shapes::painter::canvas::Canvas component
+bevy_vector_shapes::shapes::Shape3d component
+bevy_vector_shapes::shapes::ShapeFill component
+bevy_vector_shapes::shapes::ShapeMaterial component
+bevy_vector_shapes::shapes::ShapeOrigin component
+bevy_vector_shapes::shapes::disc::DiscComponent component
+bevy_vector_shapes::shapes::line::LineComponent component
+bevy_vector_shapes::shapes::rectangle::RectangleComponent component
+bevy_vector_shapes::shapes::regular_polygon::RegularPolygonComponent component
+bevy_vector_shapes::shapes::triangle::TriangleComponent component
+bevy_vox_scene::load::components::VoxelCloudSource component
+bevy_vox_scene::load::components::VoxelLayer component
+bevy_vox_scene::load::components::VoxelModelInstance component
+bevy_vox_scene::load::components::VoxelModelSource component
+bevy_vox_scene::load::components::VoxelPaletteSource component
+bevy_vox_scene::model::VoxelMeshAssetUsage component
+bevy_window::cursor::CursorIcon component
+bevy_window::event::AppLifecycle message
+bevy_window::event::CursorEntered message
+bevy_window::event::CursorLeft message
+bevy_window::event::CursorMoved message
+bevy_window::event::FileDragAndDrop message
+bevy_window::event::Ime message
+bevy_window::event::RequestRedraw message
+bevy_window::event::WindowBackendScaleFactorChanged message
+bevy_window::event::WindowCloseRequested message
+bevy_window::event::WindowCreated message
+bevy_window::event::WindowDestroyed message
+bevy_window::event::WindowEvent message
+bevy_window::event::WindowFocused message
+bevy_window::event::WindowMoved message
+bevy_window::event::WindowOccluded message
+bevy_window::event::WindowResized message
+bevy_window::event::WindowScaleFactorChanged message
+bevy_window::event::WindowThemeChanged message
+bevy_window::monitor::Monitor component
+bevy_window::monitor::PrimaryMonitor component
+bevy_window::window::CursorOptions component
+bevy_window::window::PrimaryWindow component
+bevy_window::window::Window component
+bevy_world_serialization::components::DynamicWorldRoot component
+bevy_world_serialization::components::WorldAssetRoot component
+bevy_yoleck::vpeol::VpeolDragPlane resource
+bevy_yoleck::vpeol::VpeolOverrideDragPlane component
+big_space::camera::BigSpaceCameraController component
+big_space::camera::BigSpaceCameraInput resource
+big_space::floating_origins::BigSpace component
+big_space::floating_origins::FloatingOrigin component
+big_space::grid::Grid component
+big_space::grid::cell::CellCoord component
+big_space::stationary::GridDirtyTick component
+big_space::stationary::Stationary component
+big_space::stationary::StationaryInitialized component
+flipbook::FlipbookFrame component
+flipbook::FlipbookPlayer component
+flipbook::FlipbookRepeatMode component
+flipbook::FlipbookSpeed component
+ghx_grid::cartesian::coordinates::Cartesian2D component
+ghx_grid::cartesian::coordinates::Cartesian3D component
+ghx_grid::cartesian::coordinates::CartesianPosition component
+ghx_grid::cartesian::coordinates::GridDelta component
+ghx_grid::cartesian::grid::CartesianGrid<ghx_grid::cartesian::coordinates::Cartesian2D> component
+ghx_grid::cartesian::grid::CartesianGrid<ghx_grid::cartesian::coordinates::Cartesian3D> component
+ghx_grid::direction::Direction component
+ghx_proc_gen::generator::model::ModelInstance component
+ghx_proc_gen::generator::model::ModelRotation component
+ghx_proc_gen::generator::rules::ModelInfo component
+leafwing_input_manager::action_state::ActionState<raea_bevy_plugins::leafwing::GameAction> component
+leafwing_input_manager::input_map::InputMap<raea_bevy_plugins::leafwing::GameAction> component
+lightyear_connection::client_of::ClientOf component
+lightyear_core::interpolation::Interpolated component
+lightyear_core::prediction::Predicted component
+lightyear_prediction::despawn::PredictionDisable component
+lightyear_prediction::diagnostics::PredictionMetrics resource
+lightyear_replication::control::ControlledBy component
+lightyear_replication::control::ControlledByRemote component
+lightyear_replication::hierarchy::DisableReplicateHierarchy component
+lightyear_replication::hierarchy::ReplicateLike component
+lightyear_replication::hierarchy::ReplicateLikeChildren component
+lightyear_replication::prespawn::PreSpawned component
+lightyear_replication::receive::Persistent component
+lightyear_replication::send::ReplicatedFrom component
+raea_bevy_plugins::enhanced_input::OnFoot component
+raea_bevy_plugins::hanabi::Particles component
+raea_bevy_plugins::lightyear::Announce message
+raea_bevy_plugins::lightyear::Announced resource
+raea_bevy_plugins::lightyear::Position component
+raea_bevy_plugins::lightyear::Session state
+raea_bevy_plugins::lightyear::Teleport event
+raea_bevy_plugins::tnua::TnuaInput component
+raea_core_animate::spec::Animation component
diff --git a/docs/sdk-coverage/excluded.tsv b/docs/sdk-coverage/excluded.tsv
new file mode 100644
index 00000000..f013ccb2
--- /dev/null
+++ b/docs/sdk-coverage/excluded.tsv
@@ -0,0 +1,30 @@
+# area prefix reason (tools/sdk-coverage: a row whose item starts with prefix is excluded, not authorable)
+css -x- stylo's internal properties (-x-lang, -x-text-scale): set by the engine from attributes, never by an author
+element acronym obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element basefont obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element dir obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element frame obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element frameset obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element listing obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element marquee obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element multicol obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element nobr obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element noembed obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element noframes obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element plaintext obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element rb obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element rtc obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element spacer obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element strike obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element tt obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+element xmp obsolete in HTML (non-conforming): Blitz styles it so old pages render; React's JSX has no such element
+bevy raea_runtime_js::host::TestId the conformance harness's test id, not an author's
+bevy bevy_render::globals::GlobalsUniform the render world's shader globals, written by the renderer each frame
+bevy bevy_extract::sync_world::MainEntity the render world's link back to its main-world entity
+bevy bevy_ecs::observer::distributed_storage::ObservedBy ECS bookkeeping: which observers watch an entity (an author adds observers with useObserver)
+bevy bevy_ecs::resource::IsResource ECS bookkeeping: marks the entity a resource is stored on
+bevy bevy_transform::components::transform::TransformTreeChanged transform propagation's dirty flag
+bevy bevy_gizmos_render::LineGizmoEntities the gizmo renderer's entity cache
+bevy bevy_sprite_render::tilemap_chunk::TilemapChunkMeshCache the tilemap renderer's mesh cache
+bevy bevy_remote::schemas::SchemaTypesMetadata bevy_remote's own schema table
+bevy bevy_render::storage::ShaderBuffer a storage buffer the engine fills for its own passes (the NV12 readback, a splat cloud): an author reaches what it holds through <Splat> and the export, never the buffer
diff --git a/docs/sdk-coverage/upstream.tsv b/docs/sdk-coverage/upstream.tsv
new file mode 100644
index 00000000..bd2a8e54
--- /dev/null
+++ b/docs/sdk-coverage/upstream.tsv
@@ -0,0 +1,33 @@
+# name crate latest bevy (crates.io's index, tools/sdk-coverage --upstream, 2026-10-26)
+avian_pickup avian_pickup 0.6.0 ^0.19.0
+ahoy bevy_ahoy 0.2.0 ^0.19
+fps_controller bevy_fps_controller 19.0.0 ^0.19
+ldtk bevy_ecs_ldtk 0.16.0 ^0.20.0
+embedded_assets bevy_embedded_assets 0.16.0 ^0.19
+obj bevy_obj 0.20.0 ^0.20.0
+svg bevy_svg 0.19.0 ^0.19
+pkv bevy_pkv 0.17.0 ^0.20
+transform_gizmo transform-gizmo-bevy 0.11.0 ^0.19
+outline bevy_mod_outline 0.13.0 ^0.19.0
+lyon bevy_prototype_lyon 0.17.0 ^0.19.0
+smud bevy_smud 0.15.0 ^0.20
+mipmaps bevy_mod_mipmap_generator 0.2.0 ^0.19.0
+firework bevy_firework 0.10.0 ^0.19
+editor_cam bevy_editor_cam 0.9.3 ^0.18.0-rc.2
+lunex bevy_lunex 0.7.0 ^0.19
+text_input bevy_simple_text_input 0.15.0 ^0.19.0
+ui_anchor bevy_ui_anchor 0.12.0 ^0.19.0
+navigator vleue_navigator 0.16.0 ^0.19.1
+northstar bevy_northstar 0.7.0 ^0.19
+tween bevy_tween 0.14.1 ^0.20.0
+easings bevy_easings 0.19.0 ^0.19.0
+animation_graph bevy_animation_graph 0.11.0 ^0.19
+ik bevy_mod_inverse_kinematics 0.12.0 ^0.19
+trauma_shake bevy_trauma_shake 0.9.0 ^0.20
+hexx hexx 0.25.0 ^0.19
+noisy noisy_bevy 0.15.0 ^0.20
+voxel_world bevy_voxel_world 0.17.0 ^0.19
+renet bevy_renet 5.0.0 ^0.19
+ggrs bevy_ggrs 0.22.0 ^0.19
+yarn bevy_yarnspinner 0.9.0 ^0.19
+trenchbroom bevy_trenchbroom 0.15.0 ^0.20.0
diff --git a/docs/vite-in-raea.md b/docs/vite-in-raea.md
index 8c9643cc..48e67230 100644
--- a/docs/vite-in-raea.md
+++ b/docs/vite-in-raea.md
@@ -208,9 +208,9 @@ into a raea timeline, and none of jetway's stubs.
## Owners and files
-- A and B: an agent session. Touches runtime/react/src/scene.rs (bundling), react/js/lite/build.ts and serve.ts, void's host,
+- A and B: the orchestrator. Touches runtime/react/src/scene.rs (bundling), react/js/lite/build.ts and serve.ts, void's host,
workspace and brain, a new crate for the Bun build pieces.
-- C: an agent session (Shane asked for it directly, 2026-10-19); its files went with engine/html (see C's status).
+- C: the orchestrator (Shane asked for it directly, 2026-10-19); its files went with engine/html (see C's status).
- lightspeed: performance; consulted before any change to sdk/react/js/lite, the bridge or [profile.game]. Z4 builds
on JavaScriptCore's C API (JSObjectMakeArrayBufferWithBytesNoCopy for its op ring): if B changes the API the host
calls, lightspeed hears first. Its files in flight (2026-10-19): media (soft audio / h264 split), raea-render's h264 gates,
diff --git a/docs/zeroheap.feature b/docs/zeroheap.feature
index ff58570a..65259f7a 100644
--- a/docs/zeroheap.feature
+++ b/docs/zeroheap.feature
@@ -127,5 +127,5 @@ Feature: ZeroHeap: a running world allocates nothing; its memory is fixed at loa
Scenario: Fixed-width symbolic memory (HDC)
Then a world's persistent symbolic memory (what happened, what matters: agent memory, perception summaries,
playtest knowledge) is a fixed-width hypervector; bundling and binding never change its size, so it cannot grow
- And this fits symbolic and perceptual memory (docs/the roadmap Track K, meaning/), not exact physics or game state,
+ And this fits symbolic and perceptual memory (docs/goal.feature Track K, meaning/), not exact physics or game state,
which stay in Z2's fixed buffers
diff --git a/engine/cli/Cargo.toml b/engine/cli/Cargo.toml
index d233f227..739974f2 100644
--- a/engine/cli/Cargo.toml
+++ b/engine/cli/Cargo.toml
@@ -26,6 +26,7 @@ raea-io-home = { path = "../../io/home" }
raea-core-brief = { path = "../../core/brief" }
# `raea workspace`, `raea project` and `raea controller` (docs/projects.feature PJ1-PJ4)
raea-app-workspace = { path = "../../apps/workspace" }
+# raea-runtime-react's defaults
raea-runtime-react = { path = "../../runtime/react", default-features = false, features = ["h264", "av1", "scripts", "modules", "network", "ml"] }
# the sound of its renders and plays: <Seedling> samples and speech (raea-runtime-sound's features)
raea-runtime-sound = { path = "../../runtime/sound", features = ["seedling", "ml"] }
@@ -51,6 +52,10 @@ regex = "1"
raea-app-check = { path = "../../apps/check" }
raea-app-ci = { path = "../../apps/ci" }
raea-app-tools = { path = "../../apps/tools" }
+# raea solid info|view: a solid file measured and pictured
+raea-app-solid = { path = "../../apps/solid" }
+# raea judge: review sheets judged by clef-omni
+raea-app-judge = { path = "../../apps/judge" }
raea-app-media = { path = "../../apps/media" }
# `raea app run|check|bundle` and `raea rune` on either target (docs/targets.feature T0b)
raea-app-targets = { path = "../../apps/targets" }
diff --git a/engine/cli/src/brand.ts b/engine/cli/src/brand.ts
index 20510c7e..49085068 100644
--- a/engine/cli/src/brand.ts
+++ b/engine/cli/src/brand.ts
@@ -2,7 +2,7 @@
// the brand's website as scrape.ts read it (name, palette and logos; the styleguide, its tokens from the site's CSS) as
// the project's brand kit:
// brand/styleguide.json every token (pretty, sorted keys)
-// brand/brand.css the --brand-* stylesheet engine/cli/template/theme.css maps the brand classes onto (the host app's
+// brand/brand.css the --brand-* stylesheet engine/cli/template/theme.css maps the brand classes onto (the
// BrandKit format, so a kit made there still works)
// brand/brand.json derived from the two: colours by role (picked by contrast, only from the brand's own
// colours), heading and body fonts, the type scale, the CTA button, the logos
diff --git a/engine/cli/src/cli.rs b/engine/cli/src/cli.rs
index e4c22a44..f06c0d26 100644
--- a/engine/cli/src/cli.rs
+++ b/engine/cli/src/cli.rs
@@ -48,8 +48,14 @@ pub fn cli(args: &[String]) -> i32 {
let code = match run(args) {
Ok(msg) => {
crate::refused::clear(args);
- // a still is an export like a video (whose encoder signs and marks it): Content Credentials saying raea drew
- // it, and a PNG's pixels carry its export id
+ // a still is an export like a video (whose encoder signs and marks it): when this program signs, Content
+ // Credentials saying raea drew it, and a PNG's pixels carry its export id (raea_io_media::sign)
+ if raea_io_media::signs() && args.first().map(String::as_str) == Some("render") {
+ let still = flag(args, "-o").map(PathBuf::from).filter(|o| o.is_file() && matches!(o.extension().and_then(|e| e.to_str()), Some("png" | "jpg" | "jpeg" | "webp")));
+ if let Some(o) = still {
+ raea_io_media::sign::sign_file(&o, raea_io_media::sign::Made::Created);
+ }
+ }
if !msg.is_empty() {
println!("{msg}");
}
@@ -124,7 +130,7 @@ pub fn run(args: &[String]) -> R<String> {
// a workspace's files and specs (docs/projects.feature), listed under render's usage like library
let usage = format!("{usage}\n raea spec FILE.ts [--as brief|script|taste|plan|controller] (a spec's default export as JSON, checked against its schema: brief.ts, script.ts, taste.ts, plan.ts, controllers/ID.ts)\n raea workspace init [NAME] [--layout LAYOUT] | raea workspace adopt DIR [--name NAME] | raea workspace [--json] (a workspace: a git repo of projects and controllers under raea.root, ~/Studio unless git config says)\n raea project new NAME [--storage inline|submodule] | raea project split NAME [--remote URL] | raea project join NAME | raea project [--json] (a project in the workspace: its folder, brief.ts, media/, out/; split and join keep its history)\n raea controller ls [--json] | raea controller get PATH [--json] | raea controller set PATH VALUE [--project] [--by NAME] | raea controller write FILE.ts [--by NAME] | raea controller rm ID [--by NAME] (the workspace's controllers, controllers/ID.ts; PATH is controller.group.field; every change a commit)\n raea check EDIT.tsx --quick [--shape S] [--platform P] [--taste T] [-o check.json] (three stills of a composition checked for text: clipped, cramped, safe areas, sizes; about a second)\n raea hook claude (Claude Code's PostToolUse hook: the quick check after a composition is saved)\n raea next [DIR] (the two or three useful next steps for the project, from its brief, compositions, renders and checks)\n raea doctor [--fix] [DIR] (what doesn't match this raea: old brief files, an older workspace format, an agent's skill from another version)\n raea app run|check|bundle APP.tsx [--target web|native] [--size WxH] [--script steps.json] [--png DIR] [-o App.app] (a TSX app on @raea/ui: its window, the headless check, a Mac app; web is Blitz on Bevy, native is Rune; the app's `export const app` sets the target, web when it doesn't; raea rune ... is --target native)\n {}\n {}", skill::USAGE, tools::blender::USAGE);
let (export_game, scene, physics, splat) = (raea_app_game::USAGE, export::SCENE_USAGE, motion::physics::USAGE, tools::splat::USAGE);
- let apps = format!(" {}\n", raea_app_check::USAGE);
+ let apps = format!(" {}\n {}\n {}\n", raea_app_check::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE);
return Ok(format!("raea: renders, plays and checks raea compositions (React and TypeScript) on the GPU.\n\nusage: {usage}\n raea init (a project's files where they're missing: edit.tsx, cuts.ts, components/, AGENTS.md)\n raea cut TAKE \"line\" ... | --at A-B ... [--append] (cuts.ts and words.json: a take under media/ cut in the pauses around each line it says, transcribed first if it has no TAKE.words.json; or at those seconds)\n raea frame TAKE [--at S] (how a take fits the edit: a talking take for <FaceFrame>, a screen for <ScreenFit>, from where its face is)\n raea part list | raea part add NAME ... [--force] (a ready part copied into components/, yours to change)\n raea brand DOMAIN|URL (the brand kit read from its website on this machine: brand/brand.css, brand/brand.json, BRAND.md, logos in media/brand; says when a plain fetch saw too little)\n raea guide [NAME] (craft, the floor read before any edit; the modes: pitch, explain, story, play, tool; motion, music, layout and the rest; bevy and bevy/NAME for 3D)\n raea context PROJECT (what to read before working on a project: taste, brief, look, the floor and its modes' guides)\n{apps} raea play EDIT.tsx [--input | --input-script KEYS.json] [--size WxH] [--seconds N|end] (a game, live; also: --input-log FILE --offscreen --snapshot T FILE --json FILE --seek F FILE --scrub N --baked --autoplay --no-vsync --master --3d)\n {export_game} (a game as a program of its own: a Mac app or a command)\n {scene} (what each 3D part rests on: floating, sunk and clipping parts; light: the scene's lighting)\n {physics} (the bakes <Physics> and <Goo> make)\n {splat} (footage trained into a Gaussian splat for <Splat>; setup installs its tools)\n raea run SCRIPT.ts (a TypeScript program on the engine, headless: its default export is called, what it prints is the answer; a check like a room's checkLayout; also: --timeout S)\n raea gen image|video|music|sfx|speech|mesh|text \"PROMPT\" | gen plan|run FLOW.ts|FLOW.json | gen comfy import|export|run|schema FILE | gen models | gen balance (generated media through made.app, fal, Replicate, OpenRouter, Modal or ComfyUI; ComfyUI workflows both ways: raea gen alone lists its flags)\n {neural_usage} (DLSS 5 neural rendering on a `render --aov` folder, with its motion and depth: your own MLX-DLSS build and weights, RAEA_MLXDLSS and RAEA_DLSS_MODEL)\n raea mezz [--check] PATH... (an intra-only ProRes copy of each long-GOP source over 1080p, for smooth scrubbing; --check says which would get one)\n raea traces [show [N|last|DIR]] (the sessions raea left, newest first: how each ended, its glitches; show tells one in full)"));
}
// `--version`: the release's version, which a skill's front matter names (docs/skills.feature SK6)
@@ -213,7 +219,7 @@ pub fn run(args: &[String]) -> R<String> {
}
// `mezz [--check] PATH...`: optimized media (raea_io_media::mezz, lightspeed F4): each long-GOP source over 1080p under
// PATH (a file, or a folder's videos) gets its intra-only ProRes copy, one at a time; --check only says which would
- // `neural mlxdlss DIR -o OUT`: DLSS 5 on a `render --aov` folder, through the founder's own MLX-DLSS (RT2)
+ // `neural mlxdlss DIR -o OUT`: DLSS 5 on a `render --aov` folder, through the user's own MLX-DLSS (RT2)
if args.first().map(String::as_str) == Some("neural") {
return neural::neural(&args[1..]);
}
@@ -243,7 +249,7 @@ pub fn run(args: &[String]) -> R<String> {
Some("gen") => return raea_app_tools::generate::generate(args),
// the agent shell's own verbs ported here (`init`, `cut`, `frame`): engine/cli's handler, run by its native.ts (shell())
Some(v) if SHELL.contains(&v) => return shell(args),
- _ => {}
+ _ => if let Some(r) = raea_app_solid::verb(args) { return r }, // `solid info|view FILE.ts`, `judge DIR` (apps/solid)
}
// `master-gain BUNDLE.js DIR`: the gain and ceiling a composition's render masters its sound with, as JSON (live
// play asks this of a child process, so its second React and the whole mix never sit in the game's memory)
@@ -339,7 +345,7 @@ pub fn run(args: &[String]) -> R<String> {
}
if args.first().map(String::as_str) != Some("render") || args.len() < 2 {
return Err(format!(
- "raea render EDIT.tsx -o OUT.mp4|OUT.png|DIR [--frame N | --at A,B] [--composition ID] [--w W] [--h H] [--fps FPS] [--frames N] [--words W.json] [--perception P.json] [--input I.json|inputs.rrl] [--manifest render.json] [--stage WxH] [--10bit] [--aov] [--alpha] [--kbps N | --quality draft|high|master|0..1] (also: --lite --comps)\n raea render PAGE.html -o OUT.mp4|DIR [--at A,B] (an HTML composition, the HTML composition format format)\n raea render --bundle NAME.comp.js -o OUT.png|DIR [--dir DIR] [--frame N] (a bundle from raea bundle, as render_bundle draws it)
+ "raea render EDIT.tsx -o OUT.mp4|OUT.png|DIR [--frame N | --at A,B] [--composition ID] [--w W] [--h H] [--fps FPS] [--frames N] [--words W.json] [--perception P.json] [--input I.json|inputs.rrl] [--manifest render.json] [--stage WxH] [--10bit] [--aov] [--alpha] [--kbps N | --quality draft|high|master|0..1] [--clay] (also: --lite --comps)\n raea render EDIT.tsx --review DIR [--frame N] (fixed cameras hero, front, right, top, iso, low in colour and clay: DIR/colour.png, clay.png, review.json)\n raea render PAGE.html -o OUT.mp4|DIR [--at A,B] (an HTML composition)\n raea render --bundle NAME.comp.js -o OUT.png|DIR [--dir DIR] [--frame N] (a bundle from raea bundle, as render_bundle draws it)
raea media probe|still|sheet|audio|loudness|motion|cuts|freezes|proxy|trim|concat FILE ... | ffmpeg ARGS | ffprobe ARGS (media work, native: media help)
raea bundle EDIT.tsx --composition-bundle -o OUT.js [--portable DIR] (a composition for render_bundle, on the Mac or the iPhone)\n raea add PKG[@RANGE]... [--dev] | remove NAME... | install [--offline] [--in DIR] (npm packages for the project: raea.lock, node_modules)\n {} (foley, local)\n {} (an instrument's notes, local)\n raea setup-audio [--check] [sao|tokensynth] (install or check the local audio models)\n {} (the song's energy map: beats, sections, builds, drops, stops, hits, cuts per bar; also: --backend NAME)\n raea sounds [WORDS] | sounds get PACK/INSTRUMENT [--notes ..|--all] [-o DIR] (open sample libraries for a Sampler)\n {} (the clip's camera solved, for <Matchmove>)",
tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE
diff --git a/engine/cli/src/lib.rs b/engine/cli/src/lib.rs
index 4c66f3d2..e05c8caf 100644
--- a/engine/cli/src/lib.rs
+++ b/engine/cli/src/lib.rs
@@ -22,3 +22,23 @@ pub use cli::cli;
use guide::*;
use usage::*;
use verbs::*;
+
+/// The `raea` process after its allocator (main.rs, and a build that installs a signer first): its exit code.
+pub fn main() -> i32 {
+ raea_core_alloc::init();
+ raea_core_alloc::init_sites();
+ raea_runtime_react::startup_mark("main");
+ let args: Vec<String> = std::env::args().skip(1).collect();
+ match args.first().map(String::as_str) {
+ // `check VIDEO.mp4 …`: the floor's measurable lines on an export, ranked P0-P3
+ // (with --taste or --quick, through the engine, which evaluates the taste.ts files or renders stills: `check` here)
+ Some("check") if !args.iter().any(|a| a == "--taste" || a == "--quick") => raea_app_check::cli_with(&args[1..], Vec::new()),
+ // `ci …`: the gates' sound measurements and lightspeed's process measurements
+ Some("ci") => raea_app_ci::cli(&args[1..]),
+ _ => {
+ raea_runtime_react::CLI.get_or_init(|| cli);
+ raea_runtime_react::start();
+ cli(&args)
+ }
+ }
+}
diff --git a/engine/cli/src/main.rs b/engine/cli/src/main.rs
index 006703ce..113517c5 100644
--- a/engine/cli/src/main.rs
+++ b/engine/cli/src/main.rs
@@ -1,27 +1,10 @@
//! `raea render EDIT.tsx -o OUT.mp4|OUT.png|DIR|OUT.sql [--frame N | --at A,B]` and the rest of raea's command line
-//! (lib.rs), with the allocator every raea process counts with.
-use raea_runtime_react::{CLI, start, startup_mark};
+//! (lib.rs's `main`), with the allocator every raea process counts with.
/// ZeroHeap Z1: every allocation counted per thread while RAEA_ZEROHEAP=1 (one relaxed load more otherwise)
#[global_allocator]
static ALLOC: raea_core_alloc::Counting = raea_core_alloc::Counting;
fn main() {
- raea_core_alloc::init();
- raea_core_alloc::init_sites();
- startup_mark("main");
- let args: Vec<String> = std::env::args().skip(1).collect();
- let code = match args.first().map(String::as_str) {
- // `check VIDEO.mp4 …`: the floor's measurable lines on an export, ranked P0-P3
- // (with --taste or --quick, through the engine, which evaluates the taste.ts files or renders stills: raea_cli's `check`)
- Some("check") if !args.iter().any(|a| a == "--taste" || a == "--quick") => raea_app_check::cli_with(&args[1..], Vec::new()),
- // `ci …`: the gates' sound measurements and lightspeed's process measurements
- Some("ci") => raea_app_ci::cli(&args[1..]),
- _ => {
- CLI.get_or_init(|| raea_cli::cli);
- start();
- raea_cli::cli(&args)
- }
- };
- std::process::exit(code);
+ std::process::exit(raea_cli::main());
}
diff --git a/engine/cli/src/registry.gen.ts b/engine/cli/src/registry.gen.ts
index 8812cad0..9a59b3be 100644
--- a/engine/cli/src/registry.gen.ts
+++ b/engine/cli/src/registry.gen.ts
@@ -23,5 +23,5 @@ export const REGISTRY: Record<string, Record<string, string>> = {
};
export const TEMPLATE: Record<string, string> = {
"edit.tsx": "// The edit: a React composition rendered by raea (`raea render`). The clips come from cuts.ts (`raea cut` writes it),\n// the parts from components/ (`raea part add` copies them in; they're yours to change), the look from brand/brand.css.\n// Change anything here: layout, timing, what plays when. `raea check` renders it and says what's wrong.\nimport { AbsoluteFill, Composition, Series, Video, registerRoot } from \"raea\";\nimport { cuts, edit, frames, total } from \"./cuts\";\nimport { css } from \"./styles.gen\";\n\n// Before any cuts: a card saying what comes next, three seconds long. Its colours are its own on purpose, not a brand's\n// (`raea brand SITE` writes brand/brand.css); delete it once the edit has clips.\nfunction Start() {\n return (\n <AbsoluteFill style={{ background: \"#14120f\", color: \"#f2ede4\", justifyContent: \"center\", padding: \"0 8%\", fontFamily: \"Helvetica, Arial, sans-serif\" }}>\n <div style={{ fontSize: edit.width * 0.11, fontWeight: 700, letterSpacing: \"-0.02em\" }}>raea</div>\n <div style={{ fontSize: edit.width * 0.04, marginTop: edit.width * 0.03, lineHeight: 1.4, opacity: 0.8 }}>\n No clips yet. Run raea cut on a take to put its footage in cuts.ts, and this edit plays it.\n </div>\n </AbsoluteFill>\n );\n}\n\nfunction Edit() {\n if (cuts.length === 0) return <Start />;\n return (\n <AbsoluteFill className=\"bg-brand-bg\">\n <style>{css}</style>\n <Series>\n {cuts.map((c, i) => (\n <Series.Sequence key={i} durationInFrames={frames(c)}>\n {/* a talking take: <FaceFrame>; a screen recording: <ScreenFit> (`raea frame TAKE` says which) */}\n <Video src={c.src} startFrom={Math.round(c.from * edit.fps)} endAt={Math.round(c.to * edit.fps)} style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }} />\n </Series.Sequence>\n ))}\n </Series>\n </AbsoluteFill>\n );\n}\n\nregisterRoot(() => <Composition id=\"edit\" component={Edit} width={edit.width} height={edit.height} fps={edit.fps} durationInFrames={total || edit.fps * 3} />);\n",
- "theme.css": "/* The Tailwind theme every raea project compiles with: class names (text-brand-accent, bg-brand-surface, font-brand,\n text-caption, rounded-brand) mapped onto the brand kit's variables (brand/brand.css, the host app's --brand-* format).\n Nothing here is a colour, a font or a size of its own: change the brand, and every component follows. The kit's\n sizes are the website's, so on a 1080x1920 video they're scaled up (the kit's own note: about 2.5x). */\n@theme inline {\n --color-brand-accent: var(--brand-accent);\n --color-brand-bg: var(--brand-background);\n --color-brand-surface: var(--brand-background);\n --color-brand-on-surface: var(--brand-text);\n --color-brand-ink: var(--brand-background);\n --color-brand-on-accent: var(--brand-background);\n --color-brand-1: var(--brand-color-1);\n --color-brand-2: var(--brand-color-2);\n --color-brand-3: var(--brand-color-3);\n --font-brand: var(--brand-font-heading);\n --font-brand-body: var(--brand-font);\n --text-display: calc(var(--brand-h1-size) * 3);\n --text-title: calc(var(--brand-h2-size) * 2.5);\n --text-caption: calc(var(--brand-h2-size) * 2.5);\n --text-body: calc(var(--brand-p-size) * 2.5);\n --text-label: calc(var(--brand-h4-size) * 2.2);\n --radius-brand: var(--brand-radius);\n}\n"
+ "theme.css": "/* The Tailwind theme every raea project compiles with: class names (text-brand-accent, bg-brand-surface, font-brand,\n text-caption, rounded-brand) mapped onto the brand kit's variables (brand/brand.css, the --brand-* format).\n Nothing here is a colour, a font or a size of its own: change the brand, and every component follows. The kit's\n sizes are the website's, so on a 1080x1920 video they're scaled up (the kit's own note: about 2.5x). */\n@theme inline {\n --color-brand-accent: var(--brand-accent);\n --color-brand-bg: var(--brand-background);\n --color-brand-surface: var(--brand-background);\n --color-brand-on-surface: var(--brand-text);\n --color-brand-ink: var(--brand-background);\n --color-brand-on-accent: var(--brand-background);\n --color-brand-1: var(--brand-color-1);\n --color-brand-2: var(--brand-color-2);\n --color-brand-3: var(--brand-color-3);\n --font-brand: var(--brand-font-heading);\n --font-brand-body: var(--brand-font);\n --text-display: calc(var(--brand-h1-size) * 3);\n --text-title: calc(var(--brand-h2-size) * 2.5);\n --text-caption: calc(var(--brand-h2-size) * 2.5);\n --text-body: calc(var(--brand-p-size) * 2.5);\n --text-label: calc(var(--brand-h4-size) * 2.2);\n --radius-brand: var(--brand-radius);\n}\n"
};
diff --git a/engine/cli/src/tests.rs b/engine/cli/src/tests.rs
index f25314fd..14c11f29 100644
--- a/engine/cli/src/tests.rs
+++ b/engine/cli/src/tests.rs
@@ -32,7 +32,7 @@ fn help_lists_every_verb() {
let listed = |v: &str| [format!("raea {v} "), format!("raea {v}\n"), format!("| {v} ")].iter().any(|l| help.contains(l.as_str()));
let missing: Vec<_> = verbs.iter().filter(|v| !listed(v) && !unlisted.contains(&v.as_str())).collect();
assert!(missing.is_empty(), "not in raea help: {missing:?}");
- for usage in [raea_app_check::USAGE, raea_app_game::USAGE, raea_runtime_export::SCENE_USAGE, motion::physics::USAGE, tools::splat::USAGE, tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE] {
+ for usage in [raea_app_check::USAGE, raea_app_game::USAGE, raea_runtime_export::SCENE_USAGE, motion::physics::USAGE, tools::splat::USAGE, tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, tools::blender::USAGE] {
assert!(help.contains(usage), "{usage}");
}
}
@@ -72,7 +72,7 @@ fn a_verb_refuses_what_it_doesnt_take() {
&["traces", "show", "last"],
&["media", "ffmpeg", "-i", "x", "--anything"],
&["physics", "bake", "r.json", "--whatever"],
- &["test", "--filter", "x"],
+ &["test", "--filter", "x"], &["solid", "export", "b.ts", "-o", "b.glb", "--set", "w=1", "--part", "top", "--colour", "#8a6a4a"],
] {
assert_eq!(stray(&help, &a(ok)), None, "{ok:?}");
}
diff --git a/engine/cli/template/theme.css b/engine/cli/template/theme.css
index f4b01965..f534110e 100644
--- a/engine/cli/template/theme.css
+++ b/engine/cli/template/theme.css
@@ -1,5 +1,5 @@
/* The Tailwind theme every raea project compiles with: class names (text-brand-accent, bg-brand-surface, font-brand,
- text-caption, rounded-brand) mapped onto the brand kit's variables (brand/brand.css, the host app's --brand-* format).
+ text-caption, rounded-brand) mapped onto the brand kit's variables (brand/brand.css, the --brand-* format).
Nothing here is a colour, a font or a size of its own: change the brand, and every component follows. The kit's
sizes are the website's, so on a 1080x1920 video they're scaled up (the kit's own note: about 2.5x). */
@theme inline {
diff --git a/engine/modules/src/lib.rs b/engine/modules/src/lib.rs
index dc8215db..93832511 100644
--- a/engine/modules/src/lib.rs
+++ b/engine/modules/src/lib.rs
@@ -50,7 +50,7 @@ pub struct Module {
}
/// Why an import or a load can't be done: the sentence for the agent, and the parts the engine turns into an action
-/// row (an agent session, 2026-10-16): what kind of refusal, the import as written, and the module that made it.
+/// row (2026-10-16): what kind of refusal, the import as written, and the module that made it.
#[derive(Clone, Debug, PartialEq)]
pub struct Refusal {
pub message: String,
diff --git a/engine/native/Cargo.toml b/engine/native/Cargo.toml
index f4e04eb3..7004e2c8 100644
--- a/engine/native/Cargo.toml
+++ b/engine/native/Cargo.toml
@@ -3,7 +3,7 @@ name = "raea-native"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
-description = "raea's one native-call layer: the registry every host links (raea, the sandbox, HostCore), the TypeScript types made from it, and the web shims bundles expect on JavaScriptCore"
+description = "raea's one native-call layer: the registry every host links (raea, the sandbox, the host app), the TypeScript types made from it, and the web shims bundles expect on JavaScriptCore"
[lib]
name = "raea_native"
diff --git a/engine/native/src/lib.rs b/engine/native/src/lib.rs
index c98feca9..221f7e8f 100644
--- a/engine/native/src/lib.rs
+++ b/engine/native/src/lib.rs
@@ -1,5 +1,5 @@
//! raea's one native-call layer. TypeScript running on JavaScriptCore (raea render, run and test, the iPhone
-//! probes, HostCore's composition scripts) reaches Rust through one function, `__raea_call(name, json) -> json`; every
+//! probes, the host app's composition scripts) reaches Rust through one function, `__raea_call(name, json) -> json`; every
//! name it can call is registered here once, with the TypeScript types of its arguments and answer, by whichever crate
//! implements it (raea-runtime-react's solids, worlds and coders; the sandbox's commands; the web shims' own calls below). A
//! host links the crates it wants and calls their `register()`; `typescript()` writes the types the SDK imports, so a
diff --git a/engine/neural/Cargo.toml b/engine/neural/Cargo.toml
index ce899978..5e4ac590 100644
--- a/engine/neural/Cargo.toml
+++ b/engine/neural/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
-description = "raea neural: DLSS 5 neural rendering on a `render --aov` folder through the founder's own MLX-DLSS (docs/raytracing.feature RT2)"
+description = "raea neural: DLSS 5 neural rendering on a `render --aov` folder through the user's own MLX-DLSS (docs/raytracing.feature RT2)"
[dependencies]
image = { version = "0.25", default-features = false, features = ["png"] }
diff --git a/engine/neural/src/lib.rs b/engine/neural/src/lib.rs
index bad830ba..fe091651 100644
--- a/engine/neural/src/lib.rs
+++ b/engine/neural/src/lib.rs
@@ -1,6 +1,6 @@
//! `raea neural mlxdlss DIR -o OUT` (docs/raytracing.feature RT2): DLSS 5's neural rendering on a render, on the Mac,
//! through MLX-DLSS (github.com/iamwavecut/MLX-DLSS, Apache-2.0), fed raea's own motion vectors and depth (`render
-//! --aov`). An optional integration: the mlxdlss binary and the weights are the founder's (the weights are NVIDIA's,
+//! --aov`). An optional integration: the mlxdlss binary and the weights are the user's (the weights are NVIDIA's,
//! extracted from their own DLSS install, and never ship with raea).
use std::path::{Path, PathBuf};
diff --git a/engine/page/src/html.rs b/engine/page/src/html.rs
index 7a938298..1749658a 100644
--- a/engine/page/src/html.rs
+++ b/engine/page/src/html.rs
@@ -1,4 +1,4 @@
-//! HTML compositions on the Blitz page (docs/blitz-bevy.feature B5d (1)): a the HTML composition format-format page (HTML, CSS, GSAP
+//! HTML compositions on the Blitz page (docs/blitz-bevy.feature B5d (1)): an HTML composition page (HTML, CSS, GSAP
//! and its own scripts) mounted by the host (host.rs) with @raea/ui's HTML runtime (sdk/ui/src/html.ts, raea-runtime-js's
//! html_page::bundle), so the page's scripts work on a DOM whose elements are a Blitz document's, which stylo styles,
//! Taffy lays out and Vello paints as Chrome would. The same open, seek and frame as raea-runtime-js's HtmlPage (bevy_ui),
diff --git a/engine/render/Cargo.toml b/engine/render/Cargo.toml
index 033587f8..b0423133 100644
--- a/engine/render/Cargo.toml
+++ b/engine/render/Cargo.toml
@@ -20,6 +20,8 @@ image = { version = "0.25", default-features = false, features = ["png", "jpeg",
raea-core-program = { path = "../../core/program" }
# worn surfaces on a mesh row (`wear`)
raea-sys-wear = { path = "../../systems/wear" }
+# procedural surfaces on a mesh row (`proc`)
+raea-sys-procmat = { path = "../../systems/procmat" }
raea-core-shape = { path = "../../core/shape" }
# text in the 3D world (<RichText>): each glyph a lit, shaded entity
raea-sys-text3d = { path = "../../systems/text3d" }
diff --git a/engine/render/src/engine/load.rs b/engine/render/src/engine/load.rs
index 9a96ea23..06f925a7 100644
--- a/engine/render/src/engine/load.rs
+++ b/engine/render/src/engine/load.rs
@@ -119,7 +119,7 @@ impl Engine {
world.remove_non_send::<Rows2d>();
}
let base = store::gather(world);
- let ix: HashMap<Entity, usize> = store::rows(world).iter().enumerate().map(|(r, &e)| (e, r)).collect();
+ let ix: bevy::ecs::entity::EntityHashMap<usize> = store::rows(world).iter().enumerate().map(|(r, &e)| (e, r)).collect();
let media = inserted.iter().filter(|t| t.kind == "media").cloned().collect();
let timeline = match timeline {
Some(t) => t,
diff --git a/engine/render/src/engine/raea_plugins.rs b/engine/render/src/engine/raea_plugins.rs
index ea54b004..3d42e51e 100644
--- a/engine/render/src/engine/raea_plugins.rs
+++ b/engine/render/src/engine/raea_plugins.rs
@@ -57,6 +57,7 @@ raea_plugin! {
ScreenPlugin: super::screen::install, "Live pictures on surfaces, drawn as CRTs (screen.rs).";
GridPlugin: super::grid::install, "Greybox surfaces: graph paper and outlines (grid.rs).";
WearPlugin: raea_sys_wear::install, "Worn surfaces: chipped paint, grime and rust (systems/wear).";
+ ProcMatPlugin: raea_sys_procmat::install, "Procedural surfaces: wood, stone, brick, tiles and the rest, with dust and dirt (systems/procmat).";
PaintPlugin: super::paint::install, "The paint and cartoon looks' surfaces (paint.rs).";
PassesPlugin: super::passes::install, "Render passes per view (passes.rs).";
TracedAoPlugin: super::traced_ao::install, "Traced ambient occlusion (raea-sys-rt's traced_ao.rs).";
@@ -111,7 +112,9 @@ pub fn scene3d_systems() -> ScheduleConfigs<ScheduleSystem> {
super::scene3d::instance_models,
super::scene3d::model_shadow_markers,
super::scene3d::toon_models,
- ((super::scene3d::sync_meshes, super::scene3d::sync_pictures, super::shader_ext::sync_shaded, raea_sys_sampler::arrays::sync_arrays, raea_sys_sampler::sync_samplers).chain(), super::toon::sync_toon, super::scene3d::sync_camera, super::motion_blur::sync_motion_blur, super::environment::sync_environment, super::scene3d::sync_lights, super::scene3d::sync_fog_volumes, super::scene3d::sync_fog_dither, super::scene3d::sync_models, super::scene3d::sync_morphs, super::scene3d::sync_attach, super::grid::grid_models, super::scene3d::sync_bones, super::look::sync_frame_look, super::look::sync_looks, super::compose::sync_passes, super::look::sync_flat, super::paint::sync_paint, super::decal::sync_decals, super::text3d::sync_texts).chain(),
+ ((super::scene3d::sync_meshes, super::scene3d::sync_pictures, super::shader_ext::sync_shaded, raea_sys_sampler::arrays::sync_arrays, raea_sys_sampler::sync_samplers).chain(), super::toon::sync_toon, super::scene3d::sync_camera, super::motion_blur::sync_motion_blur, (super::environment::sync_environment, super::environment::sync_prefiltered).chain(), super::scene3d::sync_lights, super::scene3d::sync_fog_volumes, super::scene3d::sync_fog_dither, super::scene3d::sync_models, super::scene3d::sync_morphs, super::scene3d::sync_attach, super::grid::grid_models, super::scene3d::sync_bones, super::look::sync_frame_look, super::look::sync_looks, super::compose::sync_passes, super::look::sync_flat, super::paint::sync_paint, super::decal::sync_decals, super::text3d::sync_texts).chain(),
+ // --clay and --review's clay half: every standard surface grey, after the rows set their colours
+ super::scene3d::clay::clay_materials,
)
.chain()
}
diff --git a/engine/render/src/engine/spawn.rs b/engine/render/src/engine/spawn.rs
index 3143ffec..14a7b641 100644
--- a/engine/render/src/engine/spawn.rs
+++ b/engine/render/src/engine/spawn.rs
@@ -163,7 +163,7 @@ pub fn remove_rows_from(world: &mut World, rows: &[(String, String)]) {
}
if any {
// the rows after a dropped one moved up: their places again, from the store's order
- let ix: HashMap<Entity, usize> = store::rows(world).iter().enumerate().map(|(r, &e)| (e, r)).collect();
+ let ix: bevy::ecs::entity::EntityHashMap<usize> = store::rows(world).iter().enumerate().map(|(r, &e)| (e, r)).collect();
world.resource_mut::<FrameRows>().ix = ix;
}
}
@@ -241,7 +241,7 @@ pub(crate) fn spawn_3d(world: &mut World, e: Entity, t: &Tup, inserted: &[Tup],
// tangents too, made from them (mikktspace); so does a grid's outline (grid.rs)
let grid = grid::grid_of(vals);
let uvs = scene3d::has_maps(vals) || grid.is_some();
- let tangents = vals.get("normal_map").is_some_and(V::truthy);
+ let tangents = raea_sys_material::maps::needs_tangents(vals);
// made once per shape and what it's given (share.rs): equal parts hold one Mesh, so Bevy batches them
let mesh = scene3d::shared_mesh(world, &format!("{expr}\0{uvs}\0{tangents}"), || raea_sys_material::mesh::shape_mesh(&t.id, &expr, uvs, tangents))?;
// a three.js shader (raea-sys-three-shader, docs/r3f.feature R3F11): its own material, and the mesh given
@@ -278,12 +278,15 @@ pub(crate) fn spawn_3d(world: &mut World, e: Entity, t: &Tup, inserted: &[Tup],
} else if let Some(extension) = grid {
// graph paper over it (grid.rs): its colours fixed, so it isn't re-tinted frame by frame
grid::put(world, e, mesh, grid::GridMaterial { base: mat, extension }, vals);
- } else if let Some(extension) = raea_sys_wear::of(vals) {
+ } else if let Some(extension) = raea_sys_procmat::of(vals).filter(|_| !scene3d::clay::on()) {
+ // a procedural surface (systems/procmat): its pattern, bump and use made on the GPU; clay draws it plain
+ grid::put(world, e, mesh, raea_sys_procmat::ProcMaterial { base: mat, extension }, vals);
+ } else if let Some(extension) = raea_sys_wear::of(vals).filter(|_| !scene3d::clay::on()) {
// worn paint (systems/wear): chipped edges, grime and rust, fixed in the part's own space
grid::put(world, e, mesh, raea_sys_wear::WearMaterial { base: mat, extension }, vals);
- } else if vals.get("shader").is_none() && !vals.contains_key("opacity") {
- // a plain surface: one material per value, shared by the parts that have it (share.rs; a see-through
- // one keeps its own, as froxel_glass copies it per standard material)
+ } else if vals.get("shader").is_none() {
+ // a plain surface, see-through too: one material per value, shared by the parts that have it (share.rs;
+ // froxel_glass's fog copy is per material, so equal panes share it; mesh_ray_cast's six walls are one)
let (mat, shared) = scene3d::shared_material(world, mat);
world.entity_mut(e).insert((Mesh3d(mesh), MeshMaterial3d(mat), transform_of(vals)));
if shared {
@@ -317,7 +320,14 @@ pub(crate) fn spawn_3d(world: &mut World, e: Entity, t: &Tup, inserted: &[Tup],
let image = world.resource_mut::<Assets<Image>>().add(sprite2d::sprite_image(pw, ph, pic.into_raw()));
sprite2d::spawn_sprite(world, e, t, image, UVec2::new(pw, ph));
}
- "shape2d" => sprite2d::spawn_shape(world, e, t),
+ "shape2d" => {
+ // its ColorMaterial's texture, found and decoded as a sprite's picture
+ let tex = match vals.get("texture") {
+ Some(V::S(s)) => { let pic = scene3d::panel_picture(s, inserted, dir).map_err(|e| format!("shape2d {}: {e}", t.id))?; let (pw, ph) = pic.dimensions(); Some(world.resource_mut::<Assets<Image>>().add(sprite2d::sprite_image(pw, ph, pic.into_raw()))) }
+ _ => None,
+ };
+ sprite2d::spawn_shape(world, e, t, tex)
+ }
// a live picture on a quad (<Screen>): screen.rs
"panel" if vals.contains_key("screen") => screen::spawn_panel(world, e, t)?,
// a screen's picture over a run of frames (raea's bevy_ui page): screen_page.rs
diff --git a/engine/rune/Cargo.toml b/engine/rune/Cargo.toml
index d1567293..fe33ceaa 100644
--- a/engine/rune/Cargo.toml
+++ b/engine/rune/Cargo.toml
@@ -9,21 +9,26 @@ description = "The native target's host (docs/targets.feature): raea's op wire d
[dependencies]
rune.workspace = true
raea-core-wire = { path = "../../core/wire" }
-# the net.* host calls, answered as the web target answers them (docs/targets.feature T2a)
-raea-io-net-calls = { path = "../../io/net/calls" }
-# os.open, the clipboard, files and dialogs, answered as the web target answers them (docs/targets.feature T2d)
+# the app's JS against its page (js/: the engine, the host calls)
+raea-rune-js = { path = "js" }
+# the check's scripted system calls (script.rs), headless (T2d)
raea-io-os = { path = "../../io/os" }
-raea-runtime-jsengine = { path = "../../runtime/jsengine" }
raea-rune-page = { path = "page" }
raea-rune-media = { path = "media" }
raea-rune-look = { path = "look" }
+# the app drawn by Bevy (docs/targets.feature T6c): a Bevy window with the tree as a layer on its device (on_bevy/window.rs),
+# and the check's frames drawn through it (on_bevy/shot.rs). Off by default until T6c passes
+raea-rune-bevy = { path = "bevy", optional = true }
+bevy = { version = "=0.20.0", default-features = false, features = ["std", "async_executor", "bevy_log", "bevy_window", "bevy_winit", "bevy_asset", "bevy_image", "bevy_render", "bevy_core_pipeline", "ui_bevy_render"], optional = true }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
png = "0.18"
[features]
+# Rune over Bevy (T6c): `run app.js --draw bevy` and `--headless app.js --draw bevy`
+bevy = ["dep:raea-rune-bevy", "dep:bevy"]
# QuickJS beside JavaScriptCore on a Mac (BEVY_TSX_ENGINE=quickjs picks it): the portable engine tested here
-portable = ["raea-runtime-jsengine/portable"]
+portable = ["raea-rune-js/portable"]
[dev-dependencies]
# the tests bundle their apps as raea does (runtime/bundle/lib app.rs), with nothing of Bevy in their tree
diff --git a/engine/rune/bevy/.gitignore b/engine/rune/bevy/.gitignore
new file mode 100644
index 00000000..90de6fc9
--- /dev/null
+++ b/engine/rune/bevy/.gitignore
@@ -0,0 +1,2 @@
+target/
+out/
diff --git a/engine/rune/bevy/Cargo.toml b/engine/rune/bevy/Cargo.toml
new file mode 100644
index 00000000..d4a8456b
--- /dev/null
+++ b/engine/rune/bevy/Cargo.toml
@@ -0,0 +1,17 @@
+# A Rune tree drawn into a Bevy Image on Bevy's own device (docs/targets.feature T6c-e, from T6b's spike). Bevy 0.20.0
+# and wgpu 30.0.1 as the rest of raea has them: one wgpu for Rune and Bevy (R0b, tools/one-version.sh).
+[package]
+name = "raea-rune-bevy"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "A Rune tree as a Bevy layer: drawn into a Bevy Image on Bevy's device with no copy, pointer and keys forwarded to it"
+
+[dependencies]
+rune.workspace = true
+bevy = { version = "=0.20.0", default-features = false, features = ["std", "async_executor", "bevy_window", "bevy_asset", "bevy_image", "bevy_render", "bevy_core_pipeline"] }
+wgpu = "=30.0.1"
+
+[dev-dependencies]
+bevy = { version = "=0.20.0", default-features = false, features = ["std", "async_executor", "bevy_window", "bevy_asset", "bevy_image", "bevy_render", "bevy_core_pipeline", "bevy_pbr", "bevy_camera"] }
diff --git a/engine/rune/bevy/src/input.rs b/engine/rune/bevy/src/input.rs
new file mode 100644
index 00000000..9228dadc
--- /dev/null
+++ b/engine/rune/bevy/src/input.rs
@@ -0,0 +1,133 @@
+//! Input to a layer's tree. [`Input`] is what any caller sends (`AnyTree::input`): a game forwarding a HUD's clicks, a
+//! check's script. A layer with [`RuneOverlay`] fills a window: its viewport follows the window's logical size and
+//! scale, and the window's pointer, wheel and keys reach it as Rune's own shell sends them (keys.rs maps Bevy's keys).
+
+use bevy::input::ButtonState;
+use bevy::input::keyboard::KeyboardInput;
+use bevy::input::mouse::{MouseButtonInput, MouseScrollUnit, MouseWheel};
+use bevy::prelude::*;
+use bevy::window::{CursorLeft, CursorMoved, PrimaryWindow};
+use std::collections::HashMap;
+use rune::{KeyEvent, Runtime};
+
+use crate::{RuneLayer, Trees};
+
+/// Pointer, wheel and keys, in the tree's points.
+#[derive(Clone, Debug)]
+pub enum Input {
+ Move(f32, f32),
+ Down(f32, f32),
+ Up(f32, f32),
+ /// the secondary (right) button
+ SecondaryDown(f32, f32),
+ SecondaryUp(f32, f32),
+ Leave,
+ /// a wheel at a point: `dy` points, positive moves the content down (Rune's `wheel`)
+ Wheel(f32, f32, f32),
+ Key(KeyEvent),
+ KeyUp(KeyEvent),
+}
+
+/// One input into `rt`, through Rune's own pointer and key paths (hit-testing, focus, text editing, on_key).
+pub fn apply<S>(rt: &mut Runtime<S>, ev: Input) {
+ match ev {
+ Input::Move(x, y) => rt.pointer_move(x, y),
+ Input::Down(x, y) => rt.pointer_down(x, y),
+ Input::Up(x, y) => rt.pointer_up(x, y),
+ Input::SecondaryDown(x, y) => rt.secondary_down(x, y),
+ Input::SecondaryUp(x, y) => rt.secondary_up(x, y),
+ Input::Leave => rt.pointer_leave(),
+ Input::Wheel(x, y, dy) => rt.wheel(x, y, dy),
+ Input::Key(k) => rt.key(k),
+ Input::KeyUp(k) => {
+ rt.key_up(k);
+ }
+ }
+}
+
+/// A layer that fills `window` (the primary window when none): sized to it and given its input.
+#[derive(Component, Clone, Copy, Default)]
+pub struct RuneOverlay {
+ pub window: Option<Entity>,
+}
+
+
+/// PostUpdate, before the draw: each overlay's tree at its window's logical size and scale.
+pub(crate) fn overlay_size(overlays: Query<(Entity, &RuneOverlay), With<RuneLayer>>, windows: Query<&Window>, primary: Query<Entity, With<PrimaryWindow>>, mut trees: NonSendMut<Trees>) {
+ let primary = primary.iter().next();
+ for (e, o) in &overlays {
+ let Some(w) = o.window.or(primary).and_then(|w| windows.get(w).ok()) else { continue };
+ let (size, scale) = ((w.resolution.width(), w.resolution.height()), w.resolution.scale_factor());
+ if let Some(t) = trees.0.get_mut(&e)
+ && t.viewport() != (size, scale)
+ {
+ t.resize(size, scale);
+ }
+ }
+}
+
+/// PreUpdate: the windows' pointer, wheel and keys to the overlays that fill them.
+#[allow(clippy::too_many_arguments)]
+pub(crate) fn forward(
+ overlays: Query<(Entity, &RuneOverlay), With<RuneLayer>>,
+ primary: Query<Entity, With<PrimaryWindow>>,
+ windows: Query<&Window>,
+ mut moved: MessageReader<CursorMoved>,
+ mut left: MessageReader<CursorLeft>,
+ mut buttons: MessageReader<MouseButtonInput>,
+ mut wheels: MessageReader<MouseWheel>,
+ mut keys: MessageReader<KeyboardInput>,
+ held: Res<ButtonInput<KeyCode>>,
+ mut trees: NonSendMut<Trees>,
+ mut at: Local<HashMap<Entity, Vec2>>,
+) {
+ let primary = primary.iter().next();
+ let targets: Vec<(Entity, Entity)> = overlays.iter().filter_map(|(e, o)| Some((e, o.window.or(primary)?))).collect();
+ let trace = std::env::var_os("RAEA_RUNE_BEVY_TRACE").is_some();
+ let mut send = |window: Entity, ev: Input| {
+ if trace {
+ eprintln!("raea-rune-bevy: {window} {ev:?}");
+ }
+ for (e, _) in targets.iter().filter(|(_, w)| *w == window) {
+ if let Some(t) = trees.0.get_mut(e) {
+ t.input(ev.clone());
+ }
+ }
+ };
+ for m in moved.read() {
+ at.insert(m.window, m.position);
+ send(m.window, Input::Move(m.position.x, m.position.y));
+ }
+ for m in left.read() {
+ at.remove(&m.window);
+ send(m.window, Input::Leave);
+ }
+ // where the pointer last moved to in the window (CursorMoved's logical points), else where the window says it is
+ let cursor = |w: Entity| at.get(&w).copied().or_else(|| windows.get(w).ok().and_then(Window::cursor_position));
+ for b in buttons.read() {
+ let Some(p) = cursor(b.window) else { continue };
+ let ev = match (b.button, b.state) {
+ (MouseButton::Left, ButtonState::Pressed) => Input::Down(p.x, p.y),
+ (MouseButton::Left, ButtonState::Released) => Input::Up(p.x, p.y),
+ (MouseButton::Right, ButtonState::Pressed) => Input::SecondaryDown(p.x, p.y),
+ (MouseButton::Right, ButtonState::Released) => Input::SecondaryUp(p.x, p.y),
+ _ => continue,
+ };
+ send(b.window, ev);
+ }
+ for w in wheels.read() {
+ let Some(p) = cursor(w.window) else { continue };
+ let scale = windows.get(w.window).map_or(1.0, |w| w.resolution.scale_factor());
+ // as Rune's shell reads winit's deltas (runtime/scroll/x.rs): a line is 40 points, pixels are physical
+ let dy = match w.unit {
+ MouseScrollUnit::Line => w.y * 40.0,
+ MouseScrollUnit::Pixel => w.y / scale,
+ };
+ send(w.window, Input::Wheel(p.x, p.y, dy));
+ }
+ let mods = crate::keys::mods(&held);
+ for k in keys.read() {
+ let Some(ev) = crate::keys::event(k, mods) else { continue };
+ send(k.window, if k.state == ButtonState::Pressed { Input::Key(ev) } else { Input::KeyUp(ev) });
+ }
+}
diff --git a/engine/rune/bevy/src/keys.rs b/engine/rune/bevy/src/keys.rs
new file mode 100644
index 00000000..1785eb05
--- /dev/null
+++ b/engine/rune/bevy/src/keys.rs
@@ -0,0 +1,77 @@
+//! Bevy's keys as Rune's: a `KeyboardInput` (winit's logical key and the text it typed) as the `KeyEvent` Rune's own
+//! shell would have made of the same winit event. Cmd is Command on macOS and Control elsewhere, as Rune has it.
+
+use bevy::input::keyboard::{Key as BKey, KeyboardInput};
+use bevy::prelude::*;
+use rune::{Key, KeyEvent, Mods};
+
+/// The modifiers held.
+pub fn mods(held: &ButtonInput<KeyCode>) -> Mods {
+ let any = |a: KeyCode, b: KeyCode| held.pressed(a) || held.pressed(b);
+ let logo = any(KeyCode::SuperLeft, KeyCode::SuperRight);
+ let ctrl = any(KeyCode::ControlLeft, KeyCode::ControlRight);
+ Mods { shift: any(KeyCode::ShiftLeft, KeyCode::ShiftRight), cmd: if cfg!(target_os = "macos") { logo } else { ctrl }, alt: any(KeyCode::AltLeft, KeyCode::AltRight), ctrl, logo }
+}
+
+/// `k` as Rune's key event, or none for a key Rune has no name for.
+pub fn event(k: &KeyboardInput, mods: Mods) -> Option<KeyEvent> {
+ let key = match &k.logical_key {
+ BKey::Enter => Key::Enter,
+ BKey::Backspace => Key::Backspace,
+ BKey::Delete => Key::Delete,
+ BKey::ArrowLeft => Key::Left,
+ BKey::ArrowRight => Key::Right,
+ BKey::ArrowUp => Key::Up,
+ BKey::ArrowDown => Key::Down,
+ BKey::Home => Key::Home,
+ BKey::End => Key::End,
+ BKey::PageUp => Key::PageUp,
+ BKey::PageDown => Key::PageDown,
+ BKey::Insert => Key::Insert,
+ BKey::PrintScreen => Key::PrintScreen,
+ BKey::ScrollLock => Key::ScrollLock,
+ BKey::Pause => Key::Pause,
+ BKey::Escape => Key::Escape,
+ BKey::Tab => Key::Tab,
+ BKey::ContextMenu => Key::ContextMenu,
+ BKey::F1 => Key::Function(1),
+ BKey::F2 => Key::Function(2),
+ BKey::F3 => Key::Function(3),
+ BKey::F4 => Key::Function(4),
+ BKey::F5 => Key::Function(5),
+ BKey::F6 => Key::Function(6),
+ BKey::F7 => Key::Function(7),
+ BKey::F8 => Key::Function(8),
+ BKey::F9 => Key::Function(9),
+ BKey::F10 => Key::Function(10),
+ BKey::F11 => Key::Function(11),
+ BKey::F12 => Key::Function(12),
+ // Cmd-Space comes natively as Text(" ") with mods.cmd (rune's KeyEvent::is_command)
+ BKey::Space => Key::Text(" ".into()),
+ BKey::Character(c) => {
+ let ch = c.chars().next()?;
+ if mods.cmd { Key::Command(ch.to_ascii_lowercase()) } else { Key::Text(k.text.as_deref().unwrap_or(c).to_string()) }
+ }
+ _ => return None,
+ };
+ Some(KeyEvent { key, mods })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn press(key: BKey, text: Option<&str>) -> KeyboardInput {
+ KeyboardInput { key_code: KeyCode::KeyA, logical_key: key, state: bevy::input::ButtonState::Pressed, text: text.map(Into::into), repeat: false, window: Entity::PLACEHOLDER }
+ }
+
+ #[test]
+ fn text_named_and_command_keys() {
+ let none = Mods::default();
+ assert_eq!(event(&press(BKey::Character("a".into()), Some("a")), none).unwrap().key, Key::Text("a".into()));
+ assert_eq!(event(&press(BKey::ArrowLeft, None), none).unwrap().key, Key::Left);
+ let cmd = Mods { cmd: true, ..none };
+ assert_eq!(event(&press(BKey::Character("C".into()), Some("C")), cmd).unwrap().key, Key::Command('c'));
+ assert!(event(&press(BKey::Shift, None), none).is_none());
+ }
+}
diff --git a/engine/rune/bevy/src/lib.rs b/engine/rune/bevy/src/lib.rs
new file mode 100644
index 00000000..ae32e72e
--- /dev/null
+++ b/engine/rune/bevy/src/lib.rs
@@ -0,0 +1,163 @@
+//! raea-rune-bevy: a Rune tree as a Bevy layer (docs/targets.feature T6c-e; T6b's spike, projects/rune
+//! spikes/rune-in-bevy). Bevy owns the window, the device and the frame; a Rune tree is an Image in it.
+//!
+//! - A layer is an entity with a [`RuneLayer`]: the Image it draws into and the colour it clears to. Its tree (a Rune
+//! `Runtime`, which isn't `Send`) lives in [`Trees`], a non-send resource, under the entity (`World::insert_rune`).
+//! - Each frame, in `PostUpdate`, every tree runs a frame (its poll, its view if state changed, its springs) and its
+//! `Renderer`, made on Bevy's `RenderDevice`, draws it straight into the Image's GpuImage view and submits on Bevy's
+//! `RenderQueue`. The render world then samples it: the same queue orders the two, so a frame shows what Rune drew
+//! in that frame. No copy, no second device.
+//! - The render world publishes each layer's view after it prepares the Image ([`Views`]); a layer's first frame,
+//! before its Image is on the GPU, draws nothing.
+//! - It needs Bevy's pipelined rendering off (raea's engine runs without it): with a render thread the render world
+//! would sample the Image while the next frame draws into it. The plugin refuses an app that has it.
+//! - Anything can show the Image: a UI `ImageNode` over a camera (a native app's window, a game's HUD), a 3D material,
+//! a render's encoder. Input reaches a tree through [`input`]: an overlay's from the window, or any `Input` sent.
+
+pub mod input;
+pub mod keys;
+pub mod readback;
+mod tree;
+
+pub use input::{Input, RuneOverlay};
+pub use tree::{AnyTree, Tree, draw as draw_runtime};
+
+use std::collections::HashMap;
+use std::sync::{Arc, Mutex};
+
+use bevy::asset::RenderAssetUsages;
+use bevy::prelude::*;
+use bevy::render::render_asset::RenderAssets;
+use bevy::render::render_resource::{TextureFormat, TextureUsages};
+use bevy::render::renderer::{RenderDevice, RenderQueue};
+use bevy::render::texture::GpuImage;
+use bevy::render::{Render, RenderApp, RenderSystems};
+
+/// The format a layer's Image has, and its tree's Renderer draws: sRGB RGBA8, premultiplied (Rune's own offscreen one).
+pub const FORMAT: TextureFormat = TextureFormat::Rgba8UnormSrgb;
+
+/// A Rune tree drawn into `image` each frame. Its tree is in [`Trees`] under this entity.
+#[derive(Component, Clone)]
+pub struct RuneLayer {
+ pub image: Handle<Image>,
+ /// what the Image holds where the tree paints nothing (premultiplied linear RGBA); transparent by default
+ pub clear: [f32; 4],
+ /// a fixed step a frame in seconds (a render's or a check's virtual clock); none: Bevy's `Time` delta
+ pub step: Option<f64>,
+}
+
+/// The layers' trees, by entity (a non-send resource: Rune's Runtime isn't `Send`).
+#[derive(Default)]
+pub struct Trees(pub HashMap<Entity, Box<dyn AnyTree>>);
+
+/// Each layer's GpuImage view, as the render world prepared it, for the main world to draw into.
+#[derive(Resource, Clone, Default)]
+pub struct Views(Arc<Mutex<ViewMap>>);
+
+#[derive(Default)]
+struct ViewMap {
+ /// the Images the layers draw into, which the render world looks up
+ wanted: Vec<AssetId<Image>>,
+ views: HashMap<AssetId<Image>, wgpu::TextureView>,
+}
+
+impl Views {
+ fn get(&self, id: AssetId<Image>) -> Option<wgpu::TextureView> {
+ self.0.lock().ok()?.views.get(&id).cloned()
+ }
+}
+
+/// Rune layers in an App.
+pub struct RuneLayerPlugin;
+
+impl Plugin for RuneLayerPlugin {
+ fn build(&self, app: &mut App) {
+ assert!(
+ !app.is_plugin_added::<bevy::render::pipelined_rendering::PipelinedRenderingPlugin>(),
+ "raea-rune-bevy: RuneLayerPlugin needs Bevy's pipelined rendering off (DefaultPlugins.build().disable::<PipelinedRenderingPlugin>()): \
+ a render thread would sample a layer's Image while the next frame draws into it"
+ );
+ let views = Views::default();
+ app.init_non_send::<Trees>().insert_resource(views.clone()).add_systems(PreUpdate, input::forward.after(bevy::input::InputSystems)).add_systems(PostUpdate, (input::overlay_size, draw).chain());
+ if let Some(render) = app.get_sub_app_mut(RenderApp) {
+ render.insert_resource(views).add_systems(Render, publish.in_set(RenderSystems::PrepareAssets).after(bevy::render::render_asset::prepare_assets::<GpuImage>));
+ }
+ }
+}
+
+/// An Image a layer of `size` pixels draws into: a render target Bevy samples, on the GPU only.
+pub fn image(images: &mut Assets<Image>, (w, h): (u32, u32)) -> Handle<Image> {
+ let mut image = Image::new_target_texture(w.max(1), h.max(1), FORMAT, None);
+ image.texture_descriptor.usage |= TextureUsages::TEXTURE_BINDING | TextureUsages::COPY_SRC;
+ image.asset_usage = RenderAssetUsages::RENDER_WORLD;
+ images.add(image)
+}
+
+/// Spawning a layer: the entity with its [`RuneLayer`] and its tree in [`Trees`].
+pub trait SpawnRune {
+ /// `tree` drawn into a new Image of its size in pixels; the layer's entity, to show the Image or send it input
+ fn spawn_rune(&mut self, tree: impl AnyTree + 'static, clear: [f32; 4]) -> Entity;
+ /// `tree` as the tree of `entity`'s layer, in place of the one it had
+ fn insert_rune(&mut self, entity: Entity, tree: impl AnyTree + 'static);
+}
+
+impl SpawnRune for World {
+ fn spawn_rune(&mut self, tree: impl AnyTree + 'static, clear: [f32; 4]) -> Entity {
+ let handle = image(&mut self.resource_mut::<Assets<Image>>(), tree.pixels());
+ let e = self.spawn(RuneLayer { image: handle, clear, step: None }).id();
+ self.insert_rune(e, tree);
+ e
+ }
+
+ fn insert_rune(&mut self, entity: Entity, tree: impl AnyTree + 'static) {
+ self.non_send_mut::<Trees>().0.insert(entity, Box::new(tree));
+ }
+}
+
+/// PostUpdate: each layer's tree runs a frame and draws into its Image on Bevy's device and queue.
+fn draw(world: &mut World) {
+ let dt = world.resource::<Time>().delta_secs_f64();
+ let (Some(device), Some(queue)) = (world.get_resource::<RenderDevice>(), world.get_resource::<RenderQueue>()) else { return };
+ let (device, queue) = (device.wgpu_device().clone(), (**queue).clone());
+ let views = world.resource::<Views>().clone();
+ let mut layers: Vec<(Entity, RuneLayer)> = world.query::<(Entity, &RuneLayer)>().iter(world).map(|(e, l)| (e, l.clone())).collect();
+ layers.sort_by_key(|(e, _)| *e);
+ // a tree resized this frame (an overlay's window) gets an Image of its new size
+ for (e, layer) in &mut layers {
+ let px = world.non_send::<Trees>().0.get(e).map(|t| t.pixels());
+ let size = world.resource::<Assets<Image>>().get(&layer.image).map(|i| (i.width(), i.height()));
+ if let (Some(px), Some(size)) = (px, size)
+ && px != size
+ {
+ world.resource_mut::<Assets<Image>>().get_mut(&layer.image).expect("the layer's Image").resize(bevy::render::render_resource::Extent3d { width: px.0.max(1), height: px.1.max(1), depth_or_array_layers: 1 });
+ if let Ok(mut views) = views.0.lock() {
+ views.views.remove(&layer.image.id());
+ }
+ }
+ }
+ if let Ok(mut v) = views.0.lock() {
+ v.wanted = layers.iter().map(|(_, l)| l.image.id()).collect();
+ }
+ let mut trees = world.non_send_mut::<Trees>();
+ trees.0.retain(|e, _| layers.iter().any(|(l, _)| l == e));
+ for (e, layer) in &layers {
+ let Some(tree) = trees.0.get_mut(e) else { continue };
+ tree.step(layer.step.unwrap_or(dt));
+ if let Some(view) = views.get(layer.image.id()) {
+ tree.draw(&device, &queue, &view, layer.clear);
+ }
+ }
+}
+
+/// Render: the views of the Images the layers draw into, once they're on the GPU.
+fn publish(views: Res<Views>, images: Res<RenderAssets<GpuImage>>) {
+ let Ok(mut v) = views.0.lock() else { return };
+ let wanted = std::mem::take(&mut v.wanted);
+ for id in &wanted {
+ if let Some(gpu) = images.get(*id) {
+ v.views.insert(*id, (*gpu.texture_view).clone());
+ }
+ }
+ v.views.retain(|id, _| wanted.contains(id));
+ v.wanted = wanted;
+}
diff --git a/engine/rune/bevy/src/readback.rs b/engine/rune/bevy/src/readback.rs
new file mode 100644
index 00000000..1f9389d0
--- /dev/null
+++ b/engine/rune/bevy/src/readback.rs
@@ -0,0 +1,44 @@
+//! An Image read back to memory: for a check or a video's encoder, never for showing it (a layer is sampled where it
+//! is). Waits for the GPU's work on it.
+
+use bevy::prelude::*;
+use bevy::render::RenderApp;
+use bevy::render::render_asset::RenderAssets;
+use bevy::render::renderer::{RenderDevice, RenderQueue};
+use bevy::render::texture::GpuImage;
+
+/// `image`'s pixels, rows tight (RGBA8 as its format stores them), or none before it's on the GPU.
+pub fn read(app: &App, image: &Handle<Image>) -> Option<Vec<u8>> {
+ let rw = app.sub_app(RenderApp).world();
+ let gpu = rw.resource::<RenderAssets<GpuImage>>().get(image)?;
+ let (device, queue) = (rw.resource::<RenderDevice>().wgpu_device().clone(), (**rw.resource::<RenderQueue>()).clone());
+ let (w, h) = (gpu.texture.width(), gpu.texture.height());
+ let row = (w * 4).div_ceil(256) * 256;
+ let buf = device.create_buffer(&wgpu::BufferDescriptor { label: Some("raea-rune-bevy read"), size: (row * h) as u64, usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ, mapped_at_creation: false });
+ let mut enc = device.create_command_encoder(&Default::default());
+ enc.copy_texture_to_buffer(
+ gpu.texture.as_image_copy(),
+ wgpu::TexelCopyBufferInfo { buffer: &buf, layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(row), rows_per_image: Some(h) } },
+ wgpu::Extent3d { width: w, height: h, depth_or_array_layers: 1 },
+ );
+ queue.submit([enc.finish()]);
+ buf.slice(..).map_async(wgpu::MapMode::Read, |r| r.expect("map the readback"));
+ device.poll(wgpu::PollType::wait_indefinitely()).expect("poll the device");
+ let data = buf.slice(..).get_mapped_range().expect("the mapped readback");
+ let mut px = Vec::with_capacity((w * h * 4) as usize);
+ for y in 0..h as usize {
+ px.extend_from_slice(&data[y * row as usize..y * row as usize + (w * 4) as usize]);
+ }
+ Some(px)
+}
+
+/// The view of `image` on Bevy's device, for a host that draws its own Runtime into it (`draw_runtime`).
+pub fn view(app: &App, image: &Handle<Image>) -> Option<wgpu::TextureView> {
+ Some((*app.sub_app(RenderApp).world().resource::<RenderAssets<GpuImage>>().get(image)?.texture_view).clone())
+}
+
+/// Bevy's device and queue.
+pub fn device(app: &App) -> (wgpu::Device, wgpu::Queue) {
+ let rw = app.sub_app(RenderApp).world();
+ (rw.resource::<RenderDevice>().wgpu_device().clone(), (**rw.resource::<RenderQueue>()).clone())
+}
diff --git a/engine/rune/bevy/src/tree.rs b/engine/rune/bevy/src/tree.rs
new file mode 100644
index 00000000..7659f459
--- /dev/null
+++ b/engine/rune/bevy/src/tree.rs
@@ -0,0 +1,95 @@
+//! A layer's tree: a Rune `Runtime` of any state, its `Renderer` (made on the device it's first drawn with), and its
+//! viewport in points and scale. [`AnyTree`] is what the plugin calls, so layers of different states share [`Trees`].
+
+use rune::Runtime;
+use rune::render::Renderer;
+
+use crate::input::Input;
+
+/// What the plugin does with a layer's tree, whatever its state.
+pub trait AnyTree {
+ /// a frame `dt` seconds on: the tree's poll, its view if state changed, its springs and layout
+ fn step(&mut self, dt: f64);
+ /// the last frame drawn into `view` (a layer's Image, `pixels()` big) on `device` and `queue`, cleared to `clear`
+ fn draw(&mut self, device: &wgpu::Device, queue: &wgpu::Queue, view: &wgpu::TextureView, clear: [f32; 4]);
+ /// pointer, wheel or keys, in the tree's points
+ fn input(&mut self, ev: Input);
+ /// the viewport in points and its scale
+ fn viewport(&self) -> ((f32, f32), f32);
+ /// a new viewport (a window resized, a HUD laid out at another size)
+ fn resize(&mut self, viewport: (f32, f32), scale: f32);
+ /// the Image's size: the viewport times its scale, in whole pixels
+ fn pixels(&self) -> (u32, u32) {
+ let ((w, h), s) = self.viewport();
+ (((w * s).round() as u32).max(1), ((h * s).round() as u32).max(1))
+ }
+ /// the tree's state, for a caller that knows its type (`downcast_ref` on it)
+ fn state(&self) -> &dyn std::any::Any;
+ fn state_mut(&mut self) -> &mut dyn std::any::Any;
+}
+
+/// A Rune Runtime as a layer's tree.
+pub struct Tree<S: 'static> {
+ pub rt: Runtime<S>,
+ scale: f32,
+ renderer: Option<Renderer>,
+ /// run after each frame with the runtime (a host reading the frame's layout, a video's encoder)
+ pub after_frame: Option<Box<dyn FnMut(&mut Runtime<S>)>>,
+}
+
+impl<S: 'static> Tree<S> {
+ /// `rt` at `scale` pixels a point. Its viewport is the one it was made with.
+ pub fn new(mut rt: Runtime<S>, scale: f32) -> Tree<S> {
+ let viewport = rt.viewport;
+ rt.set_viewport(viewport, scale);
+ Tree { rt, scale, renderer: None, after_frame: None }
+ }
+}
+
+impl<S: 'static> AnyTree for Tree<S> {
+ fn step(&mut self, dt: f64) {
+ self.rt.frame(dt);
+ if let Some(f) = self.after_frame.as_mut() {
+ f(&mut self.rt);
+ }
+ }
+
+ fn draw(&mut self, device: &wgpu::Device, queue: &wgpu::Queue, view: &wgpu::TextureView, clear: [f32; 4]) {
+ let px = self.pixels();
+ draw(&mut self.renderer, &mut self.rt, device, queue, view, px, clear);
+ }
+
+ fn input(&mut self, ev: Input) {
+ crate::input::apply(&mut self.rt, ev);
+ }
+
+ fn viewport(&self) -> ((f32, f32), f32) {
+ (self.rt.viewport, self.scale)
+ }
+
+ fn resize(&mut self, viewport: (f32, f32), scale: f32) {
+ self.scale = scale;
+ self.rt.set_viewport(viewport, scale);
+ }
+
+ fn state(&self) -> &dyn std::any::Any {
+ &self.rt.state
+ }
+
+ fn state_mut(&mut self) -> &mut dyn std::any::Any {
+ &mut self.rt.state
+ }
+}
+
+/// `rt`'s last frame drawn into `view` (`px` big, in [`crate::FORMAT`]) on `device` and `queue`, cleared to `clear`, by
+/// `renderer` (made on `device` the first time): what a layer does each frame, for a host that keeps its own Runtime
+/// (raea-rune-host's headless check draws its session this way to show it draws as Rune's own renderer does).
+pub fn draw<S>(renderer: &mut Option<Renderer>, rt: &mut Runtime<S>, device: &wgpu::Device, queue: &wgpu::Queue, view: &wgpu::TextureView, px: (u32, u32), clear: [f32; 4]) {
+ let renderer = renderer.get_or_insert_with(|| Renderer::new(device, crate::FORMAT));
+ renderer.upload_images(device, queue, &mut rt.images);
+ renderer.prepare(device, queue, &mut rt.text.atlas, &rt.instances, px);
+ renderer.prepare_surfaces(device, queue, &rt.surfaces, px);
+ let mut enc = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: Some("raea-rune-bevy layer") });
+ renderer.draw(&mut enc, view, clear);
+ renderer.submit(queue, enc);
+}
diff --git a/engine/rune/bevy/tests/layer.rs b/engine/rune/bevy/tests/layer.rs
new file mode 100644
index 00000000..042119dc
--- /dev/null
+++ b/engine/rune/bevy/tests/layer.rs
@@ -0,0 +1,122 @@
+//! A Rune layer in a headless Bevy app: its Image holds, to the byte, what Rune's own offscreen renderer draws of the
+//! same tree at the same frame; a press sent to it reaches the tree's handler; and Bevy samples it in the frame it was
+//! drawn (a lit scene with the Image on a quad reads the layer's frame counter, not the last frame's).
+
+use bevy::prelude::*;
+use bevy::window::ExitCondition;
+use raea_rune_bevy::{Input, RuneLayer, RuneLayerPlugin, SpawnRune, Tree, Trees};
+use rune::{Cx, El, Env, Runtime, col, el, text};
+
+#[derive(Default)]
+struct State {
+ on: bool,
+ presses: u32,
+}
+
+fn view(s: &State, _: &mut Cx<State>) -> El {
+ let t = rune::tok::theme(true);
+ let knob = el().key("knob").size(18.0, 18.0).radius(9.0).fill(t.knob).absolute(if s.on { 18.0 } else { 2.0 }, 2.0);
+ let switch = el()
+ .key("switch")
+ .role("switch")
+ .label("Lights")
+ .checked(s.on)
+ .size(38.0, 22.0)
+ .radius(11.0)
+ .fill(if s.on { rune::tok::accent(0, true) } else { t.control_off })
+ .motion(rune::Spring::SNAPPY)
+ .on_press(|s: &mut State| {
+ s.on = !s.on;
+ s.presses += 1;
+ })
+ .child(knob);
+ col().w_full().h_full().center().gap(14.0).fill(t.bg).child(text(if s.on { "Lights on" } else { "Lights off" }).color(t.text)).child(switch)
+}
+
+const PT: (f32, f32) = (240.0, 160.0);
+const SCALE: f32 = 2.0;
+const CLEAR: [f32; 4] = [0.0, 0.0, 0.0, 0.0];
+const STEP: f64 = 1.0 / 60.0;
+
+fn runtime() -> Runtime<State> {
+ Runtime::new(State::default(), view, PT, Env::new(true, SCALE))
+}
+
+fn app() -> (App, Entity) {
+ let mut app = App::new();
+ app.add_plugins(
+ DefaultPlugins
+ .build() // no multi_threaded feature here, so no pipelined rendering to disable
+ .set(WindowPlugin { primary_window: None, exit_condition: ExitCondition::DontExit, close_when_requested: false, ..default() })
+ .set(bevy::render::RenderPlugin { synchronous_pipeline_compilation: true, ..default() }),
+ );
+ app.add_plugins(RuneLayerPlugin);
+ app.finish();
+ app.cleanup();
+ let e = app.world_mut().spawn_rune(Tree::new(runtime(), SCALE), CLEAR);
+ app.world_mut().get_mut::<RuneLayer>(e).unwrap().step = Some(STEP);
+ (app, e)
+}
+
+/// The layer's Image read back, rows tight.
+fn read(app: &App, e: Entity) -> Vec<u8> {
+ let handle = app.world().get::<RuneLayer>(e).unwrap().image.clone();
+ raea_rune_bevy::readback::read(app, &handle).expect("the layer's GpuImage")
+}
+
+/// The same tree, the same frames, drawn by Rune's own headless GPU and offscreen target.
+fn rune_own(frames: u32) -> Vec<u8> {
+ use rune::render::{Gpu, Offscreen, Renderer};
+ let mut tree = Tree::new(runtime(), SCALE);
+ for _ in 0..frames {
+ raea_rune_bevy::AnyTree::step(&mut tree, STEP);
+ }
+ let gpu = Gpu::headless();
+ let (w, h) = raea_rune_bevy::AnyTree::pixels(&tree);
+ let target = Offscreen::with_format(&gpu.device, w, h, raea_rune_bevy::FORMAT);
+ let mut renderer = Renderer::new(&gpu.device, raea_rune_bevy::FORMAT);
+ renderer.upload_images(&gpu.device, &gpu.queue, &mut tree.rt.images);
+ renderer.prepare(&gpu.device, &gpu.queue, &mut tree.rt.text.atlas, &tree.rt.instances, (w, h));
+ renderer.prepare_surfaces(&gpu.device, &gpu.queue, &tree.rt.surfaces, (w, h));
+ let mut enc = gpu.device.create_command_encoder(&Default::default());
+ renderer.draw(&mut enc, &target.view, CLEAR);
+ target.copy(&mut enc);
+ renderer.submit(&gpu.queue, enc);
+ target.read(&gpu.device)
+}
+
+#[test]
+fn layer_matches_runes_own_render_and_takes_a_press() {
+ let (mut app, e) = app();
+ // the first update puts the Image on the GPU; the layer draws from the second
+ for _ in 0..12 {
+ app.update();
+ }
+ let ours = read(&app, e);
+ let own = rune_own(12);
+ assert_eq!(ours.len(), (PT.0 * SCALE * PT.1 * SCALE * 4.0) as usize);
+ assert!(ours.chunks(4).any(|p| p[3] > 0), "the layer drew nothing");
+ let diff = ours.iter().zip(&own).filter(|(a, b)| a != b).count();
+ assert_eq!(diff, 0, "{diff} bytes differ from Rune's own render of the same frame");
+
+ // a press on the switch's centre, where Rune laid it out: the layer's points, as a window's overlay sends them
+ let switch = {
+ let mut probe = runtime();
+ probe.frame(0.0);
+ probe.find("switch").expect("the switch laid out")
+ };
+ {
+ let mut trees = app.world_mut().non_send_mut::<Trees>();
+ let t = trees.0.get_mut(&e).unwrap();
+ t.input(Input::Move(switch.0, switch.1));
+ t.input(Input::Down(switch.0, switch.1));
+ t.input(Input::Up(switch.0, switch.1));
+ }
+ for _ in 0..30 {
+ app.update();
+ }
+ let trees = app.world().non_send::<Trees>();
+ let s = trees.0.get(&e).unwrap().state().downcast_ref::<State>().unwrap();
+ assert_eq!((s.presses, s.on), (1, true), "the press didn't reach the switch at {switch:?}");
+ assert_ne!(read(&app, e), ours, "the layer still shows the switch off");
+}
diff --git a/engine/rune/bevy/tests/overlay.rs b/engine/rune/bevy/tests/overlay.rs
new file mode 100644
index 00000000..ea1ccb19
--- /dev/null
+++ b/engine/rune/bevy/tests/overlay.rs
@@ -0,0 +1,53 @@
+//! A layer that fills a window (RuneOverlay): sized to the window's logical size and scale, and given the window's
+//! pointer as Bevy's winit writes it (CursorMoved, MouseButtonInput), so a click on the switch reaches its handler.
+
+use bevy::input::ButtonState;
+use bevy::input::mouse::MouseButtonInput;
+use bevy::prelude::*;
+use bevy::window::{CursorMoved, ExitCondition, PrimaryWindow, WindowResolution};
+use raea_rune_bevy::{RuneLayerPlugin, RuneOverlay, SpawnRune, Tree, Trees};
+use rune::{Cx, El, Env, Runtime, col, el};
+
+#[derive(Default)]
+struct State {
+ presses: u32,
+}
+
+fn view(_: &State, _: &mut Cx<State>) -> El {
+ let button = el().key("button").role("button").label("Press").size(80.0, 30.0).fill(rune::tok::accent(0, true)).on_press(|s: &mut State| s.presses += 1);
+ col().w_full().h_full().center().child(button)
+}
+
+#[test]
+fn an_overlay_follows_its_window_and_takes_its_clicks() {
+ let mut app = App::new();
+ app.add_plugins(
+ DefaultPlugins
+ .set(WindowPlugin { primary_window: None, exit_condition: ExitCondition::DontExit, close_when_requested: false, ..default() })
+ .set(bevy::render::RenderPlugin { synchronous_pipeline_compilation: true, ..default() }),
+ );
+ app.add_plugins(RuneLayerPlugin);
+ app.finish();
+ app.cleanup();
+ // a window of 300 x 200 points at scale 2, as winit would have made it
+ let window = app.world_mut().spawn((Window { resolution: WindowResolution::new(600, 400).with_scale_factor_override(2.0), ..default() }, PrimaryWindow)).id();
+ let rt = Runtime::new(State::default(), view, (100.0, 100.0), Env::new(true, 1.0));
+ let layer = app.world_mut().spawn_rune(Tree::new(rt, 1.0), [0.0; 4]);
+ app.world_mut().entity_mut(layer).insert(RuneOverlay::default());
+ for _ in 0..3 {
+ app.update();
+ }
+ assert_eq!(app.world().non_send::<Trees>().0[&layer].viewport(), ((300.0, 200.0), 2.0), "the overlay isn't the window's size");
+ // the button's centre: the window's middle
+ let at = Vec2::new(150.0, 100.0);
+ app.world_mut().write_message(CursorMoved { window, position: at, delta: None });
+ app.update();
+ app.world_mut().write_message(MouseButtonInput { button: MouseButton::Left, state: ButtonState::Pressed, window });
+ app.update();
+ app.world_mut().write_message(MouseButtonInput { button: MouseButton::Left, state: ButtonState::Released, window });
+ for _ in 0..3 {
+ app.update();
+ }
+ let presses = app.world().non_send::<Trees>().0[&layer].state().downcast_ref::<State>().unwrap().presses;
+ assert_eq!(presses, 1, "the window's click didn't reach the button");
+}
diff --git a/engine/rune/js/Cargo.toml b/engine/rune/js/Cargo.toml
new file mode 100644
index 00000000..a6ba9897
--- /dev/null
+++ b/engine/rune/js/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "raea-rune-js"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "The native target's JS (docs/targets.feature): a bundled TSX app run by raea-runtime-jsengine against a Rune page, its op batches, asks and host calls"
+
+[dependencies]
+raea-rune-page = { path = "../page" }
+raea-core-wire = { path = "../../../core/wire" }
+# the net.* host calls, answered as the web target answers them (docs/targets.feature T2a)
+raea-io-net-calls = { path = "../../../io/net/calls" }
+# os.open, the clipboard, files and dialogs, answered as the web target answers them (docs/targets.feature T2d)
+raea-io-os = { path = "../../../io/os" }
+raea-runtime-jsengine = { path = "../../../runtime/jsengine" }
+serde_json = "1"
+
+[features]
+# QuickJS beside JavaScriptCore on a Mac (BEVY_TSX_ENGINE=quickjs picks it)
+portable = ["raea-runtime-jsengine/portable"]
diff --git a/engine/rune/src/js.rs b/engine/rune/js/src/lib.rs
similarity index 99%
rename from engine/rune/src/js.rs
rename to engine/rune/js/src/lib.rs
index 453d7053..b9c2a01e 100644
--- a/engine/rune/src/js.rs
+++ b/engine/rune/js/src/lib.rs
@@ -14,8 +14,8 @@ use raea_io_net_calls::{CALLS, Net};
use raea_runtime_jsengine::{Arg, Engine, JsEngine, Native, Ret, arg};
use serde_json::{Value, json};
-use crate::page::{Out, Page};
-use crate::session::Session;
+use raea_rune_page::page::{Out, Page};
+use raea_rune_page::session::Session;
/// The platform a bundle expects (console, microtasks, timers on the host's clock).
pub const PRELUDE: &str = include_str!("prelude.js");
diff --git a/engine/rune/src/prelude.js b/engine/rune/js/src/prelude.js
similarity index 100%
rename from engine/rune/src/prelude.js
rename to engine/rune/js/src/prelude.js
diff --git a/engine/rune/src/lib.rs b/engine/rune/src/lib.rs
index 8853fc45..c88acec6 100644
--- a/engine/rune/src/lib.rs
+++ b/engine/rune/src/lib.rs
@@ -5,7 +5,11 @@
pub use raea_rune_look::{dump, look};
pub use raea_rune_page::{css, events, images, input, kit, layout, measure, motion, page, report, runeprops, session, state, tailwind, tree, variants, view};
-pub mod js;
+/// Rune over Bevy (docs/targets.feature T6c): the app in a Bevy window, and the check's frames drawn by Bevy's device
+#[cfg(feature = "bevy")]
+pub mod on_bevy;
+/// the app's JS against its page, in raea-rune-js (kept under this name)
+pub use raea_rune_js as js;
pub mod macapp;
pub mod script;
pub mod shot;
diff --git a/engine/rune/src/main.rs b/engine/rune/src/main.rs
index 6d0c9758..dfc83c9e 100644
--- a/engine/rune/src/main.rs
+++ b/engine/rune/src/main.rs
@@ -37,6 +37,8 @@ struct Args {
base: Option<PathBuf>,
/// the CSS the app's bundle imported, whose @font-face rules register (T3d)
css: Option<PathBuf>,
+ /// `--draw bevy`: the window or the check's frames drawn by Bevy's device, the tree a Rune layer (T6c)
+ bevy: bool,
}
enum Mode {
@@ -51,6 +53,12 @@ fn args() -> Result<Args, String> {
let (mut app, mut script, mut out, mut size, mut settle) = (None, None, PathBuf::from("out"), (800, 600), 12);
let (mut headless, mut bundle, mut app_out) = (false, false, None);
let (mut video, mut audio, mut title, mut base, mut css) = (None, None, None, None, None);
+ // RAEA_RUNE_DRAW=bevy is `--draw bevy` for a host raea launches (`raea app check|run --target native`), whose own
+ // flags raea doesn't pass through
+ let mut bevy = std::env::var("RAEA_RUNE_DRAW").as_deref() == Ok("bevy");
+ if bevy && !cfg!(feature = "bevy") {
+ return Err("RAEA_RUNE_DRAW=bevy: this host was built without its `bevy` feature".into());
+ }
while let Some(a) = it.next() {
let mut val = || it.next().ok_or_else(|| format!("{a} needs a value"));
match a.as_str() {
@@ -70,6 +78,12 @@ fn args() -> Result<Args, String> {
"--title" => title = Some(val()?),
"--base" => base = Some(PathBuf::from(val()?)),
"--css" => css = Some(PathBuf::from(val()?)),
+ "--draw" => match val()?.as_str() {
+ "bevy" if cfg!(feature = "bevy") => bevy = true,
+ "bevy" => return Err("--draw bevy: this host was built without its `bevy` feature".into()),
+ "rune" => bevy = false,
+ other => return Err(format!("--draw {other}? (rune or bevy)")),
+ },
"--settle" => settle = val()?.parse().map_err(|_| "--settle is a number of frames")?,
"-h" | "--help" => return Err(USAGE.into()),
other => return Err(format!("{other}?\n{USAGE}")),
@@ -86,10 +100,10 @@ fn args() -> Result<Args, String> {
} else {
Mode::Window
};
- Ok(Args { app, script, out, size, settle, mode, video, audio, title, base, css })
+ Ok(Args { app, script, out, size, settle, mode, video, audio, title, base, css, bevy })
}
-const USAGE: &str = "usage: raea-rune-host run app.js [--size 800x600] [--title T]\n raea-rune-host bundle app.js [-o App.app] [--size 800x600] [--title T]\n raea-rune-host --headless app.js [--script steps.json] [--png out/] [--size 800x600] [--settle 12] [--video OUT.mp4 [--audio FILE]]";
+const USAGE: &str = "usage: raea-rune-host run app.js [--size 800x600] [--title T] [--draw rune|bevy]\n raea-rune-host bundle app.js [-o App.app] [--size 800x600] [--title T]\n raea-rune-host --headless app.js [--script steps.json] [--png out/] [--size 800x600] [--settle 12] [--video OUT.mp4 [--audio FILE]] [--draw rune|bevy]";
/// The app's script: a bundle raea made. A source file is refused with what makes its script.
fn script_of(app: &Path) -> Result<String, String> {
@@ -139,6 +153,10 @@ fn run() -> Result<(), String> {
match &a.mode {
Mode::Window => {
raea_rune_media::fonts::register(fonts);
+ #[cfg(feature = "bevy")]
+ if a.bevy {
+ return raea_rune_host::on_bevy::window::run(src?, &title, (a.size.0 as f32, a.size.1 as f32));
+ }
return raea_rune_host::window::run(src?, &title, (a.size.0 as f32, a.size.1 as f32));
}
Mode::Bundle(out) => {
@@ -155,7 +173,7 @@ fn run() -> Result<(), String> {
let mut app = App::new(&src?, (a.size.0 as f32, a.size.1 as f32))?;
let film = a.video.as_deref().map(|v| raea_rune_host::video::start(&mut app.session, v, a.size, a.audio.as_deref())).transpose()?;
// one renderer per session: while filming, the stills are the film's own frames (video.rs, `last`)
- let mut shooter = film.is_none().then(|| Shooter::new(a.size.0, a.size.1));
+ let mut shooter = film.is_none().then(|| Shot::new(a.bevy, a.size));
let mut trees = Vec::new();
let film_ref = film.as_ref();
let mut shoot = |app: &mut App, i: usize, name: &str| -> Result<(), String> {
@@ -237,3 +255,29 @@ fn name(s: &Step) -> String {
fn shown(p: &Path) -> String {
p.display().to_string()
}
+
+/// The check's frames: Rune's own headless renderer, or Bevy's device (`--draw bevy`, T6c).
+enum Shot {
+ Rune(Shooter),
+ #[cfg(feature = "bevy")]
+ Bevy(raea_rune_host::on_bevy::shot::BevyShooter),
+}
+
+impl Shot {
+ fn new(bevy: bool, (w, h): (u32, u32)) -> Shot {
+ #[cfg(feature = "bevy")]
+ if bevy {
+ return Shot::Bevy(raea_rune_host::on_bevy::shot::BevyShooter::new(w, h));
+ }
+ let _ = bevy;
+ Shot::Rune(Shooter::new(w, h))
+ }
+
+ fn png(&mut self, rt: &mut rune::Runtime<raea_rune_host::page::Page>, path: &Path) -> Result<(), String> {
+ match self {
+ Shot::Rune(s) => s.png(rt, path),
+ #[cfg(feature = "bevy")]
+ Shot::Bevy(s) => s.png(rt, path),
+ }
+ }
+}
diff --git a/engine/rune/src/on_bevy/mod.rs b/engine/rune/src/on_bevy/mod.rs
new file mode 100644
index 00000000..bdddcef2
--- /dev/null
+++ b/engine/rune/src/on_bevy/mod.rs
@@ -0,0 +1,25 @@
+//! Rune over Bevy (docs/targets.feature T6c): the app's tree drawn into a Bevy Image on Bevy's device, with no copy
+//! (raea-rune-bevy). `window` opens it in a Bevy window, the tree a layer over Bevy's frame; `shot` draws the check's
+//! frames the same way, so a check shows that Bevy's device draws what Rune's own renderer does (`--draw bevy`).
+
+pub mod shot;
+pub mod window;
+
+use bevy::prelude::*;
+use bevy::window::ExitCondition;
+
+/// A headless Bevy app (no window, no winit) with Rune's layers: what the check and a video draw with.
+pub fn headless() -> App {
+ let mut app = App::new();
+ app.add_plugins(
+ DefaultPlugins
+ .build()
+ .disable::<bevy::winit::WinitPlugin>()
+ .set(WindowPlugin { primary_window: None, exit_condition: ExitCondition::DontExit, close_when_requested: false, ..default() })
+ .set(bevy::render::RenderPlugin { synchronous_pipeline_compilation: true, ..default() }),
+ );
+ app.add_plugins(raea_rune_bevy::RuneLayerPlugin);
+ app.finish();
+ app.cleanup();
+ app
+}
diff --git a/engine/rune/src/on_bevy/shot.rs b/engine/rune/src/on_bevy/shot.rs
new file mode 100644
index 00000000..3db0ebcb
--- /dev/null
+++ b/engine/rune/src/on_bevy/shot.rs
@@ -0,0 +1,44 @@
+//! The check's frames drawn by Bevy (`--headless app.js --draw bevy`): the session's Runtime drawn into a Bevy Image
+//! on Bevy's device (raea-rune-bevy's draw_runtime, what a layer does each frame), then read back. Against shot.rs's
+//! Shooter (Rune's own headless device), the same app and script give the same PNGs: T6c's parity.
+
+use std::path::Path;
+
+use bevy::prelude::*;
+use rune::Runtime;
+use rune::render::Renderer;
+
+use crate::page::Page;
+
+pub struct BevyShooter {
+ app: App,
+ image: Handle<Image>,
+ size: (u32, u32),
+ renderer: Option<Renderer>,
+}
+
+impl BevyShooter {
+ /// A headless Bevy app and a `w` x `h` Image on its device.
+ pub fn new(w: u32, h: u32) -> BevyShooter {
+ let mut app = super::headless();
+ let image = raea_rune_bevy::image(&mut app.world_mut().resource_mut::<Assets<Image>>(), (w, h));
+ // the Image reaches the GPU in the render world's first prepare
+ app.update();
+ BevyShooter { app, image, size: (w, h), renderer: None }
+ }
+
+ /// The runtime's last frame drawn into the Image: tightly packed sRGB RGBA8, `w * h * 4` bytes.
+ pub fn pixels(&mut self, rt: &mut Runtime<Page>) -> Result<Vec<u8>, String> {
+ let (device, queue) = raea_rune_bevy::readback::device(&self.app);
+ let view = raea_rune_bevy::readback::view(&self.app, &self.image).ok_or("bevy: the Image isn't on the GPU")?;
+ // a browser's canvas: white under a page that paints nothing there, as shot.rs
+ raea_rune_bevy::draw_runtime(&mut self.renderer, rt, &device, &queue, &view, self.size, [1.0, 1.0, 1.0, 1.0]);
+ raea_rune_bevy::readback::read(&self.app, &self.image).ok_or_else(|| "bevy: no Image to read".into())
+ }
+
+ /// The runtime's last frame as a PNG at `path`.
+ pub fn png(&mut self, rt: &mut Runtime<Page>, path: &Path) -> Result<(), String> {
+ let px = self.pixels(rt)?;
+ crate::shot::write_png(path, self.size.0, self.size.1, &px)
+ }
+}
diff --git a/engine/rune/src/on_bevy/window.rs b/engine/rune/src/on_bevy/window.rs
new file mode 100644
index 00000000..2446caf6
--- /dev/null
+++ b/engine/rune/src/on_bevy/window.rs
@@ -0,0 +1,58 @@
+//! The app in a Bevy window (`run app.js --draw bevy`, T6c): Bevy owns the window, the device and the frame, and the
+//! app's tree is a Rune layer over it (raea-rune-bevy), sized to the window and given its pointer and keys
+//! (RuneOverlay). The page, its JS and its hooks are window.rs's, as in Rune's own shell: the tree's poll moves the JS
+//! on each frame, its on_key takes the keys Rune's focused control didn't, and after each frame its layout goes to the
+//! next poll. A UI image shows the layer over a 2D camera; a 3D scene goes under it on the same device.
+
+use std::sync::Arc;
+
+use bevy::prelude::*;
+use bevy::window::WindowResolution;
+use raea_rune_bevy::{RuneLayer, RuneOverlay, SpawnRune, Tree};
+use rune::{Env, Runtime};
+
+use crate::page::{Page, view};
+
+#[derive(Resource, Clone, Copy)]
+struct Size((f32, f32));
+
+/// `bundle` in a `size` window titled `title`, until it closes. Errors from the JS end the app and come back here.
+pub fn run(bundle: String, title: &str, size: (f32, f32)) -> Result<(), String> {
+ crate::window::begin(bundle, size)?;
+ let mut app = App::new();
+ app.add_plugins(DefaultPlugins.set(WindowPlugin {
+ primary_window: Some(Window { title: title.into(), resolution: WindowResolution::new(size.0 as u32, size.1 as u32), ..default() }),
+ ..default()
+ }));
+ app.add_plugins(raea_rune_bevy::RuneLayerPlugin).insert_resource(Size(size)).add_systems(Startup, spawn).add_systems(Last, end_on_error);
+ app.run();
+ crate::window::error(false).map_or(Ok(()), Err)
+}
+
+/// The page's tree as a layer filling the window, shown by a UI image over a 2D camera.
+fn spawn(world: &mut World) {
+ let size = world.resource::<Size>().0;
+ let scale = world.query::<&Window>().iter(world).next().map_or(1.0, |w| w.resolution.scale_factor());
+ let mut page = Page::default();
+ page.viewport = size;
+ // decodes and fetches land on the next frame: Bevy's loop runs every frame, so the waker has nothing to wake
+ crate::window::setup(&mut page, Arc::new(|| {}));
+ let text = rune::text::TextSystem::new(raea_rune_media::fonts::registered(), ("Inter", "Inter"));
+ let mut rt = Runtime::with_text(page, view, size, Env::new(false, scale), text);
+ rt.poll = Some(crate::window::poll);
+ rt.on_key = Some(crate::window::on_key);
+ let mut tree = Tree::new(rt, scale);
+ tree.after_frame = Some(Box::new(|rt: &mut Runtime<Page>| crate::window::drawn(rt)));
+ let layer = world.spawn_rune(tree, [1.0, 1.0, 1.0, 1.0]);
+ world.entity_mut(layer).insert(RuneOverlay::default());
+ let image = world.get::<RuneLayer>(layer).expect("the layer").image.clone();
+ world.spawn(Camera2d);
+ world.spawn((Node { width: percent(100), height: percent(100), ..default() }, ImageNode::new(image)));
+}
+
+/// The JS failed: the app ends, as Rune's shell does on `tx.quit()`.
+fn end_on_error(mut exit: MessageWriter<AppExit>) {
+ if crate::window::error(true).is_some() {
+ exit.write(AppExit::error());
+ }
+}
diff --git a/engine/rune/src/window.rs b/engine/rune/src/window.rs
index 51df934b..b9f1260a 100644
--- a/engine/rune/src/window.rs
+++ b/engine/rune/src/window.rs
@@ -60,23 +60,35 @@ impl Host for Win<'_> {
/// `bundle` in a `size` window titled `title`, until it closes. Errors from the JS end the app and come back here.
pub fn run(bundle: String, title: &str, size: (f32, f32)) -> Result<(), String> {
- BESIDE.with_borrow_mut(|b| {
- b.js = Some(Js::new()?);
- b.bundle = Some(bundle);
- b.viewport = size;
- b.heard = size;
- Ok::<_, String>(())
- })?;
+ begin(bundle, size)?;
// the window can shrink below Rune's default floor (420x400) when the app asks for less
let min_size = Some((size.0.min(420.0), size.1.min(400.0)));
// the app's faces, registered at the start (raea-rune-media's fonts: Rune takes them only then)
let fonts = raea_rune_media::fonts::registered();
let spec = AppSpec { setup: Some(setup), poll: Some(poll), on_key: Some(on_key), min_size, fonts, ..AppSpec::new(Box::leak(title.to_string().into_boxed_str()), size, Page::default, view) };
App::new(spec).on_frame_drawn(drawn).run();
- BESIDE.with_borrow_mut(|b| b.error.take()).map_or(Ok(()), Err)
+ error(false).map_or(Ok(()), Err)
+}
+
+/// The engine made and the bundle kept for the first poll, at `size`: what any window's host does first (Rune's shell
+/// here, Bevy's in on_bevy/window.rs).
+pub(crate) fn begin(bundle: String, size: (f32, f32)) -> Result<(), String> {
+ BESIDE.with_borrow_mut(|b| {
+ b.js = Some(Js::new()?);
+ b.bundle = Some(bundle);
+ b.viewport = size;
+ b.heard = size;
+ Ok::<_, String>(())
+ })
+}
+
+/// The error that ended the app (the JS's): taken once by the host that ends on it, or `peek`ed by a host without
+/// Rune's `tx.quit()` (Bevy's), which ends when there is one.
+pub(crate) fn error(peek: bool) -> Option<String> {
+ BESIDE.with_borrow_mut(|b| if peek { b.error.clone() } else { b.error.take() })
}
-fn setup(page: &mut Page, w: Waker) {
+pub(crate) fn setup(page: &mut Page, w: Waker) {
// a window's media: a decode or a URL's fetch wakes it, and a video streams its URL (T3d)
page.images = crate::images::Images::new(w.clone());
page.videos.window = true;
@@ -84,7 +96,7 @@ fn setup(page: &mut Page, w: Waker) {
}
/// After each frame: its layout, for the next poll, and a wake for that poll when it changed.
-fn drawn(rt: &rune::Runtime<Page>) {
+pub(crate) fn drawn(rt: &rune::Runtime<Page>) {
// what a handler queued in this frame (a press, an edit, a hover) waits for the JS: a poll now
if !rt.state.outbox.is_empty() {
wake();
@@ -108,7 +120,7 @@ fn wake() {
}
/// The start of a frame, `t` seconds in: the layout taken in, a field Rune focused followed, and the JS moved on.
-fn poll(page: &mut Page, t: f64, tx: &mut Tx) -> bool {
+pub(crate) fn poll(page: &mut Page, t: f64, tx: &mut Tx) -> bool {
let (measured, resized) = BESIDE.with_borrow_mut(|b| {
let resized = (b.viewport != b.heard).then_some(b.viewport);
b.heard = b.viewport;
@@ -164,7 +176,7 @@ fn poll(page: &mut Page, t: f64, tx: &mut Tx) -> bool {
/// A key Rune's focused control didn't take (or any key while nothing has Rune's focus): the page's keydown, and
/// whether the page took it from Rune (a menu's Enter, Space or Escape).
-fn on_key(page: &mut Page, k: &KeyEvent, tx: &mut Tx) -> bool {
+pub(crate) fn on_key(page: &mut Page, k: &KeyEvent, tx: &mut Tx) -> bool {
let mut taken = !page.key_out(Ev::KeyDown, crate::events::key_payload(k));
// Tab is the page's sequential focus (input.rs)
if !taken && k.key == rune::Key::Tab {
diff --git a/examples/games/animated-character.tsx b/examples/games/animated-character.tsx
new file mode 100644
index 00000000..91b128b3
--- /dev/null
+++ b/examples/games/animated-character.tsx
@@ -0,0 +1,40 @@
+// record: robot-expressive, bevy-animation-animated-mesh
+// A rigged glTF character playing its clips: the Bevy "animated mesh" example in raea's SDK. It expects
+// media/RobotExpressive.glb (CC0, Quaternius; three.js ships it as examples/models/gltf/RobotExpressive).
+// One robot walks across the floor (clip "Walking", its position from the frame), a second waves from a Sequence.
+import { AbsoluteFill, Composition, interpolate, registerRoot, Sequence, staticFile, useCurrentFrame } from "raea";
+import { Model } from "raea/3d";
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+const FPS = 30;
+const FRAMES = 90;
+// the model is about 4.5 units tall at scale 1, its origin at the feet, facing +z
+const SCALE = 0.4;
+
+function Shot() {
+ const f = useCurrentFrame();
+ const x = interpolate(f, [0, FRAMES - 1], [-2.4, 0.6]);
+ return (
+ <AbsoluteFill style={{ background: "#1b2230" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 2.4, 7).lookingAt([0, 0.9, 0])} projection={{ Perspective: { fov: 0.698131700797732 } }} />
+ <AmbientLight brightness={180} />
+ <DirectionalLight transform={Transform.fromXyz(3, 6, 4).lookingAt([0, 0, 0])} illuminance={10400} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[6, 0.05, 4]} />
+ <StandardMaterial base_color="#d9d4c7" perceptual_roughness={0.9} />
+ </Mesh3d>
+ <Model name="walker" src={staticFile("RobotExpressive.glb")} animation="Walking" position={[x, 0, 0]} rotation={[0, Math.PI / 2, 0]} scale={SCALE} />
+ <Sequence from={15} layout="none">
+ <Model name="waver" src={staticFile("RobotExpressive.glb")} animation="Wave" position={[2, 0, -1]} rotation={[0, -0.5, 0]} scale={SCALE} />
+ </Sequence>
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="character" component={Shot} width={960} height={540} fps={FPS} durationInFrames={FRAMES} />);
diff --git a/examples/games/breakout.tsx b/examples/games/breakout.tsx
new file mode 100644
index 00000000..7f58765d
--- /dev/null
+++ b/examples/games/breakout.tsx
@@ -0,0 +1,80 @@
+// record: bevy-games-breakout, juice-it-or-lose-it
+// Bevy's Breakout showcase in raea's SDK, juiced as in "Juice it or lose it": bricks pop out with a squash and a
+// flash, the paddle squashes on contact, and the camera kicks on every break. The state is a pure fold over the input;
+// a person's keys move the paddle when `live`, otherwise the paddle tracks the ball (the scripted play for renders).
+// Played live on void's stage, the 3D follows the person's keys frame by frame, as a render of their input does.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame, useGameState, type FrameInput } from "raea";
+import { Sphere } from "raea/3d";
+import { LinearRgba, Srgba } from "raea/color";
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+const FPS = 30;
+const FRAMES = 240;
+const COLS = 8, ROWS = 4;
+const W = 8, TOP = 4.2; // field: x in [-W/2, W/2], y from 0 (paddle) to TOP
+interface Game { px: number; bx: number; by: number; vx: number; vy: number; alive: boolean[]; broke: number[]; paddleHit: number; score: number }
+const INITIAL: Game = { px: 0, bx: 0, by: 0.6, vx: 0.07, vy: 0.09, alive: Array(COLS * ROWS).fill(true), broke: Array(COLS * ROWS).fill(-99), paddleHit: -99, score: 0 };
+const brickPos = (i: number): [number, number] => [(i % COLS - (COLS - 1) / 2) * (W / COLS), TOP - 0.3 - Math.floor(i / COLS) * 0.42];
+
+function step(s: Game, input: FrameInput & { live?: boolean }, frame: number): Game {
+ const dir = input.keys.length ? (input.keys.includes("ArrowRight") ? 1 : 0) - (input.keys.includes("ArrowLeft") ? 1 : 0) : Math.sign(s.bx - s.px) * Math.min(1, Math.abs(s.bx - s.px) * 4);
+ const px = Math.max(-W / 2 + 0.7, Math.min(W / 2 - 0.7, s.px + dir * 0.12));
+ let { bx, by, vx, vy, paddleHit, score } = s;
+ bx += vx; by += vy;
+ if (bx < -W / 2 + 0.12 || bx > W / 2 - 0.12) vx = -vx;
+ if (by > TOP) vy = -Math.abs(vy);
+ if (by < 0.15 && vy < 0 && Math.abs(bx - px) < 0.8) { vy = Math.abs(vy); vx += (bx - px) * 0.04; paddleHit = frame; }
+ if (by < -1) { bx = px; by = 0.6; vy = 0.09; }
+ const alive = s.alive.slice(), broke = s.broke.slice();
+ for (let i = 0; i < alive.length; i++) {
+ if (!alive[i]) continue;
+ const [x, y] = brickPos(i);
+ if (Math.abs(bx - x) < W / COLS / 2 && Math.abs(by - y) < 0.2) { alive[i] = false; broke[i] = frame; vy = -vy; score += 10; break; }
+ }
+ return { px, bx, by, vx, vy, alive, broke, paddleHit, score };
+}
+
+function Breakout() {
+ const g = useGameState(INITIAL, step);
+ const f = g.broke.reduce((m, b) => Math.max(m, b), -99);
+ const now = useCurrentFrame();
+ const kick = Math.max(0, 1 - (now - f) / 8); // a short camera kick after each break, decaying over 8 frames
+ const shake = kick * kick * 0.08 * Math.sin(now * 2.7);
+ const squash = Math.max(0, 1 - (now - g.paddleHit) / 6);
+ return (
+ <AbsoluteFill style={{ background: "#101422" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(shake, 2.1 + shake, 8.5).lookingAt([0, 2.1, 0])} projection={{ Perspective: { fov: 0.733038285837618 } }} />
+ <AmbientLight brightness={160} />
+ <DirectionalLight transform={Transform.fromXyz(2, 6, 6).lookingAt([0, 0, 0])} illuminance={9600} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(g.px, 0, 0).withScale([1 + 0.25 * squash, 1 - 0.35 * squash, 1])} name="paddle">
+ <Cuboid half_size={[0.7, 0.1, 0.2]} />
+ <StandardMaterial base_color="#f0ebd8" perceptual_roughness={0.4} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(g.bx, g.by, 0)} name="ball">
+ <Sphere radius={0.13} />
+ <StandardMaterial base_color="#ffd166" emissive={LinearRgba.from(Srgba.hex("#ffd166")).mul(0.6)} />
+ </Mesh3d>
+ {g.alive.map((on, i) => {
+ const [x, y] = brickPos(i);
+ const t = (now - g.broke[i]) / 10; // 0..1 over the 10 frames after it breaks
+ if (!on && t > 1) return null;
+ const pop = on ? 1 : 1 + 0.6 * t;
+ return (
+ <Mesh3d key={i} transform={Transform.fromXyz(x, y, on ? 0 : t * 0.8).withScale([pop, on ? 1 : 1 - t, on ? 1 : 1 - t])} name={`brick-${i}`}>
+ <Cuboid half_size={[(W / COLS - 0.08) / 2, 0.16, 0.2]} />
+ <StandardMaterial base_color={on ? ["#ef476f", "#f78c6b", "#06d6a0", "#118ab2"][Math.floor(i / COLS)] : "#ffffff"} perceptual_roughness={0.5} />
+ </Mesh3d>
+ );
+ })}
+ </>
+ <div style={{ position: "absolute", left: 40, top: 28, fontFamily: "Inter", fontWeight: 800, fontSize: 40, color: "#f0ebd8" }}>{`SCORE ${g.score}`}</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="breakout3d" component={Breakout} width={1280} height={720} fps={FPS} durationInFrames={FRAMES} />);
diff --git a/examples/games/camera-orbit.tsx b/examples/games/camera-orbit.tsx
new file mode 100644
index 00000000..90509625
--- /dev/null
+++ b/examples/games/camera-orbit.tsx
@@ -0,0 +1,49 @@
+// record: bevy-camera-camera-orbit, bevy-math-smooth-follow
+// Bevy's "camera orbit" and "smooth follow" examples in raea's SDK. The camera is a function of the frame: it orbits
+// the scene, and a marker follows a moving target with exponential smoothing, worked out in closed form per frame
+// (a follower that lags by tau seconds behind a target moving on a circle) so any frame renders alone.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame, useVideoConfig } from "raea";
+import { Sphere } from "raea/3d";
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+function Orbit() {
+ const f = useCurrentFrame();
+ const { fps } = useVideoConfig();
+ const t = f / fps;
+ const yaw = t * 0.6;
+ const cam: [number, number, number] = [Math.sin(yaw) * 8, 3.5, Math.cos(yaw) * 8];
+ const w = 1.5; // the target's angular speed (rad/s)
+ const target: [number, number, number] = [Math.cos(t * w) * 2.5, 0.4, Math.sin(t * w) * 2.5];
+ // steady state of x' = (target - x) / tau for circular motion: the same circle, smaller and phase-lagged
+ const tau = 0.4;
+ const gain = 1 / Math.sqrt(1 + (w * tau) ** 2);
+ const lag = Math.atan(w * tau);
+ const follow: [number, number, number] = [Math.cos(t * w - lag) * 2.5 * gain, 0.4, Math.sin(t * w - lag) * 2.5 * gain];
+ return (
+ <AbsoluteFill style={{ background: "#0f1720" }}>
+ <>
+ <Camera3d transform={Transform.fromTranslation(cam).lookingAt([0, 0.4, 0])} projection={{ Perspective: { fov: 0.785398163397448 } }} />
+ <AmbientLight brightness={160} />
+ <DirectionalLight transform={Transform.fromXyz(4, 8, 3).lookingAt([0, 0, 0])} illuminance={9600} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[5, 0.05, 5]} />
+ <StandardMaterial base_color="#c4bfb2" perceptual_roughness={0.9} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromTranslation(target)} name="target">
+ <Sphere radius={0.3} />
+ <StandardMaterial base_color="#ef476f" />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromTranslation(follow)} name="follower">
+ <Cuboid half_size={[0.225, 0.225, 0.225]} />
+ <StandardMaterial base_color="#06d6a0" />
+ </Mesh3d>
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="orbit" component={Orbit} width={1280} height={720} fps={30} durationInFrames={150} />);
diff --git a/examples/games/fog-bloom.tsx b/examples/games/fog-bloom.tsx
new file mode 100644
index 00000000..49296d17
--- /dev/null
+++ b/examples/games/fog-bloom.tsx
@@ -0,0 +1,47 @@
+// record: bevy-3d-rendering-fog, bevy-3d-rendering-bloom-3d
+// Bevy's "fog" and "bloom 3d" examples in raea's SDK: a corridor of pillars fading into fog that matches the
+// background, with glowing orbs blooming as they pulse.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Bloom, Fog, Sphere } from "raea/3d";
+import { LinearRgba, Srgba } from "raea/color";
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+const BG = "#1d2433";
+
+function FogBloom() {
+ const f = useCurrentFrame();
+ const z = -f * 0.06;
+ return (
+ <AbsoluteFill style={{ background: BG }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 1.6, 4 + z).lookingAt([0, 1.2, -6 + z])} projection={{ Perspective: { fov: 0.959931088596881 } }} />
+ <AmbientLight brightness={120} />
+ <DirectionalLight transform={Transform.fromXyz(2, 6, 3).lookingAt([0, 0, 0])} illuminance={6400} shadow_maps_enabled />
+ <Fog color={BG} near={4} far={22} />
+ <Bloom intensity={1.4} threshold={0.8} />
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, -15)}>
+ <Cuboid half_size={[4, 0.05, 25]} />
+ <StandardMaterial base_color="#3b4458" perceptual_roughness={0.9} />
+ </Mesh3d>
+ {Array.from({ length: 12 }, (_, i) => (
+ <Mesh3d key={`p${i}`} transform={Transform.fromXyz(i % 2 ? 2.2 : -2.2, 1.5, -i * 3)}>
+ <Cuboid half_size={[0.25, 1.5, 0.25]} />
+ <StandardMaterial base_color="#c9c2b2" perceptual_roughness={0.7} />
+ </Mesh3d>
+ ))}
+ {Array.from({ length: 6 }, (_, i) => (
+ <Mesh3d key={`o${i}`} transform={Transform.fromXyz(0, 1.2 + 0.2 * Math.sin(f * 0.1 + i), -2 - i * 5)}>
+ <Sphere radius={0.25} />
+ <StandardMaterial base_color="#000000" emissive={LinearRgba.from(Srgba.hex("#58e1ff")).mul(4 + 3 * Math.sin(f * 0.15 + i))} />
+ </Mesh3d>
+ ))}
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="fogbloom" component={FogBloom} width={1280} height={720} fps={30} durationInFrames={120} />);
diff --git a/examples/games/lighting.tsx b/examples/games/lighting.tsx
new file mode 100644
index 00000000..07641657
--- /dev/null
+++ b/examples/games/lighting.tsx
@@ -0,0 +1,45 @@
+// record: bevy-3d-rendering-lighting, bevy-3d-rendering-spotlight
+// Bevy's "lighting" and "spotlight" examples in raea's SDK: a dim sun, a coloured bulb orbiting, and a spot sweeping
+// across the floor, all moved from the frame.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Sphere } from "raea/3d";
+import { LinearRgba, Srgba } from "raea/color";
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight, PointLight, SpotLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+function Lighting() {
+ const f = useCurrentFrame();
+ const a = f * 0.05;
+ const bulb: [number, number, number] = [Math.cos(a) * 2.5, 1.2, Math.sin(a) * 2.5];
+ const sweep = Math.sin(f * 0.04) * 3;
+ return (
+ <AbsoluteFill style={{ background: "#07080b" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 4, 9).lookingAt([0, 0.5, 0])} projection={{ Perspective: { fov: 0.698131700797732 } }} />
+ <AmbientLight brightness={32} />
+ <DirectionalLight transform={Transform.fromXyz(-4, 6, 2).lookingAt([0, 0, 0])} illuminance={2000} shadow_maps_enabled />
+ <PointLight color="#ff8a3d" transform={Transform.fromTranslation(bulb)} intensity={2250000} range={10} shadow_maps_enabled />
+ <SpotLight color="#9ad1ff" transform={Transform.fromXyz(0, 6, 2).lookingAt([sweep, 0, 0])} intensity={5400000} outer_angle={0.35} inner_angle={0.21} />
+ <Mesh3d transform={Transform.fromTranslation(bulb)} name="bulb">
+ <Sphere radius={0.08} />
+ <StandardMaterial base_color="#000000" emissive={LinearRgba.from(Srgba.hex("#ff8a3d")).mul(4)} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[6, 0.05, 4]} />
+ <StandardMaterial base_color="#b9b4aa" perceptual_roughness={0.85} />
+ </Mesh3d>
+ {[-2, 0, 2].map((x) => (
+ <Mesh3d key={x} transform={Transform.fromXyz(x, 0.5, 0)}>
+ <Cuboid half_size={[0.5, 0.5, 0.5]} />
+ <StandardMaterial base_color="#e9e4da" perceptual_roughness={0.5} />
+ </Mesh3d>
+ ))}
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="lighting" component={Lighting} width={1280} height={720} fps={30} durationInFrames={120} />);
diff --git a/examples/games/pbr.tsx b/examples/games/pbr.tsx
new file mode 100644
index 00000000..7f55b2b7
--- /dev/null
+++ b/examples/games/pbr.tsx
@@ -0,0 +1,39 @@
+// record: bevy-3d-rendering-pbr
+// Bevy's "PBR" example in raea's SDK: a grid of spheres, metalness rising left to right and roughness rising bottom
+// to top. Without an environment map fully metal surfaces read dark, so metalness tops out at 0.8 (bevy/limits).
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Sphere } from "raea/3d";
+import { AmbientLight, DirectionalLight, PointLight } from "raea/light";
+import { Camera3d } from "raea/camera";
+import { StandardMaterial } from "raea/pbr";
+import { Transform } from "raea/transform";
+import { Mesh3d } from "raea/mesh";
+
+const N = 5;
+
+function Pbr() {
+ const cells = [];
+ for (let r = 0; r < N; r++) {
+ for (let c = 0; c < N; c++) {
+ cells.push(
+ <Mesh3d key={`${r}-${c}`} transform={Transform.fromXyz((c - 2) * 1.2, (r - 2) * 1.2, 0)}>
+ <Sphere radius={0.48} />
+ <StandardMaterial base_color="#c8553d" perceptual_roughness={0.08 + (r / (N - 1)) * 0.9} metallic={(c / (N - 1)) * 0.8} />
+ </Mesh3d>,
+ );
+ }
+ }
+ return (
+ <AbsoluteFill style={{ background: "#202329" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 0, 11).lookingAt([0, 0, 0])} projection={{ Perspective: { fov: 0.663225115757845 } }} />
+ <AmbientLight brightness={160} />
+ <DirectionalLight transform={Transform.fromXyz(3, 4, 6).lookingAt([0, 0, 0])} illuminance={9600} shadow_maps_enabled />
+ <PointLight color="#bfd7ff" transform={Transform.fromXyz(-4, 3, 4)} intensity={1350000} />
+ {cells}
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="pbr" component={Pbr} width={1280} height={720} fps={30} durationInFrames={30} />);
diff --git a/examples/games/platformer-feel.tsx b/examples/games/platformer-feel.tsx
new file mode 100644
index 00000000..3a7cb690
--- /dev/null
+++ b/examples/games/platformer-feel.tsx
@@ -0,0 +1,81 @@
+// record: coyote-time-jump-buffer, variable-jump-height, building-a-better-jump
+// Platformer jump feel in raea's SDK: coyote time (a jump still counts 0.1 s after walking off a ledge), a jump buffer
+// (a press up to 0.1 s before landing jumps on landing), a variable height (letting go early cuts the rise), and a
+// jump whose height and time to apex are chosen first, with gravity and launch speed derived from them (Pittman's
+// "Building a better jump"). Scripted input for the render: run right, press jump early before a landing, hold and
+// release. A live player's keys win when `live`.
+import { AbsoluteFill, Composition, registerRoot, useGameState, type FrameInput } from "raea";
+
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+const FPS = 60;
+const FRAMES = 300;
+const DT = 1 / FPS;
+const H = 2.2, APEX = 0.38; // jump height (units) and time to apex (s)
+const G = (2 * H) / (APEX * APEX); // gravity from the chosen arc
+const V0 = (2 * H) / APEX; // launch speed from the chosen arc
+const COYOTE = 0.1, BUFFER = 0.1, CUT = 0.45, RUN = 4;
+// ledges: [x from, x to, top]
+const GROUND: [number, number, number][] = [[-20, 2, 0], [3.5, 7, 0.8], [8.5, 30, 0]];
+interface P { x: number; y: number; vy: number; grounded: boolean; sinceGround: number; sincePress: number; held: boolean; jumps: number }
+const INITIAL: P = { x: -3, y: 0, vy: 0, grounded: true, sinceGround: 0, sincePress: 99, held: false, jumps: 0 };
+
+function scripted(frame: number): string[] {
+ const t = frame / FPS;
+ const keys = t < 4.6 ? ["ArrowRight"] : [];
+ // jump presses: a short tap, an early press before landing (buffered), a long hold
+ if ((t > 0.6 && t < 0.7) || (t > 1.42 && t < 1.9) || (t > 2.8 && t < 3.4)) keys.push(" ");
+ return keys;
+}
+
+const floorAt = (x: number) => GROUND.filter(([a, b]) => x >= a && x <= b).reduce((m, [, , top]) => Math.max(m, top), -99);
+
+function step(s: P, input: FrameInput & { live?: boolean }, frame: number): P {
+ const keys = input.keys.length ? input.keys : scripted(frame);
+ const jump = keys.includes(" ") || keys.includes("ArrowUp");
+ const pressed = jump && !s.held;
+ const x = s.x + ((keys.includes("ArrowRight") ? 1 : 0) - (keys.includes("ArrowLeft") ? 1 : 0)) * RUN * DT;
+ let sincePress = pressed ? 0 : s.sincePress + DT;
+ let sinceGround = s.grounded ? 0 : s.sinceGround + DT;
+ let vy = s.vy, jumps = s.jumps;
+ if (sincePress <= BUFFER && sinceGround <= COYOTE) { vy = V0; sincePress = 99; sinceGround = 99; jumps += 1; }
+ if (!jump && vy > 0) vy *= CUT; // released early: cut the rise
+ vy -= G * DT;
+ let y = s.y + vy * DT;
+ const floor = floorAt(x);
+ let grounded = false;
+ if (y <= floor && s.y >= floor - 0.05) { y = floor; vy = 0; grounded = true; }
+ if (y < -6) return { ...INITIAL, jumps };
+ return { x, y, vy, grounded, sinceGround, sincePress, held: jump, jumps };
+}
+
+function Platformer() {
+ const p = useGameState(INITIAL, step);
+ const stretch = Math.min(0.3, Math.abs(p.vy) * 0.02);
+ return (
+ <AbsoluteFill style={{ background: "#0e1726" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(p.x + 1.5, 2.4, 9).lookingAt([p.x + 1.5, 1.2, 0])} projection={{ Perspective: { fov: 0.785398163397448 } }} />
+ <AmbientLight brightness={180} />
+ <DirectionalLight transform={Transform.fromXyz(3, 8, 6).lookingAt([0, 0, 0])} illuminance={9600} shadow_maps_enabled />
+ {GROUND.map(([a, b, top], i) => (
+ <Mesh3d key={i} transform={Transform.fromXyz((a + b) / 2, top - 0.5, 0)}>
+ <Cuboid half_size={[(b - a) / 2, 0.5, 1]} />
+ <StandardMaterial base_color="#3d5a80" perceptual_roughness={0.9} />
+ </Mesh3d>
+ ))}
+ <Mesh3d transform={Transform.fromXyz(p.x, p.y + 0.4, 0).withScale([1 - stretch * 0.5, 1 + stretch, 1 - stretch * 0.5])} name="player">
+ <Cuboid half_size={[0.3, 0.4, 0.3]} />
+ <StandardMaterial base_color={p.grounded ? "#ee6c4d" : "#f6bd60"} perceptual_roughness={0.5} />
+ </Mesh3d>
+ </>
+ <div style={{ position: "absolute", left: 40, top: 28, fontFamily: "Inter", fontWeight: 700, fontSize: 30, color: "#e0fbfc" }}>{`jumps ${p.jumps} coyote ${COYOTE}s buffer ${BUFFER}s`}</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="platformer" component={Platformer} width={1280} height={720} fps={FPS} durationInFrames={FRAMES} />);
diff --git a/examples/games/screenshake.tsx b/examples/games/screenshake.tsx
new file mode 100644
index 00000000..19e28b06
--- /dev/null
+++ b/examples/games/screenshake.tsx
@@ -0,0 +1,66 @@
+// record: art-of-screenshake, juicing-cameras-trauma
+// Screen shake as trauma (Squirrel Eiserloh, "Juicing your cameras with math"): each impact adds trauma (0..1), the
+// shake is trauma squared, and the camera's offset and roll come from smooth noise rather than random jumps, so it
+// reads as a shake and not a glitch. Trauma decays linearly. Everything is a function of the frame: impacts are listed,
+// trauma at frame f is summed from them, and the noise is a fixed sum of sines.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Sphere } from "raea/3d";
+import { LinearRgba, Srgba } from "raea/color";
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+const FPS = 30;
+const IMPACTS = [{ f: 20, k: 0.5 }, { f: 70, k: 0.9 }, { f: 75, k: 0.4 }, { f: 120, k: 0.3 }];
+const DECAY = 1.2; // trauma per second
+const MAX_OFFSET = 0.35, MAX_ROLL = 0.06;
+
+function trauma(f: number): number {
+ let t = 0, last = 0;
+ for (const i of IMPACTS) {
+ if (i.f > f) break;
+ t = Math.max(0, t - ((i.f - last) / FPS) * DECAY);
+ t = Math.min(1, t + i.k);
+ last = i.f;
+ }
+ return Math.max(0, t - ((f - last) / FPS) * DECAY);
+}
+
+// smooth noise in [-1, 1]: incommensurate sines, a different seed per channel
+const noise = (t: number, seed: number) => (Math.sin(t * 13.1 + seed) + Math.sin(t * 21.7 + seed * 2.3) * 0.6 + Math.sin(t * 34.3 + seed * 4.1) * 0.3) / 1.9;
+
+function Shake() {
+ const f = useCurrentFrame();
+ const s = trauma(f) ** 2;
+ const t = f / FPS;
+ const ox = MAX_OFFSET * s * noise(t, 1), oy = MAX_OFFSET * s * noise(t, 7), roll = MAX_ROLL * s * noise(t, 13);
+ const hit = IMPACTS.find((i) => f >= i.f && f < i.f + 4);
+ return (
+ <AbsoluteFill style={{ background: "#1a1423" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(ox, 2 + oy, 7).lookingAt([ox * 0.5 + roll * 5, 0.8 + oy * 0.5, 0])} projection={{ Perspective: { fov: 0.785398163397448 } }} />
+ <AmbientLight brightness={160} />
+ <DirectionalLight transform={Transform.fromXyz(3, 7, 4).lookingAt([0, 0, 0])} illuminance={10400} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[6, 0.05, 4]} />
+ <StandardMaterial base_color="#c9ada7" perceptual_roughness={0.9} />
+ </Mesh3d>
+ {[-2, 0, 2].map((x, i) => (
+ <Mesh3d key={i} transform={Transform.fromXyz(x, 0.6, 0)}>
+ <Cuboid half_size={[0.5, 0.6, 0.5]} />
+ <StandardMaterial base_color={hit ? "#ffffff" : "#4a4e69"} perceptual_roughness={0.6} />
+ </Mesh3d>
+ ))}
+ <Mesh3d transform={Transform.fromXyz(0, hit ? 0.3 : 6, 1.5)} name="meteor">
+ <Sphere radius={0.3} />
+ <StandardMaterial base_color="#f2e9e4" emissive={LinearRgba.from(Srgba.hex("#ff7b00")).mul(2)} />
+ </Mesh3d>
+ </>
+ <div style={{ position: "absolute", left: 40, top: 28, fontFamily: "Inter", fontWeight: 700, fontSize: 30, color: "#f2e9e4" }}>{`trauma ${trauma(f).toFixed(2)} shake ${s.toFixed(2)}`}</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="screenshake" component={Shake} width={1280} height={720} fps={FPS} durationInFrames={150} />);
diff --git a/examples/games/shapes.tsx b/examples/games/shapes.tsx
new file mode 100644
index 00000000..e6d81585
--- /dev/null
+++ b/examples/games/shapes.tsx
@@ -0,0 +1,38 @@
+// record: bevy-3d-rendering-3d-shapes
+// Bevy's "3D shapes" example in raea's SDK: a row of primitives turning on a floor under a key light.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Cone, Cylinder, Sphere, Torus } from "raea/3d";
+import { StandardMaterial } from "raea/pbr";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Quat, Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Cuboid, Mesh3d } from "raea/mesh";
+
+const COLOURS = ["#e76f51", "#f4a261", "#e9c46a", "#2a9d8f", "#457b9d"];
+
+function Shapes() {
+ const f = useCurrentFrame();
+ const spin = f * 0.04;
+ const shapes = [<Cuboid half_size={[0.45, 0.45, 0.45]} />, <Sphere radius={0.55} />, <Cylinder radius={0.45} half_height={0.5} />, <Cone radius={0.55} height={1.1} />, <Torus major_radius={0.42} minor_radius={0.16} />];
+ return (
+ <AbsoluteFill style={{ background: "#14181f" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 3, 8).lookingAt([0, 0.5, 0])} projection={{ Perspective: { fov: 0.698131700797732 } }} />
+ <AmbientLight brightness={140} />
+ <DirectionalLight transform={Transform.fromXyz(4, 8, 6).lookingAt([0, 0, 0])} illuminance={10400} shadow_maps_enabled />
+ <Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}>
+ <Cuboid half_size={[7, 0.05, 3]} />
+ <StandardMaterial base_color="#cfc8ba" perceptual_roughness={0.95} />
+ </Mesh3d>
+ {shapes.map((g, i) => (
+ <Mesh3d key={i} transform={Transform.fromXyz((i - 2) * 2, 0.75, 0).withRotation(Quat.fromEuler("XYZ", spin * 0.5, spin + i, 0))} name={`shape-${i}`}>
+ {g}
+ <StandardMaterial base_color={COLOURS[i]} perceptual_roughness={0.45} />
+ </Mesh3d>
+ ))}
+ </>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="shapes" component={Shapes} width={1280} height={720} fps={30} durationInFrames={90} />);
diff --git a/examples/headless/codecs-device.ts b/examples/headless/codecs-device.ts
new file mode 100644
index 00000000..2a0d8597
--- /dev/null
+++ b/examples/headless/codecs-device.ts
@@ -0,0 +1,34 @@
+// mediabunny on the engine's coders, run where it lands (the iPhone probe runs it in the app's Documents folder with
+// clip.mp4 beside it): a probe, a trim, a proxy, 16 kHz audio and a remux, each written beside the clip for checking
+// against ffmpeg on the Mac (sdk/raea/tools/media-vs-ffmpeg.sh's jobs, on the device's VideoToolbox).
+import { BufferTarget, Conversion, Mp4OutputFormat, Output, WavOutputFormat } from "mediabunny";
+import { fileInput, nativeScale, saveTarget, transcode, useNativeMedia } from "raea/codecs";
+import { print } from "raea/native";
+
+const now = () => (globalThis as any).__raea_now() as number;
+
+async function convert(name: string, format: Mp4OutputFormat | WavOutputFormat, opts: Record<string, unknown>) {
+ const t = now();
+ const out = new Output({ format, target: new BufferTarget() });
+ const c = await Conversion.init({ input: fileInput("clip.mp4"), output: out, ...opts });
+ await c.execute();
+ saveTarget(out.target as BufferTarget, name);
+ print(`${name} in ${(now() - t).toFixed(0)} ms`);
+}
+
+export default async function main() {
+ useNativeMedia();
+ const input = fileInput("clip.mp4");
+ const v = (await input.getPrimaryVideoTrack())!;
+ const a = await input.getPrimaryAudioTrack();
+ const stats = await v.computePacketStats();
+ print("PROBE " + JSON.stringify({ duration: await input.computeDuration(), width: v.displayWidth, height: v.displayHeight, codec: v.codec, frames: stats.packetCount, audio: a ? { codec: a.codec, rate: a.sampleRate, channels: a.numberOfChannels } : null }));
+ await convert("trim.mp4", new Mp4OutputFormat(), { trim: { start: 1, end: 3 }, video: { codec: "avc", forceTranscode: true } });
+ const h = 720, w = Math.round((v.displayWidth * h) / v.displayHeight / 2) * 2;
+ await convert("proxy.mp4", new Mp4OutputFormat(), { video: { codec: "avc", forceTranscode: true, process: nativeScale(w, h), processedWidth: w, processedHeight: h }, audio: { discard: true } });
+ await convert("a16.wav", new WavOutputFormat(), { video: { discard: true }, audio: { sampleRate: 16000, numberOfChannels: 1, codec: "pcm-s16" } });
+ await convert("remux.mp4", new Mp4OutputFormat(), {});
+ const t = now();
+ const r = transcode("clip.mp4", "native-proxy.mp4", { height: 720 });
+ print(`native-proxy.mp4 in ${(now() - t).toFixed(0)} ms (${r.frames} frames)`);
+}
diff --git a/examples/headless/solids-and-worlds.ts b/examples/headless/solids-and-worlds.ts
new file mode 100644
index 00000000..e764d17f
--- /dev/null
+++ b/examples/headless/solids-and-worlds.ts
@@ -0,0 +1,57 @@
+// Headless TypeScript against the engine (raea run): Manifold solids as native handles, and an ECS world whose
+// tables live in Rust, each checked against answers known in closed form, and a world stepped by a system.
+// raea run examples/headless/solids-and-worlds.ts
+import { manifold } from "raea/3d";
+import { createWorld } from "raea/ecs";
+import { print } from "raea/native";
+
+let failed = 0;
+function check(what: string, got: number, want: number, tol = 1e-6) {
+ const ok = Math.abs(got - want) <= tol;
+ if (!ok) failed++;
+ print(`${ok ? "PASS" : "FAIL"} ${what}: ${got.toFixed(6)} (want ${want.toFixed(6)})`);
+}
+const now = () => (globalThis as any).__raea_now() as number;
+
+export default function main() {
+ // solids
+ const box = manifold.box(2, 1, 0.5);
+ check("box(2, 1, 0.5) volume", box.volume(), 1);
+ const bored = manifold.box(2, 2, 2).minus(manifold.cylinder(0.5, 3));
+ check("a box with a 0.5 bore through it", bored.volume(), 8 - Math.PI * 0.25 * 2, 0.02);
+ check("its middle slice's area", bored.slice(0).area, 4 - Math.PI * 0.25, 0.02);
+ check("the bore is a hole: contours in the slice", bored.slice(0).contours, 2, 0);
+ const moved = box.move(0, 0, 5);
+ check("moved up 5: bottom", moved.bounds().min[2], 4.75);
+ const sign = manifold.roundedBox(2.4, 1.1, 0.25, 0.08).minus(manifold.text3d("SALE", 0.62, 0.6));
+ check("SALE cut through the sign takes volume away", sign.volume() < manifold.roundedBox(2.4, 1.1, 0.25, 0.08).volume() ? 1 : 0, 1, 0);
+ print(` the sign: ${sign.triangles()} triangles, expression ${sign.expr.slice(0, 60)}...`);
+ const nothing = box.minus(manifold.box(3, 3, 3));
+ check("a boolean that leaves nothing is empty", nothing.isEmpty() ? 1 : 0, 1, 0);
+
+ // a world: 10 000 balls falling one unit a frame; a system takes away those past y 95
+ const w = createWorld();
+ check("the world's tables are native", w.native ? 1 : 0, 1, 0);
+ for (let i = 0; i < 10000; i++) w.spawn("ball", { x: i % 100, y: Math.floor(i / 100), color: i % 2 ? "red" : "blue" });
+ w.system((world) => {
+ for (const id of world.query("ball", [["y", ">=", 95]])) world.despawn(id);
+ for (const id of world.query("ball")) world.set(id, { y: world.get(id).y as number + 1 });
+ });
+ check("before frame 0: 10 000 balls", w.count("ball"), 10000, 0);
+ // rows 0..99 start at y 0..99; after f frames the ones that started at y >= 95 - f + 1 are gone
+ check("after 10 frames (frame 10)", w.at(10).count("ball"), 100 * 86, 0);
+ check("frame 10 asked again is the same", w.at(10).count("ball"), 100 * 86, 0);
+ check("a query by string column", w.query("ball", [["color", "==", "red"]]).length, 5000, 0);
+
+ // speed: one filter over 100 000 rows, native tables against TypeScript's, in the same (jitless) V8
+ for (const native of [true, false]) {
+ const big = createWorld({ native });
+ for (let i = 0; i < 100000; i++) big.spawn("p", { v: i % 1000 });
+ const t = now();
+ let n = 0;
+ for (let k = 0; k < 20; k++) n = big.query("p", [["v", "<", 100]]).length;
+ print(` ${native ? "native" : "TypeScript"} tables: 20 filters over 100 000 rows in ${(now() - t).toFixed(1)} ms (${n} each)`);
+ }
+ print(failed === 0 ? "all checks pass" : `${failed} checks FAIL`);
+ if (failed) throw new Error(`${failed} checks failed`);
+}
diff --git a/examples/objects/bunting.tsx b/examples/objects/bunting.tsx
new file mode 100644
index 00000000..7ebbaecf
--- /dev/null
+++ b/examples/objects/bunting.tsx
@@ -0,0 +1,90 @@
+// Bunting, built from raea/3d's public parts (docs/examples.feature EX5): copy it and make it yours.
+import { manifold, toHex, type Solid, type Vec3 } from "raea/3d";
+import { StandardMaterial } from "raea/pbr";
+import { Mesh3d } from "raea/mesh";
+
+function vec(owner: string, k: string, v: unknown): Vec3 {
+ if (!Array.isArray(v) || v.length !== 3 || !v.every((n) => typeof n === "number" && Number.isFinite(n))) throw new TypeError(`${owner}: ${k} must be three finite numbers [x, y, z], got ${JSON.stringify(v)}`);
+ return v as Vec3;
+}
+
+export interface BuntingProps {
+ name: string;
+ /** where the line's tied at each end, world metres */
+ from: Vec3;
+ to: Vec3;
+ /** how far it sags at the middle (0.12 of its length) */
+ sag?: number;
+ /** flags along it (12), their colours in turn, their size (0.35 m tall) */
+ flags?: number;
+ colors?: string[];
+ size?: number;
+ /** the line's colour */
+ line?: string;
+}
+
+const buntingCache = new Map<string, { line: Solid; flags: (Solid | null)[] }>();
+
+/** A string of triangular flags hung between two points on a catenary. Its solids are made once per set of props. */
+export function Bunting(props: BuntingProps) {
+ const from = vec("Bunting", "from", props.from);
+ const to = vec("Bunting", "to", props.to);
+ const colors = (props.colors ?? ["#d8443a", "#f2c84b", "#3f7cc4", "#f4f1ea"]).map((c) => toHex("Bunting", "colors", c));
+ const n = props.flags ?? 12;
+ if (!(Number.isInteger(n) && n >= 1 && n <= 64)) throw new RangeError(`Bunting: flags must be a whole number from 1 to 64, got ${n}`);
+ const size = props.size ?? 0.35;
+ const L = Math.hypot(to[0] - from[0], to[1] - from[1], to[2] - from[2]);
+ const sag = (props.sag ?? 0.12) * L;
+ const key = JSON.stringify([from, to, sag, n, size, colors.length]);
+ let made = buntingCache.get(key);
+ if (!made) {
+ // a catenary through both ends, dropping `sag` at the middle (a cosh shape, close enough to a hung line)
+ const at = (u: number): Vec3 => {
+ const c = 3;
+ const drop = sag * (1 - (Math.cosh(c * (2 * u - 1)) - 1) / (Math.cosh(c) - 1));
+ return [from[0] + (to[0] - from[0]) * u, from[1] + (to[1] - from[1]) * u - drop, from[2] + (to[2] - from[2]) * u];
+ };
+ const segs: Solid[] = [];
+ const k = 24;
+ const r = Math.max(0.01, size * 0.04);
+ for (let i = 0; i < k; i++) {
+ const a = at(i / k);
+ const b = at((i + 1) / k);
+ const pts: Vec3[] = [];
+ for (const q of [a, b]) for (const sx of [-r, r]) for (const sy of [-r, r]) for (const sz of [-r, r]) pts.push([q[0] + sx, q[1] + sy, q[2] + sz]);
+ segs.push(manifold.hull(pts));
+ }
+ const dx = (to[0] - from[0]) / L;
+ const dz = (to[2] - from[2]) / L;
+ const nz = [-dz, dx];
+ const byColour: Solid[][] = colors.map(() => []);
+ for (let i = 0; i < n; i++) {
+ const u0 = (i + 0.15) / n;
+ const u1 = (i + 0.85) / n;
+ const a = at(u0);
+ const b = at(u1);
+ const m = at((u0 + u1) / 2);
+ const tip: Vec3 = [m[0], m[1] - size, m[2]];
+ const th = 0.01;
+ const pts: Vec3[] = [];
+ for (const s of [-th, th]) for (const p of [a, b, tip]) pts.push([p[0] + nz[0] * s, p[1], p[2] + nz[1] * s]);
+ byColour[i % colors.length].push(manifold.hull(pts));
+ }
+ made = { line: manifold.compose(...segs), flags: byColour.map((f) => (f.length ? manifold.compose(...f) : null)) };
+ buntingCache.set(key, made);
+ }
+ return (
+ <>
+ <Mesh3d name={`${props.name}-line`} shape={made.line}>
+ <StandardMaterial base_color={toHex("Bunting", "line", props.line ?? "#3a3430")} />
+ </Mesh3d>
+ {made.flags.map((f, i) =>
+ f === null ? null : (
+ <Mesh3d key={i} name={`${props.name}-flags-${i}`} shape={f}>
+ <StandardMaterial base_color={colors[i]} />
+ </Mesh3d>
+ ),
+ )}
+ </>
+ );
+}
diff --git a/examples/objects/wake.tsx b/examples/objects/wake.tsx
new file mode 100644
index 00000000..d4990c8d
--- /dev/null
+++ b/examples/objects/wake.tsx
@@ -0,0 +1,89 @@
+// A boat's wake, built from raea/3d's public parts (docs/examples.feature EX5): copy it and make it yours.
+import { useCurrentFrame, useVideoConfig } from "raea";
+import { toHex, type Vec3 } from "raea/3d";
+import { StandardMaterial } from "raea/pbr";
+import { Quat, Transform } from "raea/transform";
+import { Cuboid, Mesh3d } from "raea/mesh";
+
+/** small seeded random numbers, the same for the same seed */
+function rng(seed: number) {
+ let s = (Math.floor(seed) * 2654435761 + 1013904223) >>> 0 || 1;
+ return () => {
+ s ^= s << 13;
+ s >>>= 0;
+ s ^= s >>> 17;
+ s ^= s << 5;
+ s >>>= 0;
+ return s / 4294967296;
+ };
+}
+
+export interface WakeProps {
+ name: string;
+ /** where the boat is at a time (seconds) and which way it's heading (a unit [x, z]), on the water */
+ path: (t: number) => { at: Vec3; heading: [number, number] };
+ /** the water's height (the path's y by default) */
+ y?: number;
+ /** seconds of wake behind the boat (4) in this many segments an arm (14) */
+ length?: number;
+ segments?: number;
+ /** how fast the arms open sideways (0.5 m/s) and how wide a segment's foam is when new (0.12 m) and old (0.6 m) */
+ spread?: number;
+ width?: number;
+ oldWidth?: number;
+ color?: string;
+ time?: number;
+}
+
+/** A boat's wake: two arms of broken white foam opening behind it in a V, and the churn at its stern, laid flat on the
+ * water. Segments are matched by name across frames; the look's rag breaks their edges. */
+export function Wake(props: WakeProps) {
+ const frame = useCurrentFrame();
+ const { fps } = useVideoConfig();
+ const t = props.time ?? frame / fps;
+ const n = props.segments ?? 14;
+ const len = props.length ?? 4;
+ const spread = props.spread ?? 0.5;
+ const w0 = props.width ?? 0.12;
+ const w1 = props.oldWidth ?? 0.6;
+ const color = toHex("Wake", "color", props.color ?? "#ffffff");
+ const r = rng(n * 31 + 5);
+ const jit = Array.from({ length: n * 2 }, () => r());
+ const parts = [];
+ for (let arm = -1; arm <= 1; arm += 2) {
+ for (let i = 0; i < n; i++) {
+ const a0 = (i / n) * len;
+ const a1 = ((i + 0.8) / n) * len;
+ const p0 = props.path(t - a0);
+ const p1 = props.path(t - a1);
+ const sx = (p: { heading: [number, number] }, age: number) => [-p.heading[1] * arm * (0.25 + spread * age), p.heading[0] * arm * (0.25 + spread * age)];
+ const o0 = sx(p0, a0);
+ const o1 = sx(p1, a1);
+ const x0 = p0.at[0] + o0[0];
+ const z0 = p0.at[2] + o0[1];
+ const x1 = p1.at[0] + o1[0];
+ const z1 = p1.at[2] + o1[1];
+ const y = props.y ?? p0.at[1];
+ const age = (a0 + a1) / 2 / len;
+ const w = w0 + (w1 - w0) * age * (0.6 + 0.8 * jit[i + (arm > 0 ? n : 0)]);
+ // the oldest foam breaks up: fewer, shorter pieces
+ const keep = age < 0.55 || jit[i + (arm > 0 ? n : 0)] > age * 0.9;
+ const l = Math.hypot(x1 - x0, z1 - z0) * (keep ? 1 : 0.001);
+ parts.push(
+ <Mesh3d key={`${arm}-${i}`} transform={Transform.fromXyz((x0 + x1) / 2, y + 0.01, (z0 + z1) / 2).withRotation(Quat.fromEuler("XYZ", 0, -Math.atan2(z1 - z0, x1 - x0), 0)).withScale([Math.max(l, 0.001), 1, keep ? w : 0.001])} name={`${props.name}-${arm}-${i}`}>
+ <Cuboid half_size={[0.5, 0.01, 0.5]} />
+ <StandardMaterial base_color={color} unlit />
+ </Mesh3d>,
+ );
+ }
+ }
+ // the churn at the stern
+ const s = props.path(t - 0.05);
+ parts.push(
+ <Mesh3d key="stern" transform={Transform.fromXyz(s.at[0] - s.heading[0] * 0.2, (props.y ?? s.at[1]) + 0.012, s.at[2] - s.heading[1] * 0.2).withRotation(Quat.fromEuler("XYZ", 0, -Math.atan2(s.heading[1], s.heading[0]), 0)).withScale([1.1, 1, 0.5])} name={`${props.name}-stern`}>
+ <Cuboid half_size={[0.5, 0.01, 0.5]} />
+ <StandardMaterial base_color={color} unlit />
+ </Mesh3d>,
+ );
+ return <>{parts}</>;
+}
diff --git a/examples/parts/brand/callout.tsx b/examples/parts/brand/callout.tsx
new file mode 100644
index 00000000..105037bf
--- /dev/null
+++ b/examples/parts/brand/callout.tsx
@@ -0,0 +1,25 @@
+// raea part add callout: a short labelled card that slides in with the line it supports (a step, a claim, a stat), in the
+// band away from the face. Put it in a <Sequence from durationInFrames> timed to the words (word("phrase") finds them).
+import { Easing, Region, interpolate, useCurrentFrame } from "raea";
+
+type Props = {
+ /** the small line above: "Step 1", "Fact", "New" */
+ label?: string;
+ title: string;
+ detail?: string;
+ region?: "auto" | "top" | "bottom" | "center";
+};
+
+export default function Callout({ label, title, detail, region = "top" }: Props) {
+ const f = useCurrentFrame();
+ const t = interpolate(f, [0, 10], [0, 1], { extrapolateRight: "clamp", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });
+ return (
+ <Region name={region}>
+ <div style={{ opacity: t, transform: `translateY(${(1 - t) * 40}px)` }} className="mx-auto max-w-[86%] rounded-brand bg-brand-surface px-10 py-8 font-brand text-brand-on-surface shadow-xl">
+ {label ? <div className="mb-2 text-label font-bold uppercase tracking-widest text-brand-accent">{label}</div> : null}
+ <div className="text-title font-extrabold leading-tight">{title}</div>
+ {detail ? <div className="mt-2 text-body opacity-80">{detail}</div> : null}
+ </div>
+ </Region>
+ );
+}
diff --git a/examples/parts/brand/captions.tsx b/examples/parts/brand/captions.tsx
new file mode 100644
index 00000000..5d30bbab
--- /dev/null
+++ b/examples/parts/brand/captions.tsx
@@ -0,0 +1,35 @@
+// raea part add captions: the spoken words, a few at a time, the word being said lit. Reads the edit's words itself
+// (useWords(): `raea cut` writes them beside cuts.ts). Sits in the bottom band (parts take the top by default, so they
+// never share one), on the brand's surface with its own text colour, a pair the kit keeps readable on any footage.
+// Styled only from the brand's tokens (brand/brand.css); change anything here, it's yours.
+import { Region, useCurrentFrame, useWords } from "raea";
+
+type Props = {
+ /** words on screen at once */
+ per?: number;
+ /** where: "bottom" by default (parts default to "top"); "auto" keeps clear of the face */
+ region?: "auto" | "top" | "bottom" | "center";
+};
+
+export default function Captions({ per = 3, region = "bottom" }: Props) {
+ const f = useCurrentFrame();
+ const words = useWords();
+ const i = words.findIndex((w) => f >= w.from && f < w.to);
+ // between words, the last group stays up until the next word starts
+ const at = i >= 0 ? i : words.findLastIndex((w) => w.to <= f);
+ if (at < 0) return null;
+ const start = at - (at % per);
+ const group = words.slice(start, start + per);
+ if (group.length === 0 || f >= group[group.length - 1].to + 6) return null;
+ return (
+ <Region name={region}>
+ <div className="flex justify-center">
+ <div className="flex max-w-[90%] flex-wrap justify-center gap-x-[0.28em] rounded-brand bg-brand-surface px-8 py-4 text-center font-brand text-caption font-extrabold leading-tight text-brand-on-surface shadow-xl">
+ {group.map((w, k) => (
+ <span key={k} className={start + k === i ? "text-brand-accent" : ""}>{w.text}</span>
+ ))}
+ </div>
+ </div>
+ </Region>
+ );
+}
diff --git a/examples/parts/brand/end-card.tsx b/examples/parts/brand/end-card.tsx
new file mode 100644
index 00000000..eb1b7716
--- /dev/null
+++ b/examples/parts/brand/end-card.tsx
@@ -0,0 +1,26 @@
+// raea part add end-card: the closing card: the brand's name or logo, one line, and the ask (follow, shop, try). Give it the
+// last 2 to 3 seconds in a <Sequence>; it fades in over the footage or a fill of the brand's background.
+import { AbsoluteFill, Img, interpolate, useCurrentFrame } from "raea";
+
+type Props = {
+ name: string;
+ /** a logo file under media/ (optional) */
+ logo?: string;
+ line?: string;
+ /** the ask: "Shop now", "Link in bio" */
+ cta?: string;
+ /** cover the footage with the brand's background (default) or sit on it */
+ fill?: boolean;
+};
+
+export default function EndCard({ name, logo, line, cta, fill = true }: Props) {
+ const f = useCurrentFrame();
+ const t = interpolate(f, [0, 12], [0, 1], { extrapolateRight: "clamp" });
+ return (
+ <AbsoluteFill style={{ opacity: t }} className={`${fill ? "bg-brand-bg" : ""} flex flex-col items-center justify-center gap-8 px-16 text-center font-brand text-brand-ink`}>
+ {logo ? <Img src={logo} className="h-40 object-contain" /> : <div className="text-display font-black">{name}</div>}
+ {line ? <div className="text-title font-bold">{line}</div> : null}
+ {cta ? <div className="rounded-full bg-brand-accent px-12 py-5 text-title font-extrabold text-brand-on-accent">{cta}</div> : null}
+ </AbsoluteFill>
+ );
+}
diff --git a/examples/parts/brand/face-frame.tsx b/examples/parts/brand/face-frame.tsx
new file mode 100644
index 00000000..97df4cdb
--- /dev/null
+++ b/examples/parts/brand/face-frame.tsx
@@ -0,0 +1,18 @@
+// raea part add face-frame: a talking take cropped around the face for the edit's shape. The engine finds the face
+// itself (framing="face": raea-perceive's eye track, kept beside the take as TAKE.faces.json) and keeps the eyes 38%
+// down the frame as the speaker moves; punchIn tightens it (1.15 is a usual punch-in for emphasis). An objectPosition or
+// transform of your own on the Video turns the framing off, so this part sets neither.
+import { Video } from "raea";
+
+type Props = {
+ src: string;
+ startFrom?: number;
+ endAt?: number;
+ /** 1 = framed to fit; above 1 = tighter */
+ punchIn?: number;
+ volume?: number;
+};
+
+export default function FaceFrame({ src, startFrom, endAt, punchIn = 1, volume = 1 }: Props) {
+ return <Video src={src} startFrom={startFrom} endAt={endAt} framing="face" punchIn={punchIn} volume={volume} style={{ width: "100%", height: "100%" }} />;
+}
diff --git a/examples/parts/brand/follow.tsx b/examples/parts/brand/follow.tsx
new file mode 100644
index 00000000..19c82f59
--- /dev/null
+++ b/examples/parts/brand/follow.tsx
@@ -0,0 +1,16 @@
+// raea part add follow: the ask as a pill that hugs its text ("Follow for part 2", "Shop the stack"). Give it the moment the
+// speaker asks, or the last seconds.
+import { Region, interpolate, useCurrentFrame } from "raea";
+
+type Props = { text: string; region?: "auto" | "top" | "bottom" | "center" };
+
+export default function Follow({ text, region = "top" }: Props) {
+ const t = interpolate(useCurrentFrame(), [0, 10], [0, 1], { extrapolateRight: "clamp" });
+ return (
+ <Region name={region}>
+ <div className="flex justify-center">
+ <div style={{ opacity: t, transform: `scale(${0.85 + 0.15 * t})` }} className="rounded-full bg-brand-accent px-12 py-5 font-brand text-title font-extrabold text-brand-on-accent shadow-xl">{text}</div>
+ </div>
+ </Region>
+ );
+}
diff --git a/examples/parts/brand/lockup.tsx b/examples/parts/brand/lockup.tsx
new file mode 100644
index 00000000..9e29cc2e
--- /dev/null
+++ b/examples/parts/brand/lockup.tsx
@@ -0,0 +1,33 @@
+// raea part add lockup: a few lines stacked big, each landing as it's said. " / " splits the lines; *word* marks the accent.
+// Put it in a <Sequence> over the words it echoes; each line appears on its first word (or one by one, 8 frames apart,
+// when the line isn't said). Styled only from the brand's tokens.
+import { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from "raea";
+
+type Props = { text: string; region?: "auto" | "top" | "bottom" | "center"; small?: boolean };
+
+export default function Lockup({ text, region = "top", small = false }: Props) {
+ const f = useCurrentFrame();
+ const words = useWords();
+ const lines = text.split(" / ");
+ const at = (line: string, i: number) => {
+ try {
+ return findPhrase(words, line.replace(/\*/g, "").split(/\s+/).slice(0, 2).join(" "));
+ } catch {
+ return i * 8;
+ }
+ };
+ return (
+ <Region name={region}>
+ <div className={`flex flex-col items-center gap-2 text-center font-brand font-black uppercase leading-none text-brand-ink [text-shadow:0_4px_24px_rgba(0,0,0,0.5)] ${small ? "text-title" : "text-display"}`}>
+ {lines.map((line, i) => {
+ const t = interpolate(f - at(line, i), [0, 8], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });
+ return (
+ <div key={i} style={{ opacity: t, transform: `translateY(${(1 - t) * 30}px) scale(${0.92 + 0.08 * t})` }}>
+ {line.split(/(\*[^*]+\*)/).map((part, k) => (part.startsWith("*") ? <span key={k} className="text-brand-accent">{part.slice(1, -1)}</span> : <span key={k}>{part}</span>))}
+ </div>
+ );
+ })}
+ </div>
+ </Region>
+ );
+}
diff --git a/examples/parts/brand/notthat.tsx b/examples/parts/brand/notthat.tsx
new file mode 100644
index 00000000..25769e5a
--- /dev/null
+++ b/examples/parts/brand/notthat.tsx
@@ -0,0 +1,34 @@
+// raea part add notthat: a lead statement, then the idea it rejects on a card, struck through when the speaker says
+// strikeSay ("not X, but Y"). strikeSay is a phrase from the transcript, word for word.
+import { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from "raea";
+
+type Props = { lead: string; not: string; strikeSay?: string; region?: "auto" | "top" | "bottom" | "center" };
+
+// " / " splits lines and *word* marks the accent, as in a lockup
+const lines = (t: string) =>
+ t.split(" / ").map((line, i) => (
+ <div key={i}>{line.split(/(\*[^*]+\*)/).map((p, k) => (p.startsWith("*") ? <span key={k} className="text-brand-accent">{p.slice(1, -1)}</span> : <span key={k}>{p}</span>))}</div>
+ ));
+
+export default function NotThat({ lead, not, strikeSay, region = "top" }: Props) {
+ const f = useCurrentFrame();
+ const words = useWords();
+ let at = 24;
+ if (strikeSay) {
+ try { at = findPhrase(words, strikeSay); } catch { at = 24; }
+ }
+ const ease = (from: number, len = 10) => interpolate(f - from, [0, len], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });
+ const card = ease(6);
+ const strike = ease(at, 8);
+ return (
+ <Region name={region}>
+ <div className="flex flex-col items-center gap-6 text-center font-brand">
+ <div style={{ opacity: ease(0) }} className="rounded-brand bg-brand-surface px-8 py-4 text-title font-extrabold text-brand-on-surface">{lines(lead)}</div>
+ <div style={{ opacity: card, transform: `scale(${0.9 + 0.1 * card})` }} className="relative rounded-brand bg-brand-surface px-10 py-6 text-title font-extrabold text-brand-on-surface shadow-xl">
+ <span style={{ opacity: 1 - 0.45 * strike }}>{lines(not)}</span>
+ <div className="absolute left-6 right-6 top-1/2 h-2 rounded-full bg-brand-accent" style={{ transform: `scaleX(${strike})`, transformOrigin: "left" }} />
+ </div>
+ </div>
+ </Region>
+ );
+}
diff --git a/examples/parts/brand/screen-fit.tsx b/examples/parts/brand/screen-fit.tsx
new file mode 100644
index 00000000..5b828950
--- /dev/null
+++ b/examples/parts/brand/screen-fit.tsx
@@ -0,0 +1,27 @@
+// raea part add screen-fit: a landscape screen recording shown whole in a vertical frame, over a soft fill of itself, instead
+// of a cover crop that cuts its sides off (every app render on 2026-10-16 lost Jetflow's UI that way). `raea frame`
+// says when a take wants this. Leaves the space above and below for a headline and captions.
+import { AbsoluteFill, Video, useVideoConfig } from "raea";
+
+type Props = {
+ src: string;
+ /** source frames, as <Video> takes them */
+ startFrom?: number;
+ endAt?: number;
+ /** the recording's own aspect (width / height); 16/9 when not given */
+ aspect?: number;
+ /** where its centre sits, as a share of the frame's height (0.5 = the middle) */
+ y?: number;
+};
+
+export default function ScreenFit({ src, startFrom, endAt, aspect = 16 / 9, y = 0.5 }: Props) {
+ const { width, height } = useVideoConfig();
+ const h = width / aspect;
+ const top = Math.max(0, Math.min(height - h, height * y - h / 2));
+ return (
+ <AbsoluteFill className="bg-brand-bg">
+ <Video src={src} startFrom={startFrom} endAt={endAt} muted style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", opacity: 0.35, filter: "blur(40px)" }} />
+ <Video src={src} startFrom={startFrom} endAt={endAt} style={{ position: "absolute", left: 0, top, width, height: h, objectFit: "contain" }} className="rounded-brand shadow-2xl" />
+ </AbsoluteFill>
+ );
+}
diff --git a/examples/parts/brand/statcard.tsx b/examples/parts/brand/statcard.tsx
new file mode 100644
index 00000000..607d9533
--- /dev/null
+++ b/examples/parts/brand/statcard.tsx
@@ -0,0 +1,43 @@
+// raea part add statcard: a number and up to three lines beside it (*word* marks the accent), and up to two labelled bars
+// that fill on the words that say them. Use it only when the footage says a real number; every claim comes from the
+// brand's own material or the take. *_say props are phrases from the transcript, word for word.
+import { Easing, Region, findPhrase, interpolate, useCurrentFrame, useWords } from "raea";
+
+type Bar = { label: string; value: number; say?: string };
+type Props = { big: string; bigSay?: string; l1?: string; l2?: string; l3?: string; bars?: Bar[]; region?: "auto" | "top" | "bottom" | "center" };
+
+const accent = (s: string) => s.split(/(\*[^*]+\*)/).map((p, k) => (p.startsWith("*") ? <span key={k} className="text-brand-accent">{p.slice(1, -1)}</span> : <span key={k}>{p}</span>));
+
+export default function StatCard({ big, bigSay, l1, l2, l3, bars = [], region = "top" }: Props) {
+ const f = useCurrentFrame();
+ const words = useWords();
+ const when = (say: string | undefined, d: number) => {
+ if (!say) return d;
+ try { return findPhrase(words, say); } catch { return d; }
+ };
+ const ease = (from: number, len = 10) => interpolate(f - from, [0, len], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.bezier(0.05, 0.7, 0.1, 1) });
+ const t = ease(when(bigSay, 0));
+ return (
+ <Region name={region}>
+ <div style={{ opacity: t, transform: `translateY(${(1 - t) * 40}px)` }} className="mx-auto w-[86%] rounded-brand bg-brand-surface p-10 font-brand text-brand-on-surface shadow-xl">
+ <div className="flex items-center gap-8">
+ <div className="text-display font-black leading-none text-brand-accent">{big}</div>
+ <div className="flex flex-col text-body font-bold leading-snug">
+ {l1 ? <div>{accent(l1)}</div> : null}
+ {l2 ? <div>{accent(l2)}</div> : null}
+ {l3 ? <div>{accent(l3)}</div> : null}
+ </div>
+ </div>
+ {bars.map((b, i) => {
+ const fill = ease(when(b.say, 12 + i * 10), 18);
+ return (
+ <div key={i} className="mt-6">
+ <div className="mb-2 flex justify-between text-label font-bold uppercase"><span>{b.label}</span><span>{Math.round(b.value * fill)}%</span></div>
+ <div className="h-5 w-full rounded-full bg-brand-3"><div className="h-5 rounded-full bg-brand-accent" style={{ width: `${b.value * fill}%` }} /></div>
+ </div>
+ );
+ })}
+ </div>
+ </Region>
+ );
+}
diff --git a/examples/parts/reel/all.ts b/examples/parts/reel/all.ts
new file mode 100644
index 00000000..755a05c8
--- /dev/null
+++ b/examples/parts/reel/all.ts
@@ -0,0 +1,6 @@
+// Every part of index.tsx, in the order they load: each after what it uses while it loads. The parts import
+// each other only from here, so this order holds whichever is reached first.
+export * from "./core";
+export * from "./band";
+export * from "./cards";
+export * from "./captions";
diff --git a/examples/parts/reel/band.tsx b/examples/parts/reel/band.tsx
new file mode 100644
index 00000000..812bf8c3
--- /dev/null
+++ b/examples/parts/reel/band.tsx
@@ -0,0 +1,171 @@
+// The band's parts: words landed, Hook and StatCard.
+import { useContext } from "react";
+import { findPhrase, useCurrentFrame, useWords } from "raea";
+import { PARTS } from "./layout";
+import { ACCENT, BLIP, BODY, CARD, Cue, Hit, INK, OVER, POP, THUD, TOP, TopContext, W, Words, accent, ems, fit, key, lines, lockup, part, plain, rise, type } from "./all";
+
+// ---- the band's parts --------------------------------------------------------------------------------------------
+
+/** One line of a lockup: the accent lines pop, the rest rise; each lands when it's said (or with the part). */
+export function LockLine({ line, at, size, f }: { line: string; at: number; size: number; f: number }) {
+ const hot = line.startsWith("*") && line.endsWith("*") && !line.slice(1, -1).includes("*");
+ const local = f - at;
+ return (
+ <div style={{ height: Math.round(size * 0.92), marginBottom: 14, opacity: local >= 0 ? 1 : 0 }}>
+ <div style={{ ...type(size, hot ? ACCENT : OVER), textAlign: "center", transform: hot ? `scale(${key(local, POP)})` : `translateY(${rise(local)}px)` }}>{accent(line)}</div>
+ </div>
+ );
+}
+
+/** each line's landing frame (local): a plain line lands with the part, two frames after the line before it; a line
+ * with an *accent* (or every line, `wait`) waits for its first two words, or its first word alone, said inside the
+ * part, else lands with the line before it (or, `strict`, is refused by name, saying where it is said: `from` is the
+ * part's first frame in the composition, which the words are local to); lines land in order */
+export function landings(words: Words, ls: string[], len: number, first = 0, wait = false, strict = "", from = 0): number[] {
+ const out: number[] = []
+ const said = (phrase: string, after: number) => {
+ for (let n = 1; n < 20; n++) {
+ try {
+ const f = findPhrase(words, phrase, { occurrence: n })
+ if (f >= len - 6) return undefined
+ if (f >= after) return f
+ } catch {
+ return undefined
+ }
+ }
+ return undefined
+ }
+ ls.forEach((l, i) => {
+ const prev = i ? out[i - 1] : first
+ if (!wait && !l.includes("*")) return void out.push(i ? prev + 2 : first)
+ const ws = plain(l).split(/\s+/)
+ const at = said(ws.slice(0, 2).join(" "), prev) ?? (ws[0].length >= 3 && !strict ? said(ws[0], prev) : undefined)
+ if (at === undefined && strict) throw new Error(`<${strict}> line "${plain(l)}" ${unsaid(words, ws.slice(0, 2).join(" "), len, from, i ? undefined : strict)}`)
+ out.push(at ?? prev)
+ })
+ return out
+}
+
+/** Why a line isn't said where the part needs it, and what to change: where it is said instead (in the composition's
+ * frames), or that it isn't said at all. `first` names the part when this is its first line: starting the part there
+ * fixes it. */
+function unsaid(words: Words, phrase: string, len: number, from: number, first?: string): string {
+ let at: number | undefined;
+ try {
+ at = findPhrase(words, phrase);
+ } catch {
+ // said nowhere
+ }
+ if (at === undefined) return "isn't said in the take: each line is the speaker's words, in the order said";
+ const n = from + at, win = `frames ${from}–${from + len}`;
+ if (at >= 0 && at < len - 6) return `is said at frame ${n}, before the line before it: the lines go in the order said`;
+ if (first) return `is said at frame ${n}, outside the part's window (${win}): start the ${first} at frame ${n}, as the next part in the band (say="${phrase}")`;
+ if (at < 0) return `is said at frame ${n}, before the part's window (${win}): start the part at its first line, or take this line out`;
+ return `is said at frame ${n}, after the part's window (${win}): give \`until\` the last line's words so the part is up until then`;
+}
+
+/** The first frame at or after 0 a line's first words are said (two, or one of three letters or more), or Infinity. */
+export function saidFrom(words: Words, line: string): number {
+ const ws = plain(line).split(/\s+/)
+ for (const phrase of [ws.slice(0, 2).join(" "), ...(ws[0].length >= 3 ? [ws[0]] : [])]) {
+ for (let n = 1; n < 20; n++) {
+ try {
+ const f = findPhrase(words, phrase, { occurrence: n })
+ if (f >= 0) return f
+ } catch {
+ break
+ }
+ }
+ }
+ return Infinity
+}
+
+export interface HookProps extends Cue {
+ /** the lines, " / " between them; a line wrapped whole in *stars* is the accent line and pops */
+ text: string;
+}
+
+/** The hook: a few lines stacked big in the top band, each landing as it's said. */
+export const Hook = part<HookProps>("Hook", PARTS.Hook, ({ text, sound, span }) => {
+ const f = useCurrentFrame();
+ const TOP = useContext(TopContext);
+ const ls = lockup(text);
+ const at = landings(useWords(), ls, span.to - span.from);
+ return (
+ <>
+ <div style={{ position: "absolute", left: 90, top: TOP, width: 900, display: "flex", flexDirection: "column" }}>
+ {ls.map((l, i) => <LockLine key={i} line={l} at={at[i]} f={f} size={fit(l, 900, /^\*.*\*$/.test(l) ? 220 : 130)} />)}
+ </div>
+ <Hit sound={sound} fallback="deep punchy cinematic impact hit, tight, no reverb tail" gain={-16} seconds={1.2} screen={THUD} />
+ </>
+ );
+});
+
+export interface Bar {
+ label: string;
+ /** what it reads at its end: "2%", "~50%" */
+ value: string;
+ /** how full, 0 to 1 */
+ fill: number;
+ /** the phrase it fills on (with the card when not given) */
+ say?: string;
+}
+
+export interface StatCardProps extends Cue {
+ /** the number, big: "2%" */
+ big: string;
+ /** up to three lines beside it, " / " between them, *accent* words lit */
+ text?: string;
+ /** up to two bars that fill as they're said */
+ bars?: Bar[];
+}
+
+/** A dark card in the top band: the number big, lines beside it, bars filling on their words. */
+export const StatCard = part<StatCardProps>("StatCard", PARTS.StatCard, ({ big, text = "", bars = [], sound, span }) => {
+ const f = useCurrentFrame();
+ const TOP = useContext(TopContext);
+ const words = useWords();
+ const PAD = 50, TRACK = W - 2 * PAD;
+ const ls = lines(text).slice(0, 3);
+ const bigSize = Math.min(250, Math.floor(420 / Math.max(1, ems(big))));
+ // each line as big as its own width allows (a short line isn't held to the longest's size), the lines together
+ // within the number's height
+ const room = W - 2 * PAD - ems(big) * bigSize - 30;
+ const fitted = ls.map((l) => fit(l, room, ls.length > 2 ? 74 : 92));
+ const tall = fitted.reduce((n, z) => n + Math.round(z * 0.97), 0);
+ const sizes = fitted.map((z) => Math.floor(z * Math.min(1, 220 / Math.max(1, tall))));
+ const at = landings(words, ls, span.to - span.from, 2);
+ return (
+ <>
+ <div style={{ position: "absolute", left: 60, top: TOP, width: W, height: bars.length ? 440 : 300, boxSizing: "border-box", padding: `20px ${PAD}px 0`, borderRadius: 44, backgroundColor: CARD, boxShadow: "0 20px 60px rgba(0,0,0,0.35)", display: "flex", flexDirection: "column", transform: `translateY(${key(f, { 0: -30, 7: 0 })}px)`, opacity: key(f, { 0: 0, 4: 1 }) }}>
+ <div style={{ height: 246, display: "flex", flexDirection: "row", alignItems: "flex-start", gap: 18 }}>
+ <div style={{ ...type(bigSize, ACCENT, -6, false), flexShrink: 0, transform: `scale(${key(f, POP)})` }}>{big}</div>
+ <div style={{ marginTop: 24, flexGrow: 1, display: "flex", flexDirection: "column" }}>
+ {ls.map((l, i) => (
+ <div key={i} style={{ height: Math.round(sizes[i] * 0.97), opacity: f >= at[i] ? 1 : 0 }}>
+ <div style={{ ...type(sizes[i], i === 1 && !l.includes("*") ? "#b8b8b8" : INK, -1, false), transform: `translateY(${rise(f - at[i])}px)` }}>{accent(l)}</div>
+ </div>
+ ))}
+ </div>
+ </div>
+ {bars.slice(0, 2).map((b, i) => {
+ let from = 8 + 6 * i;
+ if (b.say) try { from = Math.max(0, findPhrase(words, b.say)); } catch (e) { throw new Error(`<StatCard> bar "${b.label}": ${(e as Error).message}`); }
+ const fill = Math.max(18, Math.min(1, Math.max(0, b.fill)) * TRACK);
+ return (
+ <div key={i} style={{ marginTop: i === 0 ? 0 : 2 }}>
+ <div style={{ height: 38, marginBottom: 8, display: "flex", justifyContent: "space-between", alignItems: "flex-end" }}>
+ <div style={{ fontFamily: BODY, fontWeight: 800, fontSize: 38, lineHeight: 1, letterSpacing: 2, color: "#e0e0e0", textTransform: "uppercase", whiteSpace: "nowrap" }}>{b.label}</div>
+ <div style={{ ...type(42, ACCENT, 0, false, 1), opacity: f >= from ? 1 : 0 }}>{b.value}</div>
+ </div>
+ <div style={{ position: "relative", width: TRACK, height: 40, borderRadius: 20, backgroundColor: "rgba(255,255,255,0.16)" }}>
+ <div style={{ position: "absolute", left: 0, top: 0, height: 40, borderRadius: 20, backgroundColor: ACCENT, width: key(f, { [from]: 18, [from + 24]: fill }) }} />
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ <Hit sound={sound} fallback="quick digital swoosh, bright, short" gain={-21} screen={BLIP} />
+ </>
+ );
+});
diff --git a/examples/parts/reel/captions.tsx b/examples/parts/reel/captions.tsx
new file mode 100644
index 00000000..e015b0fd
--- /dev/null
+++ b/examples/parts/reel/captions.tsx
@@ -0,0 +1,78 @@
+// Captions and the bed.
+import { useContext } from "react";
+import { Audio, Sequence, interpolate, useCurrentFrame, useVideoConfig, useWords } from "raea";
+import { PARTS } from "./layout";
+import { ACCENT, AdContext, META, OVER, TOP, Words, clamp, fit, key, type } from "./all";
+
+// ---- captions ----------------------------------------------------------------------------------------------------
+
+export interface CaptionsProps {
+ /** words that stay lit once said, "," between them: "not, more, bets" */
+ keys?: string;
+ /** words as they should read, "heard=shown" pairs: "two=2, followjet=Followjet" */
+ fix?: string;
+}
+
+/** Karaoke captions from the take's words: groups of up to three, the word being said lit. Inside <Ad> they sit under
+ * a card, hide under a hook, a strike, the ask or the end card, and go big at the top when the band is empty. */
+export function Captions({ keys = "", fix = "" }: CaptionsProps) {
+ const f = useCurrentFrame();
+ const ad = useContext(AdContext);
+ const fixes: Record<string, string> = Object.fromEntries(fix.split(",").map((s) => s.trim().split("=").map((x) => x.trim())).filter((p) => p.length === 2));
+ const hot = new Set(keys.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean));
+ const ws = useWords().map((w) => ({ ...w, text: fixes[w.text] ?? fixes[w.text.replace(/[.,?!]$/, "")] ?? w.text }));
+ const busy = ad?.band.find((b) => f >= b.from && f < b.to);
+ if (busy && busy.kind !== "card") return null;
+ const groups: Words[] = [];
+ for (const w of ws) {
+ const g = groups[groups.length - 1];
+ const prev = g?.[g.length - 1];
+ if (!g || g.length >= 3 || /[.,?!]$/.test(prev!.text) || w.from - prev!.to > 8) groups.push([w]);
+ else g.push(w);
+ }
+ const i = groups.findIndex((g, n) => f >= g[0].from && f < Math.min(groups[n + 1]?.[0].from ?? Infinity, g[g.length - 1].to + 8));
+ if (i < 0) return null;
+ const g = groups[i];
+ const gl = f - g[0].from;
+ const text = g.map((w) => w.text).join(" ");
+ const size = busy ? 78 : fit(text, 940, 136);
+ // under a card in the top band; over a card placed lower (its top less the caption's height)
+ const y = !busy ? 260 : busy.top === TOP ? TOP + 476 : busy.top - 120;
+ return (
+ <div data-caption={text} style={{ position: "absolute", left: 70, top: y, width: 940, textAlign: "center", ...type(size, OVER, -2, true, 0.95), transform: `translateY(${key(gl, { 0: 26, 5: 0 })}px) scale(${key(gl, { 0: 0.8, 3: 1.06, 6: 1 })})` }}>
+ {g.map((w, j) => {
+ const isKey = hot.has(w.text.toLowerCase().replace(/[^a-z0-9%']/g, ""));
+ const lit = isKey ? f >= w.from : f >= w.from && f < Math.max(w.to, w.from + 4);
+ return <span key={j} style={{ color: lit ? ACCENT : OVER }}>{w.text + (j < g.length - 1 ? " " : "")}</span>;
+ })}
+ </div>
+ );
+}
+
+META.set(Captions, PARTS.Captions);
+
+// ---- the bed -----------------------------------------------------------------------------------------------------
+
+export interface BedProps {
+ src: string;
+ /** its level under the voice, dB */
+ gain?: number;
+ /** its level once the voice is done (the last second), dB */
+ outro?: number;
+}
+
+/** Music under the voice, coming up as the voice ends and fading out over the last 1.4 s. */
+export function Bed({ src, gain = -21, outro = -12 }: BedProps) {
+ const { fps, durationInFrames: n } = useVideoConfig();
+ const words = useWords();
+ const done = Math.min(n - 1, (words[words.length - 1]?.to ?? n) + 2);
+ const fade = Math.round(1.4 * fps);
+ const db = (m: number) => key(m, { 0: gain, [done]: gain, [done + 10]: outro }) + 20 * Math.log10(Math.max(1e-4, interpolate(m, [n - fade, n], [1, 0], clamp)));
+ return (
+ <Sequence from={0} durationInFrames={n} name="bed" layout="none">
+ <Audio src={src} gainDb={db} />
+ </Sequence>
+ );
+}
+
+META.set(Bed, PARTS.Bed);
diff --git a/examples/parts/reel/cards.tsx b/examples/parts/reel/cards.tsx
new file mode 100644
index 00000000..aaa09208
--- /dev/null
+++ b/examples/parts/reel/cards.tsx
@@ -0,0 +1,145 @@
+// Strike, Phrases, Callout, Follow and EndCard.
+import { useContext } from "react";
+import { AbsoluteFill, Img, findPhrase, useCurrentFrame, useWords } from "raea";
+import { PARTS } from "./layout";
+import { ACCENT, BLIP, BODY, CARD, Cue, Hit, INK, LockLine, ON_ACCENT, OVER, POP, SHADOW, STRIKE, THUD, TOP, TopContext, W, accent, ems, fit, key, landings, lines, part, plain, rise, saidFrom, type } from "./all";
+
+export interface StrikeProps extends Cue {
+ /** the lockup above the card, " / " between lines: what's right */
+ text: string;
+ /** what's wrong, on the card (two lines at most, " / " between them), struck through */
+ not: string;
+ /** the phrase the strike lands on (a few frames before the part ends when not given) */
+ strikeSay?: string;
+}
+
+/** "this, not that": the right way big, the wrong way on a card under it, struck through as it's dismissed. */
+export const Strike = part<StrikeProps>("Strike", PARTS.Strike, ({ text, not, strikeSay, sound, span }) => {
+ const f = useCurrentFrame();
+ const TOP = useContext(TopContext);
+ const words = useWords();
+ const len = span.to - span.from;
+ const ls = lines(text).slice(0, 2);
+ const rows = lines(not).slice(0, 2);
+ // the struck card follows the headline by a third of a second, unless its first row is said sooner: then it lands on its words
+ const rowAt = landings(words, rows, len, rows.length ? Math.min(10, saidFrom(words, rows[0])) : 10, true);
+ let strike = len - 14;
+ if (strikeSay) try { strike = findPhrase(words, strikeSay); } catch (e) { throw new Error(`<Strike> strikeSay: ${(e as Error).message}`); }
+ // what's struck is read first: the strike waits until the last row has been up half a second (a strikeSay on the
+ // card's own words struck it as it landed), while the part is still up
+ if (rows.length) strike = Math.min(Math.max(strike, rowAt[rows.length - 1] + 15), len - 8);
+ const card = rowAt[0];
+ const rowSize = Math.min(74, ...rows.map((r) => fit(r, 820, 74)));
+ const h = rows.length > 1 ? key(f, { [rowAt[1] - 1]: 120, [rowAt[1] + 5]: 192 }) : 120;
+ const top = TOP + ls.length * 140 + 10;
+ return (
+ <>
+ <div style={{ position: "absolute", left: 90, top: TOP, width: 900, display: "flex", flexDirection: "column" }}>
+ {ls.map((l, i) => <LockLine key={i} line={l} at={0} f={f} size={fit(l, 900, i === 0 ? 130 : 110)} />)}
+ </div>
+ {f >= card ? (
+ <div style={{ position: "absolute", left: 100, top, width: 880, height: h, boxSizing: "border-box", padding: "22px 20px 0", borderRadius: 32, backgroundColor: CARD, overflow: "hidden", transform: `translateY(${key(f - card, { 0: 30, 6: 0 })}px)` }}>
+ {rows.map((r, i) => (
+ <div key={i} style={{ position: "relative", height: 72, opacity: f >= rowAt[i] ? 1 : 0 }}>
+ <div style={{ ...type(rowSize, "#e2e2e2", -1, false), textAlign: "center", transform: `translateY(${rise(f - rowAt[i])}px)` }}>{r}</div>
+ <div style={{ position: "absolute", left: "50%", top: rowSize * 0.42, height: 9, borderRadius: 5, backgroundColor: STRIKE, width: key(f - strike - 4 * i, { 0: 0, 8: Math.min(820, ems(r) * rowSize) }), transform: "translateX(-50%)" }} />
+ </div>
+ ))}
+ </div>
+ ) : null}
+ <Hit at={card} sound={sound} fallback="soft paper swipe whoosh, short" gain={-22} screen={BLIP} />
+ <Hit at={strike} sound={sound} fallback="marker pen scribble strike-through on paper, quick" gain={-20} seconds={0.8} />
+ </>
+ );
+});
+
+export interface PhrasesProps extends Cue {
+ /** the lines, " / " between them, each a short phrase the speaker says in turn; *accent* words lit */
+ text: string;
+}
+
+/** Big lines on purpose: a run of short phrases in the top band, one at a time, each landing on its words and held
+ * until the next, each as big as it fits (the reference's thesis, said phrase by phrase). */
+export const Phrases = part<PhrasesProps>("Phrases", PARTS.Phrases, ({ text, sound, span }) => {
+ const f = useCurrentFrame();
+ const TOP = useContext(TopContext);
+ const ls = lines(text);
+ const at = landings(useWords(), ls, span.to - span.from, 0, true, "Phrases", span.from);
+ const i = at.reduce((n, a, k) => (f >= a ? k : n), 0);
+ const local = f - at[i];
+ return (
+ <>
+ <div key={i} style={{ position: "absolute", left: 60, top: TOP, width: W, textAlign: "center", ...type(fit(ls[i], W, 150), OVER), opacity: local >= 0 ? 1 : 0, transform: `translateY(${key(local, { 0: 26, 5: 0 })}px) scale(${key(local, { 0: 0.8, 3: 1.06, 6: 1 })})` }}>
+ {accent(ls[i])}
+ </div>
+ <Hit sound={sound} fallback="deep punchy cinematic impact hit, tight, no reverb tail" gain={-18} seconds={1.2} screen={THUD} />
+ </>
+ );
+});
+
+export interface CalloutProps extends Cue {
+ /** the small line above: "Step 1", "Fact" */
+ label?: string;
+ title: string;
+ detail?: string;
+}
+
+/** A labelled card in the top band for a step or a claim. */
+export const Callout = part<CalloutProps>("Callout", PARTS.Callout, ({ label, title, detail, sound }) => {
+ const f = useCurrentFrame();
+ const TOP = useContext(TopContext);
+ return (
+ <>
+ <div style={{ position: "absolute", left: 60, top: TOP, width: W, boxSizing: "border-box", padding: "34px 50px", borderRadius: 44, backgroundColor: CARD, boxShadow: "0 20px 60px rgba(0,0,0,0.35)", transform: `translateY(${key(f, { 0: -30, 7: 0 })}px)`, opacity: key(f, { 0: 0, 4: 1 }) }}>
+ {label ? <div style={{ fontFamily: BODY, fontWeight: 800, fontSize: 38, letterSpacing: 2, color: ACCENT, textTransform: "uppercase", marginBottom: 12 }}>{label}</div> : null}
+ <div style={{ ...type(fit(title, 860, 96), INK, -1, false), whiteSpace: "normal" }}>{accent(title)}</div>
+ {detail ? <div style={{ fontFamily: BODY, fontWeight: 600, fontSize: 40, lineHeight: 1.25, color: "#d8d8d8", marginTop: 14 }}>{accent(detail)}</div> : null}
+ </div>
+ <Hit sound={sound} fallback="fast clean whoosh swipe transition, short, airy" gain={-21} screen={BLIP} />
+ </>
+ );
+});
+
+export interface FollowProps extends Cue {
+ text: string;
+}
+
+/** The ask as a pill in the top band: "+ follow for more". */
+export const Follow = part<FollowProps>("Follow", PARTS.Follow, ({ text, sound }) => {
+ const f = useCurrentFrame();
+ const TOP = useContext(TopContext);
+ // the pill is the accent already and holds one line: stars and " / " read as plain words
+ const said = plain(text).split(/\s*\/\s*/).join(" ");
+ return (
+ <>
+ <div style={{ position: "absolute", left: 108, top: TOP + 64, width: 813, padding: 26, borderRadius: 60, backgroundColor: ACCENT, color: ON_ACCENT, fontFamily: BODY, fontWeight: 800, fontSize: Math.min(64, Math.floor(800 / (0.62 * said.length))), lineHeight: 1, letterSpacing: 2, textTransform: "uppercase", textAlign: "center", whiteSpace: "nowrap", boxShadow: "0 10px 30px rgba(0,0,0,0.35)", transform: `scale(${key(f, POP)})` }}>
+ {said}
+ </div>
+ <Hit sound={sound} fallback="bubbly UI pop click, satisfying, short" gain={-17} seconds={0.6} screen={[BLIP[0], -3, 0.6]} />
+ </>
+ );
+});
+
+export interface EndCardProps extends Cue {
+ name: string;
+ /** a logo image (optional) */
+ logo?: string;
+ line?: string;
+ /** the ask: "Shop now", "Link in bio" */
+ cta?: string;
+}
+
+/** The closing card over the whole frame: the name or logo, one line, and the ask. */
+export const EndCard = part<EndCardProps>("EndCard", PARTS.EndCard, ({ name, logo, line, cta, sound }) => {
+ const t = key(useCurrentFrame(), { 0: 0, 10: 1 });
+ return (
+ <>
+ <AbsoluteFill style={{ opacity: t, backgroundColor: "rgba(10,10,10,0.92)", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 40, padding: 80 }}>
+ {logo ? <Img src={logo} style={{ height: 180, objectFit: "contain" }} /> : <div style={{ ...type(fit(name, 900, 180), INK), textShadow: SHADOW }}>{name}</div>}
+ {line ? <div style={{ ...type(fit(line, 900, 80), INK, -1, false), whiteSpace: "normal", textAlign: "center" }}>{accent(line)}</div> : null}
+ {cta ? <div style={{ padding: "26px 60px", borderRadius: 60, backgroundColor: ACCENT, color: ON_ACCENT, fontFamily: BODY, fontWeight: 800, fontSize: 56, letterSpacing: 2, textTransform: "uppercase", transform: `scale(${t})` }}>{cta}</div> : null}
+ </AbsoluteFill>
+ <Hit sound={sound} fallback="soft rising whoosh into a gentle chime, short" gain={-20} seconds={1.2} screen={THUD} />
+ </>
+ );
+});
diff --git a/examples/parts/reel/core.tsx b/examples/parts/reel/core.tsx
new file mode 100644
index 00000000..82c5facf
--- /dev/null
+++ b/examples/parts/reel/core.tsx
@@ -0,0 +1,312 @@
+// The look, cues, the frame and the take.
+import { Children, createContext, isValidElement, useContext, type CSSProperties, type ReactElement, type ReactNode } from "react";
+import { AbsoluteFill, Audio, Sequence, Video, findPhrase, interpolate, sao, useCurrentFrame, useVideoConfig, useWords, Easing } from "raea";
+import { PARTS, layout, spanOf, type Kind, type PartMeta, type Span, type Word } from "./layout";
+
+export type Words = Word[];
+
+// ---- look --------------------------------------------------------------------------------------------------------
+
+export const ACCENT = "var(--brand-accent, #c8ff2e)";
+
+export const STRIKE = "var(--brand-strike, #ff4d3d)";
+
+export const INK = "var(--brand-ink, #ffffff)";
+
+export const CARD = "var(--brand-card, rgba(12,12,12,0.88))";
+
+export const ON_ACCENT = "var(--brand-on-accent, #0d0d0d)";
+
+const HEAD = "var(--brand-font, 'Avenir Next Condensed')";
+
+export const BODY = "var(--brand-font-body, 'Avenir Next')";
+
+export const SHADOW = "0 3px 0 rgba(0,0,0,0.35), 0 0 3px rgba(0,0,0,0.5), 0 10px 36px rgba(0,0,0,0.55)";
+
+/** type straight over the footage (hooks, a strike's lockup, captions), and its shadow: white on a dark grade by
+ * default, the ink of a light screen with a soft white halo when <Ad tone="light"> */
+export const OVER = "var(--brand-over, #ffffff)";
+
+const OVER_SHADOW = `var(--brand-over-shadow, ${SHADOW})`;
+
+const LIGHT = { "--brand-over": "#17191d", "--brand-over-shadow": "0 0 4px rgba(255,255,255,0.9), 0 0 24px rgba(255,255,255,0.75)" };
+
+/** the band's top, and its width */
+export const TOP = 236;
+
+/** where a band part sits: its top edge for each `place` (top is the reference's, over the head) */
+const PLACES = { top: TOP, upper: 420, middle: 760 } as const;
+
+export type Place = keyof typeof PLACES;
+
+/** the top edge of the part being drawn */
+export const TopContext = createContext<number>(TOP);
+
+function topOf(place: Place | undefined): number {
+ if (place !== undefined && !(place in PLACES)) throw new Error(`place must be "top", "upper" or "middle", got ${JSON.stringify(place)}`);
+ return PLACES[place ?? "top"];
+}
+
+export const W = 960;
+
+const OUT = Easing.out(Easing.cubic);
+
+export const clamp = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;
+
+/** a value along keys {frame: value}, eased out per segment, held outside them */
+export function key(f: number, keys: Record<number, number>): number {
+ const xs = Object.keys(keys).map(Number).sort((a, b) => a - b);
+ return interpolate(f, xs, xs.map((x) => keys[x]), { easing: OUT, ...clamp });
+}
+
+export const POP = { 0: 0.6, 4: 1.08, 8: 1 };
+
+export const rise = (local: number) => key(local, { 0: 30, 6: 0 });
+
+export function type(size: number, color: string = INK, tracking = -2, shadow = true, line = 0.92): CSSProperties {
+ return { fontFamily: HEAD, fontWeight: 800, fontSize: size, color, lineHeight: line, textTransform: "uppercase", letterSpacing: tracking, textShadow: shadow ? OVER_SHADOW : undefined, whiteSpace: "nowrap" };
+}
+
+/** advance widths in em of Avenir Next Condensed Heavy (what weight 800 resolves to), measured from the font; a
+ * brand's own face is near enough for fitting */
+const ADVANCE: Record<string, number> = {
+ A: 0.596, B: 0.58, C: 0.53, D: 0.621, E: 0.467, F: 0.454, G: 0.577, H: 0.632, I: 0.324, J: 0.485, K: 0.624, L: 0.465, M: 0.807,
+ N: 0.63, O: 0.64, P: 0.562, Q: 0.65, R: 0.582, S: 0.478, T: 0.464, U: 0.6, V: 0.602, W: 0.844, X: 0.596, Y: 0.538, Z: 0.497,
+ " ": 0.2, "%": 0.765, "'": 0.254, ".": 0.3, ",": 0.3, "!": 0.35, "?": 0.46, ":": 0.32, ";": 0.32, "-": 0.26, "+": 0.666, "/": 0.32, "&": 0.66,
+};
+
+/** a line's width in em, set in capitals */
+export const ems = (text: string) => [...text.replace(/\*/g, "").toUpperCase()].reduce((n, c) => n + (ADVANCE[c] ?? (/\d/.test(c) ? 0.56 : 0.6)), 0);
+
+/** the largest size up to `max` at which `text` fits `width`, with the type's -2 px tracking */
+export const fit = (text: string, width: number, max: number) => Math.min(max, Math.floor((width + 2 * plain(text).length) / Math.max(1, ems(text))));
+
+/** a line with its *accent* words */
+export const accent = (line: string, color: string = ACCENT) =>
+ line.split(/(\*[^*]+\*)/).filter(Boolean).map((p, k) => (p.startsWith("*") ? <span key={k} style={{ color }}>{p.slice(1, -1)}</span> : <span key={k}>{p}</span>));
+
+export const lines = (text: string) => text.split(" / ").map((l) => l.trim()).filter(Boolean);
+
+/** A lockup's lines: as given with " / ", or a long line with none broken into two or three lines of even width (the
+ * widest as narrow as it can be), so a one-line hook still reads big. */
+export function lockup(text: string): string[] {
+ const given = lines(text);
+ const ws = text.trim().split(/\s+/);
+ if (given.length > 1 || ws.length < 4) return given;
+ const n = ws.length > 6 ? 3 : 2;
+ let best: string[] = given;
+ let widest = Infinity;
+ const tryCuts = (from: number, left: number, acc: string[]) => {
+ if (left === 1) {
+ const ls = [...acc, ws.slice(from).join(" ")];
+ const w = Math.max(...ls.map(ems));
+ if (w < widest) [best, widest] = [ls, w];
+ return;
+ }
+ for (let k = from + 1; k <= ws.length - left + 1; k++) tryCuts(k, left - 1, [...acc, ws.slice(from, k).join(" ")]);
+ };
+ tryCuts(0, n, []);
+ return best;
+}
+
+export const plain = (line: string) => line.replace(/\*/g, "");
+
+// ---- cues --------------------------------------------------------------------------------------------------------
+
+export interface Cue {
+ /** the phrase the part lands on, word for word from the transcript */
+ say?: string;
+ /** which time `say` is said, from 1 */
+ occurrence?: number;
+ /** the phrase it leaves on (the end of its last word) */
+ until?: string;
+ /** its length when there's no `until` */
+ seconds?: number;
+ /** a start frame, when it isn't cued on words */
+ from?: number;
+ /** the beat of the bed it lands on, counted from 0 (a take with no voice is cut on the music: <Ad beats>) */
+ beat?: number;
+ /** the last beat it's up for (it leaves as the next beat starts) */
+ untilBeat?: number;
+ /** foley on its moment: an SAO prompt, or false for none */
+ sound?: string | false;
+ /** where it sits: "top" (over the head, the default), "upper" or "middle" */
+ place?: Place;
+}
+
+/** what <Ad> worked out: each part's span (by its place among the children) and the band's spans with their kinds */
+interface AdLayout { spans: Map<number, Span>; band: (Span & { kind: Kind; top: number })[] }
+
+export const AdContext = createContext<AdLayout | null>(null);
+
+/** the bed's beats in the cut's frames, from <Ad beats> */
+const BeatsContext = createContext<number[]>([]);
+
+const SpanContext = createContext<Span | null>(null);
+
+export const META = new WeakMap<object, PartMeta>();
+
+export function part<P>(name: string, meta: PartMeta, Body: (p: P & { span: Span }) => ReactNode) {
+ const Part = (p: P & Cue) => {
+ // a prop the part can't go without is named, with the props it was given (a wrong name reads as a missing one)
+ const missing = (meta.needs ?? []).filter((k) => typeof (p as Record<string, unknown>)[k] !== "string");
+ if (missing.length) throw new Error(`<${name}> needs ${missing.map((k) => `${k}="..."`).join(" and ")} (it was given ${Object.keys(p).join(", ") || "nothing"})`);
+ const given = useContext(SpanContext);
+ const words = useWords();
+ const beats = useContext(BeatsContext);
+ const { fps, durationInFrames } = useVideoConfig();
+ const span = given ?? spanOf(findPhrase, name, p, meta, words, beats, fps, durationInFrames);
+ return (
+ <Sequence from={span.from} durationInFrames={span.to - span.from} name={name.toLowerCase()} layout="none">
+ <TopContext.Provider value={topOf(p.place)}>
+ <Body {...p} span={span} />
+ </TopContext.Provider>
+ </Sequence>
+ );
+ };
+ Part.displayName = name;
+ META.set(Part, meta);
+ return Part;
+}
+
+/** The SAO hit on a part's moment (frames local to the part). */
+/** the foley a part makes in each kit: the talking reel's under a voice, and a screen piece's (golden 30's: a round
+ * thud for a landing, a cartoon pop for a card, louder, as nothing is said over them) */
+type Foley = [prompt: string, gain: number, seconds: number];
+
+export const THUD: Foley = ["deep round thud, a heavy object dropping onto something soft, short, no reverb", -5, 1];
+
+export const BLIP: Foley = ["bubbly cartoon UI pop, satisfying and clean, short", -5, 0.6];
+
+const KitContext = createContext<"voice" | "screen">("voice");
+
+/** The SAO hit on a part's moment (frames local to the part): `sound` when given, else the kit's. */
+export function Hit({ at = 0, sound, fallback, gain, seconds = 1, screen }: { at?: number; sound: string | false | undefined; fallback: string; gain: number; seconds?: number; screen?: Foley }) {
+ const kit = useContext(KitContext);
+ if (sound === false) return null;
+ const [prompt, db, len] = sound === undefined && kit === "screen" && screen ? screen : [sound ?? fallback, gain, seconds];
+ return (
+ <Sequence from={at} name="foley" layout="none">
+ <Audio src={sao(prompt, { seconds: len })} gainDb={db} />
+ </Sequence>
+ );
+}
+
+// ---- the frame ---------------------------------------------------------------------------------------------------
+
+export interface AdProps {
+ children: ReactNode;
+ /** the brand's accent (lime by default), its strike colour, and its typeface for the big type */
+ accent?: string;
+ strike?: string;
+ font?: string;
+ /** the dark grade under the top band, so type reads on any footage (on by default) */
+ shade?: boolean;
+ /** the footage's tone: "dark" (the default; white type on a dark grade) or "light" (a bright screen: dark type,
+ * no grade); the host gives TONE */
+ tone?: "dark" | "light";
+ /** the parts' foley: "voice" (the talking reel's, quiet under a voice) or "screen" (thuds and pops at the level of
+ * a piece with no voice, and a thud on each quick cut); "screen" when the piece is cued on beats */
+ kit?: "voice" | "screen";
+ /** the bed's beats in the cut's frames, for parts cued by `beat` (a take with no voice; the host gives BEATS) */
+ beats?: number[];
+}
+
+/** The frame a take's parts sit in: works out every part's span from the words, gives the top band to one part at a
+ * time (each ends where the next starts), and tells Captions where the band is busy. */
+export function Ad({ children, accent: a, strike, font, tone = "dark", shade = tone === "dark", beats = [], kit = beats.length ? "screen" : "voice" }: AdProps) {
+ const words = useWords();
+ const { fps, durationInFrames } = useVideoConfig();
+ const items = Children.toArray(children).filter(isValidElement) as ReactElement<Cue>[];
+ // the parts' spans are layout.ts's, the same the feed's host lays the parts lane out with
+ const nameOf = (el: ReactElement) => Object.keys(PARTS).find((k) => PARTS[k] === META.get(el.type as object));
+ const placed = items.flatMap((el, i) => { const name = nameOf(el); return name ? [{ i, name, cue: el.props }] : []; });
+ const laid = layout(findPhrase, placed, words, beats, fps, durationInFrames);
+ const spans = laid.spans;
+ const band: (Span & { kind: Kind; top: number; i: number })[] = laid.band.map((b) => ({ ...b, top: topOf(items[b.i].props.place) }));
+ const vars = { ...(tone === "light" ? LIGHT : {}), "--brand-accent": a, "--brand-strike": strike, "--brand-font": font } as Record<string, string | undefined>;
+ const style = Object.fromEntries(Object.entries(vars).filter(([, v]) => v)) as CSSProperties;
+ return (
+ <KitContext.Provider value={kit}>
+ <BeatsContext.Provider value={beats}>
+ <AdContext.Provider value={{ spans, band }}>
+ <AbsoluteFill style={{ backgroundColor: "#000", ...style }}>
+ {items.map((el, i) => {
+ const meta = META.get(el.type as object);
+ const node = meta?.kind === "take" && shade ? [el, <Shade key="shade" />] : el;
+ return spans.has(i) ? <SpanContext.Provider key={i} value={spans.get(i)!}>{node}</SpanContext.Provider> : <AdItem key={i}>{node}</AdItem>;
+ })}
+ </AbsoluteFill>
+ </AdContext.Provider>
+ </BeatsContext.Provider>
+ </KitContext.Provider>
+ );
+}
+
+const AdItem = ({ children }: { children: ReactNode }) => <>{children}</>;
+
+/** The dark grade behind the top band. */
+export function Shade() {
+ return <AbsoluteFill style={{ backgroundImage: "linear-gradient(180deg, rgba(20,16,12,0.55) 0%, rgba(20,16,12,0.35) 24%, rgba(20,16,12,0) 52%)" }} />;
+}
+
+// ---- the take ----------------------------------------------------------------------------------------------------
+
+export interface TakeProps {
+ src: string;
+ /** the take's kept stretches in its own seconds, [from, to], played one after another (a tight cut) */
+ segments?: [number, number][];
+ /** where the face is in the take, as shares of its picture (x across, y down); the zoom holds it in place */
+ face?: { x: number; y: number };
+ /** the zoom on alternate cuts: [the even cuts', the odd cuts'] (a punch-in on every other cut) */
+ punch?: [number, number];
+ /** the voice's gain in dB */
+ gain?: number;
+ /** per segment, where to look and how close, in place of `face` and `punch`: {x, y} shares of the picture held
+ * still, `zoom` 1 for the whole picture (a screen recording's shots: the host gives them) */
+ shots?: { x?: number; y?: number; zoom?: number }[];
+}
+
+/** A talking take, cut to its segments, each pushing in slowly, the zoom punching in on every other cut. */
+function TakeBody({ src, segments, face = { x: 0.5, y: 0.35 }, punch = [1.12, 1.26], gain = 0, shots }: TakeProps) {
+ const { fps, durationInFrames } = useVideoConfig();
+ const kit = useContext(KitContext);
+ const segs = segments ?? [[0, durationInFrames / fps]];
+ let at = 0;
+ return (
+ <>
+ {segs.map(([a, b], n) => {
+ const from = at;
+ const len = Math.max(1, Math.round((b - a) * fps));
+ at += len;
+ return (
+ <Sequence key={n} from={from} durationInFrames={len} name={`take ${n + 1}`}>
+ {/* a screen piece's quick flips (under a second) each land with a thud, softer than a part's */}
+ {kit === "screen" && n > 0 && len < fps ? <Hit sound={undefined} fallback={THUD[0]} gain={-12} seconds={1} /> : null}
+ <Shot src={src} start={Math.round(a * fps)} len={len} face={shots?.[n] ? { x: shots[n].x ?? 0.5, y: shots[n].y ?? 0.5 } : face} zoom={shots?.[n] ? shots[n].zoom ?? 1 : punch[n % 2]} gain={gain} />
+ </Sequence>
+ );
+ })}
+ </>
+ );
+}
+
+function Shot({ src, start, len, face, zoom, gain }: { src: string; start: number; len: number; face: { x: number; y: number }; zoom: number; gain: number }) {
+ const f = useCurrentFrame();
+ const { width, height } = useVideoConfig();
+ const z = interpolate(f, [0, len], [zoom, zoom + 0.035], clamp);
+ // cover with the face's point at its own share of the box; the zoom is about the centre, so it's shifted back to
+ // keep that point still
+ const tx = (1 - z) * (face.x - 0.5) * width;
+ const ty = (1 - z) * (face.y - 0.5) * height;
+ return (
+ <AbsoluteFill style={{ overflow: "hidden", backgroundColor: "#000" }}>
+ <Video src={src} startFrom={start} endAt={start + len} gainDb={gain}
+ style={{ position: "absolute", width: "100%", height: "100%", objectFit: "cover", objectPosition: `${face.x * 100}% ${face.y * 100}%`, transform: `translate(${tx}px, ${ty}px) scale(${z})` }} />
+ </AbsoluteFill>
+ );
+}
+
+export const Take = (p: TakeProps) => <TakeBody {...p} />;
+
+META.set(Take, PARTS.Take);
diff --git a/examples/parts/reel/index.tsx b/examples/parts/reel/index.tsx
new file mode 100644
index 00000000..6a6168fa
--- /dev/null
+++ b/examples/parts/reel/index.tsx
@@ -0,0 +1,21 @@
+// The reel's parts (an example: `raea part add reel` copies this folder into components/reel): designed parts for a talking take, each placed by one line and cued from the take's words
+// (docs/craft-system.md, phase 9). The look and the sound are the approved reel's (golden 10): heavy
+// condensed capitals with a three-layer shadow, a lime accent, dark cards, and SAO foley on each designed moment.
+//
+// <Ad>
+// <Take src={take} segments={[[0, 1.6], [1.72, 2.95]]} />
+// <Hook say="nine in ten" text="*9 in 10* / buyers / read reviews first" />
+// <StatCard say="only a third" big="33%" text="of shops / answer / *within a day*"
+// bars={[{ label: "answer in a day", value: "33%", fill: 0.33 }, { label: "buyers who wait", value: "~10%", fill: 0.1, say: "wait" }]} />
+// <Captions />
+// <Follow say="follow" text="+ follow for more" />
+// </Ad>
+//
+// A part's `say` is a phrase from the transcript, word for word: the part lands on it. `until` is the phrase it leaves
+// on (the end of its last word), or `seconds` its length. Inside <Ad> the top band holds one part at a time, so a part
+// ends where the next one starts, and Captions keep out of the band's way: under a card, hidden under a hook, a strike
+// or the ask, and big at the top when the band is empty. `*word*` marks the accent and " / " splits lines.
+export { Ad, Shade, Take, Hook, StatCard, Strike, Phrases, Callout, Follow, EndCard, Captions, Bed } from "./all";
+export type { Place, Cue, AdProps, TakeProps, HookProps, Bar, StatCardProps, StrikeProps, PhrasesProps, CalloutProps, FollowProps, EndCardProps, CaptionsProps, BedProps } from "./all";
+
+
diff --git a/examples/parts/reel/layout.test.ts b/examples/parts/reel/layout.test.ts
new file mode 100644
index 00000000..b04d0899
--- /dev/null
+++ b/examples/parts/reel/layout.test.ts
@@ -0,0 +1,50 @@
+// <Ad>'s parts in time (src/layout.ts, the layout the render and the feed's host share): a part that says its lines
+// (Phrases) and has no cue of its own starts where its first line is said, as `say` with those words would start it.
+// Before, it started at frame 0 and its lines were said outside it, so the render refused the part.
+import { describe, expect, test } from "bun:test";
+import { firstWords, layout, PARTS, spanOf } from "./layout";
+import { findPhrase } from "raea";
+
+// a made-up talking take: one word every 10 frames
+const said = "pick a stone grow some moss then name your rock and keep it close follow along";
+const words = said.split(" ").map((text, n) => ({ text, from: n * 10, to: n * 10 + 8 }));
+const span = (cue: Record<string, unknown>) => spanOf(findPhrase, "Phrases", cue, PARTS.Phrases, words, [], 30, 200);
+
+describe("a Phrases with no cue", () => {
+ test("starts where its first line's first words are said, as say= with them does", () => {
+ expect(span({ text: "then *name* / your rock / and keep it" })).toEqual(span({ say: "then name", text: "then *name* / your rock / and keep it" }));
+ expect(span({ text: "then *name* / your rock" }).from).toBe(60);
+ });
+
+ test("ends on its until, said after it starts", () => {
+ expect(span({ text: "name your / rock", until: "keep it" })).toEqual({ from: 70, to: 128 });
+ });
+
+ test("a cue of its own wins: from, beat or say", () => {
+ expect(span({ from: 5, text: "then name" }).from).toBe(5);
+ expect(span({ say: "follow along", text: "then name" }).from).toBe(140);
+ });
+
+ test("starts at 0 when its first words aren't said (the part then says which line isn't)", () => {
+ expect(span({ text: "never said here" }).from).toBe(0);
+ });
+
+ test("holds the band from its first line until the next part", () => {
+ const laid = layout(findPhrase, [
+ { i: 0, name: "Hook", cue: { say: "pick a stone", until: "some moss" } },
+ { i: 1, name: "Phrases", cue: { text: "then *name* / your rock / and keep it" } },
+ { i: 2, name: "Follow", cue: { say: "follow along" } },
+ ], words, [], 30, 200);
+ expect(laid.spans.get(1)).toEqual({ from: 60, to: 140 });
+ });
+
+ test("its first words: two, or the first alone when it's three letters or more, accents plain", () => {
+ expect(firstWords("*You* need more / bets")).toEqual(["You need", "You"]);
+ expect(firstWords("a bet")).toEqual(["a bet"]);
+ expect(firstWords("Bets")).toEqual(["Bets"]);
+ });
+
+ test("only a part that says its lines starts on them: a Hook's text doesn't place it", () => {
+ expect(spanOf(findPhrase, "Hook", { text: "then name" }, PARTS.Hook, words, [], 30, 200).from).toBe(0);
+ });
+});
diff --git a/examples/parts/reel/layout.ts b/examples/parts/reel/layout.ts
new file mode 100644
index 00000000..4546cf45
--- /dev/null
+++ b/examples/parts/reel/layout.ts
@@ -0,0 +1,150 @@
+// Where <Ad>'s parts sit in time, with no React and no imports: index.tsx renders from it, and the feed's host lays a
+// composition's parts out with it (apps/app/host/parts.ts), so the parts lane on the timeline is the render's layout.
+// The phrase finder is passed in (findPhrase from raea), which keeps this file importable from anywhere.
+
+export type Kind = "take" | "band" | "card" | "captions" | "full" | "sound";
+export interface PartMeta {
+ kind: Kind;
+ seconds: number;
+ ask?: boolean;
+ needs?: string[];
+ /** its lines are the speaker's words (Phrases): given no cue, it starts where its first line's first words are said */
+ says?: boolean;
+}
+/** every part the reel has, by name */
+export const PARTS: Record<string, PartMeta> = {
+ Take: { kind: "take", seconds: 0 },
+ Hook: { kind: "band", seconds: 2.5, needs: ["text"] },
+ StatCard: { kind: "card", seconds: 4, needs: ["big"] },
+ Strike: { kind: "band", seconds: 5, needs: ["text", "not"] },
+ Phrases: { kind: "band", seconds: 8, needs: ["text"], says: true },
+ Callout: { kind: "card", seconds: 3, needs: ["title"] },
+ Follow: { kind: "band", seconds: 2.5, ask: true, needs: ["text"] },
+ EndCard: { kind: "full", seconds: 2.5, ask: true, needs: ["name"] },
+ Captions: { kind: "captions", seconds: 0 },
+ Bed: { kind: "sound", seconds: 0 },
+};
+
+/** how a part is placed in time (the timing half of parts.tsx's Cue) */
+export interface Timing {
+ say?: string;
+ occurrence?: number;
+ until?: string;
+ seconds?: number;
+ from?: number;
+ beat?: number;
+ untilBeat?: number;
+ /** the part's lines, " / " between them: a part that says them (Phrases) and has no cue starts on the first */
+ text?: string;
+}
+export interface Word {
+ text: string;
+ /** first frame */
+ from: number;
+ /** the frame after it ends */
+ to: number;
+}
+/** findPhrase from @raea/video/phrase: the frame a phrase is said */
+export type Find = (words: readonly Word[], phrase: string, options?: { occurrence?: number; edge?: "start" | "end" }) => number;
+export interface Span {
+ from: number;
+ to: number;
+}
+export interface Placed {
+ /** its place among <Ad>'s children */
+ i: number;
+ name: string;
+ cue: Timing;
+}
+export interface Laid {
+ spans: Map<number, Span>;
+ /** the parts in the top band, the cards and the full-frame ones, in time order */
+ band: (Span & { kind: Kind; i: number })[];
+}
+
+/** the shortest a part cued on the music stays up, seconds */
+export const READ = 1.5;
+
+/** The frame of the bed's beat n; the error names the part. */
+export function onBeat(beats: readonly number[], part: string, n: number): number {
+ if (!beats.length) throw new Error(`<${part}>: beat={${n}} needs the bed's beats, as <Ad beats={BEATS}>`);
+ if (!Number.isInteger(n) || n < 0 || n >= beats.length) throw new Error(`<${part}>: there is no beat ${n} (the cut has beats 0 to ${beats.length - 1})`);
+ return beats[n];
+}
+
+/** Where a phrase lands, said after `after` if it can be; the error names the part. */
+export function when(find: Find, words: readonly Word[], part: string, phrase: string, opts: { edge?: "start" | "end"; occurrence?: number; after?: number } = {}): number {
+ try {
+ if (opts.after !== undefined && opts.occurrence === undefined) {
+ for (let n = 1; ; n++) {
+ const at = find(words, phrase, { occurrence: n, edge: opts.edge });
+ if (at >= opts.after) return at;
+ }
+ }
+ return find(words, phrase, { occurrence: opts.occurrence, edge: opts.edge });
+ } catch (e) {
+ if (opts.after !== undefined && opts.occurrence === undefined) {
+ try { return find(words, phrase, { edge: opts.edge }); } catch { /* the first error says it */ }
+ }
+ throw new Error(`<${part}>: ${(e as Error).message.replace(/^word\(/, "the phrase (")}`);
+ }
+}
+
+/** The first words of a part's first line as a phrase to find (two, or one of three letters or more; *accents* plain),
+ * the words a line is said by (parts.tsx lands each line on them). */
+export function firstWords(text: string): string[] {
+ const ws = (text.split(" / ").map((l) => l.trim()).find(Boolean) ?? "").replace(/\*/g, "").split(/\s+/).filter(Boolean);
+ return ws.length ? [ws.slice(0, 2).join(" "), ...(ws.length > 1 && ws[0].length >= 3 ? [ws[0]] : [])] : [];
+}
+
+/** Where a part that says its lines starts when it isn't cued: its first line's first words, as `say` would give them
+ * (undefined when they aren't said: it then starts at 0 and the part says which line isn't said). */
+function saidFirst(find: Find, words: readonly Word[], text: string): number | undefined {
+ for (const phrase of firstWords(text)) {
+ try {
+ return find(words, phrase);
+ } catch {
+ // not said: try the first word alone
+ }
+ }
+ return undefined;
+}
+
+/** One part's span from its own cue, before <Ad> fits the band together. */
+export function spanOf(find: Find, name: string, p: Timing, meta: PartMeta, words: readonly Word[], beats: readonly number[], fps: number, total: number): Span {
+ const from = p.from ?? (p.beat !== undefined ? onBeat(beats, name, p.beat) : p.say ? when(find, words, name, p.say, { occurrence: p.occurrence }) : meta.says && p.text ? saidFirst(find, words, p.text) ?? 0 : 0);
+ // untilBeat is the last beat it's up for (as `until` is the last word): it leaves where the next beat starts
+ const to = p.untilBeat !== undefined ? (p.untilBeat + 1 < beats.length ? onBeat(beats, name, p.untilBeat + 1) : (onBeat(beats, name, p.untilBeat), total)) : p.until ? when(find, words, name, p.until, { edge: "end", after: from }) : from + Math.round((p.seconds ?? meta.seconds) * fps);
+ return { from, to: Math.min(total, Math.max(from + 1, to)) };
+}
+
+/** <Ad>'s layout: each part's span, the band's parts ending where the next starts, the ask holding to the end, and a
+ * part cued on the music up at least READ seconds (else the error says how to fix it). */
+export function layout(find: Find, items: Placed[], words: readonly Word[], beats: readonly number[], fps: number, total: number): Laid {
+ const spans = new Map<number, Span>();
+ const band: (Span & { kind: Kind; i: number })[] = [];
+ const at = new Map(items.map((it) => [it.i, it]));
+ for (const it of items) {
+ const meta = PARTS[it.name];
+ if (!meta || meta.kind === "take" || meta.kind === "captions") continue;
+ const s = spanOf(find, it.name, it.cue, meta, words, beats, fps, total);
+ spans.set(it.i, s);
+ if (meta.kind === "band" || meta.kind === "card" || meta.kind === "full") band.push({ ...s, kind: meta.kind, i: it.i });
+ }
+ band.sort((x, y) => x.from - y.from);
+ band.forEach((b, n) => {
+ const next = band[n + 1];
+ const it = at.get(b.i)!;
+ const p = it.cue;
+ // a part without its own `until` ends where the next one starts
+ if (next && b.to > next.from) b.to = Math.max(b.from + 1, next.from);
+ // the ask, last in the band and given no length, holds to the end: the piece ends on it, not on a caption
+ if (!next && PARTS[it.name]?.ask && !p.until && p.untilBeat === undefined && p.seconds === undefined) b.to = total;
+ // a part cued on the music is up long enough to read: a card for a flip is gone before it's seen (promo run 7 put
+ // thirteen cards a beat or two each). The error says how to fix it, so the writer can.
+ if (p.beat !== undefined && b.to - b.from < READ * fps && b.to < total)
+ throw new Error(`<${it.name} beat={${p.beat}}> is on screen ${((b.to - b.from) / fps).toFixed(1)} s (${next && b.to === next.from ? `until the next part, at beat ${at.get(next.i)!.cue.beat}` : `through beat ${p.untilBeat}`}); a part stays up at least ${READ} s, a bar or more, so it can be read: end it later, or drop it`);
+ spans.set(b.i, { from: b.from, to: b.to });
+ });
+ return { spans, band };
+}
diff --git a/examples/plugins/ball.tsx b/examples/plugins/ball.tsx
new file mode 100644
index 00000000..c07c2d84
--- /dev/null
+++ b/examples/plugins/ball.tsx
@@ -0,0 +1,44 @@
+// PL1's proof (docs/plugins.feature): a project outside the plugins bench imports the catalog by name, the same
+// way any author's project does. A ball dropped on a floor with avian's components from raea/plugins/avian and Bevy's
+// own Bloom from raea/plugins/bevy, typed by bench/tsc. The plugin build (tools/bevy-plugins.sh) renders it.
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Sphere } from "raea/3d";
+import { ColliderConstructor, Restitution, RigidBody } from "raea/plugins/avian";
+import { Bloom } from "raea/plugins/bevy";
+import { avian, bevy } from "@raea/plugins";
+import { StandardMaterial } from "raea/pbr";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { AmbientLight, DirectionalLight } from "raea/light";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+
+function Drop() {
+ return (
+ <AbsoluteFill style={{ background: "#0f1720" }}>
+ <>
+ <Camera3d transform={Transform.fromXyz(0, 2, 7).lookingAt([0, 1, 0])} projection={{ Perspective: { fov: 0.785398163397448 } }} />
+ <Bloom value={{ intensity: 0.2 }} />
+ <AmbientLight brightness={200} />
+ <DirectionalLight transform={Transform.fromXyz(3, 6, 4).lookingAt([0, 0, 0])} illuminance={10400} shadow_maps_enabled />
+ <Mesh3d name="floor">
+ <Cuboid half_size={[3, 0.15, 2]} />
+ <StandardMaterial base_color="#334155" perceptual_roughness={0.8} />
+ <RigidBody value="Static" />
+ <ColliderConstructor value={{ Cuboid: { x_length: 6, y_length: 0.3, z_length: 4 } }} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(0, 3, 0)} name="ball" driven={true}>
+ <Sphere radius={0.4} />
+ <StandardMaterial base_color="#e11d48" perceptual_roughness={0.4} />
+ <RigidBody value="Dynamic" />
+ <ColliderConstructor value={{ Sphere: { radius: 0.4 } }} />
+ <Restitution value={{ coefficient: 0.7, combine_rule: "Max" }} />
+ </Mesh3d>
+ </>
+ </AbsoluteFill>
+ );
+}
+
+// the handles name the plugins a headless BevyApp opens (raea/bevy), from the package's index
+export const plugins = [avian.plugin, bevy.plugin] as const;
+
+registerRoot(() => <Composition id="plugins-ball" component={Drop} width={640} height={360} fps={30} durationInFrames={90} />);
diff --git a/examples/tsconfig.json b/examples/tsconfig.json
new file mode 100644
index 00000000..e7ec617e
--- /dev/null
+++ b/examples/tsconfig.json
@@ -0,0 +1 @@
+{ "//": "Examples import only the SDK by name (raea, raea/<part>): the same map an author's project gets.", "extends": "../sdk/tsconfig.base.json" }
diff --git a/examples/volumes/cloud.tsx b/examples/volumes/cloud.tsx
new file mode 100644
index 00000000..9d4cf765
--- /dev/null
+++ b/examples/volumes/cloud.tsx
@@ -0,0 +1,59 @@
+// A cumulus, one choice of raea/3d's <Volume> (docs/examples.feature EX6): copy it and make it yours.
+import { Volume, type Vec3, type VolumeProps } from "raea/3d";
+
+/** small seeded random numbers, the same for the same seed */
+function rng(seed: number) {
+ let s = (Math.floor(seed) * 2654435761 + 1013904223) >>> 0 || 1;
+ return () => {
+ s ^= s << 13;
+ s >>>= 0;
+ s ^= s >>> 17;
+ s ^= s << 5;
+ s >>>= 0;
+ return s / 4294967296;
+ };
+}
+
+export interface CloudProps extends Omit<VolumeProps, "size" | "sources"> {
+ /** the box, [width, height, depth] ([16, 8, 8]) */
+ size?: Vec3;
+ /** with no `puffs`, how many seeded ones it starts from (9): a cumulus, a flat base and a heaped top */
+ count?: number;
+}
+
+/** A cumulus: puffs of vapour at the start that billow slowly in a drifting turbulence and ride the wind; under a paint
+ * look two or three tones of white and pale blue, shadowed by itself. */
+export function Cloud({ size = [16, 8, 8], count = 9, puffs, ...rest }: CloudProps) {
+ const [w, h, d] = size;
+ if (puffs === undefined) {
+ const r = rng((rest.seed ?? 0) + 7);
+ if (!(Number.isInteger(count) && count >= 1 && count <= 64)) throw new RangeError(`Cloud: count must be a whole number from 1 to 64, got ${count}`);
+ puffs = [];
+ for (let i = 0; i < count; i++) {
+ const u = count === 1 ? 0.5 : i / (count - 1);
+ const x = (u - 0.5) * w * 0.62 + (r() - 0.5) * w * 0.08;
+ const mid = 1 - Math.abs(u - 0.5) * 1.6;
+ const rad = Math.min(h, d) * (0.16 + 0.2 * mid + 0.06 * r());
+ puffs.push([x, h * 0.18 + rad * (0.55 + 0.5 * r() * mid), (r() - 0.5) * d * 0.25, rad]);
+ }
+ }
+ return (
+ <Volume
+ {...rest}
+ size={size}
+ puffs={puffs}
+ colors={rest.colors ?? ["#ffffff", "#dfe8f2", "#b8c8dc"]}
+ buoyancy={rest.buoyancy ?? 0}
+ weight={rest.weight ?? 0}
+ cooling={rest.cooling ?? 0}
+ dissipation={rest.dissipation ?? 0.004}
+ fire={rest.fire ?? false}
+ turbulence={rest.turbulence ?? 0.6}
+ turbulenceSize={rest.turbulenceSize ?? Math.max(1, Math.min(w, h, d) * 0.4)}
+ vorticity={rest.vorticity ?? 2}
+ threshold={rest.threshold ?? 0.18}
+ erodeSize={rest.erodeSize ?? Math.max(0.6, h * 0.12)}
+ absorb={rest.absorb ?? 0.45}
+ />
+ );
+}
diff --git a/examples/volumes/contrail.tsx b/examples/volumes/contrail.tsx
new file mode 100644
index 00000000..c0c96485
--- /dev/null
+++ b/examples/volumes/contrail.tsx
@@ -0,0 +1,67 @@
+// A contrail, one choice of raea/3d's <Volume> (docs/examples.feature EX6): copy it and make it yours.
+import { Volume, type Vec3, type VolumeProps, type VolumeSource } from "raea/3d";
+
+export interface ContrailProps extends Omit<VolumeProps, "position" | "size" | "sources" | "puffs"> {
+ /** where the plane is at `start` and at `end` (seconds), world metres */
+ from: Vec3;
+ to: Vec3;
+ start?: number;
+ end?: number;
+ /** the trail's width when new (0.35 m) and how much it spreads (turbulence) as it ages */
+ width?: number;
+ /** how many engines (1) and how far apart (metres) */
+ engines?: number;
+ spacing?: number;
+}
+
+/** A contrail: a thin trail of vapour left by an engine moving `from` -> `to`, spreading and breaking up as it ages. Put
+ * a small plane at its head (contrailHead gives where it is). */
+export function Contrail({ from, to, start = 0, end = 10, width = 0.35, engines = 1, spacing, ...rest }: ContrailProps) {
+ if (!(end > start)) throw new RangeError(`Contrail: end must be after start, got ${start} -> ${end}`);
+ if (!(width > 0)) throw new RangeError(`Contrail: width must be above 0, got ${width}`);
+ if (!(Number.isInteger(engines) && engines >= 1 && engines <= 4)) throw new RangeError(`Contrail: engines must be 1 to 4, got ${engines}`);
+ // the box around the path, its foot under the middle; the sources in the box's metres
+ const pad = width * 6 + 1;
+ const lo = [0, 1, 2].map((k) => Math.min(from[k], to[k]) - pad);
+ const hi = [0, 1, 2].map((k) => Math.max(from[k], to[k]) + pad);
+ const size: Vec3 = [hi[0] - lo[0], hi[1] - lo[1], hi[2] - lo[2]];
+ const foot: Vec3 = [(lo[0] + hi[0]) / 2, lo[1], (lo[2] + hi[2]) / 2];
+ const local = (p: Vec3): Vec3 => [p[0] - foot[0], p[1] - foot[1], p[2] - foot[2]];
+ const apart = spacing ?? width * 3;
+ const dir = [to[0] - from[0], to[2] - from[2]];
+ const len = Math.hypot(dir[0], dir[1]) || 1;
+ const side = [-dir[1] / len, dir[0] / len];
+ const sources: VolumeSource[] = [];
+ for (let i = 0; i < engines; i++) {
+ const o = (i - (engines - 1) / 2) * apart;
+ const off = (p: Vec3): Vec3 => [p[0] + side[0] * o, p[1], p[2] + side[1] * o];
+ sources.push({ at: local(off(from)), to: local(off(to)), from: start, until: end, radius: width, rate: 9, heat: 0, speed: [0, 0, 0] });
+ }
+ return (
+ <Volume
+ {...rest}
+ position={foot}
+ size={size}
+ sources={sources}
+ resolution={rest.resolution ?? Math.min(160, Math.max(64, Math.round(Math.max(...size) / (width * 0.7))))}
+ colors={rest.colors ?? ["#ffffff", "#e6edf5", "#c4d2e2"]}
+ buoyancy={rest.buoyancy ?? 0}
+ weight={rest.weight ?? 0}
+ cooling={rest.cooling ?? 0}
+ dissipation={rest.dissipation ?? 0.05}
+ fire={rest.fire ?? false}
+ turbulence={rest.turbulence ?? 0.25}
+ turbulenceSize={rest.turbulenceSize ?? Math.max(0.5, width * 4)}
+ vorticity={rest.vorticity ?? 1.5}
+ threshold={rest.threshold ?? 0.1}
+ erodeSize={rest.erodeSize ?? Math.max(0.3, width * 1.5)}
+ absorb={rest.absorb ?? 0.3}
+ />
+ );
+}
+
+/** where a contrail's engine is at `time`: for the plane at its head */
+export function contrailHead(from: Vec3, to: Vec3, time: number, start = 0, end = 10): Vec3 {
+ const u = Math.max(0, Math.min(1, (time - start) / (end - start)));
+ return [from[0] + (to[0] - from[0]) * u, from[1] + (to[1] - from[1]) * u, from[2] + (to[2] - from[2]) * u];
+}
diff --git a/examples/volumes/smoke.tsx b/examples/volumes/smoke.tsx
new file mode 100644
index 00000000..d4b13e58
--- /dev/null
+++ b/examples/volumes/smoke.tsx
@@ -0,0 +1,36 @@
+// A smoke plume, one choice of raea/3d's <Volume> (docs/examples.feature EX6): copy it and make it yours.
+import { Volume, type Vec3, type VolumeProps } from "raea/3d";
+
+export interface SmokeProps extends Omit<VolumeProps, "size" | "sources" | "puffs"> {
+ /** the box it lives in, [width, height, depth] in metres ([6, 12, 6]): the plume is cut where it leaves */
+ size?: Vec3;
+ /** the burner: where in the box (metres from the foot; [0, 0.4, 0]), its radius (1 m), how much smoke and heat it
+ * puts out a second at its centre (12 and 8), and the speed it pushes up with (3 m/s) */
+ source?: Vec3;
+ radius?: number;
+ rate?: number;
+ heat?: number;
+ speed?: number;
+ /** when the burner burns, seconds ([0, Infinity]) */
+ from?: number;
+ until?: number;
+}
+
+/** A smoke plume: hot smoke rising from a burner, leaning in the wind, its curls kept curling; with fire where it's
+ * hottest (`fire={false}` for none). Under a paint look it's two or three flat tones lit by the sun, shadowed by
+ * itself, with torn edges (ref: an illustrated burning field). */
+export function Smoke({ size, source, radius, rate, heat, speed, from, until, ...rest }: SmokeProps) {
+ return (
+ <Volume
+ {...rest}
+ size={size ?? [6, 12, 6]}
+ sources={[{ at: source ?? [0, 0.4, 0], radius: radius ?? 1, rate: rate ?? 12, heat: heat ?? 8, speed: [0, speed ?? 3, 0], from, until }]}
+ colors={rest.colors ?? ["#77777b", "#4a4a4e", "#232326"]}
+ windPull={rest.windPull ?? 1.2}
+ turbulence={rest.turbulence ?? 1.5}
+ turbulenceSize={rest.turbulenceSize ?? 1.5}
+ erode={rest.erode ?? 0.15}
+ erodeSize={rest.erodeSize ?? 0.9}
+ />
+ );
+}
diff --git a/io/assets/src/lib.rs b/io/assets/src/lib.rs
index 84d96b52..5ed5d452 100644
--- a/io/assets/src/lib.rs
+++ b/io/assets/src/lib.rs
@@ -6,7 +6,7 @@
//! seed, what tests use), the two local audio models, `tokensynth` (an instrument's notes, for music) and `sao` (Stable
//! Audio Open on Core ML, foley). Every model runs on this computer. `lyria` (music) and `fish` (narration, through
//! raea's API) are retired: a take made before plays from the index, and a new one is refused. Narration is Pocket TTS
-//! (raea/speech), and Fish Audio is a `raea gen` backend like fal or Replicate (`fish:<model>`, the founder's own key). The local models install themselves on first use (tools/sao/setup.sh,
+//! (raea/speech), and Fish Audio is a `raea gen` backend like fal or Replicate (`fish:<model>`, the user's own key). The local models install themselves on first use (tools/sao/setup.sh,
//! tools/tokensynth/setup.sh). Each made asset gets a line in `assets/made.jsonl` under its cache key, a hash of
//! (model, prompt, seed, params); `made` reads only that index, so a render or a check that resolves a make() never
//! generates.
diff --git a/io/codec/src/audio.rs b/io/codec/src/audio.rs
index beb0953c..415ffb8d 100644
--- a/io/codec/src/audio.rs
+++ b/io/codec/src/audio.rs
@@ -246,7 +246,7 @@ pub fn master_gained(a: &Audio, target: f64, ceiling: f64) -> (Audio, f64) {
/// `master`, held to its ceiling after the encoder: the mastered sound is put through `encode` (an AAC round trip) and,
/// if its true peak comes back over the ceiling, mastered again with the ceiling lowered by the overshoot (twice at
-/// most). AAC adds a few tenths of a dB to a limited true peak (an agent session's -1.5 ceiling gave -1.1 to -1.4 in the file).
+/// most). AAC adds a few tenths of a dB to a limited true peak (a -1.5 ceiling gave -1.1 to -1.4 in the file).
pub fn master_for(a: &Audio, target: f64, ceiling: f64, encode: &dyn Fn(&Audio) -> crate::R<Audio>) -> Audio {
let mut c = ceiling;
let mut out = master(a, target, c);
diff --git a/io/gen-core/src/fish.rs b/io/gen-core/src/fish.rs
index 4ace4a87..2a220772 100644
--- a/io/gen-core/src/fish.rs
+++ b/io/gen-core/src/fish.rs
@@ -1,4 +1,4 @@
-//! Fish Audio: an audio.speech step on Fish's text-to-speech (`fish:<model>`, else `fish:s2.1-pro`), with the founder's own
+//! Fish Audio: an audio.speech step on Fish's text-to-speech (`fish:<model>`, else `fish:s2.1-pro`), with the user's own
//! key in FISH_API_KEY. raea sends the step's words (`text`), its `voice` as Fish's reference_id (a voice model's id
//! from fish.audio) and its `speed` as Fish's prosody speed, and keeps the MP3 that comes back. Fish bills UTF-8 bytes
//! of text ($15 a million on its price list, 11-05), so a plan quotes the words before anything is sent.
diff --git a/io/gen-core/src/flow.rs b/io/gen-core/src/flow.rs
index 4b78a780..58ac3ac2 100644
--- a/io/gen-core/src/flow.rs
+++ b/io/gen-core/src/flow.rs
@@ -43,7 +43,7 @@ pub const OPS: &[(&str, Kind, &[&str], &[&str])] = &[
("audio.music", Kind::Audio, &["prompt"], &["seconds", "seed", "weights"]),
("audio.sfx", Kind::Audio, &["prompt"], &["seconds", "video", "seed", "weights"]),
("audio.speech", Kind::Audio, &["text"], &["voice", "speed"]),
- ("mesh.generate", Kind::Mesh, &[], &["prompt", "image", "refs", "seed", "texture"]),
+ ("mesh.generate", Kind::Mesh, &[], &["prompt", "image", "refs", "seed", "texture", "size"]),
("text.generate", Kind::Text, &["prompt"], &["system", "image", "refs"]),
("media.load", Kind::Any, &[], &["path", "url"]),
("comfy", Kind::Any, &["nodes", "output"], &["bind", "slots"]),
@@ -188,7 +188,8 @@ impl Flow {
let mut keys = BTreeMap::new();
for id in self.order()? {
let s = &self.steps[&id];
- let inputs = J::Object(s.inputs.clone());
+ // a mesh's `size` is fitted after the model is made (raea gen check), so it doesn't make another model
+ let inputs = J::Object(s.inputs.iter().filter(|(k, _)| !(s.op == "mesh.generate" && k.as_str() == "size")).map(|(k, v)| (k.clone(), v.clone())).collect());
let resolved = substitute(&inputs, &|r| keys.get(r).map(|k: &String| format!("key:{k}")));
let text = format!("{}\u{0}{}\u{0}{}", s.op, s.model.as_deref().unwrap_or(""), canonical(&resolved));
keys.insert(id, format!("{:x}", Sha256::digest(text.as_bytes()))[..24].to_string());
diff --git a/io/gen-core/src/lib.rs b/io/gen-core/src/lib.rs
index 8f81f763..e40024bf 100644
--- a/io/gen-core/src/lib.rs
+++ b/io/gen-core/src/lib.rs
@@ -1,7 +1,7 @@
//! Generation flows' ground. A flow (flow.rs) names generation steps by what they make (image.generate,
//! video.generate, audio.sfx, mesh.generate, …), its ops in one table (types.rs writes it as raea/gen's TypeScript);
//! the hosted backends a step runs on are here too: made.app (one key for 118 image, video and audio models at the
-//! provider's price), fal, Replicate, OpenRouter, Modal endpoints, Fish Audio's speech and Tripo 3D (its own CLI, the founder's key). ComfyUI is raea-io-gen-comfy; routing and running
+//! provider's price), fal, Replicate, OpenRouter, Modal endpoints, Fish Audio's speech and Tripo 3D (its own CLI, the user's key). ComfyUI is raea-io-gen-comfy; routing and running
//! are raea-io-gen.
pub mod direct;
diff --git a/io/gen-core/src/openrouter.rs b/io/gen-core/src/openrouter.rs
index 2615706d..0ed448a3 100644
--- a/io/gen-core/src/openrouter.rs
+++ b/io/gen-core/src/openrouter.rs
@@ -1,7 +1,7 @@
//! OpenRouter (openrouter.ai/api/v1): its image-output models (`openrouter:google/gemini-3.1-flash-image`,
//! `openrouter:black-forest-labs/flux-3-image`, …) for image.generate and image.edit, and any of its text models for
//! text.generate (the prompt-writing LLM nodes ComfyUI workflows use). One chat completion: the prompt and any images
-//! as the founder's message, `modalities` asking for images back, which arrive as data URIs. The key is
+//! as the user's message, `modalities` asking for images back, which arrive as data URIs. The key is
//! OPENROUTER_API_KEY.
use std::path::{Path, PathBuf};
diff --git a/io/gen-core/src/tripo.rs b/io/gen-core/src/tripo.rs
index ac93452b..bf6101ab 100644
--- a/io/gen-core/src/tripo.rs
+++ b/io/gen-core/src/tripo.rs
@@ -1,4 +1,4 @@
-//! Tripo 3D through Tripo's own CLI (`npm install -g tripo-cli`, the `tripo` binary), on the founder's own key: a step
+//! Tripo 3D through Tripo's own CLI (`npm install -g tripo-cli`, the `tripo` binary), on the user's own key: a step
//! whose model is `tripo:<model>` (`tripo:` alone is Tripo's default, P2; `tripo:H3.1` the denser, cheaper H series).
//! The CLI does the upload, the polling and the download, and prints one JSON line (`model_file`, `preview`,
//! `credits_consumed`), so raea reads that and nothing else.
@@ -79,7 +79,8 @@ fn command() -> Command {
/// `tripo make`'s arguments for a step: its inputs (a prompt, or 1 image, or 2-4 views as `image` + `refs`, as local
/// paths or URLs), the model, seed, and every x_<name> as `-p name=value` (Tripo's own parameter names:
-/// x_texture_quality=detailed, x_face_limit=8000, x_pbr=true). `texture: false` asks for bare geometry.
+/// x_texture_quality=detailed, x_face_limit=8000, x_pbr=true), then `defaults` for what the step left out.
+/// `texture: false` asks for bare geometry.
pub fn args(model: &str, inputs: &Map<String, J>, media: &[String], out: &Path, dry: bool) -> Vec<String> {
let mut a: Vec<String> = vec!["make".into()];
if media.is_empty() {
@@ -90,9 +91,8 @@ pub fn args(model: &str, inputs: &Map<String, J>, media: &[String], out: &Path,
if !model.is_empty() {
a.extend(["--model".into(), model.to_string()]);
}
- if let Some(s) = inputs.get("seed").and_then(|s| s.as_u64()) {
- a.extend(["--seed".into(), s.to_string()]);
- }
+ let seed = inputs.get("seed").and_then(|s| s.as_u64()).unwrap_or_else(|| seed_of(inputs, media));
+ a.extend(["--seed".into(), seed.to_string()]);
if inputs.get("texture") == Some(&J::Bool(false)) {
a.extend(["-p".into(), "texture=false".into()]);
}
@@ -102,6 +102,9 @@ pub fn args(model: &str, inputs: &Map<String, J>, media: &[String], out: &Path,
a.extend(["-p".into(), format!("{name}={v}")]);
}
}
+ for (name, v) in defaults(model, inputs, media, seed) {
+ a.extend(["-p".into(), format!("{name}={v}")]);
+ }
a.extend(["--json".into(), "--yes".into(), "--no-open".into(), "--quiet".into()]);
if dry {
a.push("--dry-run".into());
@@ -111,6 +114,49 @@ pub fn args(model: &str, inputs: &Map<String, J>, media: &[String], out: &Path,
a
}
+/// The settings a step gets when it doesn't name its own (an `x_<name>` always wins), from what scenes found
+/// generated props need (docs/handoff/solids.md, the 11-06 research):
+/// - `orientation=align_image` for an image or views: the model faces the way the picture does, where Tripo's own
+/// default turns it to +X (every H3.1 prop came out facing sideways);
+/// - `face_limit=30000` on the H series, whose own default is adaptive up to 1.5-2M triangles (40-68 MB a prop); the P
+/// series (clean low topology) keeps its own;
+/// - `auto_size=true` (real metres) and `pbr=true` on a textured model;
+/// - `texture_seed` equal to the geometry's seed, so a rerun of the same step makes the same model (raea's flows are
+/// deterministic; change `seed` for another candidate).
+pub fn defaults(model: &str, inputs: &Map<String, J>, media: &[String], seed: u64) -> Vec<(&'static str, String)> {
+ let has = |k: &str| inputs.contains_key(&format!("x_{k}"));
+ let textured = inputs.get("texture") != Some(&J::Bool(false));
+ let h_series = { let m = model.to_ascii_lowercase(); m.starts_with('h') || m.starts_with("tripo-v3") || m.starts_with("v3") };
+ let mut d = Vec::new();
+ if !media.is_empty() && !has("orientation") {
+ d.push(("orientation", "align_image".to_string()));
+ }
+ if h_series && !has("face_limit") {
+ d.push(("face_limit", "30000".to_string()));
+ }
+ if textured && !has("auto_size") {
+ d.push(("auto_size", "true".to_string()));
+ }
+ if textured && !has("pbr") {
+ d.push(("pbr", "true".to_string()));
+ }
+ if textured && !has("texture_seed") {
+ d.push(("texture_seed", seed.to_string()));
+ }
+ d
+}
+
+/// A step's own seed when it names none: from its prompt and its pictures' names, so the same step asks for the
+/// same model every run (FNV-1a, kept under 2^31 for Tripo's int field).
+fn seed_of(inputs: &Map<String, J>, media: &[String]) -> u64 {
+ let mut h: u64 = 0xcbf29ce484222325;
+ let prompt = inputs.get("prompt").and_then(|p| p.as_str()).unwrap_or("");
+ for b in prompt.bytes().chain(media.iter().flat_map(|m| Path::new(m).file_name().map(|f| f.to_string_lossy().into_owned()).unwrap_or_default().into_bytes())) {
+ h = (h ^ b as u64).wrapping_mul(0x100000001b3);
+ }
+ h % 0x7fff_ffff
+}
+
fn last_json(stdout: &[u8]) -> Option<J> {
String::from_utf8_lossy(stdout).lines().rev().find_map(|l| serde_json::from_str::<J>(l.trim()).ok())
}
diff --git a/io/gen-core/src/types.rs b/io/gen-core/src/types.rs
index 915dbfcc..841d917a 100644
--- a/io/gen-core/src/types.rs
+++ b/io/gen-core/src/types.rs
@@ -19,6 +19,7 @@ fn ty(name: &str) -> &'static str {
"nodes" => "Record<string, { class_type: string; inputs: Record<string, unknown> }>",
"bind" => "Record<string, Ref>",
"slots" => "number[]",
+ "size" => "{ h?: number; dims?: [number, number, number]; turn?: number; faces?: number }",
_ => "unknown",
}
}
diff --git a/io/gen/Cargo.toml b/io/gen/Cargo.toml
index 3cf77498..2ecfa1e4 100644
--- a/io/gen/Cargo.toml
+++ b/io/gen/Cargo.toml
@@ -10,6 +10,8 @@ description = "Generation flows: made.app's models at provider cost, ComfyUI wor
raea-io-gen-comfy = { path = "../gen-comfy" }
raea-io-gen-core = { path = "../gen-core" }
raea-io-home = { path = "../home" }
+# a generated model measured and fitted after its step (raea gen check; fit.rs)
+raea-core-meshcheck = { path = "../../core/meshcheck" }
serde_json = "1"
# image.crop, image.scale, image.stitch, run here (native.rs)
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp"] }
diff --git a/io/gen/src/cli.rs b/io/gen/src/cli.rs
index 4ce947c2..55fd72c0 100644
--- a/io/gen/src/cli.rs
+++ b/io/gen/src/cli.rs
@@ -11,6 +11,8 @@ use crate::run::{Local, Run};
pub const USAGE: &str = "raea gen models [--kind image|video|audio] [--query WORDS] | balance | types [-o FILE] | flow FLOW.ts [-o FLOW.json]
raea gen image|video|music|sfx|speech|mesh|text \"PROMPT\" [--model M] [--image FILE]... [--seconds S] [--aspect W:H] [-o DIR] [--max-cents N] [--plan] (mesh: --model tripo:H3.1|tripo:P2|fal:<endpoint>)
+ raea gen mesh \"PROMPT\" [--image FILE] [--h METRES] [--dims W,D,H] [--turn DEG] (the model checked and fitted: its real height, origin at the bottom centre)
+ raea gen check MODEL.glb [--h METRES] [--dims W,D,H] [--turn DEG] [--faces N | --seen METRES] [--parts a,b] [--rig] [--solid] [-o FIXED.glb] [--json]
raea gen plan FLOW.json|FLOW.ts [--exact] | raea gen run FLOW.json|FLOW.ts [-o DIR] [--max-cents N] [--exact] [--comfy-on-replicate] [--no-local] [--no-tripo]
raea gen comfy import WORKFLOW.json [-o FLOW.json] | comfy export FLOW.json|FLOW.ts [-o WORKFLOW.json] | comfy needs WORKFLOW.json [-o NEEDS.json]
raea gen comfy run WORKFLOW.json [-o DIR] (any workflow as it is, on the ComfyUI server: its input files uploaded, every output fetched)
@@ -106,7 +108,12 @@ pub fn command(args: &[String], local: Option<&dyn Local>) -> Result<String, Str
let flow = read_flow(path)?;
let base = Path::new(path).parent().map(Path::to_path_buf).unwrap_or_default();
let r = runner(args, &base, local);
- write_or_print(&if verb == "plan" { r.plan(&flow)? } else { r.run(&flow)? }, None)
+ if verb == "plan" {
+ return write_or_print(&r.plan(&flow)?, None);
+ }
+ let mut done = r.run(&flow)?;
+ crate::fit::after_run(&flow, &mut done);
+ write_or_print(&done, None)
}
"image" | "video" | "music" | "sfx" | "speech" | "mesh" | "text" => {
let prompt = args.get(1).filter(|p| !p.starts_with("--")).ok_or(USAGE)?;
@@ -133,6 +140,25 @@ pub fn command(args: &[String], local: Option<&dyn Local>) -> Result<String, Str
if let Some(a) = flag(args, "--aspect") {
inputs["aspect_ratio"] = json!(a);
}
+ // a mesh's fit: its real height and box, and a turn to face +z (raea gen check, after it's made)
+ if verb == "mesh" {
+ let mut fit = serde_json::Map::new();
+ for k in ["h", "turn", "faces"] {
+ if let Some(v) = flag(args, &format!("--{k}")) {
+ fit.insert(k.into(), json!(v.parse::<f64>().map_err(|_| format!("--{k} takes a number, got {v:?}"))?));
+ }
+ }
+ if let Some(d) = flag(args, "--dims") {
+ let v: Vec<f64> = d.split(',').filter_map(|x| x.trim().parse().ok()).collect();
+ if v.len() != 3 {
+ return Err(format!("--dims takes W,D,H in metres, got {d:?}"));
+ }
+ fit.insert("dims".into(), json!(v));
+ }
+ if !fit.is_empty() {
+ inputs["size"] = J::Object(fit);
+ }
+ }
let mut step = Step::new(op, inputs);
step.model = flag(args, "--model").map(|m| if m.contains(':') { m.to_string() } else { format!("made:{m}") });
flow.steps.insert("out".into(), step);
@@ -140,8 +166,14 @@ pub fn command(args: &[String], local: Option<&dyn Local>) -> Result<String, Str
flow.check()?;
let cwd = std::env::current_dir().map_err(|e| e.to_string())?;
let r = runner(args, &cwd, local);
- write_or_print(&if args.iter().any(|a| a == "--plan") { r.plan(&flow)? } else { r.run(&flow)? }, None)
+ if args.iter().any(|a| a == "--plan") {
+ return write_or_print(&r.plan(&flow)?, None);
+ }
+ let mut done = r.run(&flow)?;
+ crate::fit::after_run(&flow, &mut done);
+ write_or_print(&done, None)
}
+ "check" => crate::fit::command(args),
"comfy" => comfy_verb(&args[1..]),
"flow" => write_or_print(&read_flow(args.get(1).ok_or(USAGE)?)?.to_json(), flag(args, "-o")),
"types" => {
diff --git a/io/gen/src/fit.rs b/io/gen/src/fit.rs
new file mode 100644
index 00000000..16692627
--- /dev/null
+++ b/io/gen/src/fit.rs
@@ -0,0 +1,116 @@
+//! A generated model measured and fitted before a scene uses it (raea-core-meshcheck): `raea gen check MODEL.glb`, and
+//! every mesh.generate output of a run, by its step's `size` input (`{h, dims, turn, faces}`: its real height in
+//! metres, its real width, depth and height, the degrees to turn its front to +z, its triangle budget). With `h` or
+//! `turn`, the output under its own name is rewritten fitted (scaled, turned, its origin at the bottom centre); the
+//! step's cached file stays as the generator made it.
+
+use std::path::Path;
+
+use raea_core_meshcheck::{Glb, Want, check, fix};
+use serde_json::{Value as J, json};
+
+use crate::flow::Flow;
+
+pub const USAGE: &str = "raea gen check MODEL.glb [--h METRES] [--dims W,D,H] [--turn DEG] [--faces N | --seen METRES] [--parts a,b] [--rig] [--solid] [-o FIXED.glb] [--json] (a model measured: size, pivot, facing, triangles, loose pieces, holes, textures, and the Blender script each fault needs; -o writes it fitted)";
+
+/// A step's `fit` input, or the flags, as what the person wants of the model.
+pub fn want_of(v: &J) -> Want {
+ let dims = v["dims"].as_array().filter(|a| a.len() == 3).map(|a| [a[0].as_f64().unwrap_or(0.0), a[1].as_f64().unwrap_or(0.0), a[2].as_f64().unwrap_or(0.0)]);
+ let parts = v["parts"].as_array().into_iter().flatten().filter_map(|p| p.as_str().map(str::to_string)).collect();
+ Want { h: v["h"].as_f64(), dims, faces: v["faces"].as_u64().map(|f| f as usize), turn: v["turn"].as_f64().unwrap_or(0.0), seen: v["seen"].as_f64(), parts, rig: v["rig"] == true, solid: v["solid"] == true, file: None }
+}
+
+/// One model measured, and written fitted to `out` when given (`out` may be the model itself).
+pub fn check_file(path: &Path, want: &Want, out: Option<&Path>) -> Result<J, String> {
+ let p = path.display().to_string();
+ if let Some(f) = raea_core_meshcheck::blender::unloadable(&p) {
+ return Ok(json!({"file": p, "errors": 1, "warnings": 0, "found": [f]}));
+ }
+ let g = Glb::read(&p)?;
+ let mut r = check(&g, g.bytes.len(), &Want { file: Some(p.clone()), ..want.clone() })?;
+ r["file"] = json!(p);
+ if let Some(o) = out {
+ let f = &r["fixed"];
+ let t = f["translate"].as_array().ok_or("the model has nothing to fit")?;
+ let t = [t[0].as_f64().unwrap_or(0.0), t[1].as_f64().unwrap_or(0.0), t[2].as_f64().unwrap_or(0.0)];
+ let bytes = fix(&g, f["scale"].as_f64().unwrap_or(1.0), want.turn, t)?;
+ // written whole, then moved over: a scene loading it never reads half a model
+ let tmp = o.with_extension(format!("glb.{}.tmp", std::process::id()));
+ std::fs::write(&tmp, &bytes).map_err(|e| format!("{}: {e}", tmp.display()))?;
+ std::fs::rename(&tmp, o).map_err(|e| format!("{}: {e}", o.display()))?;
+ // a licence or provenance sidecar travels with the model
+ for side in ["json", "c2pa"] {
+ let (a, b) = (path.with_extension(format!("glb.{side}")), o.with_extension(format!("glb.{side}")));
+ if a.exists() && a != b {
+ let _ = std::fs::copy(&a, &b);
+ }
+ }
+ r["wrote"] = json!(o.display().to_string());
+ }
+ Ok(r)
+}
+
+/// `raea gen check ...`
+pub fn command(args: &[String]) -> Result<String, String> {
+ let flag = |k: &str| args.iter().position(|a| a == k).and_then(|i| args.get(i + 1)).cloned();
+ let file = args.get(1).filter(|f| !f.starts_with("--")).ok_or(USAGE)?;
+ let num = |k: &str| flag(k).map(|v| v.parse::<f64>().map_err(|_| format!("{k} takes a number, got {v:?}"))).transpose();
+ let dims = flag("--dims").map(|d| {
+ let v: Vec<f64> = d.split(',').filter_map(|x| x.trim().parse().ok()).collect();
+ if v.len() == 3 { Ok([v[0], v[1], v[2]]) } else { Err(format!("--dims takes W,D,H in metres, got {d:?}")) }
+ }).transpose()?;
+ let parts = flag("--parts").map(|p| raea_core_meshcheck::parts(&p)).unwrap_or_default();
+ let on = |k: &str| args.iter().any(|a| a == k);
+ let want = Want { h: num("--h")?, dims, faces: num("--faces")?.map(|f| f as usize), turn: num("--turn")?.unwrap_or(0.0), seen: num("--seen")?, parts, rig: on("--rig"), solid: on("--solid"), file: None };
+ let out = flag("-o");
+ let r = check_file(Path::new(file), &want, out.as_deref().map(Path::new))?;
+ let text = if args.iter().any(|a| a == "--json") {
+ serde_json::to_string_pretty(&r).unwrap_or_default()
+ } else {
+ say(&r)
+ };
+ if r["errors"].as_u64().unwrap_or(0) > 0 {
+ println!("{text}");
+ std::process::exit(1);
+ }
+ Ok(text)
+}
+
+/// The findings as lines, lint's way: warnings and errors, then one line of totals.
+pub fn say(r: &J) -> String {
+ let mut t = Vec::new();
+ for f in r["found"].as_array().into_iter().flatten().filter(|f| f["level"] != "ok") {
+ t.push(format!("{:<8} {}", f["level"].as_str().unwrap_or(""), f["says"].as_str().unwrap_or("")));
+ }
+ let m = &r["measured"];
+ // a file raea can't read has no measures: its summary says so instead of nulls
+ let measured = if m["triangles"].is_null() { "not read".to_string() } else { format!("{} triangles, {} x {} x {} m", m["triangles"], m["size"][0], m["size"][1], m["size"][2]) };
+ t.push(format!("{}: {measured}, {} errors, {} warnings{}", r["file"].as_str().unwrap_or("model"), r["errors"], r["warnings"], r["wrote"].as_str().map(|w| format!("; fitted copy {w}")).unwrap_or_default()));
+ t.join("\n")
+}
+
+/// After a run: every mesh.generate output checked, and fitted in place under its own name when its step says how
+/// (`size.h` or `size.turn`). The reports go into the run's result as `checks`.
+pub fn after_run(flow: &Flow, result: &mut J) {
+ let mut checks = serde_json::Map::new();
+ for name in &flow.out {
+ let Some(step) = flow.steps.get(name).filter(|s| s.op == "mesh.generate") else { continue };
+ let fit = step.inputs.get("size").cloned().unwrap_or(J::Null);
+ let want = want_of(&fit);
+ let files: Vec<String> = match &result["out"][name] {
+ J::Array(a) => a.iter().filter_map(|f| f.as_str().map(str::to_string)).collect(),
+ J::String(s) => vec![s.clone()],
+ _ => vec![],
+ };
+ for f in files.iter().filter(|f| f.to_ascii_lowercase().ends_with(".glb")) {
+ let p = Path::new(f);
+ let fitted = want.h.is_some() || want.turn != 0.0;
+ let r = check_file(p, &want, fitted.then_some(p)).unwrap_or_else(|e| json!({"file": f, "errors": 1, "found": [{"check": "read", "level": "error", "says": e}]}));
+ eprintln!("raea gen: {}", say(&r).replace('\n', "\nraea gen: "));
+ checks.insert(name.clone(), r);
+ }
+ }
+ if !checks.is_empty() {
+ result["checks"] = J::Object(checks);
+ }
+}
diff --git a/io/gen/src/hosted.rs b/io/gen/src/hosted.rs
index 189fc2f4..7a119f4e 100644
--- a/io/gen/src/hosted.rs
+++ b/io/gen/src/hosted.rs
@@ -30,6 +30,10 @@ fn media(done: &BTreeMap<String, Made1>, v: &J, up: Upload) -> Result<Option<Str
fn split(s: &Step, done: &BTreeMap<String, Made1>, up: Upload) -> Result<(Map<String, J>, Vec<(String, String)>), String> {
let (mut lit, mut med) = (Map::new(), Vec::new());
for (k, v) in &s.inputs {
+ // a mesh's size is raea's to fit afterwards (fit.rs), never a model's setting
+ if s.op == "mesh.generate" && k == "size" {
+ continue;
+ }
let vals: Vec<&J> = match v { J::Array(a) if a.iter().any(|x| reference(x).is_some()) => a.iter().collect(), _ => vec![v] };
let mut any = false;
for x in vals {
diff --git a/io/gen/src/lib.rs b/io/gen/src/lib.rs
index b5fc599f..ca1e72f6 100644
--- a/io/gen/src/lib.rs
+++ b/io/gen/src/lib.rs
@@ -4,6 +4,7 @@
//! both re-exported here under their old paths.
pub mod cli;
+pub mod fit;
mod hosted;
pub mod native;
pub mod route;
diff --git a/io/gen/src/route.rs b/io/gen/src/route.rs
index 497fdcfc..30c0656b 100644
--- a/io/gen/src/route.rs
+++ b/io/gen/src/route.rs
@@ -1,6 +1,6 @@
//! Where each step runs. A step that names its model goes there (`made:<id>`, `fal:<endpoint>`,
//! `replicate:<owner/name>`, `openrouter:<model>`, `modal:<endpoint>`, `fish:<model>`, `tripo:<model>`, `comfy`, `local:<name>`). mesh.generate goes to
-//! Tripo 3D: through the tripo CLI on the founder's own key when this host has both (tripo.rs), else the same Tripo model on fal. text.generate goes to
+//! Tripo 3D: through the tripo CLI on the user's own key when this host has both (tripo.rs), else the same Tripo model on fal. text.generate goes to
//! OpenRouter (RAEA_GEN_TEXT_MODEL, else Kimi). Otherwise: a `comfy` step on the ComfyUI server; a step with ComfyUI weights on the server too when
//! the flow asks for the exact weights (`--exact`), else made's model for that op, which is noted as standing in for
//! them; a local model when the host has one for the op (sao for effects); made for the rest.
@@ -16,9 +16,9 @@ pub enum Backend {
Replicate(String),
OpenRouter(String),
Modal(String),
- /// Fish Audio's text-to-speech, with the founder's FISH_API_KEY (raea-io-gen-core's fish.rs)
+ /// Fish Audio's text-to-speech, with the user's FISH_API_KEY (raea-io-gen-core's fish.rs)
Fish(String),
- /// Tripo 3D through its own CLI and the founder's key (raea-io-gen-core's tripo.rs); the name is Tripo's model id or alias
+ /// Tripo 3D through its own CLI and the user's key (raea-io-gen-core's tripo.rs); the name is Tripo's model id or alias
Tripo(String),
Comfy,
Local(String),
@@ -112,7 +112,7 @@ pub fn route(s: &Step, p: &Policy) -> Result<(Backend, Option<String>), String>
"comfy" => return Ok((Backend::Comfy, None)),
"text.generate" => return Ok((Backend::OpenRouter(crate::setting("RAEA_GEN_TEXT_MODEL").unwrap_or_else(|| "moonshotai/kimi-k3.1-pro".into())), None)),
"mesh.generate" => {
- // Tripo by default (hunyuan-3d rapid on fal errored three times running, 10-29): its CLI on the founder's key when
+ // Tripo by default (hunyuan-3d rapid on fal errored three times running, 10-29): its CLI on the user's key when
// the host has both, else fal's resale of the same model
if p.tripo {
return Ok((Backend::Tripo(String::new()), None));
diff --git a/io/gen/src/tests_tripo.rs b/io/gen/src/tests_tripo.rs
index 5d0d9bdd..2ae4577c 100644
--- a/io/gen/src/tests_tripo.rs
+++ b/io/gen/src/tests_tripo.rs
@@ -21,6 +21,20 @@ fn tripo_routes_and_args() {
assert_eq!((a[1].as_str(), a[2].as_str(), a.last().unwrap().as_str()), ("/x/front.png", "/x/back.png", "--dry-run"));
assert_eq!(crate::tripo::fal_twin("H3.1", 1), "tripo3d/h3.1/image-to-3d");
assert_eq!(crate::tripo::fal_twin("tripo-p1", 3), "tripo3d/p1/multiview-to-3d");
+ // the defaults: a step's own x_ wins (face_limit 8000 stays, no second one); pictures face their own way; a
+ // textured model in metres with its texture seeded like its geometry
+ assert_eq!(line.matches("face_limit=").count(), 1, "{line}");
+ assert!(line.contains("-p auto_size=true") && line.contains("-p pbr=true") && line.contains("-p texture_seed=7") && !line.contains("orientation"), "{line}");
+ let bare = Step::new("mesh.generate", json!({"prompt": "a CRT television"}));
+ let a = crate::tripo::args("H3.1", &bare.inputs, &["/x/tv.png".into()], std::path::Path::new("/tmp/o"), false).join(" ");
+ assert!(a.contains("-p orientation=align_image") && a.contains("-p face_limit=30000"), "{a}");
+ // no seed given: one from the step, the same every run
+ let again = crate::tripo::args("H3.1", &bare.inputs, &["/x/tv.png".into()], std::path::Path::new("/tmp/o"), false).join(" ");
+ assert_eq!(a, again);
+ // P2 keeps its own topology; bare geometry gets no texture settings
+ let geo = Step::new("mesh.generate", json!({"prompt": "a CRT television", "texture": false}));
+ let p2 = crate::tripo::args("P2", &geo.inputs, &[], std::path::Path::new("/tmp/o"), false).join(" ");
+ assert!(!p2.contains("face_limit") && !p2.contains("auto_size") && !p2.contains("pbr=") && p2.contains("texture=false"), "{p2}");
}
#[test]
@@ -40,3 +54,15 @@ fn naming_an_output_never_truncates_it() {
assert_eq!(std::fs::read(dir.join("prop.glb")).unwrap(), b"glTF-bytes");
let _ = std::fs::remove_dir_all(&dir);
}
+
+#[test]
+fn a_mesh_steps_size_is_fitted_after_and_leaves_its_key() {
+ // the same step with and without a size has the same key: fitting after doesn't make another model
+ let mut f = crate::flow::Flow::default();
+ f.steps.insert("m".into(), Step::new("mesh.generate", json!({"prompt": "a chair"})));
+ let k0 = f.keys().unwrap()["m"].clone();
+ f.steps.insert("m".into(), Step::new("mesh.generate", json!({"prompt": "a chair", "size": {"h": 0.9}})));
+ assert_eq!(f.keys().unwrap()["m"], k0);
+ f.check().unwrap();
+ assert_eq!(crate::fit::want_of(&json!({"h": 0.9, "dims": [0.5, 0.5, 0.9], "turn": 90})).h, Some(0.9));
+}
diff --git a/io/home/src/lib.rs b/io/home/src/lib.rs
index 93a6d12e..8937836f 100644
--- a/io/home/src/lib.rs
+++ b/io/home/src/lib.rs
@@ -70,7 +70,7 @@ fn user_dir(apple: &str, xdg: &str, xdg_default: &str, windows: &str) -> Option<
Some(base.join("raea"))
}
-/// A path an environment variable names, else `under_home` in the founder's home folder: RAEA_GEN_CACHE's
+/// A path an environment variable names, else `under_home` in the user's home folder: RAEA_GEN_CACHE's
/// ~/.cache/raea-gen, RAEA_ENV_FILE's ~/.raea/env. An empty variable counts as unset.
pub fn env_path(var: &str, under_home: &str) -> std::path::PathBuf {
match std::env::var_os(var).filter(|v| !v.is_empty()) {
diff --git a/io/media/Cargo.toml b/io/media/Cargo.toml
index 0f3975cc..b47a3427 100644
--- a/io/media/Cargo.toml
+++ b/io/media/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
-description = "raea's media plane under one name: the backends compiled in (ffmpeg, portable software, Apple hardware, AV1), each encoder signing what it finishes"
+description = "raea's media plane under one name: the backends compiled in (ffmpeg, portable software, Apple hardware, AV1), each wrapped by a signer when one is installed"
[features]
default = ["soft", "av1", "apple"]
diff --git a/io/media/docs/licences.feature b/io/media/docs/licences.feature
index b4f82817..a3304c65 100644
--- a/io/media/docs/licences.feature
+++ b/io/media/docs/licences.feature
@@ -1,6 +1,7 @@
Feature: What the media plane may ship, per backend
raea-media's backends, what each links, under which licence, and which codec patents apply. Checked against
- `cargo metadata` (no GPL or AGPL crate anywhere in the dependency graph). This is an engineering record, not legal advice: a release that ships H.264 or AAC encoders in
+ `cargo metadata` on 2026-10-13 (no GPL or AGPL crate anywhere in the dependency graph; the scan is in
+ bench/licences.txt). This is an engineering record, not legal advice: a release that ships H.264 or AAC encoders in
our own binaries goes past legal review first.
Background:
diff --git a/io/media/src/lib.rs b/io/media/src/lib.rs
index d6e6e839..af2f145f 100644
--- a/io/media/src/lib.rs
+++ b/io/media/src/lib.rs
@@ -10,8 +10,8 @@
//!
//! Other platforms (Android MediaCodec, Linux VA-API / NVDEC) slot in behind the same trait.
//!
-//! This crate is that one name: the backends compiled in (by feature), each encoder signing what it finishes, and the
-//! seam's types re-exported, so callers say `raea_io_media::backend("apple")`.
+//! This crate is that one name: the backends compiled in (by feature), each wrapped by a signer when one is
+//! installed (sign.rs), and the seam's types re-exported, so callers say `raea_io_media::backend("apple")`.
pub use raea_io_codec::*;
#[cfg(all(feature = "apple", target_vendor = "apple"))]
@@ -27,7 +27,7 @@ pub mod pcm;
/// optimized copies of long-GOP sources: where they are and how they're made
pub mod mezz;
-#[cfg(any(feature = "soft-audio", feature = "provenance"))]
+#[cfg(feature = "soft-audio")]
use std::path::Path;
/// `secs` seconds of a file's sound from `start` (decode_audio's time): a seek and a short decode, for streaming a long
@@ -53,16 +53,13 @@ pub fn backends() -> Vec<Box<dyn Backend>> {
v.push(Box::new(apple::Apple));
#[cfg(feature = "av1")]
v.push(Box::new(av1::Av1));
- v
-}
-
-/// Whether this build's encoders sign what they write (Content Credentials): raea's own build does, the public engine
-/// doesn't, and a report says which (docs/targets.feature T1e)
-pub const SIGNS: bool = signs();
-const fn signs() -> bool {
- false
+ // an installed signer wraps each backend, so its encoders sign and mark what they write (sign.rs)
+ v.into_iter().map(sign::wrap).collect()
}
+/// Signing what raea writes (Content Credentials, the watermark): a hook a signer installs from outside this crate
+pub mod sign;
+pub use sign::signs;
/// The backends to try for a file, in order: RAEA_MEDIA's, the platform's, the portable one, then the ffmpeg CLI
/// (which reads what the others don't: VP9 WebM).
@@ -86,4 +83,3 @@ pub fn backend(name: &str) -> R<Box<dyn Backend>> {
.ok_or(format!("no backend {name:?} in this build"))
}
-
diff --git a/io/media/src/sign.rs b/io/media/src/sign.rs
new file mode 100644
index 00000000..54dfcf0a
--- /dev/null
+++ b/io/media/src/sign.rs
@@ -0,0 +1,50 @@
+//! Signing what raea writes, installed from outside this crate. Content Credentials and the watermark that carries an
+//! export's id are raea's own service, so the engine holds only this seam: a program that signs (raea's own build)
+//! installs a `Signer` before its first export, and every backend `backends()` hands out is wrapped by it, so each
+//! encoder signs and marks what it finishes. With nothing installed, files are written as they are, unsigned.
+use crate::Backend;
+use std::path::Path;
+use std::sync::OnceLock;
+
+/// How raea made a file: its manifest's digital source type.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Made {
+ /// drawn by raea's engine from code: renders, edits, games
+ Created,
+ /// made by a trained model (local foley and instruments)
+ Generated,
+}
+
+/// What signs raea's exports.
+pub trait Signer: Send + Sync {
+ /// The backend whose encoders sign (and mark) each file they finish.
+ fn wrap(&self, backend: Box<dyn Backend>) -> Box<dyn Backend>;
+ /// A file written outside an encoder (a render's still, generated sound): signed in place, a PNG's pixels marked.
+ fn sign_file(&self, path: &Path, made: Made);
+}
+
+static SIGNER: OnceLock<Box<dyn Signer>> = OnceLock::new();
+
+/// Install the signer, once, before the first export. A second install is refused.
+pub fn install(signer: Box<dyn Signer>) -> Result<(), String> {
+ SIGNER.set(signer).map_err(|_| "raea-io-media: a signer is already installed".to_string())
+}
+
+/// Whether this program signs what it writes (a report says which: docs/targets.feature T1e).
+pub fn signs() -> bool {
+ SIGNER.get().is_some()
+}
+
+pub(crate) fn wrap(backend: Box<dyn Backend>) -> Box<dyn Backend> {
+ match SIGNER.get() {
+ Some(s) => s.wrap(backend),
+ None => backend,
+ }
+}
+
+/// Sign a file raea wrote outside an encoder (a still, generated sound), when a signer is installed.
+pub fn sign_file(path: &Path, made: Made) {
+ if let Some(s) = SIGNER.get() {
+ s.sign_file(path, made);
+ }
+}
diff --git a/io/os/src/lib.rs b/io/os/src/lib.rs
index 58f50b70..d1a9679a 100644
--- a/io/os/src/lib.rs
+++ b/io/os/src/lib.rs
@@ -1,4 +1,4 @@
-//! The system's host calls (docs/targets.feature T2d, agreed with raea-59 for raea-3f on 11-06), answered the same on
+//! The system's host calls (docs/targets.feature T2d, agreed on 11-06), answered the same on
//! both app targets: runtime/js os.rs and engine/rune js.rs each hand a call here with how to answer.
//!
//! os.open {url} -> null http, https or mailto in the system's handler; any other scheme refused
diff --git a/runtime/bundle/lib/Cargo.toml b/runtime/bundle/lib/Cargo.toml
index 6606f915..5498a465 100644
--- a/runtime/bundle/lib/Cargo.toml
+++ b/runtime/bundle/lib/Cargo.toml
@@ -10,4 +10,6 @@ description = "raea-bundle's library (engine/bundle: Rolldown) loaded at run tim
# never a Cargo dependency on raea-bundle itself: Rolldown's crates turn on serde_json's preserve_order and
# arbitrary_precision, and features unify across a binary (f60e0b7)
libloading = "0.8"
+# paths without Windows' verbatim \\?\ prefix, which Rolldown's resolver can't open (T1f)
+raea-io-home = { path = "../../../io/home" }
serde_json = "1"
diff --git a/runtime/bundle/lib/src/app.rs b/runtime/bundle/lib/src/app.rs
index e427e1b8..f9d116e7 100644
--- a/runtime/bundle/lib/src/app.rs
+++ b/runtime/bundle/lib/src/app.rs
@@ -38,9 +38,11 @@ fn ui(home: &Path) -> serde_json::Value {
/// `app` bundled against `home`: its script and the CSS its modules import
pub fn bundle(app: &Path, home: &Path) -> Result<(String, String), String> {
- let app = app.canonicalize().map_err(|e| format!("{}: {e}", app.display()))?;
+ // canonical, and on Windows without canonicalize()'s verbatim \\?\ prefix: Rolldown can't resolve an entry that
+ // imports a path written with it (T1f: the Windows release check, 11-07)
+ let app = raea_io_home::plain(app.canonicalize().map_err(|e| format!("{}: {e}", app.display()))?);
// one path per file: a module reached by two spellings of its path is bundled twice (two wires, two call ids)
- let home = &home.canonicalize().map_err(|e| format!("{}: {e}", home.display()))?;
+ let home = &raea_io_home::plain(home.canonicalize().map_err(|e| format!("{}: {e}", home.display()))?);
// one work folder per call: tests bundle on several threads of one process
static N: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
let work = std::env::temp_dir().join(format!("raea-app-{}-{}", std::process::id(), N.fetch_add(1, std::sync::atomic::Ordering::Relaxed)));
diff --git a/runtime/bundle/src/entry.rs b/runtime/bundle/src/entry.rs
index 64938f6c..6bc3b122 100644
--- a/runtime/bundle/src/entry.rs
+++ b/runtime/bundle/src/entry.rs
@@ -14,7 +14,7 @@ pub fn entry(file: &str, o: &CompOpts) -> String {
import {{ mount, addEventListener }} from "bevy-react";
import {{ Component, useEffect, useMemo, useState }} from "react";
import * as M from "./src/{file}";
-import {{ Clock, getCompositions }} from "./motion";
+import {{ Clock, getCompositions, tickClocks }} from "./motion";
const want = {comp};
const comps = getCompositions();
const reg = comps.find((c) => want === null || c.id === want) ?? null;
@@ -84,7 +84,7 @@ class Catch extends Component<{{ children?: any }}, {{ err: string | null }}> {{
const LIVE: any = {{}};
let live = false;
function Root() {{
- const [f, setF] = useState(-1);
+ const [f, setF0] = useState(-1); const setF = (n: number) => {{ tickClocks(); setF0(n); }}; // the Clocks' frame readers told in the same batch (motion clock.tsx tickClocks)
// the stage's size, for a composition that lays out from useVideoConfig (raea-size)
const [size, setSize] = useState<{{ w: number; h: number }} | null>(null);
useEffect(() => addEventListener("raea-size", (v: any) => setSize(v)), []);
diff --git a/runtime/calls/Cargo.toml b/runtime/calls/Cargo.toml
index 285635e3..3e711bb8 100644
--- a/runtime/calls/Cargo.toml
+++ b/runtime/calls/Cargo.toml
@@ -14,6 +14,7 @@ ml = ["dep:raea-sys-ml", "dep:raea-sys-speech"]
raea-runtime-plugins = { path = "../plugins" }
raea-native = { path = "../../engine/native", default-features = false }
raea-core-shape = { path = "../../core/shape" }
+raea-core-place = { path = "../../core/place" }
raea-core-scene = { path = "../../core/scene" }
raea-io-media = { path = "../../io/media", default-features = false, features = ["soft-audio", "apple"] }
raea-io-net = { path = "../../io/net" }
diff --git a/runtime/calls/src/lib.rs b/runtime/calls/src/lib.rs
index 9884ffcd..ff594a2e 100644
--- a/runtime/calls/src/lib.rs
+++ b/runtime/calls/src/lib.rs
@@ -167,6 +167,8 @@ pub fn call(name: &str, v: &Value) -> R<Value> {
Ok(Value::Null)
}
n if n.starts_with("ecs.") => ecs::call(n, v),
+ // placement by relations (raea-core-place)
+ "place.solve" => raea_core_place::solve_json(v),
n if n.starts_with("solid.") || n.starts_with("section.") => solid::call(&mut st, n, v),
n => media::call(&mut st, n, v),
}
@@ -203,6 +205,7 @@ pub fn register() {
("solid.hull_points", "{ points: [number, number, number][] }", SOLID, "the convex hull of points"),
("section.op", "{ fn: \"make\" | \"circle\" | \"square\" | \"hull_points\" | \"union\" | \"minus\" | \"intersect\" | \"hull\" | \"minkowski\" | \"offset\" | \"simplify\" | \"translate\" | \"rotate\" | \"scale\" | \"mirror\" | \"decompose\"; polygons?: [number, number][][]; others?: [number, number][][][]; args?: number[] }", &format!("{SECTION} | {SECTION}[]"), "a 2D cross-section made, combined, offset or moved (Manifold's CrossSection), held by value"),
("solid.free", "{ id: number }", "null", "drop a solid"),
+ ("place.solve", "{ objects: { id: string; size: [number, number, number]; at?: [number, number, number]; yaw?: number; fixed?: boolean }[]; rules: Record<string, string | number>[]; room?: { min: [number, number]; max: [number, number] } }", "{ objects: { id: string; at: [number, number, number]; yaw: number; size: [number, number, number] }[]; found: { part: string; check: string; level: string; says: string }[]; errors: number }", "boxes placed by relations (on, against, beside, near, apart, facing, align, clear), what can't hold found"),
("media.live", "{}", "{ vdecs: number; vencs: number; adecs: number; frames: number; solids: number; worlds: number }", "how many native coders, frames, solids and worlds are alive (for leak checks)"),
("media.size", "{ path: string }", "number", "a file's size in bytes"),
("media.read", "{ path: string; start: number; end: number }", "string", "bytes start..end of a file, base64"),
diff --git a/runtime/encode/src/html.rs b/runtime/encode/src/html.rs
index 112a7ccb..9b55fb3a 100644
--- a/runtime/encode/src/html.rs
+++ b/runtime/encode/src/html.rs
@@ -1,4 +1,4 @@
-//! An HTML composition (a the HTML composition format-format page) on raea-render's GPU path. The Blitz page (raea-page's html.rs), its
+//! An HTML composition on raea-render's GPU path. The Blitz page (raea-page's html.rs), its
//! scripts on @raea/ui's DOM, draws the whole page, its `<video>`s included, as the overlay over transparency, a frame at a time;
//! its `<audio>`, and each `<video>` with sound, become sound rows.
diff --git a/runtime/export/Cargo.toml b/runtime/export/Cargo.toml
index 0594a26f..57c91912 100644
--- a/runtime/export/Cargo.toml
+++ b/runtime/export/Cargo.toml
@@ -25,6 +25,10 @@ raea-core-scene = { path = "../../core/scene" }
raea-runtime-scene = { path = "../scene" }
raea-sys-contact = { path = "../../systems/contact" }
raea-sys-light-meter = { path = "../../systems/light-meter" }
+# --clay: every standard surface grey (its clay switch)
+raea-runtime-scene3d = { path = "../scene3d" }
+# --review: the fixed cameras
+raea-core-review = { path = "../../core/review" }
raea-sys-mix = { path = "../../systems/mix" }
bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app"] }
image = { version = "0.25", default-features = false, features = ["png", "hdr"] }
diff --git a/runtime/export/src/lib.rs b/runtime/export/src/lib.rs
index f3445414..aaa82f6a 100644
--- a/runtime/export/src/lib.rs
+++ b/runtime/export/src/lib.rs
@@ -42,6 +42,7 @@ mod sound;
use sound::*;
mod render;
pub use render::*;
+mod review;
mod run;
pub use run::*;
mod scene;
diff --git a/runtime/export/src/render.rs b/runtime/export/src/render.rs
index 86b49657..1a9368ec 100644
--- a/runtime/export/src/render.rs
+++ b/runtime/export/src/render.rs
@@ -21,6 +21,13 @@ pub(crate) fn out_ext(out: &Path) -> String {
/// `raea render EDIT.tsx -o OUT ...`: the edit bundled with the words and perception beside it (a flag wins), its
/// export options set, then rendered, or cloned from the export cache when a whole video was made from the same inputs
pub fn render(args: &[String]) -> R<String> {
+ // --review DIR: the fixed cameras in colour and clay, stitched (review.rs); --clay: every standard surface grey
+ if let Some(d) = flag(args, "--review") {
+ return crate::review::review(args, Path::new(&d));
+ }
+ if args.iter().any(|a| a == "--clay") {
+ raea_runtime_scene3d::clay::CLAY.store(true, std::sync::atomic::Ordering::Relaxed);
+ }
let tsx = PathBuf::from(&args[1]).canonicalize().map_err(|e| format!("{}: {e}", args[1]))?;
let out = PathBuf::from(flag(args, "-o").ok_or("-o OUT.mp4|OUT.png|DIR")?);
let dir = tsx.parent().unwrap().to_path_buf();
@@ -85,7 +92,7 @@ pub fn render(args: &[String]) -> R<String> {
if std::fs::copy(c, &out).is_ok() && kept_manifest.as_ref().is_none_or(|(m, k)| std::fs::copy(k, m).is_ok()) {
let _ = std::fs::File::options().append(true).open(c).and_then(|f| f.set_modified(std::time::SystemTime::now()));
let _ = std::fs::remove_file(&js);
- return Ok(format!("{} (the same export as before: from the export cache)", said.replace("{OUT}", &out.display().to_string())));
+ return Ok(with_exposure(format!("{} (the same export as before: from the export cache)", said.replace("{OUT}", &out.display().to_string())), &out, manifest.as_deref()));
}
}
}
@@ -111,7 +118,42 @@ pub fn render(args: &[String]) -> R<String> {
}
}
}
- said
+ said.map(|s| with_exposure(s, &out, manifest.as_deref()))
+}
+
+/// The render's message with its pictures' exposure after it (a still, or a folder's frames; a video's frames are
+/// measured by rendering them to a folder with --at), and the stats in the manifest with --manifest.
+fn with_exposure(said: String, out: &Path, manifest: Option<&Path>) -> String {
+ let pngs: Vec<PathBuf> = if out.is_dir() {
+ let mut v: Vec<PathBuf> = std::fs::read_dir(out).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.file_name().is_some_and(|n| n.to_string_lossy().starts_with("frame-")) && p.extension().is_some_and(|x| x == "png")).collect();
+ v.sort();
+ v
+ } else if out.extension().is_some_and(|x| x == "png") {
+ vec![out.to_path_buf()]
+ } else {
+ return said;
+ };
+ if pngs.is_empty() {
+ return said;
+ }
+ match raea_sys_light_meter::exposure::of_pngs(&pngs) {
+ Ok((e, v)) => {
+ if let Some(m) = manifest {
+ if let Ok(mut doc) = std::fs::read_to_string(m).map_err(|e| e.to_string()).and_then(|t| serde_json::from_str::<serde_json::Value>(&t).map_err(|e| e.to_string())) {
+ if let Some(o) = doc.as_object_mut() {
+ o.insert("exposure".into(), v.clone());
+ let _ = std::fs::write(m, doc.to_string());
+ }
+ }
+ }
+ let mut msg = format!("{said}\nEXPOSURE {}", e.line());
+ for f in v["found"].as_array().into_iter().flatten() {
+ msg.push_str(&format!("\n {}: {}", f["level"].as_str().unwrap_or(""), f["says"].as_str().unwrap_or("")));
+ }
+ msg
+ }
+ Err(e) => format!("{said}\nEXPOSURE not measured: {e}"),
+ }
}
/// A bundled composition rendered by the engine, in this process (the Mac or the iPhone): React on JavaScriptCore inside Bevy steps
diff --git a/runtime/export/src/review.rs b/runtime/export/src/review.rs
new file mode 100644
index 00000000..802cab0d
--- /dev/null
+++ b/runtime/export/src/review.rs
@@ -0,0 +1,89 @@
+//! `raea render EDIT.tsx --review DIR [--frame N]`: the same fixed cameras every round, in colour and in clay. The
+//! cameras come from the frame's parts (scene lint's boxes; ground slabs and other flat, wide parts left out): hero
+//! (the scene's own camera), front (+z looking -z), right, top, iso, and low (0.3 m off the floor, for feet and
+//! floaters); an interior (a ceiling over the plan) gets the same views from inside, under the ceiling. Each is rendered by a child raea with RAEA_CAMERA (raea-core-review, which also places the cameras) and, for clay, RAEA_CLAY
+//! (runtime/scene3d's clay.rs). The tiles are stitched into DIR/colour.png and DIR/clay.png, and DIR/review.json gives
+//! the cameras, each tile's place on the sheets and its exposure, and what the exposure found.
+
+use super::*;
+use crate::scene3d::items;
+use raea_core_review::{TILE_W, VIEWS, boxes_of, cameras, ceiling, inside, parts_box, passed, whole};
+
+pub fn review(args: &[String], dir_out: &Path) -> R<String> {
+ let tsx = PathBuf::from(&args[1]).canonicalize().map_err(|e| format!("{}: {e}", args[1]))?;
+ let dir = tsx.parent().unwrap().to_path_buf();
+ let frame = crate::scene::frame_of(args)?;
+ std::fs::create_dir_all(dir_out).map_err(|e| format!("{}: {e}", dir_out.display()))?;
+ // the frame's parts, measured as scene lint measures them
+ let js = std::env::temp_dir().join(format!("raea-review-{}.js", std::process::id()));
+ bundle_composition(&tsx, &js, &comp_opts(args)?, None)?;
+ let got = scene_frames_to(&js, &dir, frame + 1);
+ let _ = std::fs::remove_file(&js);
+ let (frames, w, h, _) = got?.ok_or("--review: the composition has no 3D")?;
+ let k = frames.iter().position(|(f, _)| *f == frame).ok_or_else(|| format!("--review: no frame {frame}"))?;
+ let its = items(&frames[k].1);
+ let (found, _) = raea_sys_contact::lint(&its, &its);
+ let (lo, hi) = parts_box(&found).ok_or("--review: no part with a size in the frame")?;
+ let aspect = w as f64 / h.max(1) as f64;
+ let mut cams: Vec<(&str, Option<([f64; 3], [f64; 3], f64)>)> = vec![("hero", None)];
+ let all = boxes_of(&found);
+ let (wlo, whi) = whole(&all).unwrap_or((lo, hi));
+ let ceil = ceiling(&all, wlo, whi);
+ let fixed = match ceil { Some(y) => inside(wlo, whi, y), None => cameras(lo, hi, aspect) };
+ cams.extend(fixed.into_iter().map(|(v, e, t, f)| (v, Some((e, t, f)))));
+ let exe = std::env::current_exe().map_err(|e| e.to_string())?;
+ let rest = passed(args);
+ let mut tiles = Vec::new();
+ let mut said = Vec::new();
+ for (view, cam) in &cams {
+ for mode in ["colour", "clay"] {
+ let out = dir_out.join(format!("{view}-{mode}.png"));
+ let mut cmd = std::process::Command::new(&exe);
+ cmd.arg("render").arg(&tsx).args(&rest).args(["--frame", &frame.to_string(), "-o"]).arg(&out);
+ cmd.env_remove("RAEA_CAMERA").env_remove("RAEA_CLAY");
+ if let Some((e, t, f)) = cam {
+ cmd.env("RAEA_CAMERA", format!("{},{},{},{},{},{},{}", e[0], e[1], e[2], t[0], t[1], t[2], f));
+ }
+ if mode == "clay" {
+ cmd.env("RAEA_CLAY", "1");
+ }
+ let run = cmd.output().map_err(|e| format!("--review: {e}"))?;
+ if !run.status.success() || !out.is_file() {
+ let text = format!("{}{}", String::from_utf8_lossy(&run.stdout), String::from_utf8_lossy(&run.stderr));
+ return Err(format!("--review: the {view} {mode} render failed: {}", text.lines().rev().find(|l| !l.trim().is_empty()).unwrap_or("no output")));
+ }
+ }
+ let colour = dir_out.join(format!("{view}-colour.png"));
+ let (_, ev) = raea_sys_light_meter::exposure::of_pngs(std::slice::from_ref(&colour))?;
+ for f in ev["found"].as_array().into_iter().flatten() {
+ said.push(json!({"check": "exposure", "level": f["level"], "says": format!("{view} tile: {}", f["says"].as_str().unwrap_or("").trim_start_matches("the frame: "))}));
+ }
+ tiles.push(json!({"view": view, "colour": format!("{view}-colour.png"), "clay": format!("{view}-clay.png"), "exposure": ev["exposure"],
+ "camera": cam.map(|(e, t, f)| json!({"eye": e, "target": t, "fov": f}))}));
+ }
+ // the sheets: three across, two down, each tile TILE_W wide
+ let th = (TILE_W as f64 / aspect).round().max(1.0) as u32;
+ for mode in ["colour", "clay"] {
+ let mut sheet = image::RgbaImage::from_pixel(TILE_W * 3, th * 2, image::Rgba([0, 0, 0, 255]));
+ for (i, view) in VIEWS.iter().enumerate() {
+ let img = image::open(dir_out.join(format!("{view}-{mode}.png"))).map_err(|e| format!("{view}-{mode}.png: {e}"))?.to_rgba8();
+ let small = image::imageops::resize(&img, TILE_W, th, image::imageops::FilterType::Triangle);
+ image::imageops::overlay(&mut sheet, &small, (i as u32 % 3 * TILE_W) as i64, (i as u32 / 3 * th) as i64);
+ }
+ sheet.save(dir_out.join(format!("{mode}.png"))).map_err(|e| format!("{mode}.png: {e}"))?;
+ }
+ for (i, t) in tiles.iter_mut().enumerate() {
+ t["rect"] = json!([i as u32 % 3 * TILE_W, i as u32 / 3 * th, TILE_W, th]);
+ }
+ let cameras: Vec<Value> = tiles.iter().map(|t| json!({"view": t["view"], "camera": t["camera"]})).collect();
+ std::fs::write(dir_out.join("cameras.json"), serde_json::to_string_pretty(&json!({"frame": frame, "box": {"min": lo, "max": hi}, "interior": ceil.is_some(), "cameras": cameras})).unwrap_or_default()).map_err(|e| e.to_string())?;
+ let doc = json!({"frame": frame, "sheets": {"colour": "colour.png", "clay": "clay.png"}, "size": [TILE_W * 3, th * 2],
+ "caption": if ceil.is_some() { "An interior, seen from inside: tiles left to right, top to bottom: hero, front, right, top (under the ceiling), iso, low (0.3 m). Clay: every standard surface light grey and matte." } else { "Tiles left to right, top to bottom: hero, front, right, top, iso, low (0.3 m). Clay: every standard surface light grey and matte." },
+ "box": {"min": lo, "max": hi}, "tiles": tiles, "found": said});
+ std::fs::write(dir_out.join("review.json"), serde_json::to_string_pretty(&doc).unwrap_or_default()).map_err(|e| e.to_string())?;
+ let mut msg = format!("APPLIED review of frame {frame}: {} and {} (hero, front, right, top, iso, low), cameras and exposure in {}", dir_out.join("colour.png").display(), dir_out.join("clay.png").display(), dir_out.join("review.json").display());
+ for f in &said {
+ msg.push_str(&format!("\n {}: {}", f["level"].as_str().unwrap_or(""), f["says"].as_str().unwrap_or("")));
+ }
+ Ok(msg)
+}
diff --git a/runtime/export/src/scene.rs b/runtime/export/src/scene.rs
index 7986a021..660e8ffe 100644
--- a/runtime/export/src/scene.rs
+++ b/runtime/export/src/scene.rs
@@ -34,7 +34,7 @@ pub fn cli(args: &[String]) -> Result<String, String> {
}
let tsx = std::path::PathBuf::from(edit).canonicalize().map_err(|e| format!("{edit}: {e}"))?;
let dir = tsx.parent().unwrap().to_path_buf();
- let frame: i64 = flag(args, "--frame").map(|f| f.parse().map_err(|_| "--frame takes a frame number")).transpose()?.unwrap_or(0);
+ let frame = frame_of(args)?;
let js = std::env::temp_dir().join(format!("raea-scene-{}.js", std::process::id()));
bundle_composition(&tsx, &js, &comp_opts(args)?, None)?;
// and the frame after it, to see what moves
@@ -44,7 +44,11 @@ pub fn cli(args: &[String]) -> Result<String, String> {
let k = frames.iter().position(|(f, _)| *f == frame).ok_or_else(|| format!("no frame {frame}"))?;
// the frame, and the next (or the one before, at the end) to see what moves
let other = if k + 1 < frames.len() { k + 1 } else { k.saturating_sub(1) };
- let (found, errors) = raea_sys_contact::lint(&items(&frames[k].1), &items(&frames[other].1));
+ let (mut found, errors) = raea_sys_contact::lint(&items(&frames[k].1), &items(&frames[other].1));
+ // and the Blender steps its models call for (a format raea can't load, triangles over budget for the distance)
+ let (more, unloadable) = raea_sys_contact::assets(&items(&frames[k].1));
+ found.extend(more);
+ let errors = errors + unloadable;
let shown: Vec<&Value> = found.iter().filter(|v| mode == "explain" || !matches!(v["level"].as_str(), Some("ok") | Some("note"))).collect();
let text = if args.iter().any(|a| a == "--json") {
serde_json::to_string_pretty(&json!({"frame": frame, "errors": errors, "found": shown})).unwrap_or_default()
@@ -121,3 +125,11 @@ fn light(args: &[String]) -> Result<String, String> {
}
Ok(t.join("\n"))
}
+
+/// `--frame N`, 0 when it isn't given (scene lint and render --review).
+pub(crate) fn frame_of(args: &[String]) -> Result<i64, String> {
+ match flag(args, "--frame") {
+ Some(f) => f.parse().map_err(|_| "--frame takes a frame number".to_string()),
+ None => Ok(0),
+ }
+}
diff --git a/runtime/export/src/sound.rs b/runtime/export/src/sound.rs
index a0a789c7..8e6f753b 100644
--- a/runtime/export/src/sound.rs
+++ b/runtime/export/src/sound.rs
@@ -34,7 +34,7 @@ pub(crate) fn core_bounce(frames: &[(i64, Frame)], notes: &[raea_sys_mix::ToneCu
/// its children (a <Mix> did, 2026-10-18: a 20 s ad rendered with no audio track), a sound that's never on screen, or
/// a generated sound that was never made all end here. What the edit renders is read from its bundle (not minified,
/// and what isn't used left out): an <Audio> is a JSX call `(…jsx)(Audio, {`. The folder's .tsx files were read before,
-/// so a sibling's <Audio> refused an edit with none (raea-c1, 10-24).
+/// so a sibling's <Audio> refused an edit with none (10-24).
pub(crate) fn no_sound_but_declared(js: &Path) -> R<()> {
let code = std::fs::read_to_string(js).unwrap_or_default();
let declares = code.match_indices(")(Audio").any(|(i, m)| {
diff --git a/runtime/js/src/html_page.rs b/runtime/js/src/html_page.rs
index 09ff59b2..cbbddc5f 100644
--- a/runtime/js/src/html_page.rs
+++ b/runtime/js/src/html_page.rs
@@ -1,4 +1,4 @@
-//! HTML compositions' page-independent part (docs/ts-native.feature P27): a the HTML composition format-format page (HTML, CSS, GSAP and
+//! HTML compositions' page-independent part (docs/ts-native.feature P27): an HTML composition page (HTML, CSS, GSAP and
//! its own scripts) prepared for @raea/ui's HTML runtime (sdk/ui/src/html.ts), its probe and its videos read from what
//! the runtime reports. raea-page's HtmlPage (engine/page/src/html.rs) mounts it on a Blitz document; the bevy_ui
//! page that did went with docs/blitz-bevy.feature B5d.
@@ -145,7 +145,7 @@ pub fn prepare(file: &Path, fps: f64, fonts: Option<&Path>, size: Option<(u32, u
}
};
let (w, h) = size.unwrap_or_else(|| size_of(&source));
- // the bundled faces the composition format's deterministic fonts stand in for system families with (html/fonts.ts)
+ // the bundled faces the deterministic font set stands in for system families with (html/fonts.ts)
let font_files: Vec<String> = fonts
.and_then(|d| std::fs::read_dir(d).ok())
.map(|rd| rd.flatten().map(|e| e.file_name().to_string_lossy().into_owned()).filter(|n| n.ends_with(".woff2")).collect())
diff --git a/runtime/live/src/open.rs b/runtime/live/src/open.rs
index 2f719528..75be8c88 100644
--- a/runtime/live/src/open.rs
+++ b/runtime/live/src/open.rs
@@ -9,7 +9,7 @@ impl Live {
}
/// `open`, laid out at the stage's size only when `may_respond` and the composition lays out from useVideoConfig.
- /// The rule (the founder, 2026-10-18): only games may be responsive. Video and everything played like it (timelines,
+ /// The rule (the user, 2026-10-18): only games may be responsive. Video and everything played like it (timelines,
/// motion, decks, scenes; open_baked too) keep the composition's own layout at its own size, never re-flowed to the
/// window's box; the legacy app's stage only scales that page uniformly (paint_texture_fit). Don't flip this per kind.
pub fn open_with(tsx: &Path, stage: (u32, u32), may_respond: bool) -> R<Live> {
diff --git a/runtime/look/src/camera.rs b/runtime/look/src/camera.rs
index 6b648df3..59eeed0d 100644
--- a/runtime/look/src/camera.rs
+++ b/runtime/look/src/camera.rs
@@ -71,11 +71,21 @@ pub fn camera(all: &[Vec<Item>], p: &mut Program, row: &mut BTreeMap<String, V>)
// a cut from a hall to a street changes the light on that frame
// Bevy's EnvironmentMapLight with its own prefiltered maps (<EnvironmentMapLight>: its diffuse and specular
// cubemap files, as the first frame has them), in place of a panorama raea filters
- if let Some(m) = all.iter().flatten().find(|i| i.kind == "environment" && i.props.contains_key("diffuse_map")) {
+ let maps: Vec<Option<&Item>> = all.iter().map(|its| its.iter().find(|i| i.kind == "environment" && i.props.contains_key("diffuse_map"))).collect();
+ if let Some(m) = maps.iter().flatten().next() {
for k in ["diffuse_map", "specular_map"] {
row.insert(format!("envmap_{k}"), V::S(m.props.get(k).and_then(Value::as_str).unwrap_or_default().to_string()));
}
row.insert("envmap_k".into(), V::N(n(&m.props, "intensity", 1.0)));
+ // its rotation (a Quat), keyed: rotate_environment_map turns it every frame
+ quat_columns(p, row, id, "envmap", &maps);
+ }
+ // a <Skybox>: Bevy's cubemap sky on the camera, its image as the first frame has it, its brightness and rotation keyed
+ if let Some(s) = all.iter().flatten().find(|i| i.kind == "skybox") {
+ row.insert("skybox_image".into(), V::S(s.props.get("image").and_then(Value::as_str).unwrap_or_default().to_string()));
+ let skies: Vec<Option<&Item>> = all.iter().map(|its| its.iter().find(|i| i.kind == "skybox")).collect();
+ column(p, row, id, "skybox_k", &skies.iter().map(|s| s.map(|i| n(&i.props, "brightness", 0.0)).unwrap_or(0.0)).collect::<Vec<_>>());
+ quat_columns(p, row, id, "skybox", &skies);
}
let envs: Vec<Option<&Item>> = all.iter().map(|its| its.iter().find(|i| i.kind == "environment" && !i.props.contains_key("diffuse_map"))).collect();
if envs.iter().any(Option::is_some) {
@@ -303,3 +313,20 @@ pub fn motion_blur(all: &[Vec<Item>], p: &mut Program, row: &mut BTreeMap<String
row.insert("mb_samples".into(), V::N(s));
}
}
+
+/// a part's `rotation` as glam's Quat [x, y, z, w] (Bevy's identity when it has none)
+fn quat(props: &serde_json::Map<String, Value>) -> [f64; 4] {
+ match props.get("rotation").and_then(Value::as_array) {
+ Some(q) if q.len() == 4 => [0, 1, 2, 3].map(|k| q[k].as_f64().unwrap_or(0.0)),
+ _ => [0.0, 0.0, 0.0, 1.0],
+ }
+}
+
+/// each frame's part's `rotation` (the identity on a frame without one) as four exact columns, `<name>_qx` to
+/// `<name>_qw` (keyed when it turns)
+fn quat_columns(p: &mut Program, row: &mut BTreeMap<String, V>, id: &str, name: &str, parts: &[Option<&Item>]) {
+ let qs: Vec<[f64; 4]> = parts.iter().map(|m| m.map_or([0.0, 0.0, 0.0, 1.0], |i| quat(&i.props))).collect();
+ for (k, axis) in ["qx", "qy", "qz", "qw"].iter().enumerate() {
+ exact(p, row, id, &format!("{name}_{axis}"), &qs.iter().map(|q| q[k]).collect::<Vec<_>>());
+ }
+}
diff --git a/runtime/look/src/lib.rs b/runtime/look/src/lib.rs
index 2b92373c..38cbc096 100644
--- a/runtime/look/src/lib.rs
+++ b/runtime/look/src/lib.rs
@@ -118,6 +118,15 @@ pub fn surface_spec(p: &Map<String, Value>) -> Value {
o.insert("repeat_v".into(), Value::from(v.as_f64().unwrap_or(1.0)));
}
}
+ // a <Lightmap> (raea-sys-material's lightmap.rs): its file, the glTF mesh it lies on, its sampling and rect
+ if let Some(src) = p.get("lightmap").and_then(Value::as_str) {
+ o.insert("lightmap".into(), Value::String(src_path(src)));
+ for k in ["mesh", "bicubic", "uv_x0", "uv_y0", "uv_x1", "uv_y1"] {
+ if let Some(v) = p.get(k) {
+ o.insert(k.into(), v.clone());
+ }
+ }
+ }
Value::Object(o)
}
diff --git a/runtime/page/src/elements.rs b/runtime/page/src/elements.rs
index 85ba91ba..db88ac74 100644
--- a/runtime/page/src/elements.rs
+++ b/runtime/page/src/elements.rs
@@ -212,8 +212,9 @@ pub(crate) fn page_props(kind: &str, props: Option<&Map<String, Value>>, dir: &P
let mut out = Map::new();
let Some(p) = props else { return out };
for (k, v) in p {
- // (a <Sequence>'s data-raea-start kept: its CSS animations run from there, raea-runtime-js's src/anim.rs)
- if k == "children" || k == "key" || (k.starts_with("data-raea") && k != "data-raea-start") || k == "data-props" || k == "data-shape" || k == "data-anim" || v.is_null() {
+ // (a <Sequence>'s data-raea-start kept: its CSS animations run from there, raea-runtime-js's src/anim.rs; a bevy_ui
+ // <Text>'s data-raea-bevy-text kept: Blitz measures its block as bevy_text does, vendor/blitz-dom layout/inline.rs)
+ if k == "children" || k == "key" || (k.starts_with("data-raea") && k != "data-raea-start" && k != "data-raea-bevy-text") || k == "data-props" || k == "data-shape" || k == "data-anim" || v.is_null() {
continue;
}
if k.starts_with("on") && k.chars().nth(2).is_some_and(|c| c.is_ascii_uppercase()) {
diff --git a/runtime/plugins/src/lib.rs b/runtime/plugins/src/lib.rs
index 6a813ad9..cfbc7533 100644
--- a/runtime/plugins/src/lib.rs
+++ b/runtime/plugins/src/lib.rs
@@ -103,8 +103,12 @@ pub struct Driven;
/// takes, for each, the last row from at or before it, so a seek (a still, live play's jump) lands on its value.
#[derive(Resource, Default)]
struct Keyed {
+ /// in order of the frame each is from (load sorts them), so a frame reads only the rows due since the last
rows: Vec<(Option<Entity>, String, Value, i64)>,
applied: std::collections::HashMap<(Option<Entity>, String), i64>,
+ /// the rows before this one are due by `last`, the frame last applied (a frame before it reads them all again)
+ next: usize,
+ last: i64,
}
/// Adds the registered plugins (all but the on-demand ones) and the frame clock, when there are any. An App without
@@ -236,9 +240,15 @@ fn keyed_rows(world: &mut World) {
},
};
let due: Vec<(Option<Entity>, String, Value, i64)> = {
- let k = world.resource::<Keyed>();
+ let mut k = world.resource_mut::<Keyed>();
+ // forwards, only the rows that came due since the last frame (mesh_ray_cast's 66 gizmos keyed every frame were
+ // 59 000 rows read each update by frame 900); a frame before the last reads them all again
+ let from = if f >= k.last { k.next } else { 0 };
+ let upto = from + k.rows[from..].partition_point(|r| r.3 <= f);
+ (k.next, k.last) = (upto, f);
+ let k = &*k;
let mut last: std::collections::HashMap<(Option<Entity>, &str), &(Option<Entity>, String, Value, i64)> = Default::default();
- for r in k.rows.iter().filter(|r| r.3 <= f) {
+ for r in &k.rows[from..upto] {
let at = last.entry((r.0, r.1.as_str())).or_insert(r);
if r.3 >= at.3 {
*at = r;
@@ -316,7 +326,8 @@ pub fn apply_rows(world: &mut World, inserted: &[Tup], ents: &[Entity], dir: &Pa
}
keyed.rows.push((target, ty, v, from.max(0)));
}
- // kept only when a row waits for a frame (a still edit's rows are all applied now)
+ // kept only when a row waits for a frame (a still edit's rows are all applied now); in frame order for keyed_rows
+ keyed.rows.sort_by_key(|r| r.3);
if !keyed.rows.iter().any(|r| r.3 > 0) {
keyed = Keyed::default();
}
diff --git a/runtime/plugins/src/tests.rs b/runtime/plugins/src/tests.rs
index 2c68b407..51cb7eb5 100644
--- a/runtime/plugins/src/tests.rs
+++ b/runtime/plugins/src/tests.rs
@@ -66,3 +66,24 @@ fn world_save_and_load() {
let d = raea_bevy_world::call(w, "raea/diagnostics", json!({})).unwrap();
assert!(d.get("entity_count").is_some() && d.get("fps").is_some(), "{d}");
}
+
+#[test]
+fn keyed_components_land_on_their_frame_forwards_backwards_and_jumping() {
+ let mut app = app();
+ let w = app.world_mut();
+ let (a, b) = (w.spawn_empty().id(), w.spawn_empty().id());
+ let ty = "bevy_transform::components::transform::Transform".to_string();
+ let at = |x: f64| json!({"translation": [x, 0.0, 0.0]});
+ // a keyed every frame 0-8; b at 0 and 5 only: in frame order, as apply_rows leaves them
+ let mut rows: Vec<_> = (0..=8).map(|f| (Some(a), ty.clone(), at(f as f64), f)).collect();
+ rows.extend([(Some(b), ty.clone(), at(100.0), 0), (Some(b), ty.clone(), at(105.0), 5)]);
+ rows.sort_by_key(|r| r.3);
+ w.insert_resource(Keyed { rows, ..default() });
+ w.insert_resource(Error(None));
+ let x = |w: &World, e: Entity| w.get::<Transform>(e).map(|t| t.translation.x);
+ for (f, want_a, want_b) in [(0, 0.0, 100.0), (1, 1.0, 100.0), (2, 2.0, 100.0), (6, 6.0, 105.0), (3, 3.0, 100.0), (8, 8.0, 105.0)] {
+ w.insert_resource(Clock(f));
+ keyed_rows(w);
+ assert_eq!((x(w, a), x(w, b)), (Some(want_a), Some(want_b)), "frame {f}");
+ }
+}
diff --git a/runtime/react/Cargo.toml b/runtime/react/Cargo.toml
index fd7fb0ee..f6ffdef3 100644
--- a/runtime/react/Cargo.toml
+++ b/runtime/react/Cargo.toml
@@ -74,5 +74,5 @@ raea-bevy-plugins = { path = "../../engine/bevy-plugins", optional = true }
raea-sys-bake = { path = "../../systems/bake" }
[package.metadata.cargo-shear]
-# raea-io-media is here for its features (h264, provenance), which the platform decoders raea-render reads take
+# raea-io-media is here for its features (h264), which the platform decoders raea-render reads take
ignored = ["raea-io-media"]
diff --git a/runtime/react/src/scene/holders.rs b/runtime/react/src/scene/holders.rs
index 91e176f7..4c687eb2 100644
--- a/runtime/react/src/scene/holders.rs
+++ b/runtime/react/src/scene/holders.rs
@@ -17,9 +17,10 @@ pub fn scene_of(world: &mut World) -> Vec<Node3> {
let mut q = world.query::<(Entity, &ReactKind, Option<&ReactProps>)>();
let Some(surf) = q.iter(world).find(|(_, k, p)| k.0 == "surface" && p.and_then(|p| p.0.get("id")).and_then(|v| v.as_str()) == Some("motion")).map(|(e, _, _)| e) else { return Vec::new() };
// the 3D roots under the surface (a data-3d element stops the walk; its 3D is read3d's), each subtree no commit
- // touched since the last scene handed on as it was (read.rs Kept3d)
+ // touched since the last scene handed on as it was (read.rs Kept3d); the surface's own straight into the scene, not
+ // kept and copied out (10 000 cubes beside a turning camera were copied three times a frame; FC1b)
let dirty = dirty3d(world);
- world.resource_scope(|world, mut kept: Mut<Kept3d>| contrib3d(world, surf, &mut kept, &dirty).to_vec())
+ world.resource_scope(|world, mut kept: Mut<Kept3d>| { let mut v = Vec::new(); kids3d(world, surf, &mut kept, &dirty, &mut v); v })
}
/// The elements holding the 3D (holders_of's), into `out` (ZeroHeap: live play's present asks each frame)
diff --git a/runtime/react/src/scene/read.rs b/runtime/react/src/scene/read.rs
index 3e5a966a..846c9654 100644
--- a/runtime/react/src/scene/read.rs
+++ b/runtime/react/src/scene/read.rs
@@ -182,11 +182,11 @@ pub(crate) fn read3d(world: &World, e: Entity, kept: &mut Kept3d, dirty: &bevy::
Some(Node3 { kind, props, shape, kids: kids.into() })
}
-/// The 3D children of `e`, looking through plain elements between them (a Sequence's or a component's wrapper div
-/// inside a Canvas3D), so 3D timed by a Sequence is still the scene's.
+/// The 3D children of `e` through plain elements between them (a Sequence's or a component's wrapper div), a kept
+/// child's nodes copied from where they're kept (with its list's count bumped and let go, 100 000 lights took 3.9 ms)
pub(crate) fn kids3d(world: &World, e: Entity, kept: &mut Kept3d, dirty: &bevy::ecs::entity::EntityHashSet, out: &mut Vec<Node3>) {
let Some(children) = world.get::<Children>(e) else { return };
for k in children.iter() {
- out.extend(contrib3d(world, k, kept, dirty).iter().cloned());
+ match kept.of.get(&k).filter(|_| !dirty.contains(&k)) { Some(c) => out.extend(c.iter().cloned()), None => out.extend(contrib3d(world, k, kept, dirty).iter().cloned()) }
}
}
diff --git a/runtime/scene/Cargo.toml b/runtime/scene/Cargo.toml
index 9f382eb6..e39bfb7e 100644
--- a/runtime/scene/Cargo.toml
+++ b/runtime/scene/Cargo.toml
@@ -14,3 +14,7 @@ bevy = { version = "=0.20.0", default-features = false, features = ["std"] }
serde_json = "1"
# a material's `wear` prop as its row's columns
raea-sys-wear = { path = "../../systems/wear" }
+# a material's `procedural` prop as its row's columns
+raea-sys-procmat = { path = "../../systems/procmat" }
+# a review's fixed camera (RAEA_CAMERA) in place of the scene's own
+raea-core-review = { path = "../../core/review" }
diff --git a/runtime/scene/src/lib.rs b/runtime/scene/src/lib.rs
index 950223bd..f7e4b74a 100644
--- a/runtime/scene/src/lib.rs
+++ b/runtime/scene/src/lib.rs
@@ -34,6 +34,11 @@ mod meshseq;
/// Fields of grass' rows (<Grass>).
mod grass;
+/// The scene-wide parts placed by their parent alone, a camera column or a post effect each: node kind, item kind. An
+/// <Atmosphere> is Bevy's procedural sky round the scene, a <Skybox> Bevy's cubemap sky on the camera.
+const BY_PARENT: [(&str, &str); 19] = [("AmbientLight", "ambient"), ("Bloom", "bloom"), ("Atmosphere", "atmosphere"), ("Fog", "fog"), ("ToneMapping", "tonemapping"), ("DepthOfField", "dof"), ("Grade", "grade"), ("VolumetricFog", "volfog"), ("Environment", "environment"), ("Skybox", "skybox"),
+ ("AmbientOcclusion", "ssao"), ("AntiAliasing", "aa"), ("Shadows", "shadows"), ("Look", "framelook"), ("Outline", "outline"), ("Fisheye", "fisheye"), ("LensDistortion", "distortion"), ("MotionBlur", "mblur"), ("BevyResource", "resource")];
+
fn walk(n: &Node3, parent: Mat4, out: &mut Vec<Item>) {
let item = |kind: &'static str, world: Mat4, material: Option<Node3>| Item { kind, props: n.props.clone(), shape: n.shape.clone(), material, world };
match &*n.kind {
@@ -98,7 +103,8 @@ fn walk(n: &Node3, parent: Mat4, out: &mut Vec<Item>) {
}
// MeshStandardMaterial children: its glTF materials (all, or the one each names) given another colour,
// texture or finish, the rest of each kept
- let mats: Vec<_> = n.kids.iter().filter(|k| matches!(&*k.kind, "MeshStandardMaterial" | "MeshPhysicalMaterial")).collect();
+ // (and its <Lightmap> children, a bake on each glTF mesh one names: raea-sys-material's lightmap.rs)
+ let mats: Vec<_> = n.kids.iter().filter(|k| matches!(&*k.kind, "MeshStandardMaterial" | "MeshPhysicalMaterial" | "Lightmap")).collect();
let surfaces: Vec<Value> = mats.iter().map(|k| surface_spec(&k.props)).collect();
if !surfaces.is_empty() {
std::sync::Arc::make_mut(&mut it.props).insert("surfaces".into(), Value::Array(surfaces));
@@ -142,21 +148,9 @@ fn walk(n: &Node3, parent: Mat4, out: &mut Vec<Item>) {
bevy_parts(n, &mut it);
out.push(it)
}
- "AmbientLight" => out.push(item("ambient", parent, None)),
- "Bloom" => out.push(item("bloom", parent, None)),
- // a procedural sky round the scene (Bevy's Atmosphere): a camera column
- "Atmosphere" => out.push(item("atmosphere", parent, None)),
+ k if BY_PARENT.iter().any(|(n, _)| *n == k) => out.push(item(BY_PARENT.iter().find(|(n, _)| *n == k).map_or("", |&(_, i)| i), parent, None)),
// text in the 3D world (<RichText>): a block and its glyphs (raea-render's text3d.rs)
"RichText" => out.push(item("text", parent * local(&n.props), None)),
- "Fog" => out.push(item("fog", parent, None)),
- "ToneMapping" => out.push(item("tonemapping", parent, None)),
- "DepthOfField" => out.push(item("dof", parent, None)),
- "Grade" => out.push(item("grade", parent, None)),
- "VolumetricFog" => out.push(item("volfog", parent, None)),
- "Environment" => out.push(item("environment", parent, None)),
- "AmbientOcclusion" => out.push(item("ssao", parent, None)),
- "AntiAliasing" => out.push(item("aa", parent, None)),
- "Shadows" => out.push(item("shadows", parent, None)),
"FogVolume" => out.push(item("fogvolume", parent * local(&n.props), None)),
"Fire" => out.push(item("fire", parent * local(&n.props), None)),
// a field of grass made by the engine from its grids (<Grass>): grass.rs
@@ -166,12 +160,6 @@ fn walk(n: &Node3, parent: Mat4, out: &mut Vec<Item>) {
"Sprite" => out.push(item("sprite", Mat4::IDENTITY, None)),
"Shape2D" => out.push(item("shape2d", Mat4::IDENTITY, None)),
"MeshSequence" => out.push(item("meshseq", parent * local(&n.props), None)),
- "Look" => out.push(item("framelook", parent, None)),
- "Outline" => out.push(item("outline", parent, None)),
- "Fisheye" => out.push(item("fisheye", parent, None)),
- "LensDistortion" => out.push(item("distortion", parent, None)),
- "MotionBlur" => out.push(item("mblur", parent, None)),
- "BevyResource" => out.push(item("resource", parent, None)),
// one shader over every lit standard surface left (<SurfaceShader>, docs/shaders.feature SH4)
"SurfaceShader" => out.push(item("surface_shader", parent, None)),
// a shader over the frame (<FramePass>, docs/shaders.feature SH6)
@@ -214,6 +202,7 @@ pub fn items_of(scene: &[Node3]) -> Vec<Item> {
if out.iter().any(own) {
out.retain(|i| i.kind != "ambient" || own(i));
}
+ raea_core_review::camera_override(&mut out); // a review's fixed camera in place of the scene's own (RAEA_CAMERA)
out
}
diff --git a/runtime/scene/src/parts.rs b/runtime/scene/src/parts.rs
index 9cc34440..0ac7026b 100644
--- a/runtime/scene/src/parts.rs
+++ b/runtime/scene/src/parts.rs
@@ -103,10 +103,10 @@ pub(crate) fn lights_rows(all: &[Vec<Item>], tr: &Tracks, p: &mut Program) {
row.insert("width".into(), V::N(r6(n(first, "width", 1.0))));
row.insert("height".into(), V::N(r6(n(first, "height", 1.0))));
}
- if kind == "spot" {
- let angle = n(first, "angle", std::f64::consts::FRAC_PI_3).clamp(0.0, std::f64::consts::FRAC_PI_2);
- row.insert("outer".into(), V::N(r6(angle)));
- row.insert("inner".into(), V::N(r6(angle * (1.0 - n(first, "penumbra", 0.0).clamp(0.0, 1.0)))));
+ if kind == "spot" { // its cone, keyed: spotlight.rs's light_sway widens it every frame
+ let outer: Vec<f64> = its.iter().map(|i| n(&i.props, "angle", std::f64::consts::FRAC_PI_3).clamp(0.0, std::f64::consts::FRAC_PI_2)).collect();
+ column(p, &mut row, &id, "inner", &its.iter().zip(&outer).map(|(i, a)| a * (1.0 - n(&i.props, "penumbra", 0.0).clamp(0.0, 1.0))).collect::<Vec<_>>());
+ column(p, &mut row, &id, "outer", &outer);
}
layers_column(&mut row, first);
p.spawns.push(("light".into(), vec![row]));
@@ -159,7 +159,7 @@ pub(crate) fn meshes_rows(tr: &Tracks, names: &[String], p: &mut Program) {
row.insert(col.into(), V::N(v));
}
}
- for (prop, col) in [("map", "map"), ("normalMap", "normal_map"), ("roughnessMap", "rough_map"), ("metalnessMap", "metal_map"), ("metallicRoughnessMap", "mr_map"), ("aoMap", "ao_map"), ("emissiveMap", "emissive_map"), ("depthMap", "depth_map")] {
+ for (prop, col) in [("map", "map"), ("normalMap", "normal_map"), ("roughnessMap", "rough_map"), ("metalnessMap", "metal_map"), ("metallicRoughnessMap", "mr_map"), ("aoMap", "ao_map"), ("emissiveMap", "emissive_map"), ("depthMap", "depth_map"), ("clearcoatNormalMap", "clearcoat_normal_map")] {
if let Some(src) = m0.get(prop).and_then(Value::as_str) {
row.insert(col.into(), V::S(src_path(src)));
}
@@ -222,6 +222,7 @@ pub(crate) fn meshes_rows(tr: &Tracks, names: &[String], p: &mut Program) {
grid_columns(&mut row, m0);
paint_columns(&mut row, m0);
raea_sys_wear::columns(&mut row, m0);
+ raea_sys_procmat::columns(&mut row, m0);
placement(p, &mut row, &id, &its);
visible(p, &mut row, &id, &track);
pass_column(p, &mut row, &id, &its, &names);
diff --git a/runtime/scene/src/sprite2d.rs b/runtime/scene/src/sprite2d.rs
index 33fb0f17..1bc12584 100644
--- a/runtime/scene/src/sprite2d.rs
+++ b/runtime/scene/src/sprite2d.rs
@@ -63,6 +63,17 @@ pub(super) fn shapes(tracks: &[Track], p: &mut Program) {
row.insert("w".into(), V::N(at(0)));
row.insert("h".into(), V::N(at(1)));
row.insert("sides".into(), V::N(n(first, "sides", 5.0)));
+ // its ColorMaterial's texture and AlphaMode2d ("opaque", "blend", or "mask" with its cutoff)
+ if let Some(t) = first.get("texture").and_then(Value::as_str) {
+ row.insert("texture".into(), V::S(src_path(t)));
+ }
+ // its mesh's Mesh::ATTRIBUTE_COLOR: linear [r, g, b, a] per vertex, as JSON
+ if let Some(cs) = first.get("vertex_colors").filter(|c| c.is_array()) { row.insert("vertex_colors".into(), V::S(cs.to_string())); }
+ match first.get("alpha_mode") {
+ Some(Value::String(a)) => { row.insert("alpha".into(), V::S(a.to_lowercase())); }
+ Some(Value::Object(m)) => { row.insert("alpha".into(), V::S("mask".into())); row.insert("alpha_cutoff".into(), V::N(n(m, "Mask", 0.5))); }
+ _ => {}
+ }
place2d(p, &mut row, &id, &its, "#ffffff");
visible(p, &mut row, &id, track);
p.spawns.push(("shape2d".into(), vec![row]));
diff --git a/runtime/scene3d/src/clay.rs b/runtime/scene3d/src/clay.rs
new file mode 100644
index 00000000..2d3200c4
--- /dev/null
+++ b/runtime/scene3d/src/clay.rs
@@ -0,0 +1,50 @@
+//! Clay: every standard surface drawn light grey and matte, its maps, glow and metal taken off, so a review judges
+//! form and assembly without surfaces (`raea render --clay`, and the clay half of `--review`; the 11-06 research: every
+//! strong scene reviewer judges on clay beside colour). On when `CLAY` is set or the process has RAEA_CLAY; a
+//! translucent surface keeps its alpha, so glass stays see-through. Toon and custom shader surfaces draw as they are.
+
+use std::sync::atomic::{AtomicBool, Ordering};
+
+use bevy::prelude::*;
+
+/// Set by `raea render --clay` in this process; RAEA_CLAY does the same for a child process.
+pub static CLAY: AtomicBool = AtomicBool::new(false);
+
+const GREY: [f32; 3] = [0.62, 0.62, 0.6];
+
+pub fn on() -> bool {
+ static ENV: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
+ CLAY.load(Ordering::Relaxed) || *ENV.get_or_init(|| std::env::var_os("RAEA_CLAY").is_some_and(|v| v != "0"))
+}
+
+fn is_clay(m: &StandardMaterial) -> bool {
+ let c = m.base_color.to_srgba();
+ m.base_color_texture.is_none() && m.emissive_texture.is_none() && m.normal_map_texture.is_none() && m.metallic_roughness_texture.is_none() && (c.red - GREY[0]).abs() < 1e-4 && (c.green - GREY[1]).abs() < 1e-4 && (c.blue - GREY[2]).abs() < 1e-4 && m.metallic == 0.0 && m.emissive == LinearRgba::BLACK
+}
+
+/// Each standard material not yet clay made clay (run after the rows set colours, each frame; one already clay is
+/// left untouched, so nothing is re-uploaded).
+pub fn clay_materials(mut mats: ResMut<Assets<StandardMaterial>>) {
+ if !on() {
+ return;
+ }
+ let ids: Vec<AssetId<StandardMaterial>> = mats.iter().filter(|(_, m)| !is_clay(m)).map(|(id, _)| id).collect();
+ for id in ids {
+ if let Some(mut m) = mats.get_mut(id) {
+ let alpha = m.base_color.alpha();
+ m.base_color = Color::srgba(GREY[0], GREY[1], GREY[2], alpha);
+ m.base_color_texture = None;
+ m.emissive = LinearRgba::BLACK;
+ m.emissive_texture = None;
+ m.normal_map_texture = None;
+ m.metallic_roughness_texture = None;
+ m.metallic = 0.0;
+ m.perceptual_roughness = 0.7;
+ m.reflectance = 0.5;
+ m.clearcoat = 0.0;
+ m.specular_transmission = 0.0;
+ m.diffuse_transmission = 0.0;
+ m.unlit = false;
+ }
+ }
+}
diff --git a/runtime/scene3d/src/lib.rs b/runtime/scene3d/src/lib.rs
index b92ef321..7dba1d52 100644
--- a/runtime/scene3d/src/lib.rs
+++ b/runtime/scene3d/src/lib.rs
@@ -65,6 +65,7 @@ mod instance;
pub use instance::*;
mod share;
pub use share::*;
+pub mod clay;
/// A model row's glTF: loaded by the asset server, then its scene spawned under the row's entity and its clip set up.
#[derive(Component)]
diff --git a/runtime/scene3d/src/sync.rs b/runtime/scene3d/src/sync.rs
index 767edf40..60d6830e 100644
--- a/runtime/scene3d/src/sync.rs
+++ b/runtime/scene3d/src/sync.rs
@@ -338,6 +338,10 @@ pub fn sync_lights(frame: Res<FrameRows>, mut commands: Commands, mut q: Query<(
if s.intensity != lm {
s.intensity = lm;
}
+ // its cone, as its rows animate it (spotlight.rs's light_sway widens every light each frame; light.rs set it once)
+ let outer = num(v, "outer", std::f32::consts::FRAC_PI_4);
+ let inner = num(v, "inner", 0.0).min(outer);
+ if s.outer_angle != outer || s.inner_angle != inner { (s.outer_angle, s.inner_angle) = (outer, inner); }
let sh = shadows(lm, s.shadow_maps_enabled);
if s.shadow_maps_enabled != sh {
s.shadow_maps_enabled = sh;
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
new file mode 100644
index 00000000..a4711044
--- /dev/null
+++ b/rust-toolchain.toml
@@ -0,0 +1,6 @@
+# The Rust raea builds with: rustup's proxies (cargo, rustc) read this pin in every checkout, CI included. Bevy 0.20's
+# port was built on 1.97.1 and moved to 1.99.1 (bevy_rich_text3d 0.8 needs str::substr_range). Move it to a newer
+# stable whenever that buys something (a plugin, speed, a feature), checked against the gates in docs/bevy-upgrade.md.
+[toolchain]
+channel = "1.99.1"
+components = ["clippy", "rustfmt"]
diff --git a/sdk/app/node_modules b/sdk/app/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/app/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/app/src/clock.tsx b/sdk/app/src/clock.tsx
index be21ff8c..e045fa39 100644
--- a/sdk/app/src/clock.tsx
+++ b/sdk/app/src/clock.tsx
@@ -1,6 +1,6 @@
// The clock: which frame of which composition is being rendered, and the hooks that read it
// (spec: "A composition is a component rendered once per frame", "The clock renderers use").
-import { createContext, useContext, useRef, type ReactNode } from "react";
+import { createContext, useContext, useLayoutEffect, useReducer, useRef, version, type ReactNode } from "react";
export interface TimelineWord {
text: string;
@@ -74,6 +74,57 @@ export interface LocalTime {
}
export const ClockContext = createContext<ClockState | null>(null);
+
+// A Clock's state is one object while its settings, words, perception and input hold, its frame moved on in place: a
+// new object each frame changed the context, and React looked through every part under it for a reader (10 000 cubes
+// beside one turning camera, 1.5 ms a frame; docs/control.feature FC1b). What reads the frame subscribes instead.
+interface Ticker {
+ v: number;
+ /** told by tickClocks ahead of this frame's render, so the Clock's commit doesn't tell them again */
+ pre: boolean;
+ subs: Set<() => void>;
+}
+const TICKERS = new WeakMap<ClockState, Ticker>();
+// the mounted Clocks' tickers, for tickClocks
+const MOUNTED = new Set<Ticker>();
+function ticker(): Ticker {
+ const t: Ticker = { v: 0, pre: false, subs: new Set() };
+ return t;
+}
+// its readers called: each re-renders unless it already rendered at the version now
+function tell(t: Ticker) {
+ for (const cb of [...t.subs]) cb();
+}
+/** Tells every mounted Clock's frame readers that the frame is about to move on, in the same batch as the update that
+ * moves it, so they render in that one commit. A host that steps frames back to back calls it with its frame update:
+ * else each Clock tells them as its frame commits, a second commit each frame, and React stops a chain of more than 50
+ * (raea's bake steps a range of frames as one chain: many_cubes stalled at frame 26). */
+export function tickClocks(): void {
+ for (const t of MOUNTED) {
+ t.pre = true;
+ t.v++;
+ tell(t);
+ }
+}
+// raea's live runtime (sdk/react/js/lite) re-renders by the contexts read, so it keeps a new state each frame, as before
+const LITE = version.endsWith("-raea-lite");
+/** Re-renders the caller when its Clock's frame moves on. A state not a Clock's own (a copy given to a subtree, as
+ * InputRegion's and R3F's) is a new object each frame, so its readers hear of it through the context as before. */
+export function useClockTick(clock: ClockState | null): void {
+ const t = clock ? TICKERS.get(clock) : undefined;
+ // the version it rendered at: told of a frame it already rendered (its parent re-rendered it), it isn't rendered again
+ // (useSyncExternalStore's own record moves on only in a passive effect, after the Clock tells, so every reader
+ // rendered twice a frame)
+ const [, force] = useReducer((n: number) => n + 1, 0);
+ const seen = useRef(-1);
+ if (t) seen.current = t.v;
+ useLayoutEffect(() => {
+ if (!t) return;
+ const cb = () => void (seen.current !== t.v && force());
+ t.subs.add(cb);
+ return () => void t.subs.delete(cb);
+ }, [t]);
+}
export const LocalTimeContext = createContext<LocalTime | null>(null);
/** Where a subtree sits in time, as data that changes only when its place does (not every frame): the composition
@@ -116,6 +167,8 @@ const rootTimes = new WeakMap<ClockState, LocalTime>();
export function useLocalTime(caller: string): LocalTime {
const clock = useClockState(caller);
const local = useContext(LocalTimeContext);
+ // inside a Sequence its time is a new object each frame; outside one, the frame is the Clock's own
+ useClockTick(local ? null : clock);
if (local) return local;
let t = rootTimes.get(clock);
if (!t || t.frame !== clock.frame || t.width !== clock.config.width || t.height !== clock.config.height) {
@@ -178,16 +231,44 @@ export function Clock(props: ClockProps) {
k && k.id === id && k.width === width && k.height === height && k.fps === fps && k.durationInFrames === durationInFrames && k.defaultProps === defaultProps
? k
: (kept.current = { id, width, height, fps, durationInFrames, defaultProps });
- const state: ClockState = {
- config,
- frame,
- words,
- perception,
- input,
- };
+ // the state kept while what it holds holds (perception compared shallowly: the host's is a new {} each frame when
+ // there's none), its frame moved on in place and its readers told once the frame commits
+ const st = useRef<ClockState | null>(null);
+ let state = st.current;
+ if (LITE || !state || state.config !== config || state.words !== words || state.input !== input || !samePerception(state.perception, perception)) {
+ state = st.current = { config, frame, words, perception, input };
+ TICKERS.set(state, ticker());
+ } else if (state.frame !== frame) {
+ // the version moved on as the frame does, so a reader rendering in this pass (its parent re-rendered) isn't
+ // rendered again when the commit tells the rest
+ state.frame = frame;
+ TICKERS.get(state)!.v++;
+ }
+ const told = useRef<{ state: ClockState; frame: number } | null>(null);
+ useLayoutEffect(() => {
+ const s = st.current!;
+ const t = TICKERS.get(s)!;
+ const pre = t.pre;
+ t.pre = false;
+ if (told.current?.state === s && told.current.frame === s.frame) return;
+ const fresh = told.current?.state !== s;
+ if (fresh && told.current) MOUNTED.delete(TICKERS.get(told.current.state)!);
+ MOUNTED.add(t);
+ told.current = { state: s, frame: s.frame };
+ if (!fresh && !pre) tell(t);
+ });
+ useLayoutEffect(() => () => void (told.current && MOUNTED.delete(TICKERS.get(told.current.state)!)), []);
+ // no LocalTime at the root: useLocalTime makes the root's from the Clock (a new one each frame changed the context)
+ if (!LITE) return <ClockContext.Provider value={state}>{props.children}</ClockContext.Provider>;
return (
<ClockContext.Provider value={state}>
<LocalTimeContext.Provider value={{ frame, origin: 0, width, height }}>{props.children}</LocalTimeContext.Provider>
</ClockContext.Provider>
);
}
+
+function samePerception(a: Perception, b: Perception): boolean {
+ if (a === b) return true;
+ const ka = Object.keys(a), kb = Object.keys(b);
+ return ka.length === kb.length && ka.every((k) => (a as Record<string, unknown>)[k] === (b as Record<string, unknown>)[k]);
+}
diff --git a/sdk/asset/node_modules b/sdk/asset/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/asset/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/audio/node_modules b/sdk/audio/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/audio/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/audio/src/mix.tsx b/sdk/audio/src/mix.tsx
index 03bb3ee6..2780de51 100644
--- a/sdk/audio/src/mix.tsx
+++ b/sdk/audio/src/mix.tsx
@@ -13,9 +13,10 @@ export interface MixProps {
children?: ReactNode;
}
-// Which Mix (by its React id) each rendered composition already has. Keyed by the Clock's state object, so each
-// rendered frame starts fresh; the id lets a repeated render of the same Mix through without counting it twice.
-const claimed = new WeakMap<ClockState, string>();
+// Which Mix (by its React id) each rendered composition already has, and on which frame: keyed by the Clock's state
+// (one object across frames, its frame moved on), so each rendered frame starts fresh; the id lets a repeated render
+// of the same Mix through without counting it twice.
+const claimed = new WeakMap<ClockState, { id: string; frame: number }>();
export function Mix({ lufs = -14, ceiling = -1.5, children }: MixProps) {
const clock = useClockState("Mix");
@@ -25,10 +26,10 @@ export function Mix({ lufs = -14, ceiling = -1.5, children }: MixProps) {
}
if (ceiling > 0) throw new RangeError(`Mix: ceiling is in dBTP and must be at most 0, got ${ceiling}`);
const owner = claimed.get(clock);
- if (owner !== undefined && owner !== id) {
+ if (owner !== undefined && owner.frame === clock.frame && owner.id !== id) {
throw new Error("Mix: a composition has one Mix, and this tree already has one; remove the extra <Mix>");
}
- claimed.set(clock, id);
+ claimed.set(clock, { id, frame: clock.frame });
// its children beside its marker, not inside it: written around the soundtrack, every sound inside was dropped (a
// 20 s ad rendered with no audio track, 2026-10-18)
return (
diff --git a/sdk/character/node_modules b/sdk/character/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/character/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/dev_tools/node_modules b/sdk/dev_tools/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/dev_tools/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/guides/craft/bevy.md b/sdk/guides/craft/bevy.md
index bdf98a7a..43e00efe 100644
--- a/sdk/guides/craft/bevy.md
+++ b/sdk/guides/craft/bevy.md
@@ -21,7 +21,9 @@ pieces; then write the file. Each file's example is a complete composition you c
| surfaces: colour, metal, glass, glow, clearcoat, pictures on surfaces, toon (cel) shading and ink outlines, decals (labels, stains, tiles), a model's materials repainted | `bevy/materials` |
| people: bodies posed by goals (a hand on the mouse, sat, looking at the screen), motion capture, walking round the furniture to a spot | `bevy/characters` |
| interiors: rooms, cabinets along walls, windows and bays, chairs turned to tables, layout checks, wall decor, the garden outside, daylight, sounds placed in the scene | `bevy/rooms` |
-| shapes: boxes to modelled solids, 3D letters | `bevy/meshes` |
+| a whole scene to build and make believable: the brief, which tool makes which object, build order, review sheets, the judge, when to stop | `bevy/scenes` |
+| the words to paste for a whole scene: the brief template, the builder prompt, the judge prompt | `bevy/prompts` |
+| shapes: boxes to modelled solids, blended organic bodies (`sdf`), trees, terrain, rocks and plants (`grow`), 3D letters | `bevy/meshes` |
| moving things: spins, springs, reveals, things arriving later, model clips | `bevy/animation` |
| a 3D game: state, input, many entities, collisions, state machines | `bevy/games` |
| glTF models, pictures in space, where files go | `bevy/assets` |
diff --git a/sdk/guides/craft/bevy/assets.md b/sdk/guides/craft/bevy/assets.md
index f9846d8a..ff65a2bf 100644
--- a/sdk/guides/craft/bevy/assets.md
+++ b/sdk/guides/craft/bevy/assets.md
@@ -28,7 +28,10 @@
an unlit card, its height from the picture's shape unless you give `height`. For a picture on a solid's side, use
`map` on its material (`bevy/materials`).
- Models are loaded once before the first frame is drawn; there's no loading state to handle.
-- raea generates no imagery: models and pictures come from the brand, the person, or libraries they've given you.
+- Where a model comes from is the scene's routing (`bevy/scenes`): built in code when it's exact or architectural,
+ a library or the person's file when one exists, generated with `raea gen mesh` (Tripo) when it has character.
+ Generation costs money: quote it first (`raea gen plan`), and every generated mesh goes through `raea gen check`
+ (size, facing, pivot, triangles) before a scene uses it.
## Why
diff --git a/sdk/guides/craft/bevy/blender.md b/sdk/guides/craft/bevy/blender.md
index 0094d356..415f23ef 100644
--- a/sdk/guides/craft/bevy/blender.md
+++ b/sdk/guides/craft/bevy/blender.md
@@ -1,15 +1,77 @@
-# Blender: fixing an asset before it goes in a scene
+# Blender: the workshop an asset passes through
## When Blender, when raea
-- **raea** makes anything that renders or plays: the scene, its camera, lights, motion, materials, people and games.
- Build those in TSX (the other `bevy/` topics), never in Blender.
-- **Blender** fixes an asset on its way in: a model at the wrong scale or with its origin off to one side, a mesh too
- heavy to draw, a format raea can't load (FBX, OBJ, .blend), a rig to retarget, a texture or light to bake into a
- mesh. One asset at a time, out to a `.glb` under the project's `media/`, then into a scene with `<Model>`
- (`bevy/assets`).
-- Never build a whole scene in Blender and export it; the scene belongs in TSX, where it's frame-pure and checked
- (`raea scene lint`).
+The TSX is the scene. solids, `sdf` and `grow` make things defined by numbers or rules; `raea gen` and CC0 libraries
+make things defined by their looks (`bevy/scenes`, section 2). Blender is the workshop one asset passes through on its
+way into `media/`: a saved script reads a source file and writes one `.glb`, and a scene loads that with `<Model>`.
+
+Go to Blender only when a check names a script. Each of these findings carries its fix as text
+(`fix: raea blender run blender/X.py ...`) and in its JSON (`fix.blender`, `fix.run`):
+
+| the check says | found by | the script |
+|---|---|---|
+| a format raea can't load (FBX, OBJ, .blend, STL, PLY) | `raea gen check`, `raea scene lint` | `convert.py` |
+| more triangles than its distance from the camera can show (150 000 at 1 m or closer, falling with the square of the distance, never under 2 000) | `raea gen check --seen M`, `raea scene lint` (its distance from the camera) | `decimate.py` |
+| loose debris, holes, edges shared by three faces, when it must be solid | `raea gen check --solid` | `repair.py` |
+| fewer pieces than the parts the brief says move (a vise's jaw, a lid, a door) | `raea gen check --parts jaw,body` | `split.py` |
+| it needs textures, but a solid only has box UVs | `raea solid info` (the file exports `needs = { textured: true }`) | `raea solid export`, then `bake.py --into-colour` |
+| the brief says it moves, and it has no skeleton | `raea gen check --rig` | `rig.py` |
+| a cloth lies on or hangs from something | the brief | `cloth.py` |
+
+Never use Blender for layout, cameras, lights, final materials or animation timing: those are TSX, where they are
+frame-pure and checked (`raea scene lint`, `raea scene light`, the review sheets). "I know bpy" is no reason to model
+something in Blender: a thing defined by numbers is a solid, and one defined by its looks is generated or downloaded.
+
+A gap in solids (a fillet it can't make, real UVs) goes through `raea solid export`, then a script. Log it in the
+project's `review/NOTES.md` as a gap to build into solids, so the workaround doesn't become the method.
+
+## Headless by default: one saved script per asset step — HEADLESS
+
+- Each step is a script in the project's `blender/` folder, run with `raea blender run blender/X.py IN OUT ARGS`.
+ The first time you name a library script that isn't in the project, raea copies it there from
+ `sdk/guides/craft/bevy/blender/`. From then on it is the project's script, to edit for this project.
+- Re-run the step whenever its source changes. The `.glb` in `media/` is output, never edited by hand.
+- The script reads its arguments after `--` (`sys.argv`). It writes one `.glb` plus the licence sidecar
+ (`OUT.glb.json`, with a `steps` list appended for each step), and fails loudly: it prints `FAILED X.py: why` and
+ exits 1, and `raea blender run` then fails too.
+- Check every output with `raea gen check OUT.glb` (same flags as the finding) before a scene uses it.
+- `raea solid export FILE.ts -o media/X.glb [--set k=v,...] [--part NAME] [--colour #RRGGBB]` writes a solid as one
+ `.glb` for a script. It refuses an empty solid or one `raea solid info` finds an error in, then reads the file back
+ and checks the volume, pieces and box against the solid. The solid stays the source: export it again when it changes.
+
+## The scripts (`sdk/guides/craft/bevy/blender/`)
+
+Points and boxes are in raea's frame (metres, y up, z toward the viewer, the model's own space: the box
+`raea gen check` reports).
+
+- `convert.py IN OUT.glb [--textures DIR] [--unit auto|m|cm|mm] [--max-texture 2048]`: FBX, OBJ, .blend, STL or
+ PLY to `.glb`. Applies rotation and scale. `auto` takes a model whose biggest side is over 50 as centimetres. Maps
+ named diff, nor_gl, rough, metal or ao in `textures/` beside the file are wired in and written as 8-bit PNG no
+ bigger than `--max-texture`.
+- `decimate.py IN OUT TARGET [--lods 0.5,0.25]`: down to TARGET triangles (or a ratio, at 1 or under). Fails if it
+ lands over 1.15 × the target. `--lods` also writes `OUT.lodN.glb`.
+- `repair.py IN OUT [--debris 0.005] [--voxel SIZE] [--keep-pieces]`: merges doubled vertices, drops pieces under the
+ debris share of the triangles, fills holes and recalculates normals. `--voxel` remeshes, for a model past mending.
+- `split.py IN OUT NAME=X0,Y0,Z0,X1,Y1,Z1 ... [--rest body] [--each]`: the faces inside each box become a named
+ part. `--each` also writes `OUT.NAME.glb`, each with its origin at its bottom centre, and records where it sat
+ (`at`), so a scene can move it.
+- `bake.py IN OUT [--res 1024] [--samples 32] [--high HIGH.glb] [--into-colour [--texture IMG --tile M [--turn DEG]]]`: real UVs,
+ ambient occlusion in the occlusion slot, and a normal map from `--high` (decimate.py's input). `--into-colour`
+ multiplies the AO into a flat base colour, for a solid. With `--texture`, a CC0 photo texture (plywood, painted
+ metal) is first projected from the solid's three sides at `--tile` metres a repeat and baked in: the same real scale
+ on every face; `--turn 90` runs a wood grain along the piece instead of across it. Don't tile a photo over the baked UVs in the TSX instead: each UV island gets its own grain and scale.
+- `rig.py IN OUT --bone NAME=HX,HY,HZ:TX,TY,TZ[:PARENT] ... [--pose CLIP=BONE:RX,RY,RZ/...] [--weights rigid|auto]`:
+ bones, weights and named pose clips (plus `Rest`). `rigid` is for parts that don't bend (a lamp, a machine); `auto`
+ is for a creature. Fails if a bone gets no vertices. A bone gets the vertices nearest its segment, so run a base's
+ bone across the base, not up its middle.
+- `cloth.py IN OUT (--sheet W,D,X,Y,Z | --cloth NAME) [--pin box] [--frames 60] [--stiff 5] [--bend 0.05]
+ [--crumple 0] [--no-floor]`: a cloth simulated onto what IN holds and a floor at y 0, baked into the clip `Drape`.
+ Also writes `OUT.settled.glb`. A flat sheet lands flat: a rag wants `--stiff 1 --bend 0.01 --crumple 0.035` (soft,
+ dropped in loose folds).
+
+In the scene, raea decides when a clip plays: `<Model src="media/lamp.glb" animation="Reach" time={t} loop={false}>`
+eases in over the clip and holds its last pose past the end. Timing is the Sequence's, never Blender's.
## Setting it up — HEADLESS
@@ -19,66 +81,31 @@
- The same command installs the MCP for Blender add-on into that Blender (it needs uv's `uvx`).
`raea setup blender --check` only reports.
-## Headless: `raea blender run` — HEADLESS
-
-`raea blender run SCRIPT.py [ARGS...]` runs the script in a windowless Blender (`--background --factory-startup`);
-the script reads its own arguments after `--` in `sys.argv`, and an uncaught Python error makes the command fail.
-Use it for every fix an agent can describe in code: convert, clean, decimate, set scale and pivot, re-rig, bake.
-
-## Live: the `blender` MCP server — BLENDER
+## Live: the `blender` MCP server, only to look — BLENDER
`raea skills install --agent claude|codex|kimi|gemini` registers a `blender` MCP server for the agent
-(`uvx mcp-for-blender`). Its tools (look, scene info, run Python, search and import Poly Haven, Sketchfab and
-Poly Pizza assets, generate a model) need a Blender running with its window open: tag such a step **BLENDER**, and
-give the headless `raea blender run` way beside it. `generate_3d` can cost the person a credit; ask first.
+(`uvx mcp-for-blender`; older installs name it `uvx blender-mcp`). It needs Blender running with its window open.
+- Use it only to inspect a bad asset (what are these pieces, where is the hole), or while the person watches.
+- A fix made live counts only once it is in a saved script that re-runs from the source.
+- Telemetry off, always: call its `disable_telemetry` tool first, or set `BLENDER_MCP_DISABLE_TELEMETRY=1` in the
+ server's env. It can otherwise send prompts, code and screenshots to its author.
+- `generate_3d` can cost the person a credit, and makes one object only; `raea gen` is the generation route. Ask first.
+
In the raea app, a workspace gives it to the feed's agents with a controller's servers field holding
`uvx mcp-for-blender` (`raea controller set PATH VALUE`).
## Licences
-Only permissive assets (CC0, CC BY with its credit, MIT). Write the source, licence and credit beside the `.glb`
-(`chair.glb.json`: `{"source": URL, "license": "CC0", "credit": ""}`), and keep them through every fix.
+Only permissive assets (CC0, CC BY with its credit, MIT). Every script refuses a source without a sidecar
+(`chair.fbx.json` or `chair.json`: `{"source": URL, "license": "CC0", "credit": ""}`) and carries it through to its
+output, with the step added. `raea solid export` writes its own.
## Common mistakes
-- Building the scene in Blender: export one asset, build the scene in TSX.
-- Judging scale by eye: read the model's bounds in the script and scale to a size in metres (a chair seat is
- 0.45 m high), with the origin at the bottom centre so it stands on the floor at `position={[x, 0, z]}`.
-- Hardcoding shader node names: they're localized; find nodes by `type` (`BSDF_PRINCIPLED`).
-- Exporting `.gltf` with loose files: export `.glb`, one file.
-- Moving a rigged model's mesh: the example is for a static model. A rigged one moves with its armature, so scale
- and place the armature (the mesh's parent) and apply its transform, or the skin pulls the mesh back.
-
-## Example: scale and pivot fixed, out as one .glb
-
-`raea blender run fix.py media/chair.fbx media/chair.glb 0.9` imports the file, makes it 0.9 m tall, puts its origin
-at the bottom centre and exports a `.glb`:
-
-```python
-import bpy, sys
-src, out, height = sys.argv[sys.argv.index("--") + 1:][:3]
-bpy.ops.wm.read_factory_settings(use_empty=True)
-ext = src.lower().rsplit(".", 1)[-1]
-load = {"fbx": bpy.ops.import_scene.fbx, "obj": bpy.ops.wm.obj_import, "glb": bpy.ops.import_scene.gltf,
- "gltf": bpy.ops.import_scene.gltf}.get(ext)
-load(filepath=src)
-objs = [o for o in bpy.context.scene.objects if o.type == "MESH"]
-bpy.ops.object.select_all(action="DESELECT")
-for o in objs:
- o.select_set(True)
-bpy.context.view_layer.objects.active = objs[0]
-bpy.ops.object.join()
-o = bpy.context.active_object
-bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
-s = float(height) / o.dimensions.z
-o.scale = (s, s, s)
-bpy.ops.object.transform_apply(scale=True)
-xs, ys, zs = zip(*[o.matrix_world @ v.co for v in o.data.vertices])
-bpy.context.scene.cursor.location = ((min(xs) + max(xs)) / 2, (min(ys) + max(ys)) / 2, min(zs))
-bpy.ops.object.origin_set(type="ORIGIN_CURSOR")
-o.location = (0, 0, 0)
-bpy.ops.export_scene.gltf(filepath=out, use_selection=True, export_format="GLB")
-print("wrote", out, [round(d, 3) for d in o.dimensions])
-```
-
-Blender's Z is up and glTF's Y is up; the exporter converts, so the model stands upright in raea.
+- Building, lighting or framing the scene in Blender: export one asset, build the scene in TSX.
+- Fixing an asset live and moving on: the next source change loses the fix. Put it in the script.
+- Modelling a box, a shelf or a bracket in bpy: it's a solid.
+- Decimating without `--seen`: the budget is for the distance it's seen from, not a number picked by eye.
+- Splitting by guess: read the box from `raea gen check --json`, then cut with `split.py`; check each part's
+ triangles in its output.
+- Posing a rigged model by moving its mesh: the skin pulls it back. Pose it with a clip (`--pose`).
diff --git a/sdk/guides/craft/bevy/blender/bake.py b/sdk/guides/craft/bevy/blender/bake.py
new file mode 100644
index 00000000..c00eab89
--- /dev/null
+++ b/sdk/guides/craft/bevy/blender/bake.py
@@ -0,0 +1,229 @@
+# bake.py: a model given real UVs and baked maps: ambient occlusion (where light can't reach: under a lip, in a seam,
+# where a part meets another), and a normal map from a high-poly source onto this low one.
+# raea blender run blender/bake.py IN.glb OUT.glb [--res 1024] [--samples 32] [--high HIGH.glb] [--into-colour]
+# [--texture IMG.jpg --tile METRES [--turn DEG]]
+# The UVs are a fresh smart projection on a second map ("bake") when the model's textures use its first, else they
+# replace the first (a solid's box UVs). The AO goes in the material's occlusion slot (glTF's; Bevy darkens ambient light
+# with it); --into-colour also multiplies it into the base colour (as a texture), so it shows under direct light too:
+# use it for a solid with flat colours. --texture puts a photo texture on it first (wood, metal, paint), projected from
+# the box's three sides at --tile metres a repeat (a real scale, the same on every face, no stretched islands), and
+# bakes that times the AO into the colour; --turn turns it about the vertical so the grain runs along the piece. --high bakes HIGH's surface detail as a normal map (both models in the same
+# space: decimate.py's input and output). Needs Cycles; a 1024 map of a prop takes seconds to a minute.
+import bpy, sys, os, json
+
+NAME = "bake.py"
+
+
+def fail(why):
+ print(f"FAILED {NAME}: {why}", file=sys.stderr)
+ sys.exit(1)
+
+
+def argv():
+ return sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+
+
+def opt(a, k, d=None):
+ return a[a.index(k) + 1] if k in a and a.index(k) + 1 < len(a) else d
+
+
+def sidecar(src):
+ for c in (src + ".json", os.path.splitext(src)[0] + ".json"):
+ if os.path.isfile(c):
+ return json.load(open(c))
+ fail(f"no licence sidecar for {src}: write {src}.json as {{\"source\": URL, \"license\": \"CC0\", \"credit\": \"\"}}")
+
+
+def meshes():
+ return [o for o in bpy.context.scene.objects if o.type == "MESH"]
+
+
+def textured(o):
+ return any(n.type == "TEX_IMAGE" for s in o.material_slots if s.material and s.material.node_tree for n in s.material.node_tree.nodes)
+
+
+def gltf_output(nt):
+ # the glTF exporter reads occlusion from a node group of this name
+ g = bpy.data.node_groups.get("glTF Material Output")
+ if g is None:
+ g = bpy.data.node_groups.new("glTF Material Output", "ShaderNodeTree")
+ g.interface.new_socket("Occlusion", in_out="INPUT", socket_type="NodeSocketFloat")
+ n = nt.nodes.new("ShaderNodeGroup")
+ n.node_tree = g
+ return n
+
+
+def main():
+ a = argv()
+ if len(a) < 2:
+ fail("usage: bake.py IN.glb OUT.glb [--res 1024] [--samples 32] [--high HIGH.glb] [--into-colour [--texture IMG --tile M]]")
+ src, out = os.path.abspath(a[0]), os.path.abspath(a[1])
+ side = sidecar(src)
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ bpy.ops.import_scene.gltf(filepath=src)
+ ms = meshes()
+ if not ms:
+ fail(f"{src} holds no mesh")
+ bpy.ops.object.select_all(action="DESELECT")
+ for o in ms:
+ o.select_set(True)
+ bpy.context.view_layer.objects.active = ms[0]
+ bpy.ops.object.parent_clear(type="CLEAR_KEEP_TRANSFORM")
+ if len(ms) > 1:
+ bpy.ops.object.join()
+ low = bpy.context.view_layer.objects.active
+ low.name = "baked"
+ bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
+ keep_uv = textured(low) and len(low.data.uv_layers) > 0
+ if not keep_uv:
+ while low.data.uv_layers:
+ low.data.uv_layers.remove(low.data.uv_layers[0])
+ uv = low.data.uv_layers.new(name="bake")
+ low.data.uv_layers.active = uv
+ bpy.ops.object.mode_set(mode="EDIT")
+ bpy.ops.mesh.select_all(action="SELECT")
+ bpy.ops.uv.smart_project(angle_limit=1.15, island_margin=0.004)
+ bpy.ops.object.mode_set(mode="OBJECT")
+ res = int(opt(a, "--res", "1024"))
+ sc = bpy.context.scene
+ sc.render.engine = "CYCLES"
+ sc.cycles.device = "CPU"
+ sc.cycles.samples = int(opt(a, "--samples", "32"))
+ sc.render.bake.margin = 8
+ if not low.material_slots:
+ m = bpy.data.materials.new("baked")
+ m.use_nodes = True
+ low.data.materials.append(m)
+ mats = {s.material for s in low.material_slots if s.material}
+ for m in mats:
+ m.use_nodes = True
+
+ def target(kind, colour):
+ img = bpy.data.images.new(f"{kind}", res, res, alpha=False, float_buffer=False)
+ img.colorspace_settings.name = "sRGB" if colour else "Non-Color"
+ for m in mats:
+ nt = m.node_tree
+ for n in nt.nodes:
+ n.select = False
+ t = nt.nodes.new("ShaderNodeTexImage")
+ t.image, t.name, t.select = img, f"raea-{kind}", True
+ nt.nodes.active = t
+ u = nt.nodes.new("ShaderNodeUVMap")
+ u.uv_map = "bake"
+ nt.links.new(u.outputs["UV"], t.inputs["Vector"])
+ return img
+
+ did = []
+ ao = target("ao", False)
+ bpy.ops.object.select_all(action="DESELECT")
+ low.select_set(True)
+ bpy.context.view_layer.objects.active = low
+ bpy.ops.object.bake(type="AO")
+ did.append("ao")
+ high = opt(a, "--high")
+ nmap = None
+ if high:
+ nmap = target("normal", False)
+ before = set(bpy.context.scene.objects)
+ bpy.ops.import_scene.gltf(filepath=os.path.abspath(high))
+ hs = [o for o in bpy.context.scene.objects if o not in before and o.type == "MESH"]
+ if not hs:
+ fail(f"{high} holds no mesh")
+ bpy.ops.object.select_all(action="DESELECT")
+ for h in hs:
+ h.select_set(True)
+ low.select_set(True)
+ bpy.context.view_layer.objects.active = low
+ size = max(low.dimensions)
+ bpy.ops.object.bake(type="NORMAL", use_selected_to_active=True, cage_extrusion=size * 0.02, max_ray_distance=size * 0.05)
+ for h in hs:
+ bpy.data.objects.remove(h)
+ did.append("normal")
+ # wire the maps in: occlusion through the glTF output group, the normal map into the shader, AO into colour
+ for m in mats:
+ nt = m.node_tree
+ bsdf = next((n for n in nt.nodes if n.type == "BSDF_PRINCIPLED"), None)
+ if bsdf is None:
+ continue
+ aon = nt.nodes["raea-ao"]
+ nt.links.new(aon.outputs["Color"], gltf_output(nt).inputs["Occlusion"])
+ if nmap is not None:
+ nm = nt.nodes.new("ShaderNodeNormalMap")
+ nm.uv_map = "bake"
+ nt.links.new(nt.nodes["raea-normal"].outputs["Color"], nm.inputs["Color"])
+ nt.links.new(nm.outputs["Normal"], bsdf.inputs["Normal"])
+ if "--into-colour" in a and opt(a, "--texture"):
+ # the photo projected from the box's sides at a real scale, baked through the fresh UVs, times the AO
+ base = bsdf.inputs["Base Color"]
+ if base.is_linked:
+ fail("--texture is for flat colours: this material's base colour is a texture already")
+ tile = float(opt(a, "--tile", "0.5"))
+ src_img = bpy.data.images.load(os.path.abspath(opt(a, "--texture")))
+ tc = nt.nodes.new("ShaderNodeTexCoord")
+ mp = nt.nodes.new("ShaderNodeMapping")
+ mp.inputs["Scale"].default_value = (1 / tile, 1 / tile, 1 / tile)
+ mp.inputs["Rotation"].default_value = (0, 0, float(opt(a, "--turn", "0")) * 3.14159265 / 180)
+ nt.links.new(tc.outputs["Object"], mp.inputs["Vector"])
+ tx = nt.nodes.new("ShaderNodeTexImage")
+ tx.image, tx.projection, tx.projection_blend = src_img, "BOX", 0.2
+ nt.links.new(mp.outputs["Vector"], tx.inputs["Vector"])
+ nt.links.new(tx.outputs["Color"], base)
+ img = bpy.data.images.new(f"colour-{m.name}", res, res, alpha=False)
+ for n in nt.nodes:
+ n.select = False
+ t = nt.nodes.new("ShaderNodeTexImage")
+ t.image, t.select = img, True
+ nt.nodes.active = t
+ u = nt.nodes.new("ShaderNodeUVMap")
+ u.uv_map = "bake"
+ nt.links.new(u.outputs["UV"], t.inputs["Vector"])
+ bpy.ops.object.select_all(action="DESELECT")
+ low.select_set(True)
+ bpy.context.view_layer.objects.active = low
+ bpy.ops.object.bake(type="DIFFUSE", pass_filter={"COLOR"})
+ px, occ = [0.0] * (res * res * 4), [0.0] * (res * res * 4)
+ img.pixels.foreach_get(px)
+ ao.pixels.foreach_get(occ)
+ # the colour bake is linear in a float view of an sRGB image: multiply in linear, store as display values
+ lin = lambda c: c / 12.92 if c <= 0.04045 else ((c + 0.055) / 1.055) ** 2.4
+ srgb = lambda c: 12.92 * c if c <= 0.0031308 else 1.055 * c ** (1 / 2.4) - 0.055
+ for i in range(0, len(px), 4):
+ k = occ[i]
+ px[i], px[i + 1], px[i + 2], px[i + 3] = srgb(lin(px[i]) * k), srgb(lin(px[i + 1]) * k), srgb(lin(px[i + 2]) * k), 1.0
+ img.pixels.foreach_set(px)
+ for n in (tc, mp, tx):
+ nt.nodes.remove(n)
+ nt.links.new(t.outputs["Color"], base)
+ did.append(f"texture {os.path.basename(opt(a, '--texture'))} at {tile} m")
+ elif "--into-colour" in a:
+ base = bsdf.inputs["Base Color"]
+ if base.is_linked:
+ fail("--into-colour is for flat colours: this material's base colour is a texture already (its occlusion slot has the AO)")
+ # a texture of the flat colour times the AO, baked with the same UVs
+ col = list(base.default_value)
+ img = bpy.data.images.new(f"colour-{m.name}", res, res, alpha=False)
+ px = [0.0] * (res * res * 4)
+ ao.pixels.foreach_get(px)
+ # the base colour is linear; an 8-bit sRGB image holds display values
+ srgb = lambda c: 12.92 * c if c <= 0.0031308 else 1.055 * c ** (1 / 2.4) - 0.055
+ for i in range(0, len(px), 4):
+ k = px[i]
+ px[i], px[i + 1], px[i + 2], px[i + 3] = srgb(col[0] * k), srgb(col[1] * k), srgb(col[2] * k), 1.0
+ img.pixels.foreach_set(px)
+ t = nt.nodes.new("ShaderNodeTexImage")
+ t.image = img
+ u = nt.nodes.new("ShaderNodeUVMap")
+ u.uv_map = "bake"
+ nt.links.new(u.outputs["UV"], t.inputs["Vector"])
+ nt.links.new(t.outputs["Color"], base)
+ did.append("colour")
+ for img in bpy.data.images:
+ if img.name.startswith(("ao", "normal", "colour-")):
+ img.pack()
+ bpy.ops.export_scene.gltf(filepath=out, export_format="GLB", export_yup=True)
+ json.dump({**side, "steps": list(side.get("steps", [])) + [{"script": NAME, "from": os.path.basename(src), "res": res, "maps": did, "uvKept": keep_uv}]},
+ open(out + ".json", "w"), indent=2)
+ print(f"APPLIED {NAME}: {out}: {', '.join(did)} at {res}px; UVs {'added beside its own' if keep_uv else 'made fresh'}")
+
+
+main()
diff --git a/sdk/guides/craft/bevy/blender/cloth.py b/sdk/guides/craft/bevy/blender/cloth.py
new file mode 100644
index 00000000..e630c809
--- /dev/null
+++ b/sdk/guides/craft/bevy/blender/cloth.py
@@ -0,0 +1,179 @@
+# cloth.py: a cloth simulated over the things it falls on and baked into a clip raea plays: a rag over a bench edge, a
+# tarp over a crate, a towel on a rail.
+# raea blender run blender/cloth.py IN.glb OUT.glb (--sheet W,D,X,Y,Z | --cloth NAME) [--pin X0,Y0,Z0,X1,Y1,Z1]
+# [--frames 60] [--every 3] [--cuts 24] [--mass 0.15] [--stiff 5] [--bend 0.05] [--crumple 0] [--no-floor]
+# IN holds what the cloth lands on (every mesh in it collides; a solid from `raea solid export` is fine). The cloth is
+# a W x D metre sheet made level at X,Y,Z (raea's frame, metres, y up), or the mesh NAME in IN. --pin holds the
+# vertices inside that box still (a cloth hung from a nail). A floor at y 0 collides too, unless --no-floor. OUT holds the cloth alone: its flat start, a morph target
+# every --every frames and the clip "Drape" keyed through them (<Model animation="Drape" time={t} loop={false}>; past
+# its end it holds the settled cloth), and OUT.settled.glb holds the last frame as a plain mesh.
+import bpy, bmesh, sys, os, json
+from mathutils import Vector
+
+NAME = "cloth.py"
+
+
+def fail(why):
+ print(f"FAILED {NAME}: {why}", file=sys.stderr)
+ sys.exit(1)
+
+
+def argv():
+ return sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+
+
+def opt(a, k, d=None):
+ return a[a.index(k) + 1] if k in a and a.index(k) + 1 < len(a) else d
+
+
+def sidecar(src):
+ for c in (src + ".json", os.path.splitext(src)[0] + ".json"):
+ if os.path.isfile(c):
+ return json.load(open(c))
+ fail(f"no licence sidecar for {src}: write {src}.json as {{\"source\": URL, \"license\": \"CC0\", \"credit\": \"\"}}")
+
+
+def nums(s, n, what):
+ v = [float(x) for x in s.split(",")]
+ if len(v) != n:
+ fail(f"{what} takes {n} numbers, got {s!r}")
+ return v
+
+
+def b(p):
+ return Vector((p[0], -p[2], p[1]))
+
+
+def export(path, objs, side, step, morph):
+ bpy.ops.object.select_all(action="DESELECT")
+ for o in objs:
+ o.select_set(True)
+ bpy.ops.export_scene.gltf(filepath=path, export_format="GLB", export_yup=True, use_selection=True,
+ export_morph=morph, export_animations=morph, export_morph_animation=morph)
+ json.dump({**side, "steps": list(side.get("steps", [])) + [step]}, open(path + ".json", "w"), indent=2)
+
+
+def main():
+ a = argv()
+ if len(a) < 2 or not (opt(a, "--sheet") or opt(a, "--cloth")):
+ fail("usage: cloth.py IN.glb OUT.glb (--sheet W,D,X,Y,Z | --cloth NAME) [--pin box] [--frames 60] [--every 3]")
+ src, out = os.path.abspath(a[0]), os.path.abspath(a[1])
+ side = sidecar(src)
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ bpy.ops.import_scene.gltf(filepath=src)
+ ms = [o for o in bpy.context.scene.objects if o.type == "MESH"]
+ bpy.ops.object.select_all(action="DESELECT")
+ for o in ms:
+ o.select_set(True)
+ if ms:
+ bpy.context.view_layer.objects.active = ms[0]
+ bpy.ops.object.parent_clear(type="CLEAR_KEEP_TRANSFORM")
+ cuts = int(opt(a, "--cuts", "24"))
+ if opt(a, "--sheet"):
+ w, d, x, y, z = nums(opt(a, "--sheet"), 5, "--sheet")
+ bpy.ops.mesh.primitive_grid_add(x_subdivisions=cuts, y_subdivisions=cuts, size=1, location=b([x, y, z]))
+ cloth = bpy.context.active_object
+ cloth.scale = (w, d, 1)
+ bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
+ bpy.ops.object.shade_smooth() # cloth is soft: the grid's flat faces read as folded card
+ cloth.name = "cloth"
+ # a sheet laid perfectly flat lands perfectly flat: --crumple lifts it in a few soft seeded waves (up to that
+ # many metres, folds about 12 cm apart), so it lands in folds like a rag dropped from the hand
+ crumple = float(opt(a, "--crumple", "0"))
+ if crumple > 0:
+ import math, random
+ rnd = random.Random(7)
+ waves = [(rnd.uniform(-1, 1), rnd.uniform(-1, 1), rnd.uniform(0, 6.3)) for _ in range(4)]
+ k = 2 * math.pi / 0.12
+ for v in cloth.data.vertices:
+ h = sum(math.sin(k * (dx * v.co.x + dy * v.co.y) + ph) for dx, dy, ph in waves) / len(waves)
+ v.co.z += crumple * (0.5 + 0.5 * h)
+ else:
+ cloth = bpy.data.objects.get(opt(a, "--cloth"))
+ if cloth is None or cloth.type != "MESH":
+ fail(f"no mesh {opt(a, '--cloth')} in {src}: {', '.join(o.name for o in ms)}")
+ colliders = [o for o in ms if o != cloth]
+ if "--no-floor" not in a:
+ # the floor at y 0, so a cloth that slides off lands instead of falling forever (it isn't exported)
+ bpy.ops.mesh.primitive_plane_add(size=20, location=(0, 0, 0))
+ colliders.append(bpy.context.active_object)
+ for o in colliders:
+ o.modifiers.new("collide", "COLLISION")
+ # thick enough that a fall of a few centimetres a frame can't pass through a big flat face, with friction so
+ # the cloth stops where it lands instead of skating off (or being thrown, when it ends up inside)
+ o.collision.thickness_outer = 0.01
+ o.collision.cloth_friction = 40
+ o.collision.damping = 0.5
+ if opt(a, "--pin"):
+ x0, y0, z0, x1, y1, z1 = nums(opt(a, "--pin"), 6, "--pin")
+ lo, hi = b([min(x0, x1), min(y0, y1), max(z0, z1)]), b([max(x0, x1), max(y0, y1), min(z0, z1)])
+ g = cloth.vertex_groups.new(name="pin")
+ mw = cloth.matrix_world
+ idx = [v.index for v in cloth.data.vertices if all(min(lo[k], hi[k]) <= (mw @ v.co)[k] <= max(lo[k], hi[k]) for k in range(3))]
+ if not idx:
+ fail("--pin holds no vertex of the cloth")
+ g.add(idx, 1.0, "REPLACE")
+ m = cloth.modifiers.new("cloth", "CLOTH")
+ m.settings.mass = float(opt(a, "--mass", "0.15"))
+ m.settings.tension_stiffness = m.settings.compression_stiffness = float(opt(a, "--stiff", "5"))
+ m.settings.bending_stiffness = float(opt(a, "--bend", "0.05"))
+ m.settings.quality = 12
+ m.settings.air_damping = 2
+ m.collision_settings.collision_quality = 4
+ m.collision_settings.use_self_collision = True
+ m.collision_settings.distance_min = 0.004
+ m.collision_settings.self_distance_min = 0.004
+ if opt(a, "--pin"):
+ m.settings.vertex_group_mass = "pin"
+ frames, every = int(opt(a, "--frames", "60")), max(1, int(opt(a, "--every", "3")))
+ sc = bpy.context.scene
+ sc.frame_start, sc.frame_end = 1, frames
+ m.point_cache.frame_start, m.point_cache.frame_end = 1, frames
+ # step the simulation, keeping the cloth's shape at every sampled frame
+ shapes = []
+ for f in range(1, frames + 1):
+ sc.frame_set(f)
+ if f == 1 or f % every == 0 or f == frames:
+ ev = cloth.evaluated_get(bpy.context.evaluated_depsgraph_get())
+ shapes.append((f, [v.co.copy() for v in ev.data.vertices]))
+ cloth.modifiers.remove(m)
+ if not cloth.data.shape_keys:
+ cloth.shape_key_add(name="flat")
+ keys = []
+ for f, co in shapes[1:]:
+ k = cloth.shape_key_add(name=f"f{f}")
+ for i, c in enumerate(co):
+ k.data[i].co = c
+ keys.append((f, k))
+ # one key on at a time, eased between neighbours
+ for i, (f, k) in enumerate(keys):
+ prev = shapes[i][0]
+ nxt = keys[i + 1][0] if i + 1 < len(keys) else None
+ for at, val in ((prev, 0.0), (f, 1.0)) + (((nxt, 0.0),) if nxt else ()):
+ k.value = val
+ k.keyframe_insert("value", frame=at)
+ act = cloth.data.shape_keys.animation_data.action
+ act.name = "Drape"
+ for o in colliders:
+ o.hide_set(True)
+ settled_co = shapes[-1][1]
+ moved = max((c - cloth.data.vertices[i].co).length for i, c in enumerate(settled_co))
+ if moved < 1e-4:
+ fail("the cloth never moved: is it inside what it should fall onto, or pinned everywhere?")
+ export(out, [cloth], side, {"script": NAME, "from": os.path.basename(src), "frames": frames, "keys": len(keys)}, True)
+ # the settled cloth as a plain mesh
+ cloth.animation_data_clear() if cloth.animation_data else None
+ cloth.data.shape_keys.animation_data_clear()
+ bpy.ops.object.select_all(action="DESELECT")
+ cloth.select_set(True)
+ bpy.context.view_layer.objects.active = cloth
+ for k in list(cloth.data.shape_keys.key_blocks)[1:]:
+ k.value = 0.0
+ cloth.data.shape_keys.key_blocks[-1].value = 1.0
+ bpy.ops.object.shape_key_remove(all=True, apply_mix=True)
+ settled = out[:-4] + ".settled.glb"
+ export(settled, [cloth], side, {"script": NAME, "from": os.path.basename(src), "frames": frames, "settled": True}, False)
+ print(f"APPLIED {NAME}: {out}: clip Drape, {len(keys)} morph targets over {frames} frames (the cloth moved up to {moved:.3f} m); settled mesh {settled}")
+
+
+main()
diff --git a/sdk/guides/craft/bevy/blender/convert.py b/sdk/guides/craft/bevy/blender/convert.py
new file mode 100644
index 00000000..b0d672b6
--- /dev/null
+++ b/sdk/guides/craft/bevy/blender/convert.py
@@ -0,0 +1,160 @@
+# convert.py: a model raea can't load (FBX, OBJ, .blend, or a .gltf with loose files) as one .glb.
+# raea blender run blender/convert.py IN OUT.glb [--textures DIR] [--unit auto|m|cm|mm] [--max-texture 2048]
+# Its transforms are applied, it's written in metres, y up, and its PBR textures go with it: what the importer wired,
+# else the maps in --textures DIR (or a textures/ folder beside it) found by their usual names (diff or albedo or
+# basecolor, nor_gl or normal, rough, metal, ao). --unit auto scales a model whose biggest side is over 50 (authored in
+# centimetres or millimetres) to metres. Float maps (EXR) are written as 8-bit and every map is scaled down to
+# --max-texture pixels a side (2048; 1024 for a prop seen from metres away). Then: raea gen check OUT.glb --h HEIGHT.
+import bpy, sys, os, json, glob
+
+NAME = "convert.py"
+
+
+def fail(why):
+ print(f"FAILED {NAME}: {why}", file=sys.stderr)
+ sys.exit(1)
+
+
+def argv():
+ return sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+
+
+def opt(a, k, d=None):
+ return a[a.index(k) + 1] if k in a and a.index(k) + 1 < len(a) else d
+
+
+def sidecar(src):
+ for c in (src + ".json", os.path.splitext(src)[0] + ".json"):
+ if os.path.isfile(c):
+ return json.load(open(c))
+ fail(f"no licence sidecar for {src}: write {src}.json as {{\"source\": URL, \"license\": \"CC0\", \"credit\": \"\"}}")
+
+
+def load(src):
+ ext = src.lower().rsplit(".", 1)[-1]
+ if ext == "blend":
+ bpy.ops.wm.open_mainfile(filepath=src)
+ return
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ op = {"fbx": bpy.ops.import_scene.fbx, "obj": bpy.ops.wm.obj_import, "glb": bpy.ops.import_scene.gltf,
+ "gltf": bpy.ops.import_scene.gltf, "stl": bpy.ops.wm.stl_import, "ply": bpy.ops.wm.ply_import}.get(ext)
+ if op is None:
+ fail(f"can't read .{ext} (FBX, OBJ, .blend, glTF, STL, PLY)")
+ op(filepath=src)
+
+
+def save(out, src, side, step):
+ meshes = [o for o in bpy.context.scene.objects if o.type == "MESH"]
+ if not meshes:
+ fail("no mesh to write")
+ bpy.ops.export_scene.gltf(filepath=out, export_format="GLB", export_apply=True, export_yup=True)
+ steps = list(side.get("steps", [])) + [step]
+ json.dump({**side, "steps": steps}, open(out + ".json", "w"), indent=2)
+ tris = sum(sum(len(p.vertices) - 2 for p in o.data.polygons) for o in meshes)
+ print(f"APPLIED {NAME}: {out} ({len(meshes)} meshes, {tris} triangles), licence in {out}.json")
+
+
+KINDS = {"base": ("diff", "albedo", "basecolor", "base_color", "color", "col"), "normal": ("nor_gl", "normal_gl", "normal", "nor"),
+ "rough": ("rough", "roughness"), "metal": ("metal", "metallic", "metalness"), "ao": ("ao", "occlusion")}
+
+
+def maps(folder):
+ found = {}
+ for f in sorted(glob.glob(os.path.join(folder, "*"))):
+ stem = os.path.splitext(os.path.basename(f))[0].lower()
+ for kind, words in KINDS.items():
+ if kind not in found and any(f"_{w}" in stem or stem.startswith(w) for w in words):
+ found[kind] = f
+ return found
+
+
+def wire(mat, found):
+ mat.use_nodes = True
+ nt = mat.node_tree
+ bsdf = next((n for n in nt.nodes if n.type == "BSDF_PRINCIPLED"), None)
+ if bsdf is None:
+ return 0
+ def img(path, colour):
+ n = nt.nodes.new("ShaderNodeTexImage")
+ n.image = bpy.data.images.load(path, check_existing=True)
+ n.image.colorspace_settings.name = "sRGB" if colour else "Non-Color"
+ return n
+ done = 0
+ if "base" in found and not bsdf.inputs["Base Color"].is_linked:
+ nt.links.new(img(found["base"], True).outputs["Color"], bsdf.inputs["Base Color"]); done += 1
+ if "rough" in found and not bsdf.inputs["Roughness"].is_linked:
+ nt.links.new(img(found["rough"], False).outputs["Color"], bsdf.inputs["Roughness"]); done += 1
+ if "metal" in found and not bsdf.inputs["Metallic"].is_linked:
+ nt.links.new(img(found["metal"], False).outputs["Color"], bsdf.inputs["Metallic"]); done += 1
+ if "normal" in found and not bsdf.inputs["Normal"].is_linked:
+ nm = nt.nodes.new("ShaderNodeNormalMap")
+ nt.links.new(img(found["normal"], False).outputs["Color"], nm.inputs["Color"])
+ nt.links.new(nm.outputs["Normal"], bsdf.inputs["Normal"]); done += 1
+ return done
+
+
+def shrink(most):
+ import tempfile
+ tmp = tempfile.mkdtemp(prefix="raea-convert-")
+ n = 0
+ for i in list(bpy.data.images):
+ if i.source != "FILE" or not i.has_data and not i.size[0]:
+ continue
+ w, h = i.size
+ if w == 0:
+ continue
+ k = min(1.0, most / max(w, h))
+ if k == 1.0 and not i.is_float:
+ continue
+ if k < 1.0:
+ i.scale(max(1, int(w * k)), max(1, int(h * k)))
+ w, h = i.size
+ px = [0.0] * (w * h * 4)
+ i.pixels.foreach_get(px)
+ j = bpy.data.images.new(i.name + "-8bit", w, h, alpha=True, float_buffer=False)
+ j.colorspace_settings.name = i.colorspace_settings.name
+ j.pixels.foreach_set(px)
+ j.filepath_raw = os.path.join(tmp, f"{len(os.listdir(tmp))}.png")
+ j.file_format = "PNG"
+ j.save()
+ i.user_remap(j)
+ n += 1
+ return n
+
+
+def main():
+ a = argv()
+ if len(a) < 2:
+ fail("usage: convert.py IN OUT.glb [--textures DIR] [--unit auto|m|cm|mm]")
+ src, out = os.path.abspath(a[0]), os.path.abspath(a[1])
+ if not os.path.isfile(src):
+ fail(f"no file {src}")
+ side = sidecar(src)
+ load(src)
+ meshes = [o for o in bpy.context.scene.objects if o.type == "MESH"]
+ if not meshes:
+ fail(f"{src} holds no mesh")
+ for o in bpy.context.scene.objects:
+ o.select_set(o.type in ("MESH", "EMPTY", "ARMATURE"))
+ bpy.context.view_layer.objects.active = meshes[0]
+ bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
+ # units: a model authored in centimetres is 100 times too big
+ unit = opt(a, "--unit", "auto")
+ big = max(max(o.dimensions) for o in meshes)
+ s = {"m": 1.0, "cm": 0.01, "mm": 0.001}.get(unit, 0.01 if big > 50 else 1.0)
+ if s != 1.0:
+ for o in bpy.context.scene.objects:
+ if o.parent is None:
+ o.scale = [x * s for x in o.scale]
+ bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
+ folder = opt(a, "--textures") or os.path.join(os.path.dirname(src), "textures")
+ found = maps(folder) if os.path.isdir(folder) else {}
+ wired = sum(wire(m, found) for m in {s.material for o in meshes for s in o.material_slots if s.material}) if found else 0
+ shrunk = shrink(int(opt(a, "--max-texture", "2048")))
+ missing = [i.filepath for i in bpy.data.images if i.source == "FILE" and not os.path.isfile(bpy.path.abspath(i.filepath))]
+ if missing and not found:
+ fail(f"textures it names are missing ({', '.join(missing[:3])}): give --textures DIR")
+ save(out, src, side, {"script": NAME, "from": os.path.basename(src), "scale": s, "texturesWired": wired, "texturesShrunk": shrunk})
+
+
+main()
diff --git a/sdk/guides/craft/bevy/blender/decimate.py b/sdk/guides/craft/bevy/blender/decimate.py
new file mode 100644
index 00000000..842502ee
--- /dev/null
+++ b/sdk/guides/craft/bevy/blender/decimate.py
@@ -0,0 +1,92 @@
+# decimate.py: a model over its triangle budget brought under it, its UVs and materials kept.
+# raea blender run blender/decimate.py IN.glb OUT.glb TARGET [--lods 0.5,0.25]
+# TARGET is a triangle count (20000) or a ratio of what it has (0.25); gen check's and scene lint's `fix` give the
+# count for its viewing distance. --lods also writes OUT.lod1.glb, OUT.lod2.glb at those fractions of TARGET, for far
+# placements of the same thing (raea draws the file a Model names; use the small one where it's seen far).
+# A model with shape keys is refused (a collapse can't keep them): decimate its source before it's rigged.
+import bpy, sys, os, json
+
+NAME = "decimate.py"
+
+
+def fail(why):
+ print(f"FAILED {NAME}: {why}", file=sys.stderr)
+ sys.exit(1)
+
+
+def argv():
+ return sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+
+
+def opt(a, k, d=None):
+ return a[a.index(k) + 1] if k in a and a.index(k) + 1 < len(a) else d
+
+
+def sidecar(src):
+ for c in (src + ".json", os.path.splitext(src)[0] + ".json"):
+ if os.path.isfile(c):
+ return json.load(open(c))
+ fail(f"no licence sidecar for {src}: write {src}.json as {{\"source\": URL, \"license\": \"CC0\", \"credit\": \"\"}}")
+
+
+def load(src):
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ if not src.lower().endswith((".glb", ".gltf")):
+ fail(f"{src}: give a .glb (convert.py makes one)")
+ bpy.ops.import_scene.gltf(filepath=src)
+
+
+def meshes():
+ return [o for o in bpy.context.scene.objects if o.type == "MESH"]
+
+
+def tris():
+ return sum(sum(len(p.vertices) - 2 for p in o.data.polygons) for o in meshes())
+
+
+def save(out, side, step):
+ bpy.ops.export_scene.gltf(filepath=out, export_format="GLB", export_yup=True)
+ json.dump({**side, "steps": list(side.get("steps", [])) + [step]}, open(out + ".json", "w"), indent=2)
+
+
+def collapse(ratio):
+ for o in meshes():
+ m = o.modifiers.new("raea-decimate", "DECIMATE")
+ m.ratio = max(0.0005, min(1.0, ratio))
+ m.use_collapse_triangulate = True
+ bpy.context.view_layer.objects.active = o
+ bpy.ops.object.modifier_apply(modifier=m.name)
+
+
+def main():
+ a = argv()
+ if len(a) < 3:
+ fail("usage: decimate.py IN.glb OUT.glb TARGET [--lods 0.5,0.25]")
+ src, out = os.path.abspath(a[0]), os.path.abspath(a[1])
+ side = sidecar(src)
+ load(src)
+ if not meshes():
+ fail(f"{src} holds no mesh")
+ if any(o.data.shape_keys for o in meshes()):
+ fail("it has shape keys (morph targets), which a collapse can't keep: decimate the model before it's rigged or keyed")
+ before = tris()
+ t = float(a[2])
+ target = int(t * before) if t <= 1.0 else int(t)
+ if target >= before:
+ print(f"APPLIED {NAME}: {before} triangles, already within {target}: written unchanged")
+ else:
+ collapse(target / before)
+ got = tris()
+ if got > target * 1.15:
+ fail(f"got {got} triangles, over the {target} asked (thin parts the collapse protects): repair.py --voxel first, or a lower target")
+ save(out, side, {"script": NAME, "from": os.path.basename(src), "before": before, "after": got})
+ print(f"APPLIED {NAME}: {out}: {before} -> {got} triangles (target {target})")
+ lods = [float(x) for x in opt(a, "--lods", "").split(",") if x.strip()]
+ for i, f in enumerate(lods, 1):
+ collapse(f * target / tris())
+ lod = out[:-4] + f".lod{i}.glb"
+ save(lod, side, {"script": NAME, "from": os.path.basename(src), "before": before, "after": tris(), "lod": i})
+ print(f"APPLIED {NAME}: {lod}: {tris()} triangles")
+
+
+main()
diff --git a/sdk/guides/craft/bevy/blender/repair.py b/sdk/guides/craft/bevy/blender/repair.py
new file mode 100644
index 00000000..1fdcb613
--- /dev/null
+++ b/sdk/guides/craft/bevy/blender/repair.py
@@ -0,0 +1,134 @@
+# repair.py: a model's surface mended: doubled vertices merged, loose debris dropped, holes filled, normals pointed out;
+# or, with --voxel, rebuilt as one closed surface.
+# raea blender run blender/repair.py IN.glb OUT.glb [--debris 0.005] [--voxel SIZE_M] [--keep-pieces]
+# --debris: a separate piece with fewer than this share of the triangles is dropped (gen check's "loose bits");
+# --keep-pieces keeps every piece (a tool modelled in parts). --voxel remeshes to a closed surface at that cell size in
+# metres: for a mesh too broken to mend (it loses its UVs and textures, so bake.py after it). Prints what it changed.
+import bpy, bmesh, sys, os, json
+
+NAME = "repair.py"
+
+
+def fail(why):
+ print(f"FAILED {NAME}: {why}", file=sys.stderr)
+ sys.exit(1)
+
+
+def argv():
+ return sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+
+
+def opt(a, k, d=None):
+ return a[a.index(k) + 1] if k in a and a.index(k) + 1 < len(a) else d
+
+
+def sidecar(src):
+ for c in (src + ".json", os.path.splitext(src)[0] + ".json"):
+ if os.path.isfile(c):
+ return json.load(open(c))
+ fail(f"no licence sidecar for {src}: write {src}.json as {{\"source\": URL, \"license\": \"CC0\", \"credit\": \"\"}}")
+
+
+def load(src):
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ if not src.lower().endswith((".glb", ".gltf")):
+ fail(f"{src}: give a .glb (convert.py makes one)")
+ bpy.ops.import_scene.gltf(filepath=src)
+
+
+def meshes():
+ return [o for o in bpy.context.scene.objects if o.type == "MESH"]
+
+
+def save(out, side, step):
+ bpy.ops.export_scene.gltf(filepath=out, export_format="GLB", export_yup=True, export_apply=True)
+ json.dump({**side, "steps": list(side.get("steps", [])) + [step]}, open(out + ".json", "w"), indent=2)
+
+
+def edges(o):
+ bm = bmesh.new()
+ bm.from_mesh(o.data)
+ bm.edges.ensure_lookup_table()
+ opened = sum(1 for e in bm.edges if len(e.link_faces) == 1)
+ shared = sum(1 for e in bm.edges if len(e.link_faces) > 2)
+ bm.free()
+ return opened, shared
+
+
+def pieces(bm):
+ seen, out = set(), []
+ for f in bm.faces:
+ if f.index in seen:
+ continue
+ stack, part = [f], []
+ seen.add(f.index)
+ while stack:
+ g = stack.pop()
+ part.append(g)
+ for e in g.edges:
+ for h in e.link_faces:
+ if h.index not in seen:
+ seen.add(h.index)
+ stack.append(h)
+ out.append(part)
+ return out
+
+
+def mend(o, debris, keep, size):
+ bm = bmesh.new()
+ bm.from_mesh(o.data)
+ n0 = len(bm.verts)
+ bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=max(1e-6, size * 1e-5))
+ merged = n0 - len(bm.verts)
+ bm.faces.ensure_lookup_table()
+ dropped = 0
+ if not keep:
+ parts = pieces(bm)
+ total = sum(len(p) for p in parts)
+ small = [f for p in parts if len(p) < debris * total for f in p]
+ dropped = len([p for p in parts if len(p) < debris * total])
+ bmesh.ops.delete(bm, geom=small, context="FACES")
+ holes = bmesh.ops.holes_fill(bm, edges=bm.edges, sides=64)
+ bmesh.ops.recalc_face_normals(bm, faces=bm.faces)
+ bm.to_mesh(o.data)
+ bm.free()
+ return merged, dropped, len(holes["faces"])
+
+
+def main():
+ a = argv()
+ if len(a) < 2:
+ fail("usage: repair.py IN.glb OUT.glb [--debris 0.005] [--voxel SIZE_M] [--keep-pieces]")
+ src, out = os.path.abspath(a[0]), os.path.abspath(a[1])
+ side = sidecar(src)
+ load(src)
+ ms = meshes()
+ if not ms:
+ fail(f"{src} holds no mesh")
+ for o in ms:
+ o.select_set(True)
+ bpy.context.view_layer.objects.active = ms[0]
+ bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
+ size = max(max(o.dimensions) for o in ms)
+ before = [edges(o) for o in ms]
+ voxel = opt(a, "--voxel")
+ did = {}
+ if voxel:
+ for o in ms:
+ m = o.modifiers.new("raea-remesh", "REMESH")
+ m.mode, m.voxel_size = "VOXEL", float(voxel)
+ bpy.context.view_layer.objects.active = o
+ bpy.ops.object.modifier_apply(modifier=m.name)
+ did["voxel"] = float(voxel)
+ print(f"NOTE {NAME}: remeshed at {voxel} m: UVs and textures are gone; bake.py gives it new ones")
+ else:
+ got = [mend(o, float(opt(a, "--debris", "0.005")), "--keep-pieces" in a, size) for o in ms]
+ did = {"merged": sum(g[0] for g in got), "debrisDropped": sum(g[1] for g in got), "holesFilled": sum(g[2] for g in got)}
+ after = [edges(o) for o in ms]
+ step = {"script": NAME, "from": os.path.basename(src), **did, "openEdges": [sum(b[0] for b in before), sum(x[0] for x in after)],
+ "sharedEdges": [sum(b[1] for b in before), sum(x[1] for x in after)]}
+ save(out, side, step)
+ print(f"APPLIED {NAME}: {out}: {did}; open edges {step['openEdges'][0]} -> {step['openEdges'][1]}, shared {step['sharedEdges'][0]} -> {step['sharedEdges'][1]}")
+
+
+main()
diff --git a/sdk/guides/craft/bevy/blender/rig.py b/sdk/guides/craft/bevy/blender/rig.py
new file mode 100644
index 00000000..daa88cf6
--- /dev/null
+++ b/sdk/guides/craft/bevy/blender/rig.py
@@ -0,0 +1,183 @@
+# rig.py: a model with no skeleton given bones, weights and named pose clips, so raea can pose it (<Model
+# animation="Reach">, the clip at the Sequence's time). Blender rigs; raea decides when a pose plays.
+# raea blender run blender/rig.py IN.glb OUT.glb --bone NAME=HX,HY,HZ:TX,TY,TZ[:PARENT] ... \
+# [--pose CLIP=BONE:RX,RY,RZ/BONE:RX,RY,RZ ...] [--weights rigid|auto] [--frames 24]
+# Points are in raea's frame (metres, y up, the model's own space: gen check's box), head to tail. A pose turns bones
+# by degrees about their own axes (X bends along the bone's plane, Y twists, Z bends sideways) and the clip eases from
+# rest to it over --frames; every model also gets "Rest". --weights rigid gives each vertex wholly to its nearest bone
+# (a lamp, a machine, a robot: parts that don't bend); auto is Blender's heat weighting (a creature, cloth-like parts),
+# falling back to envelopes when heat weighting fails on a broken mesh (repair.py first is better).
+import bpy, sys, os, json
+from mathutils import Vector, Euler
+
+NAME = "rig.py"
+
+
+def fail(why):
+ print(f"FAILED {NAME}: {why}", file=sys.stderr)
+ sys.exit(1)
+
+
+def argv():
+ return sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+
+
+def opt(a, k, d=None):
+ return a[a.index(k) + 1] if k in a and a.index(k) + 1 < len(a) else d
+
+
+def many(a, k):
+ return [a[i + 1] for i, x in enumerate(a) if x == k and i + 1 < len(a)]
+
+
+def sidecar(src):
+ for c in (src + ".json", os.path.splitext(src)[0] + ".json"):
+ if os.path.isfile(c):
+ return json.load(open(c))
+ fail(f"no licence sidecar for {src}: write {src}.json as {{\"source\": URL, \"license\": \"CC0\", \"credit\": \"\"}}")
+
+
+def load(src):
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ if not src.lower().endswith((".glb", ".gltf")):
+ fail(f"{src}: give a .glb (convert.py makes one)")
+ bpy.ops.import_scene.gltf(filepath=src)
+
+
+def b(p):
+ # raea (x, y up, z toward the viewer) to Blender (x, y away, z up)
+ return Vector((p[0], -p[2], p[1]))
+
+
+def point(s):
+ v = [float(x) for x in s.split(",")]
+ if len(v) != 3:
+ fail(f"{s}: a point is X,Y,Z")
+ return b(v)
+
+
+def nearest(p, bones):
+ best, d = None, float("inf")
+ for name, h, t in bones:
+ ab = t - h
+ k = max(0.0, min(1.0, (p - h).dot(ab) / max(ab.length_squared, 1e-12)))
+ e = (h + ab * k - p).length
+ if e < d:
+ best, d = name, e
+ return best
+
+
+def main():
+ a = argv()
+ specs = many(a, "--bone")
+ if len(a) < 2 or not specs:
+ fail("usage: rig.py IN.glb OUT.glb --bone NAME=HX,HY,HZ:TX,TY,TZ[:PARENT] ... [--pose CLIP=BONE:RX,RY,RZ/...] [--weights rigid|auto]")
+ src, out = os.path.abspath(a[0]), os.path.abspath(a[1])
+ side = sidecar(src)
+ load(src)
+ if any(o.type == "ARMATURE" for o in bpy.context.scene.objects):
+ fail("it already has a skeleton: pose its own bones (its clips), or strip it in a script of your own first")
+ ms = [o for o in bpy.context.scene.objects if o.type == "MESH"]
+ if not ms:
+ fail(f"{src} holds no mesh")
+ bpy.ops.object.select_all(action="DESELECT")
+ for o in ms:
+ o.select_set(True)
+ bpy.context.view_layer.objects.active = ms[0]
+ bpy.ops.object.parent_clear(type="CLEAR_KEEP_TRANSFORM")
+ if len(ms) > 1:
+ bpy.ops.object.join()
+ body = bpy.context.view_layer.objects.active
+ bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
+ bones = []
+ for s in specs:
+ name, rest = s.split("=", 1)
+ parts = rest.split(":")
+ if len(parts) < 2:
+ fail(f"{s}: a bone is NAME=HX,HY,HZ:TX,TY,TZ[:PARENT]")
+ bones.append((name, point(parts[0]), point(parts[1]), parts[2] if len(parts) > 2 else None))
+ names = [x[0] for x in bones]
+ for _, _, _, p in bones:
+ if p and p not in names:
+ fail(f"parent {p} isn't a bone ({', '.join(names)})")
+ arm = bpy.data.armatures.new("rig")
+ rig = bpy.data.objects.new("rig", arm)
+ bpy.context.scene.collection.objects.link(rig)
+ bpy.context.view_layer.objects.active = rig
+ bpy.ops.object.mode_set(mode="EDIT")
+ for name, h, t, _ in bones:
+ e = arm.edit_bones.new(name)
+ e.head, e.tail = h, t
+ for name, _, _, p in bones:
+ if p:
+ arm.edit_bones[name].parent = arm.edit_bones[p]
+ bpy.ops.object.mode_set(mode="OBJECT")
+ mode = opt(a, "--weights", "rigid")
+ how = mode
+ if mode == "rigid":
+ groups = {n: body.vertex_groups.new(name=n) for n in names}
+ segs = [(n, h, t) for n, h, t, _ in bones]
+ by = {n: [] for n in names}
+ for v in body.data.vertices:
+ by[nearest(v.co, segs)].append(v.index)
+ for n, idx in by.items():
+ groups[n].add(idx, 1.0, "REPLACE")
+ m = body.modifiers.new("rig", "ARMATURE")
+ m.object = rig
+ body.parent = rig
+ counts = {n: len(i) for n, i in by.items()}
+ else:
+ bpy.ops.object.select_all(action="DESELECT")
+ body.select_set(True)
+ rig.select_set(True)
+ bpy.context.view_layer.objects.active = rig
+ bpy.ops.object.parent_set(type="ARMATURE_AUTO")
+ counts = {g.name: sum(1 for v in body.data.vertices if any(x.group == g.index and x.weight > 0.01 for x in v.groups)) for g in body.vertex_groups}
+ if not any(counts.values()):
+ body.parent = None
+ body.modifiers.clear()
+ body.vertex_groups.clear()
+ bpy.ops.object.select_all(action="DESELECT")
+ body.select_set(True)
+ rig.select_set(True)
+ bpy.ops.object.parent_set(type="ARMATURE_ENVELOPE")
+ how = "envelope (heat weighting failed: the mesh is broken; repair.py first)"
+ counts = {}
+ empty = [n for n, c in counts.items() if c == 0]
+ if empty:
+ fail(f"bones with no vertices: {', '.join(empty)}; move them onto the part they should carry")
+ frames = int(opt(a, "--frames", "24"))
+ clips = {"Rest": {}}
+ for s in many(a, "--pose"):
+ clip, rest = s.split("=", 1)
+ turns = {}
+ for t in rest.split("/"):
+ bone, r = t.split(":")
+ if bone not in names:
+ fail(f"pose {clip}: no bone {bone}")
+ turns[bone] = [float(x) for x in r.split(",")]
+ clips[clip] = turns
+ rig.animation_data_create()
+ for pb in rig.pose.bones:
+ pb.rotation_mode = "XYZ"
+ for clip, turns in clips.items():
+ act = bpy.data.actions.new(clip)
+ rig.animation_data.action = act
+ for f, k in ((1, 0.0), (frames, 1.0)):
+ for pb in rig.pose.bones:
+ r = turns.get(pb.name, [0, 0, 0])
+ pb.rotation_euler = Euler([x * 3.14159265 / 180 * k for x in r], "XYZ")
+ pb.keyframe_insert("rotation_euler", frame=f)
+ act.use_fake_user = True
+ tr = rig.animation_data.nla_tracks.new()
+ tr.name = clip
+ tr.strips.new(clip, 1, act)
+ rig.animation_data.action = None
+ bpy.context.scene.frame_end = frames
+ bpy.ops.export_scene.gltf(filepath=out, export_format="GLB", export_yup=True, export_animation_mode="NLA_TRACKS", export_skins=True)
+ json.dump({**side, "steps": list(side.get("steps", [])) + [{"script": NAME, "from": os.path.basename(src), "bones": names, "weights": how, "clips": list(clips)}]},
+ open(out + ".json", "w"), indent=2)
+ print(f"APPLIED {NAME}: {out}: bones {', '.join(f'{n} ({counts.get(n, '?')} vertices)' for n in names)}; weights {how}; clips {', '.join(clips)} (frame {frames} is the pose)")
+
+
+main()
diff --git a/sdk/guides/craft/bevy/blender/split.py b/sdk/guides/craft/bevy/blender/split.py
new file mode 100644
index 00000000..9f800115
--- /dev/null
+++ b/sdk/guides/craft/bevy/blender/split.py
@@ -0,0 +1,140 @@
+# split.py: one blob cut into named parts, so a part can move on its own (a vise's jaw, a cabinet's door).
+# raea blender run blender/split.py IN.glb OUT.glb NAME=X0,Y0,Z0,X1,Y1,Z1 ... [--rest body] [--each]
+# Each box is in raea's frame (metres, y up, the model's own space, as gen check's box reports it); the faces whose
+# centres fall inside it become the part NAME, and the rest is --rest. OUT holds every part as its own node. --each
+# also writes OUT.NAME.glb per part with its origin at the part's bottom centre, to place and move in TSX
+# (<Model src=".../vise.jaw.glb" position={...}>): raea moves whole files, not a file's nodes.
+# The cut follows the triangles, so a box that misses a part's edge leaves a ragged edge: read the part sizes it prints.
+import bpy, bmesh, sys, os, json
+from mathutils import Vector
+
+NAME = "split.py"
+
+
+def fail(why):
+ print(f"FAILED {NAME}: {why}", file=sys.stderr)
+ sys.exit(1)
+
+
+def argv():
+ return sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+
+
+def opt(a, k, d=None):
+ return a[a.index(k) + 1] if k in a and a.index(k) + 1 < len(a) else d
+
+
+def sidecar(src):
+ for c in (src + ".json", os.path.splitext(src)[0] + ".json"):
+ if os.path.isfile(c):
+ return json.load(open(c))
+ fail(f"no licence sidecar for {src}: write {src}.json as {{\"source\": URL, \"license\": \"CC0\", \"credit\": \"\"}}")
+
+
+def load(src):
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ if not src.lower().endswith((".glb", ".gltf")):
+ fail(f"{src}: give a .glb (convert.py makes one)")
+ bpy.ops.import_scene.gltf(filepath=src)
+
+
+def meshes():
+ return [o for o in bpy.context.scene.objects if o.type == "MESH"]
+
+
+def save(out, side, step, only=None):
+ bpy.ops.object.select_all(action="DESELECT")
+ for o in (only or meshes()):
+ o.select_set(True)
+ bpy.ops.export_scene.gltf(filepath=out, export_format="GLB", export_yup=True, use_selection=True)
+ json.dump({**side, "steps": list(side.get("steps", [])) + [step]}, open(out + ".json", "w"), indent=2)
+
+
+def blender_box(raea):
+ # raea (glTF): x right, y up, z toward the viewer; Blender: x right, y away, z up
+ x0, y0, z0, x1, y1, z1 = raea
+ lo = Vector((min(x0, x1), min(-z0, -z1), min(y0, y1)))
+ hi = Vector((max(x0, x1), max(-z0, -z1), max(y0, y1)))
+ return lo, hi
+
+
+def size_of(o):
+ ws = [o.matrix_world @ v.co for v in o.data.vertices]
+ lo = Vector([min(w[k] for w in ws) for k in range(3)])
+ hi = Vector([max(w[k] for w in ws) for k in range(3)])
+ return lo, hi
+
+
+def main():
+ a = argv()
+ boxes = [x for x in a[2:] if "=" in x and not x.startswith("--")]
+ if len(a) < 3 or not boxes:
+ fail("usage: split.py IN.glb OUT.glb NAME=X0,Y0,Z0,X1,Y1,Z1 ... [--rest body] [--each]")
+ src, out = os.path.abspath(a[0]), os.path.abspath(a[1])
+ side = sidecar(src)
+ load(src)
+ ms = meshes()
+ if not ms:
+ fail(f"{src} holds no mesh")
+ bpy.ops.object.select_all(action="DESELECT")
+ for o in ms:
+ o.select_set(True)
+ bpy.context.view_layer.objects.active = ms[0]
+ # boxes are in the model's world: a fitted model's meshes sit under a parent node (gen check's raea-fixed)
+ bpy.ops.object.parent_clear(type="CLEAR_KEEP_TRANSFORM")
+ if len(ms) > 1:
+ bpy.ops.object.join()
+ body = bpy.context.view_layer.objects.active
+ bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
+ body.name = opt(a, "--rest", "body")
+ parts = []
+ for spec in boxes:
+ name, nums = spec.split("=", 1)
+ v = [float(x) for x in nums.split(",")]
+ if len(v) != 6:
+ fail(f"{spec}: a box is NAME=X0,Y0,Z0,X1,Y1,Z1")
+ lo, hi = blender_box(v)
+ inside = [all(lo[k] <= p.center[k] <= hi[k] for k in range(3)) for p in body.data.polygons]
+ if not any(inside):
+ fail(f"{name}: no faces inside its box; read the model's box with raea gen check and try again")
+ part = body.copy()
+ part.data = body.data.copy()
+ bpy.context.scene.collection.objects.link(part)
+ for o, keep in ((part, True), (body, False)):
+ bm = bmesh.new()
+ bm.from_mesh(o.data)
+ bm.faces.ensure_lookup_table()
+ gone = [f for f in bm.faces if inside[f.index] != keep]
+ bmesh.ops.delete(bm, geom=gone, context="FACES")
+ bmesh.ops.delete(bm, geom=[v for v in bm.verts if not v.link_faces], context="VERTS")
+ bm.to_mesh(o.data)
+ bm.free()
+ part.name = part.data.name = name
+ parts.append(part)
+ if not body.data.polygons:
+ fail("the boxes took every face: nothing is left for the rest")
+ report = {}
+ for o in [body] + parts:
+ lo, hi = size_of(o)
+ report[o.name] = {"triangles": sum(len(p.vertices) - 2 for p in o.data.polygons), "size": [round(hi.x - lo.x, 4), round(hi.z - lo.z, 4), round(hi.y - lo.y, 4)]}
+ save(out, side, {"script": NAME, "from": os.path.basename(src), "parts": report})
+ print(f"APPLIED {NAME}: {out}: " + ", ".join(f"{k} {v['triangles']} triangles {v['size']} m (w h d)" for k, v in report.items()))
+ if "--each" in a:
+ for o in [body] + parts:
+ lo, hi = size_of(o)
+ pivot = Vector(((lo.x + hi.x) / 2, (lo.y + hi.y) / 2, lo.z))
+ bpy.context.scene.cursor.location = pivot
+ bpy.ops.object.select_all(action="DESELECT")
+ o.select_set(True)
+ bpy.context.view_layer.objects.active = o
+ bpy.ops.object.origin_set(type="ORIGIN_CURSOR")
+ at = o.location.copy()
+ o.location = (0, 0, 0)
+ each = out[:-4] + f".{o.name}.glb"
+ # where the part sat in the model, in raea's frame: place it there to put the model back together
+ save(each, side, {"script": NAME, "from": os.path.basename(src), "part": o.name, "at": [round(at.x, 4), round(at.z, 4), round(-at.y, 4)]}, only=[o])
+ print(f"APPLIED {NAME}: {each} (origin at its bottom centre; it sat at {[round(at.x, 4), round(at.z, 4), round(-at.y, 4)]} in the model)")
+ o.location = at
+
+
+main()
diff --git a/sdk/guides/craft/bevy/limits.md b/sdk/guides/craft/bevy/limits.md
index 958e049d..5bb28695 100644
--- a/sdk/guides/craft/bevy/limits.md
+++ b/sdk/guides/craft/bevy/limits.md
@@ -2,8 +2,10 @@
## Budgets
-- **Meshes:** each mesh draws on its own (no batching), so a few hundred animated meshes are fine and thousands are
- not. For crowds, particles or debris, keep the count under about 300 and fake the rest with an ImagePlane or fog.
+- **Meshes:** a `<Mesh3d>` or `<Model>` is one entity, so a few hundred animated ones are fine and thousands are not.
+ Many copies of one thing are an `<Instances at={scatter({...})}>` (one glTF or one mesh at many placements, drawn
+ by the GPU as instances: a forest, a suburb's houses, 40k grass clumps), and a lawn is `<Grass>` (`bevy/meshes`).
+ Instanced copies share one surface, can't play a clip and are fixed for the shot (move the whole set).
- **Distinct shapes** are built once each; reusing the same geometry and args is cheap, a new solid per part is not.
Build Manifold solids at module level.
- **Shadows:** a directional light's are cheap. A shadow-casting PointLight renders six maps, a SpotLight one; keep
diff --git a/sdk/guides/craft/bevy/materials.md b/sdk/guides/craft/bevy/materials.md
index ba17bd26..59b09540 100644
--- a/sdk/guides/craft/bevy/materials.md
+++ b/sdk/guides/craft/bevy/materials.md
@@ -142,6 +142,33 @@ registerRoot(() => <Composition id="toon" component={Toon} width={1280} height={
- Graph paper for a greybox (`GridExtension`) and the paint look's breakup (`PaintExtension`) go in `extension` the
same way; two extensions nest, an ExtendedMaterial as the base of another.
+## Procedural surfaces: wood, stone, brick, tiles and use over them
+
+- `<ExtendedMaterial base={<StandardMaterial />} extension={<ProceduralExtension pattern="brick" dirt={0.3} />} />`
+ draws the surface on the GPU in place of a flat colour. The patterns are `noise`, `wood`, `marble`, `stone`
+ (concrete too), `brick`, `tiles`, `fabric`, `brushed` (metal) and `plaster`. Each has its own colours, roughness and
+ scale by default, so `pattern` alone already looks like the thing.
+- Tune it with these fields:
+ - `colors` (two colours) and `rough_a`/`rough_b`, one per colour.
+ - `scale`, how many metres one feature spans: a wood ring band, a marble vein, a stone mottle.
+ - `bump`, the surface's relief (0.5; 0 for flat).
+ - `seed`, so that two copies don't match.
+ - For brick and tiles: `tile` [width, height] in metres (brick 0.215 x 0.065, tiles 0.3 x 0.3), `gap` (the joint's
+ width, 0.01 m) and `gap_color`.
+- Use goes on top, each 0-1, and is 0 by default:
+ - `dust` settles on what faces up.
+ - `dirt` collects in joints, hollows, undersides and along the floor line.
+ - `edges` wears corners lighter and smoother.
+
+ Give every surface in a scene the same three at different strengths. That one shared recipe is what makes a room
+ read as lived in.
+- The pattern overrides the base's colour and roughness; the base's lighting, shadows and transparency stay. Like
+ wear, it is fixed in the part's own space, so it moves with the part. Brick, tiles, fabric and brushed metal lie on
+ each face's dominant plane, so a box's sides each get a straight course.
+- It goes in `extension` alone, with no WearExtension or GridExtension. On raea/3d's MeshStandardMaterial, the same
+ thing is the `procedural` prop, with camelCase fields (`roughA`, `gapColor`, ...).
+- `raea render --clay` and the clay half of `--review` draw it plain grey, the same as every other surface.
+
## Re-covering a model's materials
- `<Model src={CHAIR}><StandardMaterial material="Fabric" base_color="#7a3b2e" /></Model>` changes one glTF material
diff --git a/sdk/guides/craft/bevy/meshes.md b/sdk/guides/craft/bevy/meshes.md
index 890ead97..bd430286 100644
--- a/sdk/guides/craft/bevy/meshes.md
+++ b/sdk/guides/craft/bevy/meshes.md
@@ -24,6 +24,45 @@
level, never per frame, and move the Mesh3d instead.
- Give a Mesh3d a `name` when it comes and goes, or swaps places with another of the same shape.
+## Many copies: `<Instances>`, `scatter()` and `<Grass>` (`raea/3d`)
+
+- `<Instances src={staticFile("tree.glb")} at={placements} />` draws one glTF at every placement, loaded once and drawn
+ by the GPU as instances; without `src`, a geometry child (or `shape={solid}`) and a material child draw a mesh at
+ every placement. Each placement is `{ position, rotation?, scale? }` (radians). The list is the first frame's for the
+ whole shot: move, turn, scale or hide the set with the Instances' own props. Copies share one surface and play no
+ clip. `shadow={false}` for grass and flowers by the thousand.
+- `scatter({ area: { min: [x0, z0], max: [x1, z1] }, count, spacing, avoid, margin, clearOf, seed, yaw, tilt, scale,
+ y, density })` makes the placements: seeded (the same every frame, render and play), at least `spacing` apart, off
+ the `avoid` boxes, on the ground height `y(x, z)`, kept where `density(x, z)` says. Call it once at module level.
+- `<Grass area height density patch size tints>` is a lawn or a meadow the engine grows itself from functions of the
+ ground, cut into tiles with detail by distance; under `<Look mode="paint" wind>` the wind bends it.
+
+## Organic shapes and growth: `sdf` and `grow` (`raea/3d`)
+
+- **Blended bodies.** A creature, a limb, a handle grown out of a body, or a melted form is a distance field. Build
+ it from `sdf.sphere`, `box`, `capsule(a, b, r)`, `cone(a, b, ra, rb)`, `tube([[x, y, z, r], ...])`, `ellipsoid`,
+ `torus` and `cylinder` (y up, metres).
+ - Join the parts with `sdf.smoothUnion(k, ...)`. Within `k` metres of each join it blends them into one surface,
+ which is what makes the parts read as one thing.
+ - Carve with `smoothSubtract(k, a, b)`, for example an eye socket.
+ - Modify with `.move`, `.rotate` (degrees), `.scale`, `.mirrorX()` (both sides from one), `.round(r)`,
+ `.shell(t)` and `.displace(amp, freq, octaves, seed)` (bark, rock, lumpy skin).
+ - `.solid(step)` meshes the field into a Solid. The default cell is a 96th of its size; pass about a third of the
+ thinnest part. Cut, union and measure it like any solid.
+- **Grown things.** These are seeded, so the same settings give the same shape on every frame:
+ - `grow.tree({ height, crown: "dome"|"sphere"|"cone"|"column"|"umbrella"|"vase", points, leaves, seed }, "wood"|"leaves")`
+ grows branches into the crown's shape by space colonization, thinned from trunk to twig. Draw the wood and the
+ leaves as two meshes with two materials. With `points` 600-2000 a tree is 20k-120k triangles: put a forest in
+ `<Instances>`.
+ - `grow.loft([[0, "circle 0.2"], [0.3, "circle 0.3"], [0.6, "rect 0.1 0.1"]])` skins outlines at heights into a
+ vase, a bottle, a lamp base or a column. An outline is `circle r`, `ellipse rx rz`, `rect w d`, `ngon n r`, or
+ `[x, z]` points.
+ - `grow.terrain({ size, height, freq, seed, flat })` is ground as a closed slab. `flat` clears a disc in the middle
+ to stand things on, and the slab can be cut with `minus` for a path or a pond.
+ - `grow.boulder({ size, squash, rough, seed })` is a rock resting on y 0.
+ - `grow.rosette({ leaves, length, tilt, rise })` is a succulent, an agave, a lettuce or a flower's petals, set at
+ the golden angle and blended from one heart.
+
## Text in the 3D world, animated glyph by glyph (`RichText`)
`<RichText>` is flat lettering standing in the scene: every glyph its own lit, shaded entity (it takes the lights,
diff --git a/sdk/guides/craft/bevy/prompts.md b/sdk/guides/craft/bevy/prompts.md
new file mode 100644
index 00000000..5a5a50af
--- /dev/null
+++ b/sdk/guides/craft/bevy/prompts.md
@@ -0,0 +1,235 @@
+# Scene prompts: the brief, the builder and the judge
+
+There are three texts to copy and fill: a brief template, a builder prompt and a judge prompt for a fresh context.
+`bevy/scenes` says why each step exists. This page gives the words.
+
+Who plays which role:
+- **In Claude Code:** the session is the builder. The judge is a new subagent every round, plus `raea judge` (clef-omni)
+ for the numbers.
+- **In the raea app's feed:** Kimi is the builder and `raea judge` is the judge.
+
+Either way, the judge sees only pictures and the brief's words, never the code or the builder's notes. Code decides
+the pass, and the builder never sees the pass line. A figure the builder can read becomes a target to game.
+
+Where these texts come from: the published Blender + Claude workflows.
+- dream-loop: the target is a real in-engine screenshot; a per-category rubric; defects named precisely.
+- Muska and KOBATAKA: plan before code; route each object.
+- ProfRino and AnyScene: placement is measured; pass is decided in code.
+- hayashimon: coarse to fine; one shared wear recipe.
+- kiln and prasenx: fixed clay and colour cameras; a fresh judge each round; stop after two clean reads.
+
+## What to do
+
+1. Write the brief from the template (section 1). Write a `plan.ts` for every hero object.
+2. Start the builder with the builder prompt (section 2), filled from the brief.
+3. After every stage and every fix, run step R: the review sheets, then the judge prompt (section 3) in a new context
+ and `raea judge` on the same sheets.
+
+## 1. The brief template
+
+The brief is data, in three files:
+- `brief.ts` for the scene, made with `brief()` from `raea/brief`.
+- A `plan.ts` for each hero object, made with `plan()`.
+- For an interior, the room plan that `checkLayout` reads (`raea/room`).
+
+Fields that have no schema yet go in `sections` as text.
+
+```ts
+// brief.ts: one place, one time, one look. Fill the brackets; delete nothing.
+import { brief } from "raea/brief";
+export default brief({
+ title: "[PLACE, TIME] e.g. Late-night laundromat, heavy rain",
+ logline: "[one sentence: what the viewer sees and feels]",
+ look: "[3-5 mood words] + [the real thing it must look like: 'film stills of a 1990s Tokyo laundromat', not 'a game']",
+ references: [
+ // the TARGET: a real in-engine screenshot of this scene from the hero camera
+ { /* media/ref/target.png, role: target */ },
+ // real photos, for the judge only; they never ship
+ { /* media/ref/real-*.jpg, role: judge-only */ },
+ ],
+ notDoing: [
+ // the do-not-add list: without it the builder adds rain, neon and UI
+ "[weather you don't want]", "[time of day you don't want]", "people", "UI, captions, logos", "real brand names",
+ ],
+ sections: [
+ { heading: "Space", text: "[room size in metres; door at z=0, deep along -z; real places are small: 3.5 x 6 m]" },
+ { heading: "Zones", text: "[3-6 zones: counter, bench, washers, back shelves ...]" },
+ { heading: "Hero camera", text: "[position, target, lens mm, height: the scene's Camera3d, the review sheet's hero tile]" },
+ { heading: "Practicals", text: "[every real light source: fixture, colour temperature K, what it lights]" },
+ { heading: "Objects", text: "[one row per object: id | what | real size m | route (bevy/scenes) | seen from m]" },
+ { heading: "Placement", text: "[the relations: desk against -z, chair facing desk, lamp on desk (place())]" },
+ { heading: "Wear", text: "[one recipe for every surface: dust on tops, dirt in gaps and at the floor line, worn edges]" },
+ { heading: "Printed matter", text: "[every sign, label and screen: exact text, fictional names, size, age]" },
+ { heading: "Motion", text: "[added last, small: one dryer turning, irregular flicker, a slow push-in]" },
+ { heading: "Budget", text: "[gen cents cap; judge rounds cap (8)]" },
+ ],
+});
+```
+
+Each generated object needs a reference picture made from this template:
+
+> Studio product photograph of a single real object, photorealistic, true colours, [condition], soft even diffused
+> light, plain pale grey seamless background, the whole object in frame with margin, three-quarter view from slightly
+> above, sharp focus, no people, no text, no brand names, no logos.
+
+Each hero object gets a plan. Its fields are the frozen contract that `raea solid info --expect` and the judge check
+against:
+
+```ts
+import { plan } from "raea/brief";
+export default plan({
+ concept: { what: "coin-op tumble dryer, stacked pair", style: "worn 1990s commercial", size: 1.9, seenFrom: 1.2,
+ material: "enamelled steel" },
+ parts: {
+ cabinet: { role: "body", level: "primary" },
+ door: { role: "door", level: "primary", parent: "cabinet", count: 2, near: "chrome ring, glass with smudges" },
+ panel: { role: "controls", level: "secondary", parent: "cabinet", near: "coin slot, price label, two buttons" },
+ vents: { role: "vent", level: "tertiary", parent: "cabinet", count: { min: 8, max: 20 } },
+ },
+});
+// connection map, one line a joint: door <-> cabinet hinge side touches (overlap >= 5 mm)
+```
+
+## 2. The builder prompt
+
+Paste it as it is, with the brackets filled from the brief.
+
+```text
+You build one 3D scene in raea, the TSX/Bevy engine, from brief.ts, its plans and its reference pictures. The scene
+lives in EDIT.tsx and is frame-pure. Read the raea-bevy skill's scenes.md, meshes.md and materials.md first.
+
+THE BAR
+The target picture media/ref/target.png is a real in-engine screenshot of this scene from the hero camera. The
+finished scene must read as the same place, the same objects and the same light. From views the target doesn't show,
+invent in the same world. brief.ts notDoing is a hard list: add nothing on it, and nothing the brief doesn't name.
+
+ORDER OF WORK (one stage at a time; a stage that fails its check is fixed before the next one starts)
+0. Plan. Every object row in brief.ts has a route, a real size and, for each hero, a plan.ts with its part tree and
+ connection map. If any is missing, write it first, from how the real thing is built: look up the real product.
+1. Space. Block the room as boxes at real size. Place furniture with place() from raea/3d (on, against, beside,
+ near, apart, facing, align, clear), never typed coordinates; its `found` must be empty. Check: `raea run checks.ts`
+ with checkLayout(plan) prints no errors. Then step R in clay.
+2. Generate in bulk, early. One flow for every generated row: a reference picture from the scan template, then the
+ mesh (tripo:H3.1 for close heroes, tripo:P2 for far, edited or rigged ones). Quote it with
+ `raea gen plan props.flow.ts`, run it in the background with `raea gen run props.flow.ts -o media/gen`, and run
+ `raea gen check` on each mesh it makes (scale against the row's size, `--seen` its distance, `--parts` the parts
+ that move, `--rig` if it bends). Look at every reference picture before its mesh runs: no real brands, the whole
+ object, one object.
+ When a check names a Blender script (`fix: raea blender run blender/X.py ...`), run exactly that, headless, from
+ the project's blender/ folder, and `raea gen check` the output. Blender only converts, decimates, repairs, splits,
+ bakes, rigs or drapes one asset. Never place, light, frame, material or time anything in it.
+3. Objects, big to small: furniture, heroes, mid-size, clutter. Build each as a blockout at its planned bounds, then
+ through its levels: silhouette, structure, detail. Organic shapes go in sdf (smoothUnion); trees, lofts, terrain,
+ rocks and plants come from grow. Build ONE of a repeated thing, check it, then pattern it. After each object:
+ - `raea solid info PART.ts --expect PART.expect.json` passes, and each connection-map joint shows "touching" or
+ "overlap".
+ - `raea solid view PART.ts -o review/PART` shows the part in colour and clay from the fixed cameras, each piece in
+ its own colour. Look at it after every structural change: numbers miss a handle lying flat.
+ - `raea scene lint EDIT.tsx --json --part <id>` shows nothing floating, sunk or clipping, and no model in a format
+ raea can't load or over its triangle budget. Apply its {y, dy} fixes in code, never by eye, and its Blender
+ fixes as saved scripts.
+ - A solid that needs real UVs, baked AO or a fillet solids can't make: `raea solid export`, then the script
+ `raea solid info` names. Log the gap in review/NOTES.md.
+4. Light, practicals first. Every practical in the brief becomes a light at its real colour temperature; fills come last
+ and weak. Check with `raea scene light EDIT.tsx --part <hero> --json` and read the EXPOSURE line every render
+ prints. No part may be a stop darker than the target shows it. Re-check after every new light.
+5. Surfaces. Nothing is left a flat default colour. Use ProceduralExtension patterns (wood, stone, brick, tiles,
+ fabric, plaster, ...) or real maps, and give every material the same dust, dirt and edges at different strengths.
+ Lay out printed matter as a 2D composition, render it to a PNG, use the PNG as the map, then age it.
+6. Motion, last and small, as the brief's Motion says. Then `raea render EDIT.tsx -o out/scene.mp4` and
+ `raea check out/scene.mp4`.
+
+STEP R: REVIEW (after every stage, and after every fix)
+- `raea render EDIT.tsx --review review/r<n>` writes colour.png and clay.png (hero, front, right, top, iso, low), with
+ the same cameras every round.
+- Open both sheets and look at every tile yourself. Write your own list. "Looks good" is not a review. Name each
+ problem precisely ("the dryer doors are flat grey discs", not "the dryers look off"), with its tile and its fix.
+- Run `raea judge review/r<n> --by kimi` (or `--by claude`; plain `raea judge` is clef-omni, cheap but advice only
+ until calibrated). Each is a new session that sees only the sheets. In Claude Code you can also hand the sheets to a
+ NEW subagent with the judge prompt. Give it only the
+ brief's words, the target, the real photos, this round's sheets, and last round's sheets and verdict. Never give it
+ your code, your log or your list.
+- Fix every blocking defect named, or write in review/log.md why it is wrong and what you checked. A judge can be
+ wrong: a shadow read as a hole. Change one material per round. Every fix is code in the scene.
+- Re-run the stage's checks after every fix. A fix that breaks a check is not done.
+
+STOPPING (the loop decides, not you)
+- Done: `raea judge` prints "done" (two passes in a row), and the last fresh judge named no blocking defect.
+- Stall: the score hasn't risen a full point in 2 rounds, or the same defect is named twice. Stop tweaking and change
+ the approach for that part: another route (solid, sdf, Tripo HD, Tripo Smart Mesh), a rebuilt light plan, a moved
+ camera. A defect that comes back after two fixes is the method's fault, not the dose's.
+- Stalled: the big change didn't move it. Stop and show Shane the latest sheets and the open defects.
+- Cap: 8 judge rounds per scene. At the cap, deliver and list what is still wrong.
+
+RULES
+- One builder at a time on coupled systems (light, exposure, materials). Generation may run in parallel.
+- Never trust a command just because it ran: back every claim with an image or a check's output.
+- A Blender fix counts only once it is a saved script that re-runs from the source; the live MCP is for looking.
+- Never edit the judge prompt, the plans or the review cameras to pass.
+- Quote every paid step first, and never spend past the brief's cap.
+- Keep review/NOTES.md: one line per thing that cost time.
+```
+
+## 3. The judge prompt (a new context every round)
+
+It takes only images and the brief's words, and answers JSON. The pass threshold is not in it.
+
+```text
+You review a 3D scene from images only, as the person who will use it would. You have never seen how it was built
+and you never will. Judge what is in the pixels; do not guess at intentions.
+
+PART 1, BLIND (answer before reading the brief below):
+hero-colour.png is one frame. In one sentence: what place is this, what time, what era? List five objects you can
+name. Is it a photograph or a render, and which three tells decided it?
+
+PART 2, SCORED. The brief: "<brief.ts look + logline + notDoing>". The target picture is TARGET.png. Real photos of
+this kind of place: REAL_*.jpg. This round's sheets: colour.png and clay.png, tiles hero, front, right, top, iso, low.
+The previous round's sheets and verdict, if any: PREV_*.png, PREV.json.
+
+Score each 0-10 (5 = a believable draft; 7 = a production base an artist would accept; 9 = indistinguishable from
+the reference). Halves are allowed.
+- composition: camera, framing, layout, and the position and scale of every major object, against the target and the
+ brief's space.
+- form, judged on CLAY: silhouettes read at a glance; parts have real thickness; nothing blobby, melted or a
+ primitive standing in for a thing; repeated things vary.
+- assembly, judged on CLAY first: nothing floats, sinks, pokes through or rests on the wrong thing; joints touch; the
+ low tile shows the feet.
+- materials: every surface reads as its real material, with wear where use puts it; nothing a flat default colour.
+- light: motivated by the place's own sources; exposure and contrast match the target.
+- detail: close views hold real geometry or texture, not a smooth stand-in; printed matter reads; nothing from the
+ do-not-add list.
+- world: the same place as the target and the real photos; nothing off-era, no real brands, nothing invented
+ beyond the brief.
+
+Then list EVERY defect, most damaging first, each as:
+ {tile, where in the tile, what is wrong, what the real thing would look like, the fix, blocking|detail}
+"Blocking" means someone using this scene would notice it in the views it will be seen in. Name exactly what gives
+the scene away: not "the dryer looks fake" but "the dryer door is a flat disc with no rim or glass depth; a real
+door has a 3 cm chrome ring and domed glass". If a part must be rebuilt another way, say so. If a previous verdict is
+given, stay consistent with it, but don't feel bound to match it or to raise the score; a regression scores lower.
+Where the target and the real photos disagree on physics (scale, light falloff, contact), the real photos win.
+
+Answer only this JSON:
+{"blind": {"place": "", "objects": [], "photo": "yes|no", "tells": []},
+ "scores": {"composition": 0, "form": 0, "assembly": 0, "materials": 0, "light": 0, "detail": 0, "world": 0},
+ "defects": [{"tile": "", "where": "", "wrong": "", "real": "", "fix": "", "level": "blocking|detail"}],
+ "show_as_is": "one line: would you show this to the person as is, and why"}
+```
+
+The loop's rules live in code (`raea judge`), out of the builder's sight:
+- A round passes when there is no blocking defect, the lowest score is at least 6 and the mean is at least 7.
+- The scene is done after two passes in a row.
+- The blind read is reported, not gated, until it is calibrated. Track how often the judge calls our render a photo.
+
+## Why
+
+- A picture first and a do-not-add list keep the builder from inventing a scene nobody asked for.
+- A judge that has seen the code forgives what it knows was meant. One that sees only pixels judges what a viewer will.
+- Numbers and named defects, with the pass decided in code, stop "looks great" from ending a loop early.
+
+## Common mistakes
+
+- Giving the judge the builder's notes, or the pass line. Its scores then drift toward what the builder hoped.
+- Skipping the clay sheet. Materials hide broken form and floating parts; clay shows them.
+- Fixing three things in one round. When the score moves, you can't tell which fix did it.
+- Calling the scene done on the builder's own reading. Done is two judge passes in a row.
diff --git a/sdk/guides/craft/bevy/scenes.md b/sdk/guides/craft/bevy/scenes.md
new file mode 100644
index 00000000..483d6152
--- /dev/null
+++ b/sdk/guides/craft/bevy/scenes.md
@@ -0,0 +1,143 @@
+# Whole scenes: brief, build, review, judge
+
+A believable scene is planned before it is modelled, built big to small with a measured check after every step, and
+reviewed from the same fixed cameras every round by a judge that has never seen the code. This is the loop the people
+who make striking Blender scenes with an agent use (the 11-06 research: dream-loop, AnyScene, kiln, prasenx,
+hayashimon, KOBATAKA), each step on a raea verb.
+
+## What to do
+
+The brief template, the builder prompt and the judge prompt to paste are in `bevy/prompts`.
+
+### 1. The brief: a picture, a size, and what not to add
+
+- `brief.ts` (`brief()` from `raea/brief`) holds one place, one time, one look:
+ - `look`: three to five mood words, plus the real thing it must look like ("film stills of a 1990s Tokyo
+ laundromat", never "a game").
+ - `references`: the target, which is a "real in-engine screenshot" of the scene from hero camera 1
+ (`raea gen image "..." --aspect 16:9 -o media/ref`), and real photos of the kind of place, used for judging only.
+ - `notDoing`: the do-not-add list (weather, time of day, people, UI, real brands). Without it the agent adds rain
+ and neon.
+ - `sections`:
+ - Space: real metres. Real places are small; a shop is 3.5 x 6 m.
+ - Zones.
+ - Hero cameras: position, target, lens.
+ - Practicals: each real light source and its kelvin.
+ - Objects: one row per object, `id | what | real size m | route | faces | seen from m`.
+ - Wear.
+ - Printed matter.
+ - Motion.
+ - Budget: generation cents and judge rounds.
+- Each hero object gets a `plan.ts` (`plan()`) with its concept (what, style, size, seenFrom, material) and parts, each
+ with a role, a level (primary, secondary, tertiary), a parent, a count and `near` detail. Below it, add a connection
+ map with one line per joint: `door <-> cabinet hinge side touches`.
+- Write the plan from how the real thing is built: look up the product, the catalogue or a drawing.
+
+### 2. Route every object: which tool makes which kind of thing
+
+Ask one question of each object: **is it defined by numbers, by a rule, or by its looks?**
+- **Numbers** (sizes, a hole that must fit, a hinge line): Manifold solids, or `raea/room` for the shell.
+- **A rule** (a blend of bodies, a branching, a field of copies): `sdf.*`, `grow.*`, `<Instances>`.
+- **Its looks** (a worn tool, a lamp, food, anything with character): `raea gen` or a CC0 library model.
+
+The TSX is always the scene. Blender is only a workshop an asset passes through on its way into `media/`, when a
+check names a script (`bevy/blender`). It never places, lights, frames, materials or animates the scene.
+
+| the object | made by | then in Blender when |
+|---|---|---|
+| **numbers**: walls, counters, shelves, boxes, frames, pipes, sign boards, anything a hinge must fit | Manifold solids (`manifold.*`, `<Mesh3d shape={solid}>`, `bevy/meshes`) | it needs real UVs or baked AO (`raea solid info` names bake.py when the file's `needs.textured` is set), a cloth falls on it (cloth.py), or a fillet solids can't make: `raea solid export` first, and log the gap |
+| **numbers**: the room shell, runs of cabinets, openings, hung decor | `raea/room` (`bevy/rooms`) | never |
+| **a rule**: a creature, a limb, a handle grown from a body, a melted or poured form | `sdf.*` fields with smooth unions, `.solid()` (`bevy/meshes`, "Organic shapes and growth") | it must bend (rig.py, after `raea solid export`) |
+| **a rule**: too many or too organic to place by hand: trees, terrain, boulders, succulents, a vase's profile | `grow.tree`, `grow.terrain`, `grow.boulder`, `grow.rosette`, `grow.loft` | never |
+| **a rule**: a lawn, a meadow, a field of copies | `<Grass>`, `<Instances>` with `scatter()` (`bevy/meshes`) | never |
+| **looks**, seen close (under about 2 m) or a hero: appliances, tools, electronics, crockery, food | `raea gen` mesh, `tripo:H3.1` (`motion/gen`) | `raea gen check` names a script: over the triangle budget for `--seen` (decimate.py), debris or holes (repair.py), one blob where `--parts` names moving parts (split.py), no skeleton with `--rig` (rig.py) |
+| **looks**, seen far, to be edited or rigged, or numerous | `raea gen` mesh, `tripo:P2` (quads) | the same checks; P2's quads rig better |
+| **looks**: an exact real asset exists under CC0 (Poly Haven, ambientCG) | `<Model>` (`bevy/assets`) | it's FBX, OBJ or .blend (convert.py), or heavier than its distance needs (decimate.py) |
+| far background | a generated picture on an `ImagePlane` | never |
+
+- Every generated row carries its real height, and for boxy things its dims (generators invent depth):
+ `raea gen mesh "..." --h 0.9 --turn 0` measures the model and fits it on the way in (`raea gen check` reports
+ size, facing, pivot, pieces and triangles).
+- A reference picture for each generated prop uses the scan template: *Studio product photograph of a single real
+ object, photorealistic, true colours, [condition], soft even diffused light, plain pale grey seamless background,
+ the whole object in frame with margin, three-quarter view from slightly above, sharp focus, no people, no text, no
+ brand names, no logos.*
+
+### 3. Build, one stage at a time; a stage that fails its check is fixed first
+
+0. **Plan.** Every object row has a route and a real size, and every hero has a `plan.ts`.
+1. **Space.** Block the room as boxes at real size. Place furniture by relations, not typed coordinates:
+ `place({ room, objects, rules })` from raea/3d. Rules are `on`, `against` a wall, `beside`, `near`, `apart`,
+ `facing`, `align` and `clear` (floor kept free in front). It returns each object's `center`, `base` and `yaw`,
+ plus `found` for whatever couldn't hold. Check: `raea run checks.ts` with `checkLayout(plan)` prints no
+ errors. Then review it in clay (step R).
+2. **Generate in bulk, early.** Put every generated row in one flow:
+ - Quote it first with `raea gen plan props.flow.ts`.
+ - Run it in the background with `raea gen run props.flow.ts -o media/gen`.
+ - Look at every reference picture before its mesh runs.
+3. **Objects, big to small.** Go in this order:
+ - Furniture, then heroes, then mid-size things, then clutter. Block each one out at its planned bounds first.
+ - Then work each part through its levels: silhouette, then structure, then detail.
+ - Build ONE of a repeated thing, check it, then pattern it.
+ - After each object, run `raea scene lint EDIT.tsx --json --part ID`. It must show nothing floating, sunk or
+ clipping. Apply its `{y, dy}` fixes in code, never by eye. Each joint in the connection map must touch.
+4. **Light, practicals first.** Give every practical its real kelvin, and add fills last, weak.
+ - Check with `raea scene light EDIT.tsx --part HERO --json`.
+ - Read the EXPOSURE line `raea render` prints for every still. It gives mean luma, the 1st and 99th percentiles,
+ what clips and what crushes, and the stops from mid grey.
+5. **Surfaces.** Give every material one wear recipe, at different strengths: chipped edges, dirt in gaps, dust on
+ tops, grime at the floor line (`ProceduralExtension`'s `dust`, `dirt` and `edges`, or `WearExtension` on paint; see `bevy/materials`). Leave nothing a
+ flat default colour. Lay out printed matter as a 2D composition, render it to a PNG, use the PNG as the map, then
+ age it.
+6. **Motion, last and small.** Then `raea render EDIT.tsx -o out/scene.mp4` and `raea check out/scene.mp4`.
+
+### R. Review after every stage and every fix
+
+- Run `raea render EDIT.tsx --review review/rN`. It renders the same fixed cameras every round, computed from the
+ scene's bounds and written to `review/rN/cameras.json`: hero (the scene's own camera), front, right, top, iso, and
+ low at 0.3 m.
+- Each camera is rendered in colour and in clay (every material light grey, so form and assembly are judged without
+ surfaces).
+- The cameras are stitched into `colour.png` and `clay.png`, with a JSON sidecar of the tiles and their exposure.
+ `--clay` alone renders any frame in clay.
+- Open the sheets and look at every tile yourself. "Looks good" is not a review. Name each problem with its tile and
+ its fix, for example "the dryer doors are flat grey discs".
+- Hand the sheets to the judge (below). Fix every blocking defect it names, or write down why it is wrong and what
+ you checked.
+- Change one thing per material per round. Re-run the stage's checks after every fix.
+
+### The judge
+
+- `raea judge review/rN --brief brief.ts --target media/ref/target.png --json` sends the sheets to clef-omni with a
+ frozen rubric, and only the sheets and the brief's words: never the code or your log.
+- It returns 0-10 scores for composition, form, assembly, materials, light, detail and world, plus every defect as
+ `{tile, where, wrong, real, fix, level}`.
+- Code decides the pass. The thresholds are not in the prompt, and you do not tune toward them.
+- In Claude Code you can also judge with a fresh subagent every round, given only the sheets, the brief and the
+ previous verdict.
+- The judge doesn't gate until it has been calibrated against Shane's eye (`raea judge eye` and
+ `raea judge calibrate`). Until then its scores are advice.
+
+### Stopping
+
+- **Done:** two fresh judges in a row pass the scene.
+- **Stall:** the score hasn't risen a full point in 2 rounds, or the same defect has been named twice. Stop tweaking
+ and change the approach for that part: another route (solid, field, Tripo HD, Tripo Smart Mesh), a rebuilt light
+ plan, or a moved camera. A defect that comes back after two fixes belongs to the method, not the dose.
+- **Stalled:** the big change didn't move it. Show the latest sheet and the open defects.
+- **Cap:** 8 judge rounds a scene, 3 per object system. At the cap, deliver and list what is still wrong.
+
+## Why
+
+- Fixed cameras and a clay pass are what every strong source judges on. Colour hides bad form, and a moving camera
+ hides regressions.
+- A judge that has seen the code grades the intent, not the pixels. A judge that knows the pass line gets gamed.
+- Measured checks (lint, light, exposure, gen check) catch what eyes miss: a 3 cm float, a fridge at 4 m tall, a
+ frame two stops under.
+
+## Common mistakes
+
+- Modelling the hero from primitives when it has character: route it to Tripo HD, or to a field if it is organic.
+- Placing generated models by nudging transforms: fit them on the way in (`--h`, `--turn`), then lint.
+- Several fixes to light and materials at once: they are coupled, so do one a round.
+- Calling a stage done because the command ran: every claim needs an image or a check's output.
diff --git a/sdk/guides/craft/motion/gen.md b/sdk/guides/craft/motion/gen.md
index e2696415..8c7ef164 100644
--- a/sdk/guides/craft/motion/gen.md
+++ b/sdk/guides/craft/motion/gen.md
@@ -45,8 +45,12 @@
- Meshes on Tripo (`npm install -g tripo-cli`, then `TRIPO_API_KEY=tsk_…` in ~/.raea/env or `tripo login`; every user
brings their own key). Feed it a picture rather than words: an image step making a clean product shot (one object,
plain light background, three-quarter view) gives far better geometry than a prompt. Tripo's own settings go in as
- x_<name>: `x_face_limit: 15000` (a raw H3.1 model can be 1.5 million triangles and 40 MB, too heavy for a live
- scene), `x_texture_quality: "detailed"`, `x_pbr: true`, `x_auto_size: true` (real metres). `tripo:H3.1` costs
+ x_<name>, and raea sets the ones that matter when you don't: `face_limit` 30000 on H3.1 (a raw H3.1 model can be
+ 1.5 million triangles and 40 MB; 15000 for a background prop, 60000-150000 for a hero seen close), `orientation:
+ align_image` for a picture (the model faces as the picture does, not Tripo's sideways +X), `auto_size` (real
+ metres), `pbr`, and a seed from the step itself, geometry and texture alike, so a rerun gives the same model (set
+ `seed` for another candidate). `x_texture_quality: "detailed"` costs more and is worth it for a hero. Then
+ `raea gen check MODEL.glb --h 0.9` measures it and writes a fixed copy (`bevy/scenes`). `tripo:H3.1` costs
20-50 credits a model, `tripo:P2` (Tripo's default, clean low topology) 100-130; a credit is 1¢, and `raea gen plan`
quotes it with `tripo make --dry-run`. **Credits are the API wallet's:** buy them at
https://developers.tripo3d.ai/en/billing, not on the tripo3d.ai dashboard, whose credits the key never sees (it
diff --git a/sdk/math/node_modules b/sdk/math/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/math/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/math/src/animate/timelines.ts b/sdk/math/src/animate/timelines.ts
index 4eda5ff3..b376c685 100644
--- a/sdk/math/src/animate/timelines.ts
+++ b/sdk/math/src/animate/timelines.ts
@@ -1,6 +1,6 @@
// Timelines (who moves when, decided once), and the wire: an Animation for the engine.
import { useContext, useRef } from "react";
-import { ClockContext, LocalTimeContext, TimeBaseContext } from "@raea/app/clock";
+import { ClockContext, LocalTimeContext, TimeBaseContext, useClockTick } from "@raea/app/clock";
import type { AnimKey, AnimTrack } from "../animate.gen";
import { Move, MoveLike, move, toMove } from "./all";
@@ -136,6 +136,7 @@ export function useTime(caller: string): Time {
const clock = useContext(ClockContext);
if (!clock) throw new Error(`${caller} was called outside a Clock: render it inside a composition`);
const local = useContext(LocalTimeContext);
+ useClockTick(local ? null : clock);
cur.frame = local ? local.frame : clock.frame;
cur.fps = clock.config.fps;
}
diff --git a/sdk/ml/node_modules b/sdk/ml/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/ml/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/modelling/node_modules b/sdk/modelling/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/modelling/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/physics/node_modules b/sdk/physics/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/physics/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/plugins/node_modules b/sdk/plugins/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/plugins/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/r3f/test/clock-tick.test.tsx b/sdk/r3f/test/clock-tick.test.tsx
new file mode 100644
index 00000000..8c2010fe
--- /dev/null
+++ b/sdk/r3f/test/clock-tick.test.tsx
@@ -0,0 +1,46 @@
+// The Clock's state is one object across frames, its frame moved on in place, so a frame's change doesn't change the
+// context React would look through every part for (docs/control.feature FC1b, many_cubes): what reads the frame
+// subscribes instead. A reader its parent doesn't render again still moves on with the frame; one its parent does
+// render renders once a frame, not twice; and a host stepping frames back to back calls tickClocks in the frame's own
+// update (runtime/bundle entry.rs). Rendered through a reconciler frame by frame, as a bake steps them (R3F's here).
+import { describe, expect, test } from "bun:test";
+import { memo } from "react";
+import { Clock, tickClocks, useCurrentFrame } from "@raea/app/clock";
+import { end, stepTo } from "../src/input/session";
+
+let renders: string[] = [];
+function Reader({ name }: { name: string }) {
+ renders.push(`${name}@${useCurrentFrame()}`);
+ return null;
+}
+// a part whose parent never renders it again: only the clock moves it on
+const Still = memo(function Still() {
+ renders.push("still");
+ return <Reader name="deep" />;
+});
+
+function run(key: string, tick: boolean): string[] {
+ renders = [];
+ stepTo(key, 3, 30, 64, 64, {}, (i) => {
+ if (tick) tickClocks();
+ return (
+ <Clock frame={i} fps={30} width={64} height={64} durationInFrames={100}>
+ <Reader name="top" />
+ <Still />
+ </Clock>
+ );
+ });
+ end(key);
+ return renders;
+}
+
+const FRAMES = ["top@0", "still", "deep@0", "top@1", "deep@1", "top@2", "deep@2", "top@3", "deep@3"];
+
+describe("the Clock's frame readers", () => {
+ test("moved on as its frame commits, the memoized one too, each once a frame", () => {
+ expect(run("tick-commit", false)).toEqual(FRAMES);
+ });
+ test("told in the frame's own update by tickClocks: the same, once each", () => {
+ expect(run("tick-ahead", true)).toEqual(FRAMES);
+ });
+});
diff --git a/sdk/raea/bench/bevy-parity/2d/mesh2d_alpha_mode.tsx b/sdk/raea/bench/bevy-parity/2d/mesh2d_alpha_mode.tsx
new file mode 100644
index 00000000..53492214
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/2d/mesh2d_alpha_mode.tsx
@@ -0,0 +1,40 @@
+// Bevy v0.20.0 examples/2d/mesh2d_alpha_mode.rs in raea's TSX (docs/control.feature FC0a): a Camera2d and six 256 px
+// Rectangles with branding/icon.png as their ColorMaterial texture. On the left, three Opaque ones at x -400, -300 and
+// -200 (z 0, 1, -1) tinted css WHITE, BLUE and GREEN. On the right, one Mask(0.5) in WHITE at x 200 (z 0) and two Blend
+// ones in BLUE and GREEN at alpha 0.7, at x 300 and 400 (z 1, -1). On Bevy's default clear colour, in Bevy's default
+// 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Transform } from "raea/transform";
+import { ColorMaterial, Mesh2d, Rectangle, type AlphaMode2d } from "raea/sprite";
+import { Srgba } from "raea/color";
+
+// bevy_color css WHITE, BLUE and GREEN
+const WHITE = new Srgba(1, 1, 1, 1), BLUE = new Srgba(0, 0, 1, 1), GREEN = new Srgba(0, 0.5019608, 0, 1);
+
+const ICON = staticFile("branding/icon.png");
+const SQUARES: [number, number, Srgba, AlphaMode2d][] = [
+ [-400, 0, WHITE, "Opaque"],
+ [-300, 1, BLUE, "Opaque"],
+ [-200, -1, GREEN, "Opaque"],
+ [200, 0, WHITE, { Mask: 0.5 }],
+ [300, 1, BLUE.with_alpha(0.7), "Blend"],
+ [400, -1, GREEN.with_alpha(0.7), "Blend"],
+];
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ {SQUARES.map(([x, z, color, alpha_mode], i) => (
+ <Mesh2d key={i} transform={Transform.fromXyz(x, 0, z)}>
+ <Rectangle half_size={[128, 128]} />
+ <ColorMaterial color={color} texture={ICON} alpha_mode={alpha_mode} />
+ </Mesh2d>
+ ))}
+ </Canvas3D>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/2d/mesh2d_vertex_color_texture.tsx b/sdk/raea/bench/bevy-parity/2d/mesh2d_vertex_color_texture.tsx
new file mode 100644
index 00000000..908157ed
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/2d/mesh2d_vertex_color_texture.tsx
@@ -0,0 +1,33 @@
+// Bevy v0.20.0 examples/2d/mesh2d_vertex_color_texture.rs in raea's TSX (docs/control.feature FC0a): a Camera2d and
+// two Rectangle::default() quads scaled 128, their vertices coloured linear RED, GREEN, BLUE and WHITE (top right, top
+// left, bottom left, bottom right) by Mesh::ATTRIBUTE_COLOR. The one at x -96 has ColorMaterial::default(); the one at
+// x 96 has branding/banner.png as its texture, which the vertex colours tint. On Bevy's default clear colour, in Bevy's
+// default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Transform } from "raea/transform";
+import { ColorMaterial, Mesh2d, Rectangle } from "raea/sprite";
+import { LinearRgba } from "raea/color";
+
+// LinearRgba::RED, GREEN, BLUE and WHITE, one per corner of the quad
+const COLORS = [new LinearRgba(1, 0, 0, 1), new LinearRgba(0, 1, 0, 1), new LinearRgba(0, 0, 1, 1), new LinearRgba(1, 1, 1, 1)];
+const BANNER = staticFile("branding/banner.png");
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ <Mesh2d transform={Transform.fromXyz(-96, 0, 0).withScale(128)}>
+ <Rectangle vertex_colors={COLORS} />
+ <ColorMaterial />
+ </Mesh2d>
+ <Mesh2d transform={Transform.fromXyz(96, 0, 0).withScale(128)}>
+ <Rectangle vertex_colors={COLORS} />
+ <ColorMaterial texture={BANNER} />
+ </Mesh2d>
+ </Canvas3D>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/2d/rotate_to_cursor.tsx b/sdk/raea/bench/bevy-parity/2d/rotate_to_cursor.tsx
new file mode 100644
index 00000000..a8fc76a6
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/2d/rotate_to_cursor.tsx
@@ -0,0 +1,17 @@
+// Bevy v0.20.0 examples/2d/rotate_to_cursor.rs in raea's TSX (docs/control.feature FC0a): the ship
+// (textures/simplespace/ship_C.png) as a Sprite in the middle, on Bevy's default clear colour, in Bevy's default
+// 1280 x 720 window. It turns to face the cursor, and the harness's window has none, so it stays unturned on both sides.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D, Sprite } from "raea/3d";
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ <Sprite src={staticFile("textures/simplespace/ship_C.png")} x={640} y={360} />
+ </Canvas3D>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/3d_viewport_to_world.tsx b/sdk/raea/bench/bevy-parity/3d/3d_viewport_to_world.tsx
new file mode 100644
index 00000000..803d81a9
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/3d_viewport_to_world.tsx
@@ -0,0 +1,28 @@
+// Bevy v0.20.0 examples/3d/3d_viewport_to_world.rs in raea's TSX (docs/control.feature FC0a): a 20 m plane of
+// srgb(0.3, 0.5, 0.3), a default DirectionalLight from (1, 1, 1) at the origin, and the camera at (15, 5, 15) looking at
+// the origin, in Bevy's default 1280 x 720 window. The cursor's circle gizmo needs a cursor in the window, and the
+// harness's window has none, so neither side draws it.
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Mesh3d, Plane3d } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { DirectionalLight } from "raea/light";
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ <Mesh3d transform={Transform.IDENTITY}>
+ <Plane3d half_size={[10, 10]} />
+ <StandardMaterial base_color="rgb(76.5, 127.5, 76.5)" />
+ </Mesh3d>
+ <DirectionalLight transform={Transform.fromXyz(1, 1, 1).lookingAt([0, 0, 0])} />
+ <Camera3d transform={Transform.fromXyz(15, 5, 15).lookingAt([0, 0, 0])} />
+ </Canvas3D>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx b/sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx
new file mode 100644
index 00000000..98139ad4
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx
@@ -0,0 +1,49 @@
+// Bevy v0.20.0 examples/3d/atmospheric_fog.rs in raea's TSX (docs/control.feature FC0a): the camera at (-1, 0.1, 1)
+// looking at the origin with Bevy's DistanceFog, a <Fog> inside the <Camera3d> (colour srgba(0.35, 0.48, 0.66, 1),
+// directional light colour srgba(1, 0.95, 0.85, 0.5) at exponent 30, FogFalloff::from_visibility_colors(15,
+// srgb(0.35, 0.5, 0.66), srgb(0.8, 0.844, 1))), a shadowed DirectionalLight of srgb(0.98, 0.95, 0.82) from the origin
+// towards (-0.15, -0.05, 0.25) with cascades to 3 m (first 0.3 m), models/terrain/Mountains.gltf, a 2 x 1 x 1 unlit
+// #888888 box scaled 20 around it all drawn both sides and casting no shadow, and the instructions in Bevy's default
+// font at bottom 12, left 12, in Bevy's default 1280 x 720 window. The fog's sun term (bevy_pbr's apply_fog, scaled by
+// the directional shadow) changes no pixel of these frames: a black or alpha-0 sun colour renders the same, so this
+// port checks the falloff and colour, not the sun's glow.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D, Entity, Fog, Model, Shadows } from "raea/3d";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Cuboid, Mesh3d } from "raea/mesh";
+import { FogFalloff, StandardMaterial } from "raea/pbr";
+import { DirectionalLight } from "raea/light";
+import { Srgba } from "raea/color";
+
+const FONT = `@font-face { font-family: "Fira Mono"; src: url("${staticFile("fonts/FiraMono-Medium.ttf")}"); }`;
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <style>{FONT}</style>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ <Camera3d transform={Transform.fromXyz(-1, 0.1, 1).lookingAt([0, 0, 0])}>
+ <Fog
+ color={new Srgba(0.35, 0.48, 0.66, 1)}
+ directional_light_color={new Srgba(1, 0.95, 0.85, 0.5)}
+ directional_light_exponent={30}
+ falloff={FogFalloff.from_visibility_colors(15, new Srgba(0.35, 0.5, 0.66, 1), new Srgba(0.8, 0.844, 1, 1))}
+ />
+ </Camera3d>
+ <Shadows mapSize={2048} distance={3} firstCascade={0.3} cascades={4} overlap={0.2} />
+ <DirectionalLight color="rgb(249.9, 242.25, 209.1)" shadow_maps_enabled transform={Transform.fromXyz(0, 0, 0).lookingAt([-0.15, -0.05, 0.25])} />
+ <Entity transform={Transform.IDENTITY}>
+ <Model src={staticFile("models/terrain/Mountains.gltf")} />
+ </Entity>
+ <Mesh3d transform={Transform.fromScale([20, 20, 20])} castShadow={false}>
+ <Cuboid half_size={[1, 0.5, 0.5]} />
+ <StandardMaterial base_color="#888888" unlit cull_mode={null} />
+ </Mesh3d>
+ </Canvas3D>
+ <div style={{ position: "absolute", bottom: 12, left: 12, fontFamily: "Fira Mono", fontSize: 20, lineHeight: 1.2, color: "#fff", whiteSpace: "pre" }}>{"Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence."}</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/lightmaps.tsx b/sdk/raea/bench/bevy-parity/3d/lightmaps.tsx
new file mode 100644
index 00000000..e810138e
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/lightmaps.tsx
@@ -0,0 +1,31 @@
+// Bevy v0.20.0 examples/3d/lightmaps.rs in raea's TSX (docs/control.feature FC0a), its default arguments (forward,
+// no bicubic): models/CornellBox/CornellBox.glb's scene with no ambient light, and the camera at (-278, 273, 800).
+// add_lightmaps_to_meshes gives each mesh by its GltfMeshName a Lightmap (large_box, small_box and cornell_box, each
+// its lightmaps/CornellBox-*.zstd.ktx2) and sets its material's lightmap_exposure to 250: the box material those two
+// boxes share and the cornell box's three (the Light mesh's own emitter is left as it is). In Bevy's default
+// 1280 x 720 window.
+import { Composition, registerRoot, staticFile } from "raea";
+import { Model } from "raea/3d";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Lightmap, StandardMaterial } from "raea/pbr";
+import { GlobalAmbientLight } from "raea/light";
+
+const BAKED = ["box.Material", "cbox.Material.002", "cbox.red.002", "cbox.green.002"];
+
+function Shot() {
+ return (
+ <>
+ <GlobalAmbientLight brightness={0} />
+ <Model src={staticFile("models/CornellBox/CornellBox.glb")}>
+ <Lightmap mesh="large_box" image={staticFile("lightmaps/CornellBox-Large.zstd.ktx2")} />
+ <Lightmap mesh="small_box" image={staticFile("lightmaps/CornellBox-Small.zstd.ktx2")} />
+ <Lightmap mesh="cornell_box" image={staticFile("lightmaps/CornellBox-Box.zstd.ktx2")} />
+ {BAKED.map((m) => <StandardMaterial key={m} material={m} lightmap_exposure={250} />)}
+ </Model>
+ <Camera3d transform={Transform.fromXyz(-278, 273, 800)} />
+ </>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/mesh_ray_cast.tsx b/sdk/raea/bench/bevy-parity/3d/mesh_ray_cast.tsx
new file mode 100644
index 00000000..4e1f94fb
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/mesh_ray_cast.tsx
@@ -0,0 +1,110 @@
+// Bevy v0.20.0 examples/3d/mesh_ray_cast.rs in raea's TSX (docs/control.feature FC0a): a 1 m box of six inward-facing
+// 1 m planes (css GRAY at alpha 0.01, so Blend), a default DirectionalLight turned from_euler(XYZ, -0.1, 0.2, 0), on
+// black under TonyMcMapface and Bloom::NATURAL, the camera at (1.5, 1.5, 1.5) looking at the origin, and the laser:
+// from a point circling inside the box after 4 s (t = cos((elapsed - 4) * 0.03) * PI), a ray bounced 64 times off the
+// walls MeshRayCast finds (its default culls back faces, so from inside only the wall ahead counts: the nearest plane
+// along each axis it heads for), drawn as a gradient line strip from HDR Color::srgb(30, 0, 0) through each hit at
+// BLACK.mix(RED, 1 + 10 * (1 - i / 64)) (Color::BLACK is linear, so linear red at that strength), a 0.005 m gizmo
+// sphere at twice it at each hit, and a white 0.1 m gizmo sphere at the start. A gizmo sphere is three great circles of
+// 32 segments (bevy_gizmos circles.rs). No cursor in the harness's window, so no green ray from the pointer.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Bloom, Canvas3D, ToneMapping } from "raea/3d";
+import { Quat, Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Srgba, LinearRgba } from "raea/color";
+import { Mesh3d, Plane3d } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { DirectionalLight } from "raea/light";
+import { Gizmo, type GizmoColor } from "raea/gizmos";
+
+type V3 = [number, number, number];
+const f = Math.fround;
+const PI = Math.PI;
+
+/** the six walls: (translation, rotation as Quat::from_scaled_axis) */
+const WALLS: [V3, [number, number, number, number]][] = [
+ [[0, 0.5, 0], Quat.fromRotationX(PI)],
+ [[0, -0.5, 0], Quat.IDENTITY],
+ [[0.5, 0, 0], Quat.fromRotationZ(PI / 2)],
+ [[-0.5, 0, 0], Quat.fromRotationZ(-PI / 2)],
+ [[0, 0, 0.5], Quat.fromRotationX(-PI / 2)],
+ [[0, 0, -0.5], Quat.fromRotationX(PI / 2)],
+];
+
+const norm = (v: V3): V3 => { const l = Math.hypot(...v); return [v[0] / l, v[1] / l, v[2] / l]; };
+
+/** bounce_ray: the strip's points and colours, and each hit for its sphere */
+function laser(origin: V3, dir: V3): { points: V3[]; colours: GizmoColor[]; hits: [V3, number][] } {
+ const points: V3[] = [origin];
+ const colours: GizmoColor[] = [new Srgba(30, 0, 0, 1)];
+ const hits: [V3, number][] = [];
+ let [o, d] = [origin, dir];
+ for (let i = 0; i < 64; i++) {
+ // the wall ahead on each axis faces the ray (the rest are culled back faces); the nearest is the hit
+ let best = Infinity;
+ let axis = -1;
+ for (let k = 0; k < 3; k++) {
+ if (d[k] === 0) continue;
+ const t = ((d[k]! > 0 ? 0.5 : -0.5) - o[k]!) / d[k]!;
+ if (t > 0 && t < best) [best, axis] = [t, k];
+ }
+ if (axis < 0) break;
+ const hit: V3 = [o[0] + d[0] * best, o[1] + d[1] * best, o[2] + d[2] * best];
+ const brightness = 1 + 10 * (1 - i / 64);
+ points.push(hit);
+ colours.push(new LinearRgba(brightness, 0, 0, 1));
+ hits.push([hit, brightness * 2]);
+ // the wall's normal faces inwards, against the ray: reflect it, and start a hair along the new direction
+ const n: V3 = [0, 0, 0];
+ n[axis] = d[axis]! > 0 ? -1 : 1;
+ const dn = d[0] * n[0] + d[1] * n[1] + d[2] * n[2];
+ d = norm([d[0] - 2 * dn * n[0], d[1] - 2 * dn * n[1], d[2] - 2 * dn * n[2]]);
+ o = [hit[0] + d[0] * 1e-6, hit[1] + d[1] * 1e-6, hit[2] + d[2] * 1e-6];
+ }
+ return { points, colours, hits };
+}
+
+/** gizmos.sphere: a great circle about each axis, Quat::from_rotation_arc(Z, axis) turning the XY circle onto it */
+const ARCS: [number, number, number, number][] = [[0, Math.SQRT1_2, 0, Math.SQRT1_2], [-Math.SQRT1_2, 0, 0, Math.SQRT1_2], [0, 0, 0, 1]];
+function sphere(at: V3, r: number): (V3 | null)[] {
+ const out: (V3 | null)[] = [];
+ for (const q of ARCS) {
+ for (let i = 0; i <= 32; i++) {
+ const a = f(f(i * f(2 * PI)) / 32);
+ const p = Quat.mulVec3(q, [Math.sin(a) * r, Math.cos(a) * r, 0]);
+ out.push([at[0] + p[0], at[1] + p[1], at[2] + p[2]]);
+ }
+ out.push(null);
+ }
+ return out;
+}
+
+function Shot() {
+ const elapsed = f(useCurrentFrame() * 16_666_667e-9);
+ const t = f(f(Math.cos(f(Math.max(f(elapsed - 4), 0) * f(0.03)))) * f(PI));
+ const pos: V3 = [f(Math.sin(t)) * 0.5, f(f(Math.cos(f(3 * t))) * 0.5) * 0.5, f(Math.cos(t)) * 0.5];
+ const { points, colours, hits } = laser(pos, norm([-pos[0], -pos[1], -pos[2]]));
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(0, 0, 0)">
+ <Camera3d transform={Transform.fromXyz(1.5, 1.5, 1.5).lookingAt([0, 0, 0])} />
+ <ToneMapping mode="tony" />
+ <Bloom intensity={1} threshold={0} />
+ {WALLS.map(([translation, rotation], i) => (
+ <Mesh3d key={`w${i}`} transform={{ translation, rotation }}>
+ <Plane3d half_size={[0.5, 0.5]} />
+ <StandardMaterial base_color={new Srgba(0.5, 0.5, 0.5, 0.01)} alpha_mode="Blend" />
+ </Mesh3d>
+ ))}
+ <DirectionalLight transform={{ translation: [0, 0, 0], rotation: Quat.fromEuler("XYZ", -0.1, 0.2, 0) }} />
+ <Gizmo strip={sphere(pos, 0.1)} color="#ffffff" />
+ <Gizmo strip={points} color={colours} />
+ {hits.map(([at, k], i) => (
+ <Gizmo key={`h${i}`} strip={sphere(at, 0.005)} color={new LinearRgba(k, 0, 0, 1)} />
+ ))}
+ </Canvas3D>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={901} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/rect_light.tsx b/sdk/raea/bench/bevy-parity/3d/rect_light.tsx
new file mode 100644
index 00000000..990623d6
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/rect_light.tsx
@@ -0,0 +1,67 @@
+// Bevy v0.20.0 examples/3d/rect_light.rs in raea's TSX (docs/control.feature FC0a): a 20 m metallic floor (roughness
+// 0.6), a white 1 m sphere at (0, 1, 0), two RectLights (warm 2 x 1 m at 100 000 lm from (1, 3, 1) looking at (0, 1, 0);
+// cool 1.5 x 4 m at 800 000 lm at (-2, 1.5, -3) turned half about Y), each with its light gizmo (bevy_light's
+// rect_light_gizmo: its rectangle and a 0.6 m arrow along its -Z, in the light's colour), the camera at (-8, 5, 8)
+// looking at (0, 1, 0), and the controls text in Bevy's default font at 18 px, in Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Quat, Transform, type TransformBuilt } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Mesh3d, Plane3d, Sphere } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { RectLight } from "raea/light";
+import { Gizmo } from "raea/gizmos";
+
+type V3 = [number, number, number];
+const add = (a: V3, b: V3): V3 => [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
+const scale = (a: V3, k: number): V3 => [a[0] * k, a[1] * k, a[2] * k];
+const norm = (a: V3): V3 => scale(a, 1 / Math.hypot(...a));
+
+/** glam's Quat::from_rotation_arc(X, to): the shortest turn taking +X onto `to` (both unit) */
+function arcFromX(to: V3): [number, number, number, number] {
+ const dot = to[0];
+ if (dot < -1 + 2e-7) return [0, 1, 0, 0]; // opposite: half a turn about any axis at right angles (glam's any_orthonormal)
+ // cross(X, to) = (0, -to.z, to.y); glam: from_xyzw(c.x, c.y, c.z, 1 + dot).normalize()
+ const q: [number, number, number, number] = [0, -to[2], to[1], 1 + dot];
+ const n = Math.hypot(...q);
+ return q.map((x) => x / n) as [number, number, number, number];
+}
+
+/** bevy_light's rect_light_gizmo: gizmos.rect in the light's plane, then gizmos.arrow 0.6 m along -Z, tip 0.2 */
+function rectGizmo(t: TransformBuilt, width: number, height: number): [V3, V3][] {
+ const at = (x: number, y: number) => add(t.translation, Quat.mulVec3(t.rotation, [x, y, 0]));
+ const [hx, hy] = [width / 2, height / 2];
+ const corners = [at(-hx, hy), at(hx, hy), at(hx, -hy), at(-hx, -hy)];
+ const loop = corners.map((c, i) => [c, corners[(i + 1) % 4]!] as [V3, V3]);
+ const end = add(t.translation, scale(Quat.mulVec3(t.rotation, [0, 0, -1]), 0.6));
+ const arc = arcFromX(norm(add(end, scale(t.translation, -1))));
+ const tips = ([[-1, 1, 0], [-1, 0, 1], [-1, -1, 0], [-1, 0, -1]] as V3[]).map((v) => [end, add(end, Quat.mulVec3(arc, scale(norm(v), 0.2)))] as [V3, V3]);
+ return [...loop, [t.translation, end], ...tips];
+}
+
+const WARM = Transform.fromXyz(1, 3, 1).lookingAt([0, 1, 0]);
+const COOL = Transform.fromXyz(-2, 1.5, -3).withRotation(Quat.fromRotationY(Math.PI));
+const FONT = `@font-face { font-family: "Fira Mono"; src: url("${staticFile("fonts/FiraMono-Medium.ttf")}"); }`;
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <style>{FONT}</style>
+ <Mesh3d>
+ <Plane3d half_size={[10, 10]} />
+ <StandardMaterial base_color="#ffffff" metallic={1} perceptual_roughness={0.6} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(0, 1, 0)}>
+ <Sphere radius={1} />
+ <StandardMaterial base_color="#ffffff" />
+ </Mesh3d>
+ <RectLight color="rgb(255, 77, 51)" intensity={100_000} width={2} height={1} range={20} transform={WARM} />
+ <RectLight color="rgb(128, 179, 255)" intensity={800_000} width={1.5} height={4} range={20} transform={COOL} />
+ <Gizmo lines={rectGizmo(WARM, 2, 1)} color="#ff4d33" />
+ <Gizmo lines={rectGizmo(COOL, 1.5, 4)} color="#80b3ff" />
+ <Camera3d transform={Transform.fromXyz(-8, 5, 8).lookingAt([0, 1, 0])} />
+ <div style={{ position: "absolute", top: 12, left: 12, fontFamily: "Fira Mono", fontSize: 18, lineHeight: 1.2, color: "rgb(230, 230, 230)", whiteSpace: "pre" }}>{"Controls\nArrow Up/Down: Adjust floor roughness\nG: Toggle light gizmos\n\nRoughness: 0.60"}</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx b/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx
new file mode 100644
index 00000000..0e255183
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/rotate_environment_map.tsx
@@ -0,0 +1,50 @@
+// Bevy v0.20.0 examples/3d/rotate_environment_map.rs in raea's TSX (docs/control.feature FC0a): a 1.25 m sphere
+// (Bevy's Sphere::new(1) mesh, tangents generated) in car paint, StandardMaterial of css GOLD, metallic 0.9, roughness
+// 0.1, clearcoat 1 at roughness 0.3 with textures/ScratchedGold-Normal.png as its clearcoat normal map (loaded with
+// is_srgb false), a white PointLight of 100000 lm at the origin, and the camera at (0, 0, 10) with a 27 degree
+// fov, HDR and AcesFitted, carrying Pisa's Skybox at brightness 5000 and its prefiltered EnvironmentMapLight at 2000.
+// rotate_skybox_and_environment_map turns both by Quat::from_rotation_y(0.2 * elapsed) every update. In Bevy's
+// default 1280 x 720 window. Its clearcoat normal map needs raea built with raea-sys-material's multi-layer feature
+// (Bevy's pbr_multi_layer_material_textures, off by default), so bench/bevy-parity/runs.tsv leaves it out until that
+// is the default.
+import { Composition, registerRoot, staticFile, useCurrentFrame } from "raea";
+import { ToneMapping } from "raea/3d";
+import { Transform } from "raea/transform";
+import { Camera3d, Hdr } from "raea/camera";
+import { Mesh3d, Sphere } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { EnvironmentMapLight, PointLight, Skybox } from "raea/light";
+
+const f = Math.fround;
+const PISA = "environment_maps/pisa_specular_rgb9e5_zstd.ktx2";
+
+function Shot() {
+ // elapsed: f updates of 16_666_667 ns (none on the first), as f32; glam's from_rotation_y in f32
+ const t = f(useCurrentFrame() * 16_666_667e-9);
+ const half = f(f(f(0.2) * t) * 0.5);
+ const rotation: [number, number, number, number] = [0, f(Math.sin(half)), 0, f(Math.cos(half))];
+ return (
+ <>
+ <Mesh3d transform={Transform.fromXyz(0, 0, 0).withScale([1.25, 1.25, 1.25])}>
+ <Sphere radius={1} />
+ <StandardMaterial
+ base_color="rgb(255, 215, 0)"
+ metallic={0.9}
+ perceptual_roughness={0.1}
+ clearcoat={1}
+ clearcoat_perceptual_roughness={0.3}
+ clearcoat_normal_texture={staticFile("textures/ScratchedGold-Normal.png")}
+ />
+ </Mesh3d>
+ <PointLight color="#ffffff" intensity={100000} />
+ <Camera3d transform={Transform.fromXyz(0, 0, 10)} projection={{ Perspective: { fov: (27 / 180) * Math.PI } }}>
+ <Hdr />
+ </Camera3d>
+ <ToneMapping mode="aces" />
+ <Skybox image={staticFile(PISA)} brightness={5000} rotation={rotation} />
+ <EnvironmentMapLight diffuse_map={staticFile("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2")} specular_map={staticFile(PISA)} intensity={2000} rotation={rotation} />
+ </>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={121} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx b/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx
new file mode 100644
index 00000000..ff49f10e
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/shadow_caster_receiver.tsx
@@ -0,0 +1,43 @@
+// Bevy v0.20.0 examples/3d/shadow_caster_receiver.rs in raea's TSX (docs/control.feature FC0a): a red sphere that casts
+// and a blue one that doesn't (radius 0.25, 2 m up, x -1 and 1), a lime 20 m plane at (0, 1, -10) that neither casts nor
+// receives, a white rough 20 m floor, a PointLight at (5, 5, 0) at intensity 0 (its range 500, shadows on: the L key's
+// other light) and an OVERCAST_DAY DirectionalLight turned by Quat::from_euler(ZYX, 0, PI/2, -PI/4) with the example's
+// cascades (first far bound 7 m, maximum 25 m), the camera at (-5, 5, 5) looking at (-1, 1, 0), in Bevy's default
+// 1280 x 720 window. The cascades and the shadow map's size go in a <Shadows> at Bevy's own values (raea's sun keeps a
+// film's cascades otherwise).
+import { Composition, registerRoot } from "raea";
+import { Shadows } from "raea/3d";
+import { Quat, Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Mesh3d, Plane3d, Sphere } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { DirectionalLight, PointLight, light_consts } from "raea/light";
+
+function Shot() {
+ return (
+ <>
+ <Shadows mapSize={2048} distance={25} firstCascade={7} cascades={4} overlap={0.2} />
+ <Mesh3d transform={Transform.fromXyz(-1, 2, 0)}>
+ <Sphere radius={0.25} />
+ <StandardMaterial base_color="#ff0000" />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(1, 2, 0)} castShadow={false}>
+ <Sphere radius={0.25} />
+ <StandardMaterial base_color="#0000ff" />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(0, 1, -10)} castShadow={false} receiveShadow={false}>
+ <Plane3d half_size={[10, 10]} />
+ <StandardMaterial base_color="#00ff00" />
+ </Mesh3d>
+ <Mesh3d>
+ <Plane3d half_size={[10, 10]} />
+ <StandardMaterial base_color="#ffffff" perceptual_roughness={1} />
+ </Mesh3d>
+ <PointLight intensity={0} range={500} shadow_maps_enabled transform={Transform.fromXyz(5, 5, 0)} />
+ <DirectionalLight illuminance={light_consts.lux.OVERCAST_DAY} shadow_maps_enabled transform={Transform.fromRotation(Quat.fromEuler("ZYX", 0, Math.PI / 2, -Math.PI / 4))} />
+ <Camera3d transform={Transform.fromXyz(-5, 5, 5).lookingAt([-1, 1, 0])} />
+ </>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/spotlight.tsx b/sdk/raea/bench/bevy-parity/3d/spotlight.tsx
new file mode 100644
index 00000000..1843c43e
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/spotlight.tsx
@@ -0,0 +1,67 @@
+// Bevy v0.20.0 examples/3d/spotlight.rs in raea's TSX (docs/control.feature FC0a): a 100 m white floor, 40 blue 0.5 m
+// cubes placed by the example's ChaCha8Rng (seed 19878367467713, lib/rand.ts), a 4 x 4 grid of shadowed SpotLights at
+// 40 000 lm 2 m up, each swaying and widening every update (light_sway: from_euler(XYZ, -PI/2 + sin(t * 2.01) * 0.5,
+// sin(t * 3) * 0.5, 0), outer (sin(t * 1.2) + 1) * (PI/4 - 0.1), inner 0.8 of it) with its two emissive child spheres
+// (red at the light, maroon 0.1 m along its -Z, which casts no shadow), GlobalAmbientLight at 20, the camera at
+// (-4, 5, 10) looking at the origin, and the instructions in Bevy's default font, in Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile, useCurrentFrame } from "raea";
+import { Quat, Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { LinearRgba } from "raea/color";
+import { Cuboid, Mesh3d, Plane3d, Sphere } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { GlobalAmbientLight, SpotLight } from "raea/light";
+import { ChaCha8Rng } from "../../../../../bench/bevy-parity/lib/rand";
+
+type V3 = [number, number, number];
+const f = Math.fround;
+const rng = ChaCha8Rng.seed_from_u64(19878367467713n);
+const CUBES: V3[] = Array.from({ length: 40 }, () => [rng.random_range(-5, 5), rng.random_range(0, 3), rng.random_range(-5, 5)]);
+const LIGHTS: V3[] = [];
+for (let x = 0; x < 4; x++) for (let z = 0; z < 4; z++) LIGHTS.push([1 + (x - 2), 2, z - 2]);
+
+const FONT = `@font-face { font-family: "Fira Mono"; src: url("${staticFile("fonts/FiraMono-Medium.ttf")}"); }`;
+const INSTRUCTIONS = "Controls\n--------\nHorizontal Movement: WASD\nVertical Movement: Space and Shift\nRotate Camera: Left and Right Arrows";
+
+function Shot() {
+ // elapsed: f updates of 16_666_667 ns (none on the first), as f32; light_sway runs on every update, the first too
+ const t = f(useCurrentFrame() * 16_666_667e-9);
+ const rotation = Quat.fromEuler("XYZ", f(-Math.PI / 2 + f(f(Math.sin(f(f(t * 0.67) * 3))) * 0.5)), f(f(Math.sin(f(t * 3))) * 0.5), 0);
+ const outer = f(f(f(Math.sin(f(t * 1.2))) + 1) * f(Math.PI / 4 - 0.1));
+ const ahead = Quat.mulVec3(rotation, [0, 0, -0.1]);
+ return (
+ <AbsoluteFill>
+ <style>{FONT}</style>
+ <GlobalAmbientLight brightness={20} />
+ <Mesh3d>
+ <Plane3d half_size={[50, 50]} />
+ <StandardMaterial base_color="#ffffff" />
+ </Mesh3d>
+ {CUBES.map((p, i) => (
+ <Mesh3d key={`c${i}`} transform={Transform.fromTranslation(p)}>
+ <Cuboid half_size={[0.25, 0.25, 0.25]} />
+ <StandardMaterial base_color="rgb(124, 144, 255)" />
+ </Mesh3d>
+ ))}
+ {LIGHTS.map((p, i) => (
+ <SpotLight key={`l${i}`} intensity={40_000} shadow_maps_enabled outer_angle={outer} inner_angle={f(outer * 0.8)} transform={{ translation: p, rotation }} />
+ ))}
+ {LIGHTS.map((p, i) => (
+ <Mesh3d key={`r${i}`} transform={{ translation: p, rotation }}>
+ <Sphere radius={0.05} uv={[32, 18]} />
+ <StandardMaterial base_color="#ff0000" emissive={new LinearRgba(1, 0, 0, 0)} />
+ </Mesh3d>
+ ))}
+ {LIGHTS.map((p, i) => (
+ <Mesh3d key={`m${i}`} transform={{ translation: [p[0] + ahead[0], p[1] + ahead[1], p[2] + ahead[2]], rotation }} castShadow={false}>
+ <Sphere radius={0.1} uv={[32, 18]} />
+ <StandardMaterial base_color="#800000" emissive={new LinearRgba(0.369, 0, 0, 0)} />
+ </Mesh3d>
+ ))}
+ <Camera3d transform={Transform.fromXyz(-4, 5, 10).lookingAt([0, 0, 0])} />
+ <div style={{ position: "absolute", top: 12, left: 12, fontFamily: "Fira Mono", fontSize: 20, lineHeight: 1.2, color: "#fff", whiteSpace: "pre" }}>{INSTRUCTIONS}</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={121} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx b/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx
new file mode 100644
index 00000000..8092f100
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/3d/transparency_3d.tsx
@@ -0,0 +1,53 @@
+// Bevy v0.20.0 examples/3d/transparency_3d.rs in raea's TSX (docs/control.feature FC0a): a 6 m green plane; three ico-3
+// spheres of radius 0.5 at z -1.5 (masked at 0.5, masked at 0.1 and unlit, and an opaque red one) and two 1 m cubes at
+// z 0 (blended, as Bevy's From<Color> makes a colour with alpha under 1, and alpha-to-coverage), every material's alpha
+// set to sin(elapsed) / 2 + 0.5 each update (fade_transparency), a shadow-casting PointLight at (4, 8, 4) and the camera at
+// (-2, 3, 5) looking at the origin, in Bevy's default 1280 x 720 window.
+// Open (frame 10 fails, worst tile 25): the AlphaToCoverage cube's samples it leaves uncovered come out near the clear
+// colour in raea (grey ~45, with RAEA_READBACK=rgba too) where Bevy's show the floor (~51), so the cube reads darker.
+import { Composition, registerRoot, useCurrentFrame } from "raea";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Srgba } from "raea/color";
+import { Cuboid, Mesh3d, Plane3d, Sphere } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { PointLight } from "raea/light";
+
+function Shot() {
+ // elapsed: f updates of 16_666_667 ns (none on the first), as f32
+ const t = Math.fround(useCurrentFrame() * 16_666_667e-9);
+ const a = Math.fround(Math.fround(Math.sin(t)) / 2 + 0.5);
+ const c = (r: number, g: number, b: number) => new Srgba(r, g, b, a);
+ return (
+ <>
+ <Mesh3d>
+ <Plane3d half_size={[3, 3]} />
+ <StandardMaterial base_color={c(0.3, 0.5, 0.3)} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(1, 0.5, -1.5)}>
+ <Sphere radius={0.5} ico={3} />
+ <StandardMaterial base_color={c(0.2, 0.7, 0.1)} alpha_mode={{ Mask: 0.5 }} />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(-1, 0.5, -1.5)}>
+ <Sphere radius={0.5} ico={3} />
+ <StandardMaterial base_color={c(0.2, 0.7, 0.1)} alpha_mode={{ Mask: 0.1 }} unlit />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(0, 0.5, 0)}>
+ <Cuboid half_size={[0.5, 0.5, 0.5]} />
+ <StandardMaterial base_color={c(0.5, 0.5, 1)} alpha_mode="Blend" />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(-1.5, 0.5, 0)}>
+ <Cuboid half_size={[0.5, 0.5, 0.5]} />
+ <StandardMaterial base_color={c(0.5, 1, 0.5)} alpha_mode="AlphaToCoverage" />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromXyz(0, 0.5, -1.5)}>
+ <Sphere radius={0.5} ico={3} />
+ <StandardMaterial base_color={c(0.7, 0.2, 0.1)} />
+ </Mesh3d>
+ <PointLight shadow_maps_enabled transform={Transform.fromXyz(4, 8, 4)} />
+ <Camera3d transform={Transform.fromXyz(-2, 3, 5).lookingAt([0, 0, 0])} />
+ </>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={121} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/animation/color_animation.tsx b/sdk/raea/bench/bevy-parity/animation/color_animation.tsx
new file mode 100644
index 00000000..0694c995
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/animation/color_animation.tsx
@@ -0,0 +1,54 @@
+// Bevy v0.20.0 examples/animation/color_animation.rs in raea's TSX (docs/control.feature FC0a): six 75 px sprites at
+// y 275 to -275, sliding across 600 px on t = (sin(elapsed) + 1) / 2 and coloured through white, yellow, red and black:
+// the top three by a cubic Bezier of the four in LinearRgba, Xyza and Oklaba, the bottom three by mixing the two
+// neighbours in Hsla, Srgba and Oklcha, on Bevy's default clear colour, in Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Hsla, LinearRgba, Oklaba, Oklcha, Srgba, Xyza } from "raea/color";
+import { Shape2D } from "raea/sprite";
+
+const f = Math.fround;
+const COLORS = [new LinearRgba(1, 1, 1), new LinearRgba(1, 1, 0), new LinearRgba(1, 0, 0), new LinearRgba(0, 0, 0)];
+
+/** bevy_math's CubicBezier position at t, by its characteristic matrix, on each channel `get` reads */
+function bezier(ch: number[][], t: number): number[] {
+ return ch[0]!.map((_, k) => {
+ const [p0, p1, p2, p3] = ch.map((c) => c[k]!) as [number, number, number, number];
+ const c = [p0, f(-3 * p0 + 3 * p1), f(3 * p0 - 6 * p1 + 3 * p2), f(-p0 + 3 * p1 - 3 * p2 + p3)];
+ return f(f(f(c[0]! + f(c[1]! * t)) + f(c[2]! * f(t * t))) + f(c[3]! * f(f(t * t) * t)));
+ });
+}
+
+/** animate_mixed: the neighbours either side of t over the four, mixed */
+function mixed<T extends { mix(o: T, t: number): T }>(cs: T[], t: number): T {
+ const n = cs.length - 1;
+ const i = Math.min(Math.floor(f(t * n)), n - 1);
+ return cs[i]!.mix(cs[i + 1]!, f(f(t * n) - i));
+}
+
+function Shot() {
+ // elapsed: f updates of 16_666_667 ns (none on the first), as f32
+ const e = f(useCurrentFrame() * 16_666_667e-9);
+ const t = f(f(f(Math.sin(e)) + 1) / 2);
+ const x = 640 + f(600 * f(t - 0.5));
+ const lin = bezier(COLORS.map((c) => [c.red, c.green, c.blue, c.alpha]), t);
+ const xyz = bezier(COLORS.map((c) => Xyza.from(c)).map((c) => [c.x, c.y, c.z, c.alpha]), t);
+ const ok = bezier(COLORS.map((c) => Oklaba.from(c)).map((c) => [c.lightness, c.a, c.b, c.alpha]), t);
+ const rows: [number, Srgba][] = [
+ [275, new LinearRgba(lin[0]!, lin[1]!, lin[2]!, lin[3]).to_srgba()],
+ [175, new Xyza(xyz[0]!, xyz[1]!, xyz[2]!, xyz[3]).to_srgba()],
+ [75, new Oklaba(ok[0]!, ok[1]!, ok[2]!, ok[3]).to_srgba()],
+ [-75, mixed(COLORS.map((c) => Hsla.from(c)), t).to_srgba()],
+ [-175, mixed(COLORS.map((c) => c.to_srgba()), t)],
+ [-275, mixed(COLORS.map((c) => Oklcha.from(c)), t).to_srgba()],
+ ];
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ {rows.map(([y, c]) => <Shape2D key={y} shape="rect" size={[75, 75]} color={c.to_hex().slice(0, 7)} x={x} y={360 - y} />)}
+ </Canvas3D>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={301} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/animation/eased_motion.tsx b/sdk/raea/bench/bevy-parity/animation/eased_motion.tsx
new file mode 100644
index 00000000..9ec65af0
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/animation/eased_motion.tsx
@@ -0,0 +1,45 @@
+// Bevy v0.20.0 examples/animation/eased_motion.rs in raea's TSX (docs/control.feature FC0a): an orange 2 m cube whose
+// AnimationClip (repeating) moves it from (-6, 2, 0) to (6, 2, 0) on CubicInOut over 3 s and back (ping_pong), and
+// turns it a quarter about Y on ElasticInOut over 4 s (held after, the clip sampled clamped), on a 50 m silver plane
+// under a shadow-casting PointLight of 10 000 000 lm and range 100 at (8, 16, 8), the camera at (0, 6, 12) looking at
+// (0, 1.5, 0), in Bevy's default 1280 x 720 window.
+import { Composition, registerRoot, useCurrentFrame } from "raea";
+import { Quat, Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Cuboid, Mesh3d, Plane3d } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { PointLight } from "raea/light";
+
+const f = Math.fround;
+// bevy_curve's easing functions, in f32
+const cubicInOut = (t: number) => (t < 0.5 ? f(4 * t * t * t) : f(1 - f((-2 * t + 2) ** 3) / 2));
+function elasticInOut(t: number): number {
+ const c = f((2 * Math.PI) / 4.5);
+ return t < 0.5 ? f(-f(2 ** f(20 * t - 10)) * f(Math.sin(f(f(t * 20 - 11.125) * c))) / 2) : f(f(2 ** f(-20 * t + 10)) * f(Math.sin(f(f(t * 20 - 11.125) * c))) / 2 + 1);
+}
+
+function Shot() {
+ // the player's seek time: each update's delta of 16_666_667 ns (none on the first), repeating over the clip's 6 s
+ const time = f(f(useCurrentFrame() * 16_666_667e-9) % 6);
+ // translation: [0, 3] there, [3, 6] back (ping_pong of the curve reparametrized onto [0, 3])
+ const u = time <= 3 ? f(time / 3) : f((6 - time) / 3);
+ const x = f(-6 + f(12 * cubicInOut(u)));
+ // rotation: Quat's unbounded interpolation from IDENTITY to a quarter about Y, its domain [0, 4] sampled clamped
+ const turn = f(elasticInOut(f(Math.min(time, 4) / 4)) * f(Math.PI / 2));
+ return (
+ <>
+ <Mesh3d transform={{ translation: [x, 2, 0], rotation: Quat.fromRotationY(turn) }}>
+ <Cuboid half_size={[1, 1, 1]} />
+ <StandardMaterial base_color="#ffa500" />
+ </Mesh3d>
+ <PointLight shadow_maps_enabled intensity={10_000_000} range={100} transform={Transform.fromXyz(8, 16, 8)} />
+ <Mesh3d>
+ <Plane3d half_size={[25, 25]} />
+ <StandardMaterial base_color="#c0c0c0" />
+ </Mesh3d>
+ <Camera3d transform={Transform.fromXyz(0, 6, 12).lookingAt([0, 1.5, 0])} />
+ </>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={301} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/movement/smooth_follow.tsx b/sdk/raea/bench/bevy-parity/movement/smooth_follow.tsx
new file mode 100644
index 00000000..a09a1bfa
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/movement/smooth_follow.tsx
@@ -0,0 +1,39 @@
+// Bevy v0.20.0 examples/movement/smooth_follow.rs in raea's TSX (docs/control.feature FC0a): a 12 m plane of
+// srgb(0.3, 0.15, 0.3) at y = -2.5, a blue 0.3 m sphere walking at 5 m/s to random points in a 4 m box and a red one
+// smooth_nudging after it (bench/bevy-parity/lib/smooth_follow.ts, bevy_math's run bit for bit), a shadowed
+// 15 000 000 lm PointLight at (4, 8, 4), and the camera at (-2, 3, 5) looking at the origin, in Bevy's default
+// 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Mesh3d, Plane3d, Sphere } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { PointLight } from "raea/light";
+import { smoothFollow } from "../../../../../bench/bevy-parity/lib/smooth_follow";
+
+function Shot() {
+ const [target, follow] = smoothFollow(useCurrentFrame());
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ <Mesh3d transform={Transform.fromXyz(0, -2.5, 0)}>
+ <Plane3d half_size={[6, 6]} />
+ <StandardMaterial base_color="rgb(76.5, 38.25, 76.5)" />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromTranslation(target)}>
+ <Sphere radius={0.3} />
+ <StandardMaterial base_color="rgb(76.5, 38.25, 229.5)" />
+ </Mesh3d>
+ <Mesh3d transform={Transform.fromTranslation(follow)}>
+ <Sphere radius={0.3} />
+ <StandardMaterial base_color="rgb(229.5, 76.5, 76.5)" />
+ </Mesh3d>
+ <PointLight intensity={15_000_000} shadow_maps_enabled transform={Transform.fromXyz(4, 8, 4)} />
+ <Camera3d transform={Transform.fromXyz(-2, 3, 5).lookingAt([0, 0, 0])} />
+ </Canvas3D>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={181} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/transforms/align.tsx b/sdk/raea/bench/bevy-parity/transforms/align.tsx
new file mode 100644
index 00000000..d95a6b29
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/transforms/align.tsx
@@ -0,0 +1,89 @@
+// Bevy v0.20.0 examples/transforms/align.rs in raea's TSX (docs/control.feature FC0a): the ship
+// (models/ship/craft_speederD.gltf's scene) at identity (nothing presses T, so it never turns), its axes as gizmo
+// arrows 1.5 m long (red along -Z, srgb(0.65, 0, 0) along +X), the two random target directions the example's
+// ChaCha8Rng draws (seed 19878367467712, bench/bevy-parity/lib/rand.ts's random_dir3) as white and gray arrows from
+// the origin, a 100 m plane of srgb(0.3, 0.5, 0.3) at y = -2, a shadowed default PointLight at (4, 7, -4), the camera at
+// (3, 2.5, 4) looking at the origin, and the instructions in Bevy's default font, in Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D, Entity, Model } from "raea/3d";
+import { Transform } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Mesh3d, Plane3d } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { PointLight } from "raea/light";
+import { Gizmo } from "raea/gizmos";
+import { Srgba } from "raea/color";
+import { ChaCha8Rng } from "../../../../../bench/bevy-parity/lib/rand";
+
+type V3 = [number, number, number];
+const f = Math.fround;
+const add = (a: V3, b: V3): V3 => [f(a[0] + b[0]), f(a[1] + b[1]), f(a[2] + b[2])];
+const scale = (a: V3, k: number): V3 => [f(a[0] * k), f(a[1] * k), f(a[2] * k)];
+const norm = (a: V3): V3 => scale(a, 1 / Math.hypot(...a));
+
+/** glam's Quat::from_rotation_arc(X, to): the shortest turn taking +X onto `to` (both unit) */
+function arcFromX(to: V3): [number, number, number, number] {
+ const dot = to[0];
+ if (dot < -1 + 2e-7) return [0, 1, 0, 0];
+ const q: [number, number, number, number] = [0, -to[2], to[1], 1 + dot];
+ const n = Math.hypot(...q);
+ return q.map((x) => x / n) as [number, number, number, number];
+}
+
+/** rotate v by the unit quaternion q = [x, y, z, w] */
+function rot(q: [number, number, number, number], v: V3): V3 {
+ const [x, y, z, w] = q;
+ const t: V3 = [2 * (y * v[2] - z * v[1]), 2 * (z * v[0] - x * v[2]), 2 * (x * v[1] - y * v[0])];
+ return [v[0] + w * t[0] + (y * t[2] - z * t[1]), v[1] + w * t[1] + (z * t[0] - x * t[2]), v[2] + w * t[2] + (x * t[1] - y * t[0])];
+}
+
+/** bevy_gizmos' arrow(start, end): the line and four tip lines of length / 10 */
+function arrow(start: V3, end: V3): [V3, V3][] {
+ const tip = Math.hypot(end[0] - start[0], end[1] - start[1], end[2] - start[2]) / 10;
+ const arc = arcFromX(norm(add(end, scale(start, -1))));
+ const tips = ([[-1, 1, 0], [-1, 0, 1], [-1, -1, 0], [-1, 0, -1]] as V3[]).map((v) => [end, add(end, rot(arc, scale(norm(v), tip)))] as [V3, V3]);
+ return [[start, end], ...tips];
+}
+
+const rng = ChaCha8Rng.seed_from_u64(19878367467712n);
+const FIRST = rng.random_dir3();
+const SECOND = rng.random_dir3();
+const O: V3 = [0, 0, 0];
+
+const FONT = `@font-face { font-family: "Fira Mono"; src: url("${staticFile("fonts/FiraMono-Medium.ttf")}"); }`;
+const INSTRUCTIONS = [
+ "The bright red axis is the primary alignment axis, and it will always be",
+ "made to coincide with the primary target direction (white) exactly.",
+ "The fainter red axis is the secondary alignment axis, and it is made to",
+ "line up with the secondary target direction (gray) as closely as possible.",
+ "Press 'R' to generate random target directions.",
+ "Press 'T' to align the ship to those directions.",
+ "Click and drag the mouse to rotate the camera.",
+ "Press 'H' to hide/show these instructions.",
+].join("\n");
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <style>{FONT}</style>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)">
+ <Camera3d transform={Transform.fromXyz(3, 2.5, 4).lookingAt([0, 0, 0])} />
+ <Mesh3d transform={Transform.fromXyz(0, -2, 0)}>
+ <Plane3d half_size={[50, 50]} />
+ <StandardMaterial base_color="rgb(76.5, 127.5, 76.5)" />
+ </Mesh3d>
+ <PointLight shadow_maps_enabled transform={Transform.fromXyz(4, 7, -4)} />
+ <Entity transform={Transform.IDENTITY}>
+ <Model src={staticFile("models/ship/craft_speederD.gltf")} />
+ </Entity>
+ <Gizmo lines={arrow(O, [0, 0, -1.5])} color="#ff0000" />
+ <Gizmo lines={arrow(O, [1.5, 0, 0])} color={new Srgba(0.65, 0, 0, 1)} />
+ <Gizmo lines={arrow(O, scale(FIRST, 1.5))} color="#ffffff" />
+ <Gizmo lines={arrow(O, scale(SECOND, 1.5))} color={new Srgba(0.5, 0.5, 0.5, 1)} />
+ </Canvas3D>
+ <div style={{ position: "absolute", top: 12, left: 12, fontFamily: "Fira Mono", fontSize: 20, lineHeight: 1.2, color: "#fff", whiteSpace: "pre" }}>{INSTRUCTIONS}</div>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={31} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/transforms/transform.tsx b/sdk/raea/bench/bevy-parity/transforms/transform.tsx
new file mode 100644
index 00000000..5c72bd5b
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/transforms/transform.tsx
@@ -0,0 +1,64 @@
+// Bevy v0.20.0 examples/transforms/transform.rs in raea's TSX (docs/control.feature FC0a): a white 1 m cube starting at
+// (0, 0, -10) turned a quarter about Y, moving forward at 2 m/s and turning 0.2 x delta of the way towards a looking_at
+// of the yellow sphere (radius 3, ico 32) at the origin each update; the sphere's scale is 1 - 0.05 x the cube's
+// distance from its start (0.1 at least). The camera at (0, 10, 20) looks at the origin, a default DirectionalLight from
+// (3, 3, 3), in Bevy's default 1280 x 720 window.
+import { Composition, registerRoot, useCurrentFrame } from "raea";
+import { Quat, Transform, type TransformValue } from "raea/transform";
+import { Camera3d } from "raea/camera";
+import { Cuboid, Mesh3d, Sphere } from "raea/mesh";
+import { StandardMaterial } from "raea/pbr";
+import { DirectionalLight } from "raea/light";
+
+type V3 = [number, number, number];
+type Q = [number, number, number, number];
+const f = Math.fround;
+const START: V3 = [0, 0, -10];
+
+/** glam's Quat::lerp: towards `b` (flipped to the near side), then normalized */
+function lerp(a: Q, b: Q, s: number): Q {
+ const dot = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
+ const e = dot < 0 ? b.map((x) => -x) : b;
+ const r = a.map((x, i) => f(f(x * f(1 - s)) + f(e[i]! * s))) as Q;
+ const n = Math.hypot(...r);
+ return r.map((x) => f(x / n)) as Q;
+}
+
+/** The cube's Transform and the sphere's scale after the updates up to frame `n` (none moves on the first: delta 0) */
+function at(n: number): { cube: { translation: V3; rotation: Q }; size: number } {
+ let t: V3 = START;
+ let q = Quat.fromRotationY(Math.PI / 2) as Q;
+ for (let k = 1; k <= n; k++) {
+ const dt = f(16_666_667e-9);
+ // move_cube: forward (-Z turned) x 2 x delta
+ const fw = Quat.mulVec3(q, [0, 0, -1]);
+ t = t.map((x, i) => f(x + f(f(fw[i]! * 2) * dt))) as V3;
+ // rotate_cube: towards looking_at(the sphere, the cube's local Y) by 0.2 x delta
+ const up = Quat.mulVec3(q, [0, 1, 0]);
+ const look = Transform.fromTranslation(t).withRotation(q).lookingAt([0, 0, 0], up).rotation as Q;
+ q = lerp(q, look, f(0.2 * dt));
+ }
+ const dist = Math.hypot(t[0] - START[0], t[1] - START[1], t[2] - START[2]);
+ return { cube: { translation: t, rotation: q }, size: Math.max(f(1 - f(0.05 * dist)), 0.1) };
+}
+
+function Shot() {
+ const { cube, size } = at(useCurrentFrame());
+ const sphere: TransformValue = { scale: [size, size, size] };
+ return (
+ <>
+ <Mesh3d transform={sphere}>
+ <Sphere radius={3} ico={32} />
+ <StandardMaterial base_color="#ffff00" />
+ </Mesh3d>
+ <Mesh3d transform={cube}>
+ <Cuboid half_size={[0.5, 0.5, 0.5]} />
+ <StandardMaterial base_color="#ffffff" />
+ </Mesh3d>
+ <Camera3d transform={Transform.fromXyz(0, 10, 20).lookingAt([0, 0, 0])} />
+ <DirectionalLight transform={Transform.fromXyz(3, 3, 3).lookingAt([0, 0, 0])} />
+ </>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={121} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx b/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx
new file mode 100644
index 00000000..ddac725d
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx
@@ -0,0 +1,21 @@
+// Bevy v0.20.0 examples/ui/images/image_node.rs in raea's TSX (docs/control.feature FC0a): a full-window node centring
+// an ImageNode of branding/icon.png, 256 x 256 with a 5 px white border and 10 px of padding (the picture fills what's
+// inside them). Bevy's Camera2d over the default clear colour is the layered <Canvas3D>. In Bevy's default
+// 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { ImageNode, Node, UiRect, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node width={percent(100)} height={percent(100)} align_items="Center" justify_content="Center">
+ <ImageNode image={staticFile("branding/icon.png")} border={UiRect.all(px(5))} padding={UiRect.all(px(10))} width={px(256)} height={px(256)} border_color={new Srgba(1, 1, 1)} />
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx b/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx
new file mode 100644
index 00000000..b2fab0f3
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx
@@ -0,0 +1,34 @@
+// Bevy v0.20.0 examples/ui/images/ui_texture_atlas.rs in raea's TSX (docs/control.feature FC0a): a full-window
+// column, 40 px apart, of a 256 x 256 ImageNode of the first 24 x 24 cell of gabe-idle-run.png's 7 x 1 grid on
+// antique white with an 8 px crimson outline, over "press space to advance frames" with "space" in yellow, 20 px,
+// under ImagePlugin::default_nearest() (pixel art unblurred). Space isn't pressed, so the cell stays the first.
+// Bevy's Camera2d over the default clear colour is the layered <Canvas3D>. In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { ImageNode, ImagePlugin, Node, Text, TextSpan, TextureAtlasLayout, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const ANTIQUE_WHITE = new Srgba(0.98, 0.922, 0.843);
+const CRIMSON = new Srgba(0.863, 0.078, 0.235);
+const YELLOW = new Srgba(1, 1, 0);
+const LAYOUT = TextureAtlasLayout.from_grid([24, 24], 7, 1);
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <ImagePlugin default_sampler="Nearest">
+ <Node width={percent(100)} height={percent(100)} flex_direction="Column" justify_content="Center" align_items="Center" row_gap={px(40)}>
+ <ImageNode image={staticFile("textures/rpg/chars/gabe/gabe-idle-run.png")} texture_atlas={{ layout: LAYOUT, index: 0 }} width={px(256)} height={px(256)} background_color={ANTIQUE_WHITE} outline={{ width: px(8), offset: px(0), color: CRIMSON }} />
+ <Text font_size={20}>
+ {"press "}
+ <TextSpan color={YELLOW} font_size={20}>space</TextSpan>
+ <TextSpan font_size={20}> to advance frames</TextSpan>
+ </Text>
+ </Node>
+ </ImagePlugin>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/layout/fixed_node.tsx b/sdk/raea/bench/bevy-parity/ui/layout/fixed_node.tsx
new file mode 100644
index 00000000..bcda7b4d
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/layout/fixed_node.tsx
@@ -0,0 +1,23 @@
+// Bevy v0.20.0 examples/ui/layout/fixed_node.rs in raea's TSX (docs/control.feature FC0a): a full-window css BLUE node
+// centring its children, and its one child a 100 x 100 css YELLOW FixedNode, laid out as a root (so at the window's
+// top left, not the centre). Its pointer observers (red while hovered) see no pointer here. Bevy's Camera2d over the
+// default clear colour is the layered <Canvas3D>. In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Node, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const BLUE = new Srgba(0, 0, 1), YELLOW = new Srgba(1, 1, 0);
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node width={percent(100)} height={percent(100)} align_items="Center" justify_content="Center" background_color={BLUE}>
+ <Node fixed width={px(100)} height={px(100)} background_color={YELLOW} />
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow.tsx b/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow.tsx
new file mode 100644
index 00000000..55c72d9d
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow.tsx
@@ -0,0 +1,38 @@
+// Bevy v0.20.0 examples/ui/scroll_and_overflow/overflow.rs in raea's TSX (docs/control.feature FC0a): on antique
+// white, four columns 25 px apart, each a grey label box with its Overflow's pretty Debug text over a 100 x 100 grey
+// node (5 px black border, 25 px padding top and left) whose ImageNode of branding/icon.png (at least 100 x 100)
+// overflows it: visible, clipped in x, in y, and both (Bevy clips to the padding box, as CSS's overflow clip does).
+// The hover outline is Color::NONE without a pointer. Bevy's Camera2d over the default clear colour is the layered
+// <Canvas3D>. In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { ImageNode, Node, Overflow, Text, UiRect, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const ANTIQUE_WHITE = new Srgba(0.98, 0.922, 0.843);
+const GRAY = new Srgba(0.5019608, 0.5019608, 0.5019608);
+const OVERFLOWS = [Overflow.visible(), Overflow.clip_x(), Overflow.clip_y(), Overflow.clip()];
+// format!("{overflow:#?}")
+const label = (o: Overflow) => `Overflow {\n x: ${o.x},\n y: ${o.y},\n}`;
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node width={percent(100)} height={percent(100)} align_items="Center" justify_content="Center" background_color={ANTIQUE_WHITE}>
+ {OVERFLOWS.map((o, i) => (
+ <Node key={i} flex_direction="Column" align_items="Center" margin={UiRect.horizontal(px(25))}>
+ <Node padding={UiRect.all(px(10))} margin={UiRect.bottom(px(25))} background_color={new Srgba(0.25, 0.25, 0.25)}>
+ <Text>{label(o)}</Text>
+ </Node>
+ <Node width={px(100)} height={px(100)} padding={UiRect.new(px(25), px(0), px(25), px(0))} border={UiRect.all(px(5))} overflow={o} border_color={new Srgba(0, 0, 0)} background_color={GRAY}>
+ <ImageNode image={staticFile("branding/icon.png")} min_width={px(100)} min_height={px(100)} />
+ </Node>
+ </Node>
+ ))}
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/styling/transparency_ui.tsx b/sdk/raea/bench/bevy-parity/ui/styling/transparency_ui.tsx
new file mode 100644
index 00000000..21a1717e
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/styling/transparency_ui.tsx
@@ -0,0 +1,27 @@
+// Bevy v0.20.0 examples/ui/styling/transparency_ui.rs in raea's TSX (docs/control.feature FC0a): on a black clear, a
+// full-window row spacing two 150 x 65 buttons around (green srgb(0.1, 0.5, 0.1) and purple srgb(0.5, 0.1, 0.5)), each
+// centring "Button N" in fonts/FiraSans-Bold.ttf at 33 px in white at alpha 0.2. In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Node, Text, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const FONT = staticFile("fonts/FiraSans-Bold.ttf");
+const BUTTONS = [new Srgba(0.1, 0.5, 0.1), new Srgba(0.5, 0.1, 0.5)];
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="#000000" />
+ <Node width={percent(100)} height={percent(100)} align_items="Center" justify_content="SpaceAround">
+ {BUTTONS.map((c, i) => (
+ <Node key={i} width={px(150)} height={px(65)} justify_content="Center" align_items="Center" background_color={c}>
+ <Text font={FONT} font_size={{ Px: 33 }} color={new Srgba(1, 1, 1, 0.2)}>{`Button ${i + 1}`}</Text>
+ </Node>
+ ))}
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/text/font_variations.tsx b/sdk/raea/bench/bevy-parity/ui/text/font_variations.tsx
new file mode 100644
index 00000000..12d124e7
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/text/font_variations.tsx
@@ -0,0 +1,26 @@
+// Bevy v0.20.0 examples/ui/text/font_variations.rs in raea's TSX (docs/control.feature FC0a): font_weights' column
+// with each line's weight set on MonaSans' wght axis (FontVariations) instead of its FontWeight: "Font Variations
+// (wght axis)" underlined over a padded column of "wght N" lines, 8 px apart, at 32 px. Bevy's Camera2d over the
+// default clear colour is the layered <Canvas3D>. In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { FontVariationTag, Node, Text, UiRect, px } from "raea/ui";
+
+const FONT = staticFile("fonts/MonaSans-VariableFont.ttf");
+const WEIGHTS = [100, 200, 300, 400, 500, 600, 700, 800, 900];
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node flex_direction="Column" align_self="Center" justify_self="Center" align_items="Center">
+ <Text font={FONT} font_size={{ Px: 32 }} underline>Font Variations (wght axis)</Text>
+ <Node flex_direction="Column" padding={UiRect.all(px(8))} row_gap={px(8)}>
+ {WEIGHTS.map((w) => <Text key={w} font={FONT} font_size={{ Px: 32 }} font_variations={{ [FontVariationTag.WEIGHT]: w }}>{`wght ${w}`}</Text>)}
+ </Node>
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/text/font_weights.tsx b/sdk/raea/bench/bevy-parity/ui/text/font_weights.tsx
new file mode 100644
index 00000000..0f846993
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/text/font_weights.tsx
@@ -0,0 +1,26 @@
+// Bevy v0.20.0 examples/ui/text/font_weights.rs in raea's TSX (docs/control.feature FC0a): a column centred in the
+// window (align_self and justify_self Center in its root's viewport), "Font Weights" underlined over a padded column
+// of "Weight N" lines, 8 px apart, each in fonts/MonaSans-VariableFont.ttf at 32 px and its own FontWeight. Bevy's
+// Camera2d over the default clear colour is the layered <Canvas3D>. In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Node, Text, UiRect, px } from "raea/ui";
+
+const FONT = staticFile("fonts/MonaSans-VariableFont.ttf");
+const WEIGHTS = [100, 134, 200, 300, 400, 500, 600, 700, 800, 900, 950];
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node flex_direction="Column" align_self="Center" justify_self="Center" align_items="Center">
+ <Text font={FONT} font_size={{ Px: 32 }} underline>Font Weights</Text>
+ <Node flex_direction="Column" padding={UiRect.all(px(8))} row_gap={px(8)}>
+ {WEIGHTS.map((w) => <Text key={w} font={FONT} font_size={{ Px: 32 }} weight={w}>{`Weight ${w}`}</Text>)}
+ </Node>
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/text/strikethrough_and_underline.tsx b/sdk/raea/bench/bevy-parity/ui/text/strikethrough_and_underline.tsx
new file mode 100644
index 00000000..24117b2b
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/text/strikethrough_and_underline.tsx
@@ -0,0 +1,47 @@
+// Bevy v0.20.0 examples/ui/text/strikethrough_and_underline.rs in raea's TSX (docs/control.feature FC0a): a struck
+// "struck\nstruck" in FiraSans-Bold at 67 px on black, absolute 5 px from the bottom right, and a full-window column
+// of Texts and TextSpans with Strikethrough, Underline, their colours and TextBackgroundColor (a Text's own lines and
+// background are its string's, not its spans'). Text in Bevy's default font at 20 px unless sized. Bevy's Camera2d over
+// the default clear colour is the layered <Canvas3D>. In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Node, Text, TextSpan, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const BOLD = staticFile("fonts/FiraSans-Bold.ttf");
+// bevy::color::palettes::css (basic) RED, GREEN, YELLOW, NAVY; Color::BLACK and WHITE
+const RED = new Srgba(1, 0, 0);
+const GREEN = new Srgba(0, 0.5019608, 0);
+const YELLOW = new Srgba(1, 1, 0);
+const NAVY = new Srgba(0, 0, 0.5019608);
+const BLACK = new Srgba(0, 0, 0);
+const WHITE = new Srgba(1, 1, 1);
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Text strikethrough font={BOLD} font_size={{ Px: 67 }} justify="Center" position_type="Absolute" bottom={px(5)} right={px(5)} text_background_color={BLACK}>{"struck\nstruck"}</Text>
+ <Node flex_direction="Column" width={percent(100)} height={percent(100)} justify_content="Center" align_items="Center">
+ <Text strikethrough strikethrough_color={RED} text_background_color={GREEN}>{"struck\nstruckstruck\nstruckstuckstruck"}</Text>
+ <Text underline>underline</Text>
+ <Text strikethrough text_background_color={GREEN}>
+ struck
+ <TextSpan underline>underline</TextSpan>
+ <TextSpan strikethrough>struck</TextSpan>
+ </Text>
+ <Text strikethrough font_size={{ Px: 67 }}>struck struck</Text>
+ <Text strikethrough font={BOLD} font_size={{ Px: 67 }} background_color={NAVY}>{"2struck\nstruck"}</Text>
+ <Text>
+ {""}
+ <TextSpan strikethrough font_size={{ Px: 15 }} color={RED} text_background_color={BLACK}>struck</TextSpan>
+ <TextSpan underline underline_color={YELLOW} font_size={{ Px: 30 }} color={RED} text_background_color={GREEN}>{"\nunderline"}</TextSpan>
+ <TextSpan strikethrough font_size={{ Px: 50 }} color={RED} text_background_color={NAVY}>{"\nstruck"}</TextSpan>
+ <TextSpan strikethrough underline font_size={{ Px: 70 }} color={RED} text_background_color={NAVY} strikethrough_color={WHITE} underline_color={WHITE}>underlined and struck</TextSpan>
+ </Text>
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy-parity/ui/text/text_background_colors.tsx b/sdk/raea/bench/bevy-parity/ui/text/text_background_colors.tsx
new file mode 100644
index 00000000..21b39b2c
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/text/text_background_colors.tsx
@@ -0,0 +1,30 @@
+// Bevy v0.20.0 examples/ui/text/text_background_colors.rs in raea's TSX (docs/control.feature FC0a): a full-window
+// node centring a Text with a 5 px dark cyan border and 10 px of padding, justified Center, whose 21 spans spell
+// "Text\nBackground\nColors!" in black at 100 px, each on a TextBackgroundColor from the palette in turn (red, green,
+// blue, yellow, purple). The palette cycles once a second (its first order until then, at frames 5 and 10); the
+// hover observers have no pointer. Bevy's Camera2d over the default clear colour is the layered <Canvas3D>.
+// In Bevy's default 1280 x 720 window.
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+import { Canvas3D } from "raea/3d";
+import { Node, Text, TextSpan, UiRect, percent, px } from "raea/ui";
+import { Srgba } from "raea/color";
+
+// bevy::color::palettes::css RED, GREEN, BLUE, YELLOW, PURPLE and DARK_CYAN
+const PALETTE = [new Srgba(1, 0, 0), new Srgba(0, 0.5019608, 0), new Srgba(0, 0, 1), new Srgba(1, 1, 0), new Srgba(0.5019608, 0, 0.5019608)];
+const DARK_CYAN = new Srgba(0, 0.545, 0.545);
+const MESSAGE = ["T", "e", "x", "t\n", "B", "a", "c", "k", "g", "r", "o", "u", "n", "d\n", "C", "o", "l", "o", "r", "s", "!"];
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Node width={percent(100)} height={percent(100)} justify_content="Center" align_items="Center">
+ <Text border={UiRect.all(px(5))} padding={UiRect.all(px(10))} justify="Center" border_color={DARK_CYAN}>
+ {MESSAGE.map((s, i) => <TextSpan key={i} color={new Srgba(0, 0, 0)} font_size={{ Px: 100 }} text_background_color={PALETTE[i % PALETTE.length]}>{s}</TextSpan>)}
+ </Text>
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);
diff --git a/sdk/raea/bench/bevy/passes/media b/sdk/raea/bench/bevy/passes/media
new file mode 120000
index 00000000..fed2a334
--- /dev/null
+++ b/sdk/raea/bench/bevy/passes/media
@@ -0,0 +1 @@
+../../../../../examples/character/media
\ No newline at end of file
diff --git a/sdk/raea/bench/bevy/ssao/media/museum_of_ethnography_1k.hdr b/sdk/raea/bench/bevy/ssao/media/museum_of_ethnography_1k.hdr
new file mode 120000
index 00000000..919cd601
--- /dev/null
+++ b/sdk/raea/bench/bevy/ssao/media/museum_of_ethnography_1k.hdr
@@ -0,0 +1 @@
+../../environment/media/museum_of_ethnography_1k.hdr
\ No newline at end of file
diff --git a/sdk/raea/bench/character/clips.ts b/sdk/raea/bench/character/clips.ts
deleted file mode 100644
index 5241bd66..00000000
--- a/sdk/raea/bench/character/clips.ts
+++ /dev/null
@@ -1,296 +0,0 @@
-// The motion database's evaluation (docs/clips.feature, "The evaluation"): search methods compared over a body's
-// full database on real queries recorded from perform runs (the grip scenes, a walk-wait-carry-stop), for recall of
-// the exact best, the rank and cost gap of what each picks, time a search, memory, perform's time and the motion's
-// quality with each as perform's search, and semantic retrieval (a step wanting carry, look-around, suitcase, box).
-// bun bench/character/clips.ts [--body kid] [--db FILE] [--methods A,B,C,D,E,F] [--max-queries N] [--json OUT]
-// [--no-perform] [--scenes ball,bigbox,...]
-// A: the JS brute force (nearest()). B: the kernel's exact quantised cost, best 64-frame blocks, reranked (in TS). C: HDC Hamming over the motion's hypervectors, the tags as a bit filter, the best
-// frames reranked. D: HDC with the tags bound into the hypervectors (no tag filter). E: a coarse scan of every 8th
-// frame. F: IVF over k-means clusters.
-import { readFileSync, writeFileSync } from "node:fs";
-import { pose, qinv, qrot, surface, joint } from "raea/character";
-import type { Vec3 } from "../../src/3d";
-import { readDb } from "@raea/character/clips-bun";
-import { interact, thingSdf } from "raea/items";
-import { perform, type PerformanceSpec, type SearchBackend, type SearchQuery, type Step } from "raea/matching";
-import { SCENES, gripRun } from "../../../../examples/character/grip-scenes";
-import { parkour, type Body } from "../../../../examples/character/parkour-levels";
-import { BLOCK, MODE, SCORE_MAX, coarseSearch, exactCost, fullHdc, hdcEncode, HW, FS, ivfSearch, kernelQuery, kernelScore, kernelSearch, queryHdc, recording, rerank, topKFast, dbLibrary, type DbLibrary } from "@raea/character/clips";
-
-const args = process.argv.slice(2), opt = (k: string, d?: string) => { const i = args.indexOf(k); return i >= 0 ? args[i + 1] : d; };
-const body = opt("--body", "kid") as Body, LIB = `${process.env.HOME}/.cache/raea-mocap/lib/${body}`, dbPath = opt("--db", `${LIB}/motion.db`)!;
-const methods = opt("--methods", "A,B,C,D,E,F")!.split(","), maxQ = +(opt("--max-queries", "400")!), jsonOut = opt("--json");
-const sceneNames = opt("--scenes")?.split(","), doPerform = !args.includes("--no-perform");
-const rss = () => +(process.memoryUsage().rss / 1e9).toFixed(2);
-const out: Record<string, unknown> = { body, db: dbPath };
-const log = (...a: unknown[]) => console.log(...a);
-
-// ---------------------------------------------------------------- the library
-const { skel } = parkour(body);
-let t0 = performance.now();
-const mdb = readDb(dbPath);
-const tRead = performance.now() - t0;
-t0 = performance.now();
-const lib = dbLibrary(skel, mdb, { read: (file) => JSON.parse(readFileSync(`${LIB}/${file}`, "utf8")) });
-const tLib = performance.now() - t0;
-out.load = { readMs: Math.round(tRead), libraryMs: Math.round(tLib), frames: lib.size, clips: mdb.header.clips.length, fileMB: +((Object.values(mdb.header.sections).reduce((a, s) => Math.max(a, s.offset + s.bytes), 0)) / 1e6).toFixed(1), rssGB: rss() };
-log(`database: ${mdb.header.clips.length} clips, ${lib.size} frames (mirrored), read ${tRead.toFixed(0)} ms, library ${tLib.toFixed(0)} ms, rss ${rss()} GB`);
-
-// the right captures for a tag
-const RIGHT: Record<string, RegExp> = { carry: /^c(70_|79_25$|111_36$|113_26$|115_|69_69$)/, suitcase: /^c70_/, box: /^c(79_25|115_\d+)$/, "look-around": /^c40_10$/ };
-const lookClips = new Set(mdb.header.clips.filter((c) => /look/i.test(c.label)).map((c) => c.name));
-const rightFrame = (tag: string, k: number) => { const n = lib.clips[lib.frameClip[k]].name; return RIGHT[tag].test(n) || (tag === "look-around" && lookClips.has(n)); };
-
-// ---------------------------------------------------------------- the scenes
-const carryWalk = (len: number): PerformanceSpec => ({
- at: [0, 0, 0], facing: Math.PI / 2,
- steps: [
- { walk: [[0, 0], [3, 0]] }, { wait: 1.5 },
- // a heavy carry: slow, wanting carry frames
- { walk: [[3, 0], [3, len]], speed: 0.55, tags: { want: ["carry"] } }, { wait: 1.5 },
- ] as Step[],
-});
-interface Scene { name: string; spec: PerformanceSpec; grip?: ReturnType<typeof gripRun> }
-const scenes: Scene[] = [];
-for (const sc of SCENES.filter((s) => !sceneNames || sceneNames.includes(s.name))) {
- const r = gripRun(body, sc, lib);
- // a carry of something heavy wants carry frames (items.ts's walks don't say yet)
- const heavy = (r.plan.beats.find((b) => b.kind === "pick")?.how.load ?? 0) > 0.1;
- const spec = heavy ? { ...r.plan.spec, steps: r.plan.spec.steps.map((st) => ("walk" in st && st.speed !== undefined ? { ...st, tags: { want: ["carry"] } } : st)) } : r.plan.spec;
- scenes.push({ name: sc.name + (heavy ? " (carry)" : ""), spec, grip: { ...r, plan: { ...r.plan, spec } } });
-}
-if (!sceneNames || sceneNames.includes("wwcs")) scenes.push({ name: "walk-wait-carry-stop", spec: carryWalk(3) });
-
-// ---------------------------------------------------------------- the motion's quality
-const ranges = new WeakMap<object, Map<string, { start: number }>>();
-const rangeOf = (L: typeof lib | ReturnType<typeof parkour>["lib"]) => { let m = ranges.get(L); if (!m) ranges.set(L, (m = new Map(L.clips.map((r) => [r.name + (r.mirrored ? "~" : ""), r])))); return m; };
-const TAG = (t: string) => lib.db!.tagIndex.get(t)!;
-const hasTag = (k: number, t: string) => { const i = TAG(t); return ((lib.db!.tags[k * 2 + (i >> 5)] >>> (i & 31)) & 1) === 1; };
-const HAND = /^(palm|thumb|index|middle|ring|pinky)/;
-function quality(sc: Scene, perf: ReturnType<typeof perform>, L: { contact: Uint8Array; db?: unknown; clips: { name: string; start: number; mirrored: boolean }[] } = lib) {
- const nr = rangeOf(L as any), frames = perf.played.map((p) => nr.get(p.clip)!.start + p.f), tagged = !!L.db;
- const rest = skel.joints[0].head[1];
- let midMin = Infinity;
- const feet = ["foot_l", "foot_r"].map((n) => joint(skel, n));
- let maxWalkY = -Infinity, walkN = 0, fast = 0, crouchedN = 0, carryN = 0, carryWalkN = 0, standY: number[] = [], minWalkY = Infinity, skateSum = 0, skateMax = 0;
- let prev: Vec3[] | null = null, prevK = -1;
- for (let f = 0; f < perf.frames; f++) {
- const st = perf.step(f), k = frames[f], P = perf.pose(f), y = P.root[1];
- const w = pose(skel, P), fp = feet.map((i) => w.pos[i]);
- if (st?.kind === "walk") {
- walkN++; if (tagged && hasTag(k, "fast")) fast++; if (tagged && hasTag(k, "crouched")) crouchedN++; minWalkY = Math.min(minWalkY, y); maxWalkY = Math.max(maxWalkY, y);
- if (st.since > 0.5 && st.left > 0.5) midMin = Math.min(midMin, y);
- const wantsCarry = "walk" in sc.spec.steps[st.index] && (sc.spec.steps[st.index] as any).tags?.want?.includes("carry");
- if (wantsCarry && tagged) { carryWalkN++; if (rightFrame("carry", k)) carryN++; }
- } else if (st?.kind === "wait" || !st) standY.push(y);
- if (prev && prevK >= 0) for (const s of [0, 1]) if (L.contact[k * 2 + s] && L.contact[prevK * 2 + s]) { const d = Math.hypot(fp[s][0] - prev[s][0], fp[s][2] - prev[s][2]); skateSum += d; skateMax = Math.max(skateMax, d); }
- prev = fp; prevK = k;
- }
- standY.sort((a, b) => a - b);
- const q: Record<string, number | string> = { walkFrames: walkN, fastShare: tagged ? +(fast / (walkN || 1)).toFixed(3) : "-", crouchedShare: tagged ? +(crouchedN / (walkN || 1)).toFixed(3) : "-",
- minWalkHips: +(minWalkY / rest).toFixed(3), dipCm: +(walkN ? (rest - minWalkY) * 100 : 0).toFixed(1), midDipCm: +(midMin < Infinity ? (rest - midMin) * 100 : 0).toFixed(1), maxWalkHips: +(maxWalkY / rest).toFixed(3), skateCm: +(skateSum * 100).toFixed(1), skateMaxCm: +(skateMax * 100).toFixed(2) };
- if (carryWalkN) q.carryShare = +(carryN / carryWalkN).toFixed(3);
- if (sc.grip) {
- const live = interact(skel, perf, sc.grip.plan), sdf = thingSdf(sc.grip.plan.items.it);
- let clips = 0, held = 0, deepest = 0;
- for (let f = 0; f < live.frames; f++) {
- if (!live.held("it", f)) continue;
- held++;
- const t = live.item("it", f), field = (v: Vec3) => sdf(qrot(qinv(t.rot), [v[0] - t.at[0], v[1] - t.at[1], v[2] - t.at[2]]));
- let deep = 0;
- for (const x of surface(skel, pose(skel, live.pose(f)))) deep = Math.max(deep, -field(x.at));
- if (deep > 0.005) clips++;
- deepest = Math.max(deepest, deep);
- }
- q.gripClipFrames = clips; q.gripPass = clips <= 10 ? "PASS" : "FAIL"; q.heldFrames = held;
- }
- return q;
-}
-
-// ---------------------------------------------------------------- A: perform, recording the queries
-const backends: Record<string, () => SearchBackend> = {
- B: () => kernelSearch(16),
- C: () => hdcMotion(4096),
- D: () => hdcBound(4096),
- E: () => coarseSearch(8, 32),
- F: () => ivfSearch(lib, 256, 8),
-};
-const queries: { scene: string; q: SearchQuery }[] = [];
-const perfRows: Record<string, unknown>[] = [];
-for (const sc of scenes) {
- const qs: SearchQuery[] = [];
- lib.search = recording(qs);
- const t = performance.now();
- const perf = perform(lib, sc.spec, { quiet: true });
- const ms = performance.now() - t;
- const q = quality(sc, perf);
- perfRows.push({ method: "A", scene: sc.name, ms: Math.round(ms), searches: qs.length, ...q });
- log(`A ${sc.name}: ${perf.frames} frames, ${qs.length} searches, ${(ms / 1000).toFixed(1)} s; ${JSON.stringify(q)}`);
- for (const x of qs) queries.push({ scene: sc.name, q: x });
-}
-lib.search = undefined;
-out.queries = queries.length;
-// P: the scenes on today's library (parkour.json's 57 clips), for the motion's quality against
-{
- const P = parkour(body).lib;
- for (const sc of scenes) {
- const g = sc.grip && gripRun(body, SCENES.find((s) => sc.name.startsWith(s.name))!);
- const s2: Scene = g ? { ...sc, spec: g.plan.spec, grip: g } : sc;
- const t = performance.now(), perf = perform(P, s2.spec, { quiet: true }), ms = performance.now() - t;
- const q = quality(s2, perf, P);
- perfRows.push({ method: "P parkour.json", scene: sc.name, ms: Math.round(ms), ...q });
- log(`P ${sc.name}: ${(ms / 1000).toFixed(1)} s; ${JSON.stringify(q)}`);
- }
-}
-
-// the queries for the Rust checks and timings (clips check|bench DB FILE): count, npen, nb, expected, then each
-// query's words and pens, then the TS twin's block minima for the first few
-const dumpAt = opt("--dump");
-if (dumpAt) {
- const pick = queries.filter((_, i) => i % Math.max(1, Math.floor(queries.length / 200)) === 0).slice(0, 200).map(({ q }) => q);
- // (a few as Hamming queries too, motion-only and tag-bound, so the checks cover those terms)
- const ks = pick.map((q, i) => (i % 10 === 1 ? kernelQuery(lib, q, MODE.hamming | MODE.motion, { words: queryHdc(q, false), weight: 1 / 16384 }) : i % 10 === 2 ? kernelQuery(lib, q, MODE.exact | MODE.hamming, { words: queryHdc(q, true), weight: 0.5 }) : kernelQuery(lib, q)));
- const nb = Math.ceil(lib.size / BLOCK), ex = Math.min(3, ks.length), npen = ks[0].pen.length;
- const w: number[] = [ks.length, npen, nb, ex];
- for (const k of ks) w.push(...k.words, ...k.pen);
- const all = new Int32Array(w.length + ex * nb);
- all.set(w);
- for (let i = 0; i < ex; i++) { const mins = new Int32Array(nb).fill(SCORE_MAX); for (let k = 0; k < lib.size; k++) { const s = kernelScore(lib, ks[i], k); if (s < mins[(k / BLOCK) | 0]) mins[(k / BLOCK) | 0] = s; } all.set(mins, w.length + i * nb); }
- writeFileSync(dumpAt, new Uint8Array(all.buffer));
- log(`dumped ${ks.length} queries to ${dumpAt}`);
- if (args.includes("--dump-only")) process.exit(0);
-}
-
-// sampled down to at most maxQ, evenly
-const sample = queries.length <= maxQ ? queries : Array.from({ length: maxQ }, (_, i) => queries[Math.floor((i * queries.length) / maxQ)]);
-log(`\n${queries.length} queries recorded; evaluating ${sample.length}`);
-
-// ---------------------------------------------------------------- recall, rank, gap, time
-function hdcMotion(K: number): SearchBackend {
- return { name: `C hdc-motion K=${K}`, candidates: (l, q) => topKFast(hamming(q, false), K) };
-}
-function hdcBound(K: number): SearchBackend {
- return { name: `D hdc-bound K=${K}`, candidates: (l, q) => topKFast(hamming(q, true), K) };
-}
-let Hm: Uint32Array | undefined;
-/** each frame's Hamming score for a query: C over the motion-only vectors with the tags as a filter, D over the
- * tag-bound vectors (the file's) with the wanted tags bound into the query and not filtered */
-function hamming(q: SearchQuery, bound: boolean): Int32Array {
- let H: Uint32Array;
- if (bound) H = fullHdc(lib);
- else { if (!Hm) { Hm = new Uint32Array(lib.size * HW); for (let k = 0; k < lib.size; k++) hdcEncode(lib.full.F, k * FS, 0, 0, Hm, k * HW, false); } H = Hm; }
- const qs = bound && q.tags ? { ...q, tags: { ...q.tags, want: [0, 0] as [number, number] } } : q;
- const mode = MODE.hamming | (bound ? 0 : MODE.motion), hd = { words: queryHdc(q, bound), weight: 1 / (128 * 128) };
- const Q = kernelQuery(lib, qs, mode, hd);
- const sc = new Int32Array(lib.size);
- for (let k = 0; k < lib.size; k++) sc[k] = kernelScore(lib, Q, k, H);
- return sc;
-}
-/** the blocks' least kernel scores (B) */
-function blocks(q: SearchQuery): Int32Array {
- const Q = kernelQuery(lib, q), nb = Math.ceil(lib.size / BLOCK), mins = new Int32Array(nb).fill(SCORE_MAX);
- for (let k = 0; k < lib.size; k++) { const s = kernelScore(lib, Q, k); if (s < mins[(k / BLOCK) | 0]) mins[(k / BLOCK) | 0] = s; }
- return mins;
-}
-const framesOf = (bl: ArrayLike<number>, K: number) => { const o: number[] = []; for (let i = 0; i < Math.min(K, bl.length); i++) for (let k = bl[i] * BLOCK; k < Math.min(lib.size, bl[i] * BLOCK + BLOCK); k++) o.push(k); return o; };
-const rankOf = (sc: Int32Array, k: number) => { if (sc[k] === SCORE_MAX) return Infinity; let r = 0; for (let i = 0; i < sc.length; i++) if (sc[i] < sc[k] || (sc[i] === sc[k] && i < k)) r++; return r; };
-
-interface Row { method: string; K: string; recall: number; gapMean: number; gapMax: number; rankMedian: number | string; ms: number }
-const table: Row[] = [];
-const ref = sample.map(({ q }) => { const t = performance.now(); const r = rerank(lib, q); return { ...r, ms: performance.now() - t }; });
-const refMs = ref.reduce((a, r) => a + r.ms, 0) / ref.length;
-table.push({ method: "A js brute force", K: "all", recall: 1, gapMean: 0, gapMax: 0, rankMedian: 0, ms: +refMs.toFixed(1) });
-log(`A: ${refMs.toFixed(1)} ms a search (warm)`);
-
-function evaluate(method: string, order: (q: SearchQuery) => { cands: (K: number) => ArrayLike<number>; rank: (k: number) => number }, Ks: number[], unit: string) {
- const rec = Ks.map(() => 0), gaps: number[][] = Ks.map(() => []), ranks: number[] = [], times: number[] = [];
- sample.forEach(({ q }, i) => {
- const a = ref[i];
- if (a.k < 0) return;
- const t = performance.now();
- const o = order(q);
- const c0 = o.cands(Ks[Ks.length >> 1]);
- rerank(lib, q, c0);
- times.push(performance.now() - t);
- ranks.push(o.rank(a.k));
- Ks.forEach((K, j) => {
- const c = o.cands(K), r = rerank(lib, q, c);
- if (r.k === a.k || (r.k >= 0 && Math.abs(r.d - a.d) <= 1e-9 * Math.max(1, a.d))) rec[j]++;
- gaps[j].push(r.k < 0 ? Infinity : r.d / Math.max(1e-9, a.d) - 1);
- });
- });
- const m = ref.filter((r) => r.k >= 0).length;
- ranks.sort((x, y) => x - y);
- Ks.forEach((K, j) => {
- const g = gaps[j].filter(Number.isFinite);
- table.push({ method, K: `${K} ${unit}`, recall: +(rec[j] / m).toFixed(4), gapMean: +(g.reduce((a, x) => a + x, 0) / (g.length || 1)).toFixed(4), gapMax: +Math.max(0, ...g).toFixed(3), rankMedian: ranks[ranks.length >> 1] === Infinity ? "excluded" : ranks[ranks.length >> 1], ms: +(times.reduce((a, x) => a + x, 0) / times.length).toFixed(1) });
- });
- log(table.slice(-Ks.length).map((r) => `${r.method} K=${r.K}: recall ${r.recall}, gap mean ${r.gapMean} max ${r.gapMax}, rank median ${r.rankMedian}, ${r.ms} ms`).join("\n"));
-}
-
-if (methods.includes("B")) evaluate("B kernel-ts exact", (q) => { const mins = blocks(q), bl = topKFast(mins, 256); return { cands: (K) => framesOf(bl, K), rank: (k) => rankOf(mins, (k / BLOCK) | 0) }; }, [1, 4, 16, 64], "blocks");
-if (methods.includes("C")) evaluate("C hdc motion + tag filter", (q) => { const sc = hamming(q, false), top = topKFast(sc, 16384); return { cands: (K) => top.subarray(0, K), rank: (k) => rankOf(sc, k) }; }, [64, 1024, 4096, 16384], "frames");
-if (methods.includes("D")) evaluate("D hdc tags bound", (q) => { const sc = hamming(q, true), top = topKFast(sc, 16384); return { cands: (K) => top.subarray(0, K), rank: (k) => rankOf(sc, k) }; }, [64, 1024, 4096, 16384], "frames");
-if (methods.includes("E")) for (const [step, K] of [[8, 8], [8, 32], [16, 64]]) evaluate(`E coarse /${step}`, (q) => { const be = coarseSearch(step, K); const c = be.candidates(lib, q); const s = new Set(Array.from(c)); return { cands: () => c, rank: (k) => (s.has(k) ? 0 : Infinity) }; }, [K], "coarse");
-if (methods.includes("F")) {
- const t = performance.now(), base = ivfSearch(lib, 256, 2), idx = [2, 8, 32].map((p) => ({ ...base, candidates: (base as any).probeWith(p) }));
- log(`F: k-means built in ${((performance.now() - t) / 1000).toFixed(1)} s`);
- idx.forEach((be, i) => evaluate(`F ivf 256 probe ${[2, 8, 32][i]}`, (q) => { const c = be.candidates(lib, q); const s = new Set(Array.from(c)); return { cands: () => c, rank: (k) => (s.has(k) ? 0 : Infinity) }; }, [[2, 8, 32][i]], "probes"));
-}
-out.table = table;
-out.rssAfterSearchGB = rss();
-
-// ---------------------------------------------------------------- semantic retrieval
-// walk queries asking for a tag: the share of each method's returned frames from the right captures, and of its pick
-const walkQs = sample.filter(({ q }) => q.ws !== undefined && !q.phase).slice(0, 40).map(({ q }) => q);
-const sem: Record<string, unknown>[] = [];
-for (const tag of ["carry", "suitcase", "box", "look-around"]) {
- const bit = TAG(tag), want: [number, number] = [0, 0];
- want[bit >> 5] = (1 << (bit & 31)) >>> 0;
- const variants: [string, (q: SearchQuery) => { cands: ArrayLike<number>; q: SearchQuery }][] = [
- ["A untagged", (q) => ({ cands: [], q: { ...q, tags: undefined } })],
- ["A tag filter", (q) => ({ cands: [], q: { ...q, tags: { want, forbid: q.tags?.forbid ?? [0, 0] } } })],
- ["B untagged K=16", (q) => { const qq = { ...q, tags: undefined }; return { cands: framesOf(topKFast(blocks(qq), 16), 16), q: qq }; }],
- ["B tag filter K=16", (q) => { const qq = { ...q, tags: { want, forbid: q.tags?.forbid ?? [0, 0] } as any }; return { cands: framesOf(topKFast(blocks(qq), 16), 16), q: qq }; }],
- ["C hdc + tag filter K=4096", (q) => { const qq = { ...q, tags: { want, forbid: q.tags?.forbid ?? [0, 0] } as any }; return { cands: topKFast(hamming(qq, false), 4096), q: qq }; }],
- ["D hdc tag bound K=4096", (q) => { const qq = { ...q, tags: { want, forbid: q.tags?.forbid ?? [0, 0] } as any }; return { cands: topKFast(hamming(qq, true), 4096), q: { ...qq, tags: undefined } }; }],
- ["D hdc bound + filter K=4096", (q) => { const qq = { ...q, tags: { want, forbid: q.tags?.forbid ?? [0, 0] } as any }; return { cands: topKFast(hamming(qq, true), 4096), q: qq }; }],
- ];
- for (const [name, f] of variants) {
- if (!methods.includes(name[0])) continue;
- let ret = 0, retRight = 0, pickRight = 0, picks = 0;
- for (const q0 of walkQs) {
- const { cands, q } = f(q0);
- const all = name.startsWith("A");
- if (!all) for (let i = 0; i < cands.length; i++) { const k = cands[i]; if (exactCost(lib, { ...q, tags: undefined }, k) < Infinity) { ret++; if (rightFrame(tag, k)) retRight++; } }
- const r = all ? rerank(lib, q) : rerank(lib, q, cands);
- if (r.k >= 0) { picks++; if (rightFrame(tag, r.k)) pickRight++; }
- }
- const row = { tag, method: name, returnedRight: ret ? +(retRight / ret).toFixed(3) : "-", pickRight: +(pickRight / (picks || 1)).toFixed(3), queries: walkQs.length };
- sem.push(row);
- log(`semantic ${tag} ${name}: returned ${row.returnedRight}, picks ${row.pickRight}`);
- }
-}
-out.semantic = sem;
-
-// ---------------------------------------------------------------- perform with each method
-if (doPerform) for (const m of methods.filter((x: string) => x !== "A" && backends[x])) {
- const be = backends[m]();
- lib.search = be;
- for (const sc of scenes) {
- const t = performance.now();
- const perf = perform(lib, sc.spec, { quiet: true });
- const ms = performance.now() - t;
- const q = quality(sc, perf);
- perfRows.push({ method: m, scene: sc.name, ms: Math.round(ms), ...q });
- log(`${m} ${sc.name}: ${(ms / 1000).toFixed(1)} s; ${JSON.stringify(q)}`);
- }
-}
-lib.search = undefined;
-out.perform = perfRows;
-out.rssGB = rss();
-
-// ---------------------------------------------------------------- the tables
-const md = (rows: Record<string, unknown>[]) => { if (!rows.length) return ""; const ks = [...new Set(rows.flatMap((r) => Object.keys(r)))]; return [`| ${ks.join(" | ")} |`, `|${ks.map(() => "---").join("|")}|`, ...rows.map((r) => `| ${ks.map((k) => r[k] ?? "").join(" | ")} |`)].join("\n"); };
-log(`\n## search\n${md(table as any)}\n\n## semantic\n${md(sem)}\n\n## perform\n${md(perfRows)}`);
-if (jsonOut) writeFileSync(jsonOut, JSON.stringify(out, null, 1));
diff --git a/sdk/raea/bench/character/effects.ts b/sdk/raea/bench/character/effects.ts
deleted file mode 100644
index d22e93d6..00000000
--- a/sdk/raea/bench/character/effects.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-// Rig effects rebuilt against the real capture: for each 100STYLE style, its effect learned from the first half of
-// its forward walk against Neutral's, laid over Neutral's walk, and compared with the second half (held out) of the
-// style's own walk. Scores, each on the library's own scale (z-scores of the style measurements; degrees for the
-// joints): how far plain Neutral is from the style, and how far Neutral with the effect is. An effect that works
-// closes most of the gap.
-//
-// bun sdk/raea/bench/character/effects.ts SKELETON.json LIBRARY [Style ...] [--json OUT]
-import { readFileSync, writeFileSync } from "node:fs";
-import { clipPose, readClips, type Clip, type ClipFile } from "raea/clip";
-import { captured, pose, qinv, qmul, type Skeleton } from "raea/character";
-import { applyEffect, clipMeans, learnEffect, qlog } from "raea/effects";
-import { STATE } from "raea/matching";
-import { styleOf, type StyleVector } from "raea/style";
-
-const args = process.argv.slice(2);
-const ji = args.indexOf("--json"), jsonOut = ji >= 0 ? args.splice(ji, 2)[1] : undefined;
-const [skelPath, lib, ...only] = args;
-const skel = JSON.parse(readFileSync(skelPath, "utf8")) as Skeleton;
-const load = (s: string) => readClips(JSON.parse(readFileSync(`${lib}/100style/${s}.json`, "utf8")) as ClipFile).get(`${s}_FW`)!;
-const ix = JSON.parse(readFileSync(`${lib}/index.json`, "utf8")) as { clips: { label: string; move?: string }[] };
-const styles = only.length ? only : [...new Set(ix.clips.filter((c) => c.move === "FW").map((c) => c.label))].filter((s) => s !== "Neutral");
-const neutral = load("Neutral");
-
-/** a clip's frames as another clip of `n` frames (played at `rate`, with or without an effect laid over) */
-function render(c: Clip, n: number, rate: number, f: (p: ReturnType<typeof clipPose>) => ReturnType<typeof clipPose>): Clip {
- const nj = captured(skel), root = new Float32Array(n * 3), turns = new Float32Array(n * nj * 4);
- for (let k = 0; k < n; k++) {
- const p = f(clipPose(c, (k * rate) / c.fps, { loop: true }));
- root.set(p.root, k * 3);
- p.turns.slice(0, nj).forEach((q, i) => turns.set(q, (k * nj + i) * 4));
- }
- return { name: "x", fps: c.fps, frames: n, root, turns };
-}
-/** the style measurements over a clip, a second every half second, averaged */
-function meanStyle(c: Clip, f0 = 0, f1 = c.frames): StyleVector {
- const out = {} as StyleVector;
- const rows: StyleVector[] = [];
- for (let f = f0; f + c.fps <= f1; f += c.fps / 2) rows.push(styleOf(skel, c, f, f + c.fps));
- for (const k of Object.keys(rows[0]) as (keyof StyleVector)[]) out[k] = rows.reduce((a, r) => a + r[k], 0) / rows.length;
- return out;
-}
-/** the joints' mean turns apart, degrees, averaged over the joints */
-function postureGap(a: Clip, b: Clip, b0: number, b1: number): number {
- const ma = clipMeans(skel, a), mb = clipMeans(skel, b, b0, b1);
- let s = 0;
- for (let i = 0; i < ma.turns.length; i++) { const v = qlog(qmul(qinv(ma.turns[i]), mb.turns[i])); s += Math.hypot(...v) * 57.2958; }
- return s / ma.turns.length;
-}
-
-// the measurements' spread over the styles' walks, for z-scores
-const rowsAll: StyleVector[] = [];
-const results: { style: string; before: number; after: number; postureBefore: number; postureAfter: number; worst: string }[] = [];
-const cache = new Map<string, { real: StyleVector; plain: StyleVector; fx: StyleVector; pb: number; pa: number }>();
-for (const s of styles) {
- const c = load(s), half = Math.floor(c.frames / 2);
- const e = learnEffect(skel, neutral, c, { s: [0, half] });
- const base = clipMeans(skel, neutral);
- const n = Math.min(neutral.frames, 60 * c.fps);
- const plain = render(neutral, n, 1, (p) => p);
- const fx = render(neutral, n, e.rate, (p) => applyEffect(skel, p, e, { base }));
- const real = meanStyle(c, half, c.frames), sp = meanStyle(plain), sf = meanStyle(fx);
- rowsAll.push(real, sp, sf);
- cache.set(s, { real, plain: sp, fx: sf, pb: postureGap(plain, c, half, c.frames), pa: postureGap(fx, c, half, c.frames) });
-}
-const sd = {} as Record<string, number>;
-for (const k of STATE) { const xs = rowsAll.map((r) => r[k]), m = xs.reduce((a, b) => a + b, 0) / xs.length; sd[k] = Math.sqrt(xs.reduce((a, b) => a + (b - m) ** 2, 0) / xs.length) || 1; }
-const dist = (a: StyleVector, b: StyleVector) => Math.sqrt(STATE.reduce((s, k) => s + ((a[k] - b[k]) / sd[k]) ** 2, 0) / STATE.length);
-for (const [s, r] of cache) {
- const worst = STATE.map((k) => [k, Math.abs(r.fx[k] - r.real[k]) / sd[k]] as const).sort((a, b) => b[1] - a[1])[0];
- results.push({ style: s, before: dist(r.plain, r.real), after: dist(r.fx, r.real), postureBefore: r.pb, postureAfter: r.pa, worst: `${worst[0]} ${worst[1].toFixed(2)}` });
-}
-results.sort((a, b) => b.before - a.before);
-console.log("style".padEnd(20), "gap before", " after", " closed", " posture deg before/after", " worst after");
-for (const r of results) console.log(r.style.padEnd(20), r.before.toFixed(2).padStart(10), r.after.toFixed(2).padStart(6), `${(100 * (1 - r.after / r.before)).toFixed(0)}%`.padStart(8), `${r.postureBefore.toFixed(1)} / ${r.postureAfter.toFixed(1)}`.padStart(26), " ", r.worst);
-const mb = results.reduce((a, r) => a + r.before, 0) / results.length, ma = results.reduce((a, r) => a + r.after, 0) / results.length;
-console.log(`mean gap ${mb.toFixed(2)} -> ${ma.toFixed(2)} (${(100 * (1 - ma / mb)).toFixed(0)}% closed) over ${results.length} styles`);
-if (jsonOut) writeFileSync(jsonOut, JSON.stringify({ results, sd }, null, 1));
diff --git a/sdk/raea/bench/character/grips.ts b/sdk/raea/bench/character/grips.ts
deleted file mode 100644
index a13015b8..00000000
--- a/sdk/raea/bench/character/grips.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-// The grips (examples/character/grip-scenes.ts): each thing taken, carried and put down, judged by the skin, how deep
-// a hand's skin (palm, thumb and fingers) and the body's (trunk, head, arms, thighs) go into the thing while it is
-// held, through the pick, the carry (the walk) and the put-down. A thing "clips" on a frame where a hand or the body is
-// more than `--tol` cm into it (0.5 by default); a scene fails on more than `--frames` such frames (10). Each scene
-// also reports its closure: the share of held frames on which the skin touching the thing (the hands', the arms' and
-// the trunk's, within 3 mm) could hold it up against gravity with friction 0.5 (grasp.ts's holds), reported, not judged.
-// bun bench/character/grips.ts [SCENE...] [--body kid|man|woman|all] [--tol CM] [--frames N] [--lib parkour|db]
-// --lib db performs over the body's whole motion database (~/.cache/raea-mocap/lib/BODY/motion.db, docs/clips.feature)
-import { add, pose, qinv, qrot, surface, type Vec3 } from "raea/character";
-import { contactsOf, holds } from "raea/grasp";
-import { interact, thingSdf } from "raea/items";
-import { perform } from "raea/matching";
-import { SCENES, gripRun } from "../../../../examples/character/grip-scenes";
-import { BODIES, parkour, type Body } from "../../../../examples/character/parkour-levels";
-import { dbLibraryAt } from "@raea/character/clips-bun";
-
-const args = process.argv.slice(2), opt = (k: string, d: string) => { const i = args.indexOf(k); return i >= 0 ? args[i + 1] : d; };
-const bodyArg = opt("--body", "kid"), tol = Number(opt("--tol", "0.5")) / 100, most = Number(opt("--frames", "10"));
-const libArg = opt("--lib", "parkour");
-const pick = args.filter((a, i) => !a.startsWith("--") && !args[i - 1]?.startsWith("--"));
-const bodies: Body[] = bodyArg === "all" ? BODIES : [bodyArg as Body];
-const HAND = /^(palm|thumb|index|middle|ring|pinky)/;
-let failed = 0, total = 0;
-for (const body of bodies) {
- const { skel, lib: own } = parkour(body);
- const lib = libArg === "db" ? dbLibraryAt(skel, `${process.env.HOME}/.cache/raea-mocap/lib/${body}`) : own;
- if (bodies.length > 1 || body !== "kid") console.log(`== ${body}`);
- for (const sc of SCENES.filter((s) => !pick.length || pick.includes(s.name))) {
- total++;
- const t0 = performance.now();
- const r = gripRun(body, sc, lib), perf = perform(lib, r.plan.spec, { quiet: true }), live = interact(skel, perf, r.plan), sdf = thingSdf(r.plan.items.it);
- // the worst of each, by step (a pick's or a put-down's wait, the carry's walk)
- const worst: Record<string, { hand: [number, number, string]; body: [number, number, string] }> = {};
- let held = 0, clips = 0, held3 = 0;
- for (let f = 0; f < live.frames; f++) {
- if (!live.held("it", f)) continue;
- held++;
- const t = live.item("it", f), field = (q: Vec3) => sdf(qrot(qinv(t.rot), [q[0] - t.at[0], q[1] - t.at[1], q[2] - t.at[2]]));
- const step = perf.step(f)?.kind ?? "end", w = (worst[step] ??= { hand: [0, -1, ""], body: [0, -1, ""] });
- let deep = 0;
- for (const x of surface(skel, pose(skel, live.pose(f)))) {
- const d = -field(x.at), k = HAND.test(x.part) ? "hand" : "body";
- deep = Math.max(deep, d);
- if (d > w[k][0]) w[k] = [d, f, `${x.side ?? ""}${x.part}`];
- }
- if (deep > tol) clips++;
- const mid = add(t.at, qrot(t.rot, [0, r.plan.items.it.size[1] / 2, 0]));
- if (holds(contactsOf(skel, pose(skel, live.pose(f)), field, { parts: /./ }), mid)) held3++;
- }
- const pass = clips <= most;
- if (!pass) failed++;
- const cm = (v: [number, number, string]) => (v[1] < 0 ? "0" : `${(v[0] * 100).toFixed(1)} cm ${v[2]} @${v[1]}`);
- console.log(`${pass ? "PASS" : "FAIL"} ${sc.name} (${r.plan.beats[0].how.grip}): ${clips} of ${held} held frames over ${(tol * 100).toFixed(1)} cm; closure ${Math.round((100 * held3) / Math.max(1, held))}% (${((performance.now() - t0) / 1000).toFixed(1)} s)`);
- for (const [step, w] of Object.entries(worst)) console.log(` ${step.padEnd(5)} hand ${cm(w.hand)}; body ${cm(w.body)}`);
- }
-}
-console.log(`\n${total - failed}/${total} pass`);
-process.exit(failed ? 1 : 0);
diff --git a/sdk/raea/bench/character/lint.ts b/sdk/raea/bench/character/lint.ts
deleted file mode 100644
index 1c3d51a0..00000000
--- a/sdk/raea/bench/character/lint.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-// The motion lint over simple walks: a straight walk at the library's pace and faster, a stop and start, and a walk
-// with turns. Prints each finding with the stage that made it and what happened about then.
-// bun bench/character/lint.ts LIB.json TABLE.json SKELETON.json [--all]
-import { readFileSync } from "node:fs";
-import { readClips, type ClipFile } from "raea/clip";
-import { motionLibrary, perform, type PerformanceSpec } from "raea/matching";
-import { lintReport, motionLint } from "raea/lint";
-import { footDrift } from "raea/feet";
-
-const [libPath, tablePath, skelPath] = process.argv.slice(2).filter((a) => !a.startsWith("--"));
-const all = process.argv.includes("--all");
-const json = (p: string) => JSON.parse(readFileSync(p, "utf8"));
-const skel = json(skelPath);
-const lib = motionLibrary(skel, readClips(json(libPath) as ClipFile), { table: json(tablePath) });
-const walks: Record<string, PerformanceSpec> = {
- "straight, library pace": { at: [0, 0, 0], facing: 0, steps: [{ walk: [[0, 0], [0, 6]], speed: 0.55 }, { wait: 1 }] },
- "straight, 1 m/s": { at: [0, 0, 0], facing: 0, steps: [{ walk: [[0, 0], [0, 8]], speed: 1 }, { wait: 1 }] },
- "stop and start": { at: [0, 0, 0], facing: 0, steps: [{ walk: [[0, 0], [0, 3]] }, { wait: 1.2 }, { walk: [[0, 3], [0, 6]] }, { wait: 1 }] },
- "turns": { at: [0, 0, 0], facing: 0, steps: [{ walk: [[0, 0], [0, 3], [2.5, 4], [2.5, 1]] }, { wait: 0.6, face: Math.PI }, { walk: [[2.5, 1], [0, 0.5]] }, { wait: 1 }] },
-};
-for (const [name, spec] of Object.entries(walks)) {
- const perf = perform(lib, spec, { trace: true });
- const d = footDrift(skel, perf.pose, perf.frames);
- console.log(`\n== ${name}: skate ${d.skateCms.toFixed(1)} cm/s, slide ${d.slideCm.toFixed(1)} cm a step, knee while standing max ${d.kneeMax.toFixed(1)}°/f`);
- console.log(lintReport(motionLint(lib, perf), { max: all ? 1000 : 25 }));
-}
diff --git a/sdk/raea/bench/character/match-state.ts b/sdk/raea/bench/character/match-state.ts
deleted file mode 100644
index 90a1d7cb..00000000
--- a/sdk/raea/bench/character/match-state.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-// Matching by state: a library of 100STYLE's Neutral and a few styles (walk and stand each), one route walked with no
-// state and in each state. For a style the library has, the lookup (route plus state) should pick that style's own
-// frames; for one it hasn't, the walk is Neutral's frames under the style's rig effect. Each walk's style is compared
-// with the style's real walk on the spread of the 100 styles' walks.
-//
-// bun sdk/raea/bench/character/match-state.ts SKELETON.json LIBRARY
-import { readFileSync } from "node:fs";
-import { readClips, type Clip, type ClipFile } from "raea/clip";
-import { captured, type Skeleton } from "raea/character";
-import { motionLibrary, perform, STATE, type MotionState } from "raea/matching";
-import { styleMean, type StyleVector } from "raea/style";
-import type { RigEffect } from "raea/effects";
-
-const [skelPath, L] = process.argv.slice(2);
-const skel = JSON.parse(readFileSync(skelPath, "utf8")) as Skeleton;
-const json = (p: string) => JSON.parse(readFileSync(`${L}/${p}`, "utf8"));
-const IN = ["Neutral", "Old", "Depressed", "Proud", "Zombie", "Angry", "Crouched"];
-const OUT = ["LimpLeft", "BentForward", "Elated", "Stiff"];
-const clips = new Map<string, Clip>();
-for (const s of IN) for (const [k, c] of readClips(json(`100style/${s}.json`) as ClipFile)) clips.set(k, c);
-const lib = motionLibrary(skel, clips, { table: IN.map((s) => json(`100style/${s}.table.json`)) });
-const effects = json("effects.json") as Record<string, RigEffect>;
-const means = json("means.json") as Record<string, { v: StyleVector }>;
-const walks = Object.entries(means).filter(([k]) => k.endsWith("_FW")).map(([, m]) => m.v);
-const sd = Object.fromEntries(STATE.map((k) => { const xs = walks.map((v) => v[k]), m = xs.reduce((a, b) => a + b, 0) / xs.length; return [k, Math.sqrt(xs.reduce((a, b) => a + (b - m) ** 2, 0) / xs.length) || 1]; }));
-const gap = (a: StyleVector, b: StyleVector) => Math.sqrt(STATE.reduce((s, k) => s + ((a[k] - b[k]) / sd[k]) ** 2, 0) / STATE.length);
-const path: [number, number][] = process.env.STRAIGHT ? [[0, 0], [14, 0]] : [[0, 0], [4, 0], [4, 3], [0, 3], [0, 0.2]];
-const walk = (state?: MotionState) => {
- const p = perform(lib, { at: [0, 0, 0], facing: Math.PI / 2, steps: [{ walk: path }], state }, { effects, stateWeight: Number(process.env.WS ?? 2) });
- const nj = captured(skel), n = p.frames, root = new Float32Array(n * 3), turns = new Float32Array(n * nj * 4);
- for (let f = 0; f < n; f++) { const q = p.pose(f); root.set(q.root, f * 3); q.turns.slice(0, nj).forEach((t, i) => turns.set(t, (f * nj + i) * 4)); }
- // which style each frame played, over the walk's middle
- const share: Record<string, number> = {};
- for (const x of p.played.slice(45, n - 45)) { const s = x.clip.split("_")[0]; share[s] = (share[s] ?? 0) + 1 / (n - 90); }
- return { v: styleMean(skel, { name: "w", fps: 30, frames: n, root, turns }, 45, n - 45), share };
-};
-const plain = walk("Neutral");
-const top = (share: Record<string, number>) => Object.entries(share).sort((a, b) => b[1] - a[1]).slice(0, 3).map(([s, x]) => `${s} ${(100 * x).toFixed(0)}%`).join(", ");
-console.log(`library: ${IN.join(", ")}`);
-console.log(`Neutral: frames from ${top(plain.share)}`);
-console.log("state".padEnd(14), "in library", " own frames", " gap Neutral -> state", " frames from");
-for (const s of [...IN.slice(1), ...OUT]) {
- const w = walk(s), real = means[`${s}_FW`].v;
- console.log(s.padEnd(14), (IN.includes(s) ? "yes" : "no").padStart(10), `${(100 * (w.share[s] ?? 0)).toFixed(0)}%`.padStart(12), `${gap(plain.v, real).toFixed(2)} -> ${gap(w.v, real).toFixed(2)}`.padStart(24), " ", top(w.share));
-}
-// a mix of a style the library has and one it hasn't: the first's frames, the second's effect over them
-const mix = walk({ Old: 0.6, LimpLeft: 0.6 });
-console.log(`Old 0.6 + LimpLeft 0.6: frames from ${top(mix.share)}`);
-// two styles the library has, half each: frames of both
-console.log(`Old 0.5 + Depressed 0.5: frames from ${top(walk({ Old: 0.5, Depressed: 0.5 }).share)}`);
-// a state changed mid-walk: the frames change with it
-{
- const p = perform(lib, { at: [0, 0, 0], facing: Math.PI / 2, steps: [{ walk: [[0, 0], [5, 0]], state: "Old" }, { walk: [[5, 0], [10, 0]], state: "Angry" }] }, { effects });
- const stepOf = (f: number) => p.guide[Math.min(f, p.guide.length - 1)].step;
- for (const i of [0, 1]) { const fr = p.played.filter((_, f) => stepOf(f) === i).slice(30); const sh: Record<string, number> = {}; for (const x of fr) { const s = x.clip.split("_")[0]; sh[s] = (sh[s] ?? 0) + 1 / fr.length; } console.log(`walk ${i + 1} of 2 (${i ? "Angry" : "Old"}), past its first second: frames from ${top(sh)}`); }
-}
diff --git a/sdk/raea/bench/character/parkour.ts b/sdk/raea/bench/character/parkour.ts
deleted file mode 100644
index 00f155dd..00000000
--- a/sdk/raea/bench/character/parkour.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-// The parkour course's levels (examples/character/parkour-levels.ts), each run and checked strictly against its own
-// geometry: body through obstacles, feet sinking or sliding, falls, floating, pops, things dropped or thrown wide, and
-// the library's own limits on every joint. Exits 1 if any level fails.
-// bun bench/character/parkour.ts [LEVEL...] [--body kid|man|woman|all] [--json OUT.json]
-import { writeFileSync } from "node:fs";
-import { checkCourse, courseReport, layCourse } from "raea/course";
-import { interact } from "raea/items";
-import { perform } from "raea/matching";
-import { BODIES, parkour, type Body } from "../../../../examples/character/parkour-levels";
-
-const args = process.argv.slice(2), jsonAt = args.indexOf("--json"), bodyAt = args.indexOf("--body");
-const out = jsonAt >= 0 ? args[jsonAt + 1] : undefined, bodyArg = bodyAt >= 0 ? args[bodyAt + 1] : "kid";
-const pick = args.filter((a, i) => !a.startsWith("--") && !(jsonAt >= 0 && i === jsonAt + 1) && !(bodyAt >= 0 && i === bodyAt + 1));
-const bodies: Body[] = bodyArg === "all" ? BODIES : [bodyArg as Body];
-const results = [];
-let failed = 0, total = 0;
-for (const body of bodies) {
-const { skel: kid, lib, levels: all } = parkour(body);
-const levels = pick.length ? all.filter((l) => pick.some((p) => l.name.startsWith(p))) : all;
-if (bodies.length > 1 || body !== "kid") console.log(`== ${body}`);
-total += levels.length;
-for (const spec of levels) {
- const t0 = performance.now();
- const course = layCourse(lib, kid, spec);
- const perf = perform(lib, course.plan.spec, { trace: true, quiet: true });
- const live = interact(kid, perf, course.plan);
- const check = checkCourse(kid, course, perf, live, lib);
- console.log(courseReport(check) + `\n (${((performance.now() - t0) / 1000).toFixed(1)} s)\n`);
- if (!check.pass) failed++;
- results.push({ body, name: check.name, pass: check.pass, frames: check.frames, finished: check.finished, obstacles: check.obstacles, flags: check.flags });
-}
-}
-console.log(`${total - failed}/${total} levels pass`);
-if (out) writeFileSync(out, JSON.stringify(results, null, 1));
-process.exit(failed ? 1 : 0);
diff --git a/sdk/raea/bench/character/states.ts b/sdk/raea/bench/character/states.ts
deleted file mode 100644
index cba19839..00000000
--- a/sdk/raea/bench/character/states.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-// The effect layer under the matcher, for states the library has no frames of: a library of 100STYLE's Neutral only
-// (walk and stand), one route walked with no state and with each style's state (its effect, learned from the style's
-// walk's first half against Neutral's walk), and each walk's style compared with the second half of the style's real
-// walk, which the effect never saw, on the spread of the 100 styles' walks. The effect works where the walk with it is
-// nearer the real style than the walk without.
-//
-// The default 14 styles are the ones the gain limit was chosen on; name the other 85 to check it on styles it never saw.
-//
-// bun sdk/raea/bench/character/states.ts SKELETON.json LIBRARY [Style ...]
-import { readFileSync } from "node:fs";
-import { readClips, type Clip, type ClipFile } from "raea/clip";
-import { captured, type Skeleton } from "raea/character";
-import { motionLibrary, perform, route, STATE } from "raea/matching";
-import { styleMean, type StyleVector } from "raea/style";
-import { learnEffect, type RigEffect } from "raea/effects";
-
-const [skelPath, L, ...only] = process.argv.slice(2);
-const skel = JSON.parse(readFileSync(skelPath, "utf8")) as Skeleton;
-const file = (s: string) => readClips(JSON.parse(readFileSync(`${L}/100style/${s}.json`, "utf8")) as ClipFile);
-const neutral = file("Neutral");
-const means = JSON.parse(readFileSync(`${L}/means.json`, "utf8")) as Record<string, { v: StyleVector }>;
-const lib = motionLibrary(skel, neutral, { table: JSON.parse(readFileSync(`${L}/100style/Neutral.table.json`, "utf8")) });
-const styles = only.length ? only : ["Old", "Depressed", "Proud", "Elated", "Angry", "LimpLeft", "LimpRight", "DragLeftLeg", "Stiff", "Zombie", "Drunk", "Crouched", "BentForward", "Heavyset"];
-// a loop round a 4 x 3 m room, like the capture's own walks round its volume
-const path: [number, number][] = [[0, 0], [4, 0], [4, 3], [0, 3], [0, 0.2]];
-const effects: Record<string, RigEffect> = {};
-const walk = (state?: string) => {
- const p = perform(lib, { at: [0, 0, 0], facing: Math.PI / 2, steps: [{ walk: path }], state }, { effects });
- const nj = captured(skel), n = p.frames, root = new Float32Array(n * 3), turns = new Float32Array(n * nj * 4);
- for (let f = 0; f < n; f++) { const q = p.pose(f); root.set(q.root, f * 3); q.turns.slice(0, nj).forEach((t, i) => turns.set(t, (f * nj + i) * 4)); }
- // the walk's middle, past setting off and before stopping
- const c: Clip = { name: "w", fps: 30, frames: n, root, turns };
- return styleMean(skel, c, 45, n - 45);
-};
-// each style's effect from its walk's first half; its real style the second half's
-const real = (s: string) => { const c = file(s).get(`${s}_FW`)!; return styleMean(skel, c, c.frames >> 1, c.frames); };
-for (const s of styles) { const c = file(s).get(`${s}_FW`)!; effects[s] = learnEffect(skel, neutral.get("Neutral_FW")!, c, { s: [0, c.frames >> 1] }); }
-// the spread of the 100 styles' walks
-const walks = Object.entries(means).filter(([k]) => k.endsWith("_FW")).map(([, m]) => m.v);
-const sd = Object.fromEntries(STATE.map((k) => { const xs = walks.map((v) => v[k]), m = xs.reduce((a, b) => a + b, 0) / xs.length; return [k, Math.sqrt(xs.reduce((a, b) => a + (b - m) ** 2, 0) / xs.length) || 1]; }));
-const gap = (a: StyleVector, b: StyleVector, keys = STATE) => Math.sqrt(keys.reduce((s, k) => s + ((a[k] - b[k]) / sd[k]) ** 2, 0) / keys.length);
-// the walk without an effect at the same pace: as Neutral (the library's own frames, no effect)
-const plain = walk("Neutral");
-console.log("style".padEnd(14), "no state", " effect", " closed", " posture gap (trunk, head, elbows, knees) no state / effect");
-const POSE = ["trunkPitch", "headPitch", "elbowFlex", "kneeBend", "handHeight", "shoulderRaise"] as typeof STATE;
-let a = 0, b = 0, better = 0;
-const byKey = Object.fromEntries(STATE.map((k) => [k, [0, 0]]));
-for (const s of styles) {
- const r = real(s), fx = walk(s), g0 = gap(plain, r), g1 = gap(fx, r);
- for (const k of STATE) { byKey[k][0] += Math.abs(plain[k] - r[k]) / sd[k] / styles.length; byKey[k][1] += Math.abs(fx[k] - r[k]) / sd[k] / styles.length; }
- a += g0; b += g1; if (g1 < g0) better++;
- console.log(s.padEnd(14), g0.toFixed(2).padStart(8), g1.toFixed(2).padStart(8), `${(100 * (1 - g1 / g0)).toFixed(0)}%`.padStart(8), ` ${gap(plain, r, POSE).toFixed(2)} / ${gap(fx, r, POSE).toFixed(2)}`);
-}
-console.log(`mean ${(a / styles.length).toFixed(2)} -> ${(b / styles.length).toFixed(2)}; nearer the real style with the effect in ${better} of ${styles.length}`);
-console.log("each measurement's mean gap, no state -> effect:", STATE.map((k) => `${k} ${byKey[k][0].toFixed(2)}->${byKey[k][1].toFixed(2)}`).join(", "));
diff --git a/sdk/raea/bench/framing/check.sh b/sdk/raea/bench/framing/check.sh
deleted file mode 100755
index f8463772..00000000
--- a/sdk/raea/bench/framing/check.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-# The framing check (<Video framing="face" punchIn>: sdk/react page.rs video_fit, raea-page fit_rect, the face track
-# runtime/page/src/faces.rs). The stock talking take (engine/cli/conformance/fixtures/face.mp4, 320x180, the face left of centre
-# and high) in a 360x640 frame:
-# plain.tsx objectFit cover, centred: the reference
-# framed.tsx framing="face" punchIn={1.3}: must differ from plain, and the eyes raea-perceive finds in it (their
-# midpoint, `raea-perceive eyes`) 38% +-2% down the frame and centred across within 5%
-# framed.tsx again in its project, raea-perceive pointing at nothing: framed as before, from the kept faces.json
-# framed.tsx with RAEA_PERCEIVE pointing at nothing: the render is refused, saying it needs raea-perceive
-# The projects are made in a temp dir with the take linked into media/, so its faces.json stays out of the tree.
-#
-# sdk/raea/bench/framing/check.sh (RAEA_BIN, default raea; RAEA_PERCEIVE_BIN, default target/release's)
-# Prints a line per check (PASS or MISS) and exits 1 when any misses.
-set -u
-export RAEA_SIGN=0 RAEA_MARK=0
-HERE=$(cd "$(dirname "$0")" && pwd)
-ROOT=$(cd "$HERE/../../../.." && pwd)
-BIN=${RAEA_BIN:-raea}
-PERCEIVE=${RAEA_PERCEIVE_BIN:-$ROOT/target/release/raea-perceive}
-TAKE=$ROOT/engine/cli/conformance/fixtures/face.mp4
-[ -f "$TAKE" ] || { echo "MISS no fixture take at $TAKE"; exit 1; }
-OUT=$(mktemp -d "${TMPDIR:-/tmp}/raea-framing.XXXXXX")
-trap 'rm -rf "$OUT"' EXIT
-project() { mkdir -p "$OUT/$1/media" && cp "$HERE/$2.tsx" "$OUT/$1/" && ln -s "$TAKE" "$OUT/$1/media/face.mp4"; }
-bad=0
-for c in plain framed; do
- project "$c" "$c"
- if ! (cd "$OUT/$c" && RAEA_PERCEIVE=$PERCEIVE "$BIN" render "$c.tsx" --at 30 -o "$OUT/$c/r/") > "$OUT/$c.log" 2>&1; then
- echo "MISS $c: the render failed: $(grep -m1 -E 'REFUSED|error' "$OUT/$c.log" | cut -c1-200)"; bad=1
- fi
-done
-p=$OUT/plain/r/frame-00000.png f=$OUT/framed/r/frame-00000.png
-if [ -f "$p" ] && [ -f "$f" ]; then
- s=$(ffmpeg -nostdin -hide_banner -nostats -i "$p" -i "$f" -lavfi "[0:v]format=rgb24[a];[1:v]format=rgb24[b];[a][b]ssim" -f null - 2>&1 | grep -o 'All:[0-9.]*' | cut -d: -f2)
- if awk -v s="${s:-1}" 'BEGIN { exit !(s < 0.95) }'; then echo "PASS differs from plain: SSIM $s"; else echo "MISS framed is plain's picture: SSIM ${s:-none}"; bad=1; fi
- eyes=$("$PERCEIVE" eyes "$f" | jq -c .eyes)
- if [ -z "$eyes" ] || [ "$eyes" = null ]; then echo "MISS no face found in the framed frame"; bad=1
- else
- read -r ex ey <<< "$(jq -r '"\(.[0]) \(.[1])"' <<< "$eyes")"
- if awk -v x="$ex" -v y="$ey" 'BEGIN { exit !(y >= 0.36 && y <= 0.40 && x >= 0.45 && x <= 0.55) }'; then
- echo "PASS eyes at $(awk -v y="$ey" 'BEGIN { printf "%.1f%%", y * 100 }') down, $(awk -v x="$ex" 'BEGIN { printf "%.1f%%", x * 100 }') across"
- else
- echo "MISS eyes at y $ey, x $ex: not 38% +-2% down and centred"; bad=1
- fi
- fi
- [ -f "$OUT/framed/media/face.faces.json" ] && echo "PASS face track kept beside the take: $(jq -c '{every, samples: (.eyes | length), found: ([.eyes[] | select(. != null)] | length)}' "$OUT/framed/media/face.faces.json")" \
- || { echo "MISS no face.faces.json beside the take"; bad=1; }
- # the kept track read back: rendered again without raea-perceive, the frame is framed as before
- if (cd "$OUT/framed" && RAEA_PERCEIVE=$OUT/no-such-perceive "$BIN" render framed.tsx --at 30 -o "$OUT/framed/again/") > "$OUT/again.log" 2>&1; then
- s=$(ffmpeg -nostdin -hide_banner -nostats -i "$f" -i "$OUT/framed/again/frame-00000.png" -lavfi "[0:v]format=rgb24[a];[1:v]format=rgb24[b];[a][b]ssim" -f null - 2>&1 | grep -o 'All:[0-9.]*' | cut -d: -f2)
- if awk -v s="${s:-0}" 'BEGIN { exit !(s >= 0.9999) }'; then echo "PASS the kept track read back: the same framing without raea-perceive (SSIM $s)"; else echo "MISS the kept track read back: another picture (SSIM ${s:-none})"; bad=1; fi
- else
- echo "MISS the kept track read back: refused: $(grep -m1 -E 'REFUSED|error|raea:' "$OUT/again.log" | cut -c1-200)"; bad=1
- fi
-fi
-# no raea-perceive: refused, never centred
-project none framed
-if (cd "$OUT/none" && RAEA_PERCEIVE=$OUT/no-such-perceive "$BIN" render framed.tsx --at 30 -o "$OUT/none/r/") > "$OUT/none.log" 2>&1; then
- echo "MISS without raea-perceive: rendered"; bad=1
-elif grep -q "needs raea-perceive" "$OUT/none.log"; then
- echo "PASS without raea-perceive: refused ($(grep -m1 -o 'framing="face" needs raea-perceive[^(]*' "$OUT/none.log"))"
-else
- echo "MISS without raea-perceive: failed without saying why: $(grep -m1 -E 'REFUSED|error' "$OUT/none.log" | cut -c1-200)"; bad=1
-fi
-exit $bad
diff --git a/sdk/raea/bench/framing/chrome.sh b/sdk/raea/bench/framing/chrome.sh
deleted file mode 100755
index c6325f9d..00000000
--- a/sdk/raea/bench/framing/chrome.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-# The framing check against Chrome: a <Video framing="face"> frame as raea draws it, against the same crop written out
-# as CSS and drawn by Chrome (P26's reference). Chrome can't read a face, so the reference takes the engine's own face
-# track (TAKE.faces.json, which the render keeps beside the take) and its crop (raea-page fit_rect: the eyes held 38%
-# down and centred, the cover scale times punchIn), as an <img> placed absolutely in an overflow:hidden box the size of
-# the frame. Beside it, a plain centred cover of the same take shows what framing changed.
-#
-# sdk/raea/bench/framing/chrome.sh COMPOSITION TAKE FRAMES [PUNCH] (RAEA_BIN, default raea)
-# COMPOSITION a P26 row (examples/parts/brand/face-frame.tsx: its project made as compare.sh makes it, props
-# laid over) or a .tsx path rendered in its own folder
-# TAKE the take as the composition plays it (its faces.json is beside it: TAKE minus its extension
-# plus .faces.json)
-# FRAMES composition frames, comma-separated (e.g. 0,29,59)
-# PUNCH the Video's punchIn (default 1)
-# The video is assumed to fill the frame from its start (no startFrom, rate 1), as framed.tsx and FaceFrame do.
-# Prints a line per frame: SSIM against Chrome's framed crop and against a plain centred cover, both at the crop's own
-# resolution. Exits 1 when a frame isn't closer to the framed crop than to the plain cover by 0.2 (framed.tsx at
-# 0,30,59: 0.995/0.996/0.996 against the framed crop, 0.25-0.27 against plain).
-# FRAMING_KEEP=DIR keeps the pictures (Chrome's framed and plain, and raea's).
-set -u
-export RAEA_SIGN=0 RAEA_MARK=0
-HERE=$(cd "$(dirname "$0")" && pwd)
-ROOT=$(cd "$HERE/../../../.." && pwd)
-BIN=${RAEA_BIN:-raea}
-[ $# -ge 3 ] || { sed -n '9,16p' "$0" | sed 's/^# \{0,1\}//'; exit 2; }
-COMP=$1 TAKE=$2 FRAMES=$3 PUNCH=${4:-1}
-CHROME=$(bash "$ROOT/sdk/ui/parity/chrome.sh" | tail -1)
-[ -x "$CHROME" ] || { echo "MISS no chrome-headless-shell (sdk/ui/parity/chrome.sh)"; exit 1; }
-WORK=$(mktemp -d "${TMPDIR:-/tmp}/raea-framing-chrome.XXXXXX")
-trap 'rm -rf "$WORK"' EXIT
-if [ -f "$COMP" ] && [[ "$COMP" = /* ]]; then
- src=$COMP dir=$(dirname "$COMP")
-else
- HERE_P26=$ROOT/bench/p26-baseline
- # lib.sh's p26_src reads HERE (the P26 folder), ROOT and WORK, and sets src and dir
- (HERE=$HERE_P26; source "$HERE_P26/lib.sh"; p26_src "$COMP"; echo "$src"; echo "$dir") > "$WORK/where" || exit 1
- src=$(sed -n 1p "$WORK/where") dir=$(sed -n 2p "$WORK/where")
-fi
-(cd "$dir" && "$BIN" render "$src" --at "$FRAMES" -o "$WORK/r/") > "$WORK/render.log" 2>&1 || { echo "MISS the render failed: $(grep -m1 -E 'REFUSED|error' "$WORK/render.log" | cut -c1-200)"; exit 1; }
-FACES=${TAKE%.*}.faces.json
-[ -f "$FACES" ] || { echo "MISS no face track at $FACES (does the composition frame the take with framing=\"face\"?)"; exit 1; }
-fps=$(grep -ho 'fps={[0-9.]*}' "$src" "$dir"/*.tsx 2>/dev/null | head -1 | tr -dc '0-9.'); fps=${fps:-30}
-read -r W H < <(ffprobe -v error -show_entries stream=width,height -of csv=p=0 "$WORK/r/frame-00000.png" | tr , " ")
-read -r FW FH < <(ffprobe -v error -select_streams v -show_entries stream=width,height -of csv=p=0 "$TAKE" | tr , " ")
-# SSIM at the take's own resolution (both scaled to the crop's size, WxH): neither picture holds more than the take's pixels,
-# and blown up (a 320x180 take's face crop is 4.6x) raea's and Chrome's resampling filters would be most of the
-# difference
-ssim() { ffmpeg -nostdin -hide_banner -nostats -i "$1" -i "$2" -lavfi "[0:v]format=rgb24,scale=$3:flags=area[a];[1:v]format=rgb24,scale=$3:flags=area[b];[a][b]ssim" -f null - 2>&1 | grep -o 'All:[0-9.]*' | cut -d: -f2; }
-shot() { "$CHROME" --headless --disable-gpu --hide-scrollbars --force-device-scale-factor=1 --window-size="$W,$H" --screenshot="$2" "file://$1" >/dev/null 2>&1; }
-page() { # FILE SRC LEFT TOP WIDTH HEIGHT
- printf '<html><body style="margin:0;background:#000"><div style="position:relative;width:%spx;height:%spx;overflow:hidden"><img src="%s" style="position:absolute;left:%spx;top:%spx;width:%spx;height:%spx"></div></body></html>\n' "$W" "$H" "$2" "$3" "$4" "$5" "$6" > "$1"
-}
-bad=0 k=0
-IFS=, read -ra list <<< "$FRAMES"
-for f in "${list[@]}"; do
- t=$(awk -v f="$f" -v r="$fps" 'BEGIN { printf "%.6f", f / r }')
- # the eyes at t as sdk/react runtime/page/src/faces.rs eyes_at takes them: between the two samples around t when both found
- # a face, else the one that did, else the nearest sample that did
- eyes=$(jq -r --argjson t "$t" '.every as $e | .eyes as $E | ([$t / $e, 0] | max) as $i | ($i | floor) as $a | ($i | ceil) as $b
- | if $E[$a] != null and $E[$b] != null then ($i - $a) as $k | [$E[$a][0] + ($E[$b][0] - $E[$a][0]) * $k, $E[$a][1] + ($E[$b][1] - $E[$a][1]) * $k]
- elif $E[$a] != null then $E[$a] elif $E[$b] != null then $E[$b]
- else ([$a, ($E | length) - 1] | min) as $at | [range(0; $E | length) | select($E[.] != null)] | min_by(. - $at | fabs) as $n | $E[$n] end
- | "\(.[0]) \(.[1])"' "$FACES")
- # raea-page fit_rect: the source rect [x, y, w, h] stretched to the box, as left/top/size of the whole take
- read -r x y w h L T IW IH < <(awk -v bw="$W" -v bh="$H" -v fw="$FW" -v fh="$FH" -v p="$PUNCH" -v e="$eyes" 'function r(v) { return int(v + 0.5) }
- function cl(v, a, b) { return v < a ? a : v > b ? b : v }
- BEGIN { split(e, E, " "); s = (bw / fw > bh / fh ? bw / fw : bh / fh) * (p > 1 ? p : 1)
- w = cl(r(bw / s), 1, fw); h = cl(r(bh / s), 1, fh)
- x = cl(r(E[1] * fw - 0.5 * w), 0, fw - w); y = cl(r(E[2] * fh - 0.38 * h), 0, fh - h)
- printf "%d %d %d %d %.4f %.4f %.4f %.4f\n", x, y, w, h, -x * bw / w, -y * bh / h, fw * bw / w, fh * bh / h }')
- # without the gAMA and cHRM chunks ffmpeg writes from the take's BT.709 tags: Chrome colour-manages a PNG by them
- # (gamma 0.4545 drew face.mp4's frame 30 at grey 36.6 where its pixels are 46.2), and raea draws the decoded pixels
- ffmpeg -nostdin -loglevel error -y -i "$TAKE" -ss "$t" -frames:v 1 -f image2pipe -vcodec ppm - | magick ppm:- "$WORK/src-$f.png"
- page "$WORK/framed-$f.html" "src-$f.png" "$L" "$T" "$IW" "$IH"
- # a plain cover, centred: the take scaled to cover the box
- cs=$(awk -v bw="$W" -v bh="$H" -v fw="$FW" -v fh="$FH" 'BEGIN { s = (bw / fw > bh / fh ? bw / fw : bh / fh); printf "%.4f %.4f %.4f %.4f", (bw - fw * s) / 2, (bh - fh * s) / 2, fw * s, fh * s }')
- page "$WORK/plain-$f.html" "src-$f.png" $cs
- shot "$WORK/framed-$f.html" "$WORK/chrome-framed-$f.png"
- shot "$WORK/plain-$f.html" "$WORK/chrome-plain-$f.png"
- got=$(printf "%s/r/frame-%05d.png" "$WORK" "$k")
- a=$(ssim "$got" "$WORK/chrome-framed-$f.png" "${w}x$h") b=$(ssim "$got" "$WORK/chrome-plain-$f.png" "${w}x$h")
- line="frame $f: SSIM $a against Chrome's framed crop, $b against a plain cover, at the crop's ${w}x$h (eyes $eyes, crop $x,$y ${w}x$h of ${FW}x$FH)"
- if awk -v a="${a:-0}" -v b="${b:-1}" 'BEGIN { exit !(a >= b + 0.2) }'; then echo "PASS $line"; else echo "MISS $line"; bad=1; fi
- [ -n "${FRAMING_KEEP:-}" ] && mkdir -p "$FRAMING_KEEP" && cp "$WORK/chrome-framed-$f.png" "$WORK/chrome-plain-$f.png" "$FRAMING_KEEP/" && cp "$got" "$FRAMING_KEEP/raea-$f.png"
- k=$((k + 1))
-done
-exit $bad
diff --git a/sdk/raea/bench/framing/framed.tsx b/sdk/raea/bench/framing/framed.tsx
deleted file mode 100644
index e8bf0b8c..00000000
--- a/sdk/raea/bench/framing/framed.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-// The framing check's framed case: the stock talking take (engine/cli/conformance/fixtures/face.mp4, linked into media/ by
-// check.sh) filling a 9:16 frame with framing="face" punchIn={1.3}.
-import { AbsoluteFill, Composition, registerRoot, staticFile, Video } from "raea";
-
-function Shot() {
- return (
- <AbsoluteFill style={{ background: "#000" }}>
- <Video src={staticFile("face.mp4")} framing="face" punchIn={1.3} style={{ width: "100%", height: "100%", objectFit: "cover" }} />
- </AbsoluteFill>
- );
-}
-registerRoot(() => <Composition id="main" component={Shot} durationInFrames={60} fps={30} width={360} height={640} />);
diff --git a/sdk/raea/bench/framing/plain.tsx b/sdk/raea/bench/framing/plain.tsx
deleted file mode 100644
index cc7e8d30..00000000
--- a/sdk/raea/bench/framing/plain.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-// The framing check's plain case: the stock talking take (engine/cli/conformance/fixtures/face.mp4, linked into media/ by
-// check.sh) filling a 9:16 frame.
-import { AbsoluteFill, Composition, registerRoot, staticFile, Video } from "raea";
-
-function Shot() {
- return (
- <AbsoluteFill style={{ background: "#000" }}>
- <Video src={staticFile("face.mp4")} style={{ width: "100%", height: "100%", objectFit: "cover" }} />
- </AbsoluteFill>
- );
-}
-registerRoot(() => <Composition id="main" component={Shot} durationInFrames={60} fps={30} width={360} height={640} />);
diff --git a/sdk/raea/conformance/bevy3d.test.tsx b/sdk/raea/conformance/bevy3d.test.tsx
index e8b88e5a..6624fb81 100644
--- a/sdk/raea/conformance/bevy3d.test.tsx
+++ b/sdk/raea/conformance/bevy3d.test.tsx
@@ -84,12 +84,14 @@ describe("Bevy's shapes draw the same args", () => {
expect(html(<Mesh><ConicalFrustum /></Mesh>)).toBe(html(<Mesh><Cylinder args={[0.25, 0.5, 0.5]} /></Mesh>));
});
- test("Plane3d faces its normal: along z the old Plane, along y or x a Box with no depth; tilted is refused", () => {
- expect(html(<Mesh><Plane3d normal={[0, 0, 1]} half_size={[2, 0.75]} /></Mesh>)).toBe(html(<Mesh><Plane args={[4, 1.5]} /></Mesh>));
- expect(html(<Mesh><Plane3d normal={[0, 0, 1]} /></Mesh>)).toBe(html(<Mesh><Plane /></Mesh>));
+ test("Plane3d is Bevy's one-faced plane facing its normal, its sign kept (plane(nx, ny, nz, w, h)); tilted is refused", () => {
+ const shape = (node: React.ReactElement) => /data-shape="([^"]*)"/.exec(html(node))?.[1];
// Bevy's default faces +Y, half_size.y along z
- expect(html(<Mesh><Plane3d half_size={[2, 3]} /></Mesh>)).toBe(html(<Mesh><Box args={[4, 0, 6]} /></Mesh>));
- expect(html(<Mesh><Plane3d normal={[-1, 0, 0]} half_size={[2, 3]} /></Mesh>)).toBe(html(<Mesh><Box args={[0, 4, 6]} /></Mesh>));
+ expect(shape(<Mesh><Plane3d half_size={[2, 3]} /></Mesh>)).toBe("plane(0, 1, 0, 4, 6)");
+ expect(shape(<Mesh><Plane3d /></Mesh>)).toBe("plane(0, 1, 0, 1, 1)");
+ // facing down is its own plane, not the one facing up (a box of no depth had both faces)
+ expect(shape(<Mesh><Plane3d normal={[0, -1, 0]} half_size={[2, 3]} /></Mesh>)).toBe("plane(0, -1, 0, 4, 6)");
+ expect(shape(<Mesh><Plane3d normal={[-1, 0, 0]} half_size={[2, 0.75]} /></Mesh>)).toBe("plane(-1, 0, 0, 4, 1.5)");
expect(() => html(<Mesh><Plane3d normal={[0, 1, 1]} /></Mesh>)).toThrow(/along an axis/);
});
@@ -155,7 +157,7 @@ describe("Mesh3d, Camera3d and StandardMaterial", () => {
expect(html(<StandardMaterial base_color="#cc8844" perceptual_roughness={0.4} metallic={1} />)).toBe(html(<MeshStandardMaterial color="#cc8844" roughness={0.4} metalness={1} />));
expect(html(<StandardMaterial />)).toBe(html(<MeshStandardMaterial color="#ffffff" roughness={0.5} metalness={0} />));
expect(html(<StandardMaterial base_color="#ff0000" unlit />)).toBe(html(<MeshBasicMaterial color="#ff0000" />));
- expect(html(<StandardMaterial alpha_mode={{ Mask: 0.3 }} cull_mode={null} />)).toBe(html(<MeshStandardMaterial color="#ffffff" roughness={0.5} metalness={0} alphaMode="mask" alphaCutoff={0.3} side="double" />));
+ expect(html(<StandardMaterial alpha_mode={{ Mask: 0.3 }} cull_mode={null} />)).toBe(html(<MeshStandardMaterial color="#ffffff" roughness={0.5} metalness={0} alphaMode="mask" alphaCutoff={0.3} opacity={1} side="double" />));
});
test("WearExtension is the old material's wear, its colours camelCase there", () => {
@@ -240,6 +242,10 @@ describe("Mesh3d, Camera3d and StandardMaterial", () => {
expect(html(<StandardMaterial base_color={Srgba.hex("#88ccff").with_alpha(0.4)} />)).toBe(old({}));
expect(html(<StandardMaterial base_color={Srgba.hex("#88ccff").with_alpha(0.4)} alpha_mode="Blend" unlit />)).toBe(html(<MeshBasicMaterial color="#88ccff" transparent opacity={0.4} />));
expect(html(<StandardMaterial base_color={new Srgba(1, 0.5, 0, 0.25)} alpha_mode="Blend" />)).toBe(html(<MeshStandardMaterial color="#ff8000" roughness={0.5} metalness={0} transparent opacity={0.25} />));
+ // a Mask cuts by the alpha and AlphaToCoverage dithers by it, as Bevy's read the base colour's alpha too
+ expect(html(<StandardMaterial base_color={Srgba.hex("#88ccff").with_alpha(0.4)} alpha_mode={{ Mask: 0.5 }} />)).toBe(old({ alphaMode: "mask", alphaCutoff: 0.5, opacity: 0.4 }));
+ expect(html(<StandardMaterial base_color={Srgba.hex("#88ccff").with_alpha(0.4)} alpha_mode="AlphaToCoverage" />)).toBe(old({ alphaMode: "coverage", opacity: 0.4 }));
+ expect(html(<StandardMaterial base_color={Srgba.hex("#88ccff").with_alpha(0.4)} alpha_mode="Add" />)).toBe(old({ alphaMode: "add", opacity: 0.4 }));
});
test("emissive brighter than white: LinearRgba, made from a colour, goes as that colour and its intensity exactly", () => {
@@ -373,6 +379,25 @@ describe("S2a's last Bevy names: Mesh2d with a primitive and a ColorMaterial, an
expect(() => html(<Mesh2d><ColorMaterial /></Mesh2d>)).toThrow(/give it a primitive/);
expect(() => html(<Circle />)).toThrow(/goes in a Mesh2d/);
});
+ test("a ColorMaterial's texture and AlphaMode2d reach the Shape2D; an Srgba's alpha is its opacity (mesh2d_alpha_mode)", () => {
+ expect(html(<Mesh2d><Rectangle half_size={[128, 128]} /><ColorMaterial color={new Srgba(0, 0, 1, 0.7)} texture="branding/icon.png" alpha_mode="Blend" /></Mesh2d>))
+ .toBe(html(<Shape2D shape="rect" size={[256, 256]} color="#0000FF" opacity={0.7} texture="branding/icon.png" alpha_mode="Blend" x={160} y={120} z={0} rotation={0} scale={1} />));
+ expect(html(<Mesh2d><Rectangle /><ColorMaterial color={new LinearRgba(0.2, 0, 0, 1)} alpha_mode={{ Mask: 0.5 }} /></Mesh2d>))
+ .toBe(html(<Shape2D shape="rect" size={[1, 1]} color="#7C0000" opacity={1} alpha_mode={{ Mask: 0.5 }} x={160} y={120} z={0} rotation={0} scale={1} />));
+ expect(html(<Mesh2d opacity={0.5}><Rectangle /><ColorMaterial color={new Srgba(1, 1, 1, 0.5)} /></Mesh2d>)).toContain("&quot;opacity&quot;:0.25");
+ expect(() => html(<Shape2D alpha_mode={"Mask" as never} />)).toThrow(/alpha_mode/);
+ expect(() => html(<Shape2D texture="" />)).toThrow(/texture/);
+ });
+ test("a primitive's vertex_colors (LinearRgba or [r, g, b, a]) reach the Shape2D as linear arrays, one per vertex (mesh2d_vertex_color_texture)", () => {
+ const four = [new LinearRgba(1, 0, 0, 1), [0, 1, 0, 1] as [number, number, number, number], new LinearRgba(0, 0, 1, 0.5), new LinearRgba(1, 1, 1, 1)];
+ expect(html(<Mesh2d><Rectangle vertex_colors={four} /><ColorMaterial /></Mesh2d>))
+ .toBe(html(<Shape2D shape="rect" size={[1, 1]} vertex_colors={[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0.5], [1, 1, 1, 1]]} color="#ffffff" x={160} y={120} z={0} rotation={0} scale={1} />));
+ expect(html(<Mesh2d><Rectangle /></Mesh2d>)).not.toContain("vertex_colors");
+ expect(() => html(<Shape2D vertex_colors={[[1, 0, 0, 1]]} />)).toThrow(/rect's mesh has 4 vertices/);
+ expect(() => html(<Shape2D shape="triangle" vertex_colors={four.slice(0, 2).map(() => [1, 1, 1, 1] as [number, number, number, number])} />)).toThrow(/triangle's mesh has 3/);
+ expect(html(<Shape2D shape="circle" vertex_colors={[[1, 1, 1, 1]]} />)).toContain("vertex_colors");
+ expect(() => html(<Shape2D vertex_colors={[[1, 0, 0]] as never} />)).toThrow(/one linear \[r, g, b, a\]/);
+ });
test("ToonMaterial is the StandardMaterial with ToonExtension", () => {
expect(html(<Mesh3d><Cuboid /><ToonMaterial base_color="#c84" steps={3} rim /></Mesh3d>))
.toBe(html(<Mesh3d><Cuboid /><ExtendedMaterial base={<StandardMaterial base_color="#c84" />} extension={<ToonExtension steps={3} rim />} /></Mesh3d>));
diff --git a/sdk/raea/conformance/clips.test.ts b/sdk/raea/conformance/clips.test.ts
deleted file mode 100644
index 92d1a137..00000000
--- a/sdk/raea/conformance/clips.test.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-// The motion database (docs/clips.feature): tags read from CMU's descriptions, a database built from a few clips
-// whose mirror images are exact, the kernel's integer twin ranking frames as the exact cost does, and the linear top-k.
-import { describe, expect, test } from "bun:test";
-import { readClips, type ClipFile } from "raea/clip";
-import type { Skeleton } from "raea/character";
-import { nearest } from "raea/matching";
-import { BLOCK, FS, MF_SIGN, MF_SRC, NAN16, blockFrames, blockMins, buildDb, dbLibrary, kernelQuery, kernelScore, kernelSearch, parseDb, rerank, tagsOf, topK, topKFast } from "@raea/character/clips";
-import kidJson from "../../../examples/character/media/characters/kid/skeleton.json" with { type: "json" };
-import clipsJson from "../../../examples/character/parkour.json" with { type: "json" };
-
-describe("tags", () => {
- test("CMU's descriptions", () => {
- expect(tagsOf("carry 5.5lb suitcase")).toEqual(expect.arrayContaining(["carry", "suitcase", "heavy"]));
- expect(tagsOf("moving heavy box")).toEqual(expect.arrayContaining(["carry", "box", "heavy"]));
- expect(tagsOf("walk forward and pick up object, carry back object")).toEqual(expect.arrayContaining(["walk", "pick", "carry"]));
- expect(tagsOf("CarefulWalk LookingAround")).toEqual(expect.arrayContaining(["walk", "look-around"]));
- expect(tagsOf("run/jog, sudden stop")).toEqual(expect.arrayContaining(["run", "jog"]));
- expect(tagsOf("walk")).not.toContain("styled");
- expect(tagsOf("Old", "100style", "FW")).toEqual(expect.arrayContaining(["100style", "fw", "walk", "styled"]));
- expect(tagsOf("Neutral", "100style", "ID")).not.toContain("styled");
- });
-});
-
-describe("a database of a few clips", () => {
- const skel = kidJson as unknown as Skeleton, clips = readClips(clipsJson as ClipFile);
- const names = [...clips.keys()].filter((n) => /^c(16_15|35_01|127_05|127_19|77_02|111_28)$/.test(n));
- const db = parseDb(buildDb(skel, names.map((name) => ({ name, source: "cmu", file: "", label: "walk", clip: clips.get(name)! }))));
- const lib = dbLibrary(skel, db, { read: () => clipsJson as ClipFile });
- test("a mirror image's features are the frame's permuted and negated, exactly", () => {
- const n0 = db.header.frames;
- for (let k = 0; k < n0; k += 7) for (let d = 0; d < 27; d++) {
- const v = db.F[k * FS + MF_SRC[d]], m = lib.full.F[(n0 + k) * FS + d];
- expect(m).toBe(v === NAN16 ? NAN16 : (MF_SIGN[d] * v) | 0);
- }
- });
- test("the kernel's twin's best blocks hold the exact best", () => {
- const q = { z: lib.features.slice(500 * 27, 501 * 27).map((x) => (Number.isNaN(x) ? 0 : x + 0.1)), ws: 2 };
- const best = rerank(lib, q);
- const cands = blockFrames(lib, topK(blockMins(lib, kernelQuery(lib, q)), 4));
- expect(rerank(lib, q, cands).k).toBe(best.k);
- expect(kernelScore(lib, kernelQuery(lib, q), best.k)).toBeLessThan(2 ** 31 - 1);
- // and perform's search through the backend finds the same frame
- lib.search = kernelSearch(4);
- const raw = Float32Array.from(q.z, (z, d) => z / lib.scale[d] + lib.mean[d]);
- expect(nearest(lib, raw, undefined, undefined, 2).k).toBe(best.k);
- lib.search = undefined;
- expect(BLOCK).toBe(64);
- });
- test("topKFast is topK", () => {
- const s = Int32Array.from({ length: 5000 }, (_, i) => (Math.imul(i, 2654435761) >>> 12) % 100000);
- expect(Array.from(topKFast(s, 50))).toEqual(topK(s, 50));
- });
-});
diff --git a/sdk/raea/conformance/colorspaces.test.ts b/sdk/raea/conformance/colorspaces.test.ts
new file mode 100644
index 00000000..471f079e
--- /dev/null
+++ b/sdk/raea/conformance/colorspaces.test.ts
@@ -0,0 +1,54 @@
+// raea/color's Hsla, Oklaba, Oklcha and Xyza against bevy_color's own table (crates/bevy_color/src/test_colors.rs, Bevy
+// v0.20.0): each named colour in sRGB, linear, HSL, Oklab, Oklch and XYZ, converted both ways (docs/control.feature FC1f).
+import { describe, expect, test } from "bun:test";
+import { Hsla, LinearRgba, Oklaba, Oklcha, Srgba, Xyza } from "raea/color";
+
+type C4 = [number, number, number, number];
+// name, rgb, linear_rgb, hsl, oklab, oklch, xyz
+const TABLE: [string, C4, C4, C4, C4, C4, C4][] = [
+ ["black", [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]],
+ ["white", [1, 1, 1, 1], [1, 1, 1, 1], [0, 0, 1, 1], [1, 0, 0.000000059604645, 1], [1, 0.000000059604645, 90, 1], [0.95047, 1, 1.08883, 1]],
+ ["red", [1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 0.5, 1], [0.6279554, 0.22486295, 0.1258463, 1], [0.6279554, 0.25768322, 29.233906, 1], [0.4124564, 0.2126729, 0.0193339, 1]],
+ ["green", [0, 1, 0, 1], [0, 1, 0, 1], [120, 1, 0.5, 1], [0.8664396, -0.2338874, 0.1794985, 1], [0.8664396, 0.2948271, 142.49532, 1], [0.3575761, 0.7151522, 0.119192, 1]],
+ ["blue", [0, 0, 1, 1], [0, 0, 1, 1], [240, 1, 0.5, 1], [0.4520137, -0.032456964, -0.31152815, 1], [0.4520137, 0.31321436, 264.05203, 1], [0.1804375, 0.072175, 0.9503041, 1]],
+ ["yellow", [1, 1, 0, 1], [1, 1, 0, 1], [60, 1, 0.5, 1], [0.9679827, -0.07136908, 0.19856972, 1], [0.9679827, 0.21100587, 109.76924, 1], [0.7700325, 0.9278251, 0.1385259, 1]],
+ ["magenta", [1, 0, 1, 1], [1, 0, 1, 1], [300, 1, 0.5, 1], [0.7016738, 0.27456632, -0.16915613, 1], [0.7016738, 0.32249102, 328.36343, 1], [0.5928939, 0.28484792, 0.969638, 1]],
+ ["cyan", [0, 1, 1, 1], [0, 1, 1, 1], [180, 1, 0.5, 1], [0.90539926, -0.1494439, -0.039398134, 1], [0.90539926, 0.15454996, 194.76895, 1], [0.5380136, 0.78732723, 1.069496, 1]],
+ ["olive", [0.5, 0.5, 0, 1], [0.21404114, 0.21404114, 0, 1], [60, 1, 0.25, 1], [0.57902855, -0.042691574, 0.11878061, 1], [0.57902855, 0.12621966, 109.76922, 1], [0.16481864, 0.19859275, 0.029650241, 1]],
+ ["purple", [0.5, 0, 0.5, 1], [0.21404114, 0, 0.21404114, 1], [300, 1, 0.25, 1], [0.41972777, 0.1642403, -0.10118592, 1], [0.41972777, 0.19290791, 328.36343, 1], [0.12690368, 0.060969174, 0.20754242, 1]],
+ ["teal", [0, 0.5, 0.5, 1], [0, 0.21404114, 0.21404114, 1], [180, 1, 0.25, 1], [0.54159236, -0.08939436, -0.02356726, 1], [0.54159236, 0.09244873, 194.769, 1], [0.11515705, 0.16852042, 0.22891617, 1]],
+ ["navy", [0, 0, 0.5, 1], [0, 0, 0.21404114, 1], [240, 1, 0.25, 1], [0.27038592, -0.01941514, -0.18635012, 1], [0.27038592, 0.18735878, 264.05203, 1], [0.03862105, 0.01544842, 0.20340417, 1]],
+];
+
+const near = (got: number[], want: number[], tol = 0.001) => expect(got.every((g, i) => Math.abs(g - want[i]!) <= tol)).toBe(true);
+const v = (c: { [k: string]: number }, ...k: string[]) => k.map((n) => c[n]!);
+const lin = (c: C4) => new LinearRgba(...c);
+const srgb = (c: C4) => new Srgba(...c);
+
+describe("bevy_color's spaces, by its table", () => {
+ for (const [name, rgb, linear, hsl, oklab, oklch, xyz] of TABLE) {
+ test(name, () => {
+ near(v(Oklaba.from(lin(linear)), "lightness", "a", "b", "alpha"), oklab);
+ near(v(Oklaba.from(lin(linear)).to_linear(), "red", "green", "blue", "alpha"), linear);
+ near(v(Xyza.from(lin(linear)), "x", "y", "z", "alpha"), xyz);
+ near(v(new Xyza(...xyz).to_linear(), "red", "green", "blue", "alpha"), linear);
+ near(v(Hsla.from(srgb(rgb)), "hue", "saturation", "lightness", "alpha"), hsl);
+ near(v(new Hsla(...hsl).to_srgba(), "red", "green", "blue", "alpha"), rgb);
+ // a hue only means something with chroma (black's and white's are whatever the rounding leaves)
+ const ch = Oklcha.from(lin(linear));
+ near([ch.lightness, ch.chroma], [oklch[0], oklch[1]]);
+ if (oklch[1] > 0.01) near([ch.hue], [oklch[2]], 0.01);
+ near(v(new Oklcha(...oklch).to_linear(), "red", "green", "blue"), linear.slice(0, 3));
+ near(v(lin(linear).to_srgba(), "red", "green", "blue"), rgb.slice(0, 3));
+ });
+ }
+
+ test("a hue mixes the short way round; the rest lerp", () => {
+ expect(new Hsla(350, 0, 0).mix(new Hsla(10, 1, 1), 0.5).hue).toBe(0);
+ expect(new Oklcha(0, 0, 10).mix(new Oklcha(1, 1, 350), 0.25).hue).toBe(5);
+ near(v(new Hsla(350, 0, 0, 0).mix(new Hsla(10, 1, 1, 1), 0.25), "saturation", "lightness", "alpha"), [0.25, 0.25, 0.25]);
+ near(v(new Srgba(0, 0, 0).mix(new Srgba(1, 0.5, 0), 0.5), "red", "green", "blue"), [0.5, 0.25, 0]);
+ expect(new Srgba(1, 0.5, 0).to_hex()).toBe("#FF8000");
+ expect(new Srgba(1, 0.5, 0, 0.5).to_hex()).toBe("#FF800080");
+ });
+});
diff --git a/sdk/raea/conformance/distance-fog.test.tsx b/sdk/raea/conformance/distance-fog.test.tsx
new file mode 100644
index 00000000..85816034
--- /dev/null
+++ b/sdk/raea/conformance/distance-fog.test.tsx
@@ -0,0 +1,72 @@
+// <Fog> on the camera (Bevy's DistanceFog) and FogFalloff against Bevy (docs/control.feature FC0a: atmospheric_fog's Atmospheric falloff and the
+// sun's colour in the fog). The f32 bits come from bevy_pbr fog.rs's own constructors run on bevy_color (a scratch
+// truth crate against the vendored bevy-0.20.0), so a change to the order of the multiplies or the colour space shows.
+import { expect, test } from "bun:test";
+import type { ReactElement } from "react";
+import { FogFalloff } from "raea/pbr";
+import { Fog } from "raea/3d";
+import { Camera3d } from "raea/camera";
+import { Transform } from "raea/transform";
+import { LinearRgba, Srgba } from "raea/color";
+
+const bits = (x: number) => { const b = new DataView(new ArrayBuffer(4)); b.setFloat32(0, x); return b.getUint32(0).toString(16).padStart(8, "0"); };
+type Atmo = { Atmospheric: { extinction: number[]; inscattering: number[] } };
+const both = (fo: unknown) => { const a = (fo as Atmo).Atmospheric; return [...a.extinction, ...a.inscattering].map(bits); };
+type El = ReactElement<{ type?: string; value?: Record<string, unknown>; children?: unknown }>;
+
+test("from_visibility_colors is Bevy's, bit for bit (atmospheric_fog's own numbers)", () => {
+ expect(both(FogFalloff.from_visibility_colors(15, new Srgba(0.35, 0.5, 0.66, 1), new Srgba(0.8, 0.844, 1, 1))))
+ .toEqual(["3e195ae6", "3dd48644", "3d5276c8", "3d4f9a0d", "3d900172", "3e4c8237"]);
+});
+
+test("alpha scales each by alpha ^ e; a LinearRgba is taken as linear, an Srgba linearised", () => {
+ expect(both(FogFalloff.from_visibility_contrast_colors(30, 0.02, new Srgba(0.1, 0.2, 0.3, 0.5), new LinearRgba(0.6, 0.7, 0.8, 0.9))))
+ .toEqual(["3c9df0ca", "3c942144", "3c8401a0", "3cc818df", "3d181f26", "3d5ab0bb"]);
+});
+
+test("from_visibility and from_visibility_squared: Koschmieder's 5%", () => {
+ expect(bits((FogFalloff.from_visibility(15) as { Exponential: { density: number } }).Exponential.density)).toBe("3e4c8237");
+ expect(bits((FogFalloff.from_visibility_squared(15) as { ExponentialSquared: { density: number } }).ExponentialSquared.density)).toBe("3dec507d");
+});
+
+/** the DistanceFog a <Camera3d> puts on itself for its <Fog> child */
+function onCamera(fog: ReactElement) {
+ const cam = Camera3d({ transform: Transform.fromXyz(0, 0, 5), children: fog }) as El;
+ const found: El[] = [];
+ const walk = (n: unknown) => {
+ if (Array.isArray(n)) return n.forEach(walk);
+ const el = n as El | null;
+ if (!el || typeof el !== "object" || !("props" in el)) return;
+ if (el.props.type === "bevy_pbr::fog::DistanceFog") found.push(el);
+ walk(el.props.children);
+ };
+ walk(cam);
+ expect(found.length).toBe(1);
+ return found[0]!.props.value!;
+}
+
+test("a <Fog> in the <Camera3d> is bevy_pbr's DistanceFog on it, Bevy's defaults filled in", () => {
+ expect(onCamera(<Fog />)).toEqual({
+ color: { Srgba: { red: 1, green: 1, blue: 1, alpha: 1 } },
+ directional_light_color: { LinearRgba: { red: 0, green: 0, blue: 0, alpha: 0 } },
+ directional_light_exponent: 8,
+ falloff: { Linear: { start: 0, end: 100 } },
+ });
+ const sun = onCamera(<Fog color="#ff0000" directional_light_color={new Srgba(1, 0.95, 0.85, 0.5)} directional_light_exponent={30} />);
+ expect(sun.color).toEqual({ Srgba: { red: 1, green: 0, blue: 0, alpha: 1 } });
+ expect(sun.directional_light_color).toEqual({ Srgba: { red: 1, green: 0.95, blue: 0.85, alpha: 0.5 } });
+ expect(sun.directional_light_exponent).toBe(30);
+ expect(onCamera(<Fog near={2} far={9} />).falloff).toEqual({ Linear: { start: 2, end: 9 } });
+ expect(onCamera(<Fog density={0.2} />).falloff).toEqual({ Exponential: { density: 0.2 } });
+ expect(onCamera(<Fog color={new LinearRgba(0.1, 0.2, 0.3, 1)} />).color).toEqual({ LinearRgba: { red: 0.1, green: 0.2, blue: 0.3, alpha: 1 } });
+ expect(() => onCamera(<Fog directional_light_exponent={-1} />)).toThrow(RangeError);
+ expect(() => onCamera(<Fog falloff={FogFalloff.from_visibility(10)} near={1} />)).toThrow(TypeError);
+});
+
+test("in the Canvas3D, Bevy's camera-only fields are refused and Bevy's colours become the hex the scene's fog reads", () => {
+ expect(() => Fog({ falloff: FogFalloff.from_visibility(10) })).toThrow(/inside the <Camera3d>/);
+ expect(() => Fog({ directional_light_color: "#ffffff" })).toThrow(/inside the <Camera3d>/);
+ const hex = (el: unknown) => JSON.stringify(el).match(/#[0-9a-fA-F]{6,8}/)?.[0]?.toLowerCase();
+ expect(hex(Fog({ color: new Srgba(1, 0, 0, 1) }))).toBe("#ff0000");
+ expect(hex(Fog({ color: new LinearRgba(0.2, 0, 0, 1) }))).toBe("#7c0000");
+});
diff --git a/sdk/raea/conformance/envmap.test.tsx b/sdk/raea/conformance/envmap.test.tsx
index aea6ffdb..328308fa 100644
--- a/sdk/raea/conformance/envmap.test.tsx
+++ b/sdk/raea/conformance/envmap.test.tsx
@@ -1,6 +1,7 @@
-// docs/control.feature FC0a: Bevy's EnvironmentMapLight with its own prefiltered maps (3d/pbr, 3d/animated_material).
+// docs/control.feature FC0a: Bevy's EnvironmentMapLight with its own prefiltered maps (3d/pbr, 3d/animated_material),
+// its rotation, and Bevy's Skybox (3d/rotate_environment_map).
import { describe, expect, test } from "bun:test";
-import { EnvironmentMapLight } from "raea/light";
+import { EnvironmentMapLight, Skybox } from "raea/light";
import { renderFrame } from "../src/test";
const html = (el: React.ReactElement) => renderFrame(el, { frame: 0, width: 320, height: 240, fps: 30, durationInFrames: 30 });
@@ -18,3 +19,25 @@ describe("EnvironmentMapLight: prefiltered cubemaps on the camera", () => {
expect(() => html(<EnvironmentMapLight diffuse_map="d.ktx2" specular_map="s.ktx2" intensity={-1} />)).toThrow(/intensity/);
});
});
+
+const Y = (a: number): [number, number, number, number] => [0, Math.sin(a / 2), 0, Math.cos(a / 2)];
+
+describe("rotation and Skybox: Bevy's Quat on both, the sky's cubemap and brightness", () => {
+ test("EnvironmentMapLight's rotation reaches its row as glam's [x, y, z, w]; none sends none", () => {
+ const q = Y(0.4);
+ expect(html(<EnvironmentMapLight diffuse_map="d.ktx2" specular_map="s.ktx2" rotation={q} />)).toContain(`&quot;rotation&quot;:[0,${q[1]},0,${q[3]}]`);
+ expect(html(<EnvironmentMapLight diffuse_map="d.ktx2" specular_map="s.ktx2" />)).not.toContain("rotation");
+ });
+ test("a Skybox row carries its image, brightness (Bevy's default 0) and rotation", () => {
+ const out = html(<Skybox image="maps/s.ktx2" brightness={5000} rotation={Y(1)} />);
+ expect(out).toContain('data-3d="Skybox"');
+ for (const s of ["maps/s.ktx2", "&quot;brightness&quot;:5000", `${Y(1)[1]}`]) expect(out).toContain(s);
+ expect(html(<Skybox image="s.ktx2" />)).toContain("&quot;brightness&quot;:0");
+ });
+ test("a sky that isn't a .ktx2, a negative brightness or a rotation that isn't a unit Quat is refused", () => {
+ expect(() => html(<Skybox image="sky.hdr" />)).toThrow(/Skybox: image/);
+ expect(() => html(<Skybox image="s.ktx2" brightness={-1} />)).toThrow(/brightness/);
+ expect(() => html(<Skybox image="s.ktx2" rotation={[0, 2, 0, 1]} />)).toThrow(/unit Quat/);
+ expect(() => html(<EnvironmentMapLight diffuse_map="d.ktx2" specular_map="s.ktx2" rotation={[0, 0, 0] as never} />)).toThrow(/unit Quat/);
+ });
+});
diff --git a/sdk/raea/conformance/gizmo-colours.test.tsx b/sdk/raea/conformance/gizmo-colours.test.tsx
new file mode 100644
index 00000000..a7e76a1e
--- /dev/null
+++ b/sdk/raea/conformance/gizmo-colours.test.tsx
@@ -0,0 +1,34 @@
+// <Gizmo>'s colours as runtime/plugins fields.rs gizmo_asset reads them (docs/control.feature FC0a: mesh_ray_cast's
+// laser is HDR, Color::srgb(30, 0, 0); align's arrows srgb(0.65, 0, 0)): a hex as it is, Bevy's LinearRgba as linear
+// [r, g, b, a] above 1 kept, Srgba linearised as bevy_color does, and a list one per point.
+import { expect, test } from "bun:test";
+import type { ReactElement } from "react";
+import { Gizmo } from "raea/gizmos";
+import { LinearRgba, Srgba } from "raea/color";
+
+type El = ReactElement<{ children: ReactElement<{ value: { handle: Record<string, unknown> } }> }>;
+const handle = (el: unknown) => (el as El).props.children.props.value.handle;
+const line: [[number, number, number], [number, number, number]][] = [[[0, 0, 0], [1, 0, 0]]];
+const near = (a: unknown, b: number[]) => (a as number[]).every((x, i) => Math.abs(x - b[i]!) < 1e-6) && (a as number[]).length === b.length;
+
+test("one colour: hex as written, LinearRgba as linear (HDR kept), Srgba linearised, [r, g, b, a] as given", () => {
+ expect(handle(Gizmo({ lines: line, color: "#ff0000" })).color).toBe("#ff0000");
+ expect(handle(Gizmo({ lines: line, color: new LinearRgba(30, 0, 0, 1) })).color).toEqual([30, 0, 0, 1]);
+ // Srgba(0.65, 0, 0): 0.65 is 0.380056 linear (((0.65 + 0.055) / 1.055) ^ 2.4)
+ expect(near(handle(Gizmo({ lines: line, color: new Srgba(0.65, 0, 0, 1) })).color, [0.380056, 0, 0, 1])).toBe(true);
+ // a dark channel is linear below 0.04045: 0.03 / 12.92
+ expect(near(handle(Gizmo({ lines: line, color: new Srgba(0.03, 0, 0, 1) })).color, [0.002322, 0, 0, 1])).toBe(true);
+ expect(handle(Gizmo({ lines: line, color: [0.5, 0.25, 0, 1] })).color).toEqual([0.5, 0.25, 0, 1]);
+});
+
+test("a list is one colour per point, each read the same way", () => {
+ const h = handle(Gizmo({ lines: line, strip: [[0, 1, 0]], color: ["#00ff00", new LinearRgba(2, 2, 2, 1), [0, 0, 1, 1]] }));
+ expect(h.list_colors).toEqual(["#00ff00", [2, 2, 2, 1]]);
+ expect(h.strip_colors).toEqual([[0, 0, 1, 1]]);
+});
+
+test("a colour the engine can't read is refused here", () => {
+ expect(() => Gizmo({ lines: line, color: "rgb(1, 2, 3)" })).toThrow(/#rrggbb/);
+ expect(() => Gizmo({ lines: line, color: [1, 0, 0] as unknown as [number, number, number, number] })).toThrow(/\[r, g, b, a\]/);
+ expect(() => Gizmo({ lines: line, color: ["#ffffff"] })).toThrow(/one colour per point/);
+});
diff --git a/sdk/raea/conformance/golden/03-video-take/case.json b/sdk/raea/conformance/golden/03-video-take/case.json
deleted file mode 100644
index 636096a0..00000000
--- a/sdk/raea/conformance/golden/03-video-take/case.json
+++ /dev/null
@@ -1 +0,0 @@
-{"frames": [0, 29, 59], "ssim_min": 0.95}
diff --git a/sdk/raea/conformance/golden/03-video-take/edit.rrl b/sdk/raea/conformance/golden/03-video-take/edit.rrl
deleted file mode 100644
index 3d07d145..00000000
--- a/sdk/raea/conformance/golden/03-video-take/edit.rrl
+++ /dev/null
@@ -1,6 +0,0 @@
-edit {fps: 30, width: 1080, height: 1920, frames: 60}
-camera cam {bg: #000000}
-use "../../../../../engine/media/fixtures/take-h264.mp4" as take
-clip a {src: take, src_in: 2, from: 0, to: 60}
-title t {text: "REAL TAKE", x: 0, y: 300, w: 1080, size: 120, weight: 800, font: "Inter", color: #ffffff, align: center, line: 1}
-audio bed {src: "../../../../../engine/media/fixtures/music-bed.m4a", from: 0, to: 60, gain: -6}
diff --git a/sdk/raea/conformance/golden/03-video-take/edit.tsx b/sdk/raea/conformance/golden/03-video-take/edit.tsx
deleted file mode 100644
index fc587914..00000000
--- a/sdk/raea/conformance/golden/03-video-take/edit.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-// golden case 03: a real take (decoded natively at its source time) under a title, with a music bed at -6 dB; media
-// imported as a module resolves to its path
-import { AbsoluteFill, Audio, Video } from "../../../src";
-import take from "../../../../../engine/media/fixtures/take-h264.mp4";
-import bed from "../../../../../engine/media/fixtures/music-bed.m4a";
-
-export default function RealTake() {
- return (
- <AbsoluteFill style={{ background: "#000" }}>
- <Audio src={bed} volume={0.5011872} />
- <Video src={take} startFrom={60} style={{ position: "absolute", left: 0, top: 0, width: 1080, height: 1920 }} />
- <div style={{ position: "absolute", top: 300, width: 1080, textAlign: "center", fontFamily: "Inter", fontSize: 120, fontWeight: 800, lineHeight: 1, color: "#ffffff" }}>REAL TAKE</div>
- </AbsoluteFill>
- );
-}
diff --git a/sdk/raea/conformance/golden/03-video-take/reference/.gitignore b/sdk/raea/conformance/golden/03-video-take/reference/.gitignore
deleted file mode 100644
index 1c81ed1e..00000000
--- a/sdk/raea/conformance/golden/03-video-take/reference/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# frames of engine/media/fixtures/take-h264.mp4, which stays out of git (engine/media/fixtures/.gitignore)
-*.png
diff --git a/sdk/raea/conformance/grasp.test.ts b/sdk/raea/conformance/grasp.test.ts
deleted file mode 100644
index ddfddbc1..00000000
--- a/sdk/raea/conformance/grasp.test.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-// Grasp guides (docs/grasp-guides.feature): a thing's guides from its shape and size, a pick's tag choosing one, a hand
-// planned on a guide in its own frame, and whether contacts can hold a thing up against gravity; on the kid's can, the
-// guide puts the palm and the fingers on opposite sides, so it holds.
-import { describe, expect, test } from "bun:test";
-import { add, dot, len, norm, pose, qinv, qrot, sub, type Vec3 } from "raea/character";
-import { autoGuides, contactsOf, guidesOf, handOn, holds, pickGuide, type Contact, type CylinderGuide, type SlabGuide } from "raea/grasp";
-import { interact, thingSdf } from "raea/items";
-import { perform } from "raea/matching";
-import type { Thing } from "raea/things";
-import { SCENES, gripRun } from "../../../examples/character/grip-scenes";
-import { parkour } from "../../../examples/character/parkour-levels";
-
-const can: Thing = { at: [0, 0, 0], size: [0.066, 0.122, 0.066], shape: "round", mass: 0.36 };
-const close = (a: Vec3, b: Vec3, e = 1e-9) => expect(len(sub(a, b))).toBeLessThan(e);
-
-describe("auto-fit", () => {
- test("a can gets a cylinder of its radius round its body", () => {
- const [g] = autoGuides(can) as CylinderGuide[];
- expect(g.kind).toBe("cylinder");
- expect(g.radius).toBeCloseTo(0.033, 9);
- expect(g.length).toBeCloseTo(0.122, 9);
- close(g.at, [0, 0.061, 0]);
- close(g.axis, [0, 1, 0]);
- expect(g.tags).toContain("body");
- });
- test("a box gets a slab across each pair of its upright faces, two hands where it's wider than a hand spans", () => {
- const gs = autoGuides({ at: [0, 0, 0], size: [0.33, 0.12, 0.2] }) as SlabGuide[];
- expect(gs.map((g) => g.kind)).toEqual(["slab", "slab"]);
- close(gs[0].normal, [1, 0, 0]);
- expect(gs[0].width).toBeCloseTo(0.33, 9);
- expect(gs[0].hands).toBe(2);
- close(gs[1].normal, [0, 0, 1]);
- expect(gs[1].width).toBeCloseTo(0.2, 9);
- expect((autoGuides({ at: [0, 0, 0], size: [0.12, 0.2, 0.03] }) as SlabGuide[])[1].hands).toBe(1);
- });
- test("a handle and a stem come first, a ball is a sphere, a thing's own guides replace them all", () => {
- const mug: Thing = { at: [0, 0, 0], size: [0.085, 0.1, 0.085], shape: "round", grips: [{ at: [0.06, 0.05, 0], along: [0, 1, 0] }] };
- expect(autoGuides(mug).map((g) => g.tags?.[0])).toEqual(["handle", "body"]);
- expect(pickGuide(mug, "handle")?.tags).toContain("handle");
- expect(pickGuide(mug, "wrap")?.tags).toContain("body");
- expect(pickGuide(mug, "wrap", "handle")?.tags).toContain("handle");
- const glass: Thing = { at: [0, 0, 0], size: [0.08, 0.2, 0.08], shape: "round", grips: [{ at: [0, 0.05, 0], kind: "stem" }] };
- const gs = autoGuides(glass);
- expect(gs[0].kind).toBe("pinch");
- expect((gs[1] as CylinderGuide).length).toBeCloseTo(0.1, 9);
- expect(autoGuides({ at: [0, 0, 0], size: [0.067, 0.067, 0.067], shape: "ball" })[0].kind).toBe("sphere");
- const own: Thing = { ...can, guides: [{ kind: "pinch", at: [0, 0.122, 0], across: [1, 0, 0], width: 0.066, tags: ["rim"] }] };
- expect(guidesOf(own).length).toBe(1);
- expect(pickGuide(own, "wrap", "rim")?.kind).toBe("pinch");
- });
-});
-
-describe("a hand on a guide", () => {
- const g = autoGuides(can)[0] as CylinderGuide;
- test("from the side: the palm on the approach's side facing the axis, the fingers round it, the thumb opposite them", () => {
- for (const side of ["L", "R"] as const) {
- const on = handOn(g, side, [side === "L" ? 1 : -1, 0, -0.35], { hand: 0.126 });
- const toPalm = norm(sub(on.contacts.palm, g.at));
- expect(dot(on.facing, toPalm)).toBeLessThan(-0.99);
- // (the axis diagonal across the palm: the fingers neither along it nor square to it)
- expect(Math.abs(dot(on.point, g.axis))).toBeGreaterThan(0.5);
- expect(Math.abs(dot(on.point, g.axis))).toBeLessThan(0.9);
- // the fingers' contact and the thumb's on opposite sides of the palm's
- const flat = (v: Vec3) => norm(sub(sub(v, g.at), [0, dot(sub(v, g.at), [0, 1, 0]), 0]));
- const cross = (u: Vec3, v: Vec3) => u[2] * v[0] - u[0] * v[2];
- expect(Math.sign(cross(toPalm, flat(on.contacts.fingers)))).toBe(-Math.sign(cross(toPalm, flat(on.contacts.thumb))));
- }
- });
- test("from above: the palm on its end facing down, the fingers across it", () => {
- const on = handOn(g, "R", [0, 1, -0.15], { hand: 0.126 });
- close(on.facing, [0, -1, 0]);
- expect(Math.abs(dot(on.point, [0, 1, 0]))).toBeLessThan(1e-9);
- expect(on.contacts.palm[1]).toBeCloseTo(0.122, 9);
- });
-});
-
-describe("holding against gravity", () => {
- // contacts round a can's side (radius 3.3 cm, its middle at the origin), pushing in
- const at = (deg: number, y = 0): Contact => { const a = (deg * Math.PI) / 180, p: Vec3 = [0.033 * Math.cos(a), y, 0.033 * Math.sin(a)]; return { part: `${deg}`, at: p, push: norm([-p[0], 0, -p[2]]) }; };
- test("opposed contacts hold it; contacts on one side don't, however many", () => {
- expect(holds([at(0), at(180)], [0, 0, 0])).toBe(true);
- expect(holds([at(0, 0.02), at(0, -0.02), at(150, 0.02), at(150, -0.02), at(210, 0)], [0, 0, 0])).toBe(true);
- expect(holds([at(0), at(30), at(60), at(90)], [0, 0, 0])).toBe(false);
- expect(holds([], [0, 0, 0])).toBe(false);
- // (a thing standing on a palm turned up holds by itself)
- expect(holds([{ part: "palm", at: [0, -0.061, 0], push: [0, 1, 0] }], [0, 0, 0])).toBe(true);
- });
- test("the kid's can, carried on its guide, is held from opposed sides", () => {
- const { skel, lib } = parkour("kid"), sc = SCENES.find((s) => s.name === "can")!;
- const r = gripRun("kid", sc, lib), live = interact(skel, perform(lib, r.plan.spec, { quiet: true }), r.plan), sdf = thingSdf(r.plan.items.it);
- let n = 0, held = 0, opposed = 0;
- for (let f = 0; f < live.frames; f += 8) {
- if (!live.held("it", f)) continue;
- const t = live.item("it", f), field = (q: Vec3) => sdf(qrot(qinv(t.rot), sub(q, t.at)));
- const cs = contactsOf(skel, pose(skel, live.pose(f)), field), mid = add(t.at, qrot(t.rot, [0, 0.061, 0]));
- n++;
- if (holds(cs, mid)) held++;
- // (some two of its contacts push against each other: across it, not side by side)
- if (cs.some((a) => cs.some((b) => dot(a.push, b.push) < -0.5))) opposed++;
- }
- expect(n).toBeGreaterThan(20);
- expect(held / n).toBeGreaterThan(0.9);
- expect(opposed / n).toBeGreaterThan(0.9);
- });
-});
diff --git a/sdk/raea/conformance/lightmap.test.tsx b/sdk/raea/conformance/lightmap.test.tsx
new file mode 100644
index 00000000..93cd7d9c
--- /dev/null
+++ b/sdk/raea/conformance/lightmap.test.tsx
@@ -0,0 +1,29 @@
+// docs/control.feature FC0a: Bevy's Lightmap on a Model's glTF meshes by name, and StandardMaterial's
+// lightmap_exposure on the Model's materials (3d/lightmaps).
+import { describe, expect, test } from "bun:test";
+import { Model } from "raea/3d";
+import { Lightmap, StandardMaterial } from "raea/pbr";
+import { renderFrame } from "../src/test";
+
+const html = (el: React.ReactElement) => renderFrame(el, { frame: 0, width: 320, height: 240, fps: 30, durationInFrames: 30 });
+const q = (s: string) => s.replaceAll('"', "&quot;");
+
+describe("Lightmap: a bake on the glTF meshes it names", () => {
+ test("inside a Model it carries its file, mesh, sampling and rect (the whole image by default)", () => {
+ const out = html(<Model src="box.glb"><Lightmap mesh="large_box" image="maps/large.ktx2" /></Model>);
+ expect(out).toContain('data-3d="Lightmap"');
+ expect(out).toContain(q('{"lightmap":"maps/large.ktx2","mesh":"large_box","bicubic":0,"uv_x0":0,"uv_y0":0,"uv_x1":1,"uv_y1":1}'));
+ const atlas = html(<Model src="box.glb"><Lightmap mesh="b" image="m.ktx2" bicubic_sampling uv_rect={{ min: [0.5, 0], max: [1, 0.25] }} /></Model>);
+ expect(atlas).toContain(q('"bicubic":1,"uv_x0":0.5,"uv_y0":0,"uv_x1":1,"uv_y1":0.25'));
+ });
+ test("outside a Model, without a mesh or image, or with a rect off the image, it is refused", () => {
+ expect(() => html(<Lightmap mesh="b" image="m.ktx2" />)).toThrow(/goes in a <Model>/);
+ expect(() => html(<Model src="b.glb"><Lightmap mesh="" image="m.ktx2" /></Model>)).toThrow(/mesh is the glTF mesh/);
+ expect(() => html(<Model src="b.glb"><Lightmap mesh="b" image="" /></Model>)).toThrow(/image is a picture/);
+ expect(() => html(<Model src="b.glb"><Lightmap mesh="b" image="m.ktx2" uv_rect={{ min: [0, 0], max: [1.5, 1] }} /></Model>)).toThrow(/uv_rect/);
+ });
+ test("lightmap_exposure reaches a Model's material as its field, and only when given", () => {
+ expect(html(<Model src="b.glb"><StandardMaterial material="box" lightmap_exposure={250} /></Model>)).toContain(q('"lightmapExposure":250'));
+ expect(html(<Model src="b.glb"><StandardMaterial material="box" base_color="#ff0000" /></Model>)).not.toContain("lightmapExposure");
+ });
+});
diff --git a/sdk/raea/conformance/ui.test.tsx b/sdk/raea/conformance/ui.test.tsx
new file mode 100644
index 00000000..eca16883
--- /dev/null
+++ b/sdk/raea/conformance/ui.test.tsx
@@ -0,0 +1,147 @@
+// docs/control.feature FC0a: bevy_ui's Node, Text and TextSpan on the page, with Bevy's defaults, values and blend
+// (ui/styling/transparency_ui, ui/layout/fixed_node).
+import { describe, expect, test } from "bun:test";
+import { BorderRadius, FontVariationTag, ImageNode, ImagePlugin, Node, TextureAtlasLayout, Overflow, Text, TextSpan, UiRect, auto, percent, px, vw } from "raea/ui";
+import { LinearRgba, Srgba } from "raea/color";
+import { renderFrame } from "../src/test";
+
+const html = (el: React.ReactElement) => renderFrame(el, { frame: 0, width: 320, height: 240, fps: 30, durationInFrames: 30 });
+
+describe("Node: bevy_ui's box with Bevy's defaults", () => {
+ test("a root sits in its own implicit viewport (a full-size grid, its item at the start); a child doesn't", () => {
+ const out = html(<Node width={px(10)}><Node height={px(5)} /></Node>);
+ expect(out.match(/display:grid/g)?.length).toBe(1);
+ expect(out).toContain("position:absolute;left:0;top:0;width:100%;height:100%;display:grid;align-items:start;justify-items:start");
+ expect(out.match(/display:flex;box-sizing:border-box;position:relative;flex-shrink:1;min-width:auto;min-height:auto/g)?.length).toBe(2);
+ });
+ test("a FixedNode is a root wherever it is, fixed to the window", () => {
+ const out = html(<Node><Node fixed width={px(100)} /></Node>);
+ expect(out.match(/display:grid/g)?.length).toBe(2);
+ expect(out).toContain("position:fixed;left:0;top:0");
+ });
+ test("its fields as CSS: Vals, enums (Default sends nothing), UiRects in CSS's order, radii, overflow", () => {
+ const out = html(
+ <Node width={percent(50)} min_height={vw(10)} max_width={auto} flex_direction="ColumnReverse" justify_content="SpaceBetween" align_items="Default"
+ margin={UiRect.axes(px(1), px(2))} padding={UiRect.new(px(1), px(2), px(3), px(4))} border_radius={BorderRadius.top(px(6))} overflow={Overflow.clip_y()} flex_grow={2} />,
+ );
+ for (const s of ["width:50%", "min-height:10vw", "max-width:auto", "flex-direction:column-reverse", "justify-content:space-between", "margin:2px 1px 2px 1px", "padding:3px 2px 4px 1px", "border-radius:6px 6px 0px 0px", "overflow-x:visible;overflow-y:clip", "flex-grow:2"]) expect(out).toContain(s);
+ expect(out).not.toContain("align-items:normal");
+ expect(out).not.toContain("align-items:default");
+ });
+ test("a border is solid, transparent until a border_color colours it", () => {
+ expect(html(<Node border={UiRect.all(px(2))} />)).toContain("border-width:2px 2px 2px 2px;border-style:solid;border-color:transparent");
+ expect(html(<Node border={UiRect.all(px(2))} border_color={new Srgba(1, 0, 0)} />)).toContain("border-color:rgba(255, 0, 0, 1)");
+ });
+ test("a Val, an enum or an overflow that isn't Bevy's is refused", () => {
+ expect(() => html(<Node width={"10" as never} />)).toThrow(/width is a Val/);
+ expect(() => html(<Node justify_content={"Middle" as never} />)).toThrow(/justify_content is one of/);
+ expect(() => html(<Node overflow={{ x: "Clip", y: "Auto" } as never} />)).toThrow(/overflow.y/);
+ expect(() => px(Number.NaN)).toThrow(/finite/);
+ });
+});
+
+describe("Bevy's blend: translucent colours over a known backdrop in linear light", () => {
+ test("white at 0.2 over srgb 0.1 green is Bevy's (126, 164, 126), not the page's sRGB blend (72, 153, 72)", () => {
+ const out = html(<Node background_color={new Srgba(0.1, 0.5, 0.1)}><Text color={new Srgba(1, 1, 1, 0.2)}>a</Text></Node>);
+ expect(out).toContain("color:rgba(126, 164, 126, 1)");
+ });
+ test("a translucent background over an opaque one is the backdrop of what's on it", () => {
+ const out = html(
+ <Node background_color={new Srgba(0, 0, 0)}>
+ <Node background_color={new Srgba(1, 1, 1, 0.5)}><Text color={new LinearRgba(0, 0, 0, 0.5)}>a</Text></Node>
+ </Node>,
+ );
+ // linear 0.5 white is srgb 188; half of black over it, linear 0.25, is srgb 137
+ expect(out).toContain("background-color:rgba(188, 188, 188, 1)");
+ expect(out).toContain("color:rgba(137, 137, 137, 1)");
+ });
+ test("over nothing known (a root over the 3D) a translucent colour is sent as it is", () => {
+ expect(html(<Node background_color={new Srgba(1, 0, 0, 0.5)} />)).toContain("background-color:rgba(255, 0, 0, 0.5)");
+ });
+});
+
+describe("Text and TextSpan: bevy_text's defaults, and a span takes nothing from its Text", () => {
+ test("Bevy's default font at 20 px, white, line height 1.2, unsmoothed, wrapped at words", () => {
+ const out = html(<Text>hi</Text>);
+ for (const s of ['font-family:&quot;Bevy Default Font&quot;', "font-size:20px", "color:#ffffff", "line-height:1.2", "-webkit-font-smoothing:antialiased", "white-space:pre-wrap", "data:font/ttf;base64,"]) expect(out).toContain(s);
+ });
+ test("its font file, size units (Rem is bevy_text's 20 px), justify and linebreak", () => {
+ const out = html(<Text font="fonts/a.ttf" font_size={{ Rem: 2 }} justify="Center" linebreak="NoWrap" line_height={{ Px: 30 }}>hi</Text>);
+ for (const s of ["font-size:40px", "text-align:center", "white-space:pre", "line-height:30px", 'url("fonts/a.ttf")']) expect(out).toContain(s);
+ expect(html(<Text font_size={33}>x</Text>)).toContain("font-size:33px");
+ });
+ test("a TextSpan's style is its own: Bevy's defaults where it gives none, not its Text's", () => {
+ const out = html(<Text font_size={33} color={new Srgba(1, 0, 0)}>a<TextSpan>b</TextSpan></Text>);
+ expect(out).toContain("font-size:33px");
+ expect(out.match(/font-size:20px/g)?.length).toBe(1);
+ });
+ test("a size, weight, line height, justify or linebreak that isn't Bevy's is refused", () => {
+ expect(() => html(<Text font_size={0}>x</Text>)).toThrow(/above 0/);
+ expect(() => html(<Text font_size={{ Em: 2 } as never}>x</Text>)).toThrow(/font_size is/);
+ expect(() => html(<Text weight={1500}>x</Text>)).toThrow(/weight/);
+ expect(() => html(<Text line_height={{ Em: 1 } as never}>x</Text>)).toThrow(/line_height/);
+ expect(() => html(<Text justify={"Middle" as never}>x</Text>)).toThrow(/justify/);
+ expect(() => html(<Text linebreak={"Never" as never}>x</Text>)).toThrow(/linebreak/);
+ });
+});
+
+describe("ImageNode, Underline and Strikethrough", () => {
+ test("an ImageNode is its picture on a Node, filling its content box; a root one sits in its viewport", () => {
+ const out = html(<ImageNode image="branding/icon.png" width={px(256)} padding={UiRect.all(px(10))} flip_x />);
+ expect(out).toContain('<img src="branding/icon.png"');
+ for (const s of ["display:grid", "width:256px", "padding:10px 10px 10px 10px", "object-fit:fill", "transform:scaleX(-1)"]) expect(out).toContain(s);
+ expect(html(<Node><ImageNode image="a.png" color={new Srgba(0.5, 0.5, 0.5)} /></Node>)).toContain("filter:brightness(0.5)");
+ });
+ test("an ImageNode with children, a coloured tint or no picture is refused", () => {
+ expect(() => html(<ImageNode image="a.png"><Node /></ImageNode>)).toThrow(/no children/);
+ expect(() => html(<ImageNode image="a.png" color={new Srgba(1, 0, 0)} />)).toThrow(/grey/);
+ expect(() => html(<ImageNode image="" />)).toThrow(/picture file/);
+ });
+ test("Underline and Strikethrough are lines on the text; a font file's face spans every weight (a variable font's axis)", () => {
+ // inside the text's own block (the inline root Blitz draws decorations from), not on the Node around it; as thick
+ // as the font says; the block measured as bevy_text measures (whole pixels)
+ expect(html(<Text underline strikethrough>a</Text>)).toContain('<span data-raea-bevy-text="" style="white-space:pre-wrap"><span style="text-decoration-line:underline line-through;text-decoration-thickness:from-font">a</span></span>');
+ expect(html(<Text>a</Text>)).not.toContain("text-decoration");
+ // a Text's lines are its own string's: its spans aren't struck (CSS would carry them to every span inside)
+ const mixed = html(<Text strikethrough>a<TextSpan>b</TextSpan></Text>);
+ expect(mixed).toMatch(/<span style="text-decoration-line:line-through;text-decoration-thickness:from-font">a<\/span>/);
+ expect(mixed).toMatch(/<span style="[^"]*antialiased">b<\/span>/);
+ expect(mixed.split("line-through").length - 1).toBe(1);
+ // two colours of line are two spans; a span takes its own lines, colours and background
+ expect(html(<TextSpan underline strikethrough underline_color={new Srgba(1, 1, 0)} strikethrough_color={new Srgba(1, 1, 1)} text_background_color={new Srgba(0, 0, 0)}>c</TextSpan>)).toContain(
+ '<span style="background-color:rgba(0, 0, 0, 1);text-decoration-line:underline;text-decoration-thickness:from-font;text-decoration-color:rgba(255, 255, 0, 1)"><span style="text-decoration-line:line-through;text-decoration-thickness:from-font;text-decoration-color:rgba(255, 255, 255, 1)">c</span></span>',
+ );
+ expect(html(<Text font="f.ttf" weight={134}>a</Text>)).toContain('src: url("f.ttf"); font-weight: 1 1000;');
+ });
+ test("FontVariations set a variable font's axes by tag; a bad tag or value is refused", () => {
+ expect(html(<Text font="f.ttf" font_variations={{ [FontVariationTag.WEIGHT]: 300, wdth: 80 }}>a</Text>)).toContain("font-variation-settings:&quot;wght&quot; 300, &quot;wdth&quot; 80");
+ expect(html(<Text>a</Text>)).not.toContain("font-variation-settings");
+ expect(() => html(<Text font_variations={{ wg: 300 }}>a</Text>)).toThrow(/four characters/);
+ expect(() => html(<Text font_variations={{ wght: NaN }}>a</Text>)).toThrow(/is a number/);
+ });
+ test("a TextSpan's TextBackgroundColor is a box behind its run, in its own colour", () => {
+ expect(html(<Text><TextSpan text_background_color={new Srgba(1, 0, 0)}>a</TextSpan></Text>)).toMatch(/<span style="[^"]*background-color:rgba\(255, 0, 0, 1\)[^"]*">a<\/span>/);
+ expect(html(<Text><TextSpan>a</TextSpan></Text>)).not.toContain("background-color");
+ });
+ test("an Outline is a line outside the border box, its offset from it", () => {
+ expect(html(<Node outline={{ width: px(8), offset: px(2), color: new Srgba(1, 0, 0) }} />)).toContain("outline:8px solid rgba(255, 0, 0, 1);outline-offset:2px");
+ });
+ test("TextureAtlasLayout.from_grid lays cells out as Bevy's does; an atlas ImageNode shows one cell, sized by it", () => {
+ const l = TextureAtlasLayout.from_grid([24, 24], 7, 1);
+ expect(l.size).toEqual([168, 24]);
+ expect(l.textures[3]).toEqual({ x: 72, y: 0, w: 24, h: 24 });
+ // padding between cells (not after the last) and an offset before the first, which isn't in the size
+ const p = TextureAtlasLayout.from_grid([10, 10], 2, 2, [2, 3], [5, 5]);
+ expect(p.size).toEqual([22, 23]);
+ expect(p.textures[3]).toEqual({ x: 17, y: 18, w: 10, h: 10 });
+ const out = html(<ImageNode image="s.png" texture_atlas={{ layout: l, index: 2 }} />);
+ expect(out).toContain("width:24px;height:24px");
+ expect(out).toContain("left:-200%;top:0%;width:700%;height:100%");
+ expect(() => html(<ImageNode image="s.png" texture_atlas={{ layout: l, index: 7 }} />)).toThrow(/not one of its layout's 7 cells/);
+ });
+ test("ImagePlugin's default sampler: Nearest draws its pictures pixelated, Linear (the default) smooth", () => {
+ expect(html(<ImagePlugin default_sampler="Nearest"><Node><ImageNode image="a.png" /></Node></ImagePlugin>)).toContain("image-rendering:pixelated");
+ expect(html(<ImagePlugin><Node><ImageNode image="a.png" /></Node></ImagePlugin>)).not.toContain("image-rendering");
+ expect(() => html(<ImagePlugin default_sampler={"Bilinear" as never} />)).toThrow(/Linear or Nearest/);
+ });
+});
diff --git a/sdk/raea/docs/bevy-coverage.md b/sdk/raea/docs/bevy-coverage.md
index 9fcd7212..259cab93 100644
--- a/sdk/raea/docs/bevy-coverage.md
+++ b/sdk/raea/docs/bevy-coverage.md
@@ -1,4 +1,4 @@
-# Bevy through raea: what's reachable
+# Bevy through raea: what's reachable (2026-10-18)
raea draws 3D with Bevy **0.20** (pinned, with its features, in `engine/render/Cargo.toml`). Agents never write Rust: they write
TSX against `raea` and `raea/3d`, which compiles to raea-render rows (a table per kind, a column per component
@@ -17,7 +17,7 @@ The path, end to end:
## Summary
-59 features: **28 covered, 10 partial, 21 missing**. Three of the covered ones (2D text, UI, audio) are covered by the page and raea's mixer rather than by Bevy.
+59 features: **28 covered, 10 partial, 21 missing**. Three of the covered ones (2D text, UI, audio) are covered by the page and raea's mixer rather than by Bevy. This work moved 12 rows to covered: visibility, transforms, hierarchy, the perspective camera, point and spot lights, the standard material, bloom, tonemapping, fog, glTF models and their clips.
The top gaps, in the order a game or ad agent would hit them:
@@ -190,11 +190,12 @@ export declare function stepBodies(bodies: Body[], dt: number, gravity?: Vec3):
## Checks
- `sdk/raea/bench/bevy/check.sh`: every fixture (`character`, `lights`, `materials`, `model`, `planes`) rendered and played baked
- with its 3D on a layer, each at SSIM 1.000 at frames 0, 30 and 59.
-- `sdk/react/bench/timelines/check.sh` (titles: 1.000), raea-render's tests (41 pass), `sdk/raea/tools/golden.sh` 3D cases 04-06 against their frozen references (all pass),
+ with its 3D on a layer; on 2026-10-18 all four at SSIM 1.000 at frames 0, 30 and 59.
+- `sdk/react/bench/timelines/check.sh` (titles: 1.000), `engine/html/bench/parity.sh` (93 exact, 75 ok, 2 fail, as before),
+ raea-render's tests (41 pass), `sdk/raea/tools/golden.sh` 3D cases 04-06 against their frozen references (all pass),
`bun test conformance` (126 pass).
-## Existing Bevy knowledge packs
+## Existing Bevy knowledge packs (surveyed 2026-10-18)
What the skills library (`sdk/guides/craft/bevy/`, mirrored in `sdk/skills/raea-bevy/`) took from each. Nothing was
copied from a pack without a permissive license; the library is written for our SDK, so most packs informed its
diff --git a/sdk/raea/spec/motion.feature b/sdk/raea/spec/motion.feature
index aa7f65b0..53a4f24b 100644
--- a/sdk/raea/spec/motion.feature
+++ b/sdk/raea/spec/motion.feature
@@ -2,7 +2,8 @@
Feature: raea, the behaviour of its API
The spec the SDK is built from (clean-room: see sdk/raea/README.md). Written by the spec writer from public docs of
React-video libraries and from the maths; builders work from this file and the conformance suite, nothing else.
- Frames are integers from 0; a composition's frame t is time t / fps seconds.
+ Frames are integers from 0; a composition's frame t is time t / fps seconds. The order of rules follows the measured
+ surface (spec/surface.md).
Rule: A composition is a component rendered once per frame
Scenario: Declaring and registering
@@ -11,7 +12,8 @@ Feature: raea, the behaviour of its API
durationInFrames are positive integers and fps a positive number, or registering fails with a message naming
the composition and the field
And `registerRoot(Root)` names the root component the renderer starts from; calling it twice is an error
- And a root that declares no Composition (the content registered directly) is itself one composition: id "main", 30 fps, 1080x1920, durationInFrames the latest end among its
+ And a root that declares no Composition (M3 writes this in 4 of 50 compositions: the content registered
+ directly) is itself one composition: id "main", 30 fps, 1080x1920, durationInFrames the latest end among its
top-level Sequences with a finite duration, else 300
And finding the Compositions never runs a component that uses hooks: where expanding one would, the walk stops
there and treats it as content (the SDK's own clock-reading components and any whose source shows a hook call
@@ -143,7 +145,7 @@ Feature: raea, the behaviour of its API
Scenario: Media imported as modules (a renderer requirement)
Then `import take from "./media/take01.mp4"` (and .mov, .m4v, .mp3, .wav, .m4a, .png, .jpg, .webp, .gif) gives a
URL string in the form staticFile returns, resolved from the importing file's folder, usable anywhere a src
- is; the renderer's bundle step does this
+ is; the renderer's bundle step does this (M3 wrote it in 1 of 50 compositions)
And a missing file fails the build, naming the import line
Scenario: Img and staticFile
Then `<Img src>` draws an image, and the frame is not rendered until it has loaded (a failed load fails the
@@ -376,7 +378,7 @@ Feature: raea, the behaviour of its API
this frame already computed, as data-source-time in seconds, so the renderer needn't redo the timing), and
Composition and registerRoot record what was registered so a renderer can list compositions
Scenario: The test clock
- Then the main entry (raea) imports nothing that can't run inside the engine's JavaScriptCore (no server renderer, no
+ Then the main entry (raea) imports nothing that can't run inside the engine's V8 (no server renderer, no
Node APIs); `renderFrame` lives in the test entry, raea/test (src/test.tsx)
And `renderFrame(node, {frame, fps, width, height, durationInFrames, words?, perception?, input?})` renders a tree at one frame
without a window and returns what's visible, so the conformance suite can test timing without pixels; `words`
@@ -392,7 +394,7 @@ Feature: raea, the behaviour of its API
Scenario: The call
Then `native(name, args)` sends `args` as JSON to the engine's call `name` and returns its answer parsed (undefined
for an empty answer); a call the engine refuses throws an Error carrying the engine's message
- And `hasNative()` says whether the engine is present: true inside raea's JavaScriptCore runtime (raea render, run and test, the
+ And `hasNative()` says whether the engine is present: true inside raea's V8 (raea render, run and test, the
apps, the iPhone), false under plain bun, where `native` throws "<name> needs the raea engine ..."
And `print(...parts)` writes one line (strings as they are, anything else as JSON) to the run's output inside the
engine, and to the console under plain bun
@@ -611,7 +613,7 @@ Feature: raea, the behaviour of its API
encodes with sound to MP4 natively, nothing passing through JavaScript, and returns {frames, width, height, fps,
kbps, bytes}
Scenario: The proof
- Then the same conversions done through mediabunny, through raea ffmpeg and through real ffmpeg give the same
+ Then the same conversions done through mediabunny, through rrl ffmpeg and through real ffmpeg give the same
answers (sdk/raea/tools/media-vs-ffmpeg.sh): frame counts, sizes, SSIM 1.0 for remuxes, audio correlation
above 0.999
Scenario: AAC out, captions in, and what the hardware encodes
@@ -626,5 +628,5 @@ Feature: raea, the behaviour of its API
And `hardwareEncodes()` lists the video codecs this machine encodes in hardware (VideoToolbox's list); the
encoder offers H.264 where it's there, and AV1 or VP9 only where a chip encodes them
Scenario: Helpers
- Then `toBase64(bytes)` and `fromBase64(text)` convert bytes and standard base64 both ways (a bare JavaScript engine has no btoa),
+ Then `toBase64(bytes)` and `fromBase64(text)` convert bytes and standard base64 both ways (bare V8 has no btoa),
padding included, and round-trip any bytes
diff --git a/sdk/raea/src/camera.ts b/sdk/raea/src/camera.ts
index cc97ed3f..0401b9e6 100644
--- a/sdk/raea/src/camera.ts
+++ b/sdk/raea/src/camera.ts
@@ -3,6 +3,6 @@
// raea/camera (bevy_camera): cameras and the views they make.
export { Canvas3D, type Canvas3DProps } from "./3d";
export { Matchmove, useMatchmove, matchmoveView, matchmoveIndex, checkMatchmove, type MatchmoveProps, type MatchmoveSolve, type MatchmoveState, type MatchmoveCamera } from "@raea/render/matchmove";
-export { Camera3d, type Camera3dProps, type Projection } from "@raea/render/bevy3d";
+export { Camera3d, Hdr, type Camera3dProps, type Projection } from "@raea/render/bevy3d";
// a Bevy texture (a camera's target) drawn in an element (B3 H7)
export { TextureView } from "@raea/render/bevy3d";
diff --git a/sdk/raea/src/color.ts b/sdk/raea/src/color.ts
index dae3abb2..2c41ac71 100644
--- a/sdk/raea/src/color.ts
+++ b/sdk/raea/src/color.ts
@@ -2,5 +2,5 @@
// into it at M5; until then the old subpaths and this one export the same values.
// raea/color (bevy_color): colours.
export { toHex } from "./3d";
-export { Srgba, LinearRgba } from "@raea/render/bevy3d";
+export { Srgba, LinearRgba, Hsla, Oklaba, Oklcha, Xyza } from "@raea/render/bevy3d";
export { kelvin } from "@raea/render/daylight";
diff --git a/sdk/raea/src/gizmos.ts b/sdk/raea/src/gizmos.ts
index d2a496dd..35be0e83 100644
--- a/sdk/raea/src/gizmos.ts
+++ b/sdk/raea/src/gizmos.ts
@@ -1,5 +1,5 @@
// docs/sdk.feature S1b (M1): a Bevy-named entry point, re-exporting what today lives in the files named. Sources move
// into it at M5; until then the old subpaths and this one export the same values.
// raea/gizmos (bevy_gizmos): lines drawn for looking, and debug overlays.
-export { Gizmo, type GizmoProps } from "./3d";
+export { Gizmo, type GizmoProps, type GizmoColor } from "./3d";
export * from "@raea/video/overlay";
diff --git a/sdk/raea/src/index.tsx b/sdk/raea/src/index.tsx
index 731d8ee4..84389b28 100644
--- a/sdk/raea/src/index.tsx
+++ b/sdk/raea/src/index.tsx
@@ -8,6 +8,7 @@ export { interpolate, type ExtrapolateMode, type InterpolateOptions } from "@rae
export { spring, measureSpring, type SpringConfig, type SpringOptions } from "@raea/math/spring";
export {
Clock,
+ tickClocks,
useCurrentFrame,
useVideoConfig,
type ClockProps,
diff --git a/sdk/raea/src/light.ts b/sdk/raea/src/light.ts
index 94392f0e..95dce114 100644
--- a/sdk/raea/src/light.ts
+++ b/sdk/raea/src/light.ts
@@ -3,7 +3,7 @@
// raea/light (bevy_light): Bevy's lights in Bevy's units (lux, lumens, cd/m²; bevy3d.tsx), environments and
// daylight. 3d.tsx's lights, in raea's relative units, stay under /3d.
export { AmbientLight, GlobalAmbientLight, DirectionalLight, PointLight, SpotLight, RectLight, light_consts, type AmbientLightProps, type DirectionalLightProps, type PointLightProps, type SpotLightProps, type RectLightProps } from "@raea/render/bevy3d";
-export { Atmosphere, Environment, EnvironmentMapLight, Shadows, type AtmosphereProps, type EnvironmentProps, type EnvironmentMapLightProps, type ShadowsProps } from "./3d";
+export { Atmosphere, Environment, EnvironmentMapLight, Skybox, Shadows, type AtmosphereProps, type EnvironmentProps, type EnvironmentMapLightProps, type SkyboxProps, type ShadowsProps } from "./3d";
export * from "@raea/render/daylight";
// ray-traced lighting (Bevy's Solari, docs/raytracing.feature RT3)
export { SolariLighting, Pathtracer, type SolariLightingProps, type PathtracerProps } from "@raea/render/bevy3d";
diff --git a/sdk/raea/src/native-calls.ts b/sdk/raea/src/native-calls.ts
index 83d8c05d..31a00285 100644
--- a/sdk/raea/src/native-calls.ts
+++ b/sdk/raea/src/native-calls.ts
@@ -180,6 +180,8 @@ export interface NativeCalls {
"physics.goo": { args: { spec: Record<string, unknown> }; answer: { file: string; stats: Record<string, unknown> } };
/** glTF nodes cut out as their own .glb (where they stood), optionally with one material over them (kept in the asset store) */
"physics.part": { args: { src: string; nodes: string[]; material?: { missing?: boolean; color?: string; emissive?: string; opacity?: number; roughness?: number; unlit?: boolean } }; answer: { file: string; centre: [number, number, number]; lo: [number, number, number]; hi: [number, number, number]; tris: number } };
+ /** boxes placed by relations (on, against, beside, near, apart, facing, align, clear), what can't hold found */
+ "place.solve": { args: { objects: { id: string; size: [number, number, number]; at?: [number, number, number]; yaw?: number; fixed?: boolean }[]; rules: Record<string, string | number>[]; room?: { min: [number, number]; max: [number, number] } }; answer: { objects: { id: string; at: [number, number, number]; yaw: number; size: [number, number, number] }[]; found: { part: string; check: string; level: string; says: string }[]; errors: number } };
/** one line of a headless run's output */
"print": { args: { text: string }; answer: null };
/** the window settings set so far */
diff --git a/sdk/raea/src/pbr.ts b/sdk/raea/src/pbr.ts
index dbf14be0..2797a62d 100644
--- a/sdk/raea/src/pbr.ts
+++ b/sdk/raea/src/pbr.ts
@@ -4,4 +4,8 @@
export { SurfaceShader, ThreeShaderMaterial, type ThreeShaderMaterialProps, Refinish, Fog, VolumetricFog, FogVolume, Fire, Decal, ShaderMesh, AmbientOcclusion, type SurfaceShaderSpec, type SurfaceDrawProps, type ToonBand, type ToonRim, type ToonHighlight, type ToonOutline, type FogProps, type VolumetricFogProps, type FogVolumeProps, type FireProps, type DecalProps, type ShaderMeshProps, type AmbientOcclusionProps } from "./3d";
export * from "@raea/render/splat";
export * from "@raea/render/paint";
-export { StandardMaterial, ExtendedMaterial, ToonMaterial, type ToonMaterialProps, GridExtension, PaintExtension, WearExtension, ToonExtension, ShaderExtension, type StandardMaterialProps, type StandardMaterialAnimate, type ToonExtensionAnimate, type ExtendedMaterialProps, type GridExtensionProps, type PaintExtensionProps, type WearExtensionProps, type ToonExtensionProps, type ShaderExtensionProps, type AlphaMode, type SampledImage, type MetallicRoughnessMaps } from "@raea/render/bevy3d";
+export { StandardMaterial, ExtendedMaterial, ToonMaterial, type ToonMaterialProps, GridExtension, PaintExtension, WearExtension, ProceduralExtension, ToonExtension, ShaderExtension, type StandardMaterialProps, type StandardMaterialAnimate, type ToonExtensionAnimate, type ExtendedMaterialProps, type GridExtensionProps, type PaintExtensionProps, type WearExtensionProps, type ProceduralExtensionProps, type ToonExtensionProps, type ShaderExtensionProps, type AlphaMode, type SampledImage, type MetallicRoughnessMaps } from "@raea/render/bevy3d";
+// FogFalloff (bevy_pbr::fog): Bevy's falloff constructors, for a <Fog> inside the <Camera3d>
+export { FogFalloff } from "@raea/render/bevy3d";
+// Lightmap (bevy_pbr::lightmap): a bake on a <Model>'s glTF meshes, by the mesh's name
+export { Lightmap, type LightmapProps } from "@raea/render/bevy3d";
diff --git a/sdk/raea/src/sprite.ts b/sdk/raea/src/sprite.ts
index ea10db71..81caf001 100644
--- a/sdk/raea/src/sprite.ts
+++ b/sdk/raea/src/sprite.ts
@@ -1,4 +1,4 @@
// docs/sdk.feature S1b: a Bevy-named entry point.
// raea/sprite (bevy_sprite): 2D pictures and flat shapes over the 3D, drawn by a 2D camera of their own (S3c).
-export { Sprite, Shape2D, type SpriteProps, type Shape2DProps, type Place2dProps } from "@raea/render/3d/sprite";
-export { Mesh2d, Circle, Rectangle, Ellipse, RegularPolygon, ColorMaterial, type Mesh2dProps, type CircleProps, type RectangleProps, type EllipseProps, type RegularPolygonProps, type ColorMaterialProps } from "@raea/render/bevy3d";
+export { Sprite, Shape2D, type SpriteProps, type Shape2DProps, type Place2dProps, type AlphaMode2d } from "@raea/render/3d/sprite";
+export { Mesh2d, Circle, Rectangle, Ellipse, RegularPolygon, ColorMaterial, type Mesh2dProps, type CircleProps, type RectangleProps, type EllipseProps, type RegularPolygonProps, type ColorMaterialProps, type MeshAttributes } from "@raea/render/bevy3d";
diff --git a/sdk/raea/src/ui.ts b/sdk/raea/src/ui.ts
index f01d74a4..6c1daa29 100644
--- a/sdk/raea/src/ui.ts
+++ b/sdk/raea/src/ui.ts
@@ -5,3 +5,5 @@ export { AbsoluteFill, type AbsoluteFillProps } from "@raea/video/timeline";
export * from "@raea/video/region";
// InputRegion (input-region.tsx) joins when it is committed
export * from "@raea/video/panel";
+// bevy_ui's Node and Text, and bevy_text's TextSpan, with their values (Val, UiRect, BorderRadius, Overflow)
+export { Node, Text, TextSpan, ImageNode, ImagePlugin, FontVariationTag, TextureAtlasLayout, type ImageNodeProps, px, percent, vw, vh, vmin, vmax, auto, UiRect, BorderRadius, Overflow, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type Val } from "@raea/render/bevy3d";
diff --git a/sdk/raea/tools/golden.sh b/sdk/raea/tools/golden.sh
index 48f921e8..438f9955 100755
--- a/sdk/raea/tools/golden.sh
+++ b/sdk/raea/tools/golden.sh
@@ -3,7 +3,7 @@
# frames, which must agree to its ssim_min with the case's reference frames (reference/fNNNN.png): the retired rrl
# stack's renders of the case's edit.rrl, frozen on 2026-10-17 when rrl was deleted (03-video-take's stay local, since
# its footage is), or renders the user approved (reference/APPROVED). The SDK's renderer is RAEA_RENDER
-# (an agent session, first slice 2026-10-22), called as: $RAEA_RENDER EDIT.tsx --frame N -o OUT.png
+# (its first slice, 2026-10-22), called as: $RAEA_RENDER EDIT.tsx --frame N -o OUT.png
# Real ffmpeg does the comparison, so the grader doesn't depend on what it grades.
# A case with reference/APPROVED compares against those frames, which the user approved; editing them needs a new approval.
# Usage: sdk/raea/tools/golden.sh [CASE_DIR ...] (default: every case)
diff --git a/sdk/react/bench/corpus/list.txt b/sdk/react/bench/corpus/list.txt
index e74e5abb..fb0f5873 100644
--- a/sdk/react/bench/corpus/list.txt
+++ b/sdk/react/bench/corpus/list.txt
@@ -1,6 +1,6 @@
# The corpus run.sh runs: one edit per line, repo-relative, or ~/... for the legacy app's eval spaces (untracked agent output that
# lives only on this Mac; run.sh prints SKIP where it's missing). Footage is never committed: the s2sdk edits read
-# score/bench/out/s2sdk/*/media -> apps/legacy/shell/evals/fixtures/real/media -> engine/media/real (links into ~/.raea-feed/media,
+# score/bench/out/s2sdk/*/media -> apps/legacy/shell/evals/fixtures/real/media -> engine/media/real (links into ~/.ed/media,
# ~/Downloads and eval runs), and the eval spaces read their own media/ folders.
# fixtures in git
@@ -10,7 +10,6 @@ sdk/react/bench/games/platformer/edit.tsx
sdk/react/bench/games/tones/edit.tsx
sdk/raea/conformance/golden/01-card-fade/edit.tsx
sdk/raea/conformance/golden/02-sequence-timing/edit.tsx
-sdk/raea/conformance/golden/03-video-take/edit.tsx
sdk/raea/conformance/golden/04-mesh-sign/edit.tsx
sdk/raea/conformance/golden/05-world-solid/edit.tsx
sdk/raea/conformance/golden/06-world-entities/edit.tsx
@@ -19,35 +18,7 @@ sdk/react/bench/corpus/fixtures/deck/edit.tsx
sdk/react/bench/corpus/fixtures/box3d/edit.tsx
# ad edits on real footage with captions and parts (score's SDK backend from agent-written briefs; export const config)
-ai/score/bench/out/s2sdk/c8_brief_full/client-a/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-a/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-b/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-e/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-e/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-1/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-2/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-c/edit.tsx
-ai/score/bench/out/s2sdk/c8_brief_full/client-d/edit.tsx
-ai/score/bench/out/s2sdk/i7_ink_loop/client-3/edit.tsx
-ai/score/bench/out/s2sdk/c3_xsheet/client-b.9x16/edit.tsx
# the legacy app agents' own TSX (eval spaces): ads with FaceFrame/ScreenFit parts, captions, slides, an app promo
-~/.raea-feed/evals/runs/20261017-ts-nemotron/app--a-15-second-arock-promo/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-ts-nemotron/app--a-30-second-jetflow-explainer/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-ts-nemotron/ugc--client-a/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-ts-nemotron/ugc--best-delivery-across-takes/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-ts-nemotron/ugc--every-agency-is-a-state-machine/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-ts-nemotron/ugc--automate-vs-simulate-as-a-designed-moment/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-ts-smoke/ugc--client-a/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-project/project--a-ugc-ad-that-needs-the-person-s-call/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm2/project--a-ugc-ad-that-needs-the-person-s-call/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm3/project--a-ugc-ad-that-needs-the-person-s-call/spaces/eval/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm3/project--an-ad-and-a-game-in-one-project-switching-between-them/spaces/eval/edit.tsx
# the legacy app agents' games (and scripted matches)
-~/.raea-feed/evals/runs/20261017-project/project--pong-a-change-and-back-to-the-first-version/spaces/pong/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm/project--an-ad-and-a-game-in-one-project-switching-between-them/spaces/pong/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm2/project--an-ad-and-a-game-in-one-project-switching-between-them/spaces/pong/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm3/project--an-ad-and-a-game-in-one-project-switching-between-them/spaces/pong/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm/project--pong-a-change-and-back-to-the-first-version/spaces/pong/edit.tsx
-~/.raea-feed/evals/runs/20261017-project-glm3/project--pong-a-change-and-back-to-the-first-version/spaces/pong/edit.tsx
diff --git a/sdk/react/bench/games/seedling/assets b/sdk/react/bench/games/seedling/assets
new file mode 120000
index 00000000..2c1d5957
--- /dev/null
+++ b/sdk/react/bench/games/seedling/assets
@@ -0,0 +1 @@
+../pong/assets
\ No newline at end of file
diff --git a/sdk/react/bench/games/seedling/pong b/sdk/react/bench/games/seedling/pong
new file mode 120000
index 00000000..efada472
--- /dev/null
+++ b/sdk/react/bench/games/seedling/pong
@@ -0,0 +1 @@
+../pong
\ No newline at end of file
diff --git a/sdk/react/docs/audio-stack.md b/sdk/react/docs/audio-stack.md
index fdc7a387..0377c125 100644
--- a/sdk/react/docs/audio-stack.md
+++ b/sdk/react/docs/audio-stack.md
@@ -3,7 +3,7 @@
What reaches a speaker or a file is PCM from one mixer core. That core runs live in the device's callback and offline
as a render's bounce, so a render and a play of the same frames give the same samples by construction. Neural models
never sit in that path. Generated sound is rendered once, cached as PCM keyed by its inputs, and enters as an ordinary
-clip. Separately, frozen encoders turn sound into symbols and bits for the meaning lane (the HDC sandwich, docs/the roadmap
+clip. Separately, frozen encoders turn sound into symbols and bits for the meaning lane (the HDC sandwich, docs/goal.feature
Track K).
This document covers:
diff --git a/sdk/react/docs/state-machines.md b/sdk/react/docs/state-machines.md
index e25db63c..98787b52 100644
--- a/sdk/react/docs/state-machines.md
+++ b/sdk/react/docs/state-machines.md
@@ -139,7 +139,7 @@ the snapshot as plain JSON (a workflow resumes from any step, as a game resumes
rules, which already take "progress" as a number the host supplies (the platformer's x; a workflow's passed checks).
What a workflow would add is outside the step: an async loop that asks clef or a person at a choice point, appends the
answer to the decision log, and steps the machine with `replayDecider`. That keeps the machine pure and the run
-replayable from its log. The legacy app's agent loop belongs to raea-01, and nothing here touches it.
+replayable from its log. The legacy app's agent loop is its own, and nothing here touches it.
## Is XState needed? (assessment, 2026-10-18)
diff --git a/sdk/react/tw/tw.ts b/sdk/react/tw/tw.ts
index 7b9050a1..c8e1c276 100644
--- a/sdk/react/tw/tw.ts
+++ b/sdk/react/tw/tw.ts
@@ -1,4 +1,4 @@
-// bun tw.ts COMP.tsx: the CSS for the Tailwind classes a component uses (Tailwind 4.3.3, the host app's kit's version), for
+// bun tw.ts COMP.tsx: the CSS for the Tailwind classes a component uses (Tailwind 4.3.3), for
// void's `component` tool to put in a <style> beside it (raea-runtime-react's Blitz honours inline <style>, not <link>).
// Class candidates are every whitespace-separated token in the file's string literals; Tailwind ignores the rest.
import { compile } from "tailwindcss";
diff --git a/sdk/render/node_modules b/sdk/render/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/render/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/render/src/3d.tsx b/sdk/render/src/3d.tsx
index 2a6bfefa..5cdcc0fc 100644
--- a/sdk/render/src/3d.tsx
+++ b/sdk/render/src/3d.tsx
@@ -2,10 +2,14 @@
// carries its name (data-3d) and props (data-props, JSON) for Bevy to draw; a Mesh also carries its Manifold
// expression (data-shape). Engine-safe: this module imports nothing beyond React.
import { toHex } from "./colour";
-export { Canvas3D, Cuboid, Sphere, Plane3d, Cylinder, Torus, Cone, Capsule, Capsule3d, BufferMesh, Text3D, SurfaceShader, ThreeShaderMaterial, surfaceShader, samplerSpec, FramePass, Compute, Atmosphere, eulerOf, Entity, Refinish, clipEvents, Model, ImagePlane, surfaceTurn, Decal, Plate, Bloom, Fog, ToneMapping, Grade, Environment, EnvironmentMapLight, AmbientOcclusion, AntiAliasing, Shadows, VolumetricFog, FogVolume, Fire, dofOf, DepthOfField, Outline, Fisheye, LensDistortion, MotionBlur, checkPass, Look, Scene, Entities, BevyComponent, Gizmo, ShaderMesh, BevyResource, Span, RichText, Instances, scatter, Grass } from "./3d/all";
-export type { Vec3, Canvas3DProps, CuboidProps, SphereProps, CylinderProps, TorusProps, Plane3dProps, ConeProps, CapsuleProps, Capsule3dProps, BufferMeshProps, Text3DProps, Animate3d, SurfaceDrawProps, ToonBand, ToonRim, ToonHighlight, ToonOutline, SurfaceShaderSpec, ThreeShaderMaterialProps, ThreeUniform, SamplerSpec, SamplerWrap, FramePassProps, ComputeProps, AtmosphereProps, BevyParts, EntityProps, ModelProps, AnimGraphNode, ImagePlaneProps, DecalProps, PlateProps, BloomProps, FogProps, ToneMappingProps, GradeSection, GradeProps, EnvironmentProps, EnvironmentMapLightProps, AmbientOcclusionProps, AntiAliasingProps, ShadowsProps, VolumetricFogProps, FogVolumeProps, FireProps, DepthOfFieldProps, OutlineProps, LensCommon, FisheyeProps, LensDistortionProps, MotionBlurProps, LookProps, LookPass, SceneProps, BevyComponentProps, GizmoProps, ShaderMeshProps, SpanProps, GlyphInfo, GlyphStyle, RichTextProps, Instance, InstancesProps, PlanBox, ScatterOptions, GrassProps, GrassLod } from "./3d/all";
+export { Canvas3D, Cuboid, Sphere, Plane3d, Cylinder, Torus, Cone, Capsule, Capsule3d, BufferMesh, Text3D, SurfaceShader, ThreeShaderMaterial, surfaceShader, samplerSpec, FramePass, Compute, Atmosphere, eulerOf, Entity, Refinish, clipEvents, Model, ImagePlane, surfaceTurn, Decal, Plate, Bloom, Fog, ToneMapping, Grade, Environment, EnvironmentMapLight, Skybox, AmbientOcclusion, AntiAliasing, Shadows, VolumetricFog, FogVolume, Fire, dofOf, DepthOfField, Outline, Fisheye, LensDistortion, MotionBlur, checkPass, Look, Scene, Entities, BevyComponent, Gizmo, ShaderMesh, BevyResource, Span, RichText, Instances, scatter, Grass } from "./3d/all";
+export type { Vec3, Canvas3DProps, CuboidProps, SphereProps, CylinderProps, TorusProps, Plane3dProps, ConeProps, CapsuleProps, Capsule3dProps, BufferMeshProps, Text3DProps, Animate3d, SurfaceDrawProps, ToonBand, ToonRim, ToonHighlight, ToonOutline, SurfaceShaderSpec, ThreeShaderMaterialProps, ThreeUniform, SamplerSpec, SamplerWrap, FramePassProps, ComputeProps, AtmosphereProps, BevyParts, EntityProps, ModelProps, AnimGraphNode, ImagePlaneProps, DecalProps, PlateProps, BloomProps, FogProps, FogColor, FogFalloff, ToneMappingProps, GradeSection, GradeProps, EnvironmentProps, EnvironmentMapLightProps, SkyboxProps, AmbientOcclusionProps, AntiAliasingProps, ShadowsProps, VolumetricFogProps, FogVolumeProps, FireProps, DepthOfFieldProps, OutlineProps, LensCommon, FisheyeProps, LensDistortionProps, MotionBlurProps, LookProps, LookPass, SceneProps, BevyComponentProps, GizmoProps, ShaderMeshProps, SpanProps, GlyphInfo, GlyphStyle, RichTextProps, Instance, InstancesProps, PlanBox, ScatterOptions, GrassProps, GrassLod } from "./3d/all";
export { CrossSection, crossSection, manifold, outline, Solid, type Bounds, type Polygons, type Section } from "./solid";
+// blended distance fields and generated growth (trees, lofts, terrain, boulders, rosettes), as Solids (grow.ts)
+export { Field, sdf, grow, type TreeOptions, type LoftOutline } from "./grow";
+// placement by relations, solved natively (place.ts)
+export { place, type PlaceRule, type PlaceObject, type Placed, type Layout, type PlaceFinding } from "./place";
export { Volume, type VolumeProps, type VolumeSource, type VolumeCommon } from "./paint";
@@ -24,4 +28,5 @@ export { Matchmove, useMatchmove, matchmoveView, matchmoveIndex, checkMatchmove,
export { toHex };
// 2D over the 3D (docs/sdk.feature S3c)
export { Sprite, Shape2D } from "./3d/all";
-export type { Place2dProps, SpriteProps, Shape2DProps } from "./3d/all";
+export type { Place2dProps, SpriteProps, Shape2DProps, AlphaMode2d } from "./3d/all";
+export type { GizmoColor } from "./3d/all";
diff --git a/sdk/render/src/3d/bevy.tsx b/sdk/render/src/3d/bevy.tsx
index e6cbfd1b..4783c9b3 100644
--- a/sdk/render/src/3d/bevy.tsx
+++ b/sdk/render/src/3d/bevy.tsx
@@ -21,13 +21,37 @@ export function BevyComponent(props: BevyComponentProps) {
return node3d("BevyComponent", { type: props.type, value: props.value ?? null, ...(props.from ? { from: props.from } : {}) });
}
+/** a gizmo point's colour: "#rrggbb", linear [r, g, b, a], or Bevy's LinearRgba / Srgba (bevy3d's colours) */
+export type GizmoColor = string | [number, number, number, number] | { red: number; green: number; blue: number; alpha?: number };
+
+/** bevy_color's sRGB to linear for one channel (at or below 0 kept, as Bevy's gamma function does) */
+const toLinear = (c: number) => (c <= 0 ? c : c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
+
+/** what fields.rs's gizmo_asset reads: the hex as it is, anything else linear [r, g, b, a] */
+function gizmoColour(c: GizmoColor): string | number[] {
+ if (typeof c === "string") {
+ if (!/^#?[0-9a-f]{6}([0-9a-f]{2})?$/i.test(c)) throw new TypeError(`Gizmo: a colour string is "#rrggbb", got ${JSON.stringify(c)}`);
+ return c;
+ }
+ if (Array.isArray(c)) {
+ if (c.length !== 4 || !c.every(Number.isFinite)) throw new TypeError(`Gizmo: a colour array is linear [r, g, b, a], got ${JSON.stringify(c)}`);
+ return c;
+ }
+ if (!c || ![c.red, c.green, c.blue].every(Number.isFinite)) throw new TypeError(`Gizmo: a colour is "#rrggbb", [r, g, b, a] or a LinearRgba / Srgba, got ${JSON.stringify(c)}`);
+ // Srgba (it has to_hex) is gamma-encoded; LinearRgba is as the gizmo takes it
+ const srgb = typeof (c as { to_hex?: unknown }).to_hex === "function";
+ const ch = srgb ? [toLinear(c.red), toLinear(c.green), toLinear(c.blue)] : [c.red, c.green, c.blue];
+ return [...ch, c.alpha ?? 1];
+}
+
export interface GizmoProps {
/** segments, each [from, to] */
lines?: [Vec3, Vec3][];
/** one line through these points (null breaks it) */
strip?: (Vec3 | null)[];
- /** "#rrggbb" for every point, or one per point of `lines` (two per segment) then `strip` */
- color?: string | string[];
+ /** one colour for every point, or one per point of `lines` (two per segment) then `strip`: "#rrggbb", Bevy's
+ * LinearRgba (above 1 for HDR, as bevy_gizmos takes it) or Srgba, or linear [r, g, b, a] */
+ color?: GizmoColor | GizmoColor[];
/** line width in pixels (Bevy's default 2) */
width?: number;
/** -1 always in front of geometry, 0 depth-tested as it is (Bevy's GizmoLineConfig and depth_bias) */
@@ -50,12 +74,14 @@ export function Gizmo({ lines = [], strip = [], color = "#ffffff", width, depthB
if (width !== undefined && !(width > 0 && Number.isFinite(width))) throw new RangeError(`Gizmo: width is in pixels, above 0, got ${width}`);
if (depthBias !== undefined && !(depthBias >= -1 && depthBias <= 1)) throw new RangeError(`Gizmo: depthBias is -1 to 1, got ${depthBias}`);
const n = lines.length * 2;
- const colours = typeof color === "string" ? null : color;
+ // one colour, or a list of them (an array of numbers is one linear colour)
+ const list = Array.isArray(color) && !color.every((x) => typeof x === "number");
+ const colours = list ? (color as GizmoColor[]).map(gizmoColour) : null;
if (colours && colours.length !== n + strip.length) throw new RangeError(`Gizmo: color lists one colour per point (${n + strip.length}), got ${colours.length}`);
const handle: Record<string, unknown> = {
list_positions: lines.flat(),
strip_positions: strip,
- ...(colours ? { list_colors: colours.slice(0, n), strip_colors: colours.slice(n) } : { color }),
+ ...(colours ? { list_colors: colours.slice(0, n), strip_colors: colours.slice(n) } : { color: gizmoColour(color as GizmoColor) }),
};
const value: Record<string, unknown> = { handle };
if (width !== undefined) value.line_config = { width };
diff --git a/sdk/render/src/3d/effects.tsx b/sdk/render/src/3d/effects.tsx
index 9f5638a9..1b30ea08 100644
--- a/sdk/render/src/3d/effects.tsx
+++ b/sdk/render/src/3d/effects.tsx
@@ -130,20 +130,43 @@ export function Bloom(props: BloomProps) {
return node3d("Bloom", props as Record<string, unknown>);
}
+/** a fog colour: "#rrggbb" (or #rrggbbaa), or Bevy's Srgba or LinearRgba (raea/color) */
+export type FogColor = string | { red: number; green: number; blue: number; alpha: number };
+
+/** bevy_pbr's FogFalloff as it reflects; FogFalloff's constructors (raea/pbr) make one from a visibility distance */
+export type FogFalloff =
+ | { Linear: { start: number; end: number } }
+ | { Exponential: { density: number } }
+ | { ExponentialSquared: { density: number } }
+ | { Atmospheric: { extinction: [number, number, number]; inscattering: [number, number, number] } };
+
export interface FogProps {
- /** hex; match the background so far things fade into it */
- color?: string;
- /** linear fog from `near` to `far` (5 and 20 by default) */
+ /** what far things fade into: match the background */
+ color?: FogColor;
+ /** linear fog from `near` to `far` (in the Canvas3D 5 and 20 by default; on the camera Bevy's 0 and 100) */
near?: number;
far?: number;
/** or exponential fog of this density (0.05-0.3), instead of near and far */
density?: number;
+ /** on the camera: Bevy's FogFalloff, in place of near, far and density (Bevy's default Linear 0 to 100) */
+ falloff?: FogFalloff;
+ /** on the camera: the sun's colour in the fog looking towards it, its alpha its strength (Bevy's default none) */
+ directional_light_color?: FogColor;
+ /** on the camera: how tight the sun's glow is (Bevy's default 8) */
+ directional_light_exponent?: number;
}
-/** Distance fog: far things fade into `color`. Put it inside the Canvas3D.
+/** Distance fog: far things fade into `color`. Inside the <Camera3d> it is Bevy's DistanceFog on that camera, with all of
+ * Bevy's fields (an atmospheric falloff, the sun's colour); inside the Canvas3D it fogs the scene's camera by near, far
+ * or density.
* @bevy bevy_pbr::fog::DistanceFog */
export function Fog(props: FogProps) {
- return node3d("Fog", colours("Fog", props as Record<string, unknown>, ["color"]));
+ const bevy = (["falloff", "directional_light_color", "directional_light_exponent"] as const).filter((k) => props[k] !== undefined);
+ if (bevy.length) throw new TypeError(`Fog: ${bevy.join(", ")} need the <Fog> inside the <Camera3d> it fogs, where it is Bevy's DistanceFog`);
+ const c = props.color;
+ // Bevy's colours to the hex the scene's fog reads: an Srgba as its to_hex, a LinearRgba through its to_srgba
+ const color = c === undefined || typeof c === "string" ? c : (("to_srgba" in c ? (c as { to_srgba(): { to_hex(): string } }).to_srgba() : c) as { to_hex(): string }).to_hex();
+ return node3d("Fog", colours("Fog", (color === undefined ? props : { ...props, color }) as Record<string, unknown>, ["color"]));
}
export interface ToneMappingProps {
@@ -226,7 +249,7 @@ export interface EnvironmentProps {
* frame; its src, intensity, rotation and background may change from frame to frame (a cut from a hall to a street).
* Bevy's EnvironmentMapLight with maps already filtered is <EnvironmentMapLight>.
* Its panorama is filtered by Bevy's generator and, with `background`, drawn as the sky (engine/render
- * environment.rs): @bevy bevy_light::probe::GeneratedEnvironmentMapLight @bevy bevy_light::probe::Skybox */
+ * environment.rs): @bevy bevy_light::probe::GeneratedEnvironmentMapLight. Bevy's Skybox from its own cubemap is <Skybox>. */
export function Environment(props: EnvironmentProps) {
if (typeof props.src !== "string" || props.src === "") throw new TypeError(`Environment: src must be a panorama's path, staticFile("sky.hdr"), got ${JSON.stringify(props.src)}`);
if (!/\.(hdr|exr|png|jpe?g)$/i.test(props.src.split("?")[0])) throw new TypeError(`Environment: src must be an equirectangular .hdr, .exr, .png or .jpg, got ${JSON.stringify(props.src)}`);
@@ -245,6 +268,14 @@ export interface EnvironmentMapLightProps {
specular_map: string;
/** cd/m² (Bevy's default 1) */
intensity?: number;
+ /** its turn, glam's Quat [x, y, z, w] (Bevy's identity): Quat.from_rotation_y(0.2 * t) turns it each frame */
+ rotation?: [number, number, number, number];
+}
+
+/** a rotation as glam's Quat, unit length */
+function checkQuat(who: string, q: unknown) {
+ if (q === undefined) return;
+ if (!(Array.isArray(q) && q.length === 4 && q.every((x) => typeof x === "number" && Number.isFinite(x)) && Math.abs(Math.hypot(...q) - 1) < 1e-3)) throw new TypeError(`${who}: rotation is a unit Quat [x, y, z, w], got ${JSON.stringify(q)}`);
}
/** Bevy's EnvironmentMapLight with its own prefiltered maps, as Bevy's examples put one on the camera (docs/control.feature
@@ -256,7 +287,29 @@ export function EnvironmentMapLight(props: EnvironmentMapLightProps) {
if (typeof props[k] !== "string" || !/\.ktx2$/i.test(props[k])) throw new TypeError(`EnvironmentMapLight: ${k} is a prefiltered cubemap's .ktx2 file, got ${JSON.stringify(props[k])}`);
}
if (props.intensity !== undefined && !(typeof props.intensity === "number" && props.intensity >= 0 && Number.isFinite(props.intensity))) throw new RangeError(`EnvironmentMapLight: intensity is cd/m², 0 or more, got ${props.intensity}`);
- return node3d("Environment", { diffuse_map: assetPath(props.diffuse_map), specular_map: assetPath(props.specular_map), intensity: props.intensity ?? 1 });
+ checkQuat("EnvironmentMapLight", props.rotation);
+ return node3d("Environment", { diffuse_map: assetPath(props.diffuse_map), specular_map: assetPath(props.specular_map), intensity: props.intensity ?? 1, ...(props.rotation ? { rotation: props.rotation } : {}) });
+}
+
+export interface SkyboxProps {
+ /** the sky's cubemap, a .ktx2 file (Bevy's examples use the specular map: environment_maps/pisa_specular_rgb9e5_zstd.ktx2) */
+ image: string;
+ /** cd/m² (Bevy's default 0, a black sky: Bevy's examples give it 1000 to 5000) */
+ brightness?: number;
+ /** its turn, glam's Quat [x, y, z, w] (Bevy's identity) */
+ rotation?: [number, number, number, number];
+}
+
+/** Bevy's Skybox: a cubemap drawn behind everything, as Bevy's examples put one on the camera. Put it inside the
+ * Canvas3D, once; its brightness and rotation may change each frame (an <Environment>'s `background` is the sky of
+ * a panorama raea filters).
+ * @bevy bevy_light::probe::Skybox */
+export function Skybox(props: SkyboxProps) {
+ if (typeof props.image !== "string" || !/\.ktx2$/i.test(props.image)) throw new TypeError(`Skybox: image is a cubemap's .ktx2 file, got ${JSON.stringify(props.image)}`);
+ const b = props.brightness ?? 0;
+ if (!(typeof b === "number" && b >= 0 && Number.isFinite(b))) throw new RangeError(`Skybox: brightness is cd/m², 0 or more, got ${b}`);
+ checkQuat("Skybox", props.rotation);
+ return node3d("Skybox", { image: assetPath(props.image), brightness: b, ...(props.rotation ? { rotation: props.rotation } : {}) });
}
export interface AmbientOcclusionProps {
diff --git a/sdk/render/src/3d/materials.tsx b/sdk/render/src/3d/materials.tsx
index ca9da7d0..205b1cdc 100644
--- a/sdk/render/src/3d/materials.tsx
+++ b/sdk/render/src/3d/materials.tsx
@@ -1,6 +1,6 @@
// Materials: surfaces drawn on, standard and physical materials, toon bands and outlines.
import { toHex } from "../colour";
-import { checkOverlays, type GridOverlay, type PaintOverlay, type WearOverlay } from "../overlays";
+import { checkOverlays, type GridOverlay, type PaintOverlay, type ProceduralSurface, type WearOverlay } from "../overlays";
import { useAnimation3d } from "@raea/math/animate";
import { Animate3d, apply3d, node3d } from "./all";
@@ -62,6 +62,8 @@ export interface MeshStandardMaterialProps extends SurfaceDrawProps {
paint?: PaintOverlay;
/** a worn surface, fixed on the part as it moves (systems/wear): WearOverlay, overlays.ts */
wear?: WearOverlay;
+ /** a pattern made on the GPU with dust, dirt and worn edges (systems/procmat): ProceduralSurface, overlays.ts */
+ procedural?: ProceduralSurface;
/** how its maps are read (docs/shaders.feature SH5): { filter: "nearest" } for hard pixels */
sampler?: SamplerSpec;
/** one map's sampler, over `sampler`, by its prop name */
diff --git a/sdk/render/src/3d/shapes.tsx b/sdk/render/src/3d/shapes.tsx
index b35764a5..cde2dfeb 100644
--- a/sdk/render/src/3d/shapes.tsx
+++ b/sdk/render/src/3d/shapes.tsx
@@ -156,9 +156,13 @@ export function Plane3d(props: Plane3dProps) {
return args.length === 2 ? <Plane {...rest} args={args as [number, number]} /> : <Box {...rest} args={args as [number, number, number]} />;
}
+// plane(nx, ny, nz, w, h): one face, as Bevy's PlaneMeshBuilder makes it (systems/material mesh.rs), where a box with no
+// depth has two (mesh_ray_cast's box of inward planes, seen from outside, drew its near walls); its Manifold is that box
GEOMETRY_SHAPES.set(Plane3d, (props) => {
- const a = planeArgs(props as Plane3dProps);
- return a.length === 2 ? `box(${list(a)}, 0)` : `box(${list(a)})`;
+ const p = props as Plane3dProps;
+ planeArgs(p);
+ const [hx, hy] = p.half_size ?? [0.5, 0.5];
+ return `plane(${list([...(p.normal ?? [0, 1, 0]), 2 * hx, 2 * hy])})`;
});
GEOMETRY_BOUNDS.set(Plane3d, (props) => {
diff --git a/sdk/render/src/3d/sprite.tsx b/sdk/render/src/3d/sprite.tsx
index 30bdc01b..7ea92574 100644
--- a/sdk/render/src/3d/sprite.tsx
+++ b/sdk/render/src/3d/sprite.tsx
@@ -69,10 +69,20 @@ export interface Shape2DProps extends Place2dProps {
/** [width, height] in px ([100, 100] by default); a circle's and a polygon's diameter is the width */
size?: [number, number];
sides?: number;
- /** a CSS colour (white by default) */
+ /** a CSS colour (white by default); with a texture, it tints it */
color?: string;
+ /** a picture on it, mapped by the mesh's UVs (Bevy's ColorMaterial texture) */
+ texture?: string;
+ /** Bevy's AlphaMode2d: "Blend" (Bevy's default), "Opaque", or { Mask: cutoff } */
+ alpha_mode?: AlphaMode2d;
+ /** one linear [r, g, b, a] per vertex of the shape's mesh (Bevy's Mesh::ATTRIBUTE_COLOR): the material's colour and
+ * texture are multiplied by them. A rect has 4 (top right, top left, bottom left, bottom right), a triangle 3. */
+ vertex_colors?: [number, number, number, number][];
}
+/** bevy_sprite_render's AlphaMode2d */
+export type AlphaMode2d = "Opaque" | "Blend" | { Mask: number };
+
/** A flat shape in 2D, over the 3D, in one colour: Bevy's Mesh2d with a ColorMaterial (raea-sys-sprite). Put it
* inside the Canvas3D.
* @bevy bevy_sprite_render::mesh2d::color_material::ColorMaterial
@@ -85,6 +95,13 @@ export function Shape2D(props: Shape2DProps) {
if (s !== undefined && !(Array.isArray(s) && s.length === 2 && s.every((n) => Number.isFinite(n) && n > 0))) throw new TypeError(`Shape2D: size is [width, height], two numbers above 0, got ${JSON.stringify(s)}`);
if (props.sides !== undefined && !(Number.isInteger(props.sides) && props.sides >= 3)) throw new RangeError(`Shape2D: sides is a whole number of 3 or more, got ${props.sides}`);
check2d("Shape2D", props);
+ if (props.texture !== undefined && !(typeof props.texture === "string" && props.texture !== "")) throw new TypeError(`Shape2D: texture is a picture's path, staticFile("icon.png"), got ${JSON.stringify(props.texture)}`);
+ const a = props.alpha_mode;
+ if (a !== undefined && a !== "Opaque" && a !== "Blend" && !(typeof a === "object" && a !== null && typeof a.Mask === "number" && Number.isFinite(a.Mask))) throw new TypeError(`Shape2D: alpha_mode is "Opaque", "Blend" or { Mask: cutoff }, got ${JSON.stringify(a)}`);
+ const vc = props.vertex_colors;
+ if (vc !== undefined && !(Array.isArray(vc) && vc.every((c) => Array.isArray(c) && c.length === 4 && c.every(Number.isFinite)))) throw new TypeError(`Shape2D: vertex_colors is one linear [r, g, b, a] per vertex, got ${JSON.stringify(vc)}`);
+ const verts = ({ rect: 4, triangle: 3 } as Record<string, number>)[props.shape ?? "rect"];
+ if (vc !== undefined && verts !== undefined && vc.length !== verts) throw new RangeError(`Shape2D: a ${props.shape ?? "rect"}'s mesh has ${verts} vertices, so vertex_colors has ${verts} colours, got ${vc.length}`);
const id = useId();
const [w, h] = props.size ?? [100, 100];
const round = props.shape === "circle" || props.shape === "ellipse" || props.shape === "polygon";
diff --git a/sdk/render/src/bevy3d.tsx b/sdk/render/src/bevy3d.tsx
index 61d13ea6..042836f9 100644
--- a/sdk/render/src/bevy3d.tsx
+++ b/sdk/render/src/bevy3d.tsx
@@ -8,8 +8,8 @@
// <StandardMaterial base_color="#c84" perceptual_roughness={0.4} />
// </Mesh3d>
import { eulerOf } from "./3d";
-export { Quat, Affine2, Transform, Mesh3d, Camera3d, Srgba, LinearRgba, StandardMaterial, GridExtension, PaintExtension, WearExtension, ToonExtension, ShaderExtension, ExtendedMaterial, ToonMaterial, Mesh2d, Circle, Rectangle, Ellipse, RegularPolygon, ColorMaterial, PointLight, SpotLight, DirectionalLight, AmbientLight, GlobalAmbientLight, RectLight, light_consts } from "./bevy3d/all";
-export type { EulerRot, TransformValue, TransformBuilt, Mesh3dProps, Projection, Camera3dProps, AlphaMode, StandardMaterialProps, StandardMaterialAnimate, ToonExtensionAnimate, SampledImage, MetallicRoughnessMaps, GridExtensionProps, PaintExtensionProps, WearExtensionProps, ToonExtensionProps, ShaderExtensionProps, ExtendedMaterialProps, ToonMaterialProps, Mesh2dProps, CircleProps, RectangleProps, EllipseProps, RegularPolygonProps, ColorMaterialProps, PointLightProps, SpotLightProps, DirectionalLightProps, AmbientLightProps, RectLightProps } from "./bevy3d/all";
+export { Quat, Affine2, Transform, Mesh3d, Camera3d, Srgba, LinearRgba, StandardMaterial, GridExtension, PaintExtension, WearExtension, ProceduralExtension, ToonExtension, ShaderExtension, ExtendedMaterial, ToonMaterial, Mesh2d, Circle, Rectangle, Ellipse, RegularPolygon, ColorMaterial, PointLight, SpotLight, DirectionalLight, AmbientLight, GlobalAmbientLight, RectLight, light_consts } from "./bevy3d/all";
+export type { EulerRot, TransformValue, TransformBuilt, Mesh3dProps, Projection, Camera3dProps, AlphaMode, StandardMaterialProps, StandardMaterialAnimate, ToonExtensionAnimate, SampledImage, MetallicRoughnessMaps, GridExtensionProps, PaintExtensionProps, WearExtensionProps, ProceduralExtensionProps, ToonExtensionProps, ShaderExtensionProps, ExtendedMaterialProps, ToonMaterialProps, Mesh2dProps, CircleProps, RectangleProps, EllipseProps, RegularPolygonProps, ColorMaterialProps, MeshAttributes, PointLightProps, SpotLightProps, DirectionalLightProps, AmbientLightProps, RectLightProps } from "./bevy3d/all";
export { eulerOf };
// ray-traced lighting: Bevy's Solari (docs/raytracing.feature RT3)
@@ -19,3 +19,14 @@ export { ConicalFrustum, type ConicalFrustumProps } from "./3d/shapes";
export { TextureView } from "./layers";
// your own Material (docs/control.feature FC2a)
export { Material, type MaterialProps } from "./bevy3d/all";
+// bevy_color's other spaces (docs/control.feature FC1f)
+export { Hsla, Oklaba, Oklcha, Xyza } from "./bevy3d/all";
+// FogFalloff, Bevy's constructors, for a <Fog> inside the <Camera3d> (docs/control.feature FC0a)
+export { FogFalloff } from "./bevy3d/fog";
+// Bevy's Hdr camera marker, inside the <Camera3d> (docs/control.feature FC0a)
+export { Hdr } from "./bevy3d/core";
+// Lightmap (bevy_pbr::lightmap): a bake on a <Model>'s glTF meshes by name (docs/control.feature FC0a)
+export { Lightmap, type LightmapProps } from "./bevy3d/lightmap";
+// bevy_ui's Node, Text and TextSpan, and their values, drawn by the page (docs/control.feature FC0a)
+export { Node, Text, TextSpan, ImageNode, ImagePlugin, FontVariationTag, TextureAtlasLayout, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type ImageNodeProps } from "./bevy3d/ui";
+export { px, percent, vw, vh, vmin, vmax, auto, UiRect, BorderRadius, Overflow, type Val } from "./bevy3d/ui-val";
diff --git a/sdk/render/src/bevy3d/all.ts b/sdk/render/src/bevy3d/all.ts
index ad504405..3af736c4 100644
--- a/sdk/render/src/bevy3d/all.ts
+++ b/sdk/render/src/bevy3d/all.ts
@@ -2,7 +2,9 @@
// each other only from here, so this order holds whichever is reached first.
export * from "./core";
export * from "./colors";
+export * from "./procedural";
export * from "./materials";
export * from "./material";
export * from "./lights";
export * from "./mesh2d";
+export * from "./colorspaces";
diff --git a/sdk/render/src/bevy3d/colors.ts b/sdk/render/src/bevy3d/colors.ts
index 946f1cde..c3851627 100644
--- a/sdk/render/src/bevy3d/colors.ts
+++ b/sdk/render/src/bevy3d/colors.ts
@@ -29,6 +29,16 @@ export class Srgba {
s[MADE_FROM] = this[MADE_FROM];
return s;
}
+ /** Bevy's Srgba::to_hex: #RRGGBB (and AA when not opaque), each channel clamped and rounded */
+ to_hex(): string {
+ const byte = (v: number) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).padStart(2, "0").toUpperCase();
+ return "#" + byte(this.red) + byte(this.green) + byte(this.blue) + (this.alpha < 1 ? byte(this.alpha) : "");
+ }
+ /** Bevy's Mix: each channel lerped, in f32 */
+ mix(o: Srgba, t: number): Srgba {
+ const m = (a: number, b: number) => Math.fround(Math.fround(a * Math.fround(1 - t)) + Math.fround(b * t));
+ return new Srgba(m(this.red, o.red), m(this.green, o.green), m(this.blue, o.blue), m(this.alpha, o.alpha));
+ }
}
// a base colour as the old material takes it: its colour (the one it was made from, exactly) and its alpha
@@ -54,6 +64,16 @@ export class LinearRgba {
l[MADE_FROM] = c[MADE_FROM];
return l;
}
+ /** Bevy's Srgba::from(LinearRgba): gamma-encoded (a channel at or below 0 kept as it is) */
+ to_srgba(): Srgba {
+ const g = (c: number) => (c <= 0 ? c : Math.fround(linearToSrgb(c)));
+ return new Srgba(g(this.red), g(this.green), g(this.blue), this.alpha);
+ }
+ /** Bevy's Mix: each channel lerped, in f32 */
+ mix(o: LinearRgba, t: number): LinearRgba {
+ const m = (a: number, b: number) => Math.fround(Math.fround(a * Math.fround(1 - t)) + Math.fround(b * t));
+ return new LinearRgba(m(this.red, o.red), m(this.green, o.green), m(this.blue, o.blue), m(this.alpha, o.alpha));
+ }
/** Bevy's `* k`: each colour channel scaled (alpha kept) */
mul(k: number): LinearRgba {
const l = new LinearRgba(this.red * k, this.green * k, this.blue * k, this.alpha);
diff --git a/sdk/render/src/bevy3d/colorspaces.ts b/sdk/render/src/bevy3d/colorspaces.ts
new file mode 100644
index 00000000..f18bf144
--- /dev/null
+++ b/sdk/render/src/bevy3d/colorspaces.ts
@@ -0,0 +1,120 @@
+// bevy_color's other spaces (docs/control.feature FC1f): Hsla, Oklaba, Oklcha and Xyza, each converted to and from
+// LinearRgba and Srgba by Bevy's own formulas in f32 (crates/bevy_color: oklaba.rs, xyza.rs, oklcha.rs, and Hsla
+// through Hsva and Hwba), and mixed as Bevy's Mix does (a hue the short way round).
+import { LinearRgba, Srgba } from "./all";
+
+const f = Math.fround;
+const remEuclid = (a: number, b: number) => f(((a % b) + b) % b);
+/** bevy_color's lerp_hue: the short way round, in [0, 360) */
+const lerpHue = (a: number, b: number, t: number) => remEuclid(f(a + f(f(remEuclid(f(b - a + 180), 360) - 180) * t)), 360);
+const lerp = (a: number, b: number, t: number) => f(f(a * f(1 - t)) + f(b * t));
+type Rgb = LinearRgba | Srgba;
+const linearOf = (c: Rgb): LinearRgba => (c instanceof LinearRgba ? c : LinearRgba.from(c));
+const srgbaOf = (c: Rgb): Srgba => (c instanceof Srgba ? c : c.to_srgba());
+
+/** Bevy's Oklaba: perceptual lightness and two opponent axes. */
+export class Oklaba {
+ constructor(public lightness: number, public a: number, public b: number, public alpha = 1) {}
+ static from(c: Rgb | Oklcha): Oklaba {
+ if (c instanceof Oklcha) {
+ const h = f((c.hue * Math.PI) / 180);
+ return new Oklaba(c.lightness, f(c.chroma * f(Math.cos(h))), f(c.chroma * f(Math.sin(h))), c.alpha);
+ }
+ const { red: r, green: g, blue: b, alpha } = linearOf(c);
+ const l = f(Math.cbrt(f(f(f(0.41222146 * r) + f(0.53633255 * g)) + f(0.051445995 * b))));
+ const m = f(Math.cbrt(f(f(f(0.2119035 * r) + f(0.6806995 * g)) + f(0.10739696 * b))));
+ const s = f(Math.cbrt(f(f(f(0.08830246 * r) + f(0.28171885 * g)) + f(0.6299787 * b))));
+ return new Oklaba(f(f(f(0.21045426 * l) + f(0.7936178 * m)) - f(0.004072047 * s)), f(f(f(1.9779985 * l) - f(2.4285922 * m)) + f(0.4505937 * s)), f(f(f(0.025904037 * l) + f(0.78277177 * m)) - f(0.80867577 * s)), alpha);
+ }
+ to_linear(): LinearRgba {
+ const { lightness: L, a, b } = this;
+ const l = f(f(L + f(0.39633778 * a)) + f(0.21580376 * b)) ** 3;
+ const m = f(f(L - f(0.105561346 * a)) - f(0.06385417 * b)) ** 3;
+ const s = f(f(L - f(0.08948418 * a)) - f(1.2914855 * b)) ** 3;
+ return new LinearRgba(f(4.0767417 * l - 3.3077116 * m + 0.23096994 * s), f(-1.268438 * l + 2.6097574 * m - 0.34131938 * s), f(-0.0041960863 * l - 0.7034186 * m + 1.7076147 * s), this.alpha);
+ }
+ to_srgba(): Srgba {
+ return this.to_linear().to_srgba();
+ }
+ mix(o: Oklaba, t: number): Oklaba {
+ return new Oklaba(lerp(this.lightness, o.lightness, t), lerp(this.a, o.a, t), lerp(this.b, o.b, t), lerp(this.alpha, o.alpha, t));
+ }
+}
+
+/** Bevy's Oklcha: Oklab's lightness, chroma and hue (degrees). */
+export class Oklcha {
+ constructor(public lightness: number, public chroma: number, public hue: number, public alpha = 1) {}
+ static from(c: Rgb | Oklaba): Oklcha {
+ const o = c instanceof Oklaba ? c : Oklaba.from(c);
+ const hue = f((Math.atan2(o.b, o.a) * 180) / Math.PI);
+ return new Oklcha(o.lightness, f(Math.hypot(o.a, o.b)), hue < 0 ? f(hue + 360) : hue, o.alpha);
+ }
+ to_linear(): LinearRgba {
+ return Oklaba.from(this).to_linear();
+ }
+ to_srgba(): Srgba {
+ return this.to_linear().to_srgba();
+ }
+ mix(o: Oklcha, t: number): Oklcha {
+ return new Oklcha(lerp(this.lightness, o.lightness, t), lerp(this.chroma, o.chroma, t), lerpHue(this.hue, o.hue, t), lerp(this.alpha, o.alpha, t));
+ }
+}
+
+/** Bevy's Xyza: CIE 1931 XYZ (D65, as linear sRGB's). */
+export class Xyza {
+ constructor(public x: number, public y: number, public z: number, public alpha = 1) {}
+ static from(c: Rgb): Xyza {
+ const { red: r, green: g, blue: b, alpha } = linearOf(c);
+ return new Xyza(f(r * 0.4124564 + g * 0.3575761 + b * 0.1804375), f(r * 0.2126729 + g * 0.7151522 + b * 0.072175), f(r * 0.0193339 + g * 0.119192 + b * 0.9503041), alpha);
+ }
+ to_linear(): LinearRgba {
+ const { x, y, z } = this;
+ return new LinearRgba(f(x * 3.2404542 + y * -1.5371385 + z * -0.4985314), f(x * -0.969266 + y * 1.8760108 + z * 0.041556), f(x * 0.0556434 + y * -0.2040259 + z * 1.0572252), this.alpha);
+ }
+ to_srgba(): Srgba {
+ return this.to_linear().to_srgba();
+ }
+ mix(o: Xyza, t: number): Xyza {
+ return new Xyza(lerp(this.x, o.x, t), lerp(this.y, o.y, t), lerp(this.z, o.z, t), lerp(this.alpha, o.alpha, t));
+ }
+}
+
+/** Bevy's Hsla: hue (degrees), saturation and lightness, each 0..1; converted through Hsva and Hwba, as Bevy's is. */
+export class Hsla {
+ constructor(public hue: number, public saturation: number, public lightness: number, public alpha = 1) {}
+ static from(c: Rgb): Hsla {
+ const { red, green, blue, alpha } = srgbaOf(c);
+ // Srgba -> Hwba
+ const max = Math.max(0, red, green, blue);
+ const min = Math.min(1, red, green, blue);
+ const chroma = f(max - min);
+ let hue = chroma === 0 ? 0 : red === max ? f(f(60 * f(green - blue)) / chroma) : green === max ? f(60 * f(2 + f(f(blue - red) / chroma))) : f(60 * f(4 + f(f(red - green) / chroma)));
+ if (hue < 0) hue = f(360 + hue);
+ const [w, bl] = [min, f(1 - max)];
+ // Hwba -> Hsva -> Hsla
+ const v = f(1 - bl);
+ const s = v !== 0 ? f(1 - f(w / v)) : 0;
+ const l = f(v * f(1 - f(s / 2)));
+ return new Hsla(hue, l === 0 || l === 1 ? 0 : f(f(v - l) / Math.min(l, f(1 - l))), l, alpha);
+ }
+ to_srgba(): Srgba {
+ const { hue, saturation: s0, lightness: l } = this;
+ // Hsla -> Hsva -> Hwba
+ const v = f(l + f(s0 * Math.min(l, f(1 - l))));
+ const s = v === 0 ? 0 : f(2 * f(1 - f(l / v)));
+ const w = f(f(1 - s) * v);
+ // Hwba -> Srgba
+ const h = f(f(hue % 360) / 60);
+ const i = Math.floor(h);
+ const fr = i % 2 === 0 ? f(h - i) : f(1 - f(h - i));
+ const n = f(w + f(fr * f(v - w)));
+ const rgb: [number, number, number] = [[v, n, w], [n, v, w], [w, v, n], [w, n, v], [n, w, v], [v, w, n]][i] as [number, number, number];
+ return new Srgba(rgb[0], rgb[1], rgb[2], this.alpha);
+ }
+ to_linear(): LinearRgba {
+ return LinearRgba.from(this.to_srgba());
+ }
+ mix(o: Hsla, t: number): Hsla {
+ return new Hsla(lerpHue(this.hue, o.hue, t), lerp(this.saturation, o.saturation, t), lerp(this.lightness, o.lightness, t), lerp(this.alpha, o.alpha, t));
+ }
+}
diff --git a/sdk/render/src/bevy3d/core.tsx b/sdk/render/src/bevy3d/core.tsx
index 9f0ee43c..ec78cfbf 100644
--- a/sdk/render/src/bevy3d/core.tsx
+++ b/sdk/render/src/bevy3d/core.tsx
@@ -1,10 +1,11 @@
// Quat, Transform, Mesh3d and Camera3d.
-import { Children, isValidElement, useId, type ReactNode } from "react";
+import { Children, cloneElement, isValidElement, useId, type ReactNode } from "react";
import { meshLayers } from "../layers";
-import { DepthOfField, dofOf, eulerOf, type DepthOfFieldProps, type Vec3 } from "../3d";
+import { BevyComponent, DepthOfField, Fog, dofOf, eulerOf, type DepthOfFieldProps, type FogProps, type Vec3 } from "../3d";
import { AmbientLight as AmbientLight3, Mesh, OrthographicCamera, PerspectiveCamera, type MeshProps } from "../three";
import { Transform as TransformComponent } from "@raea/app/bevy";
import { AmbientLight, ambientOf, type AmbientLightProps } from "./all";
+import { cameraFog } from "./fog";
/** A rotation as glam's Quat: [x, y, z, w]. */
export type Quat = [number, number, number, number];
@@ -202,7 +203,11 @@ export function Camera3d({ transform, projection = { Perspective: {} }, layers,
let dof: DepthOfFieldProps | undefined;
// Bevy 0.20's AmbientLight on the camera: its own ambient, over GlobalAmbientLight (the scene's other ambient lights)
const ambient: ReactNode[] = [];
- const rest = Children.toArray(kids).filter((c) => {
+ // a <Fog> on the camera is Bevy's DistanceFog on it, every one of Bevy's fields
+ let fogs = 0;
+ const own = Children.toArray(kids).map((c) => (isValidElement(c) && c.type === Fog ? (fogs++, cloneElement(cameraFog(c.props as FogProps), { key: c.key })) : c));
+ if (fogs > 1) throw new TypeError("Camera3d: one Fog");
+ const rest = own.filter((c) => {
if (isValidElement(c) && c.type === AmbientLight) {
ambient.push(<AmbientLight3 key={ambient.length} {...ambientOf(c.props as AmbientLightProps)} camera />);
return false;
@@ -213,7 +218,7 @@ export function Camera3d({ transform, projection = { Perspective: {} }, layers,
return false;
});
const focus = dof ? { focus: dof.focal_distance ?? 10 } : {};
- const children = dof || ambient.length ? rest : kids;
+ const children = dof || ambient.length || fogs ? rest : kids;
// on the camera it is Bevy's component, so Bevy's f/1 unless the old aperture is given
const bevy = dof && dof.aperture === undefined && dof.aperture_f_stops === undefined ? { aperture_f_stops: 1 } : {};
const lens = dof ? <DepthOfField {...dofOf("Camera3d", { ...dof, ...bevy, focal_distance: undefined })} /> : null;
@@ -245,3 +250,10 @@ export function Camera3d({ transform, projection = { Perspective: {} }, layers,
</>
);
}
+
+/** Bevy's Hdr: put it inside the <Camera3d> to render it to a float target, tone-mapped after, as Bevy's Hdr camera
+ * is (a Skybox's or an emissive's light above 1 then rolls off in the tone mapping instead of clipping).
+ * @bevy bevy_camera::components::Hdr */
+export function Hdr() {
+ return <BevyComponent type="bevy_camera::components::Hdr" value={{}} />;
+}
diff --git a/sdk/render/src/bevy3d/fog.tsx b/sdk/render/src/bevy3d/fog.tsx
new file mode 100644
index 00000000..801f8303
--- /dev/null
+++ b/sdk/render/src/bevy3d/fog.tsx
@@ -0,0 +1,70 @@
+// <Fog> on the camera as Bevy has it (<Camera3d><Fog ... /></Camera3d>: Bevy's DistanceFog, reflected), and
+// FogFalloff with Bevy's own constructors (bevy_pbr fog.rs), in f32 as Bevy works them out: docs/control.feature FC0a
+// (atmospheric_fog needs the atmospheric falloff and the sun's colour, which the scene's fog row has neither of).
+import { BevyComponent, type FogColor, type FogFalloff as Falloff, type FogProps } from "../3d";
+import { LinearRgba, Srgba } from "./all";
+
+const f = Math.fround;
+const isLinear = (c: FogColor): c is LinearRgba => typeof c === "object" && "to_srgba" in c;
+const srgba = (c: FogColor): Srgba => (typeof c === "string" ? Srgba.hex(c) : isLinear(c) ? c.to_srgba() : new Srgba(c.red, c.green, c.blue, c.alpha));
+/** bevy_color's Srgba::gamma_function, in f32 as Bevy runs it */
+const gamma = (v: number) => (v <= 0 ? v : v <= 0.04045 ? f(v / f(12.92)) : f(f(f(v + f(0.055)) / f(1.055)) ** f(2.4)));
+/** LinearRgba::from(Color) as f32 channels: a LinearRgba as it is, an Srgba through gamma_function */
+function linear(c: FogColor): [number, number, number, number] {
+ if (isLinear(c)) return [c.red, c.green, c.blue, c.alpha].map(f) as [number, number, number, number];
+ const s = srgba(c);
+ return [gamma(f(s.red)), gamma(f(s.green)), gamma(f(s.blue)), f(s.alpha)];
+}
+/** core::f32::consts::E */
+const E = f(Math.E);
+/** Color as reflect's JSON reads it: an Srgba stays sRGB, a LinearRgba linear */
+function reflected(c: FogColor) {
+ if (isLinear(c)) return { LinearRgba: { red: c.red, green: c.green, blue: c.blue, alpha: c.alpha } };
+ const s = srgba(c);
+ return { Srgba: { red: s.red, green: s.green, blue: s.blue, alpha: s.alpha } };
+}
+
+/** FogFalloff's constructors: the visibility distance (5% contrast left at it by default) to a density */
+export const FogFalloff = {
+ /** Koschmieder's 5% contrast threshold, revised from 2% */
+ REVISED_KOSCHMIEDER_CONTRAST_THRESHOLD: 0.05,
+ /** the extinction coefficient for a visibility `v` at contrast `c_t`: -ln(c_t) / v */
+ koschmieder: (v: number, c_t: number) => f(f(-Math.log(f(c_t))) / f(v)),
+ from_visibility: (visibility: number): Falloff => FogFalloff.from_visibility_contrast(visibility, FogFalloff.REVISED_KOSCHMIEDER_CONTRAST_THRESHOLD),
+ from_visibility_contrast: (visibility: number, contrast_threshold: number): Falloff => ({ Exponential: { density: FogFalloff.koschmieder(visibility, contrast_threshold) } }),
+ from_visibility_squared: (visibility: number): Falloff => FogFalloff.from_visibility_contrast_squared(visibility, FogFalloff.REVISED_KOSCHMIEDER_CONTRAST_THRESHOLD),
+ from_visibility_contrast_squared: (visibility: number, contrast_threshold: number): Falloff => ({ ExponentialSquared: { density: f(Math.sqrt(f(FogFalloff.koschmieder(visibility, contrast_threshold) / f(visibility)))) } }),
+ from_visibility_color: (visibility: number, color: FogColor): Falloff => FogFalloff.from_visibility_contrast_colors(visibility, FogFalloff.REVISED_KOSCHMIEDER_CONTRAST_THRESHOLD, color, color),
+ from_visibility_colors: (visibility: number, extinction: FogColor, inscattering: FogColor): Falloff => FogFalloff.from_visibility_contrast_colors(visibility, FogFalloff.REVISED_KOSCHMIEDER_CONTRAST_THRESHOLD, extinction, inscattering),
+ from_visibility_contrast_color: (visibility: number, contrast_threshold: number, color: FogColor): Falloff => FogFalloff.from_visibility_contrast_colors(visibility, contrast_threshold, color, color),
+ /** Atmospheric: extinction (1 - colour) ^ e and inscattering colour ^ e (linear), each times the coefficient and
+ * its alpha ^ e */
+ from_visibility_contrast_colors(visibility: number, contrast_threshold: number, extinction: FogColor, inscattering: FogColor): Falloff {
+ const k = FogFalloff.koschmieder(visibility, contrast_threshold);
+ const [re, ge, be, ae] = linear(extinction);
+ const [ri, gi, bi, ai] = linear(inscattering);
+ const ea = f(ae ** E);
+ const ia = f(ai ** E);
+ const ext = [re, ge, be].map((c) => f(f(f(f(1 - c) ** E) * k) * ea)) as [number, number, number];
+ const ins = [ri, gi, bi].map((c) => f(f(f(c ** E) * k) * ia)) as [number, number, number];
+ return { Atmospheric: { extinction: ext, inscattering: ins } };
+ },
+};
+
+/** a <Fog> inside the <Camera3d>: Bevy's DistanceFog on it, Bevy's defaults where a field is left out (near and far a
+ * Linear falloff, density an Exponential one) */
+export function cameraFog(p: FogProps) {
+ const exp = p.directional_light_exponent ?? 8;
+ if (!(exp >= 0 && Number.isFinite(exp))) throw new RangeError(`Fog: directional_light_exponent is 0 or more, got ${exp}`);
+ const old = p.near !== undefined || p.far !== undefined || p.density !== undefined;
+ if (old && p.falloff) throw new TypeError("Fog: falloff or near, far and density, not both");
+ const falloff: Falloff = p.falloff ?? (p.density !== undefined ? { Exponential: { density: p.density } } : { Linear: { start: p.near ?? 0, end: p.far ?? 100 } });
+ if (typeof falloff !== "object" || Object.keys(falloff).length !== 1) throw new TypeError(`Fog: falloff is a FogFalloff ({ Linear }, { Exponential }, FogFalloff.from_visibility(...)), got ${JSON.stringify(falloff)}`);
+ const value = {
+ color: reflected(p.color ?? new Srgba(1, 1, 1, 1)),
+ directional_light_color: reflected(p.directional_light_color ?? new LinearRgba(0, 0, 0, 0)),
+ directional_light_exponent: exp,
+ falloff,
+ };
+ return <BevyComponent type="bevy_pbr::fog::DistanceFog" value={value} />;
+}
diff --git a/sdk/render/src/bevy3d/fonts/FiraMono-LICENSE b/sdk/render/src/bevy3d/fonts/FiraMono-LICENSE
new file mode 100644
index 00000000..5e4608f2
--- /dev/null
+++ b/sdk/render/src/bevy3d/fonts/FiraMono-LICENSE
@@ -0,0 +1,93 @@
+Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/sdk/render/src/bevy3d/fonts/default.ts b/sdk/render/src/bevy3d/fonts/default.ts
new file mode 100644
index 00000000..99d8b90a
--- /dev/null
+++ b/sdk/render/src/bevy3d/fonts/default.ts
@@ -0,0 +1,7 @@
+// Bevy's default font (bevy_text's DEFAULT_FONT_DATA, src/FiraMono-subset.ttf of bevy_text 0.20.0: Fira Mono Medium,
+// subset), inlined so a page's Bevy UI text is drawn in the face Bevy draws it in. Fira Mono is under the SIL Open Font
+// License 1.1 (FiraMono-LICENSE beside this file). Generated: base64 of the file as shipped; do not edit.
+export const BEVY_FONT_FAMILY = "Bevy Default Font";
+const DATA = "AAEAAAASAQAABAAgRkZUTYZSDmsAAEmEAAAAHEdERUYCKgH0AABGzAAAAFBHUE9TuP+4/gAASVQAAAAwR1NVQkpKeMMAAEccAAACOE9TLzKXp/hxAAABqAAAAGBjbWFwzJGg2QAAAtQAAAFCY3Z0IAxGLjIAABBQAAAAlmZwZ23eFNvwAAAEGAAAC5dnYXNwAAAAEAAARsQAAAAIZ2x5ZiiQaz8AABGwAAAtNGhlYWQIErwoAAABLAAAADZoaGVhBgoBTAAAAWQAAAAkaG10eBWMD8QAAAIIAAAAzGxvY2EQPAVyAAAQ6AAAAMZtYXhwAc8BaAAAAYgAAAAgbmFtZStRKSsAAD7kAAAG9nBvc3QJegljAABF3AAAAOZwcmVwbekAoQAAD7AAAACgAAEAAAADNLww/YPnXw889QAfA+gAAAAA0hRh6gAAAADUZuIiAAL/KAJgA1MAAAAIAAIAAAAAAAAAAQAAA6f+9wAAAlgAAP/4AmAAAQAAAAAAAAAAAAAAAAAAAAQAAQAAAGIARQAFAAAAAAACACQANAB3AAAAzADtAAAAAAADAlgB9AAFAAACigJYAAAASwKKAlgAAAFeADIBPAAAAgsGCQUAAAIABEAAAocCADgBAAAAAAAAAABDVERCAEAAIAB+A6f+9wAAA6cBCWAAAJ8AAAAAAhACsgAAACAAAwJYACEAAAAAAlgAAAJYAAAA4ACXAC4AOwANADAA7wB0AKUAWQBnAMcAdwDLACwAQQBRADQAJwA+AD8ARABWADkAOgDSAMcAUQBdAFEATQAFAAgAUQA0AEcAcQB/ACUARwBcADwAWAB4ABkARwAmAGAAKABVAB8AIQA9AA8AAgAVAAsAOwCtACwAmgA9ADIAsAA4AFkAUwA5AEIAVwA1AFkAbABWAFwAMgAqAFkAPQBZAD0AXgBAAEcAWQAwAAwAKwAxAFsAcQD4AI8AIwAAAAMAAAADAAAAHAABAAAAAAA8AAMAAQAAABwABAAgAAAABAAEAAEAAAB+//8AAAAg////4wABAAAAAAAAAQYAAAEAAAAAAAAAAQIAAAACAAAAAAAAAAAAAAAAAAAAAQAAAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAALCCwAFVYRVkgIEu4AA5RS7AGU1pYsDQbsChZYGYgilVYsAIlYbkIAAgAY2MjYhshIbAAWbAAQyNEsgABAENgQi2wASywIGBmLbACLCBkILDAULAEJlqyKAEKQ0VjRVJbWCEjIRuKWCCwUFBYIbBAWRsgsDhQWCGwOFlZILEBCkNFY0VhZLAoUFghsQEKQ0VjRSCwMFBYIbAwWRsgsMBQWCBmIIqKYSCwClBYYBsgsCBQWCGwCmAbILA2UFghsDZgG2BZWVkbsAErWVkjsABQWGVZWS2wAywgRSCwBCVhZCCwBUNQWLAFI0KwBiNCGyEhWbABYC2wBCwjISMhIGSxBWJCILAGI0KxAQpDRWOxAQpDsANgRWOwAyohILAGQyCKIIqwASuxMAUlsAQmUVhgUBthUllYI1khILBAU1iwASsbIbBAWSOwAFBYZVktsAUssAdDK7IAAgBDYEItsAYssAcjQiMgsAAjQmGwAmJmsAFjsAFgsAUqLbAHLCAgRSCwC0NjuAQAYiCwAFBYsEBgWWawAWNgRLABYC2wCCyyBwsAQ0VCKiGyAAEAQ2BCLbAJLLAAQyNEsgABAENgQi2wCiwgIEUgsAErI7AAQ7AEJWAgRYojYSBkILAgUFghsAAbsDBQWLAgG7BAWVkjsABQWGVZsAMlI2FERLABYC2wCywgIEUgsAErI7AAQ7AEJWAgRYojYSBksCRQWLAAG7BAWSOwAFBYZVmwAyUjYUREsAFgLbAMLCCwACNCsgsKA0VYIRsjIVkqIS2wDSyxAgJFsGRhRC2wDiywAWAgILAMQ0qwAFBYILAMI0JZsA1DSrAAUlggsA0jQlktsA8sILAQYmawAWMguAQAY4ojYbAOQ2AgimAgsA4jQiMtsBAsS1RYsQRkRFkksA1lI3gtsBEsS1FYS1NYsQRkRFkbIVkksBNlI3gtsBIssQAPQ1VYsQ8PQ7ABYUKwDytZsABDsAIlQrEMAiVCsQ0CJUKwARYjILADJVBYsQEAQ2CwBCVCioogiiNhsA4qISOwAWEgiiNhsA4qIRuxAQBDYLACJUKwAiVhsA4qIVmwDENHsA1DR2CwAmIgsABQWLBAYFlmsAFjILALQ2O4BABiILAAUFiwQGBZZrABY2CxAAATI0SwAUOwAD6yAQEBQ2BCLbATLACxAAJFVFiwDyNCIEWwCyNCsAojsANgQiBgsAFhtRAQAQAOAEJCimCxEgYrsHUrGyJZLbAULLEAEystsBUssQETKy2wFiyxAhMrLbAXLLEDEystsBgssQQTKy2wGSyxBRMrLbAaLLEGEystsBsssQcTKy2wHCyxCBMrLbAdLLEJEystsCksIC6wAV0tsCosIC6wAXEtsCssIC6wAXItsB4sALANK7EAAkVUWLAPI0IgRbALI0KwCiOwA2BCIGCwAWG1EBABAA4AQkKKYLESBiuwdSsbIlktsB8ssQAeKy2wICyxAR4rLbAhLLECHistsCIssQMeKy2wIyyxBB4rLbAkLLEFHistsCUssQYeKy2wJiyxBx4rLbAnLLEIHistsCgssQkeKy2wLCwgPLABYC2wLSwgYLAQYCBDI7ABYEOwAiVhsAFgsCwqIS2wLiywLSuwLSotsC8sICBHICCwC0NjuAQAYiCwAFBYsEBgWWawAWNgI2E4IyCKVVggRyAgsAtDY7gEAGIgsABQWLBAYFlmsAFjYCNhOBshWS2wMCwAsQACRVRYsAEWsC8qsQUBFUVYMFkbIlktsDEsALANK7EAAkVUWLABFrAvKrEFARVFWDBZGyJZLbAyLCA1sAFgLbAzLACwAUVjuAQAYiCwAFBYsEBgWWawAWOwASuwC0NjuAQAYiCwAFBYsEBgWWawAWOwASuwABa0AAAAAABEPiM4sTIBFSotsDQsIDwgRyCwC0NjuAQAYiCwAFBYsEBgWWawAWNgsABDYTgtsDUsLhc8LbA2LCA8IEcgsAtDY7gEAGIgsABQWLBAYFlmsAFjYLAAQ2GwAUNjOC2wNyyxAgAWJSAuIEewACNCsAIlSYqKRyNHI2EgWGIbIVmwASNCsjYBARUUKi2wOCywABawBCWwBCVHI0cjYbAJQytlii4jICA8ijgtsDkssAAWsAQlsAQlIC5HI0cjYSCwBCNCsAlDKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgsAhDIIojRyNHI2EjRmCwBEOwAmIgsABQWLBAYFlmsAFjYCCwASsgiophILACQ2BkI7ADQ2FkUFiwAkNhG7ADQ2BZsAMlsAJiILAAUFiwQGBZZrABY2EjICCwBCYjRmE4GyOwCENGsAIlsAhDRyNHI2FgILAEQ7ACYiCwAFBYsEBgWWawAWNgIyCwASsjsARDYLABK7AFJWGwBSWwAmIgsABQWLBAYFlmsAFjsAQmYSCwBCVgZCOwAyVgZFBYIRsjIVkjICCwBCYjRmE4WS2wOiywABYgICCwBSYgLkcjRyNhIzw4LbA7LLAAFiCwCCNCICAgRiNHsAErI2E4LbA8LLAAFrADJbACJUcjRyNhsABUWC4gPCMhG7ACJbACJUcjRyNhILAFJbAEJUcjRyNhsAYlsAUlSbACJWG5CAAIAGNjIyBYYhshWWO4BABiILAAUFiwQGBZZrABY2AjLiMgIDyKOCMhWS2wPSywABYgsAhDIC5HI0cjYSBgsCBgZrACYiCwAFBYsEBgWWawAWMjICA8ijgtsD4sIyAuRrACJUZSWCA8WS6xLgEUKy2wPywjIC5GsAIlRlBYIDxZLrEuARQrLbBALCMgLkawAiVGUlggPFkjIC5GsAIlRlBYIDxZLrEuARQrLbBBLLA4KyMgLkawAiVGUlggPFkusS4BFCstsEIssDkriiAgPLAEI0KKOCMgLkawAiVGUlggPFkusS4BFCuwBEMusC4rLbBDLLAAFrAEJbAEJiAuRyNHI2GwCUMrIyA8IC4jOLEuARQrLbBELLEIBCVCsAAWsAQlsAQlIC5HI0cjYSCwBCNCsAlDKyCwYFBYILBAUVizAiADIBuzAiYDGllCQiMgR7AEQ7ACYiCwAFBYsEBgWWawAWNgILABKyCKimEgsAJDYGQjsANDYWRQWLACQ2EbsANDYFmwAyWwAmIgsABQWLBAYFlmsAFjYbACJUZhOCMgPCM4GyEgIEYjR7ABKyNhOCFZsS4BFCstsEUssDgrLrEuARQrLbBGLLA5KyEjICA8sAQjQiM4sS4BFCuwBEMusC4rLbBHLLAAFSBHsAAjQrIAAQEVFBMusDQqLbBILLAAFSBHsAAjQrIAAQEVFBMusDQqLbBJLLEAARQTsDUqLbBKLLA3Ki2wSyywABZFIyAuIEaKI2E4sS4BFCstsEwssAgjQrBLKy2wTSyyAABEKy2wTiyyAAFEKy2wTyyyAQBEKy2wUCyyAQFEKy2wUSyyAABFKy2wUiyyAAFFKy2wUyyyAQBFKy2wVCyyAQFFKy2wVSyyAABBKy2wViyyAAFBKy2wVyyyAQBBKy2wWCyyAQFBKy2wWSyyAABDKy2wWiyyAAFDKy2wWyyyAQBDKy2wXCyyAQFDKy2wXSyyAABGKy2wXiyyAAFGKy2wXyyyAQBGKy2wYCyyAQFGKy2wYSyyAABCKy2wYiyyAAFCKy2wYyyyAQBCKy2wZCyyAQFCKy2wZSywOisusS4BFCstsGYssDorsD4rLbBnLLA6K7A/Ky2waCywABawOiuwQCstsGkssDsrLrEuARQrLbBqLLA7K7A+Ky2wayywOyuwPystsGwssDsrsEArLbBtLLA8Ky6xLgEUKy2wbiywPCuwPistsG8ssDwrsD8rLbBwLLA8K7BAKy2wcSywPSsusS4BFCstsHIssD0rsD4rLbBzLLA9K7A/Ky2wdCywPSuwQCstsHUsswkEAgNFWCEbIyFZQiuwCGWwAyRQeLEFARVFWDBZLQAAS7gAyFJYsQEBjlmwAbkIAAgAY3CxAAZCtEQwHAMAKrEABkK3NwgjCBEHAwgqsQAGQrdBBi0GGgUDCCqxAAlCvA4ACQAEgAADAAkqsQAMQrwAQABAAEAAAwAJKrEDAESxJAGIUViwQIhYsQNkRLEmAYhRWLoIgAABBECIY1RYsQMARFlZWVm3OQglCBMHAwwquAH/hbAEjbECAESxBWREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHYAdgBWAFYCsgAAAhAAAP8oA6f+9wLA//MCHv/z/ygDp/73AHYAdgBWAFYCsgAAAvECEP/z/ygDp/73AsD/8wLxAh7/8/8oA6f+9wB2AHYAVgBWArIAAALxAhAAAP8oA6f+9wLA//MDEwIe//P/KAOn/vcAIQJ5AAAAAAAqACoAKgAqAFoAiADcAT4BsgIcAkACYgKEArAC6AMWAzADUANiA7YD4gQmBIQEtgUEBWAFggXmBjgGbgayBsoG8AcIB2YH2ggMCFQImAjGCPIJGgloCZAJuAnqChYKNApuCpgKzgsAC0YLggvSC/IMIAxADHAMngzCDPINFg0qDU4NbA2GDZgN+A5mDqYPBA9QD6QQUhCKEOARLhFWEZQR9BI8EngS2hM6E9QUJBRiFKgUyBT8FSgVVhWGFeIV+BZUFpoAAAACACEAAAEqApoAAwAHAC6xAQAvPLIHBEntMrEGBdw8sgMCSe0yALEDAC88sgUESe0ysgcGSvw8sgECSe0yMxEhESczESMhAQnox8cCmv1mIQJYAAACAOD/8wF3ArIAAwAPACVAIgAAAAFZAAEBOUsEAQMDAlsAAgJCAkwEBAQPBA4lERAFCBcrJSMDMwIWFRQGIyImNTQ2MwFbXw56HCsrISArLB/uAcT92CwfICwsIB8sAAACAJcB2QHBAuQAAwAHADRLsBdQWEANAwEBAQBZAgEAADsBTBtAEwIBAAEBAFUCAQAAAVkDAQEAAU1ZthERERAECBgrEzMDIxMzAyOXehFZoHoQWQLk/vUBC/71AAIALgAAAioCsgAbAB8ASUBGEA8GAwAFAwIBAgABYQsBCQk5Sw4NAgcHCFkMCgIICDxLBAECAjoCTBwcHB8cHx4dGxoZGBcWFRQTEhEREREREREREBEIHSslMxUjByM3IwcjNyM1MzcjNTM3MwczNzMHMxUjBzcjBwG7SlUVXRV/FV4VSFIdSlUVXhZ/FV4WSVN6HYAc8FCgoKCgUNRRnZ2dnVHU1NQAAAMAO/9kAiIDUwAfACYALAA1QDIsJyYlHRcUEwcGBAMADQIDDQEBAgJKAAMCA3IAAAEAcwACAgFbAAEBQgFMGBQRHgQIGCsBHgEXByYnFR4BFRQGBxUjNS4BJzcWFzUuATU0Njc1Mw4BFRQWFzUTNjU0JicBWzlgIzw5R19oaF9JQ20nPEhTYV1lWUlvKyIvSVYmMAK+BisfPzEIzx9jVE9xDJOQBDQmREUF+iBeRkZkCZbzLCMgKxS1/egSWiY1FgAAAAAFAA3/6QJMAsYAAwAPABoAJgAvAFRAUQIBBAYBSgACAAAFAgBjCgEFCwEHBgUHYwkBAwMBWwgBAQFBSwAGBgRbAAQEOgRMJycbGxAQBAQnLycuLCobJhslIR8QGhAZFhQEDwQOKAwIFSsJAScBBhYVFAYjIiY1NDYzDgEVFBYzMjY1NCMAFhUUBiMiJjU0NjMGFRQWMzI1NCMCHP5YQAGn+U5OQ0NPT0MdHh8cHB46AV9OTkNDT09DOx8cOjoCo/1GIwK6BlpFRVtbRURbQy8tLDIvL1z+vFpFRVtbRURbQ1wtMV5cAAAAAgAw//MCPwK/ACEALQBLQEgCAQAEAwEBABkBAgEsEAIGAgRKAAEIBQICBgECYwAAAARbBwEEBEFLAAYGA1sAAwNCA0wjIgAAKigiLSMtACEAICIRJCUJCBgrABYXBy4BIyIGFRQWMyEVIxEGIyIuATU0Njc1LgE1ND4BMxMiDgEVFBYzMjY3NQFNVCc/GjEhLTBAMAEPUE+KS2gzT0s9OjFZOg0tPB5APiM5EQK/Iio5HBkyKyw9UP70WjlfOU5hEQMPTTYuSy3+mipBJDhKFxTmAAABAO8B2QFpAuQAAwAtS7AXUFhACwABAQBZAAAAOwFMG0AQAAABAQBVAAAAAVkAAQABTVm0ERACCBYrEzMDI+96EVgC5P71AAABAHT/bQGzA08ADwAGswoEATArEh4BFwcuATU0NjcXDgIV5ypXSz2CgICCPUpXKwD/kH5IPGzloKDlbDxHfZJfAAAAAAEApf9tAeQDTwAPAAazCgQBMCsALgEnNx4BFRQGByc+AjUBcStXSj2CgICCPUtXKgG9kn1HPGzloKDlbDxIfpBfAAAAAQBZAHoB/wIQAA4AHEAZDAsKCQgHBgUEAwIBDABHAAAAPABMHQEIFSsBNxcHFwcnByc3JzcXJzMBTpIfmmxTUkxWapsfkRFoAXE/YSB0P4qMPHkgYT+fAAEAZwBzAfEB/AALAEZLsBlQWEAVBAEAAwEBAgABYQACAgVZAAUFPAJMG0AaAAUAAgVVBAEAAwEBAgABYQAFBQJZAAIFAk1ZQAkRERERERAGCBorATMVIxUjNSM1MzUzAVyVlWKTk2IBZFmYmFmYAAABAMf/RAGIALQADgAlQCIIAQABAUoCAQEAAAFXAgEBAQBZAAABAE0AAAAOAA0WAwgVKyQWFRQGDwEjNy4BNTQ2MwFTNQ0QTVcwERU1JrQ0JhYsI7HLDCgXJjQAAAEAdwELAeEBZwADABhAFQAAAQEAVQAAAAFZAAEAAU0REAIIFisTIRUhdwFq/pYBZ1wAAAABAMv/8wGMALQACwATQBAAAAABWwABAUIBTCQhAggWKz4BMzIWFRQGIyImNcs4KCk4OCkoOHw4OCgpODgpAAAAAQAs/5YCLAMsAAMABrMDAQEwKxcBFwEsAahY/llCA24p/JMAAwBB//MCFwLAAAsAFwAjAD1AOggBBQAEAgUEYwcBAwMBWwYBAQFBSwACAgBbAAAAQgBMGBgMDAAAGCMYIh4cDBcMFhIQAAsACiQJCBUrABYVFAYjIiY1NDYzDgEVFBYzMjY1NCYjHgEVFAYjIiY1NDYzAZ94eHNzeHhzPD4+PDw+PjwcJiYcHCUlHALAua2turqtrblWgo6QgoKQj4HQJhscJiYcGyYAAQBRAAACEgKyAAoAKUAmBwYFAwECAUoAAgI5SwQDAgEBAFoAAAA6AEwAAAAKAAoUEREFCBcrJRUhNTMRByc3MxECEv5fqJgw1GNYWFgB511Ogv2mAAAAAAEANAAAAfsCwAAZADBALRYVAgACCwEBAAJKAAICA1sEAQMDQUsAAAABWQABAToBTAAAABkAGCcRFwUIFysAHgEVFA4BByEHITU+AjU0JiMiBgcnPgEzAVRjNDh+cwE5DP5TgoA0PDQtPyBIKWpJAsA0WDc9c4toWlV9jWQzNDwhJzg1NQAAAAABACf/8wIBAsAAKABCQD8mAQQFJQEDBAYBAgMREAIBAgRKAAMAAgEDAmMABAQFWwYBBQVBSwABAQBbAAAAQgBMAAAAKAAnJCEjJSwHCBkrAB4BFRQGBx4BFRQOASMiJic3HgEzMjY1NCsBNzMyNjU0JiMiBgcnNjMBUWQ2TTxGWT5ySkN2J0UcTitBS4Y7DSo0RUI1KkQhO1h7AsAvUDA+Vg4HVk07YDcxLzwiIkQ6eVI4NTE3HiBAVQAAAAEAPgAAAhoCwAAOACxAKQYBAAMBSggHAgRIBQEDAgEAAQMAYQAEBAFZAAEBOgFMEREUEREQBggaKyUjFSM1ITUTFwMzNzMVMwIaUmz+4sZer6oLYFKfn59OAdMl/lu4uAAAAAABAD//8wIKArIAHQA9QDoCAQQBDw4CAwUCSgAFBAMEBQNwAAEABAUBBGMAAAAGWQAGBjlLAAMDAlsAAgJCAkwREiQjJiIQBwgbKwEhFTYzMh4BFRQOASMiJzcWMzI2NTQmIyIGByMRIQHj/vc1PDdXMT5wSn9UQjtRQEg9NBgtHVMBgwJewBs0Y0RFaztaP0FNRkhBCwwBYgAAAAACAET/8wIYAsAAGAAjAEhARRABAgERAQMCFgEEAyABBQQESgYBAwAEBQMEYwACAgFbAAEBQUsHAQUFAFsAAABCAEwZGQAAGSMZIh4cABgAFyMlJggIFysAHgEVFA4BIyImNTQ+ATMyFwcmIyIGBzYzEjY1NCMiBgceATMBjFg0O2dCfHRBfFRPPysuNUZUBD1hGDppKEUZAjpBAcYyZEdJcD2zm3OtXypIHYNzUf6CVEiPKyZxaQAAAQBW//QCAwKyAAYAHUAaBQEAAQFKBgEARwAAAAFZAAEBOQBMERECCBYrNwEhNSEVAYoBCP7EAa3+8BQCRlhQ/ZIAAAADADn/8wIfAsAAGgAnADMAKEAlKx4PAgQDAgFKAAICAVsAAQFBSwADAwBbAAAAQgBMKiwrKAQIGCsABgceARUUDgEjIi4BNTQ3LgE1ND4BMzIeARUEHgEXPgE1NCYjIgYVEi4BJwYVFBYzMjY1AgM4OkVJO29LTG04hjgyPWM3O2E7/r4eNjAsJjgzMzjrJkE+W0E+PkMB3UghH149OFs0NFk3djwdSTk7UyopUDkoKhsRGzYnLzc2Mf7aMyAWL2A2PT8yAAAAAAIAOv/oAhACvwAUACAAOEA1FwEDAgoBAAMCSgcGAgBHBQEDAAADAF8AAgIBWwQBAQFBAkwVFQAAFSAVHxsZABQAEysGCBUrABYVFA4BByc+ATcGByIuATU0PgEzEjY3NiYjIgYVFBYzAZh4UKeNGYuSCkBbOFozPWpDHj4cAjdEOj06NQK/kH6MsWkjUSV7aEkBNmRDSWo4/o0kInVjTEpHQgAAAgDS//MBhQIKAAsAFwAfQBwAAQEAWwAAADxLAAICA1sAAwNCA0wkJCQhBAgYKxI2MzIWFRQGIyImNRA2MzIWFRQGIyImNdI0JSY0NCYlNDQlJzMzJyU0AdU1NSUlNTUl/sI0NCUmNDQmAAAAAgDH/0UBhQIKAAsAGgAvQCwUAQIDAUoFAQMAAgMCXQAAAAFbBAEBATwATAwMAAAMGgwZExIACwAKJAYIFSsAFhUUBiMiJjU0NjMSFhUUBg8BIzcuATU0NjMBUTQ0JiU0NCUnMwwPTVYwERQzJgIKNSUlNTUlJTX+qDQmFS0hsMkMKBYmNAAAAAEAUQAaAggCWQAGAAazBgMBMCsBDQEHJTUlAgj+qQFXN/6AAYMCCM/OUe9h7wAAAAIAXQCnAfsByAADAAcAIkAfAAEAAAMBAGEAAwICA1UAAwMCWQACAwJNEREREAQIGCsBITUhESE1IQH7/mIBnv5iAZ4BbFz+31sAAAABAFEAGgIIAlkABgAGswYCATArARUFJy0BNwII/oA3AVb+qjQBamHvUM/NUwAAAAACAE3/8wH8AsAAHgAqADxAORwbAgABAUoAAAEEAQAEcAABAQJbBQECAkFLBgEEBANbAAMDQgNMHx8AAB8qHyklIwAeAB0qHAcIFisAHgEVFA4BBw4CHQEjNTQ+ATc+ATU0JiMiBgcnNjMSFhUUBiMiJjU0NjMBa18yGyYgHSIXax0pICUiOi4kRxxLWIUILCwgICssHwLALEoqJzcjFxUeLB4dIis9JxgcJx4kKSIjOmb9yiwfICwsIB8sAAIABf+kAk8CwAAoADQATkBLJiUCAgQWAQcCMjEKAwYHA0oAAgkBBwYCB2MABgABAAYBYwADAAADAF8ABAQFWwgBBQVBBEwpKQAAKTQpMy8tACgAJyYkJCYlCggZKwAWFRQOASMiLgEnIw4BIyImNTQ2MzIXERQWMzI+ATU0LgEjIgYHJzYzAgYVFBYzMjY3NSYjAcqFGUI8JjUaAgQRRDVQS2hjTEseHRkXBiFcUzhuOjaAmHEsHyUnJAsaHALA4L+GpFMsQSAqNnxpgIYo/tdDNUR1cW2RUikzP3D+sFZkTEwvIvQNAAACAAgAAAJQArIABwAKADFALgkBBAEBSgYBBAUBAwAEA2IAAQE5SwIBAAA6AEwICAAACAoICgAHAAcREREHCBcrNwcjEzMTIy8BCwGvMHfckNx7MBhjY6amArL9TqZaAVj+qAAAAwBRAAACKAKyAA4AFwAfAC9ALAsBBAMBSgADAAQFAwRjAAICAVsAAQE5SwAFBQBbAAAAOgBMISQhKiEhBggaKyQGKwERMzIWFRQGBx4BFQImKwEVMzI2NRYmKwEVMzI1AiiYdcq9bo5JN0RalD89U1o7OhtIQGJejFxcArJRXjxNDAxNTgFmLscxNfI1420AAQA0//MCQALAABkANEAxAgEAAw4DAgEADwECAQNKAAAAA1sEAQMDQUsAAQECWwACAkICTAAAABkAGCQkJAUIFysAFhcHJiMiBhUUFjMyNjcXBiMiLgE1ND4BMwGqYCw8P1BUamhXMkcjOFSEWYxPUYxVAsAiJEgzgYqIgR8cR1JTonJwolQAAAIARwAAAjECsgAIABAAH0AcAAICAVsAAQE5SwADAwBbAAAAOgBMISQhIQQIGCskBisBETMyFhUuASsBETMyEQIxtoupnpa2emdVQEG7mZkCspHElGj9/wEFAAAAAQBxAAACFgKyAAsAKUAmAAAAAQIAAWEABQUEWQAEBDlLAAICA1kAAwM6A0wRERERERAGCBorEzMVIxUhFSERIQch5fr6ATH+WwGfDf7iAYpX21gCslgAAAEAfwAAAicCsgAJACNAIAAAAAECAAFhAAQEA1kAAwM5SwACAjoCTBEREREQBQgZKxMhFSERIxEhByHzAQT+/HQBqAz+2AF+WP7aArJYAAAAAQAl//MCJgLAAB0AQUA+CQEBAAoBBAEVAQIDGgEFAgRKAAQAAwIEA2EAAQEAWwAAAEFLAAICBVsGAQUFQgVMAAAAHQAcERIkJSUHCBkrFiY1ND4BMzIWFwcuASMiBhUUFjMyNzUjJzMRDgEjuJNRiVNDXytBIEEoUGdRVEAydQzyNW9EDbewcqJSJylDHRuBio5/Hb5Z/rEeIQAAAQBHAAACEQKyAAsAIUAeAAMAAAEDAGEEAQICOUsFAQEBOgFMEREREREQBggaKwEjESMRMxEzETMRIwGd4nR04nR0ATr+xgKy/ucBGf1OAAABAFwAAAH8ArIACwAjQCAEAQAABVkABQU5SwMBAQECWQACAjoCTBEREREREAYIGisBIxEzFSE1MxEjNSEB/JaW/mCWlgGgAlr9/1lZAgFYAAEAPP/zAfwCsgAQAClAJgYBAQIFAQABAkoAAgIDWQADAzlLAAEBAFsAAABCAEwREyQiBAgYKyUUBiMiJzceATMyNjURIzUhAfx9f21XLydGJEFLzwFD7W2NQEkZFVRNAWpZAAACAFgAAAJTArIAAwAJACZAIwkGAgEAAUoCAQAAOUsDBAIBAToBTAAACAcFBAADAAMRBQgVKzMRMxETMwMBIwNYdPSA8QEEi/cCsv1OArL+xv6IAXEAAAAAAQB4AAACIQKyAAUAGUAWAAAAOUsAAQECWgACAjoCTBEREAMIFysTMxEhByF4cwE2Df5kArL9r2EAAAAAAQAZAAACPwKyABQAKEAlEgkGAwEDAUoAAQMAAwEAcAQBAwM5SwIBAAA6AEwSERYWEAUIGSshIwMmNTQ3AyMDFhUUBwMjEzMbATMCP2sQAwNmZW0EAQ5oJ4tjXowBUEI9Ty7+LgHSM2pAIP6xArL+MgHOAAABAEcAAAIRArIADgAdQBoHAQABAUoCAQEBOUsDAQAAOgBMERUREwQIGCsTFhURIxEzEy4BNREzESOeEGeX3AcJZ5cCS6Ru/scCsv21SndQATr9TgACACb/8wIyAsAACwAXAB9AHAACAgFbAAEBQUsAAwMAWwAAAEIATCQkJCEECBgrJAYjIiY1NDYzMhYVLgEjIgYVFBYzMjY1AjKHf3+Hh39/h3dES0tERUpLRLXCv6akxMGmiISEiYeEhIgAAAACAGAAAAI0ArIACgASACNAIAAEAAABBABjAAMDAlsAAgI5SwABAToBTCEjIREhBQgZKwAGKwEVIxEzMhYVJisBETMyNjUCNJB9VHO/hZB5lFRVRk0BZW/2ArJtbIL+80BLAAAAAgAo/1MCYALAABMAHwAqQCcCAQADAUoGBQIARwACAgFbAAEBQUsAAwMAWwAAAEIATCQkJCkECBgrJAYHHgEXBy4CIyImNTQ2MzIWFS4BIyIGFRQWMzI2NQIyQ01NVxprFzROOnmBh35/hnlBS0tBQ0lLQeifKQ9JTSg5RSS9pqXDwKeJg4SJiIODiQACAFUAAAJJArIADAAVACtAKAIBAQUBSgAFAAEABQFhAAQEA1sAAwM5SwIBAAA6AEwhIyERERMGCBorAAYHEyMDIxEjETMgFS4BKwEVMzI2NQIiVkfEh65LdMABDXlFSFNWREYBomAW/tQBHP7kArLIPDbrOj8AAAABAB//8wIlAsAAJQArQCgYAQMCGQYFAwEDAkoAAwMCWwACAkFLAAEBAFsAAABCAEwjLCMiBAgYKyQOASMiJzcWMzI2NTQuAScuATU0PgEzMhcHJiMiBhUUHgEXHgEVAiU/d1KgXkBOcD5RGTw4c2w9bESLXD1HXDhFHUU/ZGmFXjRcR0g6NR8qIREiXk03VS9TRT0uKxsmHxMeXloAAAAAAQAhAAACOAKyAAcAG0AYAwEBAQJZAAICOUsAAAA6AEwREREQBAgYKyEjESM1IQcjAWV00AIXDMcCVF5eAAAAAAEAPf/zAhsCsgASABtAGAMBAQE5SwACAgBbAAAAQgBMEyMTIwQIGCslFA4BIyImNREzERQWMzI2NREzAhs5bEtxfXQ7P0A7deJGbD2CbQHQ/kZWU1NWAboAAAAAAQAPAAACSQKyAAYAG0AYBgEBAAFKAgEAADlLAAEBOgFMEREQAwgXKwEzAyMDMxMB03bbhNt8owKy/U4Csv28AAEAAgAAAlYCsgAMAChAJQoHAgMAAwFKAAMCAAIDAHAEAQICOUsBAQAAOgBMEhIREhAFCBkrISMLASMDMxsBMxsBMwH3iERHilhwNkp3RUBoAf/+AQKy/b4B8v4OAkIAAAEAFQAAAkQCsgALACZAIwoHBAEEAQABSgQDAgAAOUsCAQEBOgFMAAAACwALEhISBQgXKxMXNzMDEyMLASMTA6eFh3u/1YGZmnvQvwKy+Pj+w/6LASX+2wFvAUMAAQALAAACTQKyAAgAHUAaCAUCAwABAUoCAQEBOUsAAAA6AEwSEhADCBcrISMRAzMbATMDAWZ054CjpXrnAQcBq/65AUf+VgAAAQA7AAACHAKyAAkAL0AsCAEBAgMBAAMCSgABAQJZAAICOUsEAQMDAFkAAAA6AEwAAAAJAAkREhEFCBcrJQchNQEhNSEVAQIcDP4rAV/+xQG7/qZgYFoB+l5b/gkAAAAAAQCt/4oBvgMyAAcAIkAfAAAAAQIAAWEAAgMDAlUAAgIDWQADAgNNEREREAQIGCsTIRUjETMVIa0BEaen/u8DMln9CVgAAAAAAQAs/5YCLAMsAAMABrMCAAEwKxMBBwGEAahZ/lkDLPySKANtAAAAAAEAmv+KAasDMgAHACJAHwADAAIBAwJhAAEAAAFVAAEBAFkAAAEATRERERAECBgrBSE1MxEjNSEBq/7vp6cBEXZZAvZZAAAAAAEAPQIPAhsDSQAGABlAFgIBAAIBSgACAAJyAQEAAGkREhADCBcrASMnByMTMwIbc317c71kAg/f3wE6AAEAMv9JAib/pQADABhAFQAAAQEAVQAAAAFZAAEAAU0REAIIFisXIRUhMgH0/gxbXAAAAAABALACbgGpAyUAAwAGswMBATArEzcXB7A0xSICy1p8OwAAAAACADj/8wIVAh4AHQAoAEZAQxcBAgMWAQECIAEFBAUCAgAFBEoDAQBHAAEABAUBBGMAAgIDWwADA0RLBgEFBQBbAAAAQgBMHh4eKB4nJyQjJCcHCBkrJBYXByYnDgEjIiY1NDY7ATU0JiMiBgcnNjMyFh0BBjY3NSMiBhUUFjMB7RIWGlMaHVc0UF6DeEs8ORxKJhxfWmlqw0ETPkxGLSxjHQdMCj8kJVpKU1oiMi4ODU8kXFXsPCQgdTMwKiwAAAACAFn/8wIfAvEADwAbAIBLsBRQWEAUDwEDABkYAgQDCgEBBANKDg0CAEgbQBQPAQMAGRgCBAMKAQIEA0oODQIASFlLsBRQWEAXAAMDAFsAAABESwUBBAQBWwIBAQFCAUwbQBsAAwMAWwAAAERLAAICOksFAQQEAVsAAQFCAUxZQA0QEBAbEBooEiQhBggYKxI2MzIWFRQGIyInByMRNxESNjU0JiMiBgcVFjPkSytlYG9kWDIGY3CiPTc2IjsVKEAB9iiSg3yaQTQC5A3+4P53X2FkXCoi9z0AAAAAAQBT//MCDQIeABcANEAxDgECAQ8BAgMCAgEAAwNKAAICAVsAAQFESwQBAwMAWwAAAEIATAAAABcAFiMlJAUIFyskNxcOASMiJjU0PgEzMhcHJiMiBhUUFjMBl0MzI2I0eYg+dVBpTjRAQUJMTEJPLUgeI5V9UX9JQEYsX2BeWAACADn/8wH/AvEAEAAaAGNAFA8BBAIYFwIDBAMBAAMDShAAAgJIS7AUUFhAFwUBBAQCWwACAkRLAAMDAFsBAQAAOgBMG0AbBQEEBAJbAAICREsAAAA6SwADAwFbAAEBQgFMWUANERERGhEZJiUjEQYIGCsBESMnDgEjIiY1ND4BMzIXEQIGFRQzMjc1JiMB/2MIGkwuY2QzXkBRNKI9bkIvKT8C5P0cQSYolIFRfkc6AQ3+119hwEz5OwAAAAIAQv/zAhcCHgAWAB0AOUA2BQEAAwYBAQACSgAEAAMABANhBgEFBQJbAAICREsAAAABWwABAUIBTBcXFx0XHBMUJSUhBwgZKzYWMzI2NxcOASMiJjU0PgEzMhYVFAchNgYHMy4BI7tPPCVDIzAlZDd5hjpuSWl7A/6iSEQF9QI8OJdNFxdEHyKXfk9/SI17HhTnTk1LUAAAAQBXAAACOALxABYAXUAKAQEABgIBAQACSkuwF1BYQBsFAQEEAQIDAQJhAAAABlsHAQYGO0sAAwM6A0wbQBkHAQYAAAEGAGMFAQEEAQIDAQJhAAMDOgNMWUAPAAAAFgAVERERERMjCAgaKwAXByYjIgYdATMHIxEjESM1MzU0PgEzAfBIIjM+NDKxDaRweHgzXDwC8R9OFigqXlP+aQGXU18yTCoAAAAAAgA1/ygCMwJTADkARACbQAsvDAIBCAFKOQEHSEuwMVBYQDgAAAcJBwAJcAAEBgUGBAVwAAgAAQIIAWMKAQkJB1sABwdESwACAgZbAAYGOksABQUDWwADAz4DTBtANgAABwkHAAlwAAQGBQYEBXAACAABAggBYwACAAYEAgZjCgEJCQdbAAcHREsABQUDWwADAz4DTFlAEjo6OkQ6QycrNCMTJTUmEgsIHSsBDgEjHgEVFA4BIyInDgEVFDsBMh4BFRQGIyIuATUzFB4BMzI2NTQmKwEiJjU0NjcuATU0PgEzFjY3BAYVFBYzMjY1NCMCMx1JMzAwM15ALRsLDEFcOFgxiIBZZytkFzo3UEY3L1tHSR4cLys4ZEBWZTn+2DY3NTI0ZwH2CgcWQi80UC4JCBcNKCZDKk9XJUc4HiMRJyYgIzosGzISGUc0N1UvARocgzsyMzs6NmsAAAAAAQBZAAACAALvABMAKkAnAAECAA8BAQICShMSAgBIAAICAFsAAABESwMBAQE6AUwTIxMiBAgYKxM+ATMyFhURIxE0JiMiBgcRIxE3ySBVL0lKcCQoI0EXcHABzycoUUz+fwFwLyktIf6GAuMMAAAAAAIAbAAAAgkDEwALABUAYkuwF1BYQCEAAAABWwcBAQFDSwAFBQZZAAYGPEsEAQICA1kAAwM6A0wbQB8HAQEAAAYBAGMABQUGWQAGBjxLBAECAgNZAAMDOgNMWUAUAAAVFBMSERAPDg0MAAsACiQICBUrABYVFAYjIiY1NDYzEzMVITUzESM1IQFMKSkgISgpIE2Q/mOdmAEIAxMpHh4oKB4fKP0/UlIBbFIAAAACAFb/KAHHAxMACwAXAEy0EA8CAkdLsBdQWEAWAAAAAVsEAQEBQ0sAAgIDWQADAzwCTBtAFAQBAQAAAwEAYwACAgNZAAMDPAJMWUAOAAAXFhUUAAsACiQFCBUrABYVFAYjIiY1NDYzExQGByc+ATURIzUhAZEoKCEgKSkgV66xEoCB0AFAAxMoHx4oKB4eKf1cj5ggVhhqaAFWUgACAFwAAAJAAvEAAwAJACBAHQcBAAIBSgMCAgJIAAICPEsBAQAAOgBMEhQQAwgXKzMjETcbASMDNzPMcHCJ64nj1IIC5A3+M/7cASHvAAAAAAEAMv/zAgEC5AAOAEhACgQBAAIFAQEAAkpLsBdQWEAVAAICA1kAAwM7SwAAAAFbAAEBQgFMG0ATAAMAAgADAmEAAAABWwABAUIBTFm2ERMjIQQIGCslFDMyNxcGIyImNREjNSEBQVAoLBw3UU9ZnwEPkEMSTh5ZTgH4UgABACoAAAIuAh4AHwBcQAwcFwIBBRIKAgABAkpLsBJQWEAWAwEBAQVbCAcGAwUFPEsEAgIAADoATBtAGgAFBTxLAwEBAQZbCAcCBgZESwQCAgAAOgBMWUAQAAAAHwAeIxESIxIjEwkIGysAFhURIxE0JiMiBxEjETQmIyIHESMRMxc+ATMyFz4BMwH2OGMNFiokWw0WKiRkVAgZNCRGFBg4JAIeRFL+eAF5LCI1/m4BeSwiNf5uAhA5IyRDICMAAAABAFkAAAIAAh4AFABJQAoCAQMAEgECAwJKS7ASUFhAEgADAwBbAQEAADxLBAECAjoCTBtAFgAAADxLAAMDAVsAAQFESwQBAgI6AkxZtxMkEyMQBQgZKxMzFz4BMzIWFREjETQuASMiBgcRI1lhCCFZMUlKcAsgICRBF3ACEEUoK1JL/n8BSTE1GSwh/oUAAAACAD3/8wIbAh4ACwAXACxAKQUBAwMBWwQBAQFESwACAgBbAAAAQgBMDAwAAAwXDBYSEAALAAokBggVKwAWFRQGIyImNTQ2Mw4BFRQWMzI2NTQmIwGffH5xcn1/cT09PD09PDw8Ah6VgICWk4J+mFdeYWJdXmJhXQACAFn/KAIbAh4ADgAaAGtAFAsBBAESEQIDBAYBAAMDSggHAgBHS7ASUFhAGAYBBAQBWwUCAgEBPEsAAwMAWwAAAEIATBtAHAABATxLBgEEBAJbBQECAkRLAAMDAFsAAABCAExZQBMPDwAADxoPGRUTAA4ADRQjBwgWKwARFAYjIicVBxEzFz4BMw4BBxUWMzI2NTQmIwIbamJTM3BhBx5PLUI6FidBOjo0NQIe/ut9mTr4DQLoRCgqVioi9ztcYmVbAAAAAgA9/ygB/wIeAA4AGQBrQBQBAQQAFxYCAwQGAQEDA0oFBAIBR0uwElBYQBgGAQQEAFsFAgIAADxLAAMDAVsAAQFCAUwbQBwAAAA8SwYBBAQCWwUBAgJESwADAwFbAAEBQgFMWUATDw8AAA8ZDxgUEgAOAA0kEgcIFisAFzczEScRBiMiJjU0NjMGFRQWMzI2NzUmIwFjNAdhcDZaZF5tYVg1NSQ5FShAAh5CNP0YDQEFR5GEfJpWwGNbKCL5OwAAAQBeAAACHwIdABUA7UuwFFBYQA4SAQABBwECAAJKAQEGSBtADxIBAAEHAQIAAkoBAQYBSVlLsAxQWEAgAAABAgEAaAUBAQEGWwgHAgYGPEsEAQICA1kAAwM6A0wbS7AUUFhAIQAAAQIBAAJwBQEBAQZbCAcCBgY8SwQBAgIDWQADAzoDTBtLsB1QWEArAAABAgEAAnAFAQEBB1sIAQcHREsFAQEBBlkABgY8SwQBAgIDWQADAzoDTBtAKQAAAQIBAAJwAAUFBlkABgY8SwABAQdbCAEHB0RLBAECAgNZAAMDOgNMWVlZQBAAAAAVABQRERERExESCQgbKwAXByM1DgEHFTMVITUzESM1Mxc+ATMB+CcTUDdRGGr+2E5OoxQfWUICHQ3DbAFWTsRQUAFwUHpEQwABAED/8wICAh4AIwA0QDEOAQEAIA8CAwEfAQIDA0oAAQEAWwAAAERLBAEDAwJbAAICQgJMAAAAIwAiKiMrBQgXKyQ2NTQuAScuATU0NjMyFwcmIyIVFB4BFx4BFRQGIyInNx4BMwFOPRI2NldXcmF1VDBHT2QXODdWVYZjg1Y7IVEsSCYhFx0ZDhZFQUVTPUcvOhQaFw8YRkZRU0pEGh8AAQBH//MCEgKTABYAMkAvFQEFARYBAAUCSgsKAgJIBAEBAQJZAwECAjxLAAUFAFsAAABCAEwjERMREyEGCBorJAYjIiY1ESM1MzU3FTMHIxEUFjMyNxcB9FAsWmJ1dXCzDaYsMDUtKAkWXVABHlJ2DYNS/uMrKRlKAAAAAAEAWf/zAf8CEAATAElACgYBAAELAQIAAkpLsBRQWEASBAEBATxLAAAAAlwDAQICOgJMG0AWBAEBATxLAAICOksAAAADXAADA0IDTFm3EyMREyIFCBkrNxQWMzI2NxEzESMnDgEjIiY1ETPJJSYkQxRwYQccWjBMTHCfLikqIAF+/fBEJypSTAF/AAAAAQAwAAACKAIQAAYAG0AYBAEAAQFKAgEBATxLAAAAOgBMEhEQAwgXKyEjAzMbATMBbYK7eYWHcwIQ/k0BswAAAAEADAAAAkwCEAAMAC5AKwkGAQMAAgFKAAIBAAECAHADAQEBPEsFBAIAADoATAAAAAwADBISERIGCBgrIQsBIwMzGwEzGwEzAwFqPECJWWw3SnBEN2hWAXf+iQIQ/jYBh/55Acr98AAAAQArAAACLQIQAAsAJkAjCgcEAQQCAAFKAQEAADxLBAMCAgI6AkwAAAALAAsSEhIFCBcrMxMnMxc3MwcTIycHK76pgWxse6W+g4KBARb6urr1/uXY2AAAAAEAMf8oAicCEAAOACBAHQwBAAEBSgQDAgBHAgEBATxLAAAAOgBMEhEYAwgXKwUOAQcnPgI3IwMzGwEzAXEgeWoONEAmDyayd4WHcwJgbQlUCCEyKQIQ/j4BwgAAAQBbAAAB/AIQAAkAL0AsCAEBAgMBAAMCSgABAQJZAAICPEsEAQMDAFkAAAA6AEwAAAAJAAkREhEFCBcrJQchNQEhNSEVAQH8DP5rARn+/QGH/ulaWlIBZFpS/pwAAAAAAQBx/3cByQNFACoAO0A4CQEDBBkBAQMCSgAFAAAEBQBjAAQAAwEEA2MAAQICAVcAAQECWwACAQJPKikgHx4dFBMSERAGCBUrASIGHwEWFRQGBx4BFRQPAQYWMxUiJjU0PwE2NTQmIzUyNjU0LwEmNTQ2MwHJOTwEEgE7Ojw5ARIEPDlpcQETAURPT0QBEwFxaQLyISi4CRA3OQoKNjgSCbgpIFNBTg8IrQULLilaKS4KBa0ID05CAAEA+P+ZAV8DKAADABFADgABAAFyAAAAaREQAggWKwUjETMBX2dnZwOPAAAAAQCP/3cB5wNFACgAQUA+BgEABB4BAQANAQMBA0oGAQUABAAFBGMAAAABAwABYwADAgIDVwADAwJbAAIDAk8AAAAoACgnJhEYERgHCBgrEhYVFA8CFBYzFSIGFR8BFhUUBiM1MjYvASY1NDY3LgE1ND8BNiYjNfhxARMBR0xMRwETAXFpOTwEEgE8QD89ARIEPTgDRUFODwiuDi4qWisuDqwID05CUyApuAkRODcJCzg4EAm4KCFTAAEAIwDdAjUBnAAZADRAMQkIAgIDFhUCAQACSgQBAwACAAMCYwAAAQEAVwAAAAFbAAEAAU8AAAAZABgkJSQFCBcrEhYXHgEzMjY3Fw4BIyImJy4BIyIGByc+ATPxNCEZHhIcLhVHIE08IzQgGCETHSwWRyBNPAGcHh0WEyooIkFKHhwVFSooIkBLAAAAAAAgAYYAAQAAAAAAAABQAKIAAQAAAAAAAQAQARUAAQAAAAAAAgAHATYAAQAAAAAAAwAaAXQAAQAAAAAABAAQAbEAAQAAAAAABQANAd4AAQAAAAAABgAPAgwAAQAAAAAABwA0AoYAAQAAAAAACAAqAxEAAQAAAAAACQAmA4oAAQAAAAAACwAWA98AAQAAAAAADAAWBCQAAQAAAAAADQA6BLEAAQAAAAAADgAaBSIAAQAAAAAAEAAJBVEAAQAAAAAAEQAGBWkAAwABBAkAAACgAAAAAwABBAkAAQAgAPMAAwABBAkAAgAOASYAAwABBAkAAwA0AT4AAwABBAkABAAgAY8AAwABBAkABQAaAcIAAwABBAkABgAeAewAAwABBAkABwBoAhwAAwABBAkACABUArsAAwABBAkACQBMAzwAAwABBAkACwAsA7EAAwABBAkADAAsA/YAAwABBAkADQB0BDsAAwABBAkADgA0BOwAAwABBAkAEAASBT0AAwABBAkAEQAMBVsARABpAGcAaQB0AGkAegBlAGQAIABkAGEAdABhACAAYwBvAHAAeQByAGkAZwBoAHQAIACpACAAMgAwADEAMgAtADIAMAAxADUALAAgAFQAaABlACAATQBvAHoAaQBsAGwAYQAgAEYAbwB1AG4AZABhAHQAaQBvAG4AIABhAG4AZAAgAFQAZQBsAGUAZgBvAG4AaQBjAGEAIABTAC4AQQAuAABEaWdpdGl6ZWQgZGF0YSBjb3B5cmlnaHQgqSAyMDEyLTIwMTUsIFRoZSBNb3ppbGxhIEZvdW5kYXRpb24gYW5kIFRlbGVmb25pY2EgUy5BLgAARgBpAHIAYQAgAE0AbwBuAG8AIABNAGUAZABpAHUAbQAARmlyYSBNb25vIE1lZGl1bQAAUgBlAGcAdQBsAGEAcgAAUmVndWxhcgAAMwAuADIAMAA2ADsAQwBUAEQAQgA7AEYAaQByAGEATQBvAG4AbwAtAE0AZQBkAGkAdQBtAAAzLjIwNjtDVERCO0ZpcmFNb25vLU1lZGl1bQAARgBpAHIAYQAgAE0AbwBuAG8AIABNAGUAZABpAHUAbQAARmlyYSBNb25vIE1lZGl1bQAAVgBlAHIAcwBpAG8AbgAgADMALgAyADAANgAAVmVyc2lvbiAzLjIwNgAARgBpAHIAYQBNAG8AbgBvAC0ATQBlAGQAaQB1AG0AAEZpcmFNb25vLU1lZGl1bQAARgBpAHIAYQAgAE0AbwBuAG8AIABpAHMAIABhACAAdAByAGEAZABlAG0AYQByAGsAIABvAGYAIABUAGgAZQAgAE0AbwB6AGkAbABsAGEAIABDAG8AcgBwAG8AcgBhAHQAaQBvAG4ALgAARmlyYSBNb25vIGlzIGEgdHJhZGVtYXJrIG9mIFRoZSBNb3ppbGxhIENvcnBvcmF0aW9uLgAAQwBhAHIAcgBvAGkAcwAgAEMAbwByAHAAbwByAGEAdABlACAARwBiAFIAIAAmACAARQBkAGUAbgBzAHAAaQBlAGsAZQByAG0AYQBuAG4AIABBAEcAAENhcnJvaXMgQ29ycG9yYXRlIEdiUiAmIEVkZW5zcGlla2VybWFubiBBRwAAQwBhAHIAcgBvAGkAcwAgAEMAbwByAHAAbwByAGEAdABlACAAJgAgAEUAZABlAG4AcwBwAGkAZQBrAGUAcgBtAGEAbgBuACAAQQBHAABDYXJyb2lzIENvcnBvcmF0ZSAmIEVkZW5zcGlla2VybWFubiBBRwAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGMAYQByAHIAbwBpAHMALgBjAG8AbQAAaHR0cDovL3d3dy5jYXJyb2lzLmNvbQAAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGMAYQByAHIAbwBpAHMALgBjAG8AbQAAaHR0cDovL3d3dy5jYXJyb2lzLmNvbQAATABpAGMAZQBuAHMAZQBkACAAdQBuAGQAZQByACAAdABoAGUAIABPAHAAZQBuACAARgBvAG4AdAAgAEwAaQBjAGUAbgBzAGUALAAgAHYAZQByAHMAaQBvAG4AIAAxAC4AMQAgAG8AcgAgAGwAYQB0AGUAcgAATGljZW5zZWQgdW5kZXIgdGhlIE9wZW4gRm9udCBMaWNlbnNlLCB2ZXJzaW9uIDEuMSBvciBsYXRlcgAAaAB0AHQAcAA6AC8ALwBzAGMAcgBpAHAAdABzAC4AcwBpAGwALgBvAHIAZwAvAE8ARgBMAABodHRwOi8vc2NyaXB0cy5zaWwub3JnL09GTAAARgBpAHIAYQAgAE0AbwBuAG8AAEZpcmEgTW9ubwAATQBlAGQAaQB1AG0AAE1lZGl1bQAAAAACAAAAAAAA/7UAMgAAAAEAAAAAAAAAAAAAAAAAAAAAAGIAAAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYABhAAAAAQAB//8ADwABAAAADAAAAEAASAACAAgABwAJAAEADgAOAAEAHwAhAAEAIwA9AAEAQQBBAAEARABdAAEAXwBfAAEAYQBhAAEABAAAAAIAAAABAAAAAQAAAAEAAAAKAIIAtgACREZMVAAObGF0bgAeAAQAAAAA//8AAwAAAAEAAwBAAApBRksgAEBBWkUgAEBDQVQgAExDUlQgAEBLQVogAEBNT0wgAEBQTEsgAEBST00gAEBUQVQgAEBUUksgAEAAAP//AAMAAAABAAMAAP//AAQAAAABAAIAAwAEY2FsdAAaZnJhYwAibG9jbAAob3JkbgAuAAAAAgADAAQAAAABAAEAAAABAAAAAAABAAIABQAMABYAIAAqADQABgAAAAIANgBWAAYAAAACAGwAggAGAAAAAgCOAK4ABgAAAAIAxADaAAYAAAAEAOYA/AESATAAAwAAAAIAEAAWAAEAGgAAAAEAAQBPAAEAAAABAAEATwADAAAAAgAQABYAAQAaAAAAAQABAC8AAQAAAAEAAQAvAAMAAQASAAEADgAAAAAAAQAAAAEAAAADAAEAEgABAA4AAAAAAAEAAAABAAAAAwABABYAAQAOAAAAAAABAAIAJABEAAIAAQATABwAAAADAAEAFgABAA4AAAAAAAEAAgAyAFIAAgABABMAHAAAAAMAAQASAAEADgAAAAAAAQAAAAEAAAADAAEAEgABAA4AAAAAAAEAAAABAAAAAwAAAAEADgABABIAAAABAAAAAQAAAAMAAQASAAEADgAAAAAAAQAAAAEAAAADAAAAAQAQAAIAFAAaAAAAAQAAAAEAAQADAAEAAAADAAIAFAAaAAEAEAAAAAAAAQAAAAEAAQADAAEAAAABAAAACgAsAC4AAkRGTFQADmxhdG4AGAAEAAAAAP//AAAABAAAAAD//wAAAAAAAAAAAAEAAAAA39bKXgAAAADSFGHqAAAAANRm4iI=";
+/** the @font-face that names Bevy's default font BEVY_FONT_FAMILY */
+export const bevyFontFace = () => `@font-face { font-family: "${BEVY_FONT_FAMILY}"; src: url("data:font/ttf;base64,${DATA}"); font-weight: 1 1000; }`;
diff --git a/sdk/render/src/bevy3d/lightmap.tsx b/sdk/render/src/bevy3d/lightmap.tsx
new file mode 100644
index 00000000..f0128c8e
--- /dev/null
+++ b/sdk/render/src/bevy3d/lightmap.tsx
@@ -0,0 +1,29 @@
+// Bevy's Lightmap on a <Model>'s meshes, by their glTF mesh's name.
+import { useContext } from "react";
+import { InModel, node3d } from "../3d/all";
+
+export interface LightmapProps {
+ /** the glTF mesh it lies on, by name (Bevy's GltfMeshName): every primitive of it */
+ mesh: string;
+ /** the bake: a .ktx2 (or other picture) file, staticFile("lightmaps/room.ktx2"), sampled by the mesh's second UVs */
+ image: string;
+ /** the rect in the image those UVs are relative to, for meshes packed in one atlas ({ min: [0, 0], max: [1, 1] } by
+ * default) */
+ uv_rect?: { min: [number, number]; max: [number, number] };
+ /** bicubic sampling: smoother, slower, may leak light (false by default) */
+ bicubic_sampling?: boolean;
+}
+
+/** A light bake on the meshes of a <Model> its `mesh` names, lighting them in place of the scene's lights, scaled by
+ * their material's lightmap_exposure (a <StandardMaterial lightmap_exposure> in the same Model, by material). Goes in
+ * a <Model>. @bevy bevy_pbr::lightmap::Lightmap */
+export function Lightmap({ mesh, image, uv_rect, bicubic_sampling }: LightmapProps) {
+ if (!useContext(InModel)) throw new TypeError("Lightmap: goes in a <Model>, on the glTF meshes it names (mesh)");
+ if (typeof mesh !== "string" || mesh === "") throw new TypeError(`Lightmap: mesh is the glTF mesh's name, got ${JSON.stringify(mesh)}`);
+ if (typeof image !== "string" || image === "") throw new TypeError(`Lightmap: image is a picture file (staticFile("lightmaps/x.ktx2")), got ${JSON.stringify(image)}`);
+ const r = uv_rect ?? { min: [0, 0], max: [1, 1] };
+ const corners = [...(r.min ?? []), ...(r.max ?? [])];
+ if (corners.length !== 4 || !corners.every((x) => Number.isFinite(x) && x >= 0 && x <= 1)) throw new RangeError(`Lightmap: uv_rect is { min: [u, v], max: [u, v] } within 0..1, got ${JSON.stringify(uv_rect)}`);
+ const [uv_x0, uv_y0, uv_x1, uv_y1] = corners;
+ return node3d("Lightmap", { lightmap: image, mesh, bicubic: bicubic_sampling ? 1 : 0, uv_x0, uv_y0, uv_x1, uv_y1 });
+}
diff --git a/sdk/render/src/bevy3d/materials.tsx b/sdk/render/src/bevy3d/materials.tsx
index 9a619bf8..13aebd0c 100644
--- a/sdk/render/src/bevy3d/materials.tsx
+++ b/sdk/render/src/bevy3d/materials.tsx
@@ -5,6 +5,7 @@ import { InModel } from "../3d/all";
import { LinearRgba, MADE_FROM, baseOf, emissiveOf, type Affine2, type Srgba } from "./all";
import { samplerSpec, surfaceShader, type SamplerSpec, type SurfaceShaderSpec, type SurfaceDrawProps, type ToonBand, type ToonHighlight, type ToonOutline, type ToonRim } from "../3d";
import { MeshBasicMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, type MeshStandardMaterialProps } from "../three";
+import { ProceduralExtension, proceduralOf, type ProceduralExtensionProps } from "./procedural";
/** A picture read with its own sampler: Bevy's load_with_settings, whose ImageLoaderSettings give the Image its
* ImageSamplerDescriptor ({ path: "checker.png", sampler: { filter: "nearest" } } for hard pixels). */
@@ -49,9 +50,9 @@ export interface StandardMaterialProps {
reflectance?: number;
clearcoat?: number;
clearcoat_perceptual_roughness?: number;
- specular_transmission?: number;
- ior?: number;
- thickness?: number;
+ /** the clearcoat layer's own normal map, read as data (not sRGB), as Bevy's examples load it with is_srgb false */
+ clearcoat_normal_texture?: Tex;
+ specular_transmission?: number; ior?: number; thickness?: number;
unlit?: boolean;
alpha_mode?: AlphaMode;
double_sided?: boolean;
@@ -81,8 +82,8 @@ export interface StandardMaterialProps {
depth_bias?: number;
/** "Forward" or "Deferred" (in the deferred pass, with a camera that has one) */
opaque_render_method?: "Forward" | "Deferred";
- /** light passed through and scattered (leaves, paper, wax), 0..1 */
- diffuse_transmission?: number;
+ /** light passed through and scattered (leaves, paper, wax), 0..1; lightmap_exposure: a <Lightmap>'s bake times this */
+ diffuse_transmission?: number; lightmap_exposure?: number;
/** its fields' tracks, sampled by the engine from the frame clock: { base_color: track({ 0: "#3060ff", 30: "#ff4070" }) } */
animate?: StandardMaterialAnimate;
}
@@ -183,7 +184,7 @@ function further(p: StandardMaterialProps): Record<string, unknown> {
if (p.opaque_render_method !== "Forward" && p.opaque_render_method !== "Deferred") throw new TypeError(`StandardMaterial: opaque_render_method is "Forward" or "Deferred", got ${JSON.stringify(p.opaque_render_method)}`);
out.renderMethod = p.opaque_render_method.toLowerCase();
}
- if (p.diffuse_transmission !== undefined) out.diffuseTransmission = p.diffuse_transmission;
+ for (const [k, o] of [["diffuse_transmission", "diffuseTransmission"], ["lightmap_exposure", "lightmapExposure"]] as const) if (p[k] !== undefined) out[o] = p[k];
return out;
}
@@ -193,9 +194,9 @@ function draw(p: StandardMaterialProps): SurfaceDrawProps {
a === undefined || a === "Opaque" ? {} : typeof a === "object" ? { alphaMode: "mask" as const, alphaCutoff: a.Mask } : { alphaMode: a === "AlphaToCoverage" ? ("coverage" as const) : (a.toLowerCase() as "opaque" | "blend" | "premultiplied" | "add" | "multiply") };
// no culling draws both faces; culling the front draws the inside (double_sided is the lighting, cull_mode the faces)
const side: SurfaceDrawProps["side"] = p.cull_mode === null ? "double" : p.cull_mode === "Front" ? "back" : undefined;
- // Bevy's Blend is the old material's `transparent`, its opacity the base colour's alpha (Opaque ignores the alpha, as
- // Bevy's does)
- const out: SurfaceDrawProps & { transparent?: boolean; opacity?: number } = a === "Blend" ? { transparent: true, opacity: baseOf(p.base_color).alpha } : { ...alpha };
+ // Bevy's Blend is the old material's `transparent`; every mode but Opaque reads the base colour's alpha as its
+ // opacity (a Mask cuts by it, AlphaToCoverage dithers by it), and Opaque ignores it, as Bevy's do
+ const out: SurfaceDrawProps & { transparent?: boolean; opacity?: number } = a === "Blend" ? { transparent: true, opacity: baseOf(p.base_color).alpha } : a === undefined || a === "Opaque" ? {} : { ...alpha, opacity: baseOf(p.base_color).alpha };
if (side) out.side = side;
return out;
}
@@ -219,10 +220,10 @@ export const StandardMaterial = memo(function StandardMaterial<A>(p: StandardMat
}) as unknown as <A>(p: StandardMaterialProps & { animate?: Only<A, StandardMaterialAnimate> }) => ReactElement;
// raea's extensions an ExtendedMaterial puts on its StandardMaterial, as the old material's props
-type Extended = { grid?: GridExtensionProps; paint?: PaintExtensionProps; wear?: MeshStandardMaterialProps["wear"]; shader?: Record<string, unknown> };
+type Extended = { grid?: GridExtensionProps; paint?: PaintExtensionProps; wear?: MeshStandardMaterialProps["wear"]; procedural?: ReturnType<typeof proceduralOf>; shader?: Record<string, unknown> };
// the texture fields as the old material's maps, and each one's sampler by the map's name
-const MAPS = { base_color_texture: "map", emissive_texture: "emissiveMap", metallic_roughness_texture: "metallicRoughnessMap", normal_map_texture: "normalMap", occlusion_texture: "aoMap", depth_map: "depthMap" } as const;
+const MAPS = { base_color_texture: "map", emissive_texture: "emissiveMap", metallic_roughness_texture: "metallicRoughnessMap", normal_map_texture: "normalMap", occlusion_texture: "aoMap", depth_map: "depthMap", clearcoat_normal_texture: "clearcoatNormalMap" } as const;
function maps(p: StandardMaterialProps): { maps: Record<string, string | null>; samplers?: Record<string, SamplerSpec> } {
const out: Record<string, string | null> = {};
@@ -252,8 +253,8 @@ function maps(p: StandardMaterialProps): { maps: Record<string, string | null>;
function standard(p: StandardMaterialProps, ext: Extended) {
const color = baseOf(p.base_color).color;
- if (p.unlit && (ext.grid || ext.paint || ext.wear || ext.shader)) throw new TypeError("ExtendedMaterial: an unlit StandardMaterial takes no GridExtension, PaintExtension, WearExtension or ShaderExtension");
- if (ext.shader && (ext.grid || ext.paint || ext.wear)) throw new TypeError("ExtendedMaterial: a ShaderExtension goes alone over its StandardMaterial (no other extension with it)");
+ if (p.unlit && (ext.grid || ext.paint || ext.wear || ext.procedural || ext.shader)) throw new TypeError("ExtendedMaterial: an unlit StandardMaterial takes no GridExtension, PaintExtension, WearExtension or ShaderExtension");
+ if (ext.shader && (ext.grid || ext.paint || ext.wear || ext.procedural)) throw new TypeError("ExtendedMaterial: a ShaderExtension goes alone over its StandardMaterial (no other extension with it)");
const m = maps(p);
if (p.unlit && p.animate) throw new TypeError("StandardMaterial: an unlit material takes no animate yet");
if (p.unlit) return <MeshBasicMaterial color={color} {...(m.maps.map ? { map: m.maps.map } : {})} {...(m.samplers?.map ? { sampler: m.samplers.map } : {})} {...draw(p)} />;
@@ -466,7 +467,9 @@ export function ExtendedMaterial(p: ExtendedMaterialProps) {
if (ext.shader) throw new TypeError("ExtendedMaterial: two ShaderExtensions on one material");
ext.shader = surfaceShader("ShaderExtension", extension.props as ShaderExtensionProps);
} else {
- if (extension.type === WearExtension) {
+ if (extension.type === ProceduralExtension) {
+ ext.procedural = proceduralOf(extension.props as ProceduralExtensionProps);
+ } else if (extension.type === WearExtension) {
if (ext.wear) throw new TypeError("ExtendedMaterial: two WearExtensions on one material");
ext.wear = wearOf(extension.props as WearExtensionProps);
} else {
diff --git a/sdk/render/src/bevy3d/mesh2d.tsx b/sdk/render/src/bevy3d/mesh2d.tsx
index 6f75d89c..8566fb1d 100644
--- a/sdk/render/src/bevy3d/mesh2d.tsx
+++ b/sdk/render/src/bevy3d/mesh2d.tsx
@@ -3,15 +3,24 @@
// origin, +Y up, a unit a pixel, turns counterclockwise. It draws as <Shape2D> does (raea-sys-sprite).
import { Children, isValidElement, type ReactNode } from "react";
import { useVideoConfig } from "@raea/app/clock";
-import { Shape2D, type Place2dProps, type Shape2DProps } from "../3d/sprite";
+import { Shape2D, type AlphaMode2d, type Place2dProps, type Shape2DProps } from "../3d/sprite";
import { eulerOf } from "../3d";
-import { type TransformValue } from "./all";
+import { LinearRgba, Srgba, type TransformValue } from "./all";
-export interface CircleProps { radius?: number }
-export interface RectangleProps { half_size?: [number, number] }
-export interface EllipseProps { half_size?: [number, number] }
-export interface RegularPolygonProps { circumcircle?: { radius: number }; sides?: number }
-export interface ColorMaterialProps { color?: string }
+/** a primitive's mesh attributes: its Mesh::ATTRIBUTE_COLOR, one linear colour per vertex (as mesh.insert_attribute) */
+export interface MeshAttributes { vertex_colors?: (LinearRgba | [number, number, number, number])[] }
+export interface CircleProps extends MeshAttributes { radius?: number }
+export interface RectangleProps extends MeshAttributes { half_size?: [number, number] }
+export interface EllipseProps extends MeshAttributes { half_size?: [number, number] }
+export interface RegularPolygonProps extends MeshAttributes { circumcircle?: { radius: number }; sides?: number }
+export interface ColorMaterialProps {
+ /** white by default; it tints the texture, and its alpha is the material's (Bevy's Srgba or LinearRgba, or a hex) */
+ color?: string | Srgba | LinearRgba;
+ /** a picture, by the mesh's UVs */
+ texture?: string;
+ /** Bevy's AlphaMode2d, "Blend" by default */
+ alpha_mode?: AlphaMode2d;
+}
const inMesh2d = (name: string) => (): ReactNode => {
throw new TypeError(`${name} goes in a Mesh2d: <Mesh2d><${name} /><ColorMaterial color="#c84" /></Mesh2d>`);
@@ -24,7 +33,7 @@ export const Rectangle = inMesh2d("Rectangle") as (p: RectangleProps) => ReactNo
export const Ellipse = inMesh2d("Ellipse") as (p: EllipseProps) => ReactNode;
/** bevy_math's RegularPolygon (circumradius 0.5, 6 sides by default) */
export const RegularPolygon = inMesh2d("RegularPolygon") as (p: RegularPolygonProps) => ReactNode;
-/** bevy_sprite_render's ColorMaterial: one colour (white by default) */
+/** bevy_sprite_render's ColorMaterial: a colour (white by default), a texture it tints, and its AlphaMode2d */
export const ColorMaterial = inMesh2d("ColorMaterial") as (p: ColorMaterialProps) => ReactNode;
export interface Mesh2dProps extends Omit<Place2dProps, "x" | "y" | "rotation" | "scale" | "z"> {
@@ -34,8 +43,17 @@ export interface Mesh2dProps extends Omit<Place2dProps, "x" | "y" | "rotation" |
children?: ReactNode;
}
-/** The primitive's Shape2D: its shape, size in px and sides. */
-function shapeOf(el: { type: unknown; props: unknown }): Pick<Shape2DProps, "shape" | "size" | "sides"> {
+type ShapeOf = Pick<Shape2DProps, "shape" | "size" | "sides" | "vertex_colors">;
+
+/** The primitive's Shape2D, with its vertex colours as linear [r, g, b, a]. */
+function shapeOf(el: { type: unknown; props: unknown }): ShapeOf {
+ const vc = (el.props as MeshAttributes).vertex_colors;
+ const s = primitiveOf(el);
+ return vc === undefined ? s : { ...s, vertex_colors: vc.map((c) => (c instanceof LinearRgba ? [c.red, c.green, c.blue, c.alpha] : c)) };
+}
+
+/** The primitive's shape, size in px and sides. */
+function primitiveOf(el: { type: unknown; props: unknown }): ShapeOf {
if (el.type === Circle) {
const d = 2 * ((el.props as CircleProps).radius ?? 0.5);
return { shape: "circle", size: [d, d] };
@@ -52,10 +70,10 @@ function shapeOf(el: { type: unknown; props: unknown }): Pick<Shape2DProps, "sha
/** Bevy's Mesh2d with its Transform, a primitive and a ColorMaterial: <Shape2D> in Bevy's 2D world. */
export function Mesh2d({ transform, visibility, children, ...rest }: Mesh2dProps) {
const { width, height } = useVideoConfig();
- let shape: Pick<Shape2DProps, "shape" | "size" | "sides"> | undefined, color: string | undefined;
+ let shape: ShapeOf | undefined, material: ColorMaterialProps | undefined;
for (const c of Children.toArray(children)) {
if (!isValidElement(c)) continue;
- if (c.type === ColorMaterial) color = (c.props as ColorMaterialProps).color ?? "#ffffff";
+ if (c.type === ColorMaterial) material = c.props as ColorMaterialProps;
else if (c.type === Circle || c.type === Rectangle || c.type === Ellipse || c.type === RegularPolygon) {
if (shape) throw new TypeError("Mesh2d: one primitive");
shape = shapeOf(c);
@@ -67,5 +85,10 @@ export function Mesh2d({ transform, visibility, children, ...rest }: Mesh2dProps
const [sx, sy] = transform?.scale ?? [1, 1, 1];
// Bevy turns counterclockwise about +Z; Shape2D's rotation is clockwise, as the page's
const turn = transform?.rotation ? -eulerOf(transform.rotation)[2] : 0;
- return <Shape2D {...rest} {...shape} color={color ?? "#ffffff"} x={width / 2 + tx} y={height / 2 - ty} z={tz} rotation={turn} scale={sx === sy ? sx : [sx, sy]} />;
+ // the material's colour as Shape2D's hex, and its alpha as Shape2D's opacity (raea-sys-sprite's ColorMaterial alpha)
+ const c = material?.color ?? "#ffffff";
+ const s = typeof c === "string" ? undefined : c instanceof LinearRgba ? c.to_srgba() : c;
+ const color = s ? new Srgba(s.red, s.green, s.blue, 1).to_hex() : c as string;
+ const opacity = (rest.opacity ?? 1) * (s ? s.alpha : 1);
+ return <Shape2D {...rest} {...shape} color={color} {...(s || rest.opacity !== undefined ? { opacity } : {})} {...(material?.texture ? { texture: material.texture } : {})} {...(material?.alpha_mode ? { alpha_mode: material.alpha_mode } : {})} x={width / 2 + tx} y={height / 2 - ty} z={tz} rotation={turn} scale={sx === sy ? sx : [sx, sy]} />;
}
diff --git a/sdk/render/src/bevy3d/procedural.tsx b/sdk/render/src/bevy3d/procedural.tsx
new file mode 100644
index 00000000..c71c120c
--- /dev/null
+++ b/sdk/render/src/bevy3d/procedural.tsx
@@ -0,0 +1,44 @@
+// raea's procedural surface as a Bevy MaterialExtension (systems/procmat): an ExtendedMaterial's `extension`, its fields
+// snake_case as Bevy's are, turned into the old material's `procedural` prop (overlays.ts ProceduralSurface).
+import type { ReactNode } from "react";
+import type { ProceduralSurface } from "../overlays";
+
+/** raea's extension of StandardMaterial that draws a pattern on the GPU in place of its flat colour (the engine's
+ * Procedural MaterialExtension, systems/procmat): `pattern` (noise, wood, marble, stone, brick, tiles, fabric,
+ * brushed, plaster) in `colors` with roughness `rough_a`/`rough_b`, features `scale` metres across, a `bump`; brick
+ * and tiles in `tile` [w, h] metre cells with `gap` metre joints in `gap_color`. Over it, each 0-1: `dust` on what
+ * faces up, `dirt` in joints, hollows, undersides and the floor line, `edges` worn lighter. The pattern overrides the
+ * base's colour and roughness; its lighting stays. It goes in an ExtendedMaterial's `extension`, alone. */
+export interface ProceduralExtensionProps {
+ pattern: ProceduralSurface["pattern"];
+ colors?: [string, string];
+ scale?: number;
+ rough_a?: number;
+ rough_b?: number;
+ bump?: number;
+ tile?: [number, number];
+ gap?: number;
+ gap_color?: string;
+ dust?: number;
+ dirt?: number;
+ edges?: number;
+ dust_color?: string;
+ dirt_color?: string;
+ seed?: number;
+}
+
+/** raea's procedural surface over a StandardMaterial, as an ExtendedMaterial's extension (systems/procmat):
+ *
+ * <ExtendedMaterial base={<StandardMaterial />} extension={<ProceduralExtension pattern="brick" dirt={0.3} />} />
+ *
+ * @bevy bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_procmat::Procedural>> */
+export function ProceduralExtension(_: ProceduralExtensionProps): ReactNode {
+ throw new TypeError('ProceduralExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<ProceduralExtension pattern="wood" />} />');
+}
+
+/** the old material's `procedural` from ProceduralExtension's fields */
+export function proceduralOf(p: ProceduralExtensionProps): ProceduralSurface {
+ const { rough_a, rough_b, gap_color, dust_color, dirt_color, ...rest } = p;
+ const named = { roughA: rough_a, roughB: rough_b, gapColor: gap_color, dustColor: dust_color, dirtColor: dirt_color };
+ return { ...rest, ...Object.fromEntries(Object.entries(named).filter(([, v]) => v !== undefined)) };
+}
diff --git a/sdk/render/src/bevy3d/ui-val.ts b/sdk/render/src/bevy3d/ui-val.ts
new file mode 100644
index 00000000..49d359d2
--- /dev/null
+++ b/sdk/render/src/bevy3d/ui-val.ts
@@ -0,0 +1,130 @@
+// bevy_ui's values as the page's CSS: Val (px, percent, vw, vh, vmin, vmax, auto), UiRect, BorderRadius, and Node's
+// enums. A Bevy UI tree is drawn by the page (Blitz lays it out with taffy, as bevy_ui does), so each value is the CSS
+// that gives taffy the style bevy_ui's convert.rs gives it.
+import { LinearRgba, Srgba } from "./colors";
+
+/** A bevy_ui Val as CSS: px(12) is "12px", percent(50) "50%", auto "auto". */
+export type Val = string;
+
+const VAL = /^(auto|-?\d+(\.\d+)?(e-?\d+)?(px|%|vw|vh|vmin|vmax))$/;
+const num = (what: string, n: number) => {
+ if (!Number.isFinite(n)) throw new RangeError(`${what}: a finite number, got ${n}`);
+ return n;
+};
+
+/** Bevy's Val::Px: logical pixels */
+export const px = (n: number): Val => `${num("px", n)}px`;
+/** Bevy's Val::Percent: of the parent's size on that axis (padding and margin: its width, as CSS) */
+export const percent = (n: number): Val => `${num("percent", n)}%`;
+export const vw = (n: number): Val => `${num("vw", n)}vw`;
+export const vh = (n: number): Val => `${num("vh", n)}vh`;
+export const vmin = (n: number): Val => `${num("vmin", n)}vmin`;
+export const vmax = (n: number): Val => `${num("vmax", n)}vmax`;
+/** Bevy's Val::Auto */
+export const auto: Val = "auto";
+
+export function checkVal(who: string, k: string, v: unknown): Val {
+ if (typeof v !== "string" || !VAL.test(v)) throw new TypeError(`${who}: ${k} is a Val (px(12), percent(50), vw(10), auto), got ${JSON.stringify(v)}`);
+ return v;
+}
+
+/** Bevy's UiRect: a Val for each side (0 by default). */
+export interface UiRect { left: Val; right: Val; top: Val; bottom: Val }
+const Z = "0px";
+export const UiRect = {
+ all: (v: Val): UiRect => ({ left: v, right: v, top: v, bottom: v }),
+ axes: (horizontal: Val, vertical: Val): UiRect => ({ left: horizontal, right: horizontal, top: vertical, bottom: vertical }),
+ horizontal: (v: Val): UiRect => ({ left: v, right: v, top: Z, bottom: Z }),
+ vertical: (v: Val): UiRect => ({ left: Z, right: Z, top: v, bottom: v }),
+ new: (left: Val, right: Val, top: Val, bottom: Val): UiRect => ({ left, right, top, bottom }),
+ left: (v: Val): UiRect => ({ left: v, right: Z, top: Z, bottom: Z }),
+ right: (v: Val): UiRect => ({ left: Z, right: v, top: Z, bottom: Z }),
+ top: (v: Val): UiRect => ({ left: Z, right: Z, top: v, bottom: Z }),
+ bottom: (v: Val): UiRect => ({ left: Z, right: Z, top: Z, bottom: v }),
+};
+
+/** A UiRect as CSS's four values (top right bottom left). */
+export function rectCss(who: string, k: string, r: UiRect): string {
+ if (typeof r !== "object" || r === null) throw new TypeError(`${who}: ${k} is a UiRect (UiRect.all(px(4))), got ${JSON.stringify(r)}`);
+ return (["top", "right", "bottom", "left"] as const).map((s) => checkVal(who, `${k}.${s}`, r[s])).join(" ");
+}
+
+/** Bevy's BorderRadius: a Val for each corner (0 by default). */
+export interface BorderRadius { top_left: Val; top_right: Val; bottom_right: Val; bottom_left: Val }
+export const BorderRadius = {
+ all: (v: Val): BorderRadius => ({ top_left: v, top_right: v, bottom_right: v, bottom_left: v }),
+ new: (top_left: Val, top_right: Val, bottom_right: Val, bottom_left: Val): BorderRadius => ({ top_left, top_right, bottom_right, bottom_left }),
+ top: (v: Val): BorderRadius => ({ top_left: v, top_right: v, bottom_right: Z, bottom_left: Z }),
+ bottom: (v: Val): BorderRadius => ({ top_left: Z, top_right: Z, bottom_right: v, bottom_left: v }),
+ left: (v: Val): BorderRadius => ({ top_left: v, top_right: Z, bottom_right: Z, bottom_left: v }),
+ right: (v: Val): BorderRadius => ({ top_left: Z, top_right: v, bottom_right: v, bottom_left: Z }),
+ MAX: { top_left: "9999px", top_right: "9999px", bottom_right: "9999px", bottom_left: "9999px" } as BorderRadius,
+};
+
+export function radiusCss(who: string, r: BorderRadius): string {
+ if (typeof r !== "object" || r === null) throw new TypeError(`${who}: border_radius is a BorderRadius (BorderRadius.all(px(8))), got ${JSON.stringify(r)}`);
+ return (["top_left", "top_right", "bottom_right", "bottom_left"] as const).map((s) => checkVal(who, `border_radius.${s}`, r[s])).join(" ");
+}
+
+/** A Bevy enum variant as CSS's keyword (FlexStart: flex-start, SpaceBetween: space-between); Default is CSS's
+ * normal, which taffy reads as bevy_ui's None, so it sends nothing. */
+export function keyword(who: string, k: string, v: string, allowed: readonly string[]): string | undefined {
+ if (!allowed.includes(v)) throw new TypeError(`${who}: ${k} is one of ${allowed.join(", ")}, got ${JSON.stringify(v)}`);
+ return v === "Default" ? undefined : v.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
+}
+
+export const ALIGN_ITEMS = ["Default", "Start", "End", "FlexStart", "FlexEnd", "Center", "Baseline", "Stretch"] as const;
+export const ALIGN_SELF = ["Auto", ...ALIGN_ITEMS.slice(1)] as const;
+export const JUSTIFY_ITEMS = ["Default", "Start", "End", "Center", "Baseline", "Stretch"] as const;
+export const JUSTIFY_SELF = ["Auto", "Start", "End", "Center", "Baseline", "Stretch"] as const;
+export const JUSTIFY_CONTENT = ["Default", "Start", "End", "FlexStart", "FlexEnd", "Center", "Stretch", "SpaceBetween", "SpaceEvenly", "SpaceAround"] as const;
+export const ALIGN_CONTENT = JUSTIFY_CONTENT;
+export const FLEX_DIRECTION = ["Row", "Column", "RowReverse", "ColumnReverse"] as const;
+export const FLEX_WRAP = ["NoWrap", "Wrap", "WrapReverse"] as const;
+export const DISPLAY = ["Flex", "Grid", "Block", "None"] as const;
+export const POSITION_TYPE = ["Relative", "Absolute"] as const;
+export const OVERFLOW_AXIS = ["Visible", "Clip", "Hidden", "Scroll"] as const;
+
+/** Bevy's Overflow: each axis Visible, Clip, Hidden or Scroll. */
+export interface Overflow { x: (typeof OVERFLOW_AXIS)[number]; y: (typeof OVERFLOW_AXIS)[number] }
+export const Overflow = {
+ visible: (): Overflow => ({ x: "Visible", y: "Visible" }),
+ clip: (): Overflow => ({ x: "Clip", y: "Clip" }),
+ clip_x: (): Overflow => ({ x: "Clip", y: "Visible" }),
+ clip_y: (): Overflow => ({ x: "Visible", y: "Clip" }),
+ hidden: (): Overflow => ({ x: "Hidden", y: "Hidden" }),
+ scroll: (): Overflow => ({ x: "Scroll", y: "Scroll" }),
+ scroll_x: (): Overflow => ({ x: "Scroll", y: "Visible" }),
+ scroll_y: (): Overflow => ({ x: "Visible", y: "Scroll" }),
+};
+
+/** A bevy_color colour as CSS: Srgba or LinearRgba (its sRGB), or a CSS colour string as written. */
+export function colorCss(who: string, k: string, c: unknown): string {
+ if (typeof c === "string") return c;
+ const s = c instanceof LinearRgba ? c.to_srgba() : c instanceof Srgba ? c : undefined;
+ if (!s) throw new TypeError(`${who}: ${k} is an Srgba, a LinearRgba or a CSS colour, got ${JSON.stringify(c)}`);
+ const b = (v: number) => Math.round(Math.max(0, Math.min(1, v)) * 255);
+ return `rgba(${b(s.red)}, ${b(s.green)}, ${b(s.blue)}, ${Math.max(0, Math.min(1, s.alpha))})`;
+}
+
+/** What lies under a part of the UI, in linear light, when it's known: an opaque Node colour, or translucent ones over
+ * one. Bevy draws its UI onto an sRGB target, so a translucent colour blends in linear light; the page blends in sRGB.
+ * Over a known backdrop the colour is sent as the opaque colour Bevy's blend makes (white at 0.2 over srgb 0.1 green
+ * is 126, not the page's 72); over the 3D (unknown) it's sent as it is. */
+export type Backdrop = [number, number, number] | undefined;
+
+const toLinear = (c: number) => (c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
+const toSrgb = (c: number) => (c <= 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 1 / 2.4) - 0.055);
+
+/** A colour over `back` as Bevy blends it: its CSS, and the backdrop it leaves. */
+export function over(who: string, k: string, c: unknown, back: Backdrop): { css: string; back: Backdrop } {
+ const s = c instanceof LinearRgba ? c.to_srgba() : c instanceof Srgba ? c : undefined;
+ if (!s) return { css: colorCss(who, k, c), back: undefined };
+ const a = Math.max(0, Math.min(1, s.alpha));
+ const lin: [number, number, number] = [s.red, s.green, s.blue].map((v) => toLinear(Math.max(0, Math.min(1, v)))) as [number, number, number];
+ if (a >= 1) return { css: colorCss(who, k, s), back: lin };
+ if (!back) return { css: colorCss(who, k, s), back: undefined };
+ const mixed = lin.map((v, i) => a * v + (1 - a) * back[i]) as [number, number, number];
+ const [r, g, b] = mixed.map(toSrgb);
+ return { css: colorCss(who, k, new Srgba(r, g, b, 1)), back: mixed };
+}
diff --git a/sdk/render/src/bevy3d/ui.tsx b/sdk/render/src/bevy3d/ui.tsx
new file mode 100644
index 00000000..040b04a4
--- /dev/null
+++ b/sdk/render/src/bevy3d/ui.tsx
@@ -0,0 +1,357 @@
+// bevy_ui's Node, Text and TextSpan, drawn by the page: each a box whose CSS gives Blitz's taffy the style bevy_ui's
+// convert.rs gives Bevy's, with BackgroundColor, BorderColor, ZIndex and Outline as its props. A Node outside another
+// is a root: bevy_ui lays each root in an implicit viewport of its own (a grid the size of the window, its item at the
+// start), so a root's box sits in one. Text is Bevy's: its default font (Bevy's FiraMono subset), 20 px (bevy_text's
+// rem), white, line height 1.2, wrapped at words, drawn unsmoothed (bevy_text's coverage, not CoreText's growth).
+import { Children, createContext, useContext, type CSSProperties, type ReactNode } from "react";
+import { BEVY_FONT_FAMILY, bevyFontFace } from "./fonts/default";
+import {
+ ALIGN_CONTENT, ALIGN_ITEMS, ALIGN_SELF, DISPLAY, FLEX_DIRECTION, FLEX_WRAP, JUSTIFY_CONTENT, JUSTIFY_ITEMS, JUSTIFY_SELF, OVERFLOW_AXIS, POSITION_TYPE,
+ checkVal, keyword, over, px, radiusCss, rectCss, type Backdrop, type BorderRadius, type Overflow, type UiRect, type Val,
+} from "./ui-val";
+import type { LinearRgba, Srgba } from "./colors";
+
+type Color = Srgba | LinearRgba | string;
+
+/** bevy_ui's Node: its layout fields as Bevy names them (each Bevy's default when left out), and the components that
+ * draw it: background_color (BackgroundColor), border_color (BorderColor, every side), z_index (ZIndex). */
+export interface NodeProps {
+ display?: (typeof DISPLAY)[number];
+ box_sizing?: "BorderBox" | "ContentBox";
+ position_type?: (typeof POSITION_TYPE)[number];
+ left?: Val; right?: Val; top?: Val; bottom?: Val;
+ width?: Val; height?: Val; min_width?: Val; min_height?: Val; max_width?: Val; max_height?: Val;
+ aspect_ratio?: number;
+ flex_direction?: (typeof FLEX_DIRECTION)[number];
+ flex_wrap?: (typeof FLEX_WRAP)[number];
+ flex_grow?: number; flex_shrink?: number; flex_basis?: Val;
+ align_items?: (typeof ALIGN_ITEMS)[number];
+ align_self?: (typeof ALIGN_SELF)[number];
+ align_content?: (typeof ALIGN_CONTENT)[number];
+ justify_content?: (typeof JUSTIFY_CONTENT)[number];
+ justify_items?: (typeof JUSTIFY_ITEMS)[number];
+ justify_self?: (typeof JUSTIFY_SELF)[number];
+ margin?: UiRect; padding?: UiRect; border?: UiRect;
+ border_radius?: BorderRadius;
+ overflow?: Overflow;
+ row_gap?: Val; column_gap?: Val;
+ background_color?: Color;
+ border_color?: Color;
+ /** Outline: a line outside the border box, `offset` from it (0 by default) */
+ outline?: { width: Val; offset?: Val; color: Color };
+ z_index?: number;
+ /** FixedNode: laid out as a root wherever it is in the tree (its own viewport, the window's), drawn with its parent */
+ fixed?: boolean;
+ children?: ReactNode;
+}
+
+// inside a Node (null at the top: a Node there is a root), and what lies under its content when known
+const InUi = createContext<{ back: Backdrop } | null>(null);
+
+const VALS = ["left", "right", "top", "bottom", "width", "height", "min_width", "min_height", "max_width", "max_height", "flex_basis", "row_gap", "column_gap"] as const;
+const CSS_OF: Record<(typeof VALS)[number], keyof CSSProperties> = {
+ left: "left", right: "right", top: "top", bottom: "bottom", width: "width", height: "height", min_width: "minWidth", min_height: "minHeight",
+ max_width: "maxWidth", max_height: "maxHeight", flex_basis: "flexBasis", row_gap: "rowGap", column_gap: "columnGap",
+};
+
+/** A Node's props as the box's CSS: Bevy's defaults made explicit where CSS's differ (display flex, border-box,
+ * position relative, flex-shrink 1, min sizes auto; no font of the page's own), its colours blended as Bevy blends them over
+ * `back`, and the backdrop it leaves its content. */
+export function nodeCss(who: string, p: NodeProps, back?: Backdrop): { css: CSSProperties; back: Backdrop } {
+ const s: Record<string, unknown> = { display: "flex", boxSizing: "border-box", position: "relative", flexShrink: 1, minWidth: "auto", minHeight: "auto" };
+ const kw = (k: keyof NodeProps, css: string, allowed: readonly string[]) => {
+ const v = p[k];
+ if (v === undefined) return;
+ const w = keyword(who, k, v as string, allowed);
+ if (w !== undefined) s[css] = w === "auto" ? "auto" : w;
+ };
+ kw("display", "display", DISPLAY);
+ kw("position_type", "position", POSITION_TYPE);
+ kw("flex_direction", "flexDirection", FLEX_DIRECTION);
+ kw("flex_wrap", "flexWrap", FLEX_WRAP);
+ kw("align_items", "alignItems", ALIGN_ITEMS);
+ kw("align_self", "alignSelf", ALIGN_SELF);
+ kw("align_content", "alignContent", ALIGN_CONTENT);
+ kw("justify_content", "justifyContent", JUSTIFY_CONTENT);
+ kw("justify_items", "justifyItems", JUSTIFY_ITEMS);
+ kw("justify_self", "justifySelf", JUSTIFY_SELF);
+ if (p.flex_wrap === "NoWrap") s.flexWrap = "nowrap";
+ if (p.box_sizing !== undefined) s.boxSizing = keyword(who, "box_sizing", p.box_sizing, ["BorderBox", "ContentBox"]);
+ for (const k of VALS) if (p[k] !== undefined) s[CSS_OF[k]] = checkVal(who, k, p[k]);
+ for (const k of ["flex_grow", "flex_shrink", "aspect_ratio", "z_index"] as const) {
+ const v = p[k];
+ if (v !== undefined && !Number.isFinite(v)) throw new RangeError(`${who}: ${k} is a number, got ${v}`);
+ }
+ if (p.flex_grow !== undefined) s.flexGrow = p.flex_grow;
+ if (p.flex_shrink !== undefined) s.flexShrink = p.flex_shrink;
+ if (p.aspect_ratio !== undefined) s.aspectRatio = p.aspect_ratio;
+ if (p.z_index !== undefined) s.zIndex = p.z_index;
+ if (p.margin !== undefined) s.margin = rectCss(who, "margin", p.margin);
+ if (p.padding !== undefined) s.padding = rectCss(who, "padding", p.padding);
+ if (p.border !== undefined) {
+ s.borderWidth = rectCss(who, "border", p.border);
+ s.borderStyle = "solid";
+ s.borderColor = "transparent";
+ }
+ if (p.border_radius !== undefined) s.borderRadius = radiusCss(who, p.border_radius);
+ // (the outline is outside the node: over what is under the node, not its own background)
+ if (p.outline !== undefined) {
+ s.outline = `${checkVal(who, "outline.width", p.outline.width)} solid ${over(who, "outline.color", p.outline.color, back).css}`;
+ if (p.outline.offset !== undefined) s.outlineOffset = checkVal(who, "outline.offset", p.outline.offset);
+ }
+ if (p.background_color !== undefined) ({ css: s.backgroundColor, back } = over(who, "background_color", p.background_color, back));
+ // (the border over its own background, as Bevy draws it)
+ if (p.border_color !== undefined) s.borderColor = over(who, "border_color", p.border_color, back).css;
+ if (p.overflow !== undefined) {
+ const o = p.overflow;
+ for (const a of ["x", "y"] as const) if (!OVERFLOW_AXIS.includes(o?.[a])) throw new TypeError(`${who}: overflow.${a} is one of ${OVERFLOW_AXIS.join(", ")}, got ${JSON.stringify(o?.[a])}`);
+ s.overflowX = o.x.toLowerCase();
+ s.overflowY = o.y.toLowerCase();
+ }
+ return { css: s as CSSProperties, back };
+}
+
+// a root's implicit viewport (bevy_ui ui_surface.rs): a grid the window's size, its one item at the start of both axes
+const VIEWPORT: CSSProperties = { position: "absolute", left: 0, top: 0, width: "100%", height: "100%", display: "grid", alignItems: "start", justifyItems: "start" };
+
+function boxOf(css: CSSProperties, back: Backdrop, children: ReactNode, root: boolean | "fixed", font?: ReactNode) {
+ const inner = (
+ <div style={css}>
+ <InUi.Provider value={{ back }}>{children}</InUi.Provider>
+ </div>
+ );
+ return root ? <div style={root === "fixed" ? { ...VIEWPORT, position: "fixed" } : VIEWPORT}>{font}{inner}</div> : <>{font}{inner}</>;
+}
+
+/** A box of Bevy's UI, laid out as bevy_ui lays it (taffy, with Bevy's defaults). Put it over the 3D in an
+ * <AbsoluteFill> (after the <Canvas3D>): each root fills the frame as Bevy's window. @bevy bevy_ui::ui_node::Node */
+export function Node({ children, fixed, ...p }: NodeProps) {
+ const ui = useContext(InUi);
+ const n = nodeCss("Node", p, ui?.back);
+ return boxOf(n.css, n.back, children, fixed ? "fixed" : ui === null);
+}
+
+/** bevy_text's TextFont, TextColor, TextLayout and LineHeight, on a Text or a TextSpan. */
+export interface TextStyleProps {
+ /** a font file (staticFile("fonts/FiraSans-Bold.ttf")); Bevy's default font when left out */
+ font?: string;
+ /** Bevy's FontSize: a number of px, or { Px }, { Rem } (of bevy_text's 20 px rem), { Vw }, { Vh }, { VMin }, { VMax } */
+ font_size?: number | { Px: number } | { Rem: number } | { Vw: number } | { Vh: number } | { VMin: number } | { VMax: number };
+ /** FontWeight: 100 to 900 (400 by default) */
+ weight?: number;
+ style?: "Normal" | "Italic" | "Oblique";
+ /** TextColor: white by default */
+ color?: Color;
+ /** LineHeight: { Px } or { RelativeToFont } (1.2 of the size by default) */
+ line_height?: { Px: number } | { RelativeToFont: number };
+ /** FontVariations: a variable font's axes by their four-letter tag, { [FontVariationTag.WEIGHT]: 300 } */
+ font_variations?: Record<string, number>;
+}
+
+/** bevy_text's FontVariationTag: the registered axes' OpenType tags. @bevy bevy_text::FontVariationTag */
+export const FontVariationTag = { WEIGHT: "wght", WIDTH: "wdth", SLANT: "slnt", ITALIC: "ital", OPTICAL_SIZE: "opsz" } as const;
+
+function variationsCss(who: string, v: Record<string, number> | undefined): string | undefined {
+ if (v === undefined) return undefined;
+ const axes = Object.entries(v).map(([tag, n]) => {
+ if (!/^[\x20-\x7e]{4}$/.test(tag)) throw new TypeError(`${who}: a font variation's tag is four characters ("wght"), got ${JSON.stringify(tag)}`);
+ if (!Number.isFinite(n)) throw new TypeError(`${who}: font variation ${tag} is a number, got ${n}`);
+ return `"${tag}" ${n}`;
+ });
+ return axes.length ? axes.join(", ") : undefined;
+}
+
+/** What bevy_text draws with a section's own glyphs (a Text's string, not its spans; a TextSpan's run). */
+export interface TextRunProps {
+ /** Underline and Strikethrough: a line under or through the run, as thick as the font says */
+ underline?: boolean;
+ strikethrough?: boolean;
+ /** UnderlineColor and StrikethroughColor: the lines' colours (the text's colour by default) */
+ underline_color?: Color;
+ strikethrough_color?: Color;
+ /** TextBackgroundColor: a box behind the run, line by line */
+ text_background_color?: Color;
+}
+
+export interface TextProps extends TextStyleProps, TextRunProps, NodeProps {
+ /** TextLayout's justify (Left by default) and linebreak (WordBoundary) */
+ justify?: "Left" | "Center" | "Right" | "Justified" | "Start" | "End";
+ linebreak?: "WordBoundary" | "AnyCharacter" | "WordOrCharacter" | "NoWrap";
+}
+
+/** A section's glyphs in its lines and background: CSS carries a decoration to every element inside it, so a Text's
+ * own are on its strings alone (Bevy's Strikethrough on a Text leaves its spans unstruck). Two colours of line are
+ * two spans, one per text-decoration-color. */
+function runOf(who: string, r: TextRunProps, back: Backdrop | undefined, text: ReactNode): ReactNode {
+ const col = (k: "underline_color" | "strikethrough_color" | "text_background_color") => (r[k] === undefined ? undefined : over(who, k, r[k]!, back).css);
+ const [uc, sc, bg] = [col("underline_color"), col("strikethrough_color"), col("text_background_color")];
+ if (!r.underline && !r.strikethrough && bg === undefined) return text;
+ const line = (l: string, c: string | undefined): CSSProperties => ({ textDecorationLine: l, textDecorationThickness: "from-font", ...(c ? { textDecorationColor: c } : {}) });
+ const one = r.underline && r.strikethrough && uc === sc;
+ const outer: CSSProperties = { ...(bg ? { backgroundColor: bg } : {}), ...(one ? line("underline line-through", uc) : r.underline ? line("underline", uc) : !r.underline && r.strikethrough ? line("line-through", sc) : {}) };
+ const struck = r.underline && r.strikethrough && !one;
+ return <span style={outer}>{struck ? <span style={line("line-through", sc)}>{text}</span> : text}</span>;
+}
+
+const familyOf = (font: string) => `raea-font-${font.replace(/[^A-Za-z0-9]/g, "-")}`;
+
+function sizeCss(who: string, f: TextStyleProps["font_size"]): string {
+ if (f === undefined) return "20px";
+ if (typeof f === "number") return `${checkSize(who, f)}px`;
+ const [k, v] = Object.entries(f)[0] ?? [];
+ const unit = { Px: "px", Rem: "rem", Vw: "vw", Vh: "vh", VMin: "vmin", VMax: "vmax" }[k as string];
+ if (!unit || typeof v !== "number") throw new TypeError(`${who}: font_size is a number of px or { Px | Rem | Vw | Vh | VMin | VMax }, got ${JSON.stringify(f)}`);
+ return unit === "rem" ? `${checkSize(who, v) * 20}px` : `${checkSize(who, v)}${unit}`;
+}
+function checkSize(who: string, n: number) {
+ if (!(n > 0 && Number.isFinite(n))) throw new RangeError(`${who}: font_size is above 0, got ${n}`);
+ return n;
+}
+
+/** A text style's CSS (every field Bevy's default when left out: a span takes nothing from its Text), and the
+ * @font-face its font needs. */
+export function textCss(who: string, p: TextStyleProps, back?: Backdrop): { css: CSSProperties; face: string } {
+ const family = p.font === undefined ? BEVY_FONT_FAMILY : familyOf(p.font);
+ if (p.font !== undefined && (typeof p.font !== "string" || p.font === "")) throw new TypeError(`${who}: font is a font file (staticFile("fonts/x.ttf")), got ${JSON.stringify(p.font)}`);
+ if (p.weight !== undefined && !(Number.isInteger(p.weight) && p.weight >= 1 && p.weight <= 1000)) throw new RangeError(`${who}: weight is 1 to 1000, got ${p.weight}`);
+ const lh = p.line_height;
+ let lineHeight: string | number = 1.2;
+ if (lh !== undefined) {
+ if ("Px" in lh && Number.isFinite(lh.Px)) lineHeight = `${lh.Px}px`;
+ else if ("RelativeToFont" in lh && Number.isFinite(lh.RelativeToFont)) lineHeight = lh.RelativeToFont;
+ else throw new TypeError(`${who}: line_height is { Px } or { RelativeToFont }, got ${JSON.stringify(lh)}`);
+ }
+ const css: CSSProperties = {
+ fontFamily: `"${family}"`,
+ fontSize: sizeCss(who, p.font_size),
+ fontWeight: p.weight ?? 400,
+ fontStyle: (p.style ?? "Normal").toLowerCase(),
+ color: p.color === undefined ? "#ffffff" : over(who, "color", p.color, back).css,
+ lineHeight,
+ WebkitFontSmoothing: "antialiased",
+ };
+ const variations = variationsCss(who, p.font_variations);
+ if (variations) css.fontVariationSettings = variations;
+ const face = p.font === undefined ? bevyFontFace() : `@font-face { font-family: "${family}"; src: url("${p.font}"); font-weight: 1 1000; }`;
+ return { css, face };
+}
+
+const BREAK: Record<NonNullable<TextProps["linebreak"]>, CSSProperties> = {
+ WordBoundary: { whiteSpace: "pre-wrap" },
+ AnyCharacter: { whiteSpace: "pre-wrap", wordBreak: "break-all" },
+ WordOrCharacter: { whiteSpace: "pre-wrap", overflowWrap: "anywhere" },
+ NoWrap: { whiteSpace: "pre" },
+};
+
+/** Bevy's UI text: a Node whose content is its string and its <TextSpan> children, in its TextFont, TextColor,
+ * TextLayout and LineHeight (Bevy's defaults when left out). @bevy bevy_ui::widget::text::Text */
+export function Text({ children, font, font_size, weight, style, color, line_height, font_variations, justify, linebreak, underline, strikethrough, underline_color, strikethrough_color, text_background_color, ...node }: TextProps) {
+ const ui = useContext(InUi);
+ const n = nodeCss("Text", node, ui?.back);
+ const t = textCss("Text", { font, font_size, weight, style, color, line_height, font_variations }, n.back);
+ if (justify !== undefined && !["Left", "Center", "Right", "Justified", "Start", "End"].includes(justify)) throw new TypeError(`Text: justify is Left, Center, Right, Justified, Start or End, got ${JSON.stringify(justify)}`);
+ if (linebreak !== undefined && !(linebreak in BREAK)) throw new TypeError(`Text: linebreak is WordBoundary, AnyCharacter, WordOrCharacter or NoWrap, got ${JSON.stringify(linebreak)}`);
+ const textAlign = { Left: "left", Center: "center", Right: "right", Justified: "justify", Start: "start", End: "end" }[justify ?? "Left"] as CSSProperties["textAlign"];
+ // the text itself in one block inside the Node, as bevy_text's measured leaf: its lines laid out together.
+ // data-raea-bevy-text: Blitz measures the block as bevy_text does, rounded up to whole pixels (38.4 px lines are 39).
+ // Its own strings carry its lines and background (runOf), inside the block: Blitz draws a line from the run's
+ // inline root down, not from a block above it, as thick as the font says (bevy_text's underline_size, not em/10)
+ const run = { underline, strikethrough, underline_color, strikethrough_color, text_background_color };
+ const own = Children.map(children, (c) => (typeof c === "string" || typeof c === "number" ? runOf("Text", run, n.back, c) : c));
+ const css = { ...n.css, ...t.css, textAlign };
+ return boxOf(css, n.back, <span data-raea-bevy-text="" style={BREAK[linebreak ?? "WordBoundary"]}>{own}</span>, ui === null, <style>{t.face}</style>);
+}
+
+/** A run of a <Text> in a style of its own (Bevy's defaults, not its Text's, where left out). @bevy bevy_text::text::TextSpan */
+export function TextSpan({ children, underline, strikethrough, underline_color, strikethrough_color, text_background_color, ...p }: TextStyleProps & TextRunProps & { children?: ReactNode }) {
+ const back = useContext(InUi)?.back;
+ const t = textCss("TextSpan", p, back);
+ const run = { underline, strikethrough, underline_color, strikethrough_color, text_background_color };
+ return (
+ <>
+ <style>{t.face}</style>
+ <span style={t.css}>{runOf("TextSpan", run, back, children)}</span>
+ </>
+ );
+}
+
+export interface ImageNodeProps extends NodeProps {
+ /** the picture: staticFile("branding/icon.png") */
+ image: string;
+ /** its tint: white (none) by default; only white or a grey multiplies here yet (a picture's brightness) */
+ color?: Srgba;
+ flip_x?: boolean;
+ flip_y?: boolean;
+ /** TextureAtlas: the one cell of a sheet laid out by a TextureAtlasLayout to draw (the picture is the sheet) */
+ texture_atlas?: { layout: TextureAtlasLayout; index: number };
+}
+
+/** bevy_image's TextureAtlasLayout: a sheet's size and its cells' rects in px. @bevy bevy_image::TextureAtlasLayout */
+export interface TextureAtlasLayout { size: [number, number]; textures: { x: number; y: number; w: number; h: number }[] }
+export const TextureAtlasLayout = {
+ /** cells of `tile` px, `columns` by `rows`, row by row from the top left; padding between cells and an offset
+ * before the first, as Bevy's from_grid has them (none by default) */
+ from_grid(tile: [number, number], columns: number, rows: number, padding?: [number, number], offset?: [number, number]): TextureAtlasLayout {
+ const [w, h] = tile, [px_, py] = padding ?? [0, 0], [ox, oy] = offset ?? [0, 0];
+ for (const n of [w, h, columns, rows]) if (!(Number.isInteger(n) && n > 0)) throw new RangeError(`TextureAtlasLayout.from_grid: tile, columns and rows are whole numbers above 0, got ${JSON.stringify([tile, columns, rows])}`);
+ const textures = [];
+ for (let r = 0; r < rows; r++) for (let c = 0; c < columns; c++) textures.push({ x: ox + c * (w + px_), y: oy + r * (h + py), w, h });
+ // (Bevy's size: (tile + padding) * grid - padding, its padding between cells only; not the offset)
+ return { size: [columns * (w + px_) - px_, rows * (h + py) - py], textures };
+ },
+};
+
+/** bevy_ui's ImageNode: a Node showing a picture stretched over its content box (inside its padding and border),
+ * sized by the picture when its width or height is auto, as bevy_ui's ImageNodeSize measures it. No children (an
+ * <img>). @bevy bevy_ui::widget::image::ImageNode */
+export function ImageNode({ image, color, flip_x, flip_y, children, fixed, texture_atlas, ...p }: ImageNodeProps) {
+ if (texture_atlas !== undefined) return AtlasNode({ image, color, flip_x, flip_y, children, fixed, texture_atlas, ...p });
+ if (typeof image !== "string" || image === "") throw new TypeError(`ImageNode: image is a picture file (staticFile("x.png")), got ${JSON.stringify(image)}`);
+ if (children !== undefined && children !== null && children !== false) throw new TypeError("ImageNode: takes no children here (a picture on a Node with children: put the ImageNode beside them)");
+ const grey = color === undefined || (color.red === color.green && color.green === color.blue);
+ if (!grey || (color && color.alpha !== 1)) throw new TypeError("ImageNode: color tints only by an opaque grey yet (brightness); a coloured or translucent tint is to do");
+ const ui = useContext(InUi);
+ const n = nodeCss("ImageNode", p, ui?.back);
+ const flips = [flip_x && "scaleX(-1)", flip_y && "scaleY(-1)"].filter(Boolean).join(" ");
+ const rendering = RENDERING[useContext(Sampler)];
+ const css: CSSProperties = { ...n.css, objectFit: "fill", ...(rendering ? { imageRendering: rendering } : {}), ...(flips ? { transform: flips } : {}), ...(color && color.red !== 1 ? { filter: `brightness(${color.red})` } : {}) };
+ const img = <img src={image} style={css} />;
+ const root = fixed ? "fixed" : ui === null;
+ return root ? <div style={root === "fixed" ? { ...VIEWPORT, position: "fixed" } : VIEWPORT}>{img}</div> : img;
+}
+
+// an ImageNode of one atlas cell: the sheet scaled so the cell fills the content box (Bevy's UVs are the cell's rect
+// over the layout's size), the rest clipped; sized by the cell when its width and height are auto, as Bevy measures it
+function AtlasNode({ image, color, flip_x, flip_y, children, fixed, texture_atlas, ...p }: ImageNodeProps) {
+ if (typeof image !== "string" || image === "") throw new TypeError(`ImageNode: image is a picture file (staticFile("x.png")), got ${JSON.stringify(image)}`);
+ if (children !== undefined && children !== null && children !== false) throw new TypeError("ImageNode: takes no children here (a picture on a Node with children: put the ImageNode beside them)");
+ const { layout, index } = texture_atlas!;
+ const cell = layout?.textures?.[index];
+ if (!cell) throw new RangeError(`ImageNode: texture_atlas.index ${index} is not one of its layout's ${layout?.textures?.length ?? 0} cells`);
+ if (color !== undefined && !(color.red === color.green && color.green === color.blue && color.alpha === 1)) throw new TypeError("ImageNode: color tints only by an opaque grey yet (brightness); a coloured or translucent tint is to do");
+ const ui = useContext(InUi);
+ const n = nodeCss("ImageNode", { width: px(cell.w), height: px(cell.h), ...p }, ui?.back);
+ const flips = [flip_x && "scaleX(-1)", flip_y && "scaleY(-1)"].filter(Boolean).join(" ");
+ const pct = (a: number, b: number) => `${(a / b) * 100}%`;
+ const rendering = RENDERING[useContext(Sampler)];
+ const sheet: CSSProperties = {
+ position: "absolute", maxWidth: "none", ...(rendering ? { imageRendering: rendering } : {}),
+ left: pct(-cell.x, cell.w), top: pct(-cell.y, cell.h), width: pct(layout.size[0], cell.w), height: pct(layout.size[1], cell.h),
+ ...(color && color.red !== 1 ? { filter: `brightness(${color.red})` } : {}),
+ };
+ const box: CSSProperties = { position: "relative", overflow: "hidden", width: "100%", height: "100%", ...(flips ? { transform: flips } : {}) };
+ const node = <div style={n.css}><div style={box}><img src={image} style={sheet} /></div></div>;
+ const root = fixed ? "fixed" : ui === null;
+ return root ? <div style={root === "fixed" ? { ...VIEWPORT, position: "fixed" } : VIEWPORT}>{node}</div> : node;
+}
+
+// ImagePlugin's default sampler, for the pictures inside it (a <Node> tree's ImageNodes)
+const Sampler = createContext<"Linear" | "Nearest">("Linear");
+const RENDERING = { Linear: undefined, Nearest: "pixelated" } as const;
+
+/** bevy_image's ImagePlugin: its default_sampler for every picture drawn inside it (Linear by default;
+ * ImagePlugin::default_nearest() is default_sampler="Nearest", for pixel art). @bevy bevy_image::ImagePlugin */
+export function ImagePlugin({ default_sampler, children }: { default_sampler?: "Linear" | "Nearest"; children?: ReactNode }) {
+ if (default_sampler !== undefined && !(default_sampler in RENDERING)) throw new TypeError(`ImagePlugin: default_sampler is Linear or Nearest, got ${JSON.stringify(default_sampler)}`);
+ return <Sampler.Provider value={default_sampler ?? "Linear"}>{children}</Sampler.Provider>;
+}
diff --git a/sdk/render/src/grow.ts b/sdk/render/src/grow.ts
new file mode 100644
index 00000000..7bfa6fc0
--- /dev/null
+++ b/sdk/render/src/grow.ts
@@ -0,0 +1,165 @@
+// Organic solids and generated growth, built natively (raea-core-sdf, raea-core-grow) and returned as Solids, so they
+// draw with <Mesh shape={solid}> and cut, union, measure and place like any other.
+//
+// sdf.smoothUnion(0.05, sdf.sphere(0.3), sdf.capsule([0, 0, 0], [0, 0.6, 0], 0.1)).solid() a blended body
+// grow.tree({ height: 6, crown: "dome" }) grow.loft([[0, "circle 0.2"], [0.3, "circle 0.3"], [0.6, "circle 0.1"]])
+// grow.terrain({ size: 20, height: 2 }) grow.boulder({ size: 1, seed: 2 }) grow.rosette({ leaves: 21 })
+//
+// A field is text until .solid() meshes it: building one costs nothing, meshing it is one native call.
+
+import { native } from "@raea/app/native";
+import { Solid, type Vec3 } from "./solid";
+
+/** A number as the expressions read it: plain decimals, never an exponent. */
+function num(owner: string, n: number): string {
+ if (typeof n !== "number" || !Number.isFinite(n)) throw new TypeError(`${owner}: numbers only, got ${JSON.stringify(n)}`);
+ const s = n.toFixed(6).replace(/\.?0+$/, "");
+ return s === "-0" ? "0" : s;
+}
+
+function nums(owner: string, ns: number[]): string {
+ return ns.map((n) => num(owner, n)).join(", ");
+}
+
+function made(expr: string): Solid {
+ const out = native("solid.expr", { expr });
+ return new Solid(out.id, out.expr);
+}
+
+/** A signed distance field (negative inside), as the text raea-core-sdf reads. Y is up; sizes are metres. */
+export class Field {
+ readonly text: string;
+ constructor(text: string) {
+ this.text = text;
+ }
+ move(x: number, y: number, z: number): Field {
+ return new Field(`move(${this.text}, ${nums("move", [x, y, z])})`);
+ }
+ /** Degrees about x, then y, then z (as a Solid's rotate). */
+ rotate(x: number, y: number, z: number): Field {
+ return new Field(`rotate(${this.text}, ${nums("rotate", [x, y, z])})`);
+ }
+ scale(s: number): Field {
+ return new Field(`scale(${this.text}, ${num("scale", s)})`);
+ }
+ /** Both sides: the field and its mirror across x = 0 (a body's left and right from one). */
+ mirrorX(): Field {
+ return new Field(`mirror_x(${this.text})`);
+ }
+ /** Grown outward by r, every edge rounded by it. */
+ round(r: number): Field {
+ return new Field(`round(${this.text}, ${num("round", r)})`);
+ }
+ /** Hollow: a skin 2t thick on the surface. */
+ shell(t: number): Field {
+ return new Field(`shell(${this.text}, ${num("shell", t)})`);
+ }
+ /** Roughened by fractal noise: `amp` metres, `freq` cycles a metre (bark, rock, a lumpy creature). */
+ displace(amp: number, freq: number, octaves = 4, seed = 1): Field {
+ return new Field(`displace(${this.text}, ${nums("displace", [amp, freq, octaves, seed])})`);
+ }
+ /** The field meshed (marching tetrahedra, `step` metres a cell: by default a 96th of its size) as a closed solid. */
+ solid(step?: number): Solid {
+ return made(step === undefined ? `sdf("${this.text}")` : `sdf("${this.text}", ${num("solid", step)})`);
+ }
+}
+
+const fields = (owner: string, fs: Field[]) => {
+ if (fs.length === 0 || fs.some((f) => !(f instanceof Field))) throw new TypeError(`${owner}: give fields (sdf.sphere(...) and the like)`);
+ return fs.map((f) => f.text).join(", ");
+};
+
+export const sdf = {
+ sphere: (r: number) => new Field(`sphere(${num("sphere", r)})`),
+ /** w x h x d, centred, its edges rounded by r. */
+ box: (w: number, h: number, d: number, r = 0) => new Field(`box(${nums("box", [w, h, d, r])})`),
+ /** Radius r, height h, standing along y. */
+ cylinder: (r: number, h: number) => new Field(`cylinder(${nums("cylinder", [r, h])})`),
+ /** Lying flat in x-z: R to the tube's middle, r the tube's. */
+ torus: (R: number, r: number) => new Field(`torus(${nums("torus", [R, r])})`),
+ ellipsoid: (rx: number, ry: number, rz: number) => new Field(`ellipsoid(${nums("ellipsoid", [rx, ry, rz])})`),
+ /** A rod from a to b with round ends (a limb, a finger, a handle). */
+ capsule: (a: Vec3, b: Vec3, r: number) => new Field(`capsule(${nums("capsule", [...a, ...b, r])})`),
+ /** A round cone from a (radius ra) to b (radius rb): a tapering limb, a horn, a tail. */
+ cone: (a: Vec3, b: Vec3, ra: number, rb: number) => new Field(`cone(${nums("cone", [...a, ...b, ra, rb])})`),
+ /** Round cones through points, each [x, y, z, radius]: a tentacle, a root, a cable. */
+ tube: (points: [number, number, number, number][]) => {
+ if (points.length < 2) throw new TypeError("tube: 2 or more [x, y, z, radius] points");
+ return new Field(`tube(${nums("tube", points.flat())})`);
+ },
+ union: (...fs: Field[]) => new Field(`union(${fields("union", fs)})`),
+ /** A union blended within k metres of each join: what makes parts read as one body. */
+ smoothUnion: (k: number, ...fs: Field[]) => new Field(`smooth_union(${num("smoothUnion", k)}, ${fields("smoothUnion", fs)})`),
+ subtract: (a: Field, b: Field) => new Field(`subtract(${fields("subtract", [a, b])})`),
+ /** b carved out of a, the cut's edge rounded by k (an eye socket, a mouth). */
+ smoothSubtract: (k: number, a: Field, b: Field) => new Field(`smooth_subtract(${num("smoothSubtract", k)}, ${fields("smoothSubtract", [a, b])})`),
+ intersect: (...fs: Field[]) => new Field(`intersect(${fields("intersect", fs)})`),
+ smoothIntersect: (k: number, ...fs: Field[]) => new Field(`smooth_intersect(${num("smoothIntersect", k)}, ${fields("smoothIntersect", fs)})`),
+};
+
+/** Settings as the generators read them: name=value words, numbers as plain decimals. */
+function settings(owner: string, o: Record<string, number | string | undefined>): string {
+ return Object.entries(o)
+ .filter(([, v]) => v !== undefined)
+ .map(([k, v]) => {
+ if (typeof v === "string") {
+ if (!/^[a-z]+$/.test(v)) throw new TypeError(`${owner}: ${k} is a word, got ${JSON.stringify(v)}`);
+ return `${k}=${v}`;
+ }
+ return `${k}=${num(owner, v as number)}`;
+ })
+ .join(" ");
+}
+
+export interface TreeOptions {
+ /** metres (6) */
+ height?: number;
+ /** the clear trunk below the crown, a share of the height (0.35) */
+ trunk?: number;
+ /** the crown's width over its height (0.9) */
+ width?: number;
+ crown?: "dome" | "sphere" | "cone" | "column" | "umbrella" | "vase";
+ /** attraction points: more is a denser, twiggier crown (1200) */
+ points?: number;
+ /** a growth step, a share of the height (0.03) */
+ step?: number;
+ /** the trunk's radius at the ground (a fortieth of the height) */
+ base?: number;
+ /** the outer twigs' radius (0.006) */
+ tip?: number;
+ /** branches turn up (+) or droop (-) as they grow (0.15) */
+ tropism?: number;
+ /** leaves per outer twig node (3; 0 is bare) */
+ leaves?: number;
+ /** a leaf's length (0.09) */
+ leaf?: number;
+ sides?: number;
+ seed?: number;
+}
+
+export type LoftOutline = string | [number, number][];
+
+export const grow = {
+ /** A tree grown by space colonization in its crown, thinned by the pipe model; `part` picks the wood or the leaves
+ * (draw them as two meshes with two materials). */
+ tree: (o: TreeOptions = {}, part: "all" | "wood" | "leaves" = "all") =>
+ made(`tree("${settings("tree", o as Record<string, number | string | undefined>)}", "${part}")`),
+ /** Outlines at heights, skinned and capped: each [y, outline], the outline "circle r", "ellipse rx rz", "rect w d",
+ * "ngon n r", or [x, z] points. A vase, a bottle, a lamp base, a column. */
+ loft: (sections: [number, LoftOutline][], around = 0) => {
+ if (sections.length < 2) throw new TypeError("loft: 2 or more [y, outline] sections");
+ const text = sections.map(([y, s]) => `${num("loft", y)}: ${typeof s === "string" ? s : s.map((p) => nums("loft", p).replace(",", "")).join(", ")}`).join("; ");
+ if (/["]/.test(text)) throw new TypeError("loft: outlines hold no quotes");
+ return made(`loft("${text}", ${num("loft", around)})`);
+ },
+ /** A fractal heightfield as a closed slab, centred, its surface from y 0 up to `height`; `flat` clears a disc in the
+ * middle that share of the size wide. */
+ terrain: (o: { size?: number; depth?: number; height?: number; cells?: number; freq?: number; octaves?: number; seed?: number; base?: number; flat?: number } = {}) =>
+ made(`terrain("${settings("terrain", o)}")`),
+ /** A rock about `size` across, `squash` as tall as wide, lumped by noise, resting on y 0. */
+ boulder: (o: { size?: number; squash?: number; rough?: number; freq?: number; octaves?: number; seed?: number; step?: number } = {}) =>
+ made(`boulder("${settings("boulder", o)}")`),
+ /** Leaves at the golden angle, blended from one heart: a succulent, an agave, a lettuce, a flower's petals. */
+ rosette: (o: { leaves?: number; length?: number; width?: number; thick?: number; tilt?: number; rise?: number; blend?: number; step?: number } = {}) =>
+ made(`rosette("${settings("rosette", o)}")`),
+};
diff --git a/sdk/render/src/index.ts b/sdk/render/src/index.ts
index 52b09232..e76eebc8 100644
--- a/sdk/render/src/index.ts
+++ b/sdk/render/src/index.ts
@@ -6,6 +6,8 @@ export * from "./paint";
export * from "./matchmove";
export * from "./scene";
export * from "./solid";
+export * from "./grow";
+export * from "./place";
export * from "./pick";
export * from "./splat";
// scene and solid each declare the same Bounds; /3d has always given solid's
diff --git a/sdk/render/src/overlays.ts b/sdk/render/src/overlays.ts
index 9cc391ee..bdb9a0e0 100644
--- a/sdk/render/src/overlays.ts
+++ b/sdk/render/src/overlays.ts
@@ -1,6 +1,6 @@
// A material's overlays, drawn over its standard surface by the engine: graph paper (`grid`, raea-render's grid.rs),
-// a paint look's breakup (`paint`, paint.rs) and wear (`wear`, systems/wear). Their props and checks; 3d.tsx's
-// materials take all three, a Model takes `grid`.
+// a paint look's breakup (`paint`, paint.rs), wear (`wear`, systems/wear) and a procedural surface (`procedural`,
+// systems/procmat). Their props and checks; 3d.tsx's materials take them all, a Model takes `grid`.
import { toHex } from "./colour";
/** graph paper over the surface (greybox levels): lines every `cell` world units (fixed in the world, so they run on
@@ -18,6 +18,32 @@ export interface PaintOverlay { breakup?: number; scale?: number; color?: string
* streaks (each 0..1 of the amount), in blotches of `scale` metres (0.08); `seed` moves the pattern */
export interface WearOverlay { amount: number; scale?: number; chips?: number; grime?: number; rust?: number; seed?: number; chipColor?: string; grimeColor?: string; rustColor?: string }
+/** the patterns a procedural surface draws (systems/procmat) */
+export const PATTERNS = ["noise", "wood", "marble", "stone", "brick", "tiles", "fabric", "brushed", "plaster"] as const;
+
+/** a surface made on the GPU (systems/procmat) in place of a flat colour: `pattern` in `colors` (two, each its own
+ * look's by default) with roughness `roughA`/`roughB`, features `scale` metres across (wood 0.25, fabric 0.004), a
+ * `bump` from its height (0.5); brick and tiles in cells of `tile` [w, h] metres with `gap` metre joints in
+ * `gapColor`. Use over it, each 0..1 (0): `dust` on what faces up, `dirt` in joints, hollows, undersides and along the
+ * floor line, `edges` worn lighter. Fixed in the part's own space; `seed` moves it. Clay reviews draw it plain. */
+export interface ProceduralSurface { pattern: (typeof PATTERNS)[number]; colors?: [string, string]; scale?: number; roughA?: number; roughB?: number; bump?: number; tile?: [number, number]; gap?: number; gapColor?: string; dust?: number; dirt?: number; edges?: number; dustColor?: string; dirtColor?: string; seed?: number }
+
+function checkProcedural(owner: string, props: Record<string, unknown>): void {
+ const s = props.procedural as ProceduralSurface | undefined;
+ if (s === undefined) return;
+ if (!(typeof s === "object" && s !== null && PATTERNS.includes(s.pattern))) throw new TypeError(`${owner}: procedural needs a pattern (${PATTERNS.join(", ")}), got ${JSON.stringify(s)}`);
+ if (props.wear !== undefined || props.grid !== undefined) throw new TypeError(`${owner}: procedural has its own use (dust, dirt, edges); it takes no wear or grid with it`);
+ for (const k of ["roughA", "roughB", "dust", "dirt", "edges"] as const) if (s[k] !== undefined && !(s[k]! >= 0 && s[k]! <= 1)) throw new RangeError(`${owner}: procedural.${k} is in [0, 1], got ${s[k]}`);
+ for (const k of ["scale", "gap", "bump"] as const) if (s[k] !== undefined && !(s[k]! >= 0 && Number.isFinite(s[k]))) throw new RangeError(`${owner}: procedural.${k} is 0 or more, got ${s[k]}`);
+ if (s.tile !== undefined && !(Array.isArray(s.tile) && s.tile.length === 2 && s.tile.every((x) => x > 0))) throw new RangeError(`${owner}: procedural.tile is [width, height] in metres, got ${JSON.stringify(s.tile)}`);
+ if (s.colors !== undefined && !(Array.isArray(s.colors) && s.colors.length === 2)) throw new TypeError(`${owner}: procedural.colors is two colours, got ${JSON.stringify(s.colors)}`);
+ props.procedural = {
+ ...s,
+ ...(s.colors ? { colors: s.colors.map((c, i) => toHex(owner, `procedural.colors[${i}]`, c)) } : {}),
+ ...Object.fromEntries((["gapColor", "dustColor", "dirtColor"] as const).filter((k) => s[k] !== undefined).map((k) => [k, toHex(owner, `procedural.${k}`, s[k])])),
+ };
+}
+
/** a `grid` prop checked, its colours as hex (MeshStandardMaterial's and Model's) */
export function checkGrid(owner: string, props: Record<string, unknown>): void {
const grid = props.grid as GridOverlay | undefined;
@@ -27,8 +53,9 @@ export function checkGrid(owner: string, props: Record<string, unknown>): void {
props.grid = { ...grid, color: grid.color === undefined ? undefined : toHex(owner, "grid.color", grid.color), edge: grid.edge === undefined || grid.edge === "" ? grid.edge : toHex(owner, "grid.edge", grid.edge) };
}
-/** a material's `grid`, `paint` and `wear` checked, their colours as hex */
+/** a material's `grid`, `paint`, `wear` and `procedural` checked, their colours as hex */
export function checkOverlays(owner: string, props: Record<string, unknown>): void {
+ checkProcedural(owner, props);
checkGrid(owner, props);
const pp = props.paint as PaintOverlay | undefined;
if (pp !== undefined) {
diff --git a/sdk/render/src/place.ts b/sdk/render/src/place.ts
new file mode 100644
index 00000000..2c9b0c40
--- /dev/null
+++ b/sdk/render/src/place.ts
@@ -0,0 +1,66 @@
+// Placement by relations, solved natively (raea-core-place): say how things relate and get their places, measured,
+// instead of typing coordinates. Call it once at module level; the same input gives the same layout every frame.
+//
+// const lay = place({
+// room: { min: [-2, -2], max: [2, 2] },
+// objects: { desk: [1.4, 0.75, 0.7], chair: [0.5, 0.9, 0.5], lamp: [0.2, 0.45, 0.2] },
+// rules: [{ against: "desk", wall: "+z" }, { near: "chair", of: "desk", dist: 0.15 }, { facing: "chair", of: "desk" },
+// { on: "lamp", of: "desk" }],
+// });
+// <Mesh3d transform={{ translation: lay.desk.center, rotation: Quat.fromEuler(0, lay.desk.yaw, 0) }}>...
+//
+// Each object's `base` is the centre of its bottom face, `center` its middle (where a centred Cuboid goes), `yaw` its
+// turn about y in radians (its front is +z before the turn). `found` says what couldn't hold, in scene lint's shape.
+
+import { native } from "@raea/app/native";
+
+type V3 = [number, number, number];
+type Side = "+x" | "-x" | "+z" | "-z";
+
+export type PlaceRule =
+ | { on: string; of: string }
+ | { against: string; wall: Side }
+ | { beside: string; of: string; side: Side; gap?: number }
+ | { near: string; of: string; dist?: number }
+ | { apart: string; of: string; min?: number }
+ | { facing: string; of: string }
+ | { align: string; of: string; axis: "x" | "z" }
+ | { clear: string; depth?: number };
+
+export interface PlaceObject {
+ size: V3;
+ /** a start (or, with fixed, the place) for its bottom centre */
+ at?: V3;
+ /** degrees */
+ yaw?: number;
+ fixed?: boolean;
+}
+
+export interface Placed {
+ base: V3;
+ center: V3;
+ yaw: number;
+ size: V3;
+}
+
+export interface PlaceFinding {
+ part: string;
+ check: string;
+ level: string;
+ says: string;
+}
+
+export type Layout = Record<string, Placed> & { readonly found: PlaceFinding[]; readonly errors: number };
+
+export function place(o: { objects: Record<string, V3 | PlaceObject>; rules: PlaceRule[]; room?: { min: [number, number]; max: [number, number] } }): Layout {
+ const objects = Object.entries(o.objects).map(([id, v]) => (Array.isArray(v) ? { id, size: v } : { id, ...v }));
+ const out = native("place.solve", { objects, rules: o.rules as unknown as Record<string, string | number>[], ...(o.room ? { room: o.room } : {}) });
+ const lay: Record<string, Placed> = {};
+ for (const p of out.objects) {
+ lay[p.id] = { base: p.at, center: [p.at[0], p.at[1] + p.size[1] / 2, p.at[2]], yaw: (p.yaw * Math.PI) / 180, size: p.size };
+ }
+ const found = out.found.filter((f) => f.level !== "ok");
+ Object.defineProperty(lay, "found", { value: found, enumerable: false });
+ Object.defineProperty(lay, "errors", { value: out.errors, enumerable: false });
+ return lay as Layout;
+}
diff --git a/sdk/room/node_modules b/sdk/room/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/room/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/shell/shell.feature b/sdk/shell/shell.feature
index f0724601..0d85b26a 100644
--- a/sdk/shell/shell.feature
+++ b/sdk/shell/shell.feature
@@ -1,9 +1,10 @@
@spec
Feature: @raea/shell, the agent's shell
just-bash (vercel-labs, Apache-2.0, pinned at 3.6.0 and used unmodified as a dependency) runs the bash: parsing,
- pipes, redirections, functions, loops and its ~80 text tools, in TypeScript on JavaScriptCore (raea-native's runtime, the
+ pipes, redirections, functions, loops and its ~80 text tools, in TypeScript on raea's V8 (raea-native's runtime, the
same on the Mac and the iPhone). Under it the filesystem is the project folder through raea-native, and raea's own
- tools are commands that call the engine natively. The shell is the agent's hands in a space.
+ tools are commands that call the engine natively. The shell is the agent's hands in a space; docs/media.feature's
+ "sandbox boundary and the action rows" is the rule it keeps.
Rule: The project folder is the filesystem, and nothing else
Scenario: Paths
@@ -55,7 +56,7 @@ Feature: @raea/shell, the agent's shell
-markdown, -tabs, -quote, -html, -ascii, with -header, -separator, -newline, -nullvalue, -readonly, -echo, -cmd
And an error ends the script with exit 1 and "Error: ..." on stderr
Scenario: js-exec
- Then `js-exec -c CODE | FILE [ARGS]` runs JavaScript or TypeScript as an ES module in a fresh JavaScriptCore context on its own
+ Then `js-exec -c CODE | FILE [ARGS]` runs JavaScript or TypeScript as an ES module in a fresh V8 isolate on its own
thread (transpiled in process by raea-modules, deno_ast: no bun, so the same on the iPhone), with console to
stdout and stderr, process.argv, env, exit and stdin.text, and timers
And imports resolve only to files in the project; native calls are limited to the web shims' (no filesystem, no
@@ -78,7 +79,7 @@ Feature: @raea/shell, the agent's shell
Rule: just-bash and wsx split the work
Scenario: Who runs what
Then just-bash is the shell and its text tools (ls, cat, grep, sed, awk, jq, sort, find, ...): one implementation
- of each, in TypeScript on JavaScriptCore, on RaeaFs
+ of each, in TypeScript on V8, on RaeaFs
And wsx keeps anything compiled to WASI (Wasmtime, Pulley on the iPhone): each of its tools the shell lacks (jaq)
is a command run with only the project folder visible, under its fuel and memory limits; a WASI tool never
shadows a just-bash or raea command of the same name
@@ -90,6 +91,6 @@ Feature: @raea/shell, the agent's shell
every command's stdout and exit equal probe-golden.json (recorded on the Mac) on both machines
(sdk/react/ios/test.sh runs it on the iPhone)
Scenario: just-bash's own suite
- Then sdk/shell/tools/upstream.sh runs just-bash's tests at the pinned tag on raea's JavaScriptCore runtime, bundled as upstream bundles its
+ Then sdk/shell/tools/upstream.sh runs just-bash's tests at the pinned tag on raea's V8, bundled as upstream bundles its
browser build; the parts that need Node by design (python3, sqlite3 and js-exec's workers, the real-disk
filesystems, the CLI, curl's mocked transport) are listed, not run
diff --git a/sdk/skills/raea-bevy/SKILL.md b/sdk/skills/raea-bevy/SKILL.md
index 412af650..f1ba25f3 100644
--- a/sdk/skills/raea-bevy/SKILL.md
+++ b/sdk/skills/raea-bevy/SKILL.md
@@ -19,14 +19,16 @@ the topic files here link to those, except `rows.md` and `plugins.md`, which onl
| setting up the camera, camera moves, entities, 2D under and over 3D | `scene.md` |
| lighting: sun, bulbs, spots, ambient, shadows, brightness | `lights.md` |
| surfaces: colour, metal, glass, glow, clearcoat, picture maps, toon (cel) shading and ink outlines (`ToonMaterial`), wear (`WearExtension`), decals (`Decal`), a model's materials re-covered (a material inside its `Model`) | `materials.md` |
-| shapes: primitives, Manifold solids, Text3D | `meshes.md` |
+| a whole scene to build and make believable: brief, routing (which tool makes which object: solid, field, generator, Tripo HD or Smart Mesh, stock), build order, review sheets (`raea render --review`), the judge, stall rules | `scenes.md` |
+| the words to paste for a whole scene: the brief template, the builder prompt, the fresh-context judge prompt | `prompts.md` |
+| shapes: primitives, Manifold solids, blended organic bodies (`sdf`), trees, terrain, rocks, plants, lofts (`grow`), Text3D | `meshes.md` |
| people: Anny bodies posed by goals (a hand on a point, feet, gaze, a seat), motion capture clips, motion matching along routes round the furniture (`Character`, `perform`) | `characters.md` |
| interiors: rooms, runs of units, windows and bays, seats turned to tables (`faceToward`), layout checks, wall decor (`hang`), the garden outside, daylight, 3D sound (`Sound3D`) | `rooms.md` |
| motion: spins, springs, Sequences, model clips | `animation.md` |
| a 3D game: state, input, entities, collisions, state machines | `games.md` |
| a game's sound: one-shots on transitions (`<Tone.Sfx>`), buses, a bed ducked under a voice (Tone.js on raea) | `games.md` (Sound), then `raea guide motion/music` |
| glTF models, pictures in space, media files | `assets.md` |
-| an asset to fix before it goes in: scale and pivot, a heavy mesh, FBX/OBJ/.blend to .glb, a rig, a bake (Blender, `raea blender run`; never a whole scene) | `blender.md` |
+| a check names a Blender script (`fix: raea blender run blender/X.py`): convert, decimate, repair, split, bake, rig, cloth; one saved script per asset step, never the scene | `blender.md` |
| gaussian splats: a real scene or object trained from footage (`raea splat train`), `<Splat>` and its reveal, assemble, disperse, explode, wave, twist, morph, pulse | `splats.md` |
| liquids and goo: coffee dumped from a mug, a tap's stream, honey, things melting (`<Goo>`, sph or mpm, baked) | `liquids.md` |
| bloom, fog, tone mapping, exposure, fisheye and lens distortion, motion blur, fire (`<Fire>`), frame looks (pixel, ink, painted illustration `<Look mode="paint">`, cartoon `<Look mode="cartoon">`) | `post.md` |
diff --git a/sdk/skills/raea-bevy/animation.md b/sdk/skills/raea-bevy/animation.md
new file mode 120000
index 00000000..6f39225a
--- /dev/null
+++ b/sdk/skills/raea-bevy/animation.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/animation.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/assets.md b/sdk/skills/raea-bevy/assets.md
new file mode 120000
index 00000000..d342b976
--- /dev/null
+++ b/sdk/skills/raea-bevy/assets.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/assets.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/blender.md b/sdk/skills/raea-bevy/blender.md
new file mode 120000
index 00000000..ddd53bd8
--- /dev/null
+++ b/sdk/skills/raea-bevy/blender.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/blender.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/characters.md b/sdk/skills/raea-bevy/characters.md
new file mode 120000
index 00000000..b4069f0e
--- /dev/null
+++ b/sdk/skills/raea-bevy/characters.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/characters.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/games.md b/sdk/skills/raea-bevy/games.md
new file mode 120000
index 00000000..bd742403
--- /dev/null
+++ b/sdk/skills/raea-bevy/games.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/games.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/lights.md b/sdk/skills/raea-bevy/lights.md
new file mode 120000
index 00000000..d5e18781
--- /dev/null
+++ b/sdk/skills/raea-bevy/lights.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/lights.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/limits.md b/sdk/skills/raea-bevy/limits.md
new file mode 120000
index 00000000..54c6a5b3
--- /dev/null
+++ b/sdk/skills/raea-bevy/limits.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/limits.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/liquids.md b/sdk/skills/raea-bevy/liquids.md
new file mode 120000
index 00000000..77b44fdb
--- /dev/null
+++ b/sdk/skills/raea-bevy/liquids.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/liquids.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/materials.md b/sdk/skills/raea-bevy/materials.md
new file mode 120000
index 00000000..b9d15e65
--- /dev/null
+++ b/sdk/skills/raea-bevy/materials.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/materials.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/meshes.md b/sdk/skills/raea-bevy/meshes.md
new file mode 120000
index 00000000..5c9abd65
--- /dev/null
+++ b/sdk/skills/raea-bevy/meshes.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/meshes.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/post.md b/sdk/skills/raea-bevy/post.md
new file mode 120000
index 00000000..55d51770
--- /dev/null
+++ b/sdk/skills/raea-bevy/post.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/post.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/prompts.md b/sdk/skills/raea-bevy/prompts.md
new file mode 120000
index 00000000..d6dbfb61
--- /dev/null
+++ b/sdk/skills/raea-bevy/prompts.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/prompts.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/rooms.md b/sdk/skills/raea-bevy/rooms.md
new file mode 120000
index 00000000..a369239d
--- /dev/null
+++ b/sdk/skills/raea-bevy/rooms.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/rooms.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/scene.md b/sdk/skills/raea-bevy/scene.md
new file mode 120000
index 00000000..640ff60e
--- /dev/null
+++ b/sdk/skills/raea-bevy/scene.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/scene.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/scenes.md b/sdk/skills/raea-bevy/scenes.md
new file mode 120000
index 00000000..e0498447
--- /dev/null
+++ b/sdk/skills/raea-bevy/scenes.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/scenes.md
\ No newline at end of file
diff --git a/sdk/skills/raea-bevy/splats.md b/sdk/skills/raea-bevy/splats.md
new file mode 120000
index 00000000..6e1fca3e
--- /dev/null
+++ b/sdk/skills/raea-bevy/splats.md
@@ -0,0 +1 @@
+../../guides/craft/bevy/splats.md
\ No newline at end of file
diff --git a/sdk/skills/raea/SKILL.md b/sdk/skills/raea/SKILL.md
index 0cb3d731..496ce835 100644
--- a/sdk/skills/raea/SKILL.md
+++ b/sdk/skills/raea/SKILL.md
@@ -152,10 +152,13 @@ raea check out/piece.mp4 --manifest out/render.json --taste ~/.raea/taste/taste.
<!-- sources: docs/targets.feature apps/targets/src sdk/ui/src/app.ts sdk/rune/src -->
An app is a React file with a default export: DOM elements, inline `style` or Tailwind `className`, on @raea/ui. One
-setting picks the host that draws it. **web** (the default) is Blitz on Bevy, with Chrome's CSS and npm packages.
-**native** is Rune: a native window, native text, keyboard and accessibility, and springs on every change. The SDK
-is the same; only the setting differs. A composition or a game stays a composition; an app is an application's
-interface.
+setting picks the host that draws it. Both are desktop windows that draw every pixel themselves (neither uses the
+OS's widgets or a browser), with the same kind of text and layout engines. **web** (the default) is Blitz on Bevy: a
+browser engine, so all of CSS (grid included), web npm UI packages and the 3D world. **native** is Rune, an app UI
+framework: springs on every change, GPU effects and kit components, a screen-reader tree (AccessKit), a ~27 MB host
+against web's ~175 MB, a subset of CSS (no grid) and no 3D yet. The SDK is the same; only the setting differs. Pick
+native for a small, motion-heavy app with no 3D that passes its check; anything else stays on web. A composition or a
+game stays a composition; an app is an application's interface.
- Say the target in the app's own file, as a literal (anything else is refused at its line):
`export const app = { target: "native", title: "Notes", size: [480, 640], minSize: [360, 480] };`. With no
diff --git a/sdk/skills/raea/reference/cli.md b/sdk/skills/raea/reference/cli.md
index 39e1406d..0227d6c1 100644
--- a/sdk/skills/raea/reference/cli.md
+++ b/sdk/skills/raea/reference/cli.md
@@ -12,7 +12,7 @@ Access: HEADLESS. Arguments besides flags: 1.
```
raea render EDIT.tsx -o OUT.mp4|OUT.png|DIR [--frame N | --at A,B] [--composition ID] [--w W] [--h H] [--fps FPS] [--frames N] [--words W.json] [--perception P.json] [--input I.json|inputs.rrl] [--manifest render.json] [--stage WxH] [--10bit] [--aov] [--alpha] [--kbps N | --quality draft|high|master|0..1] (also: --lite --comps)
-raea render PAGE.html -o OUT.mp4|DIR [--at A,B] (an HTML composition, the HTML composition format format)
+raea render PAGE.html -o OUT.mp4|DIR [--at A,B] (an HTML composition)
raea render --bundle NAME.comp.js -o OUT.png|DIR [--dir DIR] [--frame N] (a bundle from raea bundle, as render_bundle draws it)
```
diff --git a/sdk/skills/raea/reference/sdk.md b/sdk/skills/raea/reference/sdk.md
index 01b14c18..6509b75c 100644
--- a/sdk/skills/raea/reference/sdk.md
+++ b/sdk/skills/raea/reference/sdk.md
@@ -7,7 +7,7 @@ with a capital, hooks with `use`. A component's props are in its file.
## `raea` (sdk/raea/src/index.tsx)
-`ACTION_KEY`, `AbsoluteFill`, `Animate`, `Audio`, `Clock`, `Composition`, `Easing`, `FEED_KEY`, `Freeze`, `Img`, `InputRegion`, `Loop`, `MEDIA_ROOT`, `Mix`, `Nudge`, `Overlay`, `Region`, `SPACE_KEY`, `Sequence`, `Series`, `SongPlot`, `Stagger`, `Video`, `actionsIn`, `applyActions`, `curve`, `curveFn`, `delay`, `fade`, `feedIn`, `fill`, `findPhrase`, `firstDecider`, `fish`, `getCompositions`, `gridDelay`, `inState`, `interpolate`, `isGeneratedAsset`, `keyEdges`, `lyria`, `machine`, `measureSpring`, `move`, `moves`, `overlays`, `parallel`, `pop`, `proofBoxes`, `propsFingerprint`, `pushIn`, `regionBand`, `registerRoot`, `replayDecider`, `reverse`, `rise`, `sampleAnimation`, `sao`, `sequence`, `sequenceGap`, `slam`, `slide`, `song`, `songAt`, `spring`, `stagger`, `stateOf`, `staticFile`, `stepAll`, `strike`, `tick`, `timeline`, `toMove`, `track`, `transitionOf`, `useCurrentFrame`, `useGameEvents`, `useGameState`, `useInput`, `useRegion`, `useSong`, `useVideoConfig`, `useWords`, `wipe`, `word`
+`ACTION_KEY`, `AbsoluteFill`, `Animate`, `Audio`, `Clock`, `Composition`, `Easing`, `FEED_KEY`, `Freeze`, `Img`, `InputRegion`, `Loop`, `MEDIA_ROOT`, `Mix`, `Nudge`, `Overlay`, `Region`, `SPACE_KEY`, `Sequence`, `Series`, `SongPlot`, `Stagger`, `Video`, `actionsIn`, `applyActions`, `curve`, `curveFn`, `delay`, `fade`, `feedIn`, `fill`, `findPhrase`, `firstDecider`, `fish`, `getCompositions`, `gridDelay`, `inState`, `interpolate`, `isGeneratedAsset`, `keyEdges`, `lyria`, `machine`, `measureSpring`, `move`, `moves`, `overlays`, `parallel`, `pop`, `proofBoxes`, `propsFingerprint`, `pushIn`, `regionBand`, `registerRoot`, `replayDecider`, `reverse`, `rise`, `sampleAnimation`, `sao`, `sequence`, `sequenceGap`, `slam`, `slide`, `song`, `songAt`, `spring`, `stagger`, `stateOf`, `staticFile`, `stepAll`, `strike`, `tick`, `tickClocks`, `timeline`, `toMove`, `track`, `transitionOf`, `useCurrentFrame`, `useGameEvents`, `useGameState`, `useInput`, `useRegion`, `useSong`, `useVideoConfig`, `useWords`, `wipe`, `word`
## `raea/3d` (sdk/raea/src/3d.tsx)
@@ -35,11 +35,11 @@ with a capital, hooks with `use`. A component's props are in its file.
## `raea/camera` (sdk/raea/src/camera.ts)
-`Camera3d`, `Canvas3D`, `Matchmove`, `TextureView`, `checkMatchmove`, `matchmoveIndex`, `matchmoveView`, `useMatchmove`
+`Camera3d`, `Canvas3D`, `Hdr`, `Matchmove`, `TextureView`, `checkMatchmove`, `matchmoveIndex`, `matchmoveView`, `useMatchmove`
## `raea/color` (sdk/raea/src/color.ts)
-`LinearRgba`, `Srgba`, `kelvin`, `toHex`
+`Hsla`, `LinearRgba`, `Oklaba`, `Oklcha`, `Srgba`, `Xyza`, `kelvin`, `toHex`
## `raea/gizmos` (sdk/raea/src/gizmos.ts)
@@ -55,7 +55,7 @@ with a capital, hooks with `use`. A component's props are in its file.
## `raea/light` (sdk/raea/src/light.ts)
-`AmbientLight`, `Atmosphere`, `DirectionalLight`, `Environment`, `EnvironmentMapLight`, `GlobalAmbientLight`, `Pathtracer`, `PointLight`, `RectLight`, `Shadows`, `SolariLighting`, `SpotLight`, `light_consts`
+`AmbientLight`, `Atmosphere`, `DirectionalLight`, `Environment`, `EnvironmentMapLight`, `GlobalAmbientLight`, `Pathtracer`, `PointLight`, `RectLight`, `Shadows`, `Skybox`, `SolariLighting`, `SpotLight`, `light_consts`
## `raea/math` (sdk/raea/src/math.ts)
@@ -67,7 +67,7 @@ with a capital, hooks with `use`. A component's props are in its file.
## `raea/pbr` (sdk/raea/src/pbr.ts)
-`AmbientOcclusion`, `Decal`, `ExtendedMaterial`, `Fire`, `Fog`, `FogVolume`, `GridExtension`, `PaintExtension`, `Refinish`, `ShaderExtension`, `ShaderMesh`, `StandardMaterial`, `SurfaceShader`, `ThreeShaderMaterial`, `ToonExtension`, `ToonMaterial`, `VolumetricFog`, `WearExtension`
+`AmbientOcclusion`, `Decal`, `ExtendedMaterial`, `Fire`, `Fog`, `FogFalloff`, `FogVolume`, `GridExtension`, `Lightmap`, `PaintExtension`, `ProceduralExtension`, `Refinish`, `ShaderExtension`, `ShaderMesh`, `StandardMaterial`, `SurfaceShader`, `ThreeShaderMaterial`, `ToonExtension`, `ToonMaterial`, `VolumetricFog`, `WearExtension`
## `raea/post_process` (sdk/raea/src/post_process.ts)
@@ -99,7 +99,7 @@ with a capital, hooks with `use`. A component's props are in its file.
## `raea/ui` (sdk/raea/src/ui.ts)
-`AbsoluteFill`
+`AbsoluteFill`, `BorderRadius`, `FontVariationTag`, `ImageNode`, `ImagePlugin`, `Node`, `Overflow`, `Text`, `TextSpan`, `TextureAtlasLayout`, `UiRect`, `auto`, `percent`, `px`, `vh`, `vmax`, `vmin`, `vw`
## `raea/video` (sdk/raea/src/video.ts)
diff --git a/sdk/ui/src/html.ts b/sdk/ui/src/html.ts
index f3e38859..24cd1487 100644
--- a/sdk/ui/src/html.ts
+++ b/sdk/ui/src/html.ts
@@ -1,5 +1,5 @@
// Portions ported from HyperFrames (Apache-2.0, https://github.com/heygen-com/hyperframes); see NOTICE.
-// An HTML composition on bevy_ui (docs/ts-native.feature P27): a the HTML composition format-format page (HTML, CSS, GSAP and the
+// An HTML composition on bevy_ui (docs/ts-native.feature P27): an HTML composition page (HTML, CSS, GSAP and the
// page's own scripts) run in a raea-runtime-js root, its elements dom.ts's, so its scripts work on a DOM and every element is
// a bevy_ui entity. The host (runtime/js src/html_page.rs) mounts this bundle with `__html` set (the page's
// source, its file and folder, the folder's files) and drives it a frame at a time:
diff --git a/sdk/ui/src/html/compile.ts b/sdk/ui/src/html/compile.ts
index 8a98e13a..1d2f1bb1 100644
--- a/sdk/ui/src/html/compile.ts
+++ b/sdk/ui/src/html/compile.ts
@@ -1,6 +1,6 @@
// Portions ported from HyperFrames (Apache-2.0, https://github.com/heygen-com/hyperframes); see NOTICE.
// A composition's compile step (docs/ts-native.feature P27), on the parsed tree before anything is built, as engine/
-// html's compile.rs did it after the composition format's compiler: sub-compositions (`data-composition-src`) inlined into their
+// html's compile.rs did it after the original compiler: sub-compositions (`data-composition-src`) inlined into their
// host, recursively, their relative URLs rebased onto the project root, their styles scoped to the host and put in
// <head>, their scripts at the end of <body> (a script of their own run with `document` and `gsap` scoped to their
// root); the root composition's data-width/height sizing it, <html> and <body>.
@@ -30,7 +30,7 @@ function sibling(file: string, url: string): string {
}
return parts.join("/") + suffix;
}
-/** A sub-composition's relative URL as a project-root path (the composition format's rewriteAssetPath): `../` resolves against
+/** A sub-composition's relative URL as a project-root path (the original rewriteAssetPath): `../` resolves against
* the file's folder, a plain relative path only when that sibling exists. */
function rebase(exists: (p: string) => boolean, file: string, url: string): string {
if (!isRelative(url)) return url;
@@ -58,7 +58,7 @@ function scopeSelector(sel: string, scope: string, ids: string[]): string {
}
return `${scope} ${t}`;
}
-/** The composition format's scopeCssToComposition: each top-level rule prefixed with the scope; @keyframes / @font-face global,
+/** The original scopeCssToComposition: each top-level rule prefixed with the scope; @keyframes / @font-face global,
* @media and @supports scoped inside. */
export function scopeCss(css: string, scope: string, ids: string[], map?: (s: string) => string): string {
let out = "";
diff --git a/sdk/ui/src/html/fonts.ts b/sdk/ui/src/html/fonts.ts
index b7f6fb82..172b7874 100644
--- a/sdk/ui/src/html/fonts.ts
+++ b/sdk/ui/src/html/fonts.ts
@@ -1,5 +1,5 @@
// Portions ported from HyperFrames (Apache-2.0, https://github.com/heygen-com/hyperframes); see NOTICE.
-// The composition format's deterministic fonts (docs/ts-native.feature P27), as engine/html's fonts.rs did them: a page's
+// the deterministic font set (docs/ts-native.feature P27), as engine/html's fonts.rs did them: a page's
// `font-family` gets the same faces whatever machine renders it. A system family is swapped for a bundled stand-in
// (Helvetica, Arial, SF Pro, Avenir -> Inter; Georgia, Times -> EB Garamond; Menlo, Courier -> JetBrains Mono ...),
// the bundle's weights (core/fonts) with Google Fonts' for the weights it lacks; any other family comes from Google
@@ -41,7 +41,7 @@ const GENERIC = new Set([
"ui-rounded", "emoji", "math", "fangsong", "-apple-system", "blinkmacsystemfont", "inherit", "initial", "unset",
"revert", "revert-layer",
]);
-/** The composition format's GENERIC_FAMILIES: a value starting with one of these gets Inter first. */
+/** The original runtime's GENERIC_FAMILIES: a value starting with one of these gets Inter first. */
const HF_GENERIC = new Set([
"sans-serif", "serif", "monospace", "cursive", "fantasy", "system-ui", "ui-sans-serif", "ui-serif", "ui-monospace",
"emoji", "math", "fangsong", "-apple-system", "blinkmacsystemfont",
@@ -107,7 +107,7 @@ type Face = { weight: string; style: string; url: string; range?: string };
function faceRule(family: string, f: Face): string {
return `@font-face{font-family:"${family.replace(/"/g, '\\"')}";src:url("${f.url}");font-weight:${f.weight};font-style:${f.style}}`;
}
-/** The composition format's bundledFamilyFaceRules supplement: the faces collapsed into weight runs of one file (Google serves a
+/** The original runtime's bundledFamilyFaceRules supplement: the faces collapsed into weight runs of one file (Google serves a
* variable family's weights as one file) that don't span a weight the bundle covers, each a `font-weight: lo hi`
* range, so the file's `wght` axis answers every weight in its run. */
function runs(faces: Face[], covered: Set<string>): Face[] {
@@ -220,7 +220,7 @@ export async function deterministic(rules: Rule[], inline: string[], at: string[
for (const [lower, { family, longhand }] of wanted) {
if (declared.has(lower)) continue;
const canonical = ALIASES[lower];
- // The HTML composition format reads `font-family` declarations only: a stand-in named only in a `font` shorthand keeps the
+ // The original runtime reads `font-family` declarations only: a stand-in named only in a `font` shorthand keeps the
// installed font, as it does in Chrome
if (!longhand && canonical && DISPLAY[canonical].toLowerCase() !== lower) continue;
if (canonical) {
diff --git a/sdk/ui/src/html/page/cascade.ts b/sdk/ui/src/html/page/cascade.ts
index e0806a51..ccce28fc 100644
--- a/sdk/ui/src/html/page/cascade.ts
+++ b/sdk/ui/src/html/page/cascade.ts
@@ -101,7 +101,7 @@ export async function gatherSheets(): Promise<boolean> {
at.push(...s.at);
for (const [k, v] of s.props) registered.set(k, v);
}
- // The composition format's deterministic fonts: the families the page names pinned to bundled and Google faces. A served page
+ // the deterministic font set: the families the page names pinned to bundled and Google faces. A served page
// (WPT's) is a plain web page and keeps the families it names, as Chrome draws them: `monospace` is Menlo, not
// `Inter, monospace`
if (!P.served) {
diff --git a/sdk/ui/src/html/page/load.ts b/sdk/ui/src/html/page/load.ts
index efe217bd..5da21e9f 100644
--- a/sdk/ui/src/html/page/load.ts
+++ b/sdk/ui/src/html/page/load.ts
@@ -59,7 +59,7 @@ async function load() {
for (let i = 0; i < 3; i++) await new Promise((r) => (g.requestAnimationFrame(r), setTimeout(r, 200)));
namedAccess();
// the registry a page's scripts put their timelines in (window.__timelines["main"] = tl), made before they run as
- // The composition format's own runtime makes it: without it every such script threw at that line and the page never moved
+ // the original runtime makes it: without it every such script threw at that line and the page never moved
g.__timelines ??= {};
for (let i = 0; i < compiled.scripts.length; i++) await runScript(compiled.scripts[i], i);
try {
diff --git a/sdk/ui/src/html/page/scripts.ts b/sdk/ui/src/html/page/scripts.ts
index 662182f0..ce131155 100644
--- a/sdk/ui/src/html/page/scripts.ts
+++ b/sdk/ui/src/html/page/scripts.ts
@@ -5,7 +5,7 @@ import { abs, g, isRemote, pagePath, read, warn } from "./all";
// ---------------------------------------------------------------- scripts
-/** The composition format's scoped `document` and `gsap` for a sub-composition's own script: selectors find its elements first. */
+/** The original runtime's scoped `document` and `gsap` for a sub-composition's own script: selectors find its elements first. */
function scope(compId: string): { document: Document; gsap: any } {
const root = Array.from(document.querySelectorAll("[data-composition-id]")).find((e) => e.getAttribute("data-composition-id") === compId);
if (!root) return { document, gsap: g.gsap };
diff --git a/sdk/ui/src/html/runtime.ts b/sdk/ui/src/html/runtime.ts
index 8052a2fd..e07377d4 100644
--- a/sdk/ui/src/html/runtime.ts
+++ b/sdk/ui/src/html/runtime.ts
@@ -1,6 +1,6 @@
// Portions ported from HyperFrames (Apache-2.0, https://github.com/heygen-com/hyperframes); see NOTICE.
-// The parts of the the HTML composition format runtime a render depends on (docs/ts-native.feature P27), as engine/html's runtime.rs
-// ported them from the composition format's packages/core/src/runtime (startResolver.ts, timeline.ts, clipWindow.ts): `data-start`
+// The parts of the original HTML-composition runtime a render depends on (docs/ts-native.feature P27), as engine/html's runtime.rs
+// ported them from its packages/core/src/runtime (startResolver.ts, timeline.ts, clipWindow.ts): `data-start`
// expressions (absolute, `id`, `id + 2`, `id - 0.5`) offset by the host composition, durations from data-duration /
// data-end / media / sub-timelines, frame-snapped clip windows, the ancestor chain rule, and display:none for hidden
// in-flow leaf clips.
diff --git a/sdk/video/node_modules b/sdk/video/node_modules
new file mode 120000
index 00000000..b8ffeb85
--- /dev/null
+++ b/sdk/video/node_modules
@@ -0,0 +1 @@
+../raea/node_modules
\ No newline at end of file
diff --git a/sdk/video/src/input-region.tsx b/sdk/video/src/input-region.tsx
index 7956df6b..4c68e59d 100644
--- a/sdk/video/src/input-region.tsx
+++ b/sdk/video/src/input-region.tsx
@@ -1,7 +1,7 @@
// A box of a page with input of its own: several panels in one page (the phone's compact shell, docs/platform.feature),
// each hearing the pointer as it would as a page of its own (apps/void/src/space_ui.rs gives each panel its own page).
import { useContext, useMemo, type ReactNode } from "react";
-import { ClockContext, type FrameInput, type InputTimeline } from "@raea/app/clock";
+import { ClockContext, useClockTick, type FrameInput, type InputTimeline } from "@raea/app/clock";
type Box = { x: number; y: number; w: number; h: number; scale: number };
type Entry = Partial<FrameInput> & { live?: boolean };
@@ -55,6 +55,8 @@ function boxed(timeline: InputTimeline, b: Box): InputTimeline {
*/
export function InputRegion({ x, y, w, h, scale = 1, children }: { x: number; y: number; w: number; h: number; scale?: number; children?: ReactNode }) {
const clock = useContext(ClockContext);
+ // its copy is a new object each frame, so its children hear the frame through it: it hears it from the Clock
+ useClockTick(clock);
const input = useMemo(() => (clock ? boxed(clock.input, { x, y, w, h, scale }) : null), [clock?.input, x, y, w, h, scale]);
if (!clock || !input) return <>{children}</>;
return <ClockContext.Provider value={{ ...clock, input }}>{children}</ClockContext.Provider>;
diff --git a/systems/contact/Cargo.toml b/systems/contact/Cargo.toml
index 91c83652..3c977296 100644
--- a/systems/contact/Cargo.toml
+++ b/systems/contact/Cargo.toml
@@ -9,5 +9,7 @@ description = "Where a 3D scene's parts meet, from their geometry: what each res
[dependencies]
raea-core-scene = { path = "../../core/scene" }
raea-core-shape = { path = "../../core/shape" }
+# the Blender step a model calls for (an unloadable format, triangles over budget for its distance): docs/blender.feature
+raea-core-meshcheck = { path = "../../core/meshcheck" }
bevy = { version = "=0.20.0", default-features = false, features = ["std"] }
serde_json = "1"
diff --git a/systems/contact/src/assets.rs b/systems/contact/src/assets.rs
new file mode 100644
index 00000000..020e0fe1
--- /dev/null
+++ b/systems/contact/src/assets.rs
@@ -0,0 +1,71 @@
+//! The Blender steps a scene's models call for (docs/blender.feature BL10, BL16): a model in a format raea can't load
+//! (an error: it draws nothing), and one carrying more triangles than its distance from the camera can show (a
+//! warning: 150 000 at a metre or closer, falling with the square of the distance, never under 2 000). Each names its
+//! fix, `raea blender run blender/X.py ...`, in its words and in `fix`.
+
+use raea_core_meshcheck::blender;
+use raea_core_scene::{Item, src_path};
+use serde_json::{Value, json};
+
+use super::model::file_tris;
+use super::seen::camera;
+
+/// The frame's models measured against the camera: (findings, the error count).
+pub fn assets(its: &[Item]) -> (Vec<Value>, usize) {
+ let eye = camera(its).map(|c| c.1);
+ let (mut out, mut errors) = (Vec::new(), 0);
+ let mut said = std::collections::HashSet::new();
+ for it in its.iter().filter(|i| i.kind == "model") {
+ let Some(src) = it.props.get("src").and_then(Value::as_str) else { continue };
+ if let Some(mut f) = blender::unloadable(src) {
+ if said.insert(src.to_string()) {
+ f["part"] = json!(src);
+ out.push(f);
+ errors += 1;
+ }
+ continue;
+ }
+ let (Some(eye), Ok(tris)) = (eye, file_tris(&src_path(src))) else { continue };
+ let n = tris.len() / 3;
+ // the nearest point of its box, placed, to the eye
+ let (mut lo, mut hi) = (bevy::math::Vec3::splat(f32::MAX), bevy::math::Vec3::splat(f32::MIN));
+ for q in tris.iter() {
+ let w = it.world.transform_point3(*q);
+ lo = lo.min(w);
+ hi = hi.max(w);
+ }
+ if n == 0 {
+ continue;
+ }
+ let seen = (eye.clamp(lo, hi) - eye).length() as f64;
+ let budget = blender::budget(seen);
+ if n > budget && said.insert(format!("{src}@tris")) {
+ let k = (budget / 1000).max(1);
+ let f = blender::fix("decimate.py", &format!("{src} {} {budget}", blender::beside(src, &format!("{k}k"))));
+ out.push(json!({"part": src, "check": "triangles", "level": "warning", "says": blender::says(&format!("{src} carries {n} triangles, {seen:.1} m from the camera: over the {budget} it can show there"), &f), "fix": f, "seen": (seen * 100.0).round() / 100.0}));
+ }
+ }
+ (out, errors)
+}
+
+#[cfg(test)]
+mod tests {
+ use std::sync::Arc;
+
+ use bevy::math::Mat4;
+ use raea_core_scene::Item;
+ use serde_json::json;
+
+ fn item(kind: &'static str, props: serde_json::Value) -> Item {
+ let Some(m) = props.as_object().cloned() else { unreachable!() };
+ Item { kind, props: Arc::new(m), shape: None, material: None, world: Mat4::IDENTITY }
+ }
+
+ #[test]
+ fn a_model_raea_cant_load_names_convert() {
+ let its = vec![item("camera", json!({"position": [0, 1, 4]})), item("model", json!({"src": "media/src/chair.fbx"})), item("model", json!({"src": "media/src/chair.fbx"}))];
+ let (found, errors) = super::assets(&its);
+ assert_eq!(errors, 1, "{found:?}");
+ assert_eq!(found[0]["fix"]["run"], "raea blender run blender/convert.py media/src/chair.fbx media/src/chair.glb");
+ }
+}
diff --git a/systems/contact/src/lib.rs b/systems/contact/src/lib.rs
index 4b48029d..87e9ad1d 100644
--- a/systems/contact/src/lib.rs
+++ b/systems/contact/src/lib.rs
@@ -25,6 +25,9 @@ use raea_core_scene::{Item, excused, filled, gltf_tris, label, src_path, tracks_
pub mod lint;
pub use lint::lint;
// a model's box and a seat's facing (scene.bounds, scene.facing)
+mod assets;
+pub use assets::assets;
+
mod model;
pub use model::{bounds, facing, seat_facing};
diff --git a/systems/environment/src/lib.rs b/systems/environment/src/lib.rs
index 9f0df4a4..9ae5a1e1 100644
--- a/systems/environment/src/lib.rs
+++ b/systems/environment/src/lib.rs
@@ -28,6 +28,11 @@ use bevy::core_pipeline::Skybox;
use bevy::light::{EnvironmentMapLight, GeneratedEnvironmentMapLight};
use bevy::render::render_resource::{Extent3d, TextureDimension, TextureViewDescriptor, TextureViewDimension};
+/// <EnvironmentMapLight>'s own prefiltered maps and <Skybox>
+mod prefiltered;
+use prefiltered::prefiltered;
+pub use prefiltered::{sync_prefiltered, Prefiltered};
+
/// The camera's panoramas as cubemaps, in env_srcs' order, and each one's bake entity (its filtered light).
#[derive(Component)]
pub struct EnvMaps(Vec<Handle<Image>>, Vec<Entity>);
@@ -323,22 +328,6 @@ pub fn environment(world: &mut World, e: Entity, vals: &BTreeMap<String, V>, ins
Ok(())
}
-/// Bevy's EnvironmentMapLight from its own prefiltered cubemaps (envmap_diffuse_map, envmap_specular_map: .ktx2 files,
-/// as Bevy's examples load environment_maps/pisa_*_rgb9e5_zstd.ktx2) at envmap_k cd/m², decoded by Bevy's KTX2 reader
-fn prefiltered(world: &mut World, e: Entity, vals: &BTreeMap<String, V>) -> Result<(), String> {
- let (Some(V::S(d)), Some(V::S(s))) = (vals.get("envmap_diffuse_map"), vals.get("envmap_specular_map")) else { return Ok(()) };
- let mut load = |p: &str| -> Result<Handle<Image>, String> {
- let bytes = std::fs::read(p).map_err(|err| format!("EnvironmentMapLight: {p}: {err}"))?;
- let ext = Path::new(p).extension().and_then(|x| x.to_str()).unwrap_or("ktx2");
- let img = Image::from_buffer(&bytes, bevy::image::ImageType::Extension(ext), bevy::image::CompressedImageFormats::NONE, false, bevy::image::ImageSampler::Default, bevy::asset::RenderAssetUsages::RENDER_WORLD)
- .map_err(|err| format!("EnvironmentMapLight: {p}: {err}"))?;
- Ok(world.resource_mut::<Assets<Image>>().add(img))
- };
- let (diffuse_map, specular_map) = (load(d)?, load(s)?);
- world.entity_mut(e).insert(EnvironmentMapLight { diffuse_map, specular_map, intensity: num(vals, "envmap_k", 1.0), ..default() });
- Ok(())
-}
-
/// Each frame's panorama, light, turn and sky: the camera's light points at the targets of the panorama's bake, so
/// switching the source switches the light that frame.
pub fn sync_environment(frame: Res<FrameRows>, mut q: Query<(Entity, &EnvMaps, &mut EnvironmentMapLight, Option<&mut Skybox>), Without<EnvBake>>, bakes: Query<&EnvironmentMapLight, With<EnvBake>>) {
diff --git a/systems/environment/src/prefiltered.rs b/systems/environment/src/prefiltered.rs
new file mode 100644
index 00000000..56e0eb02
--- /dev/null
+++ b/systems/environment/src/prefiltered.rs
@@ -0,0 +1,70 @@
+//! Bevy's EnvironmentMapLight from its own prefiltered cubemaps (<EnvironmentMapLight>) and Bevy's Skybox (<Skybox>), as
+//! Bevy's examples put both on the camera: .ktx2 files decoded by Bevy's KTX2 reader, the light's intensity as the
+//! first frame has it, and both rotations (and the sky's brightness) keyed, so rotate_environment_map turns them every
+//! frame.
+//!
+//! Camera columns: envmap_diffuse_map, envmap_specular_map (the files), envmap_k (cd/m²), envmap_qx..qw (its
+//! rotation; keyed); skybox_image (the file), skybox_k (its brightness, cd/m²; keyed), skybox_qx..qw (keyed).
+
+use std::collections::BTreeMap;
+
+use bevy::core_pipeline::Skybox;
+use bevy::light::EnvironmentMapLight;
+use bevy::prelude::*;
+use raea_core_program::ir::V;
+use raea_sys_frame::*;
+
+use super::{EnvBake, EnvMaps};
+
+/// a camera whose EnvironmentMapLight or Skybox is its own prefiltered one, not an <Environment>'s
+#[derive(Component)]
+pub struct Prefiltered;
+
+/// the row's Quat `<name>_qx..qw` (Bevy's identity when it has none)
+fn quat(vals: &BTreeMap<String, V>, name: &str) -> Quat {
+ let q = Quat::from_xyzw(num(vals, &format!("{name}_qx"), 0.0), num(vals, &format!("{name}_qy"), 0.0), num(vals, &format!("{name}_qz"), 0.0), num(vals, &format!("{name}_qw"), 1.0));
+ if q.length_squared() > 0.0 { q } else { Quat::IDENTITY }
+}
+
+/// The light and the sky as the first frame has them: each file loaded once (the sky's image is the light's specular
+/// handle when it's the same file, as Bevy's asset server gives the one handle)
+pub fn prefiltered(world: &mut World, e: Entity, vals: &BTreeMap<String, V>) -> Result<(), String> {
+ let mut loaded: Vec<(String, Handle<Image>)> = Vec::new();
+ let mut load = |world: &mut World, what: &str, p: &str| -> Result<Handle<Image>, String> {
+ if let Some((_, h)) = loaded.iter().find(|(q, _)| q == p) {
+ return Ok(h.clone());
+ }
+ let h = image_file(world, what, p)?;
+ loaded.push((p.to_string(), h.clone()));
+ Ok(h)
+ };
+ if let (Some(V::S(d)), Some(V::S(s))) = (vals.get("envmap_diffuse_map"), vals.get("envmap_specular_map")) {
+ let (diffuse_map, specular_map) = (load(world, "EnvironmentMapLight", d)?, load(world, "EnvironmentMapLight", s)?);
+ world.entity_mut(e).insert((EnvironmentMapLight { diffuse_map, specular_map, intensity: num(vals, "envmap_k", 1.0), rotation: quat(vals, "envmap"), ..default() }, Prefiltered));
+ }
+ if let Some(V::S(img)) = vals.get("skybox_image") {
+ let image = if img.is_empty() { None } else { Some(load(world, "Skybox", img)?) };
+ world.entity_mut(e).insert((Skybox { image, brightness: num(vals, "skybox_k", 0.0), rotation: quat(vals, "skybox") }, Prefiltered));
+ }
+ Ok(())
+}
+
+/// Each frame's rotations and the sky's brightness
+pub fn sync_prefiltered(frame: Res<FrameRows>, mut q: Query<(Entity, Option<&mut EnvironmentMapLight>, Option<&mut Skybox>), (With<Prefiltered>, Without<EnvMaps>, Without<EnvBake>)>) {
+ for (e, light, sky) in &mut q {
+ let Some(v) = frame.vals(e) else { continue };
+ if let Some(mut l) = light.filter(|_| v.contains_key("envmap_qw")) {
+ let r = quat(&v, "envmap");
+ if l.rotation != r {
+ l.rotation = r;
+ }
+ }
+ if let Some(mut s) = sky.filter(|_| v.contains_key("skybox_qw")) {
+ let (r, k) = (quat(&v, "skybox"), num(&v, "skybox_k", 0.0));
+ if s.rotation != r || s.brightness != k {
+ s.rotation = r;
+ s.brightness = k;
+ }
+ }
+ }
+}
diff --git a/systems/footage/ml-tracks.feature b/systems/footage/ml-tracks.feature
index a1fc00cb..e6d6f097 100644
--- a/systems/footage/ml-tracks.feature
+++ b/systems/footage/ml-tracks.feature
@@ -1,6 +1,6 @@
Feature: On-device models: which licences ship, and the tracks they write
Restored 2026-10-24 from engine/html/docs/ml-tracks.feature (deleted with engine/html in f1b4a17e) because
- perception.feature, meaning.feature and the roadmap rely on its licence rule and its track contract. Its parts about
+ perception.feature, meaning.feature and goal.feature rely on its licence rule and its track contract. Its parts about
the old HTML engine (fx.js markup, the renderer's mask-image and feImage work, the 10-09 owners) are left out; git
history has them. The licence facts are as surveyed on 2026-10-09.
@@ -11,10 +11,10 @@ Feature: On-device models: which licences ship, and the tracks they write
Scenario: The bundled constructs
Given the constructs the apps ship
| Construct | Model | Weights licence | Size | Runtime |
- | Face landmarks + blendshapes | MediaPipe face landmarker | Apache-2.0 | 4.8 MB (detector 0.29 + landmarks 2.61 + blendshapes 1.86) | converted 2026-10-10: ~/the host app/models/mediapipe-face-landmarker (validated vs the .tflite: landmarks r 0.9999996). In the apps 2026-10-10: Perception.swift `face` track (weighted NMS, rotated crop, followed from the last frame's points); vs MediaPipe on reference/ 0.34–0.42% of face width (bar 0.6%); ~8 ms/frame on M4 |
- | Hair / part segmentation | MediaPipe hair (+ multiclass selfie later) | Apache-2.0 | 0.62 MB | converted 2026-10-10: ~/the host app/models/mediapipe-hair-segmenter (mask IoU 0.998–0.999 vs MediaPipe). In the apps 2026-10-10: Perception.swift `hair` track; reference/ masks reproduced to 0 levels, IoU 0.9977–0.9989 vs MediaPipe; ~26 ms/frame on M4 |
- | Depth | Depth Anything 3 Small (Base later) | Apache-2.0 | 50.8 MB fp16 | converted 2026-10-09: ~/the host app/models/depth-anything-3-small (r ≥ 0.999998) |
- | Tracked object masks | EdgeTAM | Apache-2.0 | 36.7 MB (image encoder 10.0, mask decoder 11.0, memory encoder 8.8 fp32, memory attention 6.9) | converted 2026-10-10 incl. the memory parts: ~/the host app/models/edgetam (Core ML-only tracking vs Meta's predictor: mean IoU 0.996 click / 0.995 box; ~86 ms/frame on M4). In the apps 2026-10-10: Perception.swift `object-<name>` track from a box or point at `at` s, forward only; vs the official predictor on reference/ mean IoU 0.992–0.993, min 0.98 (bar 0.99/0.97), judged at the video's size (half-size mattes cost ~1% on the small bird); ~150–280 ms/frame on a busy M4 |
+ | Face landmarks + blendshapes | MediaPipe face landmarker | Apache-2.0 | 4.8 MB (detector 0.29 + landmarks 2.61 + blendshapes 1.86) | converted 2026-10-10: the models folder: mediapipe-face-landmarker (validated vs the .tflite: landmarks r 0.9999996). In the apps 2026-10-10: Perception.swift `face` track (weighted NMS, rotated crop, followed from the last frame's points); vs MediaPipe on reference/ 0.34–0.42% of face width (bar 0.6%); ~8 ms/frame on M4 |
+ | Hair / part segmentation | MediaPipe hair (+ multiclass selfie later) | Apache-2.0 | 0.62 MB | converted 2026-10-10: the models folder: mediapipe-hair-segmenter (mask IoU 0.998–0.999 vs MediaPipe). In the apps 2026-10-10: Perception.swift `hair` track; reference/ masks reproduced to 0 levels, IoU 0.9977–0.9989 vs MediaPipe; ~26 ms/frame on M4 |
+ | Depth | Depth Anything 3 Small (Base later) | Apache-2.0 | 50.8 MB fp16 | converted 2026-10-09: the models folder: depth-anything-3-small (r ≥ 0.999998) |
+ | Tracked object masks | EdgeTAM | Apache-2.0 | 36.7 MB (image encoder 10.0, mask decoder 11.0, memory encoder 8.8 fp32, memory attention 6.9) | converted 2026-10-10 incl. the memory parts: the models folder: edgetam (Core ML-only tracking vs Meta's predictor: mean IoU 0.996 click / 0.995 box; ~86 ms/frame on M4). In the apps 2026-10-10: Perception.swift `object-<name>` track from a box or point at `at` s, forward only; vs the official predictor on reference/ mean IoU 0.992–0.993, min 0.98 (bar 0.99/0.97), judged at the video's size (half-size mattes cost ~1% on the small bird); ~150–280 ms/frame on a busy M4 |
| Person matte, pose, box tracking | Apple Vision | OS | 0 | Vision |
Then the apps bundle the first four models and use Apple Vision for the rest
@@ -61,7 +61,7 @@ Feature: On-device models: which licences ship, and the tracks they write
is `takes/<id>/video.mov`, so bare file names would collide): `tracks/takes-take-20261009-1100-video.mov/person/`,
`tracks/IMG_0412.mov/object-mug/`. Each folder holds `track.json` plus the data; `source` in it is the clip's
project path. Writers: Perception.track in the apps and `ugc-perceive track <video> <kind> <dir> <source>`
- (the host app-a2); the Agent asks for a track with the `footage` action "track".
+ (an earlier footage track); the Agent asks for a track with the `footage` action "track".
Frame sequences (mattes and depth) are PNG files rather than alpha video. No alpha codec works in Chrome, WebKit
and ffmpeg alike (VP9-alpha needs libvpx and doesn't play in WebKit; HEVC-alpha doesn't play in Chrome), but a
diff --git a/systems/footage/src/cuts.rs b/systems/footage/src/cuts.rs
index c52c265e..0144dbb5 100644
--- a/systems/footage/src/cuts.rs
+++ b/systems/footage/src/cuts.rs
@@ -1,4 +1,4 @@
-//! Visible cuts (docs/the roadmap A4): the signals the current detector reads from ffmpeg, computed in Rust from raea-media's
+//! Visible cuts (docs/goal.feature A4): the signals the current detector reads from ffmpeg, computed in Rust from raea-media's
//! NV12 frames, and the detector itself (engine/html/src/measure.rs › sensitive_shot_changes before f1b4a17e deleted it, fitted on Buddy's renders).
//!
//! The signals, per frame, at 480 pixels wide as the ffmpeg command scales them (`scale=480:-2`):
diff --git a/systems/footage/src/ingest/tracks.rs b/systems/footage/src/ingest/tracks.rs
index c885de94..13338e59 100644
--- a/systems/footage/src/ingest/tracks.rs
+++ b/systems/footage/src/ingest/tracks.rs
@@ -5,7 +5,7 @@ use super::*;
pub(crate) const CONFIRM_NOTE: &str = "a face is visible once seen twice in a row at confidence 0.8 or more, stays through gaps of up to 0.5 s, and goes after 0.5 s under 0.5; its box is the median of its last three sightings";
-/// Faces confirmed over time (the founder, 2026-10-15: "faces are confirmed with confidence"; raea-9f's proposal): each
+/// Faces confirmed over time (2026-10-15: "faces are confirmed with confidence"): each
/// sample's faces matched to the tracks by overlap or by centre distance and size (best first); per track, per sample, the raw
/// confidence (0 where unseen), `visible` with hysteresis (on at 0.8 or more, off after 0.5 s under 0.5, gaps up to
/// 0.5 s held) and a smoothed box (the median of the last three sightings, held through gaps). Rules that read faces
@@ -183,7 +183,7 @@ pub fn camera(path: &Path, shots: &[(f64, f64)], backend: &str, v: &dyn Vision)
Ok(out)
}
-/// The sound steps of ingest (docs/the roadmap Track H), for any file with sound: `vad` (Silero's speech spans, and the
+/// The sound steps of ingest (docs/goal.feature Track H), for any file with sound: `vad` (Silero's speech spans, and the
/// level of the talking and of the floor between it), `beats` (Beat This! on the whole sound), `stems` (HTDemucs:
/// each stem's level 20 times a second, and Beat This! on the music stem: drums, bass and other), and `denoise`
/// (DeepFilterNet3, only on speech whose floor between words is above -40 dB and flat like noise: it reshapes a clean
@@ -297,7 +297,7 @@ pub fn ingest_sound(path: &Path, dir: &Path, backend: &str, m: &mut Manifest) ->
Ok(())
}
-/// The person, the depth and what's in focus through a clip (docs/the roadmap G5's depth touches: text behind the head, a
+/// The person, the depth and what's in focus through a clip (docs/goal.feature G5's depth touches: text behind the head, a
/// focus blur), `fps` times a second on a grid of 96 rows (columns by the picture's shape): matte.bin, the person mask
/// (0-255), depth.bin, Depth Anything 3's inverse depth over the sample's largest (0-255, bigger = nearer), and
/// sharp.bin, the mean absolute Laplacian of the grey picture (640 px) in each cell (x4, at most 255), one grid per
@@ -347,7 +347,7 @@ pub fn matte_track(path: &Path, dir: &Path, backend: &str, v: &dyn Vision, fps:
std::fs::write(dir.join("matte.json"), serde_json::json!({"fps": fps, "w": gw, "h": gh, "frames": frames}).to_string()).map_err(|e| e.to_string())
}
-/// Where the eye goes through a clip (docs/the roadmap G1), `fps` times a second, as attention.json: {"fps", "frames":
+/// Where the eye goes through a clip (docs/goal.feature G1), `fps` times a second, as attention.json: {"fps", "frames":
/// [{"t", "centre": [x, y], "peak": [x, y], "focus"}]}: the saliency map's weighted centre and its peak (0..1 of the
/// picture, from the top left), and focus = 1 - the map's entropy over the largest it can be (1: one place, 0: spread);
/// "rival": the strongest place (the map's mass in a disc of 0.1) at least 0.25 of the picture away from the strongest
@@ -389,7 +389,7 @@ pub fn attention_track(path: &Path, dir: &Path, backend: &str, v: &dyn Vision, f
std::fs::write(dir.join("attention.json"), serde_json::json!({"fps": fps, "frames": frames}).to_string()).map_err(|e| e.to_string())
}
-/// The focal point's rival in a saliency map (docs/the roadmap G's catalogue): the map's mass above its median in a disc
+/// The focal point's rival in a saliency map (docs/goal.feature G's catalogue): the map's mass above its median in a disc
/// of 0.1 of the picture around each cell; the strongest disc 0.25 or more from the strongest, as (its place, its mass
/// over the strongest's). Vision's maps are smooth blobs, so a single cell's maximum says little: mass does.
pub fn rival(m: &[f32], mw: usize, mh: usize) -> Option<([f64; 2], f64)> {
@@ -420,7 +420,7 @@ pub fn rival(m: &[f32], mw: usize, mh: usize) -> Option<([f64; 2], f64)> {
Some((at(i), masses[i] / masses[top]))
}
-/// The light through a clip (docs/the roadmap G4), `fps` times a second, as light.json: {"fps", "frames": [{"t", "luma",
+/// The light through a clip (docs/goal.feature G4), `fps` times a second, as light.json: {"fps", "frames": [{"t", "luma",
/// "warmth", "light", "face_level", "backlit_stops", "key_fill_stops", "mixed"}]}: the frame's mean luma (0..1) and
/// warmth ((R - B) / (R + G + B)), and the framing coach's read of the light on the face (vision::coach) when there is one.
pub fn light_track(path: &Path, dir: &Path, backend: &str, v: &dyn Vision, fps: f64) -> Result<(), String> {
diff --git a/systems/frame/src/lib.rs b/systems/frame/src/lib.rs
index 21f29654..157f3456 100644
--- a/systems/frame/src/lib.rs
+++ b/systems/frame/src/lib.rs
@@ -38,7 +38,7 @@ pub struct Edit {
#[derive(Resource, Default)]
pub struct FrameRows {
pub cols: eval::Cols,
- pub ix: HashMap<Entity, usize>,
+ pub ix: bevy::ecs::entity::EntityHashMap<usize>,
/// a live scene's rows (Engine::set_rows): a game's 3D comes from its play's state each frame, not from a timeline,
/// so each row's latest values are kept here (in the store's order), changed in place where a frame changes them,
/// and lent to the systems as they are (no columns made, nothing copied per frame)
@@ -56,6 +56,12 @@ impl FrameRows {
self.live.is_none() && self.timeline.as_ref().zip(self.ix.get(&e)).is_some_and(|(t, r)| t.still(*r))
}
+ /// Whether any row may have column `c` this frame (a live scene's or a frame look's rows: always), so a system
+ /// looking for a rare column (a glitch's) passes over a frame without it at once, not row by row (FC1b)
+ pub fn may_have(&self, c: &str) -> bool {
+ self.live.is_some() || !self.looks.is_empty() || self.cols.cols.contains_key(c)
+ }
+
/// One of a row's values this frame, copying only it (with its frame look laid on, as `vals` has it).
pub fn get(&self, e: Entity, c: &str) -> Option<V> {
let r = *self.ix.get(&e)?;
@@ -200,6 +206,16 @@ pub fn colour(v: Option<&V>, d: [f32; 4]) -> Color {
Color::srgba(c[0], c[1], c[2], c[3])
}
+/// A picture file Bevy reads itself (a .ktx2 cubemap or lightmap, with its own format and mips) decoded into a new
+/// image (`what` names the part in the error): an environment map's, a skybox's or a lightmap's.
+pub fn image_file(world: &mut World, what: &str, p: &str) -> Result<Handle<Image>, String> {
+ let bytes = std::fs::read(p).map_err(|err| format!("{what}: {p}: {err}"))?;
+ let ext = Path::new(p).extension().and_then(|x| x.to_str()).unwrap_or("ktx2");
+ let img = Image::from_buffer(&bytes, bevy::image::ImageType::Extension(ext), bevy::image::CompressedImageFormats::NONE, false, bevy::image::ImageSampler::Default, bevy::asset::RenderAssetUsages::RENDER_WORLD)
+ .map_err(|err| format!("{what}: {p}: {err}"))?;
+ Ok(world.resource_mut::<Assets<Image>>().add(img))
+}
+
/// A clip's or audio row's source: `media:<sha256>` names a row of the media table (content-addressed footage, music
/// and voice; the row holds the file's path and size), anything else is a path. The size is checked on every
/// resolve (cheap); the hash was checked when the row was made (`raea media`).
diff --git a/systems/layout/src/layout/mod.rs b/systems/layout/src/layout/mod.rs
index 23478b82..5b44a47e 100644
--- a/systems/layout/src/layout/mod.rs
+++ b/systems/layout/src/layout/mod.rs
@@ -1,7 +1,7 @@
//! How a frame is laid out (Perception.swift › layout(from:)): people, captions, screens, panes and splits, in the
//! previz layout format (previz.rs, deleted with engine/html in f1b4a17e). The inputs are what Vision saw (faces, text lines, rectangles, the
//! person mask, whether it's a screenshot) and grey copies of the frame and the next frames (240 px wide); the Vision
-//! side moves behind a trait later (docs/the roadmap A3). The arithmetic follows the Swift's order, and its ties (Swift's
+//! side moves behind a trait later (docs/goal.feature A3). The arithmetic follows the Swift's order, and its ties (Swift's
//! `max(by:)` keeps the first maximum).
use serde::{Deserialize, Serialize};
diff --git a/systems/layout/src/motion.rs b/systems/layout/src/motion.rs
index d249c8ea..6b8bd2a1 100644
--- a/systems/layout/src/motion.rs
+++ b/systems/layout/src/motion.rs
@@ -1,4 +1,4 @@
-//! Motion read back into keys (docs/the roadmap J3): a tracked element's position over frames, split into moves, each fitted
+//! Motion read back into keys (docs/goal.feature J3): a tracked element's position over frames, split into moves, each fitted
//! with raea-render's own easing functions (engine/render/src/eval.rs ease_fn: linear, in, out, inout, all cubic): for every start and
//! end frame near the move and every ease, the start value and the distance that fit best (least squares; the frames
//! read are the only data, so a move can start before its element is first seen, as a fade-in does); of the fits
diff --git a/systems/light-meter/src/exposure.rs b/systems/light-meter/src/exposure.rs
new file mode 100644
index 00000000..c7fc20c6
--- /dev/null
+++ b/systems/light-meter/src/exposure.rs
@@ -0,0 +1,176 @@
+//! A rendered frame's exposure, as a reflected meter and a histogram read it: the mean of its display luma, the 1st and
+//! 99th percentiles, how much clips to white or crushes to black, and how many stops the frame's mean linear light is
+//! from mid grey (0.18). `raea render` prints it for every still and frame folder (the 11-06 research: agents loop on
+//! "too dark, add light" for want of a number; three-live and the scene reviewers report exactly these).
+//! Transparent pixels (an --alpha render's empty background) are left out.
+
+use serde_json::{Value, json};
+
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct Exposure {
+ /// mean display (sRGB-encoded) luma, 0-1
+ pub mean_luma: f64,
+ pub p01: f64,
+ pub p99: f64,
+ /// the share of pixels with a channel at 254 or more
+ pub clipped_high: f64,
+ /// the share with every channel at 1 or less
+ pub clipped_low: f64,
+ /// log2(mean linear luminance / 0.18): 0 is a frame metered to mid grey
+ pub over_stops: f64,
+ pub pixels: usize,
+}
+
+fn linear(c: u8) -> f64 {
+ let c = c as f64 / 255.0;
+ if c <= 0.04045 { c / 12.92 } else { ((c + 0.055) / 1.055).powf(2.4) }
+}
+
+/// The stats of RGBA8 pixels (straight alpha, sRGB).
+pub fn stats(rgba: &[u8]) -> Option<Exposure> {
+ let lin: Vec<f64> = (0..=255u8).map(linear).collect();
+ let mut hist = [0usize; 256];
+ let (mut n, mut sum_luma, mut sum_lin, mut hi, mut lo) = (0usize, 0.0, 0.0, 0usize, 0usize);
+ for p in rgba.chunks_exact(4) {
+ if p[3] == 0 {
+ continue;
+ }
+ n += 1;
+ let y = 0.2126 * lin[p[0] as usize] + 0.7152 * lin[p[1] as usize] + 0.0722 * lin[p[2] as usize];
+ sum_lin += y;
+ // display luma: the linear luminance encoded back (what a histogram shows)
+ let enc = if y <= 0.0031308 { 12.92 * y } else { 1.055 * y.powf(1.0 / 2.4) - 0.055 };
+ sum_luma += enc;
+ hist[(enc * 255.0).round().clamp(0.0, 255.0) as usize] += 1;
+ if p[0].max(p[1]).max(p[2]) >= 254 {
+ hi += 1;
+ }
+ if p[0].max(p[1]).max(p[2]) <= 1 {
+ lo += 1;
+ }
+ }
+ if n == 0 {
+ return None;
+ }
+ let pct = |q: f64| {
+ let want = (q * n as f64).ceil().max(1.0) as usize;
+ let mut acc = 0;
+ for (i, c) in hist.iter().enumerate() {
+ acc += c;
+ if acc >= want {
+ return i as f64 / 255.0;
+ }
+ }
+ 1.0
+ };
+ let mean_lin = (sum_lin / n as f64).max(1e-6);
+ Some(Exposure { mean_luma: sum_luma / n as f64, p01: pct(0.01), p99: pct(0.99), clipped_high: hi as f64 / n as f64, clipped_low: lo as f64 / n as f64, over_stops: (mean_lin / 0.18).log2(), pixels: n })
+}
+
+fn r(x: f64, k: i32) -> f64 {
+ let m = 10f64.powi(k);
+ (x * m).round() / m
+}
+
+impl Exposure {
+ pub fn json(&self) -> Value {
+ json!({"meanLuma": r(self.mean_luma, 3), "p01": r(self.p01, 3), "p99": r(self.p99, 3), "clippedHigh": r(self.clipped_high, 4), "clippedLow": r(self.clipped_low, 4), "overStops": r(self.over_stops, 2)})
+ }
+
+ /// What's wrong with it, in scene lint's levels: (level, says). Empty when nothing is.
+ pub fn found(&self, what: &str) -> Vec<(&'static str, String)> {
+ let mut out = Vec::new();
+ if self.clipped_high > 0.02 {
+ out.push(("warning", format!("{what}: {:.1}% of the pixels clip to white (lower the exposure or the brightest light, or tone map)", self.clipped_high * 100.0)));
+ }
+ if self.clipped_low > 0.05 {
+ out.push(("warning", format!("{what}: {:.1}% of the pixels crush to black (a fill, an ambient or the sky's light reaches them nowhere)", self.clipped_low * 100.0)));
+ }
+ if self.over_stops > 1.5 {
+ out.push(("warning", format!("{what}: {:+.1} stops over mid grey: the frame reads washed out unless it is meant high-key", self.over_stops)));
+ } else if self.over_stops < -2.5 {
+ out.push(("warning", format!("{what}: {:+.1} stops under mid grey: the frame reads dark unless it is meant low-key (`raea scene light` meters the subject)", self.over_stops)));
+ }
+ if self.p99 - self.p01 < 0.25 {
+ out.push(("note", format!("{what}: flat, the 1st to 99th percentile spans only {:.2} of the range (little contrast)", self.p99 - self.p01)));
+ }
+ out
+ }
+
+ /// One line for a render's message.
+ pub fn line(&self) -> String {
+ format!("mean luma {:.2}, p01 {:.2}, p99 {:.2}, {:.1}% clip white, {:.1}% crush black, {:+.1} stops from mid grey", self.mean_luma, self.p01, self.p99, self.clipped_high * 100.0, self.clipped_low * 100.0, self.over_stops)
+ }
+}
+
+/// The exposure of PNG files, each read and measured, and all of them pooled (as one frame of all their pixels):
+/// `{"frames": [{file, exposure}], "exposure": pooled, "found": [{check, level, says}]}`.
+pub fn of_pngs(files: &[std::path::PathBuf]) -> Result<(Exposure, Value), String> {
+ let mut per = Vec::new();
+ let mut pooled: Vec<u8> = Vec::new();
+ let mut found = Vec::new();
+ // pooling every frame of a long folder is a lot of pixels: every k-th, at most 24 frames
+ let k = files.len().div_ceil(24).max(1);
+ for f in files.iter().step_by(k) {
+ let img = image::open(f).map_err(|e| format!("{}: {e}", f.display()))?.to_rgba8();
+ let raw = img.as_raw();
+ let name = f.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();
+ if let Some(e) = stats(raw) {
+ per.push(json!({"file": name, "exposure": e.json()}));
+ if files.len() > 1 {
+ for (level, says) in e.found(&name) {
+ if level == "warning" {
+ found.push(json!({"check": "exposure", "level": level, "says": says}));
+ }
+ }
+ }
+ }
+ // a quarter of each frame's pixels into the pool (every 4th), so a folder is measured in bounded memory
+ pooled.extend(raw.chunks_exact(4).step_by(4).flatten());
+ }
+ let all = stats(&pooled).ok_or("exposure: every pixel is transparent")?;
+ if files.len() == 1 {
+ for (level, says) in all.found("the frame") {
+ found.push(json!({"check": "exposure", "level": level, "says": says}));
+ }
+ }
+ let sampled = if k > 1 { json!(per.len()) } else { Value::Null };
+ Ok((all, json!({"exposure": all.json(), "frames": per, "sampled": sampled, "found": found})))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn flat(v: u8, n: usize) -> Vec<u8> {
+ (0..n).flat_map(|_| [v, v, v, 255]).collect()
+ }
+
+ #[test]
+ fn mid_grey_is_zero_stops_and_white_clips() {
+ // sRGB 118 is linear 0.18
+ let e = stats(&flat(118, 100)).unwrap();
+ assert!(e.over_stops.abs() < 0.03, "{}", e.over_stops);
+ assert!((e.mean_luma - 118.0 / 255.0).abs() < 0.01);
+ assert!(e.found("f").iter().any(|(l, s)| *l == "note" && s.contains("flat")));
+ let w = stats(&flat(255, 100)).unwrap();
+ assert_eq!(w.clipped_high, 1.0);
+ assert!(w.over_stops > 2.4);
+ assert!(w.found("f").iter().any(|(_, s)| s.contains("clip to white")));
+ let b = stats(&flat(0, 100)).unwrap();
+ assert_eq!(b.clipped_low, 1.0);
+ assert!(b.found("f").iter().any(|(_, s)| s.contains("crush to black")));
+ }
+
+ #[test]
+ fn percentiles_and_transparency() {
+ // half black, half white: p01 black, p99 white; transparent pixels ignored
+ let mut px = flat(0, 50);
+ px.extend(flat(255, 50));
+ px.extend((0..100).flat_map(|_| [128u8, 128, 128, 0]));
+ let e = stats(&px).unwrap();
+ assert_eq!(e.pixels, 100);
+ assert_eq!((e.p01, e.p99), (0.0, 1.0));
+ assert!(stats(&[9, 9, 9, 0]).is_none());
+ }
+}
diff --git a/systems/light-meter/src/lib.rs b/systems/light-meter/src/lib.rs
index ace5ee18..c620868b 100644
--- a/systems/light-meter/src/lib.rs
+++ b/systems/light-meter/src/lib.rs
@@ -12,6 +12,8 @@
//! outer and inner angles; an AmbientLight of 1 is 400 cd/m², an <Environment> of 1 its panorama's values x 1000
//! cd/m², neither shadowed (the engine's ambient occlusion darkens them only in the picture).
+
+pub mod exposure;
use std::collections::HashMap;
use std::f32::consts::{PI, TAU};
use std::sync::{Arc, Mutex, OnceLock};
diff --git a/systems/material/Cargo.toml b/systems/material/Cargo.toml
index 850b5f3d..2c2ac75e 100644
--- a/systems/material/Cargo.toml
+++ b/systems/material/Cargo.toml
@@ -9,6 +9,10 @@ description = "Meshes and materials: a row's primitive or buffer mesh, a row's s
[features]
# SVG pictures drawn on the CPU (resvg)
native = ["dep:resvg"]
+# Bevy's clearcoat textures (StandardMaterial clearcoat_normal_texture, which rotate_environment_map uses). Off by
+# default: they add three samplers to every StandardMaterial, and an extension with a sampler of its own (<Material>,
+# froxel glass) then passes Metal's 16 a fragment stage (docs/control.feature FC0a)
+multi-layer = ["bevy/pbr_multi_layer_material_textures"]
[dependencies]
raea-sys-frame = { path = "../frame" }
diff --git a/systems/material/src/fields.rs b/systems/material/src/fields.rs
index 121eeb37..496e5ff9 100644
--- a/systems/material/src/fields.rs
+++ b/systems/material/src/fields.rs
@@ -76,27 +76,32 @@ pub fn apply(m: &mut StandardMaterial, vals: &BTreeMap<String, V>, who: &str) ->
}
}
("diffuseTransmission", _) => m.diffuse_transmission = n(v, k)?,
+ ("lightmapExposure", _) => m.lightmap_exposure = n(v, k)?,
_ => return Err(format!("{who}: fields has no {k} ({v})")),
}
}
Ok(())
}
-/// The fields `apply` sets, copied from the material made for a Model's surface onto its glTF material.
-pub fn copy(to: &mut StandardMaterial, from: &StandardMaterial) {
- to.specular_tint = from.specular_tint;
- to.anisotropy_strength = from.anisotropy_strength;
- to.anisotropy_rotation = from.anisotropy_rotation;
- to.attenuation_distance = from.attenuation_distance;
- to.attenuation_color = from.attenuation_color;
- to.parallax_depth_scale = from.parallax_depth_scale;
- to.max_parallax_layer_count = from.max_parallax_layer_count;
- to.parallax_mapping_method = from.parallax_mapping_method;
- to.depth_bias = from.depth_bias;
- to.fog_enabled = from.fog_enabled;
- to.uv_transform = from.uv_transform;
- to.opaque_render_method = from.opaque_render_method;
- to.diffuse_transmission = from.diffuse_transmission;
+/// The fields `apply` set, by the names given (`keys`), copied from the material made for a Model's surface onto its
+/// glTF material; the glTF's others stay its own (a surface giving lightmapExposure alone kept the file's KHR texture
+/// transform and specular tint).
+pub fn copy(to: &mut StandardMaterial, from: &StandardMaterial, keys: &[String]) {
+ for k in keys {
+ match k.as_str() {
+ "specularTint" => to.specular_tint = from.specular_tint,
+ "anisotropy" => (to.anisotropy_strength, to.anisotropy_rotation) = (from.anisotropy_strength, from.anisotropy_rotation),
+ "attenuation" => (to.attenuation_distance, to.attenuation_color) = (from.attenuation_distance, from.attenuation_color),
+ "parallax" => (to.parallax_depth_scale, to.max_parallax_layer_count, to.parallax_mapping_method) = (from.parallax_depth_scale, from.max_parallax_layer_count, from.parallax_mapping_method),
+ "depthBias" => to.depth_bias = from.depth_bias,
+ "fog" => to.fog_enabled = from.fog_enabled,
+ "uvTransform" => to.uv_transform = from.uv_transform,
+ "renderMethod" => to.opaque_render_method = from.opaque_render_method,
+ "diffuseTransmission" => to.diffuse_transmission = from.diffuse_transmission,
+ "lightmapExposure" => to.lightmap_exposure = from.lightmap_exposure,
+ _ => {}
+ }
+ }
}
#[cfg(test)]
@@ -118,4 +123,19 @@ mod tests {
vals.insert("fields".to_string(), V::S(r#"{"shine":1}"#.into()));
assert!(apply(&mut m, &vals, "m").is_err());
}
+
+ #[test]
+ fn a_model_surface_copies_only_the_fields_it_names() {
+ let mut vals = BTreeMap::new();
+ vals.insert("fields".to_string(), V::S(r#"{"lightmapExposure":250}"#.into()));
+ let mut made = StandardMaterial::default();
+ apply(&mut made, &vals, "m").unwrap();
+ assert_eq!(made.lightmap_exposure, 250.0);
+ // the glTF's own tint and texture transform stay
+ let mut gltf = StandardMaterial { specular_tint: Color::srgb(1.0, 0.0, 0.0), uv_transform: Affine2::from_scale(Vec2::splat(2.0)), ..default() };
+ copy(&mut gltf, &made, &["lightmapExposure".to_string()]);
+ assert_eq!(gltf.lightmap_exposure, 250.0);
+ assert_eq!(gltf.specular_tint, Color::srgb(1.0, 0.0, 0.0));
+ assert_eq!(gltf.uv_transform.matrix2.x_axis.x, 2.0);
+ }
}
diff --git a/systems/material/src/lib.rs b/systems/material/src/lib.rs
index 4ac3271b..1ec7a351 100644
--- a/systems/material/src/lib.rs
+++ b/systems/material/src/lib.rs
@@ -12,6 +12,7 @@ use raea_sys_frame::*;
pub mod decal;
pub mod fields;
+pub mod lightmap;
pub mod maps;
pub mod mesh;
pub mod surface;
diff --git a/systems/material/src/lightmap.rs b/systems/material/src/lightmap.rs
new file mode 100644
index 00000000..69b67adb
--- /dev/null
+++ b/systems/material/src/lightmap.rs
@@ -0,0 +1,55 @@
+//! Bevy's Lightmap on a model's meshes by their glTF mesh name (<Lightmap mesh image> in a <Model>): a light bake the
+//! mesh is lit by in place of the scene's lights, as Bevy's lightmaps example puts one on each mesh whose GltfMeshName
+//! it knows. The spec is one of the model row's `surfaces` (surface.rs): `lightmap` (the file, a .ktx2 Bevy reads
+//! itself), `mesh` (the glTF mesh's name, every primitive of it), `bicubic` (1 for bicubic sampling) and uv_x0, uv_y0,
+//! uv_x1, uv_y1 (the rect in the image its second UVs are relative to; the whole image by default).
+
+use super::*;
+use bevy::pbr::Lightmap;
+use raea_core_program::eval::Tup;
+use std::path::Path;
+
+/// A bake read from its spec, and the glTF mesh it lies on.
+#[derive(Clone)]
+pub struct Baked {
+ pub(crate) mesh: String,
+ pub(crate) made: Lightmap,
+}
+
+/// The spec's bake (None for a spec that isn't one), its file decoded now.
+pub fn of(world: &mut World, t: &Tup, vals: &BTreeMap<String, V>, inserted: &[Tup], dir: &Path) -> Result<Option<Baked>, String> {
+ let Some(V::S(src)) = vals.get("lightmap") else { return Ok(None) };
+ let Some(V::S(mesh)) = vals.get("mesh") else { return Err(format!("model {}: a Lightmap names the glTF mesh it lies on (mesh)", t.id)) };
+ let path = resolve_src(inserted, src, dir).map_err(|e| format!("model {}: Lightmap {mesh}: {e}", t.id))?;
+ let image = image_file(world, &format!("model {}: Lightmap {mesh}", t.id), &path.to_string_lossy())?;
+ let uv_rect = Rect::new(num(vals, "uv_x0", 0.0), num(vals, "uv_y0", 0.0), num(vals, "uv_x1", 1.0), num(vals, "uv_y1", 1.0));
+ Ok(Some(Baked { mesh: mesh.clone(), made: Lightmap { image, uv_rect, bicubic_sampling: num(vals, "bicubic", 0.0) > 0.5 } }))
+}
+
+/// Each mesh entity (with its glTF mesh's name) given the bake that names its mesh.
+pub fn apply(world: &mut World, meshes: &[(Entity, Option<String>)], baked: &[&Baked]) {
+ for (x, name) in meshes {
+ if let Some(b) = baked.iter().find(|b| name.as_deref() == Some(b.mesh.as_str())) {
+ world.entity_mut(*x).insert(b.made.clone());
+ }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_bake_lands_on_every_mesh_of_its_name_and_no_other() {
+ let mut world = World::new();
+ let made = Lightmap { image: Handle::default(), uv_rect: Rect::new(0.0, 0.0, 0.5, 1.0), bicubic_sampling: true };
+ let (a, b, c) = (world.spawn_empty().id(), world.spawn_empty().id(), world.spawn_empty().id());
+ let meshes = [(a, Some("cornell_box".to_string())), (b, Some("cornell_box".to_string())), (c, Some("Light".to_string()))];
+ apply(&mut world, &meshes, &[&Baked { mesh: "cornell_box".into(), made }]);
+ for x in [a, b] {
+ let l = world.get::<Lightmap>(x).expect("each primitive of the named mesh");
+ assert!(l.bicubic_sampling && l.uv_rect.max.x == 0.5);
+ }
+ assert!(world.get::<Lightmap>(c).is_none());
+ }
+}
diff --git a/systems/material/src/maps.rs b/systems/material/src/maps.rs
index 116ea1a4..7cb85f53 100644
--- a/systems/material/src/maps.rs
+++ b/systems/material/src/maps.rs
@@ -142,7 +142,16 @@ pub fn cached_map(world: &mut World, key: String, kind: MapKind, repeat: bool, s
/// Whether a mesh row has any texture map (it then needs texture coordinates; a normal map needs tangents too).
pub fn has_maps(vals: &BTreeMap<String, V>) -> bool {
- ["map", "normal_map", "rough_map", "metal_map", "mr_map", "ao_map", "emissive_map"].iter().any(|k| vals.get(*k).is_some_and(V::truthy))
+ any_map(vals, &["map", "normal_map", "rough_map", "metal_map", "mr_map", "ao_map", "emissive_map", "clearcoat_normal_map"])
+}
+
+/// Whether a mesh row has a normal map, its own or its clearcoat's: its mesh then needs tangents.
+pub fn needs_tangents(vals: &BTreeMap<String, V>) -> bool {
+ any_map(vals, &["normal_map", "clearcoat_normal_map"])
+}
+
+fn any_map(vals: &BTreeMap<String, V>, keys: &[&str]) -> bool {
+ keys.iter().any(|k| vals.get(*k).is_some_and(V::truthy))
}
/// A mesh row's surface: the standard material from its columns.
@@ -192,6 +201,16 @@ pub fn material(world: &mut World, t: &Tup, inserted: &[Tup], dir: &Path) -> Res
if let Some(s) = src("normal_map") {
m.normal_map_texture = Some(cached_map(world, s.clone(), MapKind::Data, repeat, sam("normalMap"), || map_picture(t, inserted, dir, "normalMap", &s))?);
}
+ // the clearcoat layer's own normals, data not colour (rotate_environment_map loads it with is_srgb false); Bevy
+ // binds them only with its multi-layer textures (this crate's `multi-layer` feature)
+ if let Some(s) = src("clearcoat_normal_map") {
+ #[cfg(feature = "multi-layer")]
+ {
+ m.clearcoat_normal_texture = Some(cached_map(world, s.clone(), MapKind::Data, repeat, sam("clearcoatNormalMap"), || map_picture(t, inserted, dir, "clearcoatNormalMap", &s))?);
+ }
+ #[cfg(not(feature = "multi-layer"))]
+ return Err(format!("{}: clearcoat_normal_texture {s}: this raea is built without Bevy's clearcoat textures (raea-sys-material's multi-layer feature, off by default: docs/control.feature FC0a)", t.id));
+ }
if let Some(s) = src("mr_map") {
m.metallic_roughness_texture = Some(cached_map(world, s.clone(), MapKind::Data, repeat, sam("metallicRoughnessMap"), || map_picture(t, inserted, dir, "metallicRoughnessMap", &s))?);
} else if src("rough_map").is_some() || src("metal_map").is_some() {
diff --git a/systems/material/src/mesh.rs b/systems/material/src/mesh.rs
index bf499f74..f67291b2 100644
--- a/systems/material/src/mesh.rs
+++ b/systems/material/src/mesh.rs
@@ -200,7 +200,9 @@ pub fn shape_mesh(id: &str, expr: &str, uvs: bool, tangents: bool) -> Result<Mes
let ball = raea_core_shape::sphere_of(expr).map(|s| match s {
raea_core_shape::SphereOf::Ico { radius, subdivisions } => Sphere::new(radius).mesh().ico(subdivisions).map_err(|e| format!("mesh {id}: {e}")),
raea_core_shape::SphereOf::Uv { radius, sectors, stacks } => Ok(Sphere::new(radius).mesh().uv(sectors, stacks)),
- }).or_else(|| raea_core_shape::cuboid_of(expr).map(|[w, h, d]| Ok(Mesh::from(Cuboid::new(w, h, d)))));
+ }).or_else(|| raea_core_shape::cuboid_of(expr).map(|[w, h, d]| Ok(Mesh::from(Cuboid::new(w, h, d)))))
+ // a plane alone: Bevy's one face, facing its normal (a box of no depth has two)
+ .or_else(|| raea_core_shape::plane_of(expr).map(|(n, [w, h])| Ok(Mesh::from(Plane3d::new(Vec3::from(n), Vec2::new(w / 2.0, h / 2.0))))));
if let Some(mut m) = ball.transpose()? {
if tangents {
m.generate_tangents().map_err(|e| format!("mesh {id}: normalMap: its tangents: {e}"))?;
diff --git a/systems/material/src/surface.rs b/systems/material/src/surface.rs
index 47fde899..5cc8da93 100644
--- a/systems/material/src/surface.rs
+++ b/systems/material/src/surface.rs
@@ -17,6 +17,10 @@ pub struct Surface {
/// the spec's columns made into a material (its textures loaded); only the parts the spec gives are used
made: StandardMaterial,
given: Vec<String>,
+ /// the further fields it gives (fields.rs), by name
+ fields: Vec<String>,
+ /// a <Lightmap>'s bake instead of a material (lightmap.rs)
+ baked: Option<super::lightmap::Baked>,
}
/// The row's `surfaces` column, each made into a material now (its pictures read as a mesh's are).
@@ -33,16 +37,26 @@ pub fn of(world: &mut World, t: &Tup, inserted: &[Tup], dir: &Path) -> Result<Ve
_ => None,
};
}
+ let material = spec.get("material").and_then(serde_json::Value::as_str).map(str::to_string);
+ if let Some(b) = super::lightmap::of(world, t, &vals, inserted, dir)? {
+ out.push(Surface { material, made: StandardMaterial::default(), given: Vec::new(), fields: Vec::new(), baked: Some(b) });
+ continue;
+ }
let given: Vec<String> = vals.keys().cloned().collect();
+ let fields = match vals.get("fields") {
+ Some(V::S(f)) => serde_json::from_str::<serde_json::Map<String, serde_json::Value>>(f).map(|o| o.keys().cloned().collect()).unwrap_or_default(),
+ _ => Vec::new(),
+ };
let made = maps::material(world, &Tup { kind: "mesh".into(), id: t.id.clone(), vals }, inserted, dir)?;
- out.push(Surface { material: spec.get("material").and_then(serde_json::Value::as_str).map(str::to_string), made, given });
+ out.push(Surface { material, made, given, fields, baked: None });
}
Ok(out)
}
-/// The spec for a glTF material by name: the one naming it, else the one naming none.
+/// The spec for a glTF material by name: the one naming it, else the one naming none (bakes aren't materials).
fn spec_for<'a>(specs: &'a [Surface], name: Option<&str>) -> Option<(usize, &'a Surface)> {
- specs.iter().enumerate().find(|(_, s)| s.material.is_some() && s.material.as_deref() == name).or_else(|| specs.iter().enumerate().find(|(_, s)| s.material.is_none()))
+ let mut mats = specs.iter().enumerate().filter(|(_, s)| s.baked.is_none());
+ mats.clone().find(|(_, s)| s.material.is_some() && s.material.as_deref() == name).or_else(|| mats.find(|(_, s)| s.material.is_none()))
}
/// A glTF material with what a spec gives laid over it.
@@ -99,7 +113,7 @@ fn over(base: &StandardMaterial, s: &Surface) -> StandardMaterial {
m.depth_map = s.made.depth_map.clone();
}
if has("fields") {
- super::fields::copy(&mut m, &s.made);
+ super::fields::copy(&mut m, &s.made, &s.fields);
}
for (k, f) in [("clearcoat", 0), ("clearcoat_rough", 1), ("reflectance", 2)] {
if has(k) {
@@ -130,6 +144,11 @@ pub fn apply_to_model(world: &mut World, root: Entity, specs: &[Surface]) -> boo
if found.is_empty() {
return false;
}
+ let baked: Vec<&super::lightmap::Baked> = specs.iter().filter_map(|s| s.baked.as_ref()).collect();
+ if !baked.is_empty() {
+ let meshes: Vec<(Entity, Option<String>)> = found.iter().map(|(x, ..)| (*x, world.get::<bevy::gltf::GltfMeshName>(*x).map(|n| n.0.clone()))).collect();
+ super::lightmap::apply(world, &meshes, &baked);
+ }
let mut made: HashMap<(AssetId<StandardMaterial>, usize), Handle<StandardMaterial>> = HashMap::new();
for (x, mat, name) in found {
let Some((k, spec)) = spec_for(specs, name.as_deref()) else { continue };
@@ -146,3 +165,23 @@ pub fn apply_to_model(world: &mut World, root: Entity, specs: &[Surface]) -> boo
}
true
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use bevy::pbr::Lightmap;
+
+ fn spec(material: Option<&str>, baked: bool) -> Surface {
+ let made = Lightmap { image: Handle::default(), uv_rect: Rect::new(0.0, 0.0, 1.0, 1.0), bicubic_sampling: false };
+ Surface { material: material.map(str::to_string), made: StandardMaterial::default(), given: Vec::new(), fields: Vec::new(), baked: baked.then(|| super::super::lightmap::Baked { mesh: "box".into(), made }) }
+ }
+
+ #[test]
+ fn a_bake_is_never_the_material_a_glb_material_takes() {
+ // a <Lightmap> names no material: it isn't the fallback for every material either
+ let specs = [spec(None, true), spec(Some("red"), false), spec(None, false)];
+ assert_eq!(spec_for(&specs, Some("red")).map(|(k, _)| k), Some(1));
+ assert_eq!(spec_for(&specs, Some("green")).map(|(k, _)| k), Some(2));
+ assert!(spec_for(&specs[..1], Some("green")).is_none());
+ }
+}
diff --git a/systems/meshseq/src/lib.rs b/systems/meshseq/src/lib.rs
index 509531c8..08d2a315 100644
--- a/systems/meshseq/src/lib.rs
+++ b/systems/meshseq/src/lib.rs
@@ -300,6 +300,11 @@ fn sync_glitches(
binds: Res<Assets<bevy::mesh::skinning::SkinnedMeshInverseBindposes>>,
joints: Query<&GlobalTransform, Without<Mesh3d>>,
) {
+ // a frame with no glitch column anywhere (most) is passed over whole: 10 000 cubes asked each row for each column,
+ // a third of many_cubes' update (FC1b)
+ if !GLITCH_COLS.iter().any(|k| frame.may_have(k)) {
+ return;
+ }
for (e, root_gt) in &rows {
// a row with no glitch column is passed over without making its values (10 000 cubes made them every frame)
if !GLITCH_COLS.iter().any(|k| frame.get(e, k).is_some()) {
diff --git a/systems/parity/src/lib.rs b/systems/parity/src/lib.rs
index a89fe494..2b1836c9 100644
--- a/systems/parity/src/lib.rs
+++ b/systems/parity/src/lib.rs
@@ -116,7 +116,14 @@ fn no_input(
scroll: Option<ResMut<bevy::input::mouse::AccumulatedMouseScroll>>,
buttons: Option<ResMut<ButtonInput<MouseButton>>>,
keys: Option<ResMut<ButtonInput<KeyCode>>>,
+ mut windows: Query<&mut Window>,
) {
+ // and no cursor in the window: the Mac's pointer resting over it turned rotate_to_cursor's ship (11-07)
+ for mut w in &mut windows {
+ if w.cursor_position().is_some() {
+ w.set_cursor_position(None);
+ }
+ }
if let Some(mut m) = motion {
*m = default();
}
@@ -217,6 +224,14 @@ fn world_file(out: &str) -> PathBuf {
fn dump(world: &mut World) {
let Some(p) = world.get_resource::<Probe>() else { return };
let f = p.frame.saturating_sub(1);
+ // which entities there are, by archetype (RAEA_PARITY_ARCHETYPES=1, at the probed frames): what a growing entity
+ // count is made of (mesh_ray_cast's grew by one a frame per moving gizmo)
+ if std::env::var_os("RAEA_PARITY_ARCHETYPES").is_some() && p.frames.as_ref().is_none_or(|s| s.contains(&f)) {
+ for a in world.archetypes().iter().filter(|a| a.len() > 20) {
+ let names: Vec<String> = a.components().iter().filter_map(|c| world.components().get_name(*c)).map(|n| n.shortname().to_string()).collect();
+ eprintln!("archetypes frame {f}: {} x [{}]", a.len(), names.join(", "));
+ }
+ }
if p.types.is_empty() || p.frames.as_ref().is_some_and(|s| !s.contains(&f)) {
return;
}
diff --git a/systems/perceive/src/flow_portable.rs b/systems/perceive/src/flow_portable.rs
index e342c89e..936b54f3 100644
--- a/systems/perceive/src/flow_portable.rs
+++ b/systems/perceive/src/flow_portable.rs
@@ -1,5 +1,5 @@
//! Optical flow without Apple Vision: pyramidal Lucas-Kanade on a grid of points (plain Rust, no model), reduced per
-//! frame pair exactly as flow.rs reduces Vision's dense flow (docs/the roadmap Track L, the FLOW slot): the 3x3 grid's
+//! frame pair exactly as flow.rs reduces Vision's dense flow (docs/goal.feature Track L, the FLOW slot): the 3x3 grid's
//! mean magnitude, dx dy, zoom and mag, each as a share of the frame's width.
#[derive(Clone, Debug, Default)]
diff --git a/systems/procmat/Cargo.toml b/systems/procmat/Cargo.toml
new file mode 100644
index 00000000..5f1bdbdd
--- /dev/null
+++ b/systems/procmat/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+name = "raea-sys-procmat"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "Procedural surfaces: the standard material with wood, marble, stone, brick, tiles, fabric, brushed metal or plaster made on the GPU, bumped, with dust, dirt and worn edges over it"
+
+[dependencies]
+bevy = { version = "=0.20.0", default-features = false, features = ["std", "bevy_pbr"] }
+# a mesh row's values
+raea-core-program = { path = "../../core/program" }
+# a row's numbers, read as every system reads them
+raea-sys-frame = { path = "../frame" }
+# a material's `procedural` prop, as the SDK sends it
+serde_json = "1"
diff --git a/systems/procmat/src/lib.rs b/systems/procmat/src/lib.rs
new file mode 100644
index 00000000..bd86c9ef
--- /dev/null
+++ b/systems/procmat/src/lib.rs
@@ -0,0 +1,159 @@
+//! Procedural surfaces: the standard material with a pattern made on the GPU and use written over it (the 11-06 research:
+//! hayashimon's one grime group over every surface is the biggest realism step that needs no geometry, and a flat
+//! default colour is what gives a scene away). Patterns: noise, wood, marble, stone, brick, tiles, fabric, brushed and
+//! plaster, in two colours with a roughness each, a gap colour for brick and tile joints, and a bump from the
+//! pattern's height. Use: `dust` on what faces up, `dirt` in gaps, hollows, undersides and along the floor line,
+//! `edges` worn lighter. The pattern is taken in the mesh's own space, so it rides with a moving part.
+//!
+//! A mesh row's columns (from a material's `procedural` prop, `columns`): proc (the pattern's name), proc_a, proc_b,
+//! proc_gap_color, proc_dust_color, proc_dirt_color (hex), proc_scale (metres a feature, 0.25), proc_rough_a/b (0.6,
+//! 0.8), proc_bump (0.5), proc_seed, proc_tile_x/y (a brick or tile's size, 0.215 x 0.065 for brick, 0.3 x 0.3 for
+//! tiles), proc_gap (the joint's width, 0.01), proc_dust, proc_dirt, proc_edges (0..1, 0).
+
+use bevy::pbr::{ExtendedMaterial, MaterialExtension};
+use bevy::prelude::*;
+use bevy::render::render_resource::{AsBindGroup, ShaderType};
+use bevy::shader::ShaderRef;
+use raea_core_program::ir::V;
+use raea_sys_frame::num;
+use serde_json::{Map, Value};
+use std::collections::BTreeMap;
+
+pub type ProcMaterial = ExtendedMaterial<StandardMaterial, Procedural>;
+
+pub const PATTERNS: [&str; 9] = ["noise", "wood", "marble", "stone", "brick", "tiles", "fabric", "brushed", "plaster"];
+
+pub fn install(app: &mut App) {
+ bevy::asset::embedded_asset!(app, "procmat.wesl");
+ app.add_plugins(MaterialPlugin::<ProcMaterial>::default());
+}
+
+#[derive(Asset, TypePath, AsBindGroup, Clone, Debug)]
+pub struct Procedural {
+ #[uniform(100)]
+ p: ProcParams,
+}
+
+#[derive(ShaderType, Clone, Copy, Default, PartialEq, Debug)]
+pub struct ProcParams {
+ pub a: Vec4,
+ pub b: Vec4,
+ pub gap_color: Vec4,
+ pub dust_color: Vec4,
+ pub dirt_color: Vec4,
+ /// kind, scale, rough_a, rough_b
+ pub k: Vec4,
+ /// bump, seed, tile_x, tile_y
+ pub t: Vec4,
+ /// gap, dust, dirt, edges
+ pub w: Vec4,
+}
+
+impl MaterialExtension for Procedural {
+ fn fragment_shader() -> ShaderRef {
+ "embedded://raea_sys_procmat/procmat.wesl".into()
+ }
+}
+
+const NUMS: [(&str, &str); 9] = [("scale", "proc_scale"), ("bump", "proc_bump"), ("seed", "proc_seed"), ("gap", "proc_gap"), ("dust", "proc_dust"), ("dirt", "proc_dirt"), ("edges", "proc_edges"), ("roughA", "proc_rough_a"), ("roughB", "proc_rough_b")];
+const COLOURS: [(&str, &str); 3] = [("gapColor", "proc_gap_color"), ("dustColor", "proc_dust_color"), ("dirtColor", "proc_dirt_color")];
+
+/// A material's `procedural` prop as its row's columns (the first frame's)
+pub fn columns(row: &mut BTreeMap<String, V>, props: &Map<String, Value>) {
+ let Some(w) = props.get("procedural").and_then(Value::as_object) else { return };
+ let Some(pattern) = w.get("pattern").and_then(Value::as_str) else { return };
+ row.insert("proc".into(), V::S(pattern.into()));
+ for (k, col) in NUMS {
+ if let Some(n) = w.get(k).and_then(Value::as_f64) {
+ row.insert(col.into(), V::N(n));
+ }
+ }
+ for (k, col) in COLOURS {
+ if let Some(s) = w.get(k).and_then(Value::as_str) {
+ row.insert(col.into(), V::S(s.into()));
+ }
+ }
+ if let Some(cs) = w.get("colors").and_then(Value::as_array) {
+ for (i, col) in ["proc_a", "proc_b"].iter().enumerate() {
+ if let Some(s) = cs.get(i).and_then(Value::as_str) {
+ row.insert((*col).into(), V::S(s.into()));
+ }
+ }
+ }
+ if let Some(t) = w.get("tile").and_then(Value::as_array) {
+ for (i, col) in ["proc_tile_x", "proc_tile_y"].iter().enumerate() {
+ if let Some(n) = t.get(i).and_then(Value::as_f64) {
+ row.insert((*col).into(), V::N(n));
+ }
+ }
+ }
+}
+
+/// Each pattern's own colours, roughness, scale and tile when the prop doesn't give them: (a, b, gap, rough a, rough b, scale, tile)
+fn defaults(kind: usize) -> ([f32; 3], [f32; 3], [f32; 3], f32, f32, f32, [f32; 2]) {
+ match PATTERNS[kind] {
+ "wood" => ([0.55, 0.36, 0.21], [0.36, 0.22, 0.12], [0.1, 0.07, 0.05], 0.55, 0.7, 0.25, [0.3, 0.3]),
+ "marble" => ([0.92, 0.91, 0.89], [0.45, 0.45, 0.47], [0.3, 0.3, 0.3], 0.18, 0.25, 0.4, [0.3, 0.3]),
+ "stone" => ([0.62, 0.61, 0.58], [0.45, 0.44, 0.42], [0.3, 0.3, 0.3], 0.85, 0.95, 0.3, [0.3, 0.3]),
+ "brick" => ([0.6, 0.27, 0.18], [0.42, 0.18, 0.12], [0.62, 0.6, 0.55], 0.85, 0.95, 0.2, [0.215, 0.065]),
+ "tiles" => ([0.9, 0.9, 0.88], [0.82, 0.83, 0.8], [0.55, 0.54, 0.5], 0.2, 0.3, 0.2, [0.3, 0.3]),
+ "fabric" => ([0.35, 0.38, 0.45], [0.25, 0.28, 0.34], [0.2, 0.2, 0.2], 0.9, 0.95, 0.004, [0.3, 0.3]),
+ "brushed" => ([0.72, 0.72, 0.74], [0.6, 0.6, 0.62], [0.3, 0.3, 0.3], 0.3, 0.45, 0.05, [0.3, 0.3]),
+ "plaster" => ([0.88, 0.86, 0.82], [0.8, 0.78, 0.74], [0.5, 0.5, 0.5], 0.85, 0.95, 0.4, [0.3, 0.3]),
+ _ => ([0.6, 0.6, 0.6], [0.4, 0.4, 0.4], [0.3, 0.3, 0.3], 0.6, 0.8, 0.25, [0.3, 0.3]),
+ }
+}
+
+/// The procedural surface a mesh row asks for, or None (no `proc` column, or a pattern this doesn't know)
+pub fn of(vals: &BTreeMap<String, V>) -> Option<Procedural> {
+ let Some(V::S(name)) = vals.get("proc") else { return None };
+ let kind = PATTERNS.iter().position(|p| *p == name.as_str())?;
+ let (a, b, gap, ra, rb, scale, tile) = defaults(kind);
+ let rgb = |col: &str, d: [f32; 3]| {
+ let c = match vals.get(col) {
+ Some(V::S(s)) => Srgba::hex(s.trim()).unwrap_or(Srgba::rgb(d[0], d[1], d[2])),
+ _ => Srgba::rgb(d[0], d[1], d[2]),
+ };
+ let l = LinearRgba::from(c);
+ Vec4::new(l.red, l.green, l.blue, 1.0)
+ };
+ let share = |col: &str, d: f32| num(vals, col, d).clamp(0.0, 1.0);
+ // a positive number, else the pattern's own
+ let pos = |col: &str, d: f32| Some(num(vals, col, d)).filter(|s| *s > 0.0).unwrap_or(d);
+ Some(Procedural {
+ p: ProcParams {
+ a: rgb("proc_a", a),
+ b: rgb("proc_b", b),
+ gap_color: rgb("proc_gap_color", gap),
+ dust_color: rgb("proc_dust_color", [0.62, 0.6, 0.55]),
+ dirt_color: rgb("proc_dirt_color", [0.2, 0.17, 0.13]),
+ k: Vec4::new(kind as f32, pos("proc_scale", scale), share("proc_rough_a", ra), share("proc_rough_b", rb)),
+ t: Vec4::new(num(vals, "proc_bump", 0.5).max(0.0), num(vals, "proc_seed", 0.0), pos("proc_tile_x", tile[0]), pos("proc_tile_y", tile[1])),
+ w: Vec4::new(Some(num(vals, "proc_gap", 0.01)).filter(|s| *s >= 0.0).unwrap_or(0.01), share("proc_dust", 0.0), share("proc_dirt", 0.0), share("proc_edges", 0.0)),
+ },
+ })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_prop_becomes_columns_and_the_columns_a_surface() {
+ let props: Map<String, Value> = serde_json::from_value(serde_json::json!({"procedural": {"pattern": "brick", "colors": ["#884433", "#663322"], "tile": [0.25, 0.08], "dust": 0.4, "gapColor": "#aaaaaa"}})).unwrap();
+ let mut row = BTreeMap::new();
+ columns(&mut row, &props);
+ assert_eq!(row.get("proc"), Some(&V::S("brick".into())));
+ assert_eq!(row.get("proc_tile_y"), Some(&V::N(0.08)));
+ let p = of(&row).unwrap().p;
+ assert_eq!(p.k.x, 4.0);
+ assert_eq!((p.t.z, p.t.w), (0.25, 0.08));
+ assert!((p.w.y - 0.4).abs() < 1e-6);
+ // a pattern it doesn't know draws a plain surface
+ row.insert("proc".into(), V::S("plaid".into()));
+ assert!(of(&row).is_none());
+ // each pattern has its own look by default
+ let wood = of(&BTreeMap::from([("proc".to_string(), V::S("wood".into()))])).unwrap().p;
+ assert!(wood.a.x > wood.a.z, "wood is warm");
+ }
+}
diff --git a/systems/procmat/src/procmat.wesl b/systems/procmat/src/procmat.wesl
new file mode 100644
index 00000000..9f21b8d3
--- /dev/null
+++ b/systems/procmat/src/procmat.wesl
@@ -0,0 +1,199 @@
+// lib.rs: a pattern over the standard material (Bevy's extended-material fragment, its lighting kept). The pattern is
+// taken in the mesh's own space (it rides with the part), on the face's dominant plane for the flat ones (brick, tiles,
+// fabric, brushed); its height bumps the normal (surface gradient, screen space); then use: dust on what faces up, dirt
+// in the gaps, hollows and the floor line, edges worn lighter.
+import bevy_pbr::render::pbr_fragment::pbr_input_from_standard_material;
+import bevy_pbr::render::pbr_functions::alpha_discard;
+import bevy_pbr::render::mesh_functions::get_local_from_world;
+@if(PREPASS_PIPELINE) import bevy_pbr::prepass::io::{VertexOutput, FragmentOutput};
+@if(PREPASS_PIPELINE) import bevy_pbr::deferred::functions::deferred_output;
+@if(!PREPASS_PIPELINE) import bevy_pbr::render::forward_io::{VertexOutput, FragmentOutput};
+@if(!PREPASS_PIPELINE) import bevy_pbr::render::pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing};
+
+struct Proc {
+ a: vec4<f32>,
+ b: vec4<f32>,
+ gap_color: vec4<f32>,
+ dust_color: vec4<f32>,
+ dirt_color: vec4<f32>,
+ // kind, scale, rough_a, rough_b
+ k: vec4<f32>,
+ // bump, seed, tile_x, tile_y
+ t: vec4<f32>,
+ // gap, dust, dirt, edges
+ w: vec4<f32>,
+}
+
+@group(constants::MATERIAL_BIND_GROUP) @binding(100)
+var<uniform> pm: Proc;
+
+fn hash(p: vec3<f32>) -> f32 {
+ let q = fract(p * 0.3183099 + vec3(0.1, 0.2, 0.3));
+ let r = q * 17.0;
+ return fract(r.x * r.y * r.z * (r.x + r.y + r.z));
+}
+
+fn vnoise(p: vec3<f32>) -> f32 {
+ let i = floor(p);
+ let f = fract(p);
+ let u = f * f * (3.0 - 2.0 * f);
+ let a = mix(mix(hash(i), hash(i + vec3(1.0, 0.0, 0.0)), u.x), mix(hash(i + vec3(0.0, 1.0, 0.0)), hash(i + vec3(1.0, 1.0, 0.0)), u.x), u.y);
+ let b = mix(mix(hash(i + vec3(0.0, 0.0, 1.0)), hash(i + vec3(1.0, 0.0, 1.0)), u.x), mix(hash(i + vec3(0.0, 1.0, 1.0)), hash(i + vec3(1.0, 1.0, 1.0)), u.x), u.y);
+ return mix(a, b, u.z);
+}
+
+fn fbm(p: vec3<f32>) -> f32 {
+ var s = 0.0;
+ var w = 0.5;
+ var q = p;
+ for (var k = 0; k < 5; k++) {
+ s += w * vnoise(q);
+ q = q * 2.03 + vec3(1.7, 9.2, 3.1);
+ w *= 0.5;
+ }
+ return s / 0.96875;
+}
+
+// the face's own plane: the two axes across the dominant normal (a wall's x-y, a floor's x-z)
+fn plane(p: vec3<f32>, n: vec3<f32>) -> vec2<f32> {
+ let a = abs(n);
+ if (a.y >= a.x && a.y >= a.z) { return p.xz; }
+ if (a.x >= a.z) { return vec2(p.z, p.y); }
+ return p.xy;
+}
+
+// (mix between a and b, gap mask, height 0..1)
+fn pattern(p: vec3<f32>, n: vec3<f32>) -> vec3<f32> {
+ let kind = i32(pm.k.x + 0.5);
+ let q = p / max(pm.k.y, 1e-4) + vec3(pm.t.y * 17.3);
+ let uv = plane(p, n);
+ // wood: rings round the local y axis, wandering, and fine grain along it
+ if (kind == 1) {
+ let r = length(q.xz + vec2(fbm(q * 0.4), fbm(q * 0.4 + 7.0)) * 0.6) * 4.0;
+ let ring = smoothstep(0.0, 0.6, fract(r)) * (1.0 - smoothstep(0.75, 1.0, fract(r)));
+ let grain = vnoise(vec3(q.x * 30.0, q.y * 1.5, q.z * 30.0));
+ let m = clamp(ring * 0.75 + grain * 0.35, 0.0, 1.0);
+ return vec3(m, 0.0, 0.3 * ring + 0.2 * grain);
+ }
+ // marble: sharp veins through soft clouding
+ if (kind == 2) {
+ let v = pow(1.0 - abs(sin(q.x * 2.0 + q.y * 0.7 + fbm(q * 0.8) * 7.0)), 10.0);
+ let cloud = fbm(q * 0.5) * 0.3;
+ return vec3(clamp(v + cloud, 0.0, 1.0), 0.0, 0.05 * v);
+ }
+ // stone / concrete: mottled, pitted, speckled
+ if (kind == 3) {
+ let m = fbm(q);
+ let pits = smoothstep(0.78, 0.84, vnoise(q * 9.0));
+ let speck = step(0.93, hash(floor(q * 30.0)));
+ return vec3(clamp(m * 0.8 + speck * 0.4, 0.0, 1.0), pits, m * 0.6 - pits * 0.5);
+ }
+ // brick (running bond) and tiles: cells on the face's plane with gaps between, each cell its own shade
+ if (kind == 4 || kind == 5) {
+ let size = vec2(max(pm.t.z, 1e-3), max(pm.t.w, 1e-3));
+ var c = uv / size;
+ let row = floor(c.y);
+ if (kind == 4) { c.x += 0.5 * (row - 2.0 * floor(row / 2.0)); }
+ let id = floor(c);
+ let f = fract(c);
+ let g = vec2(pm.w.x) / size;
+ let edge = min(min(f.x, 1.0 - f.x) / max(g.x, 1e-4), min(f.y, 1.0 - f.y) / max(g.y, 1e-4));
+ let gap = 1.0 - smoothstep(0.5, 1.0, edge);
+ let shade = hash(vec3(id, pm.t.y)) * 0.7 + fbm(q * 2.0) * 0.3;
+ let bevel = smoothstep(0.5, 2.0, edge);
+ return vec3(shade, gap, bevel * (0.8 + 0.2 * fbm(q * 3.0)));
+ }
+ // fabric: a plain weave
+ if (kind == 6) {
+ let f = uv / max(pm.k.y, 1e-4) * 6.2831;
+ let warp = 0.5 + 0.5 * sin(f.x) * sign(sin(f.y * 0.5));
+ let weft = 0.5 + 0.5 * sin(f.y) * sign(sin(f.x * 0.5 + 1.57));
+ // threads finer than a pixel fade to the weave's mean shade, so a distant sofa doesn't shimmer in moire
+ let far = smoothstep(0.8, 2.5, length(fwidth(f)));
+ let m = mix(max(warp, weft), 0.72, far);
+ return vec3(clamp(m * 0.6 + fbm(q * 0.3) * 0.4, 0.0, 1.0), 0.0, m * (1.0 - far));
+ }
+ // brushed metal: long fine streaks along the face
+ if (kind == 7) {
+ let sy = uv.y / max(pm.k.y, 1e-4) * 60.0;
+ let s = mix(vnoise(vec3(uv.x / max(pm.k.y, 1e-4) * 0.4, sy, pm.t.y)), 0.5, smoothstep(0.5, 1.5, fwidth(sy)));
+ return vec3(s * 0.6 + fbm(q * 0.2) * 0.4, 0.0, s * 0.15);
+ }
+ // plaster: soft trowel marks and fine bumps
+ if (kind == 8) {
+ let m = fbm(q * 0.6);
+ let fine = vnoise(q * 18.0);
+ return vec3(m, 0.0, m * 0.5 + fine * 0.2);
+ }
+ // noise: two colours by fractal noise
+ let m = fbm(q);
+ return vec3(m, 0.0, m * 0.5);
+}
+
+@fragment
+fn fragment(
+ in: VertexOutput,
+ @builtin(front_facing) is_front: bool,
+) -> FragmentOutput {
+ var pbr_input = pbr_input_from_standard_material(in, is_front);
+
+ var p = in.world_position.xyz;
+ var n = normalize(in.world_normal);
+@if(VERTEX_OUTPUT_INSTANCE_INDEX) {
+ let m = get_local_from_world(in.instance_index);
+ p = (m * vec4(in.world_position.xyz, 1.0)).xyz;
+ n = normalize((m * vec4(n, 0.0)).xyz);
+}
+ let pat = pattern(p, n);
+ let t = pat.x;
+ let gap = pat.y;
+
+ var c = mix(pm.a.rgb, pm.b.rgb, t);
+ var rough = mix(pm.k.z, pm.k.w, t);
+ c = mix(c, pm.gap_color.rgb, gap);
+ rough = mix(rough, 0.95, gap);
+
+ // bump from the pattern's height (surface gradient: Mikkelsen 2010), in world space
+ let h = (pat.z - gap * 0.6) * pm.t.x;
+ let sx = dpdx(in.world_position.xyz);
+ let sy = dpdy(in.world_position.xyz);
+ let nw = normalize(pbr_input.N);
+ let r1 = cross(sy, nw);
+ let r2 = cross(nw, sx);
+ let det = dot(sx, r1);
+ let grad = sign(det) * (dpdx(h) * r1 + dpdy(h) * r2);
+ let bumped = normalize(abs(det) * nw - grad * 0.02);
+ if (pm.t.x > 0.0 && abs(det) > 1e-12) {
+ pbr_input.N = bumped;
+ }
+
+ // use: dust settles on what faces up; dirt in the gaps, the hollows, undersides and along the floor line; edges
+ // worn lighter and smoother where hands and feet go
+ let wq = p / max(pm.k.y, 1e-4) * 0.7 + vec3(pm.t.y * 3.1);
+ let up = smoothstep(0.55, 0.95, normalize(in.world_normal).y);
+ let dust = clamp(up * pm.w.y * (0.55 + 0.45 * fbm(wq * 2.0 + 30.0)), 0.0, 0.9);
+ c = mix(c, pm.dust_color.rgb, dust);
+ rough = mix(rough, 0.95, dust);
+ let floor_line = 1.0 - smoothstep(0.0, 0.25, in.world_position.y);
+ let under = clamp(-normalize(in.world_normal).y, 0.0, 1.0);
+ let dirt = clamp((gap * 0.8 + under * 0.5 + floor_line * 0.7 + smoothstep(0.6, 0.9, fbm(wq * 0.8 + 50.0)) * 0.4) * pm.w.z, 0.0, 0.85) * (0.6 + 0.4 * fbm(wq * 3.0 + 70.0));
+ c = mix(c, pm.dirt_color.rgb, dirt);
+ rough = mix(rough, 0.9, dirt);
+ let curve = length(fwidth(in.world_normal)) / max(length(fwidth(in.world_position.xyz)), 1e-5);
+ let edge = smoothstep(25.0, 90.0, curve) * pm.w.w * (0.5 + 0.5 * fbm(wq * 4.0 + 90.0));
+ c = mix(c, min(c * 1.35 + vec3(0.04), vec3(1.0)), edge);
+ rough = mix(rough, rough * 0.6, edge);
+
+ pbr_input.material.base_color = vec4(c, pbr_input.material.base_color.a);
+ pbr_input.material.perceptual_roughness = clamp(rough, 0.04, 1.0);
+ pbr_input.material.base_color = alpha_discard(pbr_input.material.flags, pbr_input.material.alpha_cutoff, pbr_input.material.base_color);
+
+@if(PREPASS_PIPELINE) {
+ return deferred_output(in, pbr_input);
+} @else {
+ var out: FragmentOutput;
+ out.color = apply_pbr_lighting(pbr_input);
+ out.color = main_pass_post_lighting_processing(pbr_input, out.color);
+ return out;
+}
+}
diff --git a/systems/speech/src/pocket/run.rs b/systems/speech/src/pocket/run.rs
index 703f2f3a..a08cdeee 100644
--- a/systems/speech/src/pocket/run.rs
+++ b/systems/speech/src/pocket/run.rs
@@ -85,7 +85,7 @@ impl Pocket {
out
}
- /// The voice to use when none is chosen: the founder's clip "watts" when it's there, otherwise alba.
+ /// The voice to use when none is chosen: the user's clip "watts" when it's there, otherwise alba.
pub fn default_voice() -> String {
if Self::voice_dir().join("watts.wav").exists() { "watts".into() } else { "alba".into() }
}
diff --git a/systems/sprite/src/lib.rs b/systems/sprite/src/lib.rs
index 5386e68e..472d9f98 100644
--- a/systems/sprite/src/lib.rs
+++ b/systems/sprite/src/lib.rs
@@ -104,19 +104,35 @@ pub fn spawn_sprite(world: &mut World, e: Entity, t: &Tup, image: Handle<Image>,
world.entity_mut(e).insert((sprite, place_of(v), Visibility::default(), Part2d));
}
-/// A flat shape's entity from its row.
-pub fn spawn_shape(world: &mut World, e: Entity, t: &Tup) {
+/// A flat shape's entity from its row: its ColorMaterial the row's colour, its texture (decoded by the caller) and
+/// AlphaMode2d (`alpha`: "opaque", "mask" at `alpha_cutoff`, otherwise Bevy's default "blend").
+pub fn spawn_shape(world: &mut World, e: Entity, t: &Tup, texture: Option<Handle<Image>>) {
let v = &t.vals;
let (w, h) = (num(v, "w", 100.0), num(v, "h", 100.0));
- let mesh = match v.get("shape") {
+ let mut mesh = match v.get("shape") {
Some(V::S(s)) if s == "circle" => Mesh::from(Circle::new(w / 2.0)),
Some(V::S(s)) if s == "ellipse" => Mesh::from(Ellipse::new(w / 2.0, h / 2.0)),
Some(V::S(s)) if s == "triangle" => Mesh::from(Triangle2d::new(Vec2::new(0.0, h / 2.0), Vec2::new(-w / 2.0, -h / 2.0), Vec2::new(w / 2.0, -h / 2.0))),
Some(V::S(s)) if s == "polygon" => Mesh::from(RegularPolygon::new(w / 2.0, num(v, "sides", 5.0).max(3.0) as u32)),
_ => Mesh::from(Rectangle::new(w, h)),
};
+ // per-vertex linear colours (Mesh::ATTRIBUTE_COLOR), which ColorMaterial multiplies its colour and texture by
+ if let Some(V::S(s)) = v.get("vertex_colors") {
+ // the row's JSON, [[r, g, b, a], ..]: its numbers in order, four to a vertex
+ let f: Vec<f32> = s.split([',', '[', ']']).filter_map(|x| x.trim().parse().ok()).collect();
+ let colors: Vec<[f32; 4]> = f.chunks_exact(4).filter_map(|c| c.try_into().ok()).collect();
+ match colors.len() == mesh.count_vertices() {
+ true => mesh.insert_attribute(Mesh::ATTRIBUTE_COLOR, colors),
+ false => error!("Shape2D {}: vertex_colors has {} colours for a mesh of {} vertices; drawn without them", t.id, colors.len(), mesh.count_vertices()),
+ }
+ }
let mesh = world.resource_mut::<Assets<Mesh>>().add(mesh);
- let mat = world.resource_mut::<Assets<ColorMaterial>>().add(ColorMaterial { color: color_of(v), alpha_mode: AlphaMode2d::Blend, ..default() });
+ let alpha_mode = match v.get("alpha") {
+ Some(V::S(a)) if a == "opaque" => AlphaMode2d::Opaque,
+ Some(V::S(a)) if a == "mask" => AlphaMode2d::Mask(num(v, "alpha_cutoff", 0.5)),
+ _ => AlphaMode2d::Blend,
+ };
+ let mat = world.resource_mut::<Assets<ColorMaterial>>().add(ColorMaterial { color: color_of(v), alpha_mode, texture, ..default() });
world.entity_mut(e).insert((Mesh2d(mesh), MeshMaterial2d(mat), place_of(v), Visibility::default(), Part2d));
}
diff --git a/systems/vision/src/coreml.rs b/systems/vision/src/coreml.rs
index 6a674d12..d3f46f15 100644
--- a/systems/vision/src/coreml.rs
+++ b/systems/vision/src/coreml.rs
@@ -1,4 +1,4 @@
-//! Core ML from Rust (docs/the roadmap A2): the same .mlpackage files the apps run, compiled once into the founder's caches,
+//! Core ML from Rust (docs/goal.feature A2): the same .mlpackage files the apps run, compiled once into the user's caches,
//! fed BGRA pixel buffers, read back as floats through each multi-array's strides (Core ML pads rows). Apple only;
//! other platforms run the ONNX exports through ort (later).
diff --git a/systems/vision/src/flow.rs b/systems/vision/src/flow.rs
index bc19c7e9..8868f14e 100644
--- a/systems/vision/src/flow.rs
+++ b/systems/vision/src/flow.rs
@@ -1,5 +1,5 @@
//! Optical flow through Apple Vision (VNGenerateOpticalFlowRequest, on the Neural Engine and GPU; no model shipped),
-//! reduced per frame pair to what editing rules ask about motion (docs/the roadmap Track L, the FLOW slot):
+//! reduced per frame pair to what editing rules ask about motion (docs/goal.feature Track L, the FLOW slot):
//!
//! grid mean flow magnitude in a 3x3 grid, as a share of the frame's width per frame pair (where things move)
//! dx dy the mean flow (a pan or a scroll), same unit; dy > 0 is downward
diff --git a/systems/vision/src/textread.rs b/systems/vision/src/textread.rs
index 9e8ca6e2..eb2b1dd7 100644
--- a/systems/vision/src/textread.rs
+++ b/systems/vision/src/textread.rs
@@ -1,4 +1,4 @@
-//! Text read off a rendered video as rows (docs/the roadmap J1): every frame's lines from Apple Vision's accurate text
+//! Text read off a rendered video as rows (docs/goal.feature J1): every frame's lines from Apple Vision's accurate text
//! recognition, chained through frames into rows: a line continues a row when its text is the same (case and
//! punctuation aside) and its box overlaps the row's last one, with up to `GAP` frames missed between; each row keeps
//! its text, its first and last frame, and its median box. The rows read can then be set against the rows an edit
diff --git a/systems/vision/src/vision.rs b/systems/vision/src/vision.rs
index 1861a03e..8f9233db 100644
--- a/systems/vision/src/vision.rs
+++ b/systems/vision/src/vision.rs
@@ -1,4 +1,4 @@
-//! What Apple Vision sees in a frame, behind one trait (docs/the roadmap A3): faces, text lines, rectangles, the person
+//! What Apple Vision sees in a frame, behind one trait (docs/goal.feature A3): faces, text lines, rectangles, the person
//! mask and whether the picture is a screenshot. AppleVision runs Vision's requests through objc2 with the settings
//! Perception.swift uses; another implementation (models elsewhere) can stand in on other platforms.
@@ -333,7 +333,7 @@ impl Vision for AppleVision {
}
}
-/// Every line of text Apple Vision reads accurately in a frame (docs/the roadmap J1), with its confidence and its box (0..1
+/// Every line of text Apple Vision reads accurately in a frame (docs/goal.feature J1), with its confidence and its box (0..1
/// of the frame, from the top left, unrounded): no language correction (captions aren't prose), lines at least 1.5% of
/// the frame high.
pub fn text_lines(rgba: &[u8], w: usize, h: usize) -> Result<Vec<(String, f32, [f64; 4])>, String> {
diff --git a/tools/bevy-defaults.ts b/tools/bevy-defaults.ts
new file mode 100644
index 00000000..cc25080d
--- /dev/null
+++ b/tools/bevy-defaults.ts
@@ -0,0 +1,101 @@
+// The defaults and override test (docs/control.feature FC0c): render sdk/raea/bench/bevy-parity/defaults/parts.tsx
+// (each Bevy-named part with no props) with the parity probe dumping its components, and hold every value against
+// Bevy's own Default from the type registry (raea-bevy-sdk --schema). Each difference is a convention: a unit, a
+// setting or a value raea chose that an author didn't write.
+//
+// bun tools/bevy-defaults.ts [SCHEMA.json] (default: makes it with target/release/raea-bevy-sdk)
+// Prints one line a difference and the count; writes docs/control/defaults.tsv.
+import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import { join } from "node:path";
+
+const root = join(import.meta.dir, "..");
+const TYPES = [
+ "bevy_camera::camera::Camera",
+ "bevy_camera::projection::Projection",
+ "bevy_render::view::Tonemapping",
+ "bevy_render::view::Msaa",
+ "bevy_light::ambient_light::AmbientLight",
+ "bevy_light::directional_light::DirectionalLight",
+ "bevy_light::point_light::PointLight",
+ "bevy_light::spot_light::SpotLight",
+ "bevy_light::ambient_light::GlobalAmbientLight",
+ "bevy_camera::clear_color::ClearColor",
+ "bevy_camera::camera::Exposure",
+ "bevy_render::view::ColorGrading",
+];
+// what the World works out itself, not a value an author or raea sets
+const COMPUTED = ["computed", "near_clip_plane", "aspect_ratio"];
+const tmp = join(process.env.TMPDIR ?? "/tmp", "raea-bevy-defaults");
+mkdirSync(tmp, { recursive: true });
+
+let schemaPath = process.argv[2];
+if (!schemaPath) {
+ schemaPath = join(tmp, "schema.json");
+ const args = TYPES.flatMap((t) => ["--type", t]);
+ const r = Bun.spawnSync([join(root, "target/release/raea-bevy-sdk"), ...args, "--schema", schemaPath, "-o", join(tmp, "schema.ts")], { stderr: "pipe" });
+ if (r.exitCode !== 0) throw new Error(`raea-bevy-sdk: ${r.stderr}`);
+}
+const schema = JSON.parse(readFileSync(schemaPath, "utf8")).types as Record<string, { default?: unknown }>;
+
+const out = join(tmp, "probe.jsonl");
+const r = Bun.spawnSync([join(root, "target/release/raea"), "render", join(root, "sdk/raea/bench/bevy-parity/defaults/parts.tsx"), "--frame", "0", "-o", join(tmp, "parts.png")], {
+ env: { ...process.env, RAEA_SIGN: "0", RAEA_MARK: "0", RAEA_PARITY: out, RAEA_PARITY_TYPES: TYPES.join(",") },
+ stdout: "pipe",
+ stderr: "pipe",
+});
+if (r.exitCode !== 0) throw new Error(`raea render failed: ${r.stderr.toString().split("\n").filter((l) => /error|refused/i.test(l)).slice(-2).join(" ")}`);
+const lines = readFileSync(join(tmp, "probe.world.jsonl"), "utf8").trim().split("\n");
+const world = JSON.parse(lines[lines.length - 1]).world as Record<string, unknown[]>;
+
+// a colour as linear RGBA, so Srgba white and LinearRgba white are one value
+const lin = (c: number) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
+function norm(v: unknown): unknown {
+ if (Array.isArray(v)) return v.map(norm);
+ if (!v || typeof v !== "object") return v;
+ const o = v as Record<string, unknown>;
+ const k = Object.keys(o);
+ if (k.length === 1 && k[0] === "Srgba") {
+ const s = o.Srgba as Record<string, number>;
+ return { LinearRgba: { red: lin(s.red), green: lin(s.green), blue: lin(s.blue), alpha: s.alpha } };
+ }
+ return Object.fromEntries(k.map((key) => [key, norm(o[key])]));
+}
+const near = (a: unknown, b: unknown) => typeof a === "number" && typeof b === "number" && Math.abs(a - b) <= 1e-4 * Math.max(1, Math.abs(b));
+function diff(path: string, got: unknown, want: unknown, into: string[][]) {
+ if (COMPUTED.some((c) => path.endsWith(`.${c}`))) return;
+ if (got === want || near(got, want)) return;
+ if (got && want && typeof got === "object" && typeof want === "object" && !Array.isArray(got) === !Array.isArray(want)) {
+ const keys = new Set([...Object.keys(got as object), ...Object.keys(want as object)]);
+ // an enum's variant changed: report the variant, not its fields
+ if (!Array.isArray(want) && Object.keys(want as object).length === 1 && Object.keys(got as object).length === 1 && Object.keys(got as object)[0] !== Object.keys(want as object)[0]) {
+ into.push([path, JSON.stringify(got), JSON.stringify(want)]);
+ return;
+ }
+ for (const k of keys) diff(`${path}.${k}`, (got as Record<string, unknown>)[k], (want as Record<string, unknown>)[k], into);
+ return;
+ }
+ into.push([path, JSON.stringify(got), JSON.stringify(want)]);
+}
+
+const rows: string[][] = [];
+for (const t of TYPES) {
+ const short = t.split("::").pop()!;
+ const values = world[t];
+ if (!Array.isArray(values)) {
+ rows.push([short, "(the probe)", JSON.stringify(values), "-"]);
+ continue;
+ }
+ if (values.length === 0) {
+ rows.push([short, "(missing)", "no entity has it", "the part should give Bevy's"]);
+ continue;
+ }
+ values.forEach((v, i) => {
+ const d: string[][] = [];
+ diff(values.length > 1 ? `${short}[${i}]` : short, norm(v), norm(schema[t]?.default), d);
+ rows.push(...d.map(([p, g, w]) => [short, p, g, w]));
+ });
+}
+mkdirSync(join(root, "docs/control"), { recursive: true });
+writeFileSync(join(root, "docs/control/defaults.tsv"), ["# type\tpath\traea gives\tBevy's Default (tools/bevy-defaults.ts, docs/control.feature FC0c)", ...rows.map((r) => r.join("\t"))].join("\n") + "\n");
+for (const [, p, g, w] of rows) console.log(`${p}: raea ${g}, Bevy ${w}`);
+console.log(`${rows.length} differences from Bevy's defaults`);
diff --git a/tools/bevy-parity b/tools/bevy-parity
new file mode 100755
index 00000000..ceed1a02
--- /dev/null
+++ b/tools/bevy-parity
@@ -0,0 +1,141 @@
+#!/bin/bash
+# Bevy's own examples against their TSX ports (docs/control.feature FC0a): each example runs as Bevy wrote it
+# (bench/bevy-parity's host, raea's Bevy, a fixed 60 fps clock) and as sdk/raea/bench/bevy-parity/<path>.tsx through
+# raea, the same parity probe (systems/parity) in both, and they're compared three ways at each listed frame:
+# pixels SSIM of the two frames (P26's ffmpeg ssim), passes at 0.98; and the worst 32 px tile's mean grey difference
+# (0-255), passes at 24: whole-frame SSIM forgives a small subject (a sprite on the wrong cell scored 0.989)
+# cost batch_keys (distinct mesh+material pairs drawn, about a draw call each), entities, frame_ms: passes when
+# raea's batch_keys and frame time are at most 1.25x the example's (wall time is this machine's, same run);
+# raea's frame time is its update's (frame_ms) plus React's step of a frame for its 3D (step_ms)
+# world (not yet: entities and components over BRP)
+#
+# tools/bevy-parity [PATH ...] default: every row of bench/bevy-parity/runs.tsv
+# tools/bevy-parity --report only rewrite docs/bevy-parity.md from docs/bevy-parity/results.jsonl
+# Needs target/release/raea-bevy-parity and raea, built in two cargo runs (lane build -- cargo build --release -p
+# raea-bevy-parity, then -p raea-cli --bin raea): the host turns on bevy_winit for Bevy's examples, and one run of both
+# unifies it into raea, whose render then panics building a second event loop (RecreationAttempt). And Bevy v0.20.0 at
+# BEVY_SRC (~/.cache/raea-vendor/bevy-0.20.0).
+set -uo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+BEVY_SRC=${BEVY_SRC:-$HOME/.cache/raea-vendor/bevy-0.20.0}
+HOST=${RAEA_PARITY_HOST:-$ROOT/target/release/raea-bevy-parity}
+RAEA=${RAEA_BIN:-$ROOT/target/release/raea}
+RUNS=bench/bevy-parity/runs.tsv
+PORTS=sdk/raea/bench/bevy-parity
+RES=docs/bevy-parity/results.jsonl
+OUT=${TMPDIR:-/tmp}/raea-bevy-parity
+export RAEA_SIGN=0 RAEA_MARK=0
+mkdir -p docs/bevy-parity "$OUT"
+
+report() {
+ local total ported pass
+ total=$(grep -c '^\[\[example\]\]' "$BEVY_SRC/Cargo.toml")
+ {
+ echo "# Bevy parity"
+ echo
+ echo "Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a). Generated by tools/bevy-parity;"
+ echo "don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys and"
+ echo "frame time at most 1.25x the example's). Wall time is one machine's, measured in the same run."
+ echo
+ ported=$(jq -s '[.[].example] | unique | length' "$RES" 2>/dev/null || echo 0)
+ pass=$(jq -s 'group_by(.example) | map(select(all(.pass))) | length' "$RES" 2>/dev/null || echo 0)
+ excluded=$(grep -c '^[^#]' docs/bevy-parity/excluded.tsv 2>/dev/null || echo 0)
+ echo "Examples: **$total**, ported **$ported**, passing **$pass**, excluded **$excluded** (docs/bevy-parity/excluded.tsv), left **$((total - pass - excluded))**."
+ echo
+ echo "raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the example"
+ echo "doesn't pay."
+ echo
+ echo "| example | frame | ssim | worst tile | batch keys (bevy / raea) | entities (bevy / raea) | meshes (bevy / raea) | materials (bevy / raea) | frame ms (bevy / raea = update + step) | pass | why |"
+ echo "|---|---:|---:|---:|---:|---:|---:|---:|---:|---|---|"
+ jq -r '"| \(.example) | \(.frame) | \(.ssim // "-") | \(.tile // "-") | \(.bevy.batch_keys) / \(.raea.batch_keys) | \(.bevy.entities) / \(.raea.entities) | \(.bevy.meshes) / \(.raea.meshes) | \(.bevy.materials) / \(.raea.materials) | \(.bevy.frame_ms) / \(.raea.cost_ms // .raea.frame_ms) = \(.raea.frame_ms) + \(.raea.step_ms // 0) | \(if .pass then "yes" else "no" end) | \(.why) |"' "$RES" 2>/dev/null
+ echo
+ echo "## Excluded"
+ echo
+ echo "| example | why |"
+ echo "|---|---|"
+ grep '^[^#]' docs/bevy-parity/excluded.tsv 2>/dev/null | awk -F'\t' '{ printf "| %s | %s |\n", $1, $2 }'
+ } > docs/bevy-parity.md
+ echo "docs/bevy-parity.md: $total examples, $ported ported, $pass passing, $excluded excluded"
+}
+
+[ "${1:-}" = "--report" ] && { report; exit 0; }
+[ -x "$HOST" ] || { echo "no $HOST: lane build -- cargo build --release -p raea-bevy-parity" >&2; exit 2; }
+[ -x "$RAEA" ] || { echo "no $RAEA" >&2; exit 2; }
+
+# runs.tsv: path, the example's arguments, the frames probed
+rows=()
+while IFS=$'\t' read -r path args frames; do
+ [[ -z "$path" || "$path" == \#* ]] && continue
+ if [ $# -gt 0 ]; then
+ for want in "$@"; do [ "$want" = "$path" ] && rows+=("$path"$'\t'"$args"$'\t'"$frames"); done
+ else
+ rows+=("$path"$'\t'"$args"$'\t'"$frames")
+ fi
+done < "$RUNS"
+
+for row in "${rows[@]}"; do
+ IFS=$'\t' read -r path args frames <<< "$row"
+ [ "$args" = - ] && args=""
+ d="$OUT/${path//\//__}"
+ rm -rf "$d"; mkdir -p "$d/bevy" "$d/raea"
+ echo "== $path ($args) at frames $frames"
+ # the example as Bevy wrote it
+ # shellcheck disable=SC2086
+ if ! RAEA_PARITY="$d/bevy.jsonl" RAEA_PARITY_FRAMES="$frames" RAEA_PARITY_PNG="$d/bevy" RAEA_PARITY_EXIT=1 \
+ RAEA_PARITY_EXAMPLE="$path" BEVY_ASSET_ROOT="$BEVY_SRC" "$HOST" $args > "$d/bevy.log" 2>&1; then
+ echo " the example failed: $(tail -1 "$d/bevy.log")"
+ fi
+ tsx="$PORTS/$path.tsx"
+ # Bevy's assets beside the port, as staticFile finds them (/media/x falls back to the folder's assets/, as Bevy's
+ # asset root): models/animated/Fox.glb for many_foxes. A link, gitignored, never a copy
+ [ -d "$(dirname "$tsx")" ] && ln -sfn "$BEVY_SRC/assets" "$(dirname "$tsx")/assets"
+ for f in ${frames//,/ }; do
+ why=""
+ b=$(jq -c "select(.frame == $f)" "$d/bevy.jsonl" 2>/dev/null | tail -1)
+ [ -z "$b" ] && b='{"batch_keys":null,"entities":null,"meshes":null,"materials":null,"frame_ms":null}' && why="the example wrote no frame $f"
+ r='{"batch_keys":null,"entities":null,"meshes":null,"materials":null,"frame_ms":null}'
+ s=null
+ t=null
+ if [ ! -f "$tsx" ]; then
+ why="${why:+$why; }no port at $tsx"
+ elif ! RAEA_STARTUP_TRACE=$(perl -MTime::HiRes=time -e 'printf "%.1f", time * 1000') RAEA_PARITY="$d/raea-$f.jsonl" \
+ "$RAEA" render "$tsx" --frame "$f" -o "$d/raea/$f.png" > "$d/raea-$f.log" 2>&1; then
+ why="${why:+$why; }raea failed: $(grep -iE 'error|refused|panick' "$d/raea-$f.log" | tail -1 | cut -c1-140)"
+ else
+ # the counts from the last update before the readback; its time the median update after the first five (the
+ # last line holds the readback's stall, the first the load)
+ r=$(jq -s -c 'if length == 0 then null else (.[-1] + {frame_ms: ((.[5:] // .) | map(.frame_ms) | sort | .[length / 2 | floor])}) end' "$d/raea-$f.jsonl" 2>/dev/null)
+ [ -z "$r" ] || [ "$r" = null ] && r='{"batch_keys":null,"entities":null,"meshes":null,"materials":null,"frame_ms":null}'
+ # and what a frame costs before Bevy sees it: React stepped through it for its 3D (the startup trace's marks over
+ # the frames stepped after frame 0, whose step is the mount, as Bevy's setup is out of its frame time), which
+ # Bevy's example doesn't pay; the time check is on frame_ms + step_ms
+ step=$(perl -ne '$a = $1 if /startup:\s+([\d.]+) ms the 3D.s rows: frame 0 stepped/; ($b, $n) = ($1, $2) if /startup:\s+([\d.]+) ms the 3D.s rows: (\d+) frames stepped/; END { printf "%.3f", ($b - $a) / ($n - 1) if $n > 1 && defined $a }' "$d/raea-$f.log")
+ r=$(jq -c --argjson s "${step:-null}" '. + {step_ms: $s, cost_ms: (if .frame_ms == null then null else ((.frame_ms + ($s // 0)) * 1000 | round / 1000) end)}' <<< "$r")
+ if [ -f "$d/bevy/$f.png" ] && [ -f "$d/raea/$f.png" ]; then
+ s=$(ffmpeg -hide_banner -nostats -i "$d/bevy/$f.png" -i "$d/raea/$f.png" -lavfi "[0:v]format=rgb24[a];[1:v]format=rgb24[b];[a][b]ssim" -f null - 2>&1 | grep -o 'All:[0-9.]*' | cut -d: -f2)
+ s=${s:-null}
+ # the worst tile: the two frames' difference, grey, averaged over 32 px squares, its largest value
+ t=$(ffmpeg -hide_banner -loglevel error -i "$d/bevy/$f.png" -i "$d/raea/$f.png" -filter_complex "[0:v]format=rgb24[a];[1:v]format=rgb24[b];[a][b]blend=all_mode=difference,format=gray,scale=iw/32:ih/32:flags=area" -f rawvideo -pix_fmt gray - | od -An -tu1 -v | tr -s ' ' '\n' | sort -n | tail -1)
+ t=${t:-null}
+ else
+ why="${why:+$why; }a frame is missing"
+ fi
+ fi
+ jq -nc --arg ex "$path" --argjson f "$f" --argjson s "$s" --argjson t "$t" --argjson b "$b" --argjson r "$r" --arg why "$why" '
+ def within(x; y): (x != null and y != null and (y <= (x * 1.25) or y <= x + 1));
+ ($s != null and $s >= 0.98 and $t != null and $t <= 24) as $px
+ | within($b.batch_keys; $r.batch_keys) as $draws
+ | within($b.frame_ms; ($r.cost_ms // $r.frame_ms)) as $time
+ | {example: $ex, frame: $f, ssim: $s, tile: $t, bevy: $b, raea: $r, pixels: $px, draws: $draws, time: $time,
+ pass: ($px and $draws and $time),
+ why: ([$why, (if $s != null and ($px | not) then "pixels \($s), worst tile \($t)" else empty end),
+ (if ($draws | not) and $r.batch_keys != null then "draws \($r.batch_keys) vs \($b.batch_keys)" else empty end),
+ (if ($time | not) and $r.frame_ms != null then "frame \($r.cost_ms // $r.frame_ms) ms (\($r.frame_ms) update + \($r.step_ms // 0) React step) vs \($b.frame_ms) ms" else empty end)]
+ | map(select(. != "")) | join("; "))}' > "$d/result-$f.json"
+ jq -r '" frame \(.frame): ssim \(.ssim // "-"), tile \(.tile // "-"), batch keys \(.bevy.batch_keys) / \(.raea.batch_keys), frame ms \(.bevy.frame_ms) / \(.raea.frame_ms): \(if .pass then "PASS" else "FAIL \(.why)" end)"' "$d/result-$f.json"
+ done
+ # replace this example's rows in the results
+ { jq -c --arg ex "$path" 'select(.example != $ex)' "$RES" 2>/dev/null; cat "$d"/result-*.json | jq -c .; } > "$RES.new" && mv "$RES.new" "$RES"
+done
+report
diff --git a/tools/bevy-pins.sh b/tools/bevy-pins.sh
new file mode 100755
index 00000000..8293c751
--- /dev/null
+++ b/tools/bevy-pins.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+# Everything a Bevy bump has to move, listed from the tree (docs/bevy-upgrade.md): the Bevy, wgpu and plugin pins in
+# every Cargo.toml, the [patch] entries for them, the versions each lockfile resolved (more than one Bevy or wgpu in a
+# lock is flagged), the vendored crates raea changed (their "# raea:" header names the upstream base), and the Bevy
+# shaders raea swaps at load (the upstream hash each was taken from). Exits 1 when a lock mixes Bevy or wgpu versions,
+# but for the known mixes in KNOWN (lockfile, crate, version, why), which draw on a device of their own, and when Bevy's
+# glam has scalar-math or libm on.
+# tools/bevy-pins.sh
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+CRATES='bevy|bevy_ecs|bevy_clipboard|wgpu|avian3d|bevy_hanabi|bevy_tweening|bevy_seedling|firewheel|firewheel-core|firewheel-graph|firewheel-macros|firewheel-nodes'
+KNOWN='Cargo.lock wgpu 29.0.4 pixels 0.17 (dioxus-native ios-sim window renderer, its own device; not built on macOS)'
+manifests() { git ls-files '*Cargo.toml' | grep -v '/vendor/' ; }
+locks() { git ls-files '*Cargo.lock' | grep -v '/vendor/' ; }
+
+echo "== pins (dependencies)"
+for m in $(manifests); do
+ awk -v m="$m" -v re="^($CRATES)[ ]*=" '
+ /^\[patch/ { patch = 1; next } /^\[/ { patch = 0 }
+ !patch && $0 ~ re && $0 !~ /= \[/ { sub(/^[ ]+/, ""); printf "%-45s %s\n", m, $0 }' "$m"
+done
+
+echo
+echo "== patches"
+for m in $(manifests); do
+ awk -v m="$m" -v re="^($CRATES|wgpu-core)[ ]*=" '
+ /^\[patch/ { patch = 1; next } /^\[/ { patch = 0 }
+ patch && $0 ~ re { printf "%-45s %s\n", m, $0 }' "$m"
+done
+
+echo
+echo "== resolved versions by lockfile"
+status=0
+for l in $(locks); do
+ line=""
+ for c in bevy bevy_ecs wgpu wgpu-core avian3d bevy_hanabi bevy_tweening bevy_seedling firewheel glam; do
+ v=$(awk -v c="$c" '$0 == "name = \"" c "\"" { getline; gsub(/version = |"/, ""); print }' "$l" | sort -u | tr '\n' ' ')
+ [ -n "$v" ] || continue
+ line="$line $c ${v% }"
+ n=$(echo "$v" | wc -w | tr -d ' ')
+ if [ "$n" -gt 1 ]; then case $c in bevy|bevy_ecs|wgpu)
+ known=""
+ for ver in $v; do echo "$KNOWN" | grep -q "^$l $c $ver " && known="$known $ver"; done
+ if [ "$(echo $known | wc -w | tr -d ' ')" -ge $((n - 1)) ]; then line="$line (mixed, known:$known)"; else line="$line (MIXED)"; status=1; fi ;;
+ esac; fi
+ line="$line;"
+ done
+ [ -n "$line" ] && printf "%-45s%s\n" "$l" "$line"
+done
+
+echo
+# glam's scalar-math or libm on Bevy's own glam (feature unification: at 0.20 rapier's enhanced-determinism turned
+# both on through parry3d and glamx) drops Vec4's 16-byte alignment, and Bevy's GPU structs stop matching its shaders
+echo "== Bevy's glam: features that break Bevy's GPU structs"
+gv=$(awk '$0 == "name = \"bevy_math\"" { m = 1 } m && /"glam / { gsub(/[" ,]/, ""); sub(/glam/, ""); print; exit }' Cargo.lock)
+bad=$(cargo tree --offline --workspace -e features -i "glam@$gv" 2>/dev/null | grep -o 'glam feature "\(scalar-math\|libm\|fast-math\)"' | sort -u | tr '\n' ' ')
+if [ -n "$bad" ]; then echo "glam $gv: $bad(BAD: cargo tree -e features -i glam@$gv shows who)"; status=1; else echo "glam $gv: none"; fi
+
+echo
+echo "== vendored crates raea changed (upstream base in the header; changes marked raea:)"
+for m in vendor/*/Cargo.toml; do
+ h=$(head -1 "$m")
+ case $h in "# raea:"*) printf "%-60s %s (%s raea: marks)\n" "$(dirname "$m")" "${h#\# raea: }" "$(grep -rI 'raea:' "$(dirname "$m")" | wc -l | tr -d ' ')" ;; esac
+done
+
+echo
+echo "== Bevy shaders swapped at load (engine/render, bevy_api::swap_embedded_shader)"
+grep -rn 'swap_embedded_shader(app, "' engine/render/src | sed -E 's/^([^:]+):([0-9]+):.*swap_embedded_shader\(app, "([^"]+)", (0x[0-9a-f_]+).*/\1:\2 \3 upstream hash \4/'
+
+echo
+echo "== toolchain"
+bv=$(awk '$0 == "name = \"bevy\"" { getline; gsub(/version = |"/, ""); print; exit }' Cargo.lock)
+rv=$(grep -h '^rust-version' "$HOME"/.cargo/registry/src/*/bevy-"$bv"/Cargo.toml 2>/dev/null | head -1)
+echo "bevy $bv: ${rv:-rust-version unknown (crate not in the local registry)}; rustc on PATH: $(rustc --version 2>/dev/null)"
+exit $status
diff --git a/tools/bevy-plugins.sh b/tools/bevy-plugins.sh
new file mode 100755
index 00000000..2bb38868
--- /dev/null
+++ b/tools/bevy-plugins.sh
@@ -0,0 +1,500 @@
+#!/bin/bash
+# Bevy plugins declared in TypeScript projects, resolved into raea's plugin build (sdk/raea/docs/bevy-plugins.md).
+# A project names its plugins in package.json under raea.plugins (raea.bevy.plugins, its first name, is still read);
+# this script turns every declaration into
+# engine/bevy-plugins (its declared dependencies and features, and src/declared.rs, which registers each plugin with
+# raea-render), builds raea-bevy-sdk with the plugins a project asks for, and generates that project's TypeScript from the
+# built App's TypeRegistry, with a lock that fails loudly when a plugin's version moves without a regeneration.
+#
+# tools/bevy-plugins.sh sync [PACKAGE.json ...] write engine/bevy-plugins from the declarations (default: every
+# package.json in the repo that declares plugins)
+# tools/bevy-plugins.sh build DIR sync, then build raea-bevy-sdk with DIR's plugins (through lane),
+# then gen DIR when a plugin's version differs from DIR's lock
+# tools/bevy-plugins.sh gen DIR DIR/bevy/<plugin>.gen.tsx and DIR/bevy/plugins.lock.json (or in
+# the folder package.json's raea.generated names, relative to DIR)
+# tools/bevy-plugins.sh check DIR fails when the declarations, Cargo.lock or the generated TypeScript
+# have drifted from DIR's lock (CI runs this)
+# tools/bevy-plugins.sh features DIR the cargo features DIR's plugins need
+#
+# One declaration, keyed by the plugin's name (that name is also its cargo feature):
+# "avian": {
+# "crate": "avian3d", default: the key
+# "versions": { "0.19": "=0.7.0", "0.20": "=0.8.0" }, by Bevy minor: a crates.io requirement, or
+# {"git": URL, "rev": REV} or {"path": DIR}; "version"
+# alone is one requirement for every Bevy
+# "features": ["3d", "f32"], its default features are always off
+# "plugin": "avian3d::prelude::PhysicsPlugins::default()", the Rust expression app.add_plugins takes
+# "calls": "avian", optional: avian.rs's calls(app) adds methods (see CALLS)
+# "adapter": "hanabi", the escape hatch: its register() does it all (see ADAPTERS)
+# "deps": { "rand_pcg": { "version": "0.10" } }, crates the adapter needs, behind the same feature
+# "types": ["avian3d::"], type-path prefixes to generate (default: the crate's)
+# "reflect": { "components": ["bevy_egui::EguiContextSettings"], types deriving Reflect that the crate leaves
+# "resources": [...], "messages": [...], unregistered or without #[reflect(Component)] (Resource,
+# "defaults": [...] } Message, Default): registered here, so TypeScript can write them
+# "headless": ["assets", "mesh"], what a plain headless App needs for it
+# "onDemand": true, only an App that names it gets it (a peer's half)
+# "library": true, no plugin: compiled for its types and calls (noise)
+# "widgets": { "x-gauge": "gauge::Gauge::default()" }, Blitz custom widgets: each tag's elements in every
+# page backed by the blitz-dom Widget its expression makes
+# (a widget crate with no Bevy plugin is a "library")
+# "verdict": "blocked: ...", why its line for this Bevy is null, and when that was checked
+# "builtin": true always compiled in, not a feature (bevy_remote); its
+# features go behind a feature of its name. A builtin
+# whose crate the manifest already has (bevy) is only that
+# "needs": ["avian"], other declared plugins it needs (a backend's engine)
+# "raea": true raea's own plugin, in every raea build (render's looks,
+# audio's mixer): nothing for cargo; gen writes its handle,
+# with the registry's types under "types" when it names them
+# }
+# "versions" may say "0.20": null: no release for that Bevy yet, so a build on it leaves the plugin out (sync says
+# so). "features" may be lists by Bevy minor when the feature names moved: {"0.19": [...], "0.20": [...]}.
+# A project uses a plugin declared in another package by naming it there: "audio": { "from": "@raea/audio" } (the
+# package.json whose "name" is @raea/audio declares it; its handle is that package's).
+# "raea": { "generated": "../../../plugins/src" } beside "plugins" puts the generated modules in that folder instead of
+# DIR/bevy, with an index.ts exporting each plugin's handle: the catalog bench's go to the SDK's @raea/plugins, which
+# authors import as raea/plugins/<name> (docs/plugins.feature PL1).
+set -euo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+CRATE=$ROOT/engine/bevy-plugins
+TOML=$CRATE/Cargo.toml
+DECLARED=$CRATE/src/declared.rs
+# most calls live in their own crate (raea-bevy-calls): a declaration's "calls" module is there when its file is,
+# else in this one (calls that need the bridge, avian's)
+CALLS=$ROOT/engine/bevy-calls
+CALLS_TOML=$CALLS/Cargo.toml
+# and most adapters in theirs (raea-bevy-adapters), the same way: there when the file is, else in this crate (the ones
+# that need its bridge, lightyear's)
+ADAPTERS=$ROOT/engine/bevy-adapters
+ADAPTERS_TOML=$ADAPTERS/Cargo.toml
+SDK=$ROOT/target/release/raea-bevy-sdk
+
+die() { echo "bevy-plugins: $*" >&2; exit 1; }
+command -v jq >/dev/null || die "needs jq"
+
+# the Bevy minor the tree builds against (the plugin crate's exact bevy pin)
+bevy_minor() {
+ sed -n 's/^bevy = { version = "=\([0-9]*\.[0-9]*\)\.[0-9]*".*/\1/p' "$TOML" | head -1
+}
+
+# a package.json's plugin declarations: raea.plugins (docs/sdk.feature S6b), over raea.bevy.plugins, its first name
+PLUGINS='((.raea.bevy.plugins // {}) + (.raea.plugins // {}))'
+
+# every package.json in the repo that declares plugins (tracked or new, not ignored)
+declarations() {
+ (cd "$ROOT" && git ls-files --cached --others --exclude-standard -- '*package.json' | while read -r f; do
+ jq -e "$PLUGINS"' | length > 0' "$ROOT/$f" >/dev/null 2>&1 && echo "$ROOT/$f"
+ done) || true
+}
+
+# the declarations merged into one object; the same name declared two ways is an error
+merged() {
+ local out='{}' f name a b
+ for f in "$@"; do
+ [ -f "$f" ] || die "no declaration $f"
+ for name in $(jq -r "$PLUGINS"' | keys[]' "$f"); do
+ # a reference to another package's declaration adds nothing of its own (spec_of checks it resolves)
+ jq -e --arg n "$name" "$PLUGINS"'[$n] | type == "object" and has("from")' "$f" >/dev/null && { spec_of "$f" "$name" >/dev/null; continue; }
+ a=$(jq -c --arg n "$name" '.[$n] // empty' <<<"$out")
+ b=$(jq -c --arg n "$name" "$PLUGINS"'[$n] | del(.note)' "$f")
+ if [ -n "$a" ] && [ "$a" != "$b" ]; then
+ die "$name is declared two ways (one is in $f): $a vs $b. One Bevy links one version of a plugin, so declare it once."
+ fi
+ out=$(jq -c --arg n "$name" --argjson v "$b" '.[$n] = $v' <<<"$out")
+ done
+ done
+ echo "$out"
+}
+
+# the package.json whose "name" is PACKAGE (@raea/audio), tracked or new
+package_named() { # PACKAGE
+ (cd "$ROOT" && git ls-files --cached --others --exclude-standard -- '*package.json' | while read -r f; do
+ jq -e --arg p "$1" '.name == $p' "$ROOT/$f" >/dev/null 2>&1 && echo "$ROOT/$f"
+ done) | head -1
+}
+
+# NAME's declaration in a package.json, a { "from": PACKAGE } reference followed to the package that declares it
+spec_of() { # PACKAGE.json NAME
+ local s from f
+ s=$(jq -c --arg n "$2" "$PLUGINS"'[$n]' "$1")
+ from=$(jq -r 'if type == "object" then .from // empty else empty end' <<<"$s")
+ [ -n "$from" ] || { echo "$s"; return; }
+ f=$(package_named "$from")
+ [ -n "$f" ] || die "$2 in $1 is from $from, which no package.json in the repo is named"
+ s=$(jq -c --arg n "$2" "$PLUGINS"'[$n] // empty' "$f")
+ [ -n "$s" ] || die "$2 in $1 is from $from (${f#"$ROOT"/}), which doesn't declare $2"
+ jq -e 'type == "object" and has("from")' <<<"$s" >/dev/null && die "$2 in ${f#"$ROOT"/} is itself a reference: declare it there"
+ echo "$s"
+}
+
+# a crate's source for this Bevy as TOML keys: version = "..." | git = "...", rev = "..." | path = "..."
+source_of() { # JSON-SPEC MINOR WHAT
+ local s
+ s=$(jq -c --arg m "$2" 'if .versions then .versions[$m] elif .version then .version else null end' <<<"$1")
+ [ "$s" != null ] || die "$3 has no version for Bevy $2 (add \"$2\" to its versions)"
+ jq -r 'if type == "string" then "version = \"\(.)\""
+ elif .git then (if (.rev // "" | test("^[0-9a-f]{7,40}$")) then "git = \"\(.git)\", rev = \"\(.rev)\"" else error("\(.git): rev must be a commit hash, got \(.rev)") end)
+ elif .path then "path = \"\(.path)\""
+ else error("a source is a version, {git, rev} or {path}") end' <<<"$s" 2>/dev/null || die "$3's source for Bevy $2 isn't usable: $s"
+}
+
+toml_list() { jq -r '[.[] | "\"\(.)\""] | join(", ")'; }
+
+# a plugin declared with no release for this Bevy ("0.20": null in its versions): left out of the build, said so
+unreleased() { # JSON-SPEC MINOR
+ jq -e --arg m "$2" '.versions and (.versions | has($m)) and .versions[$m] == null' <<<"$1" >/dev/null
+}
+
+# a plugin's features for this Bevy, as a JSON list: "features" is a list, or lists by Bevy minor
+features_of() { # JSON-SPEC MINOR
+ jq -c --arg m "$2" '(.features // []) | if type == "object" then (.[$m] // []) else . end' <<<"$1"
+}
+
+# the other declared plugins a plugin needs, as more entries of its cargo feature (tnua's avian backend needs avian)
+needs_of() { # JSON-SPEC
+ jq -r '[(.needs // [])[] | "\"\(.)\""] | if length > 0 then ", " + join(", ") else "" end' <<<"$1"
+}
+
+# the Rust that registers a plugin's "reflect" types with the App: a type that derives Reflect but whose crate never
+# registers it (a library), or doesn't say #[reflect(Component)] / #[reflect(Resource)] / #[reflect(Message)], so
+# TypeScript can't insert or write it; "defaults" are ones that implement Default without #[reflect(Default)], so a
+# value that gives only some fields is refused. Each is a public Rust path; a generic one is named with its type arguments
+reflect_of() { # JSON-SPEC
+ jq -r '(.reflect // {}) as $r | "::bevy::ecs::reflect::" as $e
+ | [($r.components // [])[] | " app.register_type::<\(.)>().register_type_data::<\(.), \($e)ReflectComponent>();"]
+ + [($r.resources // [])[] | " app.register_type::<\(.)>().register_type_data::<\(.), \($e)ReflectResource>().register_type_data::<\(.), \($e)ReflectComponent>();"]
+ + [($r.messages // [])[] | " app.register_type::<\(.)>().register_type_data::<\(.), \($e)ReflectMessage>();"]
+ + [($r.defaults // [])[] | " app.register_type::<\(.)>().register_type_data::<\(.), ::bevy::prelude::ReflectDefault>();"]
+ | join("")' <<<"$1"
+}
+
+# the plugins DIR builds: the ones it declares that have a release for this Bevy
+released_names() { # PACKAGE.json
+ local m name; m=$(bevy_minor)
+ for name in $(jq -r "$PLUGINS"' | keys_unsorted[]' "$1"); do
+ unreleased "$(spec_of "$1" "$name")" "$m" || echo "$name"
+ done
+}
+
+# the plugins DIR builds that are cargo features: its released ones but raea's own (in every build already)
+cargo_names() { # PACKAGE.json
+ local name
+ for name in $(released_names "$1"); do
+ jq -e '.raea == true' <<<"$(spec_of "$1" "$name")" >/dev/null || echo "$name"
+ done
+}
+
+# replace the lines between a ">>> NAME" and "<<< NAME" marker in a file
+splice() { # FILE NAME CONTENT-FILE
+ awk -v name="$2" -v body="$3" '
+ index($0, ">>> " name) { print; while ((getline l < body) > 0) print l; skip = 1; next }
+ index($0, "<<< " name) { skip = 0 }
+ !skip { print }' "$1" > "$1.tmp" && mv "$1.tmp" "$1"
+}
+
+cmd_sync() {
+ local files=()
+ if [ $# -gt 0 ]; then
+ files=("$@")
+ else
+ while read -r f; do files+=("$f"); done < <(declarations)
+ fi
+ [ ${#files[@]} -gt 0 ] || die "no package.json declares raea.plugins"
+ local all minor deps feats cdeps cfeats reg list name spec crate src fl dname dspec dline seen="" skipped="" own=""
+ all=$(merged "${files[@]}")
+ minor=$(bevy_minor)
+ [ -n "$minor" ] || die "can't read the bevy pin in $TOML"
+ deps=$(mktemp); feats=$(mktemp); cdeps=$(mktemp); cfeats=$(mktemp); adeps=$(mktemp); afeats=$(mktemp); reg=$(mktemp); list=$(mktemp)
+ for name in $(jq -r 'keys[]' <<<"$all"); do
+ [[ "$name" =~ ^[a-z][a-z0-9_]*$ ]] || die "plugin name $name: lowercase letters, digits and _ (it is a cargo feature and a Rust name)"
+ spec=$(jq -c --arg n "$name" '.[$n]' <<<"$all")
+ crate=$(jq -r --arg n "$name" '.crate // $n' <<<"$spec")
+ if unreleased "$spec" "$minor"; then
+ skipped="$skipped $name"
+ continue
+ fi
+ # raea's own plugin is in every raea build: nothing for cargo or the registry
+ jq -e '.raea == true' <<<"$spec" >/dev/null && { own="$own $name"; continue; }
+ src=$(source_of "$spec" "$minor" "$name")
+ fl=$(features_of "$spec" "$minor" | toml_list)
+ local builtin; builtin=$(jq -r '.builtin // false' <<<"$spec")
+ local fdeps=""
+ # calls in raea-bevy-calls, or an adapter in raea-bevy-adapters: the plugin's crate and its "deps" are that crate's
+ # too, behind a feature of its name (its side)
+ local calls in_calls=false cfdeps="" ad out_adapter=false side="" sdeps sfeats
+ calls=$(jq -r '.calls // empty' <<<"$spec")
+ [ -n "$calls" ] && [ -f "$CALLS/src/$calls.rs" ] && in_calls=true && side=calls && sdeps=$cdeps && sfeats=$cfeats
+ ad=$(jq -r '.adapter // empty' <<<"$spec")
+ if [ -n "$ad" ] && [ -f "$ADAPTERS/src/$ad.rs" ]; then
+ [ -z "$side" ] || die "$name: calls in engine/bevy-calls and an adapter in engine/bevy-adapters; keep its code in one"
+ out_adapter=true side=adapters sdeps=$adeps sfeats=$afeats
+ fi
+ # a library whose only code is those calls (no plugin, no types to register here), or a plugin an adapter there
+ # installs, is that crate's alone
+ local here=true
+ [ $in_calls = true ] && [ "$(jq -r '(.library // false) and (.reflect | not)' <<<"$spec")" = true ] && here=false
+ [ $out_adapter = true ] && here=false
+ if [ "$builtin" = true ]; then
+ # always compiled in, with no features; its features go behind a feature of its own name, so a workspace build
+ # (which compiles this crate with none) doesn't unify them into everyone's Bevy. A crate the manifest already
+ # depends on by hand (bevy itself) gets only the feature
+ grep -q "^$crate = " <(sed '/>>> declared dependencies/,$d' "$TOML") || echo "$crate = { $src, default-features = false }" >> "$deps"
+ fdeps=$(features_of "$spec" "$minor" | jq -r --arg c "$crate" '[.[] | "\"\($c)/\(.)\""] | join(", ")')
+ else
+ if [ $here = true ]; then
+ echo "$crate = { $src, optional = true, default-features = false, features = [$fl] }" >> "$deps"
+ fdeps="\"dep:$crate\""
+ fi
+ if [ -n "$side" ]; then
+ echo "$crate = { $src, optional = true, default-features = false, features = [$fl] }" >> "$sdeps"
+ cfdeps="\"dep:$crate\""
+ fi
+ fi
+ for dname in $(jq -r '.deps // {} | keys[]' <<<"$spec"); do
+ dspec=$(jq -c --arg d "$dname" '.deps[$d]' <<<"$spec")
+ case " $seen " in *" $dname "*) die "$dname is a dependency of two plugins: declare it in one" ;; esac
+ seen="$seen $dname"
+ dline="$dname = { $(source_of "$dspec" "$minor" "$name's $dname"), optional = true, default-features = false, features = [$(jq '.features // []' <<<"$dspec" | toml_list)] }"
+ if [ -n "$side" ]; then
+ echo "$dline" >> "$sdeps"
+ cfdeps="${cfdeps:+$cfdeps, }\"dep:$dname\""
+ else
+ echo "$dline" >> "$deps"
+ fdeps="${fdeps:+$fdeps, }\"dep:$dname\""
+ fi
+ done
+ [ -n "$side" ] && { echo "$name = [$cfdeps]" >> "$sfeats"; fdeps="${fdeps:+$fdeps, }\"raea-bevy-$side/$name\""; }
+ echo "$name = [$fdeps$(needs_of "$spec")]" >> "$feats"
+ # the registration raea-render sees, and what the generator and the bridge read
+ local prefixes headless ondemand plugin adapter rcrate
+ rcrate=${crate//-/_}
+ prefixes=$(jq -c --arg c "$rcrate" '.types // ["\($c)::"]' <<<"$spec" | jq -r '[.[] | "\"\(.)\""] | join(", ")')
+ headless=$(jq '.headless // []' <<<"$spec" | toml_list)
+ ondemand=$(jq -r '.onDemand // false' <<<"$spec")
+ plugin=$(jq -r '.plugin // empty' <<<"$spec")
+ adapter=$(jq -r '.adapter // empty' <<<"$spec")
+ local reflect; reflect=$(reflect_of "$spec")
+ [ -z "$reflect" ] || [ -z "$adapter$(jq -r '.builtin // empty' <<<"$spec")" ] || die "$name: \"reflect\" is for a plugin or a library; an adapter or a builtin registers its own types"
+ local cfg="#[cfg(feature = \"$name\")]"
+ local lcfg="$cfg"
+ [ "$builtin" = true ] && lcfg=""
+ echo " $lcfg v.push(Declared { name: \"$name\", krate: \"$crate\", source: $(jq -Rn --arg s "$src" '$s'), prefixes: &[$prefixes], headless: &[$headless], on_demand: $ondemand });" >> "$list"
+ # Blitz widgets (docs/sdk.feature S8b): each tag backed in every page App by the widget its expression makes
+ local widgets; widgets=$(jq -r '.widgets // {} | to_entries[] | " raea_sys_page::widgets::AppPageWidgets::page_widget(app, \"\(.key)\", || Box::new(\(.value)));"' <<<"$spec" | tr -d '\n')
+ [ -z "$widgets" ] || printf ' %s\n raea_sys_page::widgets::register_page_plugin(|app| {%s });\n' "$cfg" "$widgets" >> "$reg"
+ if [ "$builtin" = true ] && [ -z "$adapter" ]; then
+ continue
+ elif [ $out_adapter = true ]; then
+ printf ' %s\n raea_bevy_adapters::%s::register();\n' "$cfg" "$adapter" >> "$reg"
+ elif [ -n "$adapter" ]; then
+ [ -f "$CRATE/src/$adapter.rs" ] || die "$name's adapter src/$adapter.rs doesn't exist in engine/bevy-adapters or engine/bevy-plugins"
+ printf ' %s\n crate::%s::register();\n' "$cfg" "$adapter" >> "$reg"
+ else
+ local extra="$reflect" library
+ library=$(jq -r '.library // false' <<<"$spec")
+ if [ -n "$calls" ]; then
+ if [ $in_calls = true ]; then extra="$extra raea_bevy_calls::$calls::calls(app);"
+ else
+ [ -f "$CRATE/src/$calls.rs" ] || die "$name's calls src/$calls.rs doesn't exist in engine/bevy-calls or engine/bevy-plugins"
+ extra="$extra crate::$calls::calls(app);"
+ fi
+ fi
+ if [ "$library" = true ]; then
+ # a library has no plugin: it is compiled for its reflected types (registered here) and calls (its App half);
+ # one with neither (bevy_asset_loader) is named, so it is linked and cargo-shear sees it used
+ [ -z "$extra" ] || printf ' %s\n raea_runtime_plugins::register(raea_runtime_plugins::Registered { name: "%s", install: |app| {%s }, group: None, on_demand: %s });\n' "$cfg" "$name" "$extra" "$ondemand" >> "$reg"
+ [ -n "$extra" ] || printf ' %s\n use %s as _;\n' "$cfg" "${crate//-/_}" >> "$reg"
+ continue
+ fi
+ [ -n "$plugin" ] || die "$name needs \"plugin\" (the expression app.add_plugins takes), an \"adapter\", or \"library\": true"
+ printf ' %s\n raea_runtime_plugins::register(raea_runtime_plugins::Registered { name: "%s", install: |app| { crate::AddOnce::add_once(%s, app);%s }, group: None, on_demand: %s });\n' "$cfg" "$name" "$plugin" "$extra" "$ondemand" >> "$reg"
+ fi
+ done
+ # the modules adapters and calls live in, by feature
+ local mods cmods amods; mods=$(mktemp); cmods=$(mktemp); amods=$(mktemp)
+ for name in $(jq -r 'keys[]' <<<"$all"); do
+ spec=$(jq -c --arg n "$name" '.[$n]' <<<"$all")
+ unreleased "$spec" "$minor" && continue
+ for m in $(jq -r '[.adapter // empty, .calls // empty] | unique[]' <<<"$spec"); do
+ if [ "$m" = "$(jq -r '.calls // empty' <<<"$spec")" ] && [ -f "$CALLS/src/$m.rs" ]; then
+ printf '#[cfg(feature = "%s")]\npub mod %s;\n' "$name" "$m" >> "$cmods"
+ elif [ "$m" = "$(jq -r '.adapter // empty' <<<"$spec")" ] && [ -f "$ADAPTERS/src/$m.rs" ]; then
+ printf '#[cfg(feature = "%s")]\npub mod %s;\n' "$name" "$m" >> "$amods"
+ else
+ printf '#[cfg(feature = "%s")]\npub mod %s;\n' "$name" "$m" >> "$mods"
+ fi
+ done
+ done
+ splice "$TOML" "declared dependencies" "$deps"
+ splice "$TOML" "declared features" "$feats"
+ splice "$CRATE/src/lib.rs" "declared modules" "$mods"
+ splice "$CALLS_TOML" "declared dependencies" "$cdeps"
+ splice "$CALLS_TOML" "declared features" "$cfeats"
+ splice "$CALLS/src/lib.rs" "declared modules" "$cmods"
+ splice "$ADAPTERS_TOML" "declared dependencies" "$adeps"
+ splice "$ADAPTERS_TOML" "declared features" "$afeats"
+ splice "$ADAPTERS/src/lib.rs" "declared modules" "$amods"
+ {
+ echo "// Generated by tools/bevy-plugins.sh sync for Bevy $minor from:"
+ # the files that declare what this crate builds (raea's own plugins and references to them add nothing here)
+ for f in "${files[@]}"; do jq -e "$PLUGINS"' | any(.[]; type == "object" and (has("from") or .raea == true | not))' "$f" >/dev/null && echo "// ${f#"$ROOT"/}" || true; done
+ echo "// Don't edit: change a declaration and sync. lib.rs includes this file (and holds the adapters' modules)."
+ echo
+ echo "/// The Bevy minor these plugins were resolved for."
+ echo "pub const BEVY: &str = \"$minor\";"
+ echo
+ echo "/// Registers every plugin this build has (by feature) with raea-render's hooks. Call before the first Engine or App."
+ echo "pub fn install() {"
+ cat "$reg"
+ echo "}"
+ echo
+ echo "/// The declared plugins this build has: name, crate, the source resolved, the type-path prefixes the generator"
+ echo "/// keeps, what a plain headless App needs for it, and whether only an App that names it gets it."
+ echo "pub fn declared() -> Vec<Declared> {"
+ echo " #[allow(unused_mut)]"
+ echo " let mut v = Vec::new();"
+ cat "$list"
+ echo " v"
+ echo "}"
+ } > "$DECLARED"
+ rm -f "$deps" "$feats" "$cdeps" "$cfeats" "$adeps" "$afeats" "$reg" "$list" "$mods" "$cmods" "$amods"
+ echo "bevy-plugins: synced $(jq -r 'keys | length' <<<"$all") declarations for Bevy $minor from ${#files[@]} file(s)"
+ [ -z "$skipped" ] || echo "bevy-plugins: no release for Bevy $minor, left out:$skipped"
+ [ -z "$own" ] || echo "bevy-plugins: raea's own, in every build (nothing to sync):$own"
+}
+
+decl_of() { # DIR -> its package.json
+ local f=$1/package.json
+ [ -f "$f" ] || die "$1 has no package.json"
+ jq -e "$PLUGINS"' | length > 0' "$f" >/dev/null || die "$f declares no raea.plugins"
+ # every reference resolves, checked here in the caller's shell (inside $(...) a die would only end the subshell)
+ local name
+ for name in $(jq -r "$PLUGINS"' | to_entries[] | select(.value | type == "object" and has("from")) | .key' "$f"); do
+ spec_of "$f" "$name" >/dev/null
+ done
+ echo "$f"
+}
+
+# where DIR's generated modules go: raea.generated relative to DIR, else DIR/bevy
+out_of() { # DIR
+ local g; g=$(jq -r '.raea.generated // "bevy"' "$1/package.json")
+ echo "$1/$g"
+}
+
+cmd_features() { # DIR
+ local f; f=$(decl_of "$1")
+ { echo bevy-plugins; cargo_names "$f" | sed 's|^|raea-bevy-plugins/|'; } | paste -sd, -
+}
+
+cmd_build() { # DIR
+ local dir; dir=$(cd "$1" && pwd)
+ cmd_sync
+ local feats; feats=$(cmd_features "$dir")
+ echo "bevy-plugins: building raea-bevy-sdk with $feats"
+ (cd "$ROOT" && lane build -- cargo build --release -p raea-cli --bin raea-bevy-sdk --features "$feats" -j 6)
+ if ! cmd_check "$dir" >/dev/null 2>&1; then
+ echo "bevy-plugins: $dir's TypeScript is behind its plugins; regenerating"
+ cmd_gen "$dir"
+ fi
+}
+
+# the version Cargo.lock resolved for a crate (several: the one the plugin crate links)
+locked_version() {
+ (cd "$ROOT" && cargo tree -p raea-bevy-plugins --features "$2" -e normal --depth 1 --prefix none -f '{p}' 2>/dev/null) | awk -v c="$1" '$1 == c { print $2; exit }'
+}
+
+# raea's own plugin's handle, for one that names no types: what a plugin list takes, marked as raea's
+raea_handle() { # NAME SPEC
+ local note; note=$(jq -r '.note // empty' <<<"$2")
+ printf '%s\n' "// Generated by tools/bevy-plugins.sh gen from $1's declaration (raea's own plugin, in every raea build); don't" \
+ "// edit, regenerate." \
+ "" \
+ "/** $1${note:+: $note}. Named in a project's raea.plugins, it says the project uses it; a headless BevyApp can't open it. */" \
+ "export const $1 = {" \
+ " plugin: \"$1\" as const," \
+ " raea: true as const," \
+ "};"
+}
+
+cmd_gen() { # DIR [OUTDIR]
+ local dir out f name spec crate prefixes args version hash g plugins='{}'
+ dir=$(cd "$1" && pwd); out=${2:-$(out_of "$dir")}
+ f=$(decl_of "$dir")
+ [ -x "$SDK" ] || die "build first: tools/bevy-plugins.sh build $1"
+ mkdir -p "$out"
+ local schema; schema=$(mktemp -d)
+ for name in $(released_names "$f"); do
+ # a plugin from another package: its handle is that package's
+ jq -e --arg n "$name" "$PLUGINS"'[$n] | type == "object" and has("from")' "$f" >/dev/null && { plugins=$(jq -c --arg n "$name" --arg p "$(jq -r --arg n "$name" "$PLUGINS"'[$n].from' "$f")" '.[$n] = {from: $p}' <<<"$plugins"); continue; }
+ spec=$(jq -c --arg n "$name" "$PLUGINS"'[$n]' "$f")
+ crate=$(jq -r --arg n "$name" '.crate // $n' <<<"$spec")
+ # raea's own plugin naming no types: its handle alone, which names it in a plugin list
+ if [ "$(jq -r '.raea == true and (.types | not)' <<<"$spec")" = true ]; then
+ raea_handle "$name" "$spec" > "$out/$name.gen.tsx"
+ plugins=$(jq -c --arg n "$name" '.[$n] = {raea: true}' <<<"$plugins")
+ continue
+ fi
+ # a builtin is generated only when it names the types it brings (bevy's features do)
+ [ "$(jq -r '(.builtin // false) and (.types | not)' <<<"$spec")" = true ] && { plugins=$(jq -c --arg n "$name" --arg c "$crate" --arg v "$(locked_version "$crate" "")" '.[$n] = {crate: $c, version: $v, builtin: true}' <<<"$plugins"); continue; }
+ args=()
+ while read -r p; do args+=(--prefix "$p"); done < <(jq -r --arg c "${crate//-/_}" '.types // ["\($c)::"] | .[]' <<<"$spec")
+ "$SDK" "${args[@]}" --plugin "$name" --title "$name ($crate)" -o "$out/$name.gen.tsx" --schema "$schema/$name.json" 2> "$schema/$name.log" || { cat "$schema/$name.log" >&2; die "generating $name failed"; }
+ tail -1 "$schema/$name.log"
+ hash=$(shasum -a 256 "$schema/$name.json" | cut -c1-16)
+ if jq -e '.raea == true' <<<"$spec" >/dev/null; then
+ # raea's own: in every build, no feature of its name; marked in its handle, which no headless App can open
+ perl -0pi -e 's/^ plugin: ("[a-z0-9_]+") as const,$/ plugin: $1 as const,\n raea: true as const,/m' "$out/$name.gen.tsx"
+ plugins=$(jq -c --arg n "$name" --arg c "$crate" --arg h "$hash" '.[$n] = {crate: $c, raea: true, schema: $h}' <<<"$plugins")
+ continue
+ fi
+ version=$(locked_version "$crate" "$name")
+ plugins=$(jq -c --arg n "$name" --arg c "$crate" --arg v "$version" --arg h "$hash" '.[$n] = {crate: $c, version: $v, schema: $h}' <<<"$plugins")
+ done
+ rm -rf "$schema"
+ jq -n --arg b "$(bevy_minor)" --argjson p "$plugins" '{bevy: $b, plugins: $p}' > "$out/plugins.lock.json"
+ # a package's folder (raea.generated): an index of every generated plugin's handle, by its name
+ if jq -e '.raea.generated' "$f" >/dev/null; then
+ {
+ echo "// Generated by tools/bevy-plugins.sh gen from ${f#"$ROOT"/}; don't edit, regenerate. Each plugin's handle,"
+ echo "// by name; its wrappers and types are raea/plugins/<name>."
+ for g in "$out"/*.gen.tsx; do
+ name=$(basename "$g" .gen.tsx)
+ # the handle is the name in camelCase (raea-bevy-sdk: big_space is bigSpace)
+ echo "export { $(perl -pe 's/_([a-z0-9])/\U$1/g' <<<"$name") } from \"./$name.gen\";"
+ done
+ } > "$out/index.ts"
+ fi
+ echo "bevy-plugins: generated $(jq -r 'keys | join(", ")' <<<"$plugins") into ${out#"$ROOT"/}"
+}
+
+cmd_check() { # DIR
+ local dir gen lock tmp status=0 name want have
+ dir=$(cd "$1" && pwd); gen=$(out_of "$dir"); lock=$gen/plugins.lock.json
+ [ -f "$lock" ] || die "$dir has no ${lock#"$dir"/}: run tools/bevy-plugins.sh build $1"
+ [ "$(jq -r .bevy "$lock")" = "$(bevy_minor)" ] || { echo "drift: $lock is for Bevy $(jq -r .bevy "$lock"), the tree is on $(bevy_minor)"; status=1; }
+ tmp=$(mktemp -d)
+ cmd_gen "$dir" "$tmp" >/dev/null
+ for name in $(jq -r '.plugins | keys[]' "$lock"); do
+ want=$(jq -r --arg n "$name" '.plugins[$n] | if . == null then "missing" else (.version // "unversioned") end' "$lock")
+ have=$(jq -r --arg n "$name" '.plugins[$n] | if . == null then "missing" else (.version // "unversioned") end' "$tmp/plugins.lock.json")
+ [ "$want" = "$have" ] || { echo "drift: $name is $have in the build, $want in $lock"; status=1; }
+ if [ -f "$tmp/$name.gen.tsx" ] && ! cmp -s "$tmp/$name.gen.tsx" "$gen/$name.gen.tsx"; then
+ echo "drift: $name's generated TypeScript differs from the build's registry:"; diff "$gen/$name.gen.tsx" "$tmp/$name.gen.tsx" | head -20; status=1
+ fi
+ done
+ for name in $(jq -r '.plugins | keys[]' "$tmp/plugins.lock.json"); do
+ jq -e --arg n "$name" '.plugins[$n]' "$lock" >/dev/null || { echo "drift: $name is declared but not in $lock"; status=1; }
+ done
+ if [ -f "$tmp/index.ts" ] && ! cmp -s "$tmp/index.ts" "$gen/index.ts"; then echo "drift: ${gen#"$dir"/}/index.ts isn't the generated plugins' index"; status=1; fi
+ rm -rf "$tmp"
+ [ $status = 0 ] && echo "bevy-plugins: $1 matches its lock" || echo "bevy-plugins: $1 drifted; run tools/bevy-plugins.sh build $1 (or gen) and review the diff"
+ return $status
+}
+
+case "${1:-}" in
+ sync) shift; cmd_sync "$@" ;;
+ build) [ $# = 2 ] || die "build DIR"; cmd_build "$2" ;;
+ gen) [ $# -ge 2 ] || die "gen DIR"; cmd_gen "$2" "${3:-}" ;;
+ check) [ $# = 2 ] || die "check DIR"; cmd_check "$2" ;;
+ features) [ $# = 2 ] || die "features DIR"; cmd_features "$2" ;;
+ *) sed -n '2,41p' "$0" | sed 's/^# \{0,1\}//'; exit 2 ;;
+esac
diff --git a/tools/dead-rust.sh b/tools/dead-rust.sh
new file mode 100755
index 00000000..17fc0425
--- /dev/null
+++ b/tools/dead-rust.sh
@@ -0,0 +1,180 @@
+#!/bin/bash
+# Dead Rust items in one crate (overhaul phase 1, docs/handoff/audit.md). Every `pub` in the crate's library (or its
+# binary, for a crate with no library) is narrowed to `pub(crate)`, the crate is checked, and each dead_code or
+# unused_imports warning is an item nothing in the crate uses. Each name is then looked for, as a whole word, in the
+# crate's own bins, tests, examples and benches and in the crates that depend on it, plus TS for a field (serde fields
+# reach TS by name). No hit outside means dead; a hit means used, or a common name (new, run) that grep can't tell
+# apart, so read it. Items found used keep `pub` and the check repeats until no new one turns up, so nothing only a
+# used item reaches is called dead. The crate is restored afterwards, even on failure. It edits files, so it refuses
+# the shared tree.
+# tools/dead-rust.sh <crate> [cargo args] run from a private checkout (~/raea-trial/<x>); prints a TSV:
+# verdict, kind, name, file:line, hits outside (up to 3 files)
+# Default features only: an item used only under a feature shows as dead; pass --all-features or --features to check.
+# The library alone: an item only its unit tests use shows as dead; `--profile test` checks with them, to tell the two
+# apart (not --tests, which also builds the integration tests and bins against the narrowed library).
+set -u
+crate=${1:?usage: tools/dead-rust.sh <crate> [cargo args]}
+shift
+root=$(git rev-parse --show-toplevel 2>/dev/null) || { echo "dead-rust: run it inside a checkout" >&2; exit 2; }
+shared=$(cd "${RAEA:-$HOME/raea}" 2>/dev/null && pwd -P)
+[ "$(cd "$root" && pwd -P)" != "$shared" ] || { echo "dead-rust: refused in the shared tree $shared; use a private checkout" >&2; exit 2; }
+cd "$root" || exit 2
+
+meta=$(cargo metadata --no-deps --format-version 1) || exit 2
+pkg=$(echo "$meta" | jq -c --arg n "$crate" '.packages[] | select(.name == $n)')
+[ -n "$pkg" ] || { echo "dead-rust: no crate $crate in this workspace" >&2; exit 2; }
+dir=$(dirname "$(echo "$pkg" | jq -r .manifest_path)")
+# the library's sources, or the bins' when there is no library: everything under src/ except src/bin, and not a nested
+# crate's
+if echo "$pkg" | jq -e '[.targets[].kind[]] | any(. == "lib" or . == "rlib" or . == "cdylib")' >/dev/null; then
+ target=(--lib); skip_bin=1
+else
+ target=(--bins); skip_bin=0
+fi
+nested=$(echo "$meta" | jq -r '.packages[].manifest_path' | xargs -n1 dirname | grep "^$dir/." || true)
+src=()
+while IFS= read -r f; do
+ case "$f" in "$dir"/src/bin/*) [ "$skip_bin" = 1 ] && continue ;; esac
+ [ "$skip_bin" = 1 ] && [ "$f" = "$dir/src/main.rs" ] && continue
+ inner=0
+ for n in $nested; do case "$f" in "$n"/*) inner=1 ;; esac; done
+ [ "$inner" = 0 ] && src+=("$f")
+done < <(find "$dir/src" -name '*.rs' 2>/dev/null | sort)
+[ ${#src[@]} -gt 0 ] || { echo "dead-rust: $crate has no sources under $dir/src" >&2; exit 2; }
+
+work=$(mktemp -d "${TMPDIR:-/tmp}/dead-rust.XXXXXX")
+child=
+restore() {
+ [ -z "$child" ] || kill "$child" 2>/dev/null
+ for f in "${src[@]}"; do cp -p "$work/orig/${f//\//%}" "$f"; done
+ rm -rf "$work"
+}
+mkdir -p "$work/orig"
+for f in "${src[@]}"; do cp -p "$f" "$work/orig/${f//\//%}"; done
+trap restore EXIT
+trap 'exit 130' INT TERM
+
+# names used outside the narrowed sources: every tracked .rs, .ts, .tsx, .js outside vendor and node_modules
+# .rs only in this crate and the crates that depend on it (a file belongs to the deepest crate folder holding it); a
+# crate that doesn't depend on this one can't use its items, so its matches are only the same word
+echo "$meta" | jq -r '.packages[].manifest_path' | xargs -n1 dirname | awk '{print length, $0}' | sort -rn | cut -d' ' -f2- > "$work/dirs"
+{ echo "$dir"
+ echo "$meta" | jq -r --arg n "$crate" '.packages[] | select(any(.dependencies[]; .name == $n)) | .manifest_path' | xargs -n1 dirname
+} > "$work/users"
+git ls-files -- '*.rs' '*.ts' '*.tsx' '*.js' '*.mjs' ':!vendor/*' ':!*/vendor/*' ':!**/node_modules/**' | sed "s|^|$root/|" |
+ awk -v dirs="$work/dirs" -v users="$work/users" '
+ BEGIN { while ((getline d < dirs) > 0) D[++n] = d; while ((getline u < users) > 0) U[u] = 1 }
+ !/\.rs$/ { print; next }
+ { for (i = 1; i <= n; i++) if (index($0, D[i] "/") == 1) { if (D[i] in U) print; next } }' | sort > "$work/all"
+printf '%s\n' "${src[@]}" | sort > "$work/mine"
+comm -23 "$work/all" "$work/mine" > "$work/outside"
+grep '\.rs$' "$work/outside" > "$work/outside.rs"
+
+# one pass: `pub ` at the start of an item or field narrowed to pub(crate) (never `pub mod`: a kept item in a narrowed
+# module is still private, so it and all it reaches would stay dead), except the lines in $work/keep (file:line,
+# the items found used outside in an earlier pass), then the crate checked; dead.tsv gets kind, name, file:line per
+# dead span in the crate's own files
+narrow_check() {
+ for f in "${src[@]}"; do
+ awk -v f="${f#"$root"/}" -v keep="$work/keep" '
+ BEGIN { while ((getline k < keep) > 0) K[k] = 1 }
+ !((f ":" FNR) in K) && /^[[:space:]]*pub [^(]/ && !/^[[:space:]]*pub mod / { sub(/pub /, "pub(crate) ") } { print }' "$work/orig/${f//\//%}" > "$f"
+ done
+ lane build -- cargo check -j 6 -p "$crate" "${target[@]}" --message-format=json "$@" > "$work/check.raw" 2> "$work/check.err" &
+ child=$!; wait "$child"; code=$?; child=
+ grep "^{" "$work/check.raw" > "$work/check.json"
+ if [ "$code" != 0 ] && ! grep -q '"reason":"compiler-message"' "$work/check.json"; then
+ echo "dead-rust: cargo check failed ($code)" >&2; tail -20 "$work/check.err" >&2; exit 1
+ fi
+}
+pass() {
+ narrow_check "$@"
+ # a narrowing that breaks the build (a kept `pub use` of a narrowed item: E0364, E0365; a narrowed type in a kept
+ # signature) gets its item's pub back: each line an error points at that this script narrowed, and each item an
+ # error names in backticks whose definition it narrowed. Then the same pass again; errors it can't place fail the run,
+ # since rustc runs no lints after an error and the warnings would be meaningless.
+ while jq -e 'select(.reason == "compiler-message" and .message.level == "error")' "$work/check.json" >/dev/null; do
+ jq -r --arg r "$root/" 'select(.reason == "compiler-message" and .message.level == "error") | .message
+ | (.spans[], .children[].spans[]) | "\(.file_name | ltrimstr($r)):\(.line_start)"' "$work/check.json" | sort -u > "$work/errlines"
+ jq -r 'select(.reason == "compiler-message" and .message.level == "error") | .message
+ | (.message, .children[].message) | scan("`([A-Za-z_][A-Za-z0-9_]*)`") | .[0]' "$work/check.json" | sort -u > "$work/errnames"
+ : > "$work/fix"
+ for f in "${src[@]}"; do
+ rel=${f#"$root"/}
+ awk -v f="$rel" -v lines="$work/errlines" -v names="$work/errnames" '
+ BEGIN { while ((getline l < lines) > 0) L[l] = 1; while ((getline n < names) > 0) N[n] = 1 }
+ /^[[:space:]]*pub\(crate\) / {
+ if ((f ":" FNR) in L) { print f ":" FNR; next }
+ if (match($0, /(struct|enum|union|trait|type|fn|const|static|mod|use) +[A-Za-z_][A-Za-z0-9_]*/)) {
+ w = substr($0, RSTART, RLENGTH); sub(/.* +/, "", w); if (w in N) print f ":" FNR
+ } else if (match($0, /pub\(crate\) +[A-Za-z_][A-Za-z0-9_]* *:/)) {
+ w = substr($0, RSTART, RLENGTH); sub(/^pub\(crate\) +/, "", w); sub(/ *:$/, "", w); if (w in N) print f ":" FNR
+ }
+ }' "$f" > "$work/fix.one"
+ # only lines this script narrowed (the original said `pub `)
+ while IFS=: read -r _ line; do
+ sed -n "${line}p" "$work/orig/${f//\//%}" | grep -qE '^[[:space:]]*pub [^(]' && echo "$rel:$line"
+ done < "$work/fix.one" >> "$work/fix"
+ done
+ sort -u "$work/fix" | comm -23 - <(sort -u "$work/keep") > "$work/fix.new"
+ if [ ! -s "$work/fix.new" ]; then
+ echo "dead-rust: the narrowed crate doesn't build, and its errors name nothing this script narrowed:" >&2
+ jq -r 'select(.reason == "compiler-message" and .message.level == "error") | .message.rendered' "$work/check.json" | head -40 >&2
+ exit 1
+ fi
+ cat "$work/fix.new" >> "$work/keep"
+ narrow_check "$@"
+ done
+ jq -r --arg d "$dir/" --arg r "$root/" '
+ select(.reason == "compiler-message") | .message
+ | select(.code.code == "dead_code" or .code.code == "unused_imports")
+ | .message as $m
+ | (($m | capture("^(?<k>[a-z ]+?)s? `") // ($m | capture("^multiple (?<k>[a-z ]+?)s are")) // {k: "item"}) | .k) as $k
+ | .spans[] | select(.is_primary)
+ | (if (.file_name | startswith("/")) then .file_name else $r + .file_name end) as $f
+ | select($f | startswith($d))
+ | [ (if .text[0] then .text[0].text[.text[0].highlight_start - 1 : .text[0].highlight_end - 1] else "?" end),
+ ($m | if test("^unused import") then "import" else $k end),
+ (($f | ltrimstr($r)) + ":" + (.line_start | tostring)) ]
+ | @tsv' "$work/check.json" | sort -u > "$work/dead.tsv"
+}
+
+# each warned item's verdict: dead (no hit outside), used? (hits, up to 3 files) or read (no name to look for)
+judge() {
+ local name kind where word list hits
+ while IFS=$'\t' read -r name kind where; do
+ # an import's span is the whole path; the name is its last segment
+ word=$(echo "$name" | sed -E 's/.*:://; s/[{} ]//g; s/^r#//')
+ if [ -z "$word" ] || [ "$word" = "?" ] || [ "$word" = "*" ]; then
+ printf 'read\t%s\t%s\t%s\t-\n' "$kind" "$name" "$where"; continue
+ fi
+ # TS can only reach a field (by its serde name); everything else is looked for in Rust
+ case "$kind" in field*) list="$work/outside" ;; *) list="$work/outside.rs" ;; esac
+ hits=$(tr '\n' '\0' < "$list" | xargs -0 grep -lw -- "$word" 2>/dev/null | sed "s|^$root/||")
+ if [ -z "$hits" ]; then
+ printf 'dead\t%s\t%s\t%s\t-\n' "$kind" "$name" "$where"
+ else
+ printf 'used?\t%s\t%s\t%s\t%s\n' "$kind" "$name" "$where" "$(echo "$hits" | head -3 | paste -sd, -)$( [ "$(echo "$hits" | wc -l)" -gt 3 ] && echo ",…")"
+ fi
+ done < "$work/dead.tsv"
+}
+
+# Narrowing everything at once makes rustc's dead_code spread: an entry point used only from outside looks unused, and
+# so does everything only it reaches. So repeat: keep `pub` on each item found used outside, check again, until a pass
+# finds none new. What's dead then is dead with every used item public.
+: > "$work/keep"; : > "$work/used"; n=0
+while :; do
+ n=$((n + 1))
+ pass "$@"
+ judge > "$work/verdicts"
+ grep '^used?' "$work/verdicts" | cut -f4 | sort -u | comm -23 - <(sort -u "$work/keep") > "$work/new"
+ grep '^used?' "$work/verdicts" >> "$work/used"
+ [ -s "$work/new" ] || break
+ cat "$work/new" >> "$work/keep"
+done
+echo "dead-rust: $crate, $n passes" >&2
+
+# an item only an exported macro uses is used by whoever calls the macro, which this can't see
+grep -l '#\[macro_export\]' "${src[@]}" 2>/dev/null | sed "s|^$root/|dead-rust: exported macros in |; s|$|: a 'dead' item its macros use isn't|" >&2
+printf 'verdict\tkind\tname\twhere\toutside\n'
+{ sort -u -t$'\t' -k4,4 "$work/used"; grep -v '^used?' "$work/verdicts"; } | sort -t$'\t' -k1,1r -k4,4
diff --git a/tools/dupes.max b/tools/dupes.max
new file mode 100644
index 00000000..8441b241
--- /dev/null
+++ b/tools/dupes.max
@@ -0,0 +1,17 @@
+# tools/dupes.sh: the most duplicate groups allowed; lower them as copies are folded, never raise
+# Raised once, 11-06 (docs/targets.feature T1a): 292/48 -> 296/56 when the Rune host joined the
+# workspace as engine/rune. Its two real copies were folded (view.rs padding(), tests/common); these twelve are
+# accessors, one-line forwards and closures matched by shape, not copies:
+# exact: rune/page tree.rs:57 Tree::get (a11y Ctx::el); rune/page page.rs:83 Page::take_out (rune/style report.rs:40
+# Report::take_fresh); rune/page kit.rs:17 closure (engine/native node.rs:257); rune/page events.rs:42 and :54
+# the two pointer handlers' closures
+# near: rune js.rs:164/173 Host clock/take_out; rune/page session.rs:179/192 focused_field/take_out; rune/page
+# tree.rs:52 Tree::ids (speech Slot::lock); tree.rs:149 Tree::node_mut (calls State::solid); rune tests/css.rs:7
+# style (core/wire raw.rs is_object); rune video.rs:155 fnv (tone tonegraph.rs hash, the same FNV-1a: kept, the
+# host can't depend on systems/); rune/style css.rs:409 closure (plugins fields.rs:272); rune bundle.rs:9 js_dir
+# Raised once more, 11-06, by raea-web (web-export): 296 -> 297. Its copies were folded (grass's and volume's JSON number
+# into raea_sys_frame::json_f32; begin_live and app_mut gone; await_models split by target); the one left is an
+# accessor matched by shape: Engine::world_mut and Opening::world_mut (the canvas window goes on before the engine is
+# finished, its camera after) with runtime/page bevy_page.rs BevyPage::app
+exact=296
+near=56
diff --git a/tools/dupes.sh b/tools/dupes.sh
new file mode 100755
index 00000000..1c1a0b12
--- /dev/null
+++ b/tools/dupes.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Copied code, as a ratchet: exits 1 when cargo-dupes finds more exact or near-duplicate groups in raea's own Rust
+# than tools/dupes.max allows. When it finds fewer, it says so: lower the numbers in the same commit, so they only
+# go down. Vendored crates, the conformance runner (sdk/ui/conformance: a test tool in its own workspace, its
+# one-line closures matching other crates') and tests are left out: #[cfg(test)] modules and files named tests.rs (a
+# module's tests split into a file of their own, which cargo-dupes reads as code). So is engine/bevy-plugins/src/
+# declared.rs, which tools/bevy-plugins.sh generates: one registration closure per catalog plugin, alike by design.
+# tools/dupes.sh the check (L0, tools/agents/check)
+# tools/dupes.sh report every group, to find what to fold together
+# Needs cargo-dupes (cargo install cargo-dupes --locked).
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+# tools/rask is its own repository (a submodule, empty in the fresh checkout L1 uses), so it never counts
+X=(--exclude vendor --exclude target --exclude sdk/ui/conformance --exclude-tests --exclude tests.rs --exclude engine/bevy-plugins/src/declared.rs \
+ --exclude tools/rask)
+command -v cargo-dupes >/dev/null || { echo "dupes: cargo-dupes isn't installed (cargo install cargo-dupes --locked)"; exit 1; }
+[ "${1:-}" = report ] && exec cargo dupes report "${X[@]}"
+
+read -r max_exact max_near < <(awk -F= '/^exact=/{e=$2} /^near=/{n=$2} END{print e, n}' tools/dupes.max)
+[ -n "$max_exact" ] && [ -n "$max_near" ] || { echo "dupes: tools/dupes.max names no exact= and near= limits"; exit 1; }
+out=$(cargo dupes stats "${X[@]}" 2>&1) || { echo "$out"; exit 1; }
+exact=$(echo "$out" | awk '/^Exact duplicates:/{print $3}')
+near=$(echo "$out" | awk '/^Near duplicates:/{print $3}')
+[ -n "$exact" ] && [ -n "$near" ] || { echo "dupes: couldn't read cargo-dupes' stats:"; echo "$out"; exit 1; }
+if [ "$exact" -gt "$max_exact" ] || [ "$near" -gt "$max_near" ]; then
+ echo "dupes: $exact exact and $near near-duplicate groups (allowed $max_exact and $max_near): fold the new copy into"
+ echo " what it copies (tools/dupes.sh report lists every group)"
+ exit 1
+fi
+if [ "$exact" -lt "$max_exact" ] || [ "$near" -lt "$max_near" ]; then
+ echo "dupes: ok, and down to $exact exact and $near near: set tools/dupes.max to exact=$exact near=$near"
+else
+ echo "dupes: ok ($exact exact, $near near)"
+fi
diff --git a/tools/ensure.sh b/tools/ensure.sh
new file mode 100755
index 00000000..e7261c55
--- /dev/null
+++ b/tools/ensure.sh
@@ -0,0 +1,161 @@
+#!/bin/bash
+# A tool raea and the feed run that a clean Mac doesn't have (docs/app.feature AP6), its path printed, installed first
+# if it isn't there: one place, so `raea cut` (engine/cli/src/native.ts), the feed's host (apps/app host/tools.ts) and
+# raea.app ask the same way. Each install is pinned and its download's sha256 checked, under $RAEA_TOOLS_CACHE (else
+# ~/.cache/raea-tools)/NAME, once; RAEA_AUDIO_AUTOSETUP=0 (raea's one switch for local tools installing themselves)
+# refuses instead. A working one already on PATH is used as it is.
+# tools/ensure.sh git git with git-lfs (GitHub Desktop's portable build, dugite-native: git 2.56.0, lfs 3.8.1)
+# tools/ensure.sh parakeet-mlx the take transcriber (parakeet-mlx 0.5.2 in its own venv; its model loads on first use)
+# tools/ensure.sh uv uv 0.12.24 (Astral's standalone build), what the Python installs are made with
+# Progress goes to stderr; stdout is only the path.
+set -euo pipefail
+name=${1:?usage: tools/ensure.sh git|parakeet-mlx|uv}
+cache=${RAEA_TOOLS_CACHE:-$HOME/.cache/raea-tools}
+
+UV_VER=0.12.24
+UV_SHA=0c4346de7abdb49495b393b9ec809fe387aa43e586be20fecb972216c1e71732
+GIT_TAG=v2.56.0-2
+GIT_FILE=dugite-native-v2.56.0-a44aeca-macOS-arm64.tar.gz
+GIT_SHA=1110de343de11cc6f469b782b60f36217b9199b5e06875dd65baa26dd60563c7
+PARAKEET_VER=0.5.2
+
+say() { echo "raea: $*" >&2; }
+refuse() { say "$name isn't installed, and RAEA_AUDIO_AUTOSETUP=0 keeps it from installing itself (into $cache/$name)"; exit 1; }
+
+# a download, its sha256 checked, at $2
+fetch() {
+ local url=$1 out=$2 sha=$3
+ curl -fL --retry 3 --silent --show-error -o "$out.part" "$url"
+ [ "$(shasum -a 256 "$out.part" | cut -d' ' -f1)" = "$sha" ] || { rm -f "$out.part"; say "$url: its sha256 isn't $sha"; exit 1; }
+ mv "$out.part" "$out"
+}
+
+# one install at a time per tool (two renders asking at once): a lock directory, released on exit
+lock() {
+ mkdir -p "$cache"
+ local l="$cache/.$1.lock" n=0
+ until mkdir "$l" 2>/dev/null; do
+ n=$((n + 1))
+ [ $n -gt 1200 ] && { say "$l: another install has held it for 10 minutes (remove it if none is running)"; exit 1; }
+ sleep 0.5
+ done
+ trap "rmdir '$l' 2>/dev/null" EXIT
+}
+
+# git on PATH, if it works without asking for anything: /usr/bin/git is a stub that opens the Command Line Tools
+# installer when they're missing, so it counts only when xcode-select has a developer directory
+path_git() {
+ local g
+ g=$(command -v git 2>/dev/null) || return 1
+ if [ "$g" = /usr/bin/git ]; then xcode-select -p >/dev/null 2>&1 || return 1; fi
+ "$g" --version >/dev/null 2>&1 && "$g" lfs version >/dev/null 2>&1 || return 1
+ echo "$g"
+}
+
+ensure_uv() {
+ local d=$cache/uv
+ if [ -x "$d/uv" ]; then echo "$d/uv"; return; fi
+ local u
+ if u=$(command -v uv 2>/dev/null); then echo "$u"; return; fi
+ [ "${RAEA_AUDIO_AUTOSETUP:-1}" = 0 ] && refuse
+ lock uv
+ if [ ! -x "$d/uv" ]; then
+ say "installing uv $UV_VER into $d"
+ mkdir -p "$d.part"
+ fetch "https://github.com/astral-sh/uv/releases/download/$UV_VER/uv-aarch64-apple-darwin.tar.gz" "$d.part/uv.tgz" $UV_SHA
+ tar xzf "$d.part/uv.tgz" -C "$d.part" --strip-components 1
+ rm "$d.part/uv.tgz"
+ rm -rf "$d" && mv "$d.part" "$d"
+ fi
+ echo "$d/uv"
+}
+
+ensure_git() {
+ local d=$cache/git
+ if [ -x "$d/raea-git" ]; then echo "$d/raea-git"; return; fi
+ path_git && return
+ [ "${RAEA_AUDIO_AUTOSETUP:-1}" = 0 ] && refuse
+ lock git
+ if [ ! -x "$d/raea-git" ]; then
+ say "installing git (dugite-native $GIT_TAG, with git-lfs, 150 MB) into $d"
+ rm -rf "$d.part" && mkdir -p "$d.part"
+ fetch "https://github.com/desktop/dugite-native/releases/download/$GIT_TAG/$GIT_FILE" "$d.part/git.tgz" $GIT_SHA
+ tar xzf "$d.part/git.tgz" -C "$d.part"
+ rm "$d.part/git.tgz"
+ # its programs found where it is, as GitHub Desktop runs it (git-lfs is one of them, so the LFS filter works)
+ cat >"$d.part/raea-git" <<'EOF'
+#!/bin/sh
+d=$(cd "$(dirname "$0")" && pwd)
+export GIT_EXEC_PATH="$d/libexec/git-core" GIT_TEMPLATE_DIR="$d/share/git-core/templates" PATH="$d/libexec/git-core:$PATH"
+exec "$d/bin/git" "$@"
+EOF
+ chmod +x "$d.part/raea-git"
+ "$d.part/raea-git" --version >/dev/null && "$d.part/raea-git" lfs version >/dev/null || { say "the installed git doesn't run ($d.part)"; exit 1; }
+ rm -rf "$d" && mv "$d.part" "$d"
+ fi
+ echo "$d/raea-git"
+}
+
+ensure_parakeet() {
+ local d=$cache/parakeet-mlx
+ if [ -f "$d/.ready" ]; then echo "$d/parakeet-mlx"; return; fi
+ local p
+ if p=$(command -v parakeet-mlx 2>/dev/null); then echo "$p"; return; fi
+ [ "${RAEA_AUDIO_AUTOSETUP:-1}" = 0 ] && refuse
+ local uv
+ uv=$(ensure_uv)
+ lock parakeet-mlx
+ if [ ! -f "$d/.ready" ]; then
+ say "installing parakeet-mlx $PARAKEET_VER into $d (its own Python, from uv)"
+ rm -rf "$d" && mkdir -p "$d"
+ # uv's Python and its cache kept beside it, not in ~/.local
+ export UV_PYTHON_INSTALL_DIR=$cache/uv/python UV_CACHE_DIR=$cache/uv/cache
+ "$uv" venv -q --python 3.12 --python-preference only-managed "$d/.venv" >&2
+ VIRTUAL_ENV="$d/.venv" "$uv" pip install -q --python "$d/.venv/bin/python" "parakeet-mlx==$PARAKEET_VER" >&2
+ # parakeet-mlx reads its audio through ffmpeg (-f s16le -ac 1 -ar RATE -), which a clean Mac doesn't have. What
+ # raea hands it is already a mono 16 kHz wav (raea media audio --rate 16000 --mono), so this stand-in answers
+ # that one call from the wav itself, PCM 16 or float 32, and refuses anything it would have to resample
+ mkdir -p "$d/shim"
+ cat >"$d/shim/ffmpeg" <<SHIM
+#!$d/.venv/bin/python
+import struct, sys
+a = sys.argv[1:]
+src = a[a.index("-i") + 1]
+rate = int(a[a.index("-ar") + 1])
+b = open(src, "rb").read()
+if b[:4] != b"RIFF" or b[8:12] != b"WAVE":
+ sys.exit(f"raea's ffmpeg stand-in reads only a wav, not {src}: make one with raea media audio --rate {rate} --mono")
+at, fmt, data = 12, None, None
+while at + 8 <= len(b):
+ kind, n = b[at:at + 4], struct.unpack("<I", b[at + 4:at + 8])[0]
+ if kind == b"fmt ": fmt = struct.unpack("<HHIIHH", b[at + 8:at + 24])
+ elif kind == b"data": data = b[at + 8:at + 8 + n]
+ at += 8 + n + (n & 1)
+code, ch, sr, _, _, bits = fmt
+if sr != rate: sys.exit(f"{src} is {sr} Hz, not {rate}: make it with raea media audio --rate {rate} --mono")
+if code == 1 and bits == 16: s = struct.unpack(f"<{len(data) // 2}h", data)
+elif code == 3 and bits == 32: s = [max(-32768, min(32767, round(v * 32767))) for v in struct.unpack(f"<{len(data) // 4}f", data)]
+else: sys.exit(f"{src}: a wav of format {code}, {bits}-bit, isn't read here")
+if ch > 1: s = [round(sum(s[i:i + ch]) / ch) for i in range(0, len(s) - ch + 1, ch)]
+sys.stdout.buffer.write(struct.pack(f"<{len(s)}h", *s))
+SHIM
+ chmod +x "$d/shim/ffmpeg"
+ cat >"$d/parakeet-mlx" <<WRAP
+#!/bin/sh
+PATH="$d/shim:\$PATH" exec "$d/.venv/bin/parakeet-mlx" "\$@"
+WRAP
+ chmod +x "$d/parakeet-mlx"
+ "$d/parakeet-mlx" --help >/dev/null || { say "the installed parakeet-mlx doesn't run"; exit 1; }
+ # the downloads uv kept are done with (the venv has its own copies)
+ rm -rf "$cache/uv/cache"
+ touch "$d/.ready"
+ fi
+ echo "$d/parakeet-mlx"
+}
+
+case $name in
+ git) ensure_git ;;
+ uv) ensure_uv ;;
+ parakeet-mlx) ensure_parakeet ;;
+ *) say "no tool $name (git, parakeet-mlx, uv)"; exit 2 ;;
+esac
diff --git a/tools/l2.sh b/tools/l2.sh
new file mode 100755
index 00000000..10e55605
--- /dev/null
+++ b/tools/l2.sh
@@ -0,0 +1,121 @@
+#!/bin/bash
+# L2, the orchestrator's post-landing suites (docs/agents.md "Check levels"), run one way every time:
+#
+# tools/l2.sh [SHA] # default: origin/main when it starts
+#
+# - It tests one commit, fixed at the start. Landings go on while it runs; they never restart it. The next run
+# takes whatever landed since.
+# - It runs in its own checkout ($RAEA_L2_DIR, default ~/raea-trial/a), never in ~/raea's shared tree, so no
+# lane's uncommitted edit reaches it. That checkout keeps its target/: a release build without incremental (the
+# reference build), so a new commit rebuilds only the crates that changed.
+# - It resumes: results go to $RAEA_L2_OUT/<sha> (default ~/Library/Caches/raea/l2), and a composition already
+# compared for that commit is skipped. A run that was stopped is started again with the same SHA.
+# - P26 runs one composition at a time and prints a line for each, so an antsy --stall sees progress.
+# - The checkout gets what git doesn't track (media, fonts, solves, node_modules) as links to ~/raea's copies,
+# made once. A link is never made through a linked folder, so nothing is written into ~/raea.
+# - Before building, it sweeps ~/raea's stale debug caches if disk is short, and refuses under 8 GB.
+#
+# Output: one line per step ("L2 <step>: ..."), then "L2 <sha>: P26 a/b, ui-parity c/d, conformance e/f" and
+# $OUT/summary.json. Run it under antsy with a stall of 20 minutes or more (a heavy composition prints after
+# rendering all its frames).
+set -uo pipefail
+ROOT=$HOME/raea
+T=${RAEA_L2_DIR:-$HOME/raea-trial/a}
+git -C "$T" rev-parse --git-dir > /dev/null 2>&1 || { echo "L2: no checkout at $T (git clone ~/raea's origin there)"; exit 2; }
+git -C "$T" fetch -q origin || exit 2
+SHA=$(git -C "$T" rev-parse --short=8 "${1:-origin/main}") || exit 2
+OUT=${RAEA_L2_OUT:-$HOME/Library/Caches/raea/l2}/$SHA
+mkdir -p "$OUT/bin" "$OUT/p26"
+free() { df -g / | awk 'NR==2{print $4}'; }
+say() { echo "L2 $*"; }
+
+# the commit, and the app at that commit's pointer
+git -C "$T" checkout -q -f "$SHA" || exit 2
+[ -z "$(git -C "$T" status --porcelain --untracked-files=no -- . ':!apps/app')" ] || { say "checkout has tracked changes"; exit 2; }
+app=$(git -C "$T" ls-tree HEAD apps/app | awk '{print $3}')
+[ -d "$T/apps/app/.git" ] || { rmdir "$T/apps/app" 2>/dev/null; git clone -q "$ROOT/apps/app" "$T/apps/app" || exit 2; }
+git -C "$T/apps/app" fetch -q "$ROOT/apps/app" && git -C "$T/apps/app" checkout -q -f "$app" || exit 2
+say "commit: $(git -C "$T" log --oneline -1 | cut -c1-90) | app ${app:0:8}"
+
+# what git doesn't track, linked from ~/raea (once; never through a link, never trimming a name)
+links=0; TREAL=$(cd "$T" && pwd -P)
+while IFS= read -r -d '' p; do
+ p=${p%/}
+ case $p in target|target/*|*/target|*/target/*|*.DS_Store) continue ;; esac
+ { [ -e "$T/$p" ] || [ -L "$T/$p" ]; } && continue
+ # the nearest folder of it that exists must resolve inside the checkout (else mkdir or ln writes into ~/raea)
+ up=$(dirname "$p"); while [ "$up" != . ] && [ ! -d "$T/$up" ]; do up=$(dirname "$up"); done
+ case $(cd "$T/$up" && pwd -P)/ in "$TREAL"/*) ;; *) continue ;; esac
+ mkdir -p "$T/$(dirname "$p")" && ln -s "$ROOT/$p" "$T/$p" && links=$((links + 1))
+done < <(git -C "$ROOT" status --porcelain=v1 -z --ignored -- content sdk bench engine 2>/dev/null | tr '\0' '\n' | sed -n 's/^!! //p' | tr '\n' '\0')
+# the app's packages (apps/app is a submodule: its own ignored files aren't in ~/raea's status)
+[ -e "$T/apps/app/node_modules" ] || ln -s "$ROOT/apps/app/node_modules" "$T/apps/app/node_modules"
+# a tracked relative link that climbs out of ~/raea (media/assets/residential -> ../../../../../Assets) resolves
+# from the checkout's parent: give that parent the same folders
+for d in Assets; do [ -e "$(dirname "$T")/$d" ] || [ ! -e "$HOME/$d" ] || ln -s "$HOME/$d" "$(dirname "$T")/$d"; done
+say "links: $links new"
+
+# disk
+if [ "$(free)" -lt 15 ]; then bash "$ROOT/tools/target-sweep.sh" --debug --delete --age 60 --target "$ROOT/target" | tail -1; fi
+[ "$(free)" -ge 8 ] || { say "refused: $(free) GB free (needs 8)"; exit 1; }
+
+# builds (lane stops a hold at 15 minutes; a stopped cargo build resumes where it left off)
+build() {
+ local n=$1; shift
+ for _ in 1 2 3 4 5 6 7 8; do
+ # every 25th crate compiled is a line on stdout: a full release build prints nothing else for half an hour, and
+ # an antsy --stall would stop a compiler that's working (10-27)
+ (cd "$T" && lane build -- env CARGO_INCREMENTAL=0 cargo build --release -j 6 "$@") 2>&1 </dev/null | tee "$OUT/$n.log" |
+ awk -v n="$n" '/^ *Compiling / && ++c % 25 == 0 { print "L2 " n ": " c " crates compiled"; fflush() }'
+ grep -q '^ *Finished' "$OUT/$n.log" && { say "$n: $(grep '^ *Finished' "$OUT/$n.log" | sed 's/^ *//' | cut -c1-90)"; return 0; }
+ grep -qE '^error(\[|:)' "$OUT/$n.log" && { say "$n: FAILED $(grep -m1 -E '^error' "$OUT/$n.log" | cut -c1-120)"; return 1; }
+ say "$n: lane hold ended, resuming"
+ done
+ return 1
+}
+build build-raea -p raea-cli || exit 1
+cp "$T/target/release/raea" "$T/target/release/libraea_bundle.dylib" "$OUT/bin/" || exit 1
+build build-host -p raea-page-host || exit 1
+build build-conformance --manifest-path sdk/ui/conformance/Cargo.toml --target-dir target || exit 1
+build build-parity --manifest-path sdk/ui/parity/Cargo.toml --target-dir target || exit 1
+for b in raea-page-host conformance ui-parity; do cp "$T/target/release/$b" "$OUT/bin/" || exit 1; done
+# P26, one composition at a time, skipping those already compared for this commit
+cd "$T" || exit 2
+# the plugin build's rows go last, after their binary is built, so a long plugin build doesn't hold up the rest
+jq -r 'select(.binary | test("bevy-plugins|bin-avian") | not) | .composition' bench/p26-baseline/manifest.jsonl | awk '!s[$0]++' > "$OUT/p26/all"
+jq -r 'select(.binary | test("bevy-plugins|bin-avian")) | .composition' bench/p26-baseline/manifest.jsonl | awk '!s[$0]++' > "$OUT/p26/plugin"
+p26_rows() { # LIST
+while IFS= read -r c; do
+ n=$(echo "$c" | tr '/#' '__')
+ [ -s "$OUT/p26/$n/results.jsonl" ] && continue
+ rm -rf "$OUT/p26/$n"
+ RAEA_HOME="$T" ONLY="$c" P26_PLUGIN_BIN="$OUT/bin/plugin.sh" P26_OUT="$OUT/p26/$n" \
+ bash bench/p26-baseline/compare.sh "$OUT/bin/raea" </dev/null > "$OUT/p26/$n.log" 2>&1
+ grep -hE '^(ok|MISS)' "$OUT/p26/$n.log" | sed 's/^/L2 p26 /' | cut -c1-200
+ rm -rf "$OUT/p26/$n/frames"
+done < "$1"
+}
+p26_rows "$OUT/p26/all"
+cd "$ROOT" || exit 2
+# the plugin rows' binary, as tools/bevy-plugins.sh builds it for bench/bevy-plugins (motion.sh)
+feats=$(cd "$T" && bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins) || { say "plugin features: failed"; exit 1; }
+build build-plugins -p raea-cli --bin raea-bevy-sdk --features "$feats" || exit 1
+cp "$T/target/release/raea-bevy-sdk" "$OUT/bin/" || exit 1
+printf '#!/bin/sh\nexec %s motion "$@"\n' "$OUT/bin/raea-bevy-sdk" > "$OUT/bin/plugin.sh" && chmod +x "$OUT/bin/plugin.sh"
+cd "$T" || exit 2
+p26_rows "$OUT/p26/plugin"
+# a composition ONLY matched by substring also ran its longer-named neighbours: keep one row per frame
+cat "$OUT"/p26/*/results.jsonl | jq -s 'unique_by(.composition, .frame)' > "$OUT/p26.json"
+p26=$(jq -r '"\(map(select(.pass)) | length)/\(length)"' "$OUT/p26.json")
+jq -r 'map(select(.pass | not)) | .[] | "L2 p26 miss: \(.composition) @\(.frame) \(.ssim)"' "$OUT/p26.json"
+
+# ui-parity full (calib's off-* cases fail by design) and conformance full, on the page host
+RAEA_TS_NATIVE_RESULTS="$OUT/ui-parity/latest.json" "$OUT/bin/ui-parity" run --tier full --jobs 2 --bevy "$OUT/bin/raea-page-host" --out "$OUT/ui-parity" </dev/null > "$OUT/ui-parity.log" 2>&1
+parity=$(jq -rs '"\(map(select(.area != "CALIB" and .pass)) | length)/\(map(select(.area != "CALIB")) | length)"' "$OUT/ui-parity/results.jsonl" 2>/dev/null || echo "no results")
+say "ui-parity: $parity (calibration cases left out)"
+RAEA_FEED_AGENT=echo "$OUT/bin/conformance" --bin "$OUT/bin/raea-page-host" --substrate blitz --tier full --out "$OUT/conformance" </dev/null > "$OUT/conformance.log" 2>&1
+conf=$(jq -r '"\(.pass)/\(.cases)"' "$OUT/conformance/summary.json" 2>/dev/null || echo "no results")
+say "conformance: $conf"
+
+jq -n --arg sha "$SHA" --arg p26 "$p26" --arg parity "$parity" --arg conf "$conf" '{sha: $sha, p26: $p26, ui_parity: $parity, conformance: $conf}' > "$OUT/summary.json"
+echo "L2 $SHA: P26 $p26, ui-parity $parity, conformance $conf"
diff --git a/tools/layers.allow b/tools/layers.allow
new file mode 100644
index 00000000..b5c9f486
--- /dev/null
+++ b/tools/layers.allow
@@ -0,0 +1,2 @@
+# dependencies that break the layers today (tools/layers.sh): this list only shrinks; the split empties it
+
diff --git a/tools/layers.sh b/tools/layers.sh
new file mode 100755
index 00000000..32183f58
--- /dev/null
+++ b/tools/layers.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+# Dependencies point down (docs/overhaul.md, "Layers"). Reads each tracked Cargo.toml of ours, takes its normal and
+# build dependencies on our own crates (dev-dependencies aren't checked: a test may use anything), and fails on an edge
+# that points up, or sideways where the layer doesn't allow it (tools/layers.toml), and on a crate with no layer. The
+# edges wrong today are listed in tools/layers.allow; that list only shrinks, and the split (phase 4) empties it.
+# tools/layers.sh check
+# tools/layers.sh --edges every edge of ours, "from (layer) -> to (layer)", wrong ones marked
+# tools/layers.sh --update tools/layers.allow rewritten to today's wrong edges (refused if one is new)
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+MAP=tools/layers.toml
+ALLOW=tools/layers.allow
+ORDER="core io gpu systems runtime sdk apps tools"
+SIDEWAYS="core io gpu runtime apps tools"
+
+rank() { local i=0 l; for l in $ORDER; do [ "$l" = "$1" ] && { echo $i; return; }; i=$((i + 1)); done; echo -1; }
+layer() { awk -F'"' -v c="$1" '/^\[crates\]/ {s=1; next} /^\[/ {s=0} s && $1 ~ "^"c" *= *$" {print $2}' "$MAP"; }
+facility() { awk -v c="$1" '/^\[facility\]/ {s=1; next} /^\[/ {s=0} s && $1 == c {f=1} END {exit !f}' "$MAP"; }
+
+# "name dir" per crate of ours, from the Cargo.toml files git tracks or would (as tools/size.sh)
+crates() {
+ git ls-files --cached --others --exclude-standard -- '*Cargo.toml' ':!vendor/*' ':!*/vendor/*' | while read -r f; do
+ [ -f "$f" ] || continue
+ n=$(awk -F'"' '/^\[package\]/ {p=1} p && /^name *=/ {print $2; exit}' "$f")
+ [ -n "$n" ] && echo "$n $(dirname "$f")"
+ done
+}
+# the dependency names a Cargo.toml declares outside [dev-dependencies]: `name = ...`, `name.workspace = true` and
+# `[dependencies.name]`, under [dependencies], [build-dependencies] and [target.*.dependencies]
+deps() {
+ awk '
+ /^\[/ { dep = ($0 ~ /^\[(target\..*\.)?(build-)?dependencies\]$/); one = ""
+ if (match($0, /^\[(target\..*\.)?(build-)?dependencies\.[A-Za-z0-9_-]+\]$/)) { s = $0; sub(/^.*dependencies\./, "", s); sub(/\]$/, "", s); print s }
+ next }
+ dep && /^[A-Za-z0-9_-]+(\.workspace)? *=/ { s = $0; sub(/[ .=].*/, "", s); print s }
+ ' "$1" | sort -u
+}
+
+edges() {
+ local list ours
+ list=$(crates)
+ ours=" $(echo "$list" | awk '{print $1}' | tr '\n' ' ') "
+ echo "$list" | while read -r name dir; do
+ for d in $(deps "$dir/Cargo.toml"); do
+ case "$ours" in *" $d "*) [ "$d" != "$name" ] && echo "$name $d" ;; esac
+ done
+ done | sort -u
+}
+
+# "from -> to: why" per wrong edge, and "name: no layer" per unmapped crate
+wrong() {
+ crates | while read -r name _; do [ -n "$(layer "$name")" ] || echo "$name: no layer in $MAP"; done
+ edges | while read -r a b; do
+ la=$(layer "$a"); lb=$(layer "$b")
+ [ -n "$la" ] && [ -n "$lb" ] || continue
+ ra=$(rank "$la"); rb=$(rank "$lb")
+ if [ "$rb" -gt "$ra" ]; then echo "$a -> $b: up ($la -> $lb)"
+ elif [ "$rb" -eq "$ra" ]; then
+ case " $SIDEWAYS " in *" $la "*) ;; *) facility "$b" || echo "$a -> $b: sideways in $la ($b isn't a facility)" ;; esac
+ fi
+ done
+}
+
+if [ "${1:-}" = "--edges" ]; then
+ bad=$(wrong)
+ edges | while read -r a b; do
+ m=$(echo "$bad" | grep -F "$a -> $b:" | sed 's/^[^:]*: / WRONG: /')
+ echo "$a ($(layer "$a")) -> $b ($(layer "$b"))$m"
+ done
+ exit 0
+fi
+now=$(wrong | sort)
+if [ "${1:-}" = "--update" ]; then
+ new=$(comm -23 <(echo "$now" | grep -v '^$') <(grep -v '^#' "$ALLOW" 2>/dev/null | sort))
+ [ -z "$new" ] || [ ! -f "$ALLOW" ] || { echo "layers: refused, these are new:" >&2; echo "$new" >&2; exit 1; }
+ { echo "# dependencies that break the layers today (tools/layers.sh): this list only shrinks; the split empties it"
+ echo "$now"; } > "$ALLOW"
+ echo "layers: $(echo "$now" | grep -c .) wrong today, $ALLOW updated"
+ exit 0
+fi
+new=$(comm -23 <(echo "$now" | grep -v '^$') <(grep -v '^#' "$ALLOW" 2>/dev/null | sort))
+if [ -n "$new" ]; then
+ echo "layers: dependencies that break the layers (docs/overhaul.md):" >&2
+ echo "$new" | sed 's/^/ /' >&2
+ exit 1
+fi
+echo "layers: ok ($(echo "$now" | grep -c .) wrong edges left from before, none new)"
diff --git a/tools/layers.toml b/tools/layers.toml
new file mode 100644
index 00000000..d5783f77
--- /dev/null
+++ b/tools/layers.toml
@@ -0,0 +1,200 @@
+# Each crate of ours and its layer (docs/overhaul.md, "Layers"). tools/layers.sh reads this file. A dependency may
+# point down to a lower layer. Within a layer, it may point sideways only where the layer allows it: core, io,
+# gpu, runtime, apps and tools do; systems don't, except to a crate listed under [facility]. Vendored crates sit
+# below everything. A crate missing from this file fails the check: give every new crate its layer here.
+# The order, lowest first: core io gpu systems runtime sdk apps tools
+
+[crates]
+raea-core-program = "core"
+raea-core-scene = "core"
+raea-core-shape = "core"
+raea-core-meshcheck = "core"
+raea-core-sdf = "core"
+raea-core-grow = "core"
+raea-core-review = "core"
+raea-core-solidinfo = "core"
+raea-core-place = "core"
+raea-shape-web = "runtime"
+raea-web = "runtime"
+raea-core-wire = "core"
+raea-core-alloc = "core"
+raea-io-net = "io"
+raea-io-net-calls = "io"
+raea-io-os = "io"
+# raea's own build: the CLI with the signer installed (private)
+raea-io-trace = "io"
+raea-io-media = "io"
+raea-io-assets = "io"
+raea-io-gen = "io"
+raea-io-gen-comfy = "io"
+raea-io-gen-core = "io"
+raea-io-home = "io"
+raea-io-codec = "io"
+raea-io-soft = "io"
+raea-io-av1 = "io"
+raea-io-ffmpeg = "io"
+raea-io-apple = "io"
+raea-io-apple-coding = "io"
+raea-io-shell = "io"
+raea-core-animate = "core"
+raea-core-ease = "core"
+raea-core-fonts = "core"
+raea-sys-animate = "systems"
+raea-gpu-device = "gpu"
+raea-core-k = "core"
+raea-core-calls = "core"
+raea-core-brief = "core"
+raea-sys-k = "systems"
+raea-sys-mix = "systems"
+raea-sys-tone = "systems"
+raea-seedling = "systems"
+raea-sys-ml = "systems"
+raea-sys-speech = "systems"
+raea-sys-layout = "systems"
+raea-sys-vision = "systems"
+raea-sys-song = "systems"
+raea-sys-perceive = "systems"
+raea-sys-footage = "systems"
+raea-perceive = "tools"
+raea-bridge-bench = "tools"
+raea-bevy-parity = "tools" # Bevy's own examples with the parity probe (docs/control.feature FC0a)
+raea-sys-parity = "systems" # the parity probe, in raea's App and the examples'
+raea-bench-swatch = "systems" # a Blitz widget fixture (bench/bridge/swatch) the plugin catalog declares: a leaf on vendored crates, so a runtime crate may build it in
+raea-render = "runtime"
+raea-render-raytrace = "runtime"
+raea-bevy-plugins = "runtime"
+raea-bevy-calls = "runtime"
+raea-bevy-adapters = "runtime"
+wsx = "systems"
+raea-native = "runtime"
+raea-modules = "runtime"
+raea-io-npm = "io"
+raea-bevy-world = "runtime"
+raea-runtime-js = "runtime"
+raea-runtime-jsengine = "runtime"
+raea-sys-a11y = "systems"
+raea-sys-bake = "systems"
+raea-sys-contact = "systems"
+raea-sys-light-meter = "systems"
+raea-sys-canvas = "systems"
+raea-sys-tweak = "systems"
+raea-sys-filters = "systems"
+raea-sys-wear = "systems"
+raea-sys-procmat = "systems"
+raea-sys-grass = "systems"
+raea-sys-page = "systems"
+raea-sys-page-net = "systems"
+raea-sys-frame = "systems"
+raea-sys-splat = "systems"
+raea-sys-sprite = "systems"
+raea-sys-rt = "systems"
+raea-sys-text3d = "systems"
+raea-runtime-gpuframe = "runtime"
+raea-runtime-scene3d = "runtime"
+raea-sys-screen = "systems"
+raea-sys-matchmove = "systems"
+raea-sys-grid = "systems"
+raea-sys-meshseq = "systems"
+raea-sys-environment = "systems"
+raea-sys-look = "systems"
+raea-sys-compose = "systems"
+raea-sys-material = "systems"
+raea-sys-framepass = "systems"
+raea-sys-compute = "systems"
+raea-sys-sampler = "systems"
+raea-sys-shader = "systems"
+raea-sys-three-shader = "systems"
+raea-sys-post = "systems"
+raea-sys-fog = "systems"
+raea-sys-fog-half = "systems"
+raea-sys-volume = "systems"
+raea-sys-fonts = "systems"
+raea-sys-image = "systems"
+raea-runtime-twins = "runtime"
+raea-runtime-dom = "runtime"
+raea-runtime-edit = "runtime"
+raea-runtime-input = "runtime"
+raea-runtime-bake = "runtime"
+raea-runtime-bundle = "runtime"
+raea-runtime-bundle-lib = "runtime"
+raea-runtime-calls = "runtime"
+raea-runtime-export = "runtime"
+raea-runtime-page = "runtime"
+raea-runtime-sound = "runtime"
+raea-runtime-view = "runtime"
+raea-runtime-encode = "runtime"
+raea-runtime-plugins = "runtime"
+raea-runtime-live = "runtime"
+raea-runtime-look = "runtime"
+raea-runtime-scene = "runtime"
+raea-runtime-shared = "runtime"
+raea-page = "runtime"
+raea-app-check = "apps"
+raea-app-ci = "apps"
+raea-app-tools = "apps"
+raea-app-judge = "apps"
+raea-app-solid = "apps"
+raea-app-media = "apps"
+raea-app-targets = "apps"
+raea-app-game = "apps"
+raea-app-play = "apps"
+raea-page-host = "runtime"
+raea-rune-host = "runtime"
+raea-rune-page = "runtime"
+raea-rune-media = "runtime"
+raea-rune-look = "runtime"
+raea-rune-style = "runtime"
+raea-rune-js = "runtime"
+raea-rune-bevy = "runtime"
+raea-page-stage = "runtime"
+raea-page-window = "runtime"
+raea-runtime-react = "runtime"
+raea-cli = "apps"
+raea-neural = "runtime"
+raea-app-workspace = "apps"
+raea-bundle = "apps"
+raea-sdk-props = "tools"
+conformance = "tools"
+ui-parity = "tools"
+ui-parity-compare = "tools"
+conformance-fake = "tools"
+rtools = "tools"
+seetool = "tools"
+
+# systems that hold only a facility another system may build on (docs/overhaul.md: the mixer graph, ONNX sessions,
+# Vision requests, K kernels on the GPU)
+[facility]
+# the frame's rows every pass reads (FrameRows, the edit, the clock, row helpers)
+raea-sys-frame = true
+# a row's standard material and its maps (meshseq builds its mesh's on it)
+raea-sys-material = true
+# how a texture is read (materials, shaders and models set it the same way)
+raea-sys-sampler = true
+# a shader's inputs, accessors and registration (surface shaders and frame passes share them)
+raea-sys-shader = true
+# the pass mask (looks and the paint look read which pass drew each pixel)
+raea-sys-compose = true
+# ink outlines (the frame's look sets its camera's)
+raea-sys-post = true
+# the froxel grid and glass fogged through it (looks and greybox surfaces keep a mesh's fog copy)
+raea-sys-fog = true
+# simulated volumes (a fire row with a sim is one)
+raea-sys-volume = true
+# the scene's ray tracing (the traced-light pass reads its scene)
+raea-sys-rt = true
+raea-sys-mix = true
+raea-sys-tone = true
+raea-sys-ml = true
+raea-sys-layout = true
+raea-sys-vision = true
+raea-sys-song = true
+raea-sys-k = true
+raea-sys-wear = true
+raea-sys-procmat = true
+raea-sys-canvas = true
+raea-sys-filters = true
+raea-sys-page = true
+# a page's loads (raea-sys-page's net)
+raea-sys-page-net = true
+raea-sys-fonts = true
+raea-sys-image = true
diff --git a/tools/licenses.sh b/tools/licenses.sh
new file mode 100755
index 00000000..1de17a44
--- /dev/null
+++ b/tools/licenses.sh
@@ -0,0 +1,134 @@
+#!/bin/bash
+# The plugin catalog's and the native host's third-party crates' licences (docs/release.feature RL2). The catalog (engine/bevy-plugins, every
+# declared plugin on) pulls in crates a plain raea build doesn't; each of those ships in the public tree with its own
+# licence files, copied from its source into LICENSES/<crate>-<version>/, and is listed in NOTICE between the markers
+# below, with its version and licence expression. A crate that ships no licence file gets LICENSE.txt naming the
+# expression its Cargo.toml declares. raea's own crates and vendor/ (each folder keeps its licence) aren't listed.
+#
+# tools/licenses.sh write LICENSES/ and NOTICE's catalog section
+# tools/licenses.sh --check exit 1 when they differ from what the lock resolves to (after a plugin is added)
+#
+# Nothing is built: cargo metadata resolves the workspace twice (every catalog feature, then none) from Cargo.lock.
+set -euo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT"
+check=0
+[ "${1:-}" = --check ] && check=1
+BEGIN="---- the plugin catalog's crates (tools/licenses.sh; don't edit by hand) ----"
+END="---- end of the plugin catalog's crates ----"
+
+tmp=$(mktemp -d)
+trap 'rm -rf "$tmp"' EXIT
+feats=$(sed -n '/^\[features\]/,/^\[/p' engine/bevy-plugins/Cargo.toml | grep -oE '^[a-z0-9_]+ =' | cut -d' ' -f1 | grep -v '^default$' | sed 's|^|raea-bevy-plugins/|' | paste -sd, -)
+cargo metadata --format-version 1 --locked --offline --features "$feats" > "$tmp/all.json"
+cargo metadata --format-version 1 --locked --offline > "$tmp/base.json"
+
+# the package ids reachable from ROOT's crate in a resolve
+reach='(.resolve.nodes | map({key: .id, value: [.deps[]?.pkg]}) | from_entries) as $n
+ | (.packages | map(select(.name == $root)) | .[0].id) as $r
+ | {seen: [$r], todo: [$r]}
+ | until(.todo == []; ([.todo[] as $id | $n[$id][]] | unique) as $next | ($next - .seen) as $new | {seen: (.seen + $new), todo: $new})
+ | .seen[]'
+# and the native target's host (engine/rune: Rune and its crates), which ships beside raea (docs/targets.feature T1f)
+{ jq -r --arg root raea-bevy-plugins "$reach" "$tmp/all.json"; jq -r --arg root raea-rune-host "$reach" "$tmp/base.json"; } | sort -u > "$tmp/catalog"
+jq -r --arg root raea-cli "$reach" "$tmp/base.json" | sort > "$tmp/raea"
+# third-party only (registry or git): raea's crates and vendor/ are path crates
+comm -23 "$tmp/catalog" "$tmp/raea" | grep -E '^(registry|git)\+' > "$tmp/ids" || true
+jq -c --slurpfile ids <(jq -R . "$tmp/ids") '.packages[] | select(.id as $i | $ids | index($i)) | {name, version, license, license_file, authors: ((.authors // []) | if length == 0 then "its authors" else join(", ") end), dir: (.manifest_path | sub("/Cargo.toml$"; ""))}' "$tmp/all.json" | sort > "$tmp/crates"
+
+# a crate with no licence file of its own: its declared licence's texts, MIT's and Zlib's with its authors as the
+# copyright holders (as each template asks), the others' (fixed texts, no holder in them) in LICENSES/texts/
+fallback() { # NAME VERSION EXPRESSION AUTHORS
+ local id
+ printf '%s %s ships no licence file of its own. Its Cargo.toml declares %s, by %s.\n' "$1" "$2" "$3" "$4"
+ for id in $(grep -oE '[A-Za-z][A-Za-z0-9.-]*' <<<"$3" | grep -vxE 'OR|AND|WITH' | sort -u); do
+ case $id in
+ MIT) printf '\n---- MIT ----\n\nCopyright (c) %s\n\n' "$4"; cat <<'MIT' ;;
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+MIT
+ Zlib) printf '\n---- Zlib ----\n\nCopyright (c) %s\n\n' "$4"; cat <<'ZLIB' ;;
+This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
+liable for any damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter
+it and redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If
+ you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not
+ required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original
+ software.
+3. This notice may not be removed or altered from any source distribution.
+ZLIB
+ Apache-2.0|MPL-2.0|BSL-1.0) printf '\n---- %s: the text is LICENSES/texts/%s.txt ----\n' "$id" "$id"; cp "$ROOT/tools/licenses/$id.txt" "$out/LICENSES/texts/" ;;
+ *) printf '\n---- %s: its text ships beside the files it covers (see this crate'"'"'s source) ----\n' "$id" ;;
+ esac
+ done
+}
+
+out=$tmp/out
+mkdir -p "$out/LICENSES/texts"
+{
+ echo "$BEGIN"
+ echo "The plugin catalog (engine/bevy-plugins, built with tools/bevy-plugins.sh) and the native target's host (engine/rune,"
+ echo "raea-rune-host) bring in these crates beyond raea's own build. Each is under its own licence, its files in"
+ echo "LICENSES/<crate>-<version>/."
+ while read -r c; do
+ name=$(jq -r .name <<<"$c") version=$(jq -r .version <<<"$c") dir=$(jq -r .dir <<<"$c")
+ lic=$(jq -r '.license // ("see " + (.license_file // "its source"))' <<<"$c")
+ d=$out/LICENSES/$name-$version
+ mkdir -p "$d"
+ found=0
+ while IFS= read -r f; do
+ cp "$f" "$d/" && found=1
+ done < <(find "$dir" -maxdepth 1 -type f \( -iname 'LICEN[CS]E*' -o -iname 'COPYING*' -o -iname 'NOTICE*' -o -iname 'UNLICENSE*' -o -iname 'COPYRIGHT*' \) | sort)
+ # a crate from a git checkout (Rune's): its repository's licence too, at the checkout's root above the crate's folder
+ case $dir in */checkouts/*/*/*)
+ while IFS= read -r f; do
+ cp "$f" "$d/repository-$(basename "$f")" && found=1
+ done < <(find "$(sed -E 's#(.*/checkouts/[^/]+/[^/]+)/.*#\1#' <<<"$dir")" -maxdepth 1 -type f \( -iname 'LICEN[CS]E*' -o -iname 'COPYING*' \) | sort) ;;
+ esac
+ lf=$(jq -r '.license_file // empty' <<<"$c")
+ [ -n "$lf" ] && [ -f "$dir/$lf" ] && cp "$dir/$lf" "$d/" && found=1
+ # licences beside what they cover, in a folder of their own (fonts: OFL, the Ubuntu Font Licence)
+ while IFS= read -r f; do
+ cp "$f" "$d/$(basename "$(dirname "$f")")-$(basename "$f")" && found=1
+ done < <(find "$dir" -mindepth 2 -maxdepth 3 -type f \( -iname 'OFL*.txt' -o -iname 'UFL*.txt' -o -iname '*licen[cs]e*.txt' \) -not -path '*/tests/*' | sort)
+ [ $found = 1 ] || fallback "$name" "$version" "$lic" "$(jq -r .authors <<<"$c")" > "$d/LICENSE.txt"
+ echo " $name $version: $lic"
+ done < "$tmp/crates"
+ echo "$END"
+} > "$out/section"
+
+# NOTICE: the section replaced (or added after the rest)
+notice() {
+ if grep -qF -- "$BEGIN" NOTICE; then
+ awk -v b="$BEGIN" -v e="$END" -v s="$out/section" '$0 == b { while ((getline l < s) > 0) print l; skip = 1; next } $0 == e { skip = 0; next } !skip' NOTICE
+ else
+ cat NOTICE; echo; cat "$out/section"
+ fi
+}
+notice > "$out/NOTICE"
+
+if [ $check = 1 ]; then
+ status=0
+ cmp -s "$out/NOTICE" NOTICE || { echo "licenses: NOTICE's catalog section is stale"; status=1; }
+ diff -rq "$out/LICENSES" LICENSES > "$tmp/diff" 2>&1 || { echo "licenses: LICENSES/ differs:"; head -10 "$tmp/diff"; status=1; }
+ [ $status = 0 ] && echo "licenses: ok ($(wc -l < "$tmp/crates" | tr -d ' ') catalog crates)"
+ exit $status
+fi
+rm -rf LICENSES
+cp -R "$out/LICENSES" LICENSES
+cp "$out/NOTICE" NOTICE
+echo "licenses: $(wc -l < "$tmp/crates" | tr -d ' ') catalog crates into LICENSES/ and NOTICE ($(du -sh LICENSES | cut -f1))"
diff --git a/tools/licenses/Apache-2.0.txt b/tools/licenses/Apache-2.0.txt
new file mode 100644
index 00000000..d9a10c0d
--- /dev/null
+++ b/tools/licenses/Apache-2.0.txt
@@ -0,0 +1,176 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/tools/licenses/BSL-1.0.txt b/tools/licenses/BSL-1.0.txt
new file mode 100644
index 00000000..36b7cd93
--- /dev/null
+++ b/tools/licenses/BSL-1.0.txt
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/tools/licenses/MPL-2.0.txt b/tools/licenses/MPL-2.0.txt
new file mode 100644
index 00000000..d8b475b6
--- /dev/null
+++ b/tools/licenses/MPL-2.0.txt
@@ -0,0 +1,374 @@
+ Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+means each individual or legal entity that creates, contributes to
+the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+means the combination of the Contributions of others (if any) used
+by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+means Source Code Form to which the initial Contributor has attached
+the notice in Exhibit A, the Executable Form of such Source Code
+Form, and Modifications of such Source Code Form, in each case
+including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+means
+
+(a) that the initial Contributor has attached the notice described
+in Exhibit B to the Covered Software; or
+
+(b) that the Covered Software was made available under the terms of
+version 1.1 or earlier of the License, but not also under the
+terms of a Secondary License.
+
+1.6. "Executable Form"
+means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+means a work that combines Covered Software with other material, in
+a separate file or files, that is not Covered Software.
+
+1.8. "License"
+means this document.
+
+1.9. "Licensable"
+means having the right to grant, to the maximum extent possible,
+whether at the time of the initial grant or subsequently, any and
+all of the rights conveyed by this License.
+
+1.10. "Modifications"
+means any of the following:
+
+(a) any file in Source Code Form that results from an addition to,
+deletion from, or modification of the contents of Covered
+Software; or
+
+(b) any new file in Source Code Form that contains any Covered
+Software.
+
+1.11. "Patent Claims" of a Contributor
+means any patent claim(s), including without limitation, method,
+process, and apparatus claims, in any patent Licensable by such
+Contributor that would be infringed, but for the grant of the
+License, by the making, using, selling, offering for sale, having
+made, import, or transfer of either its Contributions or its
+Contributor Version.
+
+1.12. "Secondary License"
+means either the GNU General Public License, Version 2.0, the GNU
+Lesser General Public License, Version 2.1, the GNU Affero General
+Public License, Version 3.0, or any later versions of those
+licenses.
+
+1.13. "Source Code Form"
+means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+means an individual or a legal entity exercising rights under this
+License. For legal entities, "You" includes any entity that
+controls, is controlled by, or is under common control with You. For
+purposes of this definition, "control" means (a) the power, direct
+or indirect, to cause the direction or management of such entity,
+whether by contract or otherwise, or (b) ownership of more than
+fifty percent (50%) of the outstanding shares or beneficial
+ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+Licensable by such Contributor to use, reproduce, make available,
+modify, display, perform, distribute, and otherwise exploit its
+Contributions, either on an unmodified basis, with Modifications, or
+as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+for sale, have made, import, and otherwise transfer either its
+Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+or
+
+(b) for infringements caused by: (i) Your and any other third party's
+modifications of Covered Software, or (ii) the combination of its
+Contributions with other software (except as part of its Contributor
+Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+Form, as described in Section 3.1, and You must inform recipients of
+the Executable Form how they can obtain a copy of such Source Code
+Form by reasonable means in a timely manner, at a charge no more
+than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+License, or sublicense it under different terms, provided that the
+license for the Executable Form does not attempt to limit or alter
+the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+This Source Code Form is subject to the terms of the Mozilla Public
+License, v. 2.0. If a copy of the MPL was not distributed with this
+file, You can obtain one at https://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+This Source Code Form is "Incompatible With Secondary Licenses", as
+defined by the Mozilla Public License, v. 2.0.
+
diff --git a/tools/linux-check.sh b/tools/linux-check.sh
new file mode 100755
index 00000000..245d20a3
--- /dev/null
+++ b/tools/linux-check.sh
@@ -0,0 +1,213 @@
+#!/bin/bash
+# PT8, the Linux check after landing (docs/ports.feature): `cargo check` of raea-cli, and of raea-render without its
+# default features, for x86_64 Linux on the probe box (Fly Sprite raea-kimi), so an Apple-only call outside a cfg is
+# caught the day it lands.
+#
+# tools/linux-check.sh [SHA] # default: origin/main
+# tools/linux-check.sh --release VERSION [SHA] [--dry] # RL3: the Linux tarball, built and tried there
+#
+# --release builds raea as the macOS release does, `raea-cli --bin raea --no-default-features` with the plugin catalog's
+# features (tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins), with the dist profile (--dry: LTO off, debug 0)
+# in the probe box's ubuntu:24.04 root, /srv/noble (debootstrapped with the build's -dev packages and rustup; target
+# /srv/noble-target), so the tarball needs glibc 2.39, not the probe box's own 2.43; the app targets' two hosts too,
+# raea-rune-host and raea-page-host's window build, in a cargo call each (docs/targets.feature T1f). Then tools/release.sh VERSION,
+# and RL3's three steps on the unpacked tarball (raea init, a render of the template as a frame and as MP4, raea play
+# of the bench's pong offscreen) in a private network and mount namespace: no network but loopback, ~/raea, the
+# worktree and ~/.raea under empty tmpfs, env -i with an empty HOME and raea's API at a closed port. The tarball stays
+# in the worktree's dist/ on the probe box.
+#
+# - A Mac cross check would need a Linux sysroot: twelve -sys crates' build scripts compile C (alsa, udev, fontconfig,
+# sqlite, openh264, opus, oniguruma, ring, psm, rquickjs, wasmtime, raea-runtime-react's build.rs). So it is an
+# after-land check on the probe box, not an L1 gate; a failure goes back to the lane that landed the commit.
+# - The commit goes over as a git bundle on `sprite exec` stdin (the probe box can't reach the private repo), cut
+# against the commits the probe box already has. It is checked out in its own worktree (~/linux-check, target
+# ~/linux-check-target, kept warm), never in the probe box's ~/raea.
+# - Output: one line a step ("linux <step>: ..."), the first errors, then "linux <sha>: ok" (exit 0), "FAILED" (exit 1)
+# or, when the connection to the probe box dropped first, "lost the probe box" (exit 2, run it again).
+# Run it under antsy with a stall of 20 minutes (a cold target builds every build script before printing).
+# - Memory: the probe box has 8 GB and is shared with kpop's relay (Shane's cloud agent), and running it out of memory
+# restarts the whole box (10-29: the release build at 7 jobs with thin LTO did). Every cargo here runs under a floor:
+# its process group is killed once the memory left falls below RAEA_LINUX_FLOOR_MB (default 1536), so the worst case
+# is a failed build ("stopped at N MB"), never a restarted box. Memory left is MemTotal less the root cgroup's anon
+# and kernel memory (memory.stat): the box's /proc/meminfo is synthetic (MemFree 0, MemAvailable equal to Cached and
+# past MemTotal), so MemAvailable never falls. The box allows no cgroup memory limit (its root
+# cgroup's subtree_control refuses +memory) and has no systemd, and ulimit -v caps each rustc's address space, which
+# LLVM reserves far past what it uses, not the sum. The release build runs 4 jobs, a dry run 7.
+set -uo pipefail
+cd "$(dirname "$0")/.."
+S=(-o "${RAEA_SPRITE_ORG:-kamal-hafid}" -s "${RAEA_SPRITE:-raea-kimi}")
+say() { echo "linux $*"; }
+git fetch -q origin 2> /dev/null
+mode=check version= dry=
+if [ "${1:-}" = --release ]; then
+ mode=release; version=${2:?usage: linux-check.sh --release VERSION [SHA] [--dry]}; shift 2
+ [ "${2:-${1:-}}" = --dry ] && dry=1
+ [ "${1:-}" = --dry ] && set -- "${@:2}"
+fi
+SHA=$(git rev-parse --short=9 "${1:-origin/main}^{commit}") || exit 2
+REF=refs/linux-check/$SHA
+
+# what the probe box has: every commit its refs point at that this repo knows, as the bundle's basis
+basis=()
+for c in $(sprite exec --no-stdin "${S[@]}" -- bash -c 'git -C ~/raea for-each-ref --format="%(objectname)"' 2> /dev/null | sort -u); do
+ git cat-file -e "$c^{commit}" 2> /dev/null && basis+=("^$c")
+done
+FULL=$(git rev-parse "$SHA")
+if sprite exec --no-stdin "${S[@]}" -- bash -c "git -C ~/raea cat-file -e $FULL^{commit} && git -C ~/raea update-ref $REF $FULL" 2> /dev/null; then
+ say "sent: $SHA (the probe box had it)"
+else
+ git update-ref "$REF" "$SHA" || exit 2
+ git bundle create -q - "$REF" ${basis[@]+"${basis[@]}"} \
+ | sprite exec "${S[@]}" -- bash -c "cat > ~/linux-check.bundle && git -C ~/raea fetch -q ~/linux-check.bundle '+$REF:$REF' && rm ~/linux-check.bundle"
+ sent=$?
+ git update-ref -d "$REF"
+ [ $sent = 0 ] || { say "$SHA: the bundle didn't reach the probe box"; exit 2; }
+ say "sent: $SHA (${#basis[@]} commits as the basis)"
+fi
+
+# The check runs detached on the probe box and this session follows its log: cargo killed mid-write by a dropped
+# connection leaves invalid metadata (E0786) in the target. Run again after a drop and it attaches to the same check.
+cat <<'EOF' | sprite exec "${S[@]}" -- bash -c 'cat > ~/linux-check-run.sh' || { say "$SHA: couldn't reach the probe box"; exit 2; }
+set -uo pipefail
+W=~/linux-check
+[ -d $W ] || git -C ~/raea worktree add -q --detach $W "$1" || exit 2
+git -C $W checkout -q --detach "$1" && git -C ~/raea update-ref -d "$1" || exit 2
+echo "linux checkout: $(git -C $W log -1 --format='%h %s' | cut -c1-90)"
+ok=0
+# CMD... in its own process group, killed whole when the box's available memory falls below the floor (see the header).
+# Its group isn't the runner's, so stopping the runner stops it too (canary.2's cargo outlived a stopped runner).
+GUARDED=
+trap '[ -n "$GUARDED" ] && sudo kill -KILL -- -$GUARDED 2> /dev/null; exit 143' TERM INT HUP
+guarded() {
+ local floor=${RAEA_LINUX_FLOOR_MB:-1536} low= avail
+ setsid "$@" &
+ local pg=$!
+ GUARDED=$pg
+ while [ -d /proc/$pg ]; do
+ avail=$(( $(awk '/^MemTotal:/ {print $2}' /proc/meminfo) / 1024 - $(awk '$1 == "anon" || $1 == "kernel" {s += $2} END {print int(s / 1048576)}' /sys/fs/cgroup/memory.stat) ))
+ if [ "$avail" -lt "$floor" ]; then
+ low=$avail; sudo kill -KILL -- -$pg; break
+ fi
+ sleep 0.5
+ done
+ wait $pg; local code=$?
+ [ -z "$low" ] || { echo "linux: stopped at $low MB of memory available (floor $floor MB)"; return 1; }
+ return $code
+}
+if [ "$2" = release ]; then
+ V=${3:?version}; N=/srv/noble; T=/srv/noble-target; R=/tmp/linux-release
+ free=$(df -BG --output=avail / | tail -1 | tr -dc 0-9)
+ [ "$free" -ge 15 ] || { echo "linux refused: ${free} GB free (needs 15)"; echo "linux done 2"; exit 2; }
+ # the runtime's packages, which release.sh copies in
+ for d in sdk/react/js sdk/react/tw; do (cd "$W/$d" && bun install --frozen-lockfile 2>&1 | tail -1); done
+ sudo mkdir -p "$N/.sprite" "$N/rel" "$N$HOME/raea"
+ mountpoint -q "$N/.sprite" || sudo mount --bind -o ro /.sprite "$N/.sprite"
+ for d in proc sys dev; do mountpoint -q "$N/$d" || sudo mount --bind "/$d" "$N/$d"; done
+ # /rel is this worktree every time (an earlier run's mount may name another), and its .git's ~/raea resolves too
+ mountpoint -q "$N/rel" && sudo umount "$N/rel"
+ sudo mount --bind "$W" "$N/rel" || exit 2
+ mountpoint -q "$N$HOME/raea" || sudo mount --bind -o ro "$HOME/raea" "$N$HOME/raea"
+ mountpoint -q "$N/target" || sudo mount --bind "$T" "$N/target"
+ slim=; [ -n "${4:-}" ] && slim="CARGO_PROFILE_DIST_LTO=off CARGO_PROFILE_DIST_DEBUG=0 CARGO_PROFILE_DIST_INCREMENTAL=false"
+ # the probe box has 8 GB: 7 jobs with thin LTO ran it out of memory and restarted it (10-29, canary.2's first try)
+ jobs=7; [ -z "$slim" ] && jobs=4
+ # RAEA_LINUX_DIST_ENV: profile overrides for a release build the box's memory can't hold as the dist profile has it
+ # (canary.2: CARGO_PROFILE_DIST_DEBUG=0, since debug info is most of the final link's memory; the symbol table stays,
+ # so the unstripped binary still names functions), and RAEA_LINUX_JOBS its job count
+ [ -z "$slim" ] && slim=${RAEA_LINUX_DIST_ENV:-}; [ -n "${RAEA_LINUX_JOBS:-}" ] && jobs=$RAEA_LINUX_JOBS
+ # the plugin catalog, as the macOS release has it (all 57 check on Linux, 10-29)
+ feat=$(cd "$W" && bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins) && [ -n "$feat" ] || { echo "linux: no catalog features"; echo "linux done 1"; exit 1; }
+ echo "linux catalog: $(tr , '\n' <<< "$feat" | wc -l) features"
+ # the pinned toolchain's own bin first: without rustup's proxies (/root/.cargo/bin, gone by 11-06) cargo was the
+ # probe box's, which doesn't run in the root
+ tc=/root/.rustup/toolchains/$(sed -n 's/^channel *= *"\(.*\)"/\1/p' "$W/rust-toolchain.toml")-x86_64-unknown-linux-gnu/bin
+ sudo test -x "$N$tc/cargo" || { echo "linux: no cargo at $N$tc"; echo "linux done 1"; exit 1; }
+ # the probe box's resolver, so cargo can fetch a git dependency (11-06: rav1d's github.com didn't resolve in the root)
+ sudo cp --remove-destination /etc/resolv.conf "$N/etc/resolv.conf" # its own is a dangling link
+ guarded sudo chroot "$N" bash -c "export PATH=$tc:/root/.cargo/bin:/.sprite/bin:\$PATH CARGO_TARGET_DIR=/target $slim
+ git config --global --add safe.directory /rel; git config --global --add safe.directory $HOME/raea
+ cd /rel && cargo build --profile dist --locked -j $jobs -p raea-cli --bin raea --no-default-features --features '$feat' 2>&1 | tee /target/dist-build.log | grep --line-buffered -E '^ *Compiling|^error|Finished'"
+ grep -q '^ *Finished' "$T/dist-build.log" || { grep -E '^error' -A8 "$T/dist-build.log" | head -40; tail -3 "$T/dist-build.log"; echo "linux done 1"; exit 1; }
+ # the app targets' hosts (docs/targets.feature T1f), each in a cargo call of its own: with raea-cli's crates in one
+ # call taffy's features unify and rune-taffy doesn't build
+ for h in raea-rune-host 'raea-page-host --features window'; do
+ guarded sudo chroot "$N" bash -c "export PATH=$tc:/root/.cargo/bin:/.sprite/bin:\$PATH CARGO_TARGET_DIR=/target $slim
+ cd /rel && cargo build --profile dist --locked -j $jobs -p $h 2>&1 | tee /target/host-build.log | grep --line-buffered -E '^error|Finished'"
+ grep -q '^ *Finished' "$T/host-build.log" || { grep -E '^error' -A8 "$T/host-build.log" | head -40; tail -3 "$T/host-build.log"; echo "linux done 1"; exit 1; }
+ done
+ for b in raea raea-rune-host raea-page-host; do
+ glibc=$(objdump -T "$T/dist/$b" | grep -o 'GLIBC_[0-9.]*' | sort -uV | tail -1)
+ echo "linux build: $b $glibc${4:+ (dry-run profile)}"
+ [ "$(printf '%s\n' "$glibc" GLIBC_2.39 | sort -V | tail -1)" = GLIBC_2.39 ] || { echo "linux: $b needs $glibc, past 2.39"; echo "linux done 1"; exit 1; }
+ done
+ # the tarball's binaries stripped, from copies (the target's stay as cargo wrote them); the unstripped ones are kept
+ # on the probe box for symbolicating a release's backtraces, never shipped
+ ship=$T/ship; sym=$HOME/raea-dist-symbols/$V
+ rm -rf "${ship:?}"; mkdir -p "$ship" "$sym"
+ bins=("$T/dist/raea" "$T/dist/libraea_bundle.so" "$T/dist/raea-rune-host" "$T/dist/raea-page-host")
+ sudo cp "${bins[@]}" "$sym/" && sudo cp "${bins[@]}" "$ship/" && sudo chown "$(id -un)" "$ship"/* "$sym"/* \
+ && strip "$ship/raea" "$ship/raea-rune-host" "$ship/raea-page-host" && strip --strip-unneeded "$ship/libraea_bundle.so" \
+ || { echo "linux: strip failed"; echo "linux done 1"; exit 1; }
+ echo "linux strip: raea $(du -h "$sym/raea" | cut -f1) to $(du -h "$ship/raea" | cut -f1); unstripped in $sym"
+ cd "$W" && zsh tools/release.sh "$V" "$ship" HEAD || { echo "linux done 1"; exit 1; }
+ tgz=$W/dist/raea-$V-linux-x86_64.tar.gz
+ [ -s "${tgz:?}" ] || { echo "linux: no tarball"; echo "linux done 1"; exit 1; }
+ rm -rf "${R:?}"; mkdir -p "$R/home" "$R/p" "$R/game"
+ tar -xzf "$tgz" -C "$R" && cp -R "$W/sdk/react/bench/games/pong/." "$R/game/"
+ clean() { # DIR ARGS...: raea in DIR as a fresh user
+ local dir=$1; shift
+ sudo unshare -n -m --propagation private bash -c '
+ ip link set lo up 2> /dev/null
+ for d in "$1/raea" "$1/linux-check" "$1/.raea"; do [ -d "$d" ] && mount -t tmpfs none "$d"; done
+ r=$3; cd "$2" && shift 3 && exec sudo -u "$SUDO_USER" env -i PATH=/usr/bin:/bin HOME="$r/home" RAEA_NO_TREE=1 RAEA_API=http://127.0.0.1:9 RAEA_GEN_API=http://127.0.0.1:9 "$r/raea/bin/raea" "$@"' -- "$HOME" "$dir" "$R" "$@"
+ }
+ step() { # NAME DIR ARGS...
+ local n=$1 t0; shift; t0=$(date +%s)
+ clean "$@" > "$R/$n.log" 2>&1; local code=$?
+ echo "linux $n: exit $code, $(( $(date +%s) - t0 ))s"; grep -v -E 'ALSA|^\s*$' "$R/$n.log" | tail -2 | cut -c1-160
+ [ $code = 0 ] || ok=1
+ }
+ step init "$R/p" init
+ step render-frame "$R/p" render edit.tsx --frame 15 -o card.png
+ step render-mp4 "$R/p" render edit.tsx -o edit.mp4
+ step play "$R/game" play edit.tsx --offscreen --seconds 2 --size 540x960 --snapshot 1 snap.png
+ # a raea/bevy program on the catalog: a headless App with avian and bevy, stepped, printing its frame
+ # (raea run calls the script's default export; print is raea's stdout)
+ mkdir -p "$R/bevy" && printf '%s\n' 'import { BevyApp } from "raea/bevy";' 'import { print } from "raea/native";' 'export default function main() {' \
+ ' const app = BevyApp.open({ plugins: ["avian", "bevy"] });' ' const frame = app.step(30);' ' app.close();' \
+ ' if (!(frame >= 30)) throw new Error(`stepped to ${frame}`);' ' print(`bevy ok: frame ${frame}`);' '}' > "$R/bevy/check.ts"
+ step bevy "$R/bevy" run check.ts
+ grep -q '^bevy ok' "$R/bevy.log" || { echo "linux: the BevyApp program didn't finish"; ok=1; }
+ for f in "$R/p/card.png" "$R/p/edit.mp4" "$R/game/snap.png"; do [ -s "$f" ] || { echo "linux: no $f"; ok=1; }; done
+ echo "linux tarball: $tgz ($(du -h "$tgz" | cut -f1))"
+ echo "linux done $ok"; exit $ok
+fi
+cd $W && export CARGO_TARGET_DIR=~/linux-check-target
+for args in '-p raea-cli' '-p raea-render --no-default-features'; do
+ t0=$(date +%s)
+ guarded bash -c "cargo check $args -j 7 --message-format short > ~/linux-check.out 2>&1"
+ code=$?
+ grep -E '^(error|[^ ]+:[0-9]+:[0-9]+: error)' ~/linux-check.out | head -20 > ~/linux-check.err
+ echo "linux cargo check $args: exit $code, $(( $(date +%s) - t0 ))s"
+ cat ~/linux-check.err
+ [ $code = 0 ] || ok=1
+done
+echo "linux done $ok"
+EOF
+sprite exec --no-stdin "${S[@]}" -- bash -lc "
+ P=\$(cat ~/linux-check.pid 2> /dev/null)
+ if [ -n \"\$P\" ] && kill -0 \$P 2> /dev/null; then
+ [ \"\$(cat ~/linux-check.sha)\" = $SHA ] || { echo \"linux busy: checking \$(cat ~/linux-check.sha)\"; exit 2; }
+ echo 'linux attached to the running check'
+ else
+ echo $SHA > ~/linux-check.sha
+ # from a subshell, so init adopts and reaps the runner: as this shell's child it would stay a zombie under tail,
+ # and tail --pid would never see it end
+ ( RAEA_LINUX_DIST_ENV='${RAEA_LINUX_DIST_ENV:-}' RAEA_LINUX_JOBS='${RAEA_LINUX_JOBS:-}' setsid nohup bash ~/linux-check-run.sh '$REF' $mode '$version' '$dry' > ~/linux-check.log 2>&1 < /dev/null & echo \$! > ~/linux-check.pid )
+ fi
+ tail -n +1 --pid=\$(cat ~/linux-check.pid) -f ~/linux-check.log
+" 2> /dev/null | tee /dev/stderr | grep -q '^linux done 0$'
+code=(${PIPESTATUS[0]} $?)
+if [ "${code[1]}" = 0 ]; then say "$SHA: ok"; exit 0; fi
+[ "${code[0]}" = 0 ] && { say "$SHA: FAILED"; exit 1; }
+say "$SHA: lost the probe box before the check finished (sprite exec exit ${code[0]}); run it again"; exit 2
diff --git a/tools/names.allow b/tools/names.allow
new file mode 100644
index 00000000..cf568035
--- /dev/null
+++ b/tools/names.allow
@@ -0,0 +1,2 @@
+# retired names left per file, and paths with one (tools/names.sh): only shrinks; phase 3 empties it
+
diff --git a/tools/names.sh b/tools/names.sh
new file mode 100755
index 00000000..4f4aa400
--- /dev/null
+++ b/tools/names.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+# Retired names (docs/overhaul.md, "One name per thing"; the words are in docs/names.md). Counts, per tracked file, the
+# lines that use a retired name, and each path that has one in it. It fails when a file has more such lines than
+# tools/names.allow gives it, or a file or path it doesn't list has any. The allowance only shrinks: rename, then take
+# the new counts. Motion as the subject (animation, mocap, motion matching) is fine; only the names below are retired.
+# tools/names.sh check
+# tools/names.sh --update tools/names.allow rewritten to today's counts (refused if any count rose)
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+ALLOW=tools/names.allow
+RETIRED='@raea/motion|sdk/motion|raea[-_]motion\b|raea[-_]react\b|raea_react::|\bkgpu\b|raea[-_]kgpu|motiondb|bevy[-_]tsx|raea[-_]brief'
+# records and the overhaul's own docs name them on purpose; vendored and generated text isn't ours
+SKIP=(':!docs/overhaul.md' ':!docs/overhaul/*' ':!docs/names.md' ':!docs/handoff/*' ':!tools/names.sh' ':!tools/names.allow' ':!tools/layers.allow'
+ ':!*.lock' ':!*pnpm-lock.yaml' ':!*package-lock.json' ':!*bun.lock' ':!vendor/*' ':!*/vendor/*' ':!**/node_modules/**'
+ ':!bench/p26-baseline/manifest.jsonl' ':!*.png' ':!*.jpg' ':!*.mp4' ':!*.woff2' ':!*.glb' ':!*.wasm')
+
+counts() {
+ git grep --untracked -c -I -E "$RETIRED" -- . "${SKIP[@]}" | awk -F: '{print $2, $1}'
+ git ls-files --cached --others --exclude-standard -- . "${SKIP[@]}" | grep -E "$RETIRED|/motion\.rs$|/motion/" | grep -E "$RETIRED|sdk/react/src/motion" |
+ while read -r f; do [ -e "$f" ] && echo "$f"; done | awk '{print 1, "path:" $0}'
+}
+now=$(counts | sort -k2)
+
+if [ "${1:-}" = "--update" ]; then
+ rose=$(join -1 2 -2 2 <(echo "$now") <(grep -v '^#' "$ALLOW" 2>/dev/null | sort -k2) | awk '$2>$3 {print $1 ": " $3 " -> " $2}')
+ [ -z "$rose" ] || { echo "names: refused, these grew:" >&2; echo "$rose" >&2; exit 1; }
+ { echo "# retired names left per file, and paths with one (tools/names.sh): only shrinks; phase 3 empties it"
+ echo "$now"; } > "$ALLOW"
+ echo "names: $(echo "$now" | grep -c .) files or paths still use a retired name, $ALLOW updated"
+ exit 0
+fi
+bad=0
+while read -r n what; do
+ [ -n "$what" ] || continue
+ a=$(awk -v w="$what" '$2==w {print $1}' "$ALLOW" 2>/dev/null)
+ if [ -z "$a" ]; then echo "names: $what uses a retired name ($n lines; docs/names.md has the new word)" >&2; bad=1
+ elif [ "$n" -gt "$a" ]; then echo "names: $what grew to $n lines with a retired name (allowed $a)" >&2; bad=1; fi
+done <<< "$now"
+[ $bad -eq 0 ] && echo "names: ok ($(echo "$now" | grep -c .) files or paths left to rename, none grew)"
+exit $bad
diff --git a/tools/native-types.sh b/tools/native-types.sh
new file mode 100755
index 00000000..3457feb7
--- /dev/null
+++ b/tools/native-types.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# The TypeScript table of native calls (sdk/raea/src/native-calls.ts) against the registry it's generated from:
+# exits 1 when `raea types` (every host's registered calls, from the raea binary) prints something else, so a call
+# added or changed in Rust can't go untyped in TS. It reads the built binary, so it belongs after a build of main
+# (L2), not in L0. `tools/native-types.sh --write` regenerates the file.
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+F=$ROOT/sdk/raea/src/native-calls.ts
+RAEA=${RAEA_BIN:-$ROOT/target/release/raea}
+[ -x "$RAEA" ] || { echo "native-types: no raea binary at $RAEA (build -p raea-cli, or set RAEA_BIN)"; exit 2; }
+out=$("$RAEA" types 2>/dev/null) && [ -n "$out" ] || { echo "native-types: raea types printed nothing"; exit 2; }
+if [ "${1:-}" = --write ]; then printf '%s\n' "$out" > "$F"; echo "native-types: wrote $F"; exit 0; fi
+if d=$(diff -B <(printf '%s\n' "$out") "$F"); then echo "native-types: ok"; else
+ echo "native-types: sdk/raea/src/native-calls.ts is out of date with the registry (tools/native-types.sh --write):"
+ echo "$d" | grep -E '^[<>] +"' | sed 's/^< / missing in TS: /; s/^> / only in TS: /' | cut -c1-120
+ exit 1
+fi
diff --git a/tools/no-void.allow b/tools/no-void.allow
new file mode 100644
index 00000000..e69de29b
diff --git a/tools/no-void.sh b/tools/no-void.sh
new file mode 100755
index 00000000..179bd665
--- /dev/null
+++ b/tools/no-void.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# "void" is retired: raea's application layer is raea feed (decided 10-25). This ratchet keeps the old name from
+# coming back. It counts the lines of each tracked file (raea's and apps/app's) that use "void" as a product name: the
+# names raea-void, void-bevy, void_bevy, void-app, void-conform and RAEA_VOID_*, and the bare word wherever it isn't
+# TypeScript's `void` type or operator. It fails when a file has more such lines than tools/no-void.allow gives it, or
+# a file it doesn't list has any. The allowance only shrinks: rename, then take the new counts.
+# tools/no-void.sh check; each file over its allowance, with its lines
+# tools/no-void.sh --update tools/no-void.allow rewritten to today's counts (refused if any count rose)
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+ALLOW=tools/no-void.allow
+NAMES='raea-void|void[-_](bevy|app|conform|shell)|RAEA_VOID_'
+# TypeScript's void (and C's, in a few FFI comments): a type after `:`, `=>`, `<` or `|`, or the operator before an
+# expression (`void css;` too, in TS a script writes); ts-native's checklist names the operator's own tests; those
+# lines aren't the product
+KEYWORD='(:|=>|<|\||\(|,) *void\b|\bvoid *(0|\(|>|\||;|,|\)|\]|\{|=)|\bvoid [a-z_$][a-zA-Z0-9_$.]*\(|\bvoid [A-Za-z_$][A-Za-z0-9_$]*;|operators\.void|expressions/void|c_void|void\*|\bvoid main\b|no-void'
+# the fallback readers: they read RAEA_VOID_* and move ~/.raea-void for one release, so they must
+# name both; dropped from here when the fallback is
+SHIMS=(':!systems/ml/src/feed.rs')
+# text that isn't ours or is a record, kept as written:
+# the fonts' OFL licence texts (the licence's own word, "void")
+# a recorded SEO rankings file (the keywords searched that day)
+# P26 baseline rows already taken (their notes name the composition as it was then)
+RECORDS=(':!*-OFL.txt' ':!apps/site/seo/rankings/*' ':!bench/p26-baseline/manifest.jsonl')
+SKIP=("${SHIMS[@]}" "${RECORDS[@]}" ':!*.lock' ':!*pnpm-lock.yaml' ':!*package-lock.json' ':!*/vendor/*' ':!vendor/*' ':!**/node_modules/**' ':!tools/no-void.allow' ':!tools/no-void.sh' ':!docs/handoff/*' ':!docs/overhaul/audit/*' ':!*LICENSE*' ':!*LICENCE*' ':!*.png' ':!*.jpg' ':!*.mp4' ':!*.woff2' ':!*.glb' ':!*.wasm')
+
+# file:line of each use, in one repo (prefixed with its path in raea)
+uses() {
+ local dir=$1 pre=$2
+ {
+ git -C "$dir" grep -n -I -E "$NAMES" -- . "${SKIP[@]}"
+ git -C "$dir" grep -n -I -i -w void -- . "${SKIP[@]}" ':!*.ts' ':!*.tsx' ':!*.js' ':!*.mjs' ':!*.cjs' ':!*.d.ts' \
+ | grep -v -i -E "^[^:]+:[0-9]+:.*($KEYWORD)"
+ } | awk -F: -v p="$pre" '{print p $1 ":" $2}' | sort -u
+}
+all=$(uses . ""; [ -e apps/app/.git ] && uses apps/app "apps/app/")
+counts=$(printf '%s\n' "$all" | grep -v '^$' | awk -F: '{n[$1]++} END {for (f in n) print n[f], f}' | sort -k2)
+
+if [ "${1:-}" = "--update" ]; then
+ rose=0
+ while read -r n f; do
+ [ -n "$n" ] || continue
+ a=$(awk -v f="$f" '$2 == f {print $1}' "$ALLOW" 2>/dev/null)
+ if [ -f "$ALLOW" ] && [ "${a:-0}" -lt "$n" ]; then echo "no-void: $f rose to $n (allowed ${a:-0}); rename it instead"; rose=1; fi
+ done <<< "$counts"
+ [ $rose = 0 ] || exit 1
+ printf '%s\n' "$counts" | grep -v '^$' > "$ALLOW"
+ echo "no-void: $ALLOW now $(wc -l < "$ALLOW" | tr -d ' ') files, $(awk '{s+=$1} END {print s+0}' "$ALLOW") lines"
+ exit 0
+fi
+
+bad=0
+while read -r n f; do
+ [ -n "$f" ] || continue
+ a=$(awk -v f="$f" '$2 == f {print $1}' "$ALLOW")
+ if [ "${a:-0}" -lt "$n" ]; then
+ echo "no-void: $f has $n product uses of \"void\" (allowed ${a:-0}); the app is raea feed:"
+ printf '%s\n' "$all" | awk -F: -v f="$f" '$1 == f {print $2}' | while read -r l; do
+ echo " $l: $(sed -n "${l}p" "$f" | cut -c1-140)"
+ done
+ bad=1
+ fi
+done <<< "$counts"
+total=$(printf '%s\n' "$counts" | awk '{s+=$1} END {print s+0}')
+[ $bad = 0 ] && echo "no-void: ok ($total uses left in $(printf '%s\n' "$counts" | grep -c .) files, none new)"
+exit $bad
diff --git a/tools/one-version.sh b/tools/one-version.sh
new file mode 100755
index 00000000..9fbe163c
--- /dev/null
+++ b/tools/one-version.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# One version of each crate the page and Bevy share (docs/blitz-bevy.feature B0b): exits 1 when a tracked Cargo.lock
+# resolves two versions of stylo, taffy, parley, fontique, wgpu, vello or anyrender, naming each and its versions.
+# Two would mean two text engines, two layout engines or two GPU APIs in one process, and a page Bevy can't draw on
+# its own device. A lock that doesn't resolve as locked (its workspace broken, or the lock out of date) fails too,
+# since what it says can't be trusted. The check reads; it never writes a lock.
+# tools/one-version.sh
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+CRATES='stylo taffy parley fontique wgpu vello anyrender'
+bad=0
+for lock in $(git ls-files '*Cargo.lock' | grep -vE '(^|/)vendor/'); do
+ if ! cargo metadata --format-version 1 --offline --locked --manifest-path "$(dirname "$lock")/Cargo.toml" >/dev/null 2>&1; then
+ echo "one-version: $lock doesn't resolve as locked (a path dependency gone, or the lock out of date)"
+ bad=1
+ continue
+ fi
+ for c in $CRATES; do
+ vs=$(awk -v n="$c" '$0 == "name = \"" n "\"" { getline; gsub(/"/, "", $3); print $3 }' "$lock" | sort -u | tr '\n' ' ')
+ if [ "$(echo "$vs" | wc -w)" -gt 1 ]; then
+ echo "one-version: $lock: $c $vs"
+ bad=1
+ fi
+ done
+done
+[ $bad = 0 ] && echo "one-version: ok ($CRATES)"
+exit $bad
diff --git a/tools/perceive/src/main.rs b/tools/perceive/src/main.rs
index 4055e712..617b191a 100644
--- a/tools/perceive/src/main.rs
+++ b/tools/perceive/src/main.rs
@@ -335,7 +335,7 @@ fn main() {
}
/// The Vision behind see-layout and see-coach: apple (the default on Apple) or portable (open models; docs/checks.feature
-/// in host records which uses match Vision).
+/// in the host app's records which uses match Vision).
fn vision_backend(name: Option<String>) -> Result<Box<dyn raea_sys_vision::vision::Vision>, String> {
match name.as_deref().unwrap_or(if cfg!(target_vendor = "apple") { "apple" } else { "portable" }) {
#[cfg(target_vendor = "apple")]
diff --git a/tools/public-guard.sh b/tools/public-guard.sh
new file mode 100755
index 00000000..68746b52
--- /dev/null
+++ b/tools/public-guard.sh
@@ -0,0 +1,111 @@
+#!/usr/bin/env bash
+# What goes into raea's public repository is permanent, so every commit is checked before it lands, not only releases
+# (docs/public-first.feature PF3). This script is the one check; hooks, the `but` wrapper and CI all call it.
+#
+# tools/public-guard.sh msg "MESSAGE" a commit message
+# tools/public-guard.sh range A..B each commit's message and the lines it adds, then gitleaks over the range
+# tools/public-guard.sh staged the lines staged for a plain `git commit`
+# tools/public-guard.sh install add the checks to this checkout's git hooks (pre-commit, commit-msg, pre-push)
+#
+# The patterns: the generic ones below (a home folder's path, an agent's scratch path, an agent session's name), plus
+# one regular expression per line from a private names file when there is one (client and product names stay out of
+# the public tree, so their list does too): $RAEA_GUARD_NAMES, else private/guard/names.txt, else
+# tools/agents/guard-names.txt. Lines starting with # are comments. Matching ignores case, except for a names line
+# starting with case: (a name that is also an ordinary word in lower case). Exit 1 lists every hit.
+set -euo pipefail
+root=$(git rev-parse --show-toplevel)
+
+generic=(
+ '(^|[^A-Za-z0-9_.-])/Users/[A-Za-z0-9._-]+/' '(^|[^A-Za-z0-9_.-])/home/[a-z][a-z0-9_-]*/' # a person's home folder (examples use ~ or $HOME)
+ '/private/tmp/claude-[0-9]+' '[.]claude/projects/' # an agent's scratch and transcript paths
+ '\braea-[0-9a-f]{2}\b' '\borgmode-[a-z0-9]{2}\b' # agent session names
+)
+# allowed: example home folders, the credits for what raea ports (NOTICE, ported headers), and licence boilerplate. Written
+# split ('Hyper''Frames') so this line doesn't match the names list itself.
+allow='/Users/(a|you|me|name|user|USER|runner)/|/home/(you|user|runner|USER)/|PERFORMANCE OF'
+allow+='|Portions ported from Hyper''Frames \(Apache-2\.0|ports? from Hyper''Frames|github\.com/heygen-com/hyper''frames'
+
+names_file() {
+ for f in "${RAEA_GUARD_NAMES:-}" "$root/private/guard/names.txt" "$root/tools/agents/guard-names.txt"; do
+ [[ -n $f && -f $f ]] && { echo "$f"; return; }
+ done
+}
+
+names() { local f; f=$(names_file) || true; [[ -n ${f:-} ]] && grep -v -E '^\s*(#|$)' "$f" || true; }
+# one alternation each: the case-insensitive patterns, and the case: ones (a pattern that matches nothing when empty)
+pat_i=$( { printf '%s\n' "${generic[@]}"; { names | grep -v '^case:' || true; }; } | paste -sd '|' -)
+pat_c=$(names | sed -n 's/^case://p' | paste -sd '|' -); pat_c=${pat_c:-'a^'}
+
+# hits in stdin's text, each line prefixed with $1
+scan() {
+ local where=$1 t; t=$(cat)
+ { grep -n -i -E -- "$pat_i" <<<"$t"; grep -n -E -- "$pat_c" <<<"$t"; } | sort -t: -k1,1n -u | grep -v -E -- "$allow" | sed "s|^|$where:|" || true
+}
+
+hits=0
+report() { [[ -z $1 ]] && return; printf '%s\n' "$1" >&2; hits=1; }
+
+case ${1:-} in
+ msg)
+ report "$(printf '%s\n' "${2:-}" | scan "message")"
+ ;;
+ range)
+ range=${2:?usage: public-guard.sh range A..B}
+ for c in $(git rev-list --no-merges "$range"); do
+ report "$(git log -1 --format=%B "$c" | scan "$(git rev-parse --short "$c") message")"
+ report "$(git show --format= --no-color --unified=0 "$c" | grep -E '^\+[^+]' | cut -c2- | scan "$(git rev-parse --short "$c") adds")"
+ done
+ if command -v gitleaks >/dev/null; then
+ gitleaks git --no-banner --redact --log-opts="$range" "$root" >&2 || { echo "public-guard: gitleaks found secrets in $range" >&2; hits=1; }
+ else
+ echo "public-guard: gitleaks isn't installed; secrets weren't checked (brew install gitleaks)" >&2
+ hits=1
+ fi
+ ;;
+ staged)
+ report "$(git diff --cached --no-color --unified=0 | grep -E '^\+[^+]' | cut -c2- | scan "staged")"
+ ;;
+ files)
+ # NUL-separated paths on stdin (git ls-files -z): every line of each text file
+ list=$(mktemp); cat > "$list"
+ report "$( { xargs -0 grep -n -i -I -E -- "$pat_i" < "$list"; xargs -0 grep -n -I -E -- "$pat_c" < "$list"; } 2>/dev/null | sort -u | grep -v -E -- "$allow" || true)"
+ # a symlink's target is what git stores for it (grep reads the file it points to instead)
+ report "$(tr '\0' '\n' < "$list" | while IFS= read -r f; do [[ -L $f ]] && printf '%s -> %s\n' "$f" "$(readlink "$f")"; done | scan "symlink")"
+ rm -f "$list"
+ ;;
+ install)
+ # only this checkout's own hooks: a core.hooksPath outside its .git (a global one) would put the checks into
+ # every repository on the machine, where tools/public-guard.sh doesn't exist and every commit would fail
+ gitdir=$(cd "$(git rev-parse --git-common-dir)" && pwd -P)
+ hooks=$(git config --local core.hooksPath || git rev-parse --git-path hooks)
+ [[ $hooks = /* ]] || hooks="$root/$hooks"
+ mkdir -p "$hooks"
+ hooks=$(cd "$hooks" && pwd -P)
+ if [[ $hooks != "$gitdir"/* ]] || [[ -z $(git config --local core.hooksPath || true) && -n $(git config --global core.hooksPath || true) ]]; then
+ echo "public-guard: this checkout's hooks resolve to $hooks, outside its .git (or a global core.hooksPath applies)." >&2
+ echo "Give it hooks of its own first: git config --local core.hooksPath .git/hooks-raea (copy the global ones in), then install again." >&2
+ exit 1
+ fi
+ add() { # hook, line: put right after the shebang, so it runs before the rest (and before anything reads stdin)
+ local h="$hooks/$1"
+ [[ -f $h ]] || printf '#!/bin/sh\n' >"$h"
+ if ! grep -q 'public-guard.sh' "$h"; then
+ { head -1 "$h"; printf '%s\n' "$2"; tail -n +2 "$h"; } >"$h.pg" && mv "$h.pg" "$h"
+ fi
+ chmod +x "$h"
+ }
+ # GitButler keeps the user's pre-commit as pre-commit-user and calls it first
+ pre=pre-commit; [[ -f $hooks/pre-commit ]] && grep -q GITBUTLER_MANAGED_HOOK "$hooks/pre-commit" && pre=pre-commit-user
+ add "$pre" '"$(git rev-parse --show-toplevel)/tools/public-guard.sh" staged || exit 1'
+ add commit-msg '"$(git rev-parse --show-toplevel)/tools/public-guard.sh" msg "$(cat "$1")" || exit 1'
+ # pre-push gets "<local ref> <local sha> <remote ref> <remote sha>" lines on stdin, which the rest of the hook (Git
+ # LFS) reads too: kept in a file and handed back. A new branch is checked from where it leaves origin/main.
+ add pre-push 'pg_in=$(mktemp); cat >"$pg_in"; z=0000000000000000000000000000000000000000; while read -r _ l _ r; do [ "$l" = "$z" ] && continue; b=$r; [ "$r" = "$z" ] && b=$(git merge-base "$l" origin/main 2>/dev/null || echo "$l~1"); "$(git rev-parse --show-toplevel)/tools/public-guard.sh" range "$b..$l" || exit 1; done <"$pg_in"; exec <"$pg_in"'
+ echo "public-guard: installed into $hooks (pre-commit, commit-msg, pre-push)"
+ ;;
+ *)
+ sed -n '2,13p' "$0" | sed 's/^# \{0,1\}//' >&2
+ exit 2
+ ;;
+esac
+exit $hits
diff --git a/tools/rask b/tools/rask
new file mode 160000
index 00000000..538b140f
--- /dev/null
+++ b/tools/rask
@@ -0,0 +1 @@
+Subproject commit 538b140f6d0f2f908bdf6bef1e448b322df81917
diff --git a/tools/rask.sh b/tools/rask.sh
new file mode 100755
index 00000000..83dc822a
--- /dev/null
+++ b/tools/rask.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+# rask (tools/rask, a submodule: github.com/shinyobjectz/rask): tasks are feature-file scenarios, marked in the Rust
+# with `// rask: ID what`, claimed by lanes, closed only when checked (docs/agents.md, "Tasks"). Built on first use and
+# whenever its source is newer than the binary, in a lane of its own: a small compile that every L0 needs shouldn't queue
+# behind the release builds (10-28: two L1s waited on it behind 40-minute builds).
+set -euo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+R=$ROOT/tools/rask
+[ -f "$R/Cargo.toml" ] || git -C "$ROOT" submodule update --init -q tools/rask
+bin=$R/target/release/rask
+if [ ! -x "$bin" ] || [ -n "$(find "$R/src" "$R/Cargo.toml" -newer "$bin" 2>/dev/null | head -1)" ]; then
+ if command -v lane >/dev/null; then lane rask -- cargo build --release -q --manifest-path "$R/Cargo.toml" >&2
+ else cargo build --release -q --manifest-path "$R/Cargo.toml" >&2; fi
+fi
+exec "$bin" "$@"
diff --git a/tools/readbacks.sh b/tools/readbacks.sh
new file mode 100755
index 00000000..fa66493a
--- /dev/null
+++ b/tools/readbacks.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+# The GPU-to-CPU copies in a run (docs/blitz-bevy.feature B1d): every copy into a buffer the CPU maps (MAP_READ), read
+# from the shared device's wgpu trace. Take one with RAEA_WGPU_TRACE=DIR on any raea program, then:
+# tools/readbacks.sh DIR one line per destination buffer's label: copies, bytes; then the total
+# tools/readbacks.sh DIR --count the total copies alone
+# A copy whose buffer label is in RAEA_READBACKS_EXCEPT (comma separated, e.g. the MP4 encoder's) is counted apart.
+set -euo pipefail
+dir=${1:?usage: tools/readbacks.sh TRACE_DIR [--count]}
+trace=$dir/trace.ron
+[ -f "$trace" ] || { echo "readbacks: no $trace (run with RAEA_WGPU_TRACE=$dir)" >&2; exit 2; }
+awk -v count_only="${2:-}" -v except="${RAEA_READBACKS_EXCEPT:-}" '
+ BEGIN { n = split(except, ex, ","); for (i = 1; i <= n; i++) skip[ex[i]] = 1 }
+ # CreateBuffer(PointerId(ID), ( label: Some("L"), size: N, usage: "...", ...
+ /^CreateBuffer\(PointerId\(/ { match($0, /PointerId\([0-9]+\)/); id = substr($0, RSTART, RLENGTH); want = 1; label = "(no label)"; next }
+ want && /label: Some\(/ { l = $0; sub(/.*label: Some\("/, "", l); sub(/"\).*/, "", l); label = l; next }
+ want && /usage:/ { if ($0 ~ /MAP_READ/) { read[id] = label }; want = 0; next }
+ # CopyTextureToBuffer( src: (...), dst: ( buffer: PointerId(ID), ... and CopyBufferToBuffer( ..., dst: PointerId(ID),
+ /CopyTextureToBuffer\(/ { t2b = 1; next }
+ t2b && /buffer: PointerId\(/ { match($0, /PointerId\([0-9]+\)/); hit(substr($0, RSTART, RLENGTH)); t2b = 0; next }
+ /CopyBufferToBuffer\(/ { b2b = 1; next }
+ b2b && /dst: PointerId\(/ { match($0, /PointerId\([0-9]+\)/); hit(substr($0, RSTART, RLENGTH)); b2b = 0; next }
+ function hit(id) { if (id in read) { by[read[id]]++ } }
+ END {
+ total = 0; apart = 0
+ for (l in by) { if (l in skip) apart += by[l]; else total += by[l] }
+ if (count_only == "--count") { print total; exit }
+ for (l in by) printf "%6d %s%s\n", by[l], l, (l in skip) ? " (excepted)" : ""
+ printf "readbacks: %d", total; if (apart) printf " (+%d excepted)", apart; print ""
+ }
+' "$trace"
diff --git a/tools/release-check.sh b/tools/release-check.sh
new file mode 100644
index 00000000..d6624b16
--- /dev/null
+++ b/tools/release-check.sh
@@ -0,0 +1,98 @@
+#!/bin/bash
+# The check every release archive passes (tools/release.sh runs it on the archive it just made; windows.yml's verify job
+# runs it again on a fresh Windows runner, from the archive alone): unpacked into a fresh folder, with RAEA_NO_TREE=1 so
+# it can't be reading a checkout, its raea renders a frame, has the plugin catalog, prints a craft guide and writes
+# styles.gen.ts; its binaries name none of raea's API, nothing in it looks like a key, and a Windows archive holds no
+# Microsoft file (the CRT comes from the VC++ redistributable; docs/handoff/ports.md).
+#
+# tools/release-check.sh ARCHIVE raea-VERSION-PLATFORM.tar.gz or .zip
+set -eu
+archive=${1:?usage: release-check.sh ARCHIVE}
+check=$(mktemp -d)
+case $archive in
+ *.zip) if command -v unzip >/dev/null; then unzip -q "$archive" -d "$check"; else 7z x -y -o"$check" "$archive" >/dev/null; fi ;;
+ *) tar -xzf "$archive" -C "$check" ;;
+esac
+fail() { echo "release: $* (see $check)" >&2; exit 1; }
+raea=$check/raea/bin/raea
+[ -f "$raea.exe" ] && raea=$raea.exe
+[ -f "$raea" ] || fail "no raea in bin/"
+# the edit in a folder of its own: raea reads every file under a project, and the install isn't the user's project
+mkdir -p "$check/p"
+cat > "$check/p/hello.tsx" <<'TSX'
+import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
+function Hello() {
+ const f = useCurrentFrame();
+ return <AbsoluteFill style={{ background: "#000", color: "#fff", fontSize: 120, justifyContent: "center", alignItems: "center" }}>raea {f}</AbsoluteFill>;
+}
+registerRoot(() => <Composition id="hello" component={Hello} width={640} height={360} fps={30} durationInFrames={30} />);
+TSX
+(cd "$check/p" && RAEA_NO_TREE=1 RUST_BACKTRACE=1 "$raea" render hello.tsx --frame 12 -o hello.png > render.log 2>&1) || { s=$?; tail -40 "$check/p/render.log" >&2; fail "the unpacked raea didn't render (exit $s)"; }
+[ -s "$check/p/hello.png" ] || fail "no frame written"
+# hello.tsx draws white text on black, so a frame raea finds all black lost its page (Windows' c:\ paths read as a URL
+# scheme drew nothing but the black behind it, 11-05)
+! grep -q "is all black" "$check/p/render.log" || { grep "all black" "$check/p/render.log" >&2; fail "the unpacked raea rendered a black frame"; }
+# the plugin catalog is in it (track 3, raea/plugins): a headless App with avian and Bevy's input, raea/input's virtual
+# gamepad pressed and read back. A raea built without --features "bevy-plugins,..." says "no plugin "avian" in this
+# build" here
+mkdir -p "$check/plugins"
+cat > "$check/plugins/check.ts" <<'TS'
+import { BevyApp } from "raea/bevy";
+import { print } from "raea/native";
+export default function main() {
+ const app = BevyApp.open({ plugins: ["avian", "bevy"], fps: 60 });
+ app.step(2);
+ app.call("raea/input", { gamepad: "South" });
+ app.step(2);
+ const held = app.call<{ buttons: string[] }>("raea/input.gamepad");
+ if (!held.buttons.includes("South")) throw new Error(`the virtual gamepad's South isn't held: ${JSON.stringify(held)}`);
+ print("plugins: avian and the virtual gamepad");
+}
+TS
+(cd "$check/plugins" && RAEA_NO_TREE=1 "$raea" run check.ts > run.log 2>&1; grep -q "plugins: avian and the virtual gamepad" run.log) || { tail -20 "$check/plugins/run.log" >&2; fail "the unpacked raea has no plugin catalog (build raea with --features \"\$(tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)\")"; }
+# and its guides and styles.gen come from the release too
+(cd "$check/p" && RAEA_NO_TREE=1 "$raea" guide music | grep -q "music") || fail "the unpacked raea has no craft guides"
+mkdir -p "$check/styled" && { echo 'import { css } from "./styles.gen";'; cat "$check/p/hello.tsx"; echo 'void css;'; } > "$check/styled/hello.tsx"
+(cd "$check/styled" && RAEA_NO_TREE=1 "$raea" render hello.tsx --frame 1 -o hello.png >/dev/null 2>&1 && [ -s styles.gen.ts ]) || fail "the unpacked raea didn't write styles.gen.ts"
+# the app targets (docs/targets.feature T1c, T1e, T1f): an app importing react, @raea/ui and @raea/rune, bundled by the
+# release's own raea (no bun), checked headless on each target with one press: its frames, the press drawn (the
+# frame after it differs from the mount's) and an empty unmapped.json; filmed on native, the public engine's MP4 says
+# it's unsigned and carries no Content Credentials
+mkdir -p "$check/app"
+cat > "$check/app/app.tsx" <<'TSX'
+import { useState } from "react";
+import { emit } from "@raea/ui/wire";
+import { Spring, rune } from "@raea/rune";
+export default function App() {
+ const [n, setN] = useState(0);
+ const add = () => { setN(n + 1); emit("added", n + 1); };
+ return (
+ <div style={{ display: "flex", gap: 12, padding: 24, backgroundColor: "#111111", color: "#ffffff", fontSize: 24 }}>
+ <button data-testid="add" onClick={add} style={{ padding: 8, backgroundColor: "#2563eb", color: "#ffffff", borderRadius: 8 }} {...rune({ motion: Spring(0.3) })}>Add</button>
+ <span data-testid="count">{"Count: " + n}</span>
+ </div>
+ );
+}
+TSX
+echo '[{"press": "add"}]' > "$check/app/steps.json"
+for t in web native; do
+ film=(); [ $t = native ] && film=(--video "$check/app/$t.mp4")
+ (cd "$check/app" && RAEA_NO_TREE=1 "$raea" app check app.tsx --target $t --script steps.json --png "out-$t" --size 480x200 "${film[@]+"${film[@]}"}" > "$t.log" 2>&1) || { tail -20 "$check/app/$t.log" >&2; fail "raea app check --target $t failed"; }
+ o=$check/app/out-$t
+ [ -s "$o/00-mount.png" ] && [ -s "$o/01-press-add.png" ] || fail "raea app check --target $t wrote no frames"
+ ! cmp -s "$o/00-mount.png" "$o/01-press-add.png" || fail "raea app check --target $t: the press didn't change the frame"
+ [ "$(tr -d ' \n' < "$o/unmapped.json")" = "[]" ] || fail "raea app check --target $t: unmapped.json isn't empty: $(head -c 300 "$o/unmapped.json")"
+done
+grep -q "unsigned" "$check/app/native.log" || { tail -5 "$check/app/native.log" >&2; fail "the native film's report doesn't say it's unsigned"; }
+! grep -qa c2pa "$check/app/native.mp4" || fail "the public engine's native film carries Content Credentials"
+# engine only: no raea API in the binaries, nothing key-shaped anywhere
+api=$(cat "$check"/raea/bin/* | grep -aoE '(api|sign)\.raea\.io|RAEA_(SIGN|GEN)_TOKEN' | sort -u | tr '\n' ' ' || true)
+[ -z "$api" ] || fail "the binaries name raea's API ($api): build raea-cli with --no-default-features"
+keys=$(grep -rlE 'sk-or-v1-[0-9a-f]{20}|sk-ant-[A-Za-z0-9_-]{20}|AKIA[0-9A-Z]{16}|BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY' "$check/raea" 2>/dev/null | head -5 || true)
+[ -z "$keys" ] || fail "key-shaped text in: $keys"
+# Windows: our binaries only. Any other DLL, or a file named like the CRT, the SDK or DirectX's redistributables, is
+# Microsoft's and isn't ours to ship
+ms=$(cd "$check/raea" && find . -type f \( -iname '*.dll' ! -path './bin/raea_bundle.dll' -o -iname 'vcruntime*' -o -iname 'msvcp*' -o -iname 'ucrtbase*' -o -iname 'api-ms-win*' -o -iname 'concrt*' -o -iname 'vccorlib*' -o -iname '*.lib' -o -iname '*.pdb' -o -iname 'd3dcompiler*' -o -iname 'dxcompiler*' -o -iname 'dxil*' \) | head -5)
+[ -z "$ms" ] || fail "files that aren't ours: $ms"
+echo "release: $archive checked: an unpacked copy rendered a frame and checked an app on both targets with RAEA_NO_TREE=1"
+rm -rf "$check"
diff --git a/tools/release-web.sh b/tools/release-web.sh
new file mode 100755
index 00000000..5c52f7ad
--- /dev/null
+++ b/tools/release-web.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# The web modules of a release, attached to its GitHub release beside the engine's archives (tools/release/README.md):
+# raea_shape_web.js, raea_shape_web_bg.wasm core/shape for the browser (engine/shape-web): what @raea/r3f's
+# loadShapes() meshes solids with (minus, hull, extrude, Text3D)
+# raea_web.js, raea_web_bg.wasm raea's engine on WebGPU (engine/web): what @raea/web's loadRaea() opens
+# SHA256SUMS
+# Each is wasm-bindgen's `--target web` glue and its module, built with the web profile. A page serves them itself:
+# GitHub sends release files as application/octet-stream with no CORS header, so a browser can't import them from
+# github.com. Built from REF's committed tree (a git archive of it, never anyone's unfinished edit), as release.sh is.
+#
+# tools/release-web.sh VERSION [REF] writes dist/web-VERSION/ (REF: HEAD)
+# tools/release-web.sh VERSION REF --upload TAG and attaches them to the GitHub release TAG (shinyobjectz/raea)
+set -euo pipefail
+version=${1:?usage: release-web.sh VERSION [REF [--upload TAG]]}
+ref=${2:-HEAD}
+tag=
+[ "${3:-}" = --upload ] && tag=${4:?usage: release-web.sh VERSION REF --upload TAG}
+root=$(cd "$(dirname "$0")/.." && pwd)
+cd "$root"
+out=$root/dist/web-$version
+export CARGO_TARGET_DIR=$root/target/web
+src=$(mktemp -d)
+trap 'rm -rf "$src"' EXIT
+git archive "$ref" | tar -x -C "$src"
+mkdir -p "$out"
+for p in raea-shape-web raea-web; do
+ (cd "$src" && lane build -- cargo build --locked -p "$p" --target wasm32-unknown-unknown --profile web -j 6 --message-format short)
+ wasm-bindgen --target web --no-typescript --out-dir "$out" "$CARGO_TARGET_DIR/wasm32-unknown-unknown/web/${p//-/_}.wasm"
+done
+(cd "$out" && shasum -a 256 raea_shape_web.js raea_shape_web_bg.wasm raea_web.js raea_web_bg.wasm > SHA256SUMS && cat SHA256SUMS)
+# each module opens under its glue, as loadShapes and loadRaea open it
+for m in raea_shape_web raea_web; do
+ bun -e "const m = await import('$out/$m.js'); await m.default({ module_or_path: await Bun.file('$out/${m}_bg.wasm').arrayBuffer() }); console.log('$m opens')" \
+ || { echo "release-web.sh: $m.js didn't open its module" >&2; exit 1; }
+done
+[ -z "$tag" ] || gh release upload "$tag" -R shinyobjectz/raea --clobber "$out"/raea_shape_web.js "$out"/raea_shape_web_bg.wasm "$out"/raea_web.js "$out"/raea_web_bg.wasm "$out"/SHA256SUMS
diff --git a/tools/release.sh b/tools/release.sh
index 73c34434..9bc85613 100755
--- a/tools/release.sh
+++ b/tools/release.sh
@@ -59,13 +59,23 @@ untar() {
printf '%s\n' "$err" >&2
return $rc
}
-git archive "$ref" | untar "$gate" || { echo "release.sh: the skills gate couldn't unpack $ref" >&2; exit 1; }
-git -C "$gate" init -q && git -C "$gate" add -A && git -C "$gate" -c gc.auto=0 -c maintenance.auto=false -c user.name=release -c [email protected] commit -qm "$ref" --no-verify
raea_bin=$bin/raea; [ -f "$raea_bin.exe" ] && raea_bin=$raea_bin.exe
-if ! (cd "$gate" && SKILLS_STRICT=1 SKILLS_CHANGED= RAEA_BIN="$raea_bin" RAEA_APP="$root/apps/app" RAEA_APP_REV="$(git -C "$root" rev-parse "$ref:apps/app")" bash tools/skills.sh check); then
- echo "release.sh: tools/skills.sh check failed on $ref with $raea_bin; fix the skills (tools/skills.sh gen) before releasing" >&2
- rm -rf "$gate"
- exit 1
+# The gate reads the feed app's checkout (apps/app), a private submodule GitHub's Windows runner can't fetch. There,
+# RAEA_SKILLS_PASSED=SHA stands for it: the gate passed at SHA on macOS or Linux, and it counts for REF only when what
+# the gate reads (the skills and guides, the glossary, the CLI's usage, skills.sh) is the same at both (T1f, 11-07)
+gate_inputs=(sdk/skills sdk/guides docs/skills.glossary.md engine/cli/src tools/skills.sh)
+if [ "$platform" = windows-x86_64 ] && [ ! -f "$root/apps/app/src/acp/protocol.ts" ] && [ -n "${RAEA_SKILLS_PASSED:-}" ]; then
+ git diff --quiet "$RAEA_SKILLS_PASSED" "$ref" -- "${gate_inputs[@]}" \
+ || { echo "release.sh: the skills changed between $RAEA_SKILLS_PASSED (where the gate passed) and $ref" >&2; exit 1; }
+ echo "release.sh: note: the skills gate passed at $(git rev-parse --short "$RAEA_SKILLS_PASSED") elsewhere and its inputs are unchanged; not run here (no feed app)"
+else
+ git archive "$ref" | untar "$gate" || { echo "release.sh: the skills gate couldn't unpack $ref" >&2; exit 1; }
+ git -C "$gate" init -q && git -C "$gate" add -A && git -C "$gate" -c gc.auto=0 -c maintenance.auto=false -c user.name=release -c [email protected] commit -qm "$ref" --no-verify
+ if ! (cd "$gate" && SKILLS_STRICT=1 SKILLS_CHANGED= RAEA_BIN="$raea_bin" RAEA_APP="$root/apps/app" RAEA_APP_REV="$(git -C "$root" rev-parse "$ref:apps/app")" bash tools/skills.sh check); then
+ echo "release.sh: tools/skills.sh check failed on $ref with $raea_bin; fix the skills (tools/skills.sh gen) before releasing" >&2
+ rm -rf "$gate"
+ exit 1
+ fi
fi
rm -rf "$gate"
# the skills' changes since the last release, for its notes (SK9): RAEA_SINCE names where that was (a ref, or a date
diff --git a/tools/release/README.md b/tools/release/README.md
new file mode 100644
index 00000000..48bc923f
--- /dev/null
+++ b/tools/release/README.md
@@ -0,0 +1,20 @@
+# Release recipes
+
+How 0.1.0-canary.2 and canary.3 were built and checked beyond `tools/release.sh` (kept for the next):
+
+- `linux/Dockerfile`: the Ubuntu 24.04 build root (glibc 2.39), run under Rosetta; bun's x64 baseline build, as the
+ default bun segfaults there.
+- `linux/build.sh VERSION [JOBS]`: in that container, raea with the plugin catalog's features and the two app hosts,
+ strip, then `tools/release.sh` under Xvfb (its header has the pitfalls). The VM: `colima start -p x86 --vm-type vz`,
+ then `rosetta: true` in ~/.colima/x86/colima.yaml and `vmOpts.vz.rosetta {enabled, binfmt}` in its lima.yaml, and
+ `LIMA_HOME=~/.colima/_lima limactl start colima-x86`; docker at unix://~/.colima/x86/docker.sock. Stop it to free a
+ deleted target's disk. It runs `tools/cpu-heartbeat.sh`
+ mounted as /hb.sh beside the build, so antsy's --stall sees a working compiler.
+- `linux/Dockerfile.trixie` and `linux/rl3.sh`: RL3 on Linux, the tarball on a fresh debian:trixie with a new user and
+ no network.
+- `rl3-mac.sh TARBALL [PONG_DIR]`: RL3 on the Mac, the tarball as a fresh user would run it, sandboxed.
+- `../release-web.sh VERSION REF --upload TAG`: the web modules built from REF (core/shape's for @raea/r3f's loadShapes,
+ raea-web's for @raea/web) with their SHA256SUMS, attached to the GitHub release TAG: vVERSION beside the archives
+ for every release (canary.1 and canary.2 got theirs by hand on 11-06, built from their own shape sources), and between releases a pre-release web-SHA on the public commit SHA that
+ publish.sh made from REF (`gh release create web-SHA -R shinyobjectz/raea --target SHA --prerelease` first),
+ when core/shape, engine/shape-web or engine/web changed (docs/r3f.feature R3F5).
diff --git a/tools/release/linux/Dockerfile b/tools/release/linux/Dockerfile
new file mode 100644
index 00000000..09663a31
--- /dev/null
+++ b/tools/release/linux/Dockerfile
@@ -0,0 +1,14 @@
+# The Linux build root (canary.2, canary.3): Ubuntu 24.04 x86_64 (glibc 2.39, as linux-check.sh's noble root), run under Rosetta
+# (bun is its x64 baseline build: the default one segfaults under Rosetta)
+FROM --platform=linux/amd64 ubuntu:24.04
+RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
+ ca-certificates curl git build-essential pkg-config cmake ninja-build nasm clang libclang-dev lld zsh unzip jq rsync \
+ binutils file procps python3 libasound2-dev libudev-dev libxkbcommon-dev libwayland-dev libx11-dev libxi-dev \
+ libxcursor-dev libxrandr-dev libvulkan-dev libssl-dev libfontconfig-dev mesa-vulkan-drivers ffmpeg \
+ xvfb xauth libxkbcommon-x11-0 \
+ && rm -rf /var/lib/apt/lists/*
+ARG BUN
+RUN curl -fsSL https://sh.rustup.rs | sh -s -- -y -q --profile minimal --default-toolchain 1.99.1 \
+ && curl -fsSLo /tmp/bun.zip https://github.com/oven-sh/bun/releases/download/bun-v$BUN/bun-linux-x64-baseline.zip \
+ && mkdir -p /root/.bun/bin && unzip -qj /tmp/bun.zip -d /root/.bun/bin && rm /tmp/bun.zip
+ENV PATH=/root/.cargo/bin:/root/.bun/bin:$PATH
diff --git a/tools/release/linux/Dockerfile.trixie b/tools/release/linux/Dockerfile.trixie
new file mode 100644
index 00000000..4d69dce3
--- /dev/null
+++ b/tools/release/linux/Dockerfile.trixie
@@ -0,0 +1,2 @@
+FROM --platform=linux/amd64 debian:trixie-slim
+RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends libasound2t64 libfontconfig1 libvulkan1 mesa-vulkan-drivers >/dev/null && rm -rf /var/lib/apt/lists/*
diff --git a/tools/release/linux/build.sh b/tools/release/linux/build.sh
new file mode 100755
index 00000000..1cb8f7e9
--- /dev/null
+++ b/tools/release/linux/build.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# In the container (Dockerfile here): a Linux release from /rel, a clone at the release SHA, with /target a folder of its
+# own: raea with the plugin catalog and the two app hosts (targets.feature T1f), each in a cargo call, stripped, then
+# tools/release.sh under Xvfb (its release check opens the web target's window, which needs a display on Linux). Run
+# release.sh with bash: zsh reads `$ref:apps` as a path modifier. The skills gate reads /rel/apps/app (clone the
+# feed app there at the commit the release SHA records). A virtiofs /target holds deleted files until the VM stops.
+set -uo pipefail
+V=${1:?version}; jobs=${2:-8}
+export CARGO_TARGET_DIR=/target CARGO_INCREMENTAL=0
+git config --global --add safe.directory /rel
+bash /hb.sh /target 60 &
+cd /rel
+for d in sdk/react/js sdk/react/tw; do (cd "$d" && bun install --frozen-lockfile 2>&1 | tail -1); done
+feat=$(bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins) && [ -n "$feat" ] || { echo "linux: no catalog features"; exit 1; }
+b() { cargo build --release --locked -j "$jobs" "$@" 2>&1 | tee -a /target/c3-build.log | grep --line-buffered -E '^ *Compiling|^error|Finished'; grep -q '^ *Finished' <(tail -3 /target/c3-build.log) || { grep -E '^error' -A8 /target/c3-build.log | head -40; echo "linux: build FAILED: $*"; exit 1; }; }
+: > /target/c3-build.log
+b -p raea-cli --bin raea --no-default-features --features "$feat"
+b -p raea-rune-host
+b -p raea-page-host --features window
+r=/target/release; echo "linux build: $(objdump -T $r/raea | grep -o 'GLIBC_[0-9.]*' | sort -uV | tail -1)"
+ship=/target/ship; rm -rf "${ship:?}"; mkdir -p "$ship"
+cp $r/raea $r/libraea_bundle.so $r/raea-rune-host $r/raea-page-host "$ship/" && strip "$ship/raea" "$ship/raea-rune-host" "$ship/raea-page-host" \
+ && strip --strip-unneeded "$ship/libraea_bundle.so" || { echo "linux: strip failed"; exit 1; }
+xvfb-run -a -s "-screen 0 1280x1024x24" bash tools/release.sh "$V" "$ship" HEAD || { echo "linux: release.sh FAILED"; exit 1; }
+cp dist/raea-$V-linux-x86_64.tar.gz* /out/ && ls -l /out && echo "linux: done"
diff --git a/tools/release/linux/rl3.sh b/tools/release/linux/rl3.sh
new file mode 100755
index 00000000..3dda8095
--- /dev/null
+++ b/tools/release/linux/rl3.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# RL3 on Linux, in a fresh debian:trixie container (the cloud node's base): the tarball unpacked, run by a new user
+# with an empty HOME and no network, as linux-check.sh's clean() does on the probe box. PKGS = the runtime packages.
+set -uo pipefail
+V=${1:?version}; shift
+export DEBIAN_FRONTEND=noninteractive
+[ $# = 0 ] || apt-get update -qq >/dev/null && apt-get install -y -qq --no-install-recommends "$@" >/dev/null || { echo "rl3: apt failed"; exit 1; }
+R=/tmp/rl3; mkdir -p $R/home $R/p $R/game $R/bevy
+tar -xzf /out/raea-$V-linux-x86_64.tar.gz -C $R && cp -R /rel/sdk/react/bench/games/pong/. $R/game/
+bin=$(ls -d $R/raea*/bin 2>/dev/null | head -1); [ -x "$bin/raea" ] || bin=$R/raea/bin
+echo "rl3 missing libs: $(ldd $bin/raea $bin/libraea_bundle.so | grep -c 'not found')"; ldd $bin/raea | grep 'not found'
+useradd -m fresh; chown -R fresh $R
+ok=0
+step() { # NAME DIR ARGS...
+ local n=$1 d=$2 t0=$(date +%s); shift 2
+ (cd "$d" && su fresh -c "env -i PATH=/usr/bin:/bin HOME=$R/home RAEA_NO_TREE=1 RAEA_API=http://127.0.0.1:9 RAEA_GEN_API=http://127.0.0.1:9 $bin/raea $(printf '%q ' "$@")") > $R/$n.log 2>&1
+ local c=$?; echo "rl3 $n: exit $c, $(( $(date +%s) - t0 ))s"; grep -v -E 'ALSA|^\s*$' $R/$n.log | tail -2 | cut -c1-160; [ $c = 0 ] || ok=1
+}
+step init $R/p init
+step render-frame $R/p render edit.tsx --frame 15 -o card.png
+step render-mp4 $R/p render edit.tsx -o edit.mp4
+step play $R/game play edit.tsx --offscreen --seconds 2 --size 540x960 --snapshot 1 snap.png
+printf '%s\n' 'import { BevyApp } from "raea/bevy";' 'import { print } from "raea/native";' 'export default function main() {' \
+ ' const app = BevyApp.open({ plugins: ["avian", "bevy"] });' ' const frame = app.step(30);' ' app.close();' \
+ ' if (!(frame >= 30)) throw new Error(`stepped to ${frame}`);' ' print(`bevy ok: frame ${frame}`);' '}' > $R/bevy/main.ts && chown -R fresh $R/bevy
+step bevy $R/bevy run main.ts
+ls -la $R/p/card.png $R/p/edit.mp4 $R/game/snap.png 2>&1 | awk '{print $5, $NF}'
+echo "rl3 home left: $(cd $R/home && find . -maxdepth 3 -type d | sort | tr '\n' ' ')"
+echo "rl3: $([ $ok = 0 ] && echo ok || echo FAILED)"
diff --git a/tools/release/models.tsv b/tools/release/models.tsv
new file mode 100644
index 00000000..2a615478
--- /dev/null
+++ b/tools/release/models.tsv
@@ -0,0 +1,5 @@
+# The models a release packs, downloaded by .github/workflows/release.yml into ~/.local/share/raea-models (path, URL,
+# sha256; tab-separated). The URL is an asset of the public repository's models-1 release, uploaded once at the cutover
+# (docs/public-first.feature PF5); the sha256 is of the copy tools/release.sh packs on the release Mac.
+# Beat This! small0 (MIT, github.com/CPJKU/beat_this), converted to ONNX for raea song
+beat-this/beat_this_small0.onnx https://github.com/shinyobjectz/raea/releases/download/models-1/beat_this_small0.onnx 3f650a9f36d708d575808220a2874b0b84cf402db645b7eac2d9069a53642d4b
diff --git a/tools/release/rl3-mac.sh b/tools/release/rl3-mac.sh
new file mode 100755
index 00000000..619dd8ab
--- /dev/null
+++ b/tools/release/rl3-mac.sh
@@ -0,0 +1,37 @@
+#!/bin/zsh
+# RL3 on the Mac for a release tarball: unpacked in a fresh folder, run as a fresh user would (env -i, an empty HOME,
+# PATH without bun or brew, RAEA_NO_TREE=1, raea's API at a closed port) under a sandbox that denies reads of
+# ~/raea, ~/raea-trial and ~/.raea and all network but localhost. raea init, a frame and an MP4 of the template,
+# play of the bench's pong offscreen with a snapshot, and a raea/bevy BevyApp program on the catalog.
+set -u
+tgz=${1:?usage: rl3-mac.sh TARBALL [PONG_DIR]}; pong=${2:-$HOME/raea/sdk/react/bench/games/pong}
+R=$(mktemp -d /private/tmp/rl3-mac.XXXXXX); mkdir -p $R/home $R/p $R/game $R/bevy
+tar -xzf $tgz -C $R && cp -R $pong/. $R/game/
+cat > $R/sb <<SB
+(version 1)
+(allow default)
+(deny file-read* (subpath "$HOME/raea") (subpath "$HOME/raea-trial") (subpath "$HOME/.raea"))
+(deny network*)
+(allow network* (remote ip "localhost:*") (local ip "localhost:*"))
+(allow network* (remote unix-socket))
+SB
+ok=0
+step() { # NAME DIR ARGS...
+ local n=$1 d=$2; shift 2; local t0=$(date +%s)
+ (cd $d && sandbox-exec -f $R/sb env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin HOME=$R/home RAEA_NO_TREE=1 RAEA_API=http://127.0.0.1:9 RAEA_GEN_API=http://127.0.0.1:9 $R/raea/bin/raea "$@") > $R/$n.log 2>&1
+ local code=$?; echo "mac $n: exit $code, $(( $(date +%s) - t0 ))s"; grep -v '^\s*$' $R/$n.log | tail -2 | cut -c1-160
+ [ $code = 0 ] || ok=1
+}
+step init $R/p init
+step render-frame $R/p render edit.tsx --frame 15 -o card.png
+step render-mp4 $R/p render edit.tsx -o edit.mp4
+step play $R/game play edit.tsx --offscreen --seconds 2 --size 540x960 --snapshot 1 snap.png
+# raea run calls the script's default export; print is raea's stdout
+printf '%s\n' 'import { BevyApp } from "raea/bevy";' 'import { print } from "raea/native";' 'export default function main() {' \
+ ' const app = BevyApp.open({ plugins: ["avian", "bevy"] });' ' const frame = app.step(30);' ' app.close();' \
+ ' if (!(frame >= 30)) throw new Error(`stepped to ${frame}`);' ' print(`bevy ok: frame ${frame}`);' '}' > $R/bevy/check.ts
+step bevy $R/bevy run check.ts
+grep -q '^bevy ok' $R/bevy.log || { echo "mac: the BevyApp program didn't finish"; ok=1; }
+for f in $R/p/card.png $R/p/edit.mp4 $R/game/snap.png; do [ -s $f ] || { echo "mac: no $f"; ok=1; }; done
+echo "mac home left: $(cd $R/home && find . -maxdepth 3 -type d | sort | tr '\n' ' ')"
+echo "mac dir: $R"; echo "mac done $ok"; exit $ok
diff --git a/tools/sca-seen.tsv b/tools/sca-seen.tsv
new file mode 100644
index 00000000..49f2b3b9
--- /dev/null
+++ b/tools/sca-seen.tsv
@@ -0,0 +1,7 @@
+first_seen id package version severity
+2026-10-23 GHSA-xjj6-f33q-929c undici 7.29.1 7.5
+2026-10-23 RUSTSEC-2026-0194 quick-xml 0.31.0 7.5
+2026-10-23 RUSTSEC-2026-0194 quick-xml 0.38.4 7.5
+2026-10-23 RUSTSEC-2026-0195 quick-xml 0.31.0 7.5
+2026-10-23 RUSTSEC-2026-0195 quick-xml 0.38.4 7.5
+2026-10-23 RUSTSEC-2026-0344 ruzstd 0.8.3 7.5
diff --git a/tools/sca.sh b/tools/sca.sh
new file mode 100755
index 00000000..e76e6a68
--- /dev/null
+++ b/tools/sca.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Dependency scan (C2PA Generator Product Security Requirements O.3/O.4, Level 1): osv-scanner over the lockfiles of
+# everything that makes or signs an export, CRITICAL and HIGH advisories (CVSS 7 and up) listed with when raea first
+# saw each. Fails when one has gone unfixed more than 90 days after it was first seen.
+# tools/sca.sh scan and report (CI's gate); a finding not yet recorded counts as seen today
+# tools/sca.sh --record also add new findings to the record (io/provenance/conformance/sca-seen.tsv)
+# Needs osv-scanner (brew install osv-scanner) and jq.
+set -eu
+cd "$(dirname "$0")/.."
+SEEN=io/provenance/conformance/sca-seen.tsv
+DAYS=90
+LOCKS=(Cargo.lock engine/sandbox/wsx/Cargo.lock apps/site/api/pnpm-lock.yaml)
+record=0; [ "${1:-}" = --record ] && record=1
+command -v osv-scanner >/dev/null || { echo "sca: no osv-scanner (brew install osv-scanner)" >&2; exit 2; }
+
+args=(); for l in "${LOCKS[@]}"; do [ -f "$l" ] && args+=(--lockfile "$l"); done
+out=$(mktemp); trap 'rm -f "$out"' EXIT
+# exit 1 means it found something, which is the normal case; anything else is the scanner failing
+osv-scanner scan source "${args[@]}" --format json > "$out" 2>/dev/null || [ $? = 1 ] || { echo "sca: osv-scanner failed" >&2; exit 2; }
+
+today=$(date +%F); now=$(date +%s); late=0; new=0
+[ -f "$SEEN" ] || printf 'first_seen\tid\tpackage\tversion\tseverity\n' > "$SEEN"
+while IFS=$'\t' read -r id pkg ver sev; do
+ first=$(awk -F'\t' -v i="$id" -v p="$pkg" -v v="$ver" '$2==i && $3==p && $4==v {print $1; exit}' "$SEEN")
+ if [ -z "$first" ]; then
+ first=$today; new=$((new + 1))
+ [ $record = 1 ] && printf '%s\t%s\t%s\t%s\t%s\n' "$today" "$id" "$pkg" "$ver" "$sev" >> "$SEEN"
+ fi
+ age=$(( (now - $(date -j -f %F "$first" +%s)) / 86400 ))
+ state=open; [ $age -gt $DAYS ] && { state=LATE; late=$((late + 1)); }
+ printf '%-5s %-22s %-28s %-10s cvss %-4s seen %s (%d days)\n' "$state" "$id" "$pkg" "$ver" "$sev" "$first" "$age"
+done < <(jq -r '.results[].packages[] | .package as $p | .groups[]
+ | select((.max_severity | tonumber? // 0) >= 7)
+ | [(.ids | sort | .[0]), $p.name, $p.version, .max_severity] | @tsv' "$out" | sort -u)
+
+echo "sca: $late past $DAYS days, $new not yet recorded$([ $record = 1 ] && echo ' (recorded)')"
+[ $late = 0 ]
diff --git a/tools/sdk-coverage b/tools/sdk-coverage
new file mode 100755
index 00000000..bf309ea6
--- /dev/null
+++ b/tools/sdk-coverage
@@ -0,0 +1,279 @@
+#!/bin/bash
+# What of Bevy and Blitz an author reaches from raea's SDK, and how (docs/handoff/sdk.md, docs/sdk.feature S8).
+#
+# tools/sdk-coverage write docs/sdk-coverage.md from the registry snapshot and the sources
+# tools/sdk-coverage --registry first retake the snapshot (docs/sdk-coverage/bevy.tsv) from the plugin build's
+# raea-bevy-sdk (RAEA_BEVY_SDK, default target/release/raea-bevy-sdk)
+# tools/sdk-coverage --check the ratchet (tools/agents/check): the reached count is at least
+# tools/sdk-coverage.min, and docs/sdk-coverage.md is what this writes
+# tools/sdk-coverage --rows print the rows (area, item, kind, tier, reach or reason) as TSV
+#
+# Each authorable thing is one row, with its tier:
+# 1 typed: a hand-written component or hook. Bevy: a `@bevy <type path>` tag in the doc comment of the sdk/*/src
+# export that sets it. CSS: a property React's CSSProperties types (csstype), on an element Blitz draws. An
+# element: one React's JSX types.
+# 2 reflected: a typed handle generated from the type registry (sdk/render/src/bevy-own.gen.tsx in every build;
+# a project's bevy/<plugin>.gen.tsx from tools/bevy-plugins.sh gen; the catalog's are raea/plugins/<plugin>)
+# 3 plugin: added by one declaration (package.json raea.plugins), and in the plugin build
+# n not rendered: a CSS property an author writes and Chrome draws, which Blitz never reads (a gap, not reached)
+# s SVG attribute only: an SVG property Blitz passes to usvg from the element's attributes and style="", not from
+# a stylesheet (a gap for blitz-bridge's SVG parity, not reached)
+# b blocked upstream: a declared plugin with no release on this Bevy, and its exit condition
+# - excluded: not authorable, with the reason docs/sdk-coverage/excluded.tsv gives
+# 0 unmapped: nothing reaches it yet
+# Sources: the Bevy rows are every component, resource, event, message, state and asset in the registry of the plugin
+# build's App (RaeaPlugins and every declared plugin); the CSS rows are every property stylo parses for servo
+# (vendor/stylo/properties/*.toml without engine = "gecko"), those Blitz never reads by name not rendered; the element
+# rows are those blitz-dom names (local_name!) or styles (its default.css).
+set -uo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+D=docs/sdk-coverage
+OUT=docs/sdk-coverage.md
+MIN=tools/sdk-coverage.min
+BENCH=sdk/raea/bench/bevy-plugins
+# the catalog's generated modules, raea/plugins/<name> (the bench's raea.generated)
+PLUGINS=sdk/plugins/src
+STYLO=vendor/stylo/properties
+# node_modules aren't in git: a clean export (tools/agents/check on a lane) reads the shared tree's
+NM=sdk/raea/node_modules; [ -d $NM ] || NM=${RAEA_NODE_MODULES:-$HOME/raea/sdk/raea/node_modules}
+CSSTYPE=$NM/csstype/index.d.ts
+REACT=$NM/@types/react/index.d.ts
+[ -f "$CSSTYPE" ] && [ -f "$REACT" ] || { echo "sdk-coverage: no csstype or @types/react under $NM (bun install in sdk/raea)" >&2; exit 2; }
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/sdk-coverage.XXXXXX")
+trap 'rm -rf "$TMP"' EXIT
+
+mode=${1:-write}
+
+if [ "$mode" = --registry ]; then
+ BIN=${RAEA_BEVY_SDK:-$ROOT/target/release/raea-bevy-sdk}
+ [ -x "$BIN" ] || { echo "sdk-coverage: no raea-bevy-sdk at $BIN (tools/bevy-plugins.sh build $BENCH)" >&2; exit 2; }
+ log=$("$BIN" --prefix "" --registry "$TMP/registry.tsv" -o "$TMP/all.tsx" 2>&1) || { echo "$log" | tail -5 >&2; exit 1; }
+ plugins=$(sed -n 's/.*plugins compiled: \[\(.*\)\].*/\1/p' <<<"$log" | tr -d '" ' | tr , '\n' | sort)
+ {
+ echo "# The plugin build's TypeRegistry: every component, resource, event, message, state and asset (tools/sdk-coverage --registry)"
+ echo "# compiled plugins: $(echo $plugins)"
+ cat "$TMP/registry.tsv"
+ } > $D/bevy.tsv
+ echo "sdk-coverage: $D/bevy.tsv: $(grep -vc '^#' $D/bevy.tsv) types, $(echo "$plugins" | grep -c .) plugins compiled"
+ mode=write
+fi
+
+if [ "$mode" = --upstream ]; then
+ # each declared plugin with no version for Bevy 0.20: its latest unyanked release on crates.io and the bevy it needs
+ {
+ echo "# name crate latest bevy (crates.io's index, tools/sdk-coverage --upstream, $(date +%F))"
+ jq -r '.raea.plugins | to_entries[] | select(.value.versions["0.20"] == null) | [.key, .value.crate] | @tsv' $BENCH/package.json |
+ while IFS=$'\t' read -r name crate; do
+ l=$(tr A-Z a-z <<<"$crate")
+ case ${#l} in 1) p=1/$l ;; 2) p=2/$l ;; 3) p=3/${l:0:1}/$l ;; *) p=${l:0:2}/${l:2:2}/$l ;; esac
+ curl -sf "https://index.crates.io/$p" |
+ jq -r --arg n "$name" --arg c "$crate" -s 'map(select(.yanked | not)) | last | [$n, $c, .vers, ([.deps[] | select(.name | test("^bevy(_ecs|_app|_internal)?$")) | .req] | first // "?")] | @tsv'
+ done
+ } > $D/upstream.tsv
+ echo "sdk-coverage: $D/upstream.tsv: $(grep -vc '^#' $D/upstream.tsv) plugins looked up"
+ mode=write
+fi
+
+# --- what reaches what ------------------------------------------------------------------------------------------
+
+# tier 1, Bevy: `@bevy <path>` tags, each with the export after it (path, export, file)
+for f in $(rg -l '@bevy [a-z_]+::' sdk/*/src -g '*.ts' -g '*.tsx' -g '!*.gen.*' 2>/dev/null); do
+ awk -v f="$f" '
+ { while (match($0, /@bevy [a-z_][A-Za-z0-9_:<>, ]*[A-Za-z0-9_>]/)) { tags[++n] = substr($0, RSTART + 6, RLENGTH - 6); $0 = substr($0, RSTART + RLENGTH) } }
+ n && /^export (default )?(async )?(function|const|class|interface|type|let) / {
+ name = $0; sub(/^export (default )?(async )?(function|const|class|interface|type|let) /, "", name); sub(/[^A-Za-z0-9_$].*/, "", name)
+ for (i = 1; i <= n; i++) printf "%s\t%s\t%s\n", tags[i], name, f
+ n = 0
+ }' "$f"
+done | sort -u > "$TMP/typed"
+
+# tier 2: generated handles: every-build wrappers, then each plugin's (path, export)
+rg -o --no-filename -N 'type="[^"]+"' sdk/render/src/bevy-own.gen.tsx | sed 's/^type="//; s/"$//' | sort -u |
+ awk -F'\t' '{printf "%s\traea/bevy-own\n", $1}' > "$TMP/gen"
+for g in $PLUGINS/*.gen.tsx; do
+ p=$(basename "$g" .gen.tsx)
+ rg -o --no-filename -N '^ [A-Za-z0-9_]+: (component|resource|event|message|state)(<[^(]*>)?\("[^"]+"\)' "$g" |
+ sed -E "s/^ ([A-Za-z0-9_]+): .*\(\"([^\"]+)\"\)$/\2\t$p.\1 (raea\/plugins\/$p)/"
+done | sort -t$'\t' -k1,1 -u >> "$TMP/gen"
+sort -t$'\t' -k1,1 -u "$TMP/gen" -o "$TMP/gen"
+
+# excluded: area, prefix, reason
+grep -v '^#' $D/excluded.tsv | grep . > "$TMP/excluded" || true
+
+# Each row's tier: rows "area item kind tier reach" come in with tier 0 (or the tier a source proved), and a
+# row still at 0 whose item an excluded prefix of its area starts takes that exclusion.
+exclude() {
+ awk -F'\t' -v OFS='\t' -v ex="$TMP/excluded" '
+ BEGIN { while ((getline l < ex) > 0) { split(l, a, "\t"); n++; area[n] = a[1]; pre[n] = a[2]; why[n] = a[3] } }
+ $4 == "0" { for (i = 1; i <= n; i++) if (area[i] == $1 && index($2, pre[i]) == 1) { $4 = "-"; $5 = why[i]; break } }
+ { print }'
+}
+
+# --- rows -------------------------------------------------------------------------------------------------------
+
+rows() {
+ # Bevy's registry
+ grep -v '^#' $D/bevy.tsv | awk -F'\t' -v OFS='\t' -v typed="$TMP/typed" -v gen="$TMP/gen" '
+ BEGIN {
+ while ((getline l < typed) > 0) { split(l, a, "\t"); t[a[1]] = (a[1] in t ? t[a[1]] ", " : "") a[2] " (" a[3] ")" }
+ while ((getline l < gen) > 0) { split(l, a, "\t"); if (!(a[1] in g)) g[a[1]] = a[2] }
+ }
+ { if ($1 in t) print "bevy", $1, $2, 1, t[$1]; else if ($1 in g) print "bevy", $1, $2, 2, g[$1]; else print "bevy", $1, $2, 0, "" }'
+
+ # plugins: each declaration the bench project makes. Reached when the plugin build registers it, or when a library
+ # with no Plugin to register is in every plugin App (builtin: bevy_remote) or has generated handles (raea/plugins/NAME);
+ # a library compiled in that nothing reaches is unmapped. One with no version for
+ # Bevy 0.20 is this lane's to declare when crates.io has a release on 0.20 (docs/sdk-coverage/upstream.tsv, from
+ # --upstream), and blocked upstream until then.
+ compiled=" $(sed -n 's/^# compiled plugins: //p' $D/bevy.tsv) "
+ jq -r '.raea.plugins | to_entries[] | [.key, .value.crate, (.value.versions["0.20"] != null), (.value.plugin != null), (.value.builtin // false)] | @tsv' $BENCH/package.json |
+ while IFS=$'\t' read -r name crate v20 has_plugin builtin; do
+ case $compiled in
+ *" $name "*) printf 'plugin\t%s\tdeclared\t3\traea.plugins: "%s" (%s)\n' "$name" "$name" "$crate"; continue ;;
+ esac
+ if [ "$v20" = true ] && [ "$has_plugin" = false ] && { [ "$builtin" = true ] || grep -qE "^ [A-Za-z_]+: " "$PLUGINS/$name.gen.tsx" 2>/dev/null; }; then
+ printf 'plugin\t%s\tdeclared\t3\traea.plugins: "%s" (%s): compiled in, no Plugin to register\n' "$name" "$name" "$crate"
+ elif [ "$v20" = true ] && [ "$has_plugin" = false ]; then
+ printf 'plugin\t%s\tdeclared\t0\t%s: compiled in, but nothing reaches it (no Plugin, no generated handles)\n' "$name" "$crate"
+ elif [ "$v20" = true ]; then
+ printf 'plugin\t%s\tdeclared\t0\t%s: declared for 0.20, not registered in the plugin build\n' "$name" "$crate"
+ else
+ awk -F'\t' -v OFS='\t' -v n="$name" -v c="$crate" '$1 == n { found = 1
+ if ($4 ~ /0\.20/) print "plugin", n, "declared", 0, c " " $3 " is on bevy " $4 ": declare its 0.20 version (this lane, tools/bevy-plugins.sh)"
+ else print "plugin", n, "declared", "b", c "'"'"'s latest release (" $3 ") is on bevy " $4 ". Exit: a release of " c " on Bevy 0.20" }
+ END { if (!found) print "plugin", n, "declared", 0, c ": no version for 0.20 (tools/sdk-coverage --upstream looks it up)" }' $D/upstream.tsv
+ fi
+ done
+
+ # CSS: what Blitz reads by name (its source's `.name` and `.clone_name`), and what csstype types
+ rg -o --no-filename -N '\.(clone_)?[a-z_][a-z0-9_]*' vendor/blitz-dom/src vendor/blitz-paint/src \
+ "$(ls -d ~/.cargo/registry/src/*/stylo_taffy-"$(awk '/^name = "stylo_taffy"/{getline; gsub(/version = |"/, ""); print; exit}' Cargo.lock)" 2>/dev/null | head -1)/src" 2>/dev/null |
+ sed 's/^\.//; s/^clone_//' | sort -u > "$TMP/blitz-reads"
+ # csstype's, and raea's own for what csstype doesn't type yet (sdk/video/src/css.ts, which augments csstype)
+ { rg -o --no-filename -N '^ +"?[A-Za-z]+"?\??: Property\.' "$CSSTYPE"; rg -o --no-filename -N '^ [a-zA-Z]+\?:' sdk/video/src/css.ts; } | sed -E 's/^ +"?([A-Za-z]+)"?.*/\1/' | sort -u > "$TMP/csstype"
+ # Each servo property: name, kind, its sub-properties (a shorthand's) and its logical group. A logical longhand
+ # (margin-inline-start) is drawn when its group's physical longhands are: stylo's cascade maps it onto them, so Blitz
+ # never names it. Animations and transitions are run by stylo's animation engine, which Blitz drives
+ # (resolve(current_time_for_animations)); their values reach the frame as the animated properties'.
+ for kind in longhand shorthand; do
+ awk -v kind=$kind '
+ function flush() { if (name != "" && name !~ /\./ && !gecko) printf "%s\t%s\t%s\t%s\t%d\t%s\n", name, kind, subs, group, logical, strct; name = ""; gecko = 0; subs = ""; insub = 0; group = ""; logical = 0; strct = "" }
+ /^\[[^]]+\]$/ { flush(); name = substr($0, 2, length($0) - 2); next }
+ /^engine = "gecko"/ { gecko = 1 }
+ /^logical = true/ { logical = 1 }
+ /^struct = / { strct = $0; sub(/^struct = "/, "", strct); sub(/".*/, "", strct) }
+ /^logical_group = / { group = $0; sub(/^logical_group = "/, "", group); sub(/".*/, "", group) }
+ /^sub_properties = \[/ { insub = 1; s = $0; sub(/^sub_properties = \[/, "", s); subs = subs s }
+ insub && !/^sub_properties/ { subs = subs $0 }
+ insub && /\]/ { insub = 0 }
+ END { flush() }' $STYLO/${kind}s.toml
+ done | awk -F'\t' -v OFS='\t' -v reads="$TMP/blitz-reads" -v types="$TMP/csstype" '
+ function ident(n, s) { s = n; gsub(/-/, "_", s); return s }
+ function camel(n, p, k, i, s, w) { k = split(n, p, "-"); s = ""; for (i = 1; i <= k; i++) { if (p[i] == "") continue; w = p[i]; if (i > 1) w = toupper(substr(w, 1, 1)) substr(w, 2); s = s w } return s }
+ BEGIN { while ((getline l < reads) > 0) r[l] = 1; while ((getline l < types) > 0) c[l] = 1 }
+ { n++; name[n] = $1; kind[n] = $2; subs[n] = $3; group[n] = $4; logical[n] = $5; svg[n] = ($6 ~ /^(inherited_)?svg$/ && $1 !~ /^(clip-path|mask-(image|position-x|position-y|repeat|size|mode|clip|origin|composite))$/)
+ if ($2 == "longhand" && !$5 && $4 != "" && (ident($1) in r)) physical[$4] = 1 }
+ END {
+ for (i = 1; i <= n; i++) if (kind[i] == "longhand") {
+ how[name[i]] = (ident(name[i]) in r) ? "read" : (logical[i] && group[i] in physical) ? "logical" : (name[i] ~ /^(animation|transition)-/) ? "animated" : ""
+ }
+ for (i = 1; i <= n; i++) {
+ h = ""
+ if (kind[i] == "longhand") h = how[name[i]]
+ else if (name[i] ~ /^(animation|transition)$/) h = "animated"
+ else { s = subs[i]; gsub(/[][", ]/, " ", s); k = split(s, sb, " "); for (j = 1; j <= k; j++) if (how[sb[j]] != "") { h = "read"; break } }
+ cm = camel(name[i]); typed = (cm in c)
+ why = (h == "logical") ? "; stylo maps it onto its physical longhands, which Blitz draws" : (h == "animated") ? "; stylo animates it, and Blitz draws the animated values" : ""
+ if (h == "" && svg[i]) print "css", name[i], kind[i], "s", (typed ? "style={{ " cm " }} types it" : "csstype has no " cm) "; drawn on an inline <svg> when written as its attribute or in its style=\"\" (blitz-dom serializes those for usvg), not when a stylesheet or class sets it (the computed value never reaches usvg)"
+ else if (h == "") print "css", name[i], kind[i], "n", (typed ? "style={{ " cm " }} types it" : "csstype has no " cm) "; stylo parses it, Blitz never reads it by name, so nothing lays it out or paints it"
+ else if (typed) print "css", name[i], kind[i], 1, "style={{ " cm " }} (React CSSProperties)" why
+ else print "css", name[i], kind[i], 0, "Blitz draws it" why "; csstype has no " cm
+ }
+ }'
+
+ # elements: the type selectors of blitz-dom's default stylesheet, and the names its code matches that are elements
+ # (local_name! names attributes too, so those count only when React's JSX has the element)
+ # React's elements, and raea's own (sdk/ui/src/elements.ts: view3d and its parts)
+ rg -o --no-filename -N '^ [a-z][a-z0-9]*: [A-Z][A-Za-z0-9]*Attributes;' sdk/ui/src/elements.ts | sed -E 's/^ +([a-z0-9]+):.*/\1/' | sort -u > "$TMP/own"
+ { awk '/interface IntrinsicElements/ { p = 1 } p' "$REACT" | rg -o --no-filename -N '^ +"?[a-z][a-zA-Z0-9-]*"?: React\.' | sed -E 's/^ +"?([^":]+)"?: .*/\1/'; cat "$TMP/own"; } | sort -u > "$TMP/jsx"
+ {
+ tr '\n' ' ' < vendor/blitz-dom/assets/default.css | sed 's#/\*[^*]*\*\{1,\}\([^/*][^*]*\*\{1,\}\)*/##g' | awk 'BEGIN { RS = "}" }
+ { n = split($0, p, "{"); if (n < 2) next; s = p[n - 1]; if (s ~ /@/) next
+ gsub(/\[[^]]*\]/, " ", s); gsub(/::?[a-z-]+(\([^)]*\))?/, " ", s); gsub(/[.#][A-Za-z0-9_-]+/, " ", s); gsub(/[a-z*]*\|/, "", s)
+ k = split(s, t, /[ ,>+~()]+/); for (i = 1; i <= k; i++) if (t[i] ~ /^[a-z][a-z0-9]*$/) print t[i] }'
+ rg -o --no-filename -N 'local_name!\("[a-z][a-z0-9-]*"\)' vendor/blitz-dom/src | sed 's/local_name!("//; s/")//' | grep -Fxf "$TMP/jsx"
+ } | sort -u > "$TMP/elements"
+ awk -F'\t' -v OFS='\t' -v jsx="$TMP/jsx" -v own="$TMP/own" 'BEGIN { while ((getline l < jsx) > 0) j[l] = 1; while ((getline l < own) > 0) o[l] = 1 }
+ { if ($1 in o) print "element", $1, "html", 1, "<" $1 "> (raea JSX, sdk/ui/src/elements.ts)"; else if ($1 in j) print "element", $1, "html", 1, "<" $1 "> (React JSX)"; else print "element", $1, "html", 0, "React JSX has no <" $1 ">" }' "$TMP/elements"
+}
+
+rows | exclude > "$TMP/rows"
+[ "$mode" = --rows ] && { cat "$TMP/rows"; exit 0; }
+
+reached=$(awk -F'\t' '$4 ~ /^[123]$/' "$TMP/rows" | wc -l | tr -d ' ')
+unmapped=$(awk -F'\t' '$4 == "0"' "$TMP/rows" | wc -l | tr -d ' ')
+
+# --- the page ---------------------------------------------------------------------------------------------------
+
+md() {
+ cat <<'EOF'
+# SDK coverage
+
+What of Bevy and Blitz an author reaches from raea's SDK, and how. Generated by `tools/sdk-coverage` (its header
+says where each list comes from); don't edit, regenerate. A row says what reaches the type today; unbuilt work is in
+docs/handoff/sdk.md.
+
+Tiers: **1** typed (a hand-written component, hook or typed style prop), **2** reflected (a typed handle generated
+from the type registry), **3** plugin (one declaration), **not rendered** (an author writes it, and Chrome draws it, but
+Blitz doesn't: a gap, never counted as reached), **SVG attribute only** (an SVG property drawn when it's written as
+the element's attribute or inline style, not when a stylesheet sets it: a gap), **blocked upstream** (a plugin with no release on this Bevy, and
+what ends the block), **excluded** (not authorable, with the reason), **unmapped** (nothing
+reaches it yet).
+
+EOF
+ echo "| area | kind | tier 1 | tier 2 | tier 3 | not rendered | SVG attribute only | blocked upstream | excluded | unmapped | total |"
+ echo "|---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|"
+ awk -F'\t' '{ k = $1 "\t" $3; c[k, $4]++; t[k]++; if (!(k in seen)) { seen[k] = 1; order[++n] = k } }
+ END { for (i = 1; i <= n; i++) { k = order[i]; split(k, a, "\t"); printf "| %s | %s | %d | %d | %d | %d | %d | %d | %d | %d | %d |\n", a[1], a[2], c[k, "1"], c[k, "2"], c[k, "3"], c[k, "n"], c[k, "s"], c[k, "b"], c[k, "-"], c[k, "0"], t[k] } }' \
+ <(sort -t$'\t' -k1,1 -k3,3 "$TMP/rows")
+ awk -F'\t' '{ c[$4]++ } END { printf "| **all** | | **%d** | **%d** | **%d** | **%d** | **%d** | **%d** | **%d** | **%d** | **%d** |\n", c["1"], c["2"], c["3"], c["n"], c["s"], c["b"], c["-"], c["0"], NR }' "$TMP/rows"
+ echo
+ echo "Reached (tiers 1-3): **$reached**. The ratchet (\`tools/sdk-coverage --check\`, in tools/agents/check) keeps it from dropping."
+ for area in bevy plugin css element; do
+ case $area in
+ bevy) title="Bevy types (the plugin build's TypeRegistry)" ;;
+ plugin) title="Plugins (package.json raea.plugins)" ;;
+ css) title="CSS properties (stylo, servo)" ;;
+ element) title="Elements (blitz-dom)" ;;
+ esac
+ echo; echo "## $title"; echo
+ echo "| item | kind | tier | reached by, or why not |"
+ echo "|---|---|---|---|"
+ awk -F'\t' -v a=$area '$1 == a { t = ($4 == "-") ? "excluded" : ($4 == "n") ? "not rendered" : ($4 == "s") ? "SVG attribute only" : ($4 == "b") ? "blocked upstream" : ($4 == "0") ? "unmapped" : $4; gsub(/\|/, "\\|", $5); printf "| `%s` | %s | %s | %s |\n", $2, $3, t, $5 }' "$TMP/rows"
+ done
+}
+
+md > "$TMP/md"
+
+if [ "$mode" = --check ]; then
+ floor=$(cat $MIN 2>/dev/null || echo 0)
+ ok=1
+ if [ "$reached" -lt "$floor" ]; then echo "sdk-coverage: reached $reached, below the floor $floor ($MIN)" >&2; ok=0; fi
+ # one form per Bevy concept (docs/control.feature FC1e): a Bevy type tagged on two exports is two spellings of it;
+ # the ratchet holds the count where it stands until the codemod moves the three.js-shaped ones and they go
+ dupes=$(awk -F'\t' '{ c[$1]++; e[$1] = e[$1] " " $2 } END { for (t in c) if (c[t] > 1) print t ":" e[t] }' "$TMP/typed" | sort)
+ nd=$(awk -F'\t' '{ c[$1]++ } END { for (t in c) if (c[t] > 1) n += c[t] - 1; print n + 0 }' "$TMP/typed")
+ maxd=$(cat tools/sdk-coverage.dupes 2>/dev/null || echo 0)
+ if [ "$nd" -gt "$maxd" ]; then echo "sdk-coverage: $nd exports beside a Bevy type's first (allowed $maxd, tools/sdk-coverage.dupes): one form per concept, so move the newer to the existing export:" >&2; echo "$dupes" | sed 's/^/ /' >&2; ok=0; fi
+ [ "$nd" -lt "$maxd" ] && echo "sdk-coverage: note $nd second exports of a Bevy type now, under $maxd: lower tools/sdk-coverage.dupes" >&2
+ # a stale page is a note, not a failure: another lane's change to Blitz or a generated file moves rows it doesn't own
+ cmp -s "$TMP/md" $OUT || echo "sdk-coverage: note $OUT is out of date (tools/sdk-coverage rewrites it)" >&2
+ [ $ok = 1 ] && echo "sdk-coverage: ok, reached $reached (floor $floor), unmapped $unmapped"
+ [ $ok = 1 ]; exit $?
+fi
+
+cp "$TMP/md" $OUT
+floor=$(cat $MIN 2>/dev/null || echo 0)
+[ "$reached" -gt "$floor" ] && echo "$reached" > $MIN
+echo "sdk-coverage: wrote $OUT: reached $reached, unmapped $unmapped (floor $(cat $MIN))"
diff --git a/tools/sdk-coverage.dupes b/tools/sdk-coverage.dupes
new file mode 100644
index 00000000..573541ac
--- /dev/null
+++ b/tools/sdk-coverage.dupes
@@ -0,0 +1 @@
+0
diff --git a/tools/sdk-coverage.min b/tools/sdk-coverage.min
new file mode 100644
index 00000000..525c173d
--- /dev/null
+++ b/tools/sdk-coverage.min
@@ -0,0 +1 @@
+1548
diff --git a/tools/sdk-fields b/tools/sdk-fields
new file mode 100755
index 00000000..e5a45a73
--- /dev/null
+++ b/tools/sdk-fields
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Field coverage (docs/control.feature FC0b): each tier-1 Bevy type's reflected fields against the typed props that name
+# them (tools/sdk-fields.ts), written to docs/control/fields.tsv, and the totals.
+# tools/sdk-fields needs target/release/raea-bevy-sdk (the plugin build's) for the schema
+set -euo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT"
+T=${TMPDIR:-/tmp}/raea-sdk-fields
+mkdir -p "$T" docs/control
+tools/sdk-coverage --rows > "$T/rows.tsv"
+args=()
+while IFS=$'\t' read -r area item _ tier _; do
+ [ "$area" = bevy ] && [ "$tier" = 1 ] && args+=(--type "$item")
+done < "$T/rows.tsv"
+target/release/raea-bevy-sdk "${args[@]}" --schema "$T/schema.json" -o "$T/schema.ts" > "$T/sdk.log" 2>&1
+bun tools/sdk-fields.ts "$T/rows.tsv" "$T/schema.json" > docs/control/fields.tsv
+tail -1 docs/control/fields.tsv
diff --git a/tools/sdk-fields.ts b/tools/sdk-fields.ts
new file mode 100644
index 00000000..84136fa2
--- /dev/null
+++ b/tools/sdk-fields.ts
@@ -0,0 +1,69 @@
+// Field coverage (docs/control.feature FC0b): for each Bevy type the SDK says it reaches by hand (a tier-1 row of
+// tools/sdk-coverage), its reflected fields (raea-bevy-sdk --schema) against the props of the exports that set it: the
+// tagged export and the Bevy-named one of the same short name in sdk/render/src/bevy3d. A field counts as named when a
+// prop of either has its name. Named isn't proven: the round trip (set the prop, read the component back over BRP) is
+// FC0b's second half. Props with no field of that name are listed too: each is a convention (a raea name or unit) or a
+// prop for another component.
+//
+// bun tools/sdk-fields.ts ROWS.tsv SCHEMA.json > docs/control/fields.tsv
+// (sdk/shell holds the classic compiler, whose API this reads; sdk/raea's is TS 7's native one.)
+// ROWS.tsv is `tools/sdk-coverage --rows`; SCHEMA.json is raea-bevy-sdk --type T... --schema's output.
+import ts from "../sdk/shell/node_modules/typescript/lib/typescript.js";
+import { readFileSync, readdirSync } from "node:fs";
+import { join } from "node:path";
+
+const [rowsPath, schemaPath] = process.argv.slice(2);
+const root = join(import.meta.dir, "..");
+const schema = JSON.parse(readFileSync(schemaPath, "utf8")) as { types: Record<string, { fields?: { name: string }[] }> };
+
+const dirs = ["sdk/render/src/3d", "sdk/render/src/bevy3d", "sdk/render/src"];
+const files = dirs.flatMap((d) => readdirSync(join(root, d)).filter((f) => /\.tsx?$/.test(f) && !f.endsWith(".d.ts")).map((f) => join(root, d, f)));
+const program = ts.createProgram(files, { jsx: ts.JsxEmit.ReactJSX, target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.ESNext, moduleResolution: ts.ModuleResolutionKind.Bundler, strict: true, skipLibCheck: true, noEmit: true, allowImportingTsExtensions: true });
+const checker = program.getTypeChecker();
+
+// every exported function's first parameter's property names, by "file:Name" and by Name within bevy3d
+const props = new Map<string, Set<string>>();
+for (const f of files) {
+ const sf = program.getSourceFile(f);
+ if (!sf) continue;
+ const mod = checker.getSymbolAtLocation(sf);
+ if (!mod) continue;
+ const rel = f.slice(root.length + 1);
+ for (const sym of checker.getExportsOfModule(mod)) {
+ const decl = sym.valueDeclaration;
+ if (!decl || !(ts.isFunctionDeclaration(decl) || ts.isVariableDeclaration(decl))) continue;
+ const t = checker.getTypeOfSymbolAtLocation(sym, decl);
+ const sig = t.getCallSignatures()[0];
+ const p = sig?.getParameters()[0];
+ if (!p) continue;
+ const pt = checker.getTypeOfSymbolAtLocation(p, decl);
+ const names = new Set(checker.getApparentType(pt).getProperties().map((s) => s.getName()).filter((n) => n !== "children" && n !== "key"));
+ props.set(`${rel}:${sym.getName()}`, names);
+ }
+}
+
+const out = ["# type\tfields\tnamed\tmissing\textra props (no field of that name)\texports"];
+let total = 0, named = 0;
+for (const line of readFileSync(rowsPath, "utf8").split("\n")) {
+ const [area, item, , tier, reach] = line.split("\t");
+ if (area !== "bevy" || tier !== "1") continue;
+ // a tuple field (Mesh3d(Handle), RenderLayers(mask)) is set by the part itself or its children, not a prop
+ const fields = schema.types[item]?.fields?.map((f) => f.name).filter((n): n is string => typeof n === "string");
+ const short = item.replace(/<.*$/, "").split("::").pop()!;
+ const exports = [...(reach ?? "").matchAll(/(\w+) \(([^)]+)\)/g)].map((m) => `${m[2]}:${m[1]}`);
+ for (const f of ["sdk/render/src/bevy3d/core.tsx", "sdk/render/src/bevy3d/lights.tsx", "sdk/render/src/bevy3d/materials.tsx", "sdk/render/src/bevy3d/mesh2d.tsx", "sdk/render/src/bevy3d/raytracing.tsx"]) {
+ if (props.has(`${f}:${short}`)) exports.push(`${f}:${short}`);
+ }
+ const have = new Set(exports.flatMap((e) => [...(props.get(e) ?? [])]));
+ if (!fields) {
+ out.push([item, "-", "-", "no schema (an asset or a non-struct type)", "", exports.join(" ")].join("\t"));
+ continue;
+ }
+ const hit = fields.filter((f) => have.has(f));
+ const extra = [...have].filter((p) => !fields.includes(p)).sort();
+ total += fields.length;
+ named += hit.length;
+ out.push([item, fields.length, hit.length, fields.filter((f) => !have.has(f)).join(" "), extra.join(" "), exports.join(" ")].join("\t"));
+}
+out.push(`# all\t${total}\t${named}\t${total - named} fields no typed prop names`);
+console.log(out.join("\n"));
diff --git a/tools/sdk-props.max b/tools/sdk-props.max
new file mode 100644
index 00000000..573541ac
--- /dev/null
+++ b/tools/sdk-props.max
@@ -0,0 +1 @@
+0
diff --git a/tools/sdk-props.sh b/tools/sdk-props.sh
new file mode 100755
index 00000000..5196ef89
--- /dev/null
+++ b/tools/sdk-props.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Every exported prop of the SDK's engine components is read (tools/sdk-props, docs/sdk.feature S8c).
+#
+# tools/sdk-props.sh the unread, one a line, then the count
+# tools/sdk-props.sh --check the ratchet (tools/agents/check): no more unread than tools/sdk-props.max
+#
+# Built on first use and whenever its source is newer than the binary, in a lane and target dir of its own (as
+# tools/rask.sh): a small compile every L0 needs shouldn't queue behind the release builds on target/.
+set -euo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+T=$ROOT/target/sdk-props
+bin=$T/release/raea-sdk-props
+if [ ! -x "$bin" ] || [ -n "$(find "$ROOT/tools/sdk-props" -newer "$bin" 2>/dev/null | head -1)" ]; then
+ if command -v lane >/dev/null; then lane sdk-props -- cargo build --release -q -p raea-sdk-props --target-dir "$T" --manifest-path "$ROOT/Cargo.toml" >&2
+ else cargo build --release -q -p raea-sdk-props --target-dir "$T" --manifest-path "$ROOT/Cargo.toml" >&2; fi
+fi
+exec "$bin" "$@" "$PWD"
diff --git a/tools/size.allow b/tools/size.allow
new file mode 100644
index 00000000..337c0a9e
--- /dev/null
+++ b/tools/size.allow
@@ -0,0 +1,2 @@
+# allowance per file or crate over the limit (tools/size.sh): it only shrinks; split it and take the new size
+
diff --git a/tools/size.sh b/tools/size.sh
new file mode 100755
index 00000000..f4a85adf
--- /dev/null
+++ b/tools/size.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Size limits (Shane, 10-27): a code file is at most FILE_MAX lines and a Rust crate at most CRATE_MAX lines of its own
+# .rs (a nested crate's files count for that crate, not its parent), so any one file or crate stays small enough to hold
+# in context and to rebuild alone. Files and crates over the limit today are listed in tools/size.allow with their size
+# then; each may shrink but never grow, and one that isn't listed may not go over. The overhaul splits them until the
+# allow file is empty.
+# tools/size.sh check: each file or crate over its limit or allowance
+# tools/size.sh --report every crate: own lines, files, its largest file, workspace crates it uses, crates using it
+# tools/size.sh --update tools/size.allow rewritten to today's sizes (refused if any size rose)
+set -u
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT" || exit 2
+FILE_MAX=${FILE_MAX:-500}
+CRATE_MAX=${CRATE_MAX:-2000}
+ALLOW=tools/size.allow
+# code only; vendored crates are upstream's, lockfiles and type declarations are generated, and so is a file whose first
+# line says it was ("// Generated by ...": its generator checks it for drift, and nobody edits it)
+files() {
+ git ls-files --cached --others --exclude-standard -- '*.rs' '*.ts' '*.tsx' '*.mjs' '*.js' '*.sh' ':!vendor/*' ':!*/vendor/*' ':!**/node_modules/**' ':!*.d.ts' \
+ ':!*.min.js' | while read -r f; do [ -f "$f" ] && ! head -1 "$f" | grep -qi '^// generated by' && echo "$f"; done
+}
+# "lines path" per file over FILE_MAX
+big_files() { files | tr '\n' '\0' | xargs -0 wc -l 2>/dev/null | grep -v ' total$' | awk -v m="$FILE_MAX" '$1>m {print $1, $2}'; }
+# "name dir" per crate of ours, from the tracked Cargo.toml files (vendored ones left out). Not cargo metadata: L0
+# runs this in a copy of what lands, where the workspace resolves differently and nested crates went missing
+crates() {
+ git ls-files --cached --others --exclude-standard -- '*Cargo.toml' ':!vendor/*' ':!*/vendor/*' | while read -r f; do
+ [ -f "$f" ] || continue
+ n=$(awk -F'"' '/^\[package\]/ {p=1} p && /^name *=/ {print $2; exit}' "$f")
+ [ -n "$n" ] && echo "$n $(dirname "$f")"
+ done
+}
+# "lines crate:name" per crate: its own .rs, without any nested crate's
+crate_lines() {
+ local list dirs
+ list=$(crates)
+ dirs=$(echo "$list" | awk '{print $2}')
+ echo "$list" | while read -r name dir; do
+ local skip=() d
+ for d in $dirs; do case "$d" in "$dir"/*) skip+=(":!$d/*") ;; esac; done
+ n=$(git ls-files --cached --others --exclude-standard -- "$dir/*.rs" ${skip[@]+"${skip[@]}"} | while read -r f; do [ -f "$f" ] && cat "$f"; done | wc -l)
+ echo "$((n)) crate:$name"
+ done
+}
+current() { { big_files; crate_lines | awk -v m="$CRATE_MAX" '$1>m'; } | sort -k2; }
+
+if [ "${1:-}" = "--report" ]; then
+ meta=$(cargo metadata --format-version 1 2>/dev/null)
+ printf '%7s %5s %7s %4s %4s %s\n' lines files largest uses used crate
+ crates | while read -r name dir; do
+ n=$(crate_lines | awk -v c="crate:$name" '$2==c {print $1}')
+ nf=$(git ls-files --cached --others --exclude-standard -- "$dir/*.rs" | wc -l)
+ lg=$(git ls-files --cached --others --exclude-standard -- "$dir/*.rs" | tr '\n' '\0' | xargs -0 wc -l 2>/dev/null | grep -v ' total$' | sort -rn | head -1 | awk '{print $1}')
+ uses=$(echo "$meta" | jq --arg n "$name" '[.resolve.nodes[] | select(.id | test("[/#]" + $n + "[@#]")) | .deps[].name] as $d | [.packages[] | select(.source == null) | .name | gsub("-";"_")] as $w | [$d[] | select(. as $x | $w | index($x))] | length')
+ used=$(echo "$meta" | jq --arg n "$name" '[.packages[] | select(.source == null) | select(any(.dependencies[]; .name == $n))] | length')
+ printf '%7d %5d %7d %4d %4d %s\n' "$n" "$nf" "${lg:-0}" "$uses" "$used" "$name"
+ done | sort -rn
+ exit 0
+fi
+
+now=$(current)
+if [ "${1:-}" = "--update" ]; then
+ rose=$(join -1 2 -2 2 <(echo "$now") <(grep -v '^#' "$ALLOW" 2>/dev/null | sort -k2) | awk '$2>$3 {print $1 ": " $3 " -> " $2}')
+ [ -z "$rose" ] || { echo "size: refused, these grew:" >&2; echo "$rose" >&2; exit 1; }
+ { echo "# allowance per file or crate over the limit (tools/size.sh): it only shrinks; split it and take the new size"
+ echo "$now"; } > "$ALLOW"
+ echo "size: $(echo "$now" | grep -c .) over the limit, $ALLOW updated"
+ exit 0
+fi
+bad=0
+while read -r n what; do
+ [ -n "$what" ] || continue
+ a=$(awk -v w="$what" '$2==w {print $1}' "$ALLOW" 2>/dev/null)
+ case "$what" in crate:*) m=$CRATE_MAX ;; *) m=$FILE_MAX ;; esac
+ if [ -z "$a" ]; then echo "size: $what is $n lines, over the $m limit: split it" >&2; bad=1
+ elif [ "$n" -gt "$a" ]; then echo "size: $what grew to $n lines (allowed $a while it's split; limit $m)" >&2; bad=1; fi
+done <<< "$now"
+[ $bad -eq 0 ] && echo "size: ok ($(echo "$now" | grep -c .) still over the limit, none grew)"
+exit $bad
diff --git a/tools/skills.sh b/tools/skills.sh
new file mode 100755
index 00000000..41699fc7
--- /dev/null
+++ b/tools/skills.sh
@@ -0,0 +1,343 @@
+#!/bin/bash
+# The raea skill's generated references (docs/skills.feature SK1-SK2): the hand-written core, sdk/skills/raea/SKILL.md,
+# links these instead of repeating them, so a verb, a flag, a feed tool or an export changes its reference in the
+# same commit.
+#
+# tools/skills.sh gen write sdk/skills/raea/reference/{cli,feed,files,sdk,app}.md
+# tools/skills.sh check the drift gate (SK3, in L0): fails on a stale reference, a retired word, a flag a verb
+# doesn't take, a RAEA_* variable nothing reads, or a relative link that goes nowhere, each
+# with its file, line and fix. engine/cli/conformance/surface.test.ts checks the verbs and
+# guides named, and tools/context-examples.sh the examples; this doesn't repeat them.
+# It also warns (SK4) when a change touches a source a section names in its
+# `<!-- sources: PATH ... -->` line and leaves the section alone: the landing message answers
+# it ("checked, still true", or the edit). SKILLS_CHANGED lists the changed files (L0 passes
+# its own); else the changes since origin/main.
+# SKILLS_STRICT=1 (tools/release.sh) is a release's check: RAEA_BIN is the release's own
+# build of this tree, so its help is the truth and every difference fails.
+# tools/skills.sh stale every section with sources, by how many commits to them it has missed since it last changed
+#
+# Sources: cli.md from `raea help --json` (engine/cli/src/usage.rs); feed.md from FEED_TOOLS (apps/app
+# src/acp/protocol.ts), with each tool's access tag; files.md from a workspace and project raea makes in a scratch
+# folder, and the ~/.raea paths engine/cli and the feed's host name; sdk.md from the exports of each sdk/raea/src entry.
+# RAEA_BIN picks the raea (default: this checkout's target/debug/raea, else target/release/raea, else PATH), and
+# RAEA_APP the feed app's checkout (default apps/app; an L0 export has no submodules, so L0 names the shared one), read
+# at RAEA_APP_REV: the commit raea's tree records for apps/app (L0 passes its tree's), so what's generated follows the
+# submodule pointer, not whatever that checkout has on disk.
+set -euo pipefail
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+cd "$ROOT"
+OUT=${SKILLS_OUT:-sdk/skills/raea/reference}
+HEAD_LINE="<!-- generated by tools/skills.sh gen; do not edit -->"
+APP=${RAEA_APP:-apps/app}
+[ -f "$APP/src/acp/protocol.ts" ] || { echo "skills.sh: no feed app at $APP (RAEA_APP names its checkout)" >&2; exit 2; }
+APP=$(cd "$APP" && pwd)
+APP_REV=${RAEA_APP_REV:-$(git rev-parse -q --verify HEAD:apps/app 2>/dev/null || git -C "$APP" rev-parse HEAD)}
+git -C "$APP" cat-file -e "$APP_REV" 2>/dev/null || { echo "skills.sh: apps/app has no commit $APP_REV (fetch raea-feed)" >&2; exit 2; }
+
+raea_bin() {
+ if [ -n "${RAEA_BIN:-}" ]; then echo "$RAEA_BIN"
+ elif [ -x target/debug/raea ] && [ target/debug/raea -nt target/release/raea ]; then echo "$ROOT/target/debug/raea"
+ elif [ -x target/release/raea ]; then echo "$ROOT/target/release/raea"
+ else command -v raea; fi
+}
+
+gen_cli() {
+ "$R" help --json | jq -r --arg head "$HEAD_LINE" '
+ $head, "",
+ "# raea CLI",
+ "",
+ "Every verb `raea help` lists, with its forms, its flags (and how many values follow each) and where it runs:",
+ "HEADLESS needs nothing running; HOST needs the raea app'"'"'s host; PERSON waits on a click. A verb refuses a flag",
+ "or an argument its usage doesn'"'"'t name, so these lists are what it takes.",
+ "",
+ (.verbs[] |
+ "## raea \(.verb)", "",
+ "Access: \(.access). " + (if .own_parser then "Its arguments go to a parser of its own: `raea \(.verb)` alone lists them." else "Arguments besides flags: \(if .args == null then "any number" else .args end)." end), "",
+ "```", (.usage[]), "```", "",
+ (if (.flags | length) > 0 then
+ ("Flags: " + ([.flags[] | "`\(.flag)`" + (if .values > 0 then " (\(.values))" else "" end)] | join(", ")) + "."), ""
+ else empty end))'
+}
+
+gen_feed() {
+ # protocol.ts at the recorded commit (it imports nothing), evaluated from a scratch copy
+ local p; p=$(mktemp -d "${TMPDIR:-/tmp}/skills-feed.XXXXXX")
+ git -C "$APP" show "$APP_REV:src/acp/protocol.ts" > "$p/protocol.ts"
+ bun -e '
+ const { FEED_TOOLS } = await import(process.argv[1] + "/protocol.ts")
+ console.log(JSON.stringify(Object.entries(FEED_TOOLS).map(([name, t]) => ({ name, ...t }))))
+ ' "$p" | jq -r --arg head "$HEAD_LINE" '
+ $head, "",
+ "# The feed'"'"'s tools",
+ "",
+ "The tools the raea app offers every agent it launches, as the MCP server `feed` (apps/app host/acp/feed-mcp.ts).",
+ "PAGE: the feed'"'"'s page answers it, so the app must be open (or a windowless page); PERSON: a click finishes it.",
+ "With no page, use the CLI instead: `raea controller` for the controllers, `raea context .` for the brief.",
+ "",
+ (.[] |
+ "## \(.name)", "",
+ "Access: \(.access // "not tagged").", "",
+ .description, "",
+ (if ((.inputSchema.properties // {}) | length) > 0 then
+ ("| input | | |", "|---|---|---|",
+ ((.inputSchema.required // []) as $req | .inputSchema.properties | to_entries[] | .key as $k |
+ "| `\(.key)` | \(if ($req | index($k)) then "required" else "optional" end) | \((.value.description // .value.type // "") | gsub("\\|"; "\\\\|")) |"),
+ "")
+ else ("No input.", "") end))'
+ rm -rf "$p"
+}
+
+gen_app() {
+ # the raea app's window serves MCP (engine/page/host src/mcp.rs): its tools, read from the source as they're declared
+ printf '%s\n\n' "$HEAD_LINE"
+ cat <<'MD'
+# The app's window over MCP
+
+The raea app's window (raea-page-host, `raea-window` inside raea.app) can serve an MCP server on
+`http://127.0.0.1:PORT/mcp`: Streamable HTTP, JSON answers. It is how an agent drives the app as a person would and sees
+what they see: real input events, the interface's elements with their `data-testid`s, the window as a PNG, and any Bevy
+Remote Protocol method. Access: HOST. The packaged app serves it only when started with RAEA_PAGE_MCP_PORT set
+(tools/raea-app/launch.sh; RAEA_APP_HEADLESS=1 runs it with no window, as its own checks do); a page host started by
+hand serves 7477 unless RAEA_PAGE_MCP_PORT says otherwise (0: none). The conformance suite (sdk/ui/conformance) drives
+the app through `input` and `ui`.
+
+MD
+ perl -0ne 'while (/\{"name": "([a-z_]+)", "description": (?:"((?:[^"\\]|\\.)*)"|format!\("((?:[^"\\]|\\.)*)")/g) { my ($n, $d) = ($1, $2 // $3); $d =~ s/\\"/"/g; $d =~ s/\{\}/page/g; print "## $n\n\n$d\n\n" }' "$ROOT/engine/page/host/src/mcp.rs"
+}
+
+gen_files() {
+ local tmp; tmp=$(mktemp -d "${TMPDIR:-/tmp}/skills-gen.XXXXXX")
+ # a workspace and a project as raea makes them, with no global config of the person's
+ (
+ export GIT_CONFIG_GLOBAL="$tmp/gitconfig" GIT_AUTHOR_NAME=gen GIT_AUTHOR_EMAIL=gen@raea GIT_COMMITTER_NAME=gen GIT_COMMITTER_EMAIL=gen@raea
+ git config --global raea.root "$tmp/Studio"
+ mkdir -p "$tmp/Studio" && cd "$tmp/Studio"
+ "$R" workspace init Example >/dev/null
+ cd example && "$R" project new Launch >/dev/null
+ )
+ {
+ echo "$HEAD_LINE"
+ echo
+ echo "# Files"
+ echo
+ echo "## A workspace and its project"
+ echo
+ echo "What \`raea workspace init Example\` and then \`raea project new Launch\` make, under raea.root (\`git config"
+ echo "--global raea.root\`, else ~/Studio). The workspace is one git repo; media/ and out/ go to LFS."
+ echo
+ echo '```'
+ (cd "$tmp/Studio" && find example -path '*/.git' -prune -o -print | grep -v '/\.git$' | LC_ALL=C sort | sed 's|[^/]*/| |g')
+ echo '```'
+ echo
+ echo "## ~/.raea"
+ echo
+ echo "The files and folders under ~/.raea that raea's CLI, its engine and the raea app keep, the environment variable"
+ echo "that moves each (when there is one) and the files that name them."
+ echo
+ echo "| path | moved by | named in |"
+ echo "|---|---|---|"
+ { git grep -nE '\.raea(/|", ")[A-Za-z]' -- engine io runtime ':!*.test.*' ':!*/tests/*' ':!*.md'
+ git -C "$APP" grep -nE '\.raea(/|", ")[A-Za-z]' "$APP_REV" -- host ':!*.test.*' | sed "s|^$APP_REV:|apps/app/|"
+ } 2>/dev/null | perl -ne '
+ my ($f, $text) = /^([^:]+):\d+:(.*)$/ or next;
+ while ($text =~ m{(?<![\w.-]/)(?<![\w-])\.raea(?:/|", ")([A-Za-z][A-Za-z0-9_.-]*(?:/[A-Za-z][A-Za-z0-9_.-]*)?)}g) {
+ my $p = $1; $p =~ s/\.$//; next if $p =~ /^(workspace|project)\b/;
+ my $env = $text =~ /(?:process\.env\.(RAEA_\w+)\s*\?\?|env::var(?:_os)?\("(RAEA_\w+)"\))/ ? ($1 // $2) : "";
+ $env{$p} ||= $env; $files{$p}{$f} = 1;
+ }
+ END { for my $p (sort keys %files) { printf "| `~/.raea/%s` | %s | %s |\n", $p, $env{$p} ? "`$env{$p}`" : "", join(", ", sort keys %{$files{$p}}) } }'
+ echo
+ echo "## The spec files"
+ echo
+ echo "Each spec's fields, as raea/brief's types (sdk/raea/src/brief.gen.ts, generated from the schemas in core/brief that"
+ echo "\`raea spec\` checks against): brief.ts is a Brief, NAME.script.ts a Script, taste.ts a Taste, plan.ts a Plan and"
+ echo "controllers/ID.ts a Controller. A field marked ? may be left out."
+ echo
+ echo '```ts'
+ grep -v '^// Generated' "$ROOT/sdk/raea/src/brief.gen.ts" | sed '/^$/d'
+ echo '```'
+ }
+ rm -rf "$tmp"
+}
+
+gen_sdk() {
+ bun -e '
+ const root = process.argv[1], dir = root + "/sdk/raea/src"
+ const t = new Bun.Transpiler({ loader: "tsx" })
+ const skip = /(\.gen\.ts|^test\.tsx|^native-calls\.ts|^prelude\.ts|^pure\.ts)$/
+ const files = [...new Bun.Glob("*.{ts,tsx}").scanSync(dir)].filter((f) => !skip.test(f)).sort()
+ const rows = files.map((f) => ({ entry: f.startsWith("index.") ? "raea" : "raea/" + f.replace(/\.tsx?$/, ""), file: "sdk/raea/src/" + f, names: t.scan(require("fs").readFileSync(dir + "/" + f, "utf8")).exports.filter((n) => n !== "default").sort() }))
+ console.log(JSON.stringify(rows.sort((a, b) => (a.entry === "raea" ? -1 : b.entry === "raea" ? 1 : a.entry.localeCompare(b.entry)))))
+ ' "$ROOT" | jq -r --arg head "$HEAD_LINE" '
+ $head, "",
+ "# The raea SDK",
+ "",
+ "What each import gives a composition, a game or a spec (values only; their types come along). Components start",
+ "with a capital, hooks with `use`. A component'"'"'s props are in its file.",
+ "",
+ (.[] | select((.names | length) > 0) |
+ "## `\(.entry)` (\(.file))", "",
+ ([.names[] | "`\(.)`"] | join(", ")), "")'
+}
+
+
+# the hand-written text the gate reads: the skills (not their generated references) and the craft guides
+texts() { git ls-files -co --exclude-standard -- 'sdk/skills/raea*' sdk/guides/craft | grep -E '\.md$' | grep -v '/reference/' | grep -v '^sdk/skills/raea-work/'; }
+
+# the raea is older than the help's sources as committed: its help would be stale (L0's cli surface step rebuilds it)
+help_stale() {
+ [ "${SKILLS_STRICT:-0}" = 1 ] && return 1
+ local built newest
+ built=$(stat -f %m "$R" 2>/dev/null || stat -c %Y "$R")
+ # the history is the binary's own checkout's (an L0 export has none)
+ local co; co=$(cd "$(dirname "$(realpath "$R")")/../.." 2>/dev/null && pwd); [ -f "$co/engine/cli/src/cli.rs" ] || co=$ROOT
+ newest=$(git -C "$co" log -1 --no-merges --format=%at -- engine/cli/src apps/check/src apps/game/src apps/tools/src runtime/react/src/scene.rs runtime/react/src/scene 2>/dev/null)
+ [ -n "$newest" ] && [ "$built" -lt "$newest" ]
+}
+
+check() {
+ local fail=0 tmp; tmp=$(mktemp -d "${TMPDIR:-/tmp}/skills-check.XXXXXX")
+ # 1. stale references: what gen writes now, against what's committed beside the skill
+ if help_stale; then
+ echo "skills: note $R is older than the help's sources; cli.md and the flags aren't checked (rebuild raea-cli)"
+ fi
+ local stale_help=0; help_stale && stale_help=1
+ SKILLS_OUT=$tmp/ref R=$R SKIP_CLI=$stale_help "$0" gen-into >/dev/null || { echo "FAIL skills: tools/skills.sh gen failed"; rm -rf "$tmp"; return 1; }
+ for f in cli feed files sdk app; do
+ [ "$f" = cli ] && [ $stale_help = 1 ] && continue
+ if ! diff -q "$tmp/ref/$f.md" "sdk/skills/raea/reference/$f.md" >/dev/null 2>&1; then
+ # the shared GitButler tree holds every applied lane's code, so what gen writes there isn't what main + one lane
+ # gives: a note here, a failure in L1's export (origin/main + the lane)
+ if [ "${SKILLS_STRICT:-0}" = 1 ]; then
+ echo "FAIL skills: sdk/skills/raea/reference/$f.md:1: differs from what this release generates; fix: tools/skills.sh gen with this raea, and commit it"
+ fail=1
+ elif [ "$(git symbolic-ref -q HEAD 2>/dev/null)" = refs/heads/gitbutler/workspace ]; then
+ echo "skills: warning sdk/skills/raea/reference/$f.md differs from what this tree generates (other lanes' code is applied here; L1's export decides)"
+ elif [ "$f" = cli ] && [ "$(cd "$(dirname "$(realpath "$R")")/../.." && pwd)" != "$ROOT" ]; then
+ # the help is the binary's, built from another tree (L1's export runs the shared raea, which holds every
+ # applied lane): a note here; a clean checkout with its own build (release.sh) fails on it
+ echo "skills: warning sdk/skills/raea/reference/cli.md differs from the help of $R, built from another tree"
+ else
+ echo "FAIL skills: sdk/skills/raea/reference/$f.md:1: stale; fix: tools/skills.sh gen on origin/main + this lane (the shared tree holds other lanes too), and commit it"
+ fail=1
+ fi
+ fi
+ done
+ # 2. retired words (docs/skills.glossary.md), whole words where they start with a letter
+ local words; words=$(sed -n '/<!-- retired -->/,/<!-- \/retired -->/p' docs/skills.glossary.md | sed '1d;$d')
+ # 3. flags: each `raea VERB ... --flag` in a code span or block, against the verb's flags in raea help --json
+ touch "$tmp/flags"
+ [ $stale_help = 1 ] || "$R" help --json | jq -r '.verbs[] | select(.own_parser | not) | "\(.verb)\t\([.flags[].flag] | join(" "))"' > "$tmp/flags"
+ # 4. RAEA_* variables: read somewhere outside the docs
+ git grep -ohE 'RAEA_[A-Z0-9_]+' -- ':!*.md' ':!*.feature' > "$tmp/vars" 2>/dev/null || true
+ git -C "$APP" grep -ohE 'RAEA_[A-Z0-9_]+' "$APP_REV" -- ':!*.md' >> "$tmp/vars" 2>/dev/null || true
+ sort -u -o "$tmp/vars" "$tmp/vars"
+ texts | WORDS="$words" FLAGS="$tmp/flags" VARS="$tmp/vars" STALE_HELP=$stale_help perl -e '
+ my @words = grep { length } split /\n/, $ENV{WORDS};
+ my %flags; open my $fh, "<", $ENV{FLAGS}; while (<$fh>) { chomp; my ($v, $f) = split /\t/, $_, 2; $flags{$v} = { map { $_ => 1 } split / /, ($f // "") } }
+ my %vars; open my $vh, "<", $ENV{VARS}; while (<$vh>) { chomp; $vars{$_} = 1 }
+ my $fail = 0;
+ sub bad { my ($f, $n, $what, $fix) = @_; print "FAIL skills: $f:$n: $what; fix: $fix\n"; $fail = 1 }
+ while (my $f = <STDIN>) {
+ chomp $f; open my $in, "<", $f or next; my ($n, $block) = (0, 0); (my $dir = $f) =~ s{/[^/]*$}{};
+ while (my $l = <$in>) {
+ $n++;
+ $block = !$block if $l =~ /^\s*```/;
+ for my $w (@words) {
+ my $re = $w =~ /^\w/ ? qr/\b\Q$w\E\b/i : $w =~ /^\./ ? qr/\Q$w\E\b/ : qr/(?<![\w-])\Q$w\E\b/;
+ bad($f, $n, "retired word \"$w\"", "say it as docs/skills.glossary.md does") if $l =~ $re;
+ }
+ # the code on the line: all of it in a block, else its `spans`
+ my @code = $block ? ($l) : ($l =~ /`([^`]+)`/g);
+ if (!$ENV{STALE_HELP}) {
+ for my $c (@code) {
+ while ($c =~ /\braea ([a-z][a-z-]*)((?:\s+[^\s|;#]+)*)/g) {
+ my ($v, $rest) = ($1, $2); next unless $flags{$v};
+ for my $fl ($rest =~ /(?<![\w-])(--[a-z][\w-]*)/g) {
+ bad($f, $n, "raea $v takes no $fl", "raea help --json lists its flags (reference/cli.md)") unless $flags{$v}{$fl};
+ }
+ }
+ }
+ }
+ for my $v ($l =~ /\b(RAEA_[A-Z0-9_]+)/g) { bad($f, $n, "$v is read nowhere", "drop it, or name the variable that replaced it") unless $vars{$v} }
+ while ($l =~ /\]\(([^)#\s]+)(?:#[^)]*)?\)/g) {
+ my $t = $1; next if $t =~ m{^(https?:|mailto:|/)};
+ bad($f, $n, "link to $t goes nowhere", "point it at a file that exists") unless -e "$dir/$t";
+ }
+ }
+ }
+ exit $fail;' || fail=1
+ rm -rf "$tmp"
+ # 5. a section's sources exist
+ local f a b head src x
+ while IFS=$'\t' read -r f a b head src; do
+ for x in $src; do [ -e "$x" ] || { echo "FAIL skills: $f:$a: \"$head\" names source $x, which doesn't exist; fix: name the file that replaced it"; fail=1; }; done
+ done < <(sections)
+ cochange
+ [ $fail -eq 0 ] && echo "skills: ok"
+ return $fail
+}
+
+# each hand-written section that names its sources: file, its first and last line, heading, sources
+sections() {
+ texts | while IFS= read -r f; do
+ awk -v f="$f" '
+ function flush() { if (head != "" && src != "") printf "%s\t%d\t%d\t%s\t%s\n", f, start, NR - 1, head, src }
+ /^## / { flush(); head = substr($0, 4); start = NR; src = "" }
+ /^<!-- sources: / { s = $0; sub(/^<!-- sources: /, "", s); sub(/ *-->.*$/, "", s); src = s }
+ END { NR++; flush() }' "$f"
+ done
+}
+
+# a change to a section's sources that leaves the section alone (SK4): a warning, answered in the landing message
+cochange() {
+ local changed
+ if [ -n "${SKILLS_CHANGED:-}" ]; then changed=$SKILLS_CHANGED
+ else changed=$(git diff --name-only "$(git merge-base HEAD origin/main 2>/dev/null || echo HEAD)" 2>/dev/null; git diff --name-only HEAD 2>/dev/null); fi
+ [ -n "$changed" ] || return 0
+ sections | while IFS=$'\t' read -r f a b head src; do
+ local hit="" s
+ for s in $src; do grep -qE "^${s//./\\.}(/|$)" <<< "$changed" && hit="$hit $s"; done
+ [ -n "$hit" ] || continue
+ # the section counts as touched when its file changed within its lines (or, with no history here, at all)
+ if grep -qx "$f" <<< "$changed"; then
+ [ -n "${SKILLS_CHANGED:-}" ] && continue
+ git diff -U0 "$(git merge-base HEAD origin/main 2>/dev/null || echo HEAD)" -- "$f" | grep -E '^@@' | sed -E 's/^@@ [^+]*\+([0-9]+)(,([0-9]+))?.*/\1 \3/' |
+ awk -v a="$a" -v b="$b" '{ n = ($2 == "" ? 1 : $2); if ($1 <= b && $1 + n - 1 >= a) t = 1 } END { exit !t }' && continue
+ fi
+ echo "skills: warning $f:$a: \"$head\" names$hit, which changed while it didn't; say in the landing message whether it still holds (\"checked, still true\") or edit it"
+ done
+}
+
+# every section with sources, by how many commits to them it has missed since its own lines last changed
+stale() {
+ sections | while IFS=$'\t' read -r f a b head src; do
+ local t n
+ t=$(git blame -L "$a,$b" --porcelain -- "$f" 2>/dev/null | awk '/^committer-time / { if ($2 > m) m = $2 } END { print m + 0 }')
+ [ "$t" -gt 0 ] || t=$(date +%s)
+ # shellcheck disable=SC2086
+ n=$(git rev-list --count --since="$t" HEAD -- $src 2>/dev/null || echo 0)
+ printf '%s\t%s:%s\t%s\n' "$n" "$f" "$a" "$head"
+ done | sort -rn -k1,1 | awk -F'\t' 'BEGIN { print "missed section" } { printf "%6d %s %s\n", $1, $2, $3 }'
+}
+
+case "${1:-}" in
+ gen | gen-into)
+ R=${R:-$(raea_bin)}
+ [ -x "$R" ] || { echo "skills.sh: no raea to read the help from (RAEA_BIN, or build raea-cli)" >&2; exit 2; }
+ mkdir -p "$OUT"
+ [ "${SKIP_CLI:-0}" = 1 ] || gen_cli > "$OUT/cli.md"
+ gen_feed > "$OUT/feed.md"
+ gen_files > "$OUT/files.md"
+ gen_sdk > "$OUT/sdk.md"
+ gen_app > "$OUT/app.md"
+ if [ "$1" = gen ]; then wc -l "$OUT"/*.md; fi
+ ;;
+ check)
+ R=$(raea_bin)
+ [ -x "$R" ] || { echo "FAIL skills: no raea to read the help from (RAEA_BIN, or build raea-cli)"; exit 1; }
+ check
+ ;;
+ stale) stale ;;
+ *) echo "usage: tools/skills.sh gen | check | stale" >&2; exit 2 ;;
+esac
diff --git a/tools/taxonomy.list b/tools/taxonomy.list
new file mode 100644
index 00000000..ede430db
--- /dev/null
+++ b/tools/taxonomy.list
@@ -0,0 +1,87 @@
+# tools/taxonomy.sh: the SDK's PascalCase names that are neither Bevy's nor a deprecated alias, a reason each.
+# web NAME reason: the web's (HTML, CSS, React) name for it
+# raea NAME reason: raea's own, with no Bevy or web name to take
+
+# the web's: HTML's elements, and Tone.js's names (the web's audio library, whose API /tone keeps)
+web Audio HTML's <audio>: sound in step with the frame
+web Img HTML's <img>: the renderer holds the frame until it has loaded
+web Video HTML's <video>: a clip in step with the frame
+web Tone Tone.js as a namespace (import * as Tone), as its users write it
+web Loop Tone.js's Loop: a callback every interval in transport time
+web Part Tone.js's Part: values at times
+web Sequence Tone.js's Sequence: one value per subdivision
+
+# raea's own: the video timeline (no Bevy concept; frame-addressed pieces of a composition)
+raea AbsoluteFill a box over its parent, as a flex column: the page layer's full-frame container
+raea Composition a composition declared in the root (id, size, fps, length), found by registerRoot
+raea Series shots one after another on the timeline
+raea Freeze its children held at one frame
+raea Nudge its child moved in front of its own transform
+raea Overlay children only in a render asked for that overlay
+raea Region a box at a named band, clear of the face perception found
+raea InputRegion a box that keeps a press until it's let go (a panel's page of its own)
+raea Clock the tree at one frame of a composition (the frame's provider)
+raea Matchmove footage with solved 3D standing in it (its own Canvas3D)
+raea Plate footage behind the 3D, filling the camera's view
+
+# raea's own: motion (frame-pure animation, engine/animate)
+raea Animate a frame-pure animation of its child (raea_core_animate's Animation)
+raea Stagger Animate over children, each delayed
+raea Easing the easing curves (in, out, inOut), as values
+
+# raea's own: sound beyond Bevy's (raea-runtime-sound: seedling, speech, songs)
+raea Seedling bevy_seedling's mixer graph as TSX (the crate's name: no single Bevy type)
+raea Sound3D a sound placed in the 3D, heard from the camera (seedling's spatial sampler)
+raea Speech a line spoken by the narration voice, word-timed
+raea SongPlot a song's energy map drawn for a human to check
+
+# raea's own: 3D pieces with no single Bevy type (each groups several, its @bevy tags name them)
+raea AntiAliasing one choice over Bevy's Smaa, Fxaa, TemporalAntiAliasing and Msaa
+raea AmbientOcclusion Bevy's ScreenSpaceAmbientOcclusion with its quality and thickness (M5: ScreenSpaceAmbientOcclusion)
+raea Shadows the shadow maps' settings together (PointLightShadowMap, filtering, cascades)
+raea Grade Bevy's ColorGrading with chromatic aberration and the effect stack (ColorGrading alone is M5's name)
+raea Fog Bevy's DistanceFog plus an exponential form by density (DistanceFog is M5's name)
+raea ToneMapping Bevy's Tonemapping with Exposure (Tonemapping is M5's name)
+raea Environment Bevy's EnvironmentMapLight from a panorama, drawn as the sky with `background` (M5: EnvironmentMapLight)
+raea Decal Bevy's ForwardDecal with its picture and the camera's depth prepass (M5: ForwardDecal)
+raea Look the scene's one look (paint, toon, flat) as an ExtendedMaterial on every surface
+raea SurfaceShader one WGSL/WESL surface for every material in the scene (docs/shaders.feature SH4)
+raea ShaderMesh a mesh drawn by its own shader, uniforms set at load (Mesh3d with a raea Material)
+web ThreeShaderMaterial three.js's ShaderMaterial (GLSL) or node material (WGSL) as it is, run by raea's engine (docs/r3f.feature R3F11)
+raea FramePass a full-screen pass over the camera's frame (docs/shaders.feature)
+raea Compute a compute shader run once a frame before the cameras draw (docs/shaders.feature SH10)
+raea ShaderExtension raea's MaterialExtension running a surface shader (ExtendedMaterial's extension)
+raea GridExtension raea's MaterialExtension drawing a grid (ExtendedMaterial's extension)
+raea PaintExtension raea's MaterialExtension for the paint look (ExtendedMaterial's extension)
+raea WearExtension raea's MaterialExtension that chips, grimes and rusts a StandardMaterial in the part's own space (systems/wear); Bevy has none
+raea ProceduralExtension raea's MaterialExtension that draws wood, stone, brick, tiles and the rest on a StandardMaterial with dust, dirt and worn edges (systems/procmat); Bevy has none
+raea ToonExtension raea's MaterialExtension for toon bands (ExtendedMaterial's extension)
+raea ToonMaterial StandardMaterial with ToonExtension (S2a's table: raea's)
+raea Fisheye a lens pass after tone mapping (raea-render's lens)
+raea Fire raea's fire volume (raea-render's fire.rs)
+raea Splat a Gaussian splat (raea-render's splat material)
+raea Screen a live picture (a page, a game) on a quad in the scene
+raea ImagePlane a picture on an unlit card in the scene
+raea Shape2D a flat shape in frame px over the 3D (Mesh2d with a ColorMaterial, placed as the page places things)
+raea Refinish the glTF materials of every <Model> inside re-covered
+raea RichText 3D text in runs (raea-render's text3d), as HTML's rich text reads
+raea Span a run of a RichText (HTML's <span>, inside RichText only)
+raea Text3D solid 3D letters as a mesh's geometry (Manifold's text3d)
+raea BufferMesh a mesh from its own vertex buffers (Bevy's Mesh built from attributes, as JSX)
+raea Instances one mesh or glTF drawn at many placements (Bevy batches the copies; it has no component of its own)
+raea Grass a field of grass the engine makes in tiles by distance from a few grids of the ground (no Bevy component)
+raea MeshSequence a baked simulation, one mesh a frame
+raea Daylight the sun and sky at a place and time, lit through windows at true brightness
+raea WindowLight a window's light as a wide soft lamp
+raea Echoes copies trailing a part
+raea Goo objects melting into goo (a bake)
+raea Body a rigid body inside <Physics> (avian's RigidBody with its collider, drawn)
+raea Model a loaded ML model (/ml; not Bevy's glTF, which is raea/scene's <Model>)
+
+# raea's own: solids (Manifold) and the App's TSX bridges to Bevy's reflection
+raea Solid a native solid's handle (Manifold), freed when done
+raea CrossSection a 2D shape (Manifold's CrossSection), by value
+raea Field a signed distance field as text (raea-core-sdf), meshed into a Solid by .solid()
+raea BevyApp Bevy's App as a TypeScript object for programs (App is its Bevy name, also exported)
+raea BevyComponent any reflected Bevy component on an entity by its type path (the TypeRegistry)
+raea BevyResource any reflected Bevy resource by its type path (the TypeRegistry)
diff --git a/tools/taxonomy.sh b/tools/taxonomy.sh
new file mode 100755
index 00000000..39a1a3fa
--- /dev/null
+++ b/tools/taxonomy.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+# Every name the SDK hands out is a Bevy name, a web name, a deprecated alias of a Bevy name, or raea's own on a
+# reasoned list (docs/sdk.feature M2, S2a).
+#
+# tools/taxonomy.sh each PascalCase export of raea and its Bevy-named modules with its class
+# tools/taxonomy.sh --check exits 1 on a PascalCase export with no class, or a listed name that no longer needs
+# listing (a Bevy name, an alias, or no longer exported); both fail on a prop named after a
+# backend or a processor (S3b)
+#
+# A Bevy name is a public type of Bevy 0.20's crates or glam (their sources in cargo's registry), a type path in the
+# generated plugin modules (*.gen.tsx, the registry's schema), or the last segment of an @bevy tag. An alias carries
+# @deprecated naming its Bevy name (S2a). Web and raea names are in tools/taxonomy.list, a reason each. camelCase
+# functions, use* hooks and CONSTANTS are TypeScript's conventions for raea's own (S2a) and are counted, not listed.
+set -euo pipefail
+export LC_ALL=C
+ROOT=$(cd "$(dirname "$0")/.." && pwd)
+LIST=$ROOT/tools/taxonomy.list
+check=0
+[ "${1:-}" = "--check" ] && check=1
+tmp=$(mktemp -d "${TMPDIR:-/tmp}/raea-taxonomy-XXXXXX")
+trap 'rm -rf "$tmp"' EXIT
+
+# the values raea and its Bevy-named modules export (not the test helper, the native calls or the pure subset)
+src=$ROOT/sdk/raea/src
+mods=$(cd "$src" && ls ./*.ts ./*.tsx | grep -vE '/(native-calls|test|pure)\.tsx?$')
+(cd "$ROOT/sdk/raea" && bun -e '
+ for (const f of process.argv.slice(2)) for (const k of Object.keys(await import(f))) console.log(k);
+' ${mods//.\//$src/}) | sort -u > "$tmp/all"
+grep -E '^[A-Z][a-z]' "$tmp/all" > "$tmp/pascal" || true
+
+# Bevy's names: its crates' and glam's public types, the generated modules' type paths, and @bevy tags
+reg=$(ls -d "${CARGO_HOME:-$HOME/.cargo}"/registry/src/index.crates.io-*/ | head -1)
+glam=$(grep -A1 '^name = "glam"$' "$ROOT/Cargo.lock" | awk -F'"' '/version/ {print $2}' | sort -V | tail -1)
+{
+ grep -rhoE '^\s*pub (struct|enum|trait|type) [A-Z][A-Za-z0-9_]*' "$reg"/bevy_*-0.20.0/src "$reg/glam-$glam/src" | awk '{print $NF}'
+ find "$ROOT/sdk" -name '*.gen.tsx' -not -path '*/node_modules/*' -print0 | xargs -0 grep -hoE '[a-z_0-9]+(::[A-Za-z_0-9]+)+' |
+ grep -vE '^(alloc|core|std)::' | awk -F'::' '{print $NF}'
+ grep -rhoE '@bevy [a-z_0-9]+(::[A-Za-z_0-9]+)+' "$ROOT"/sdk/*/src | awk -F'::' '{print $NF}'
+} | sort -u > "$tmp/bevy"
+
+# aliases: an export whose doc comment says @deprecated (its Bevy name in the text)
+find "$ROOT"/sdk/*/src -name '*.ts*' -not -name '*.gen.tsx' -print0 | xargs -0 awk '
+ /@deprecated/ { d = 1 }
+ d && match($0, /^export (function|const|class) [A-Za-z0-9_]+/) { n = substr($0, RSTART, RLENGTH); sub(/.* /, "", n); print n; d = 0 }
+' | sort -u > "$tmp/alias"
+
+# the list: "web NAME reason" and "raea NAME reason"
+{ grep -E '^(web|raea) ' "$LIST" || true; } | awk '{print $2, $1}' | sort > "$tmp/listed"
+
+status=0
+while read -r name; do
+ if grep -qx "$name" "$tmp/alias"; then cls=alias
+ elif grep -qx "$name" "$tmp/bevy"; then cls=bevy
+ else cls=$(awk -v n="$name" '$1 == n {print $2}' "$tmp/listed")
+ fi
+ if [ -z "$cls" ]; then
+ echo "taxonomy: $name has no class: a Bevy name, @deprecated naming its Bevy name, or a line in tools/taxonomy.list"
+ status=1
+ elif [ $check = 0 ]; then
+ printf '%-6s %s\n' "$cls" "$name"
+ fi
+done < "$tmp/pascal"
+
+# a listed name that needs no line: Bevy's or an alias fails; one not exported is only noted, since a lane lists its
+# new component in the commit that adds it and the two may land apart
+while read -r name cls; do
+ why=""
+ grep -qx "$name" "$tmp/bevy" && why="a Bevy name"
+ grep -qx "$name" "$tmp/alias" && why="an alias (@deprecated)"
+ if [ -n "$why" ]; then echo "taxonomy: tools/taxonomy.list's $name is $why: drop its line"; status=1
+ elif ! grep -qx "$name" "$tmp/pascal"; then echo "taxonomy: note: tools/taxonomy.list's $name isn't exported (yet, or any more)"; fi
+done < "$tmp/listed"
+
+n=$(wc -l < "$tmp/pascal"); a=$(wc -l < "$tmp/all")
+# props named after the backend that draws them or the processor it runs on: the engine chooses where work runs
+# (S3b), so a prop names what it does, never the path
+backend=$(grep -rnoE '^\s+(wgpu|metal|vulkan|opengl|webgl|webgpu|bevy|blitz|vello|skia|three|gpu|cpu|readback|software|hardware)([A-Z_][A-Za-z_]*)?\??:' \
+ "$ROOT"/sdk/*/src --include='*.ts' --include='*.tsx' | grep -v '\.gen\.tsx' | sed "s|$ROOT/||; s/: *\$//" || true)
+if [ -n "$backend" ]; then
+ echo "taxonomy: props named after a backend or a processor (S3b: the engine chooses where work runs):"
+ echo "$backend" | sed 's/^/ /'
+ status=1
+fi
+echo "taxonomy: $n PascalCase of $a exports; $(comm -12 "$tmp/pascal" "$tmp/bevy" | comm -23 - "$tmp/alias" | wc -l | tr -d ' ') Bevy names, $(comm -12 "$tmp/pascal" "$tmp/alias" | wc -l | tr -d ' ') aliases, $(wc -l < "$tmp/listed" | tr -d ' ') listed"
+exit $status
diff --git a/tools/vendor b/tools/vendor
new file mode 100755
index 00000000..2472dfc2
--- /dev/null
+++ b/tools/vendor
@@ -0,0 +1,143 @@
+#!/bin/bash
+# raea's vendored crates, against the upstream versions in vendor/vendor.toml.
+#
+# tools/vendor ls each crate: kind, upstream, lines changed, files changed, marked files
+# tools/vendor diff <crate> our patch: upstream -> our copy (Cargo.toml included)
+# tools/vendor check the manifest matches the tree: every [patch] and vendored path listed, every
+# path present, a bump changes no source, a patch marks each changed file
+# tools/vendor bump <crate> <ver> our changes moved onto upstream <ver> (three-way, per file); conflicts are left
+# marked in the files and listed; the manifest's upstream is updated
+# tools/vendor outdated each crate with a newer crates.io release than its base: the version, and which of
+# our changed files that release already has as ours (upstream took the change)
+#
+# Upstream sources are fetched once from static.crates.io into ~/.cache/raea-vendor (cargo's registry copy is used
+# when it has one).
+set -uo pipefail
+RAEA=${RAEA_ROOT:-$HOME/raea}
+M=$RAEA/vendor/vendor.toml
+CACHE=${RAEA_VENDOR_CACHE:-$HOME/.cache/raea-vendor}
+MARK='raea:|raea patch'
+# what crates.io packaging adds or drops, which isn't ours
+X=(-x Cargo.toml.orig -x .cargo_vcs_info.json -x Cargo.lock -x target -x .git)
+cd "$RAEA" || exit 2
+
+names() { awk -F'[][]' '/^\[[^]]+\]$/{print $2}' "$M"; }
+field() { awk -v n="[$1]" -v k="$2" '$0==n{p=1; next} /^\[/{p=0} p && $1==k {sub(/^[^=]*= *"/, ""); sub(/" *$/, ""); print; exit}' "$M"; }
+
+# the upstream copy of <crate> at <upstream>, fetched if needed; prints its directory
+upstream_dir() {
+ local name=$1 up=$2 ver dir reg
+ case $up in
+ crates.io:*) ver=${up#crates.io:} ;;
+ *) echo "vendor: $name: only crates.io upstreams are fetched ($up)" >&2; return 1 ;;
+ esac
+ for reg in "$HOME"/.cargo/registry/src/index.crates.io-*/"$name-$ver"; do [ -d "$reg" ] && { echo "$reg"; return; }; done
+ dir=$CACHE/$name-$ver
+ if [ ! -d "$dir" ]; then
+ mkdir -p "$CACHE"
+ curl -fsSL "https://static.crates.io/crates/$name/$name-$ver.crate" | tar -xz -C "$CACHE" ||
+ { echo "vendor: couldn't fetch $name $ver" >&2; return 1; }
+ fi
+ echo "$dir"
+}
+
+# files that differ (relative paths), excluding packaging; Cargo.toml reported separately
+changed_files() { diff -rq "${X[@]}" "$1" "$2" 2>/dev/null | awk -v a="$1/" -v b="$2/" '
+ / differ$/ {f=$2; sub(a, "", f); print f; next}
+ /^Only in / {d=$3; sub(/:$/, "", d); f=d "/" $4; if (index(f, b)==1) {sub(b, "", f); print f}}'; }
+
+cmd=${1:-}; shift || true
+case $cmd in
+ ls)
+ printf '%-17s %-6s %-22s %7s %6s %7s\n' CRATE KIND UPSTREAM LINES FILES MARKED
+ for n in $(names); do
+ p=$(field "$n" path); up=$(field "$n" upstream); k=$(field "$n" kind)
+ u=$(upstream_dir "$n" "$up") || { printf '%-17s %-6s %-22s %s\n' "$n" "$k" "$up" "(no upstream copy)"; continue; }
+ lines=$(diff -r "${X[@]}" -x Cargo.toml "$u" "$p" 2>/dev/null | grep -cE '^[<>]')
+ files=$(changed_files "$u" "$p" | grep -vxc Cargo.toml)
+ marked=0; for f in $(changed_files "$u" "$p" | grep -vx Cargo.toml); do grep -qE "$MARK" "$p/$f" 2>/dev/null && marked=$((marked + 1)); done
+ printf '%-17s %-6s %-22s %7s %6s %7s\n' "$n" "$k" "$up" "$lines" "$files" "$marked"
+ done
+ ;;
+ diff)
+ n=${1:?crate}; p=$(field "$n" path); [ -n "$p" ] || { echo "vendor: $n isn't in vendor/vendor.toml" >&2; exit 2; }
+ u=$(upstream_dir "$n" "$(field "$n" upstream)") || exit 1
+ diff -ruN "${X[@]}" "$u" "$p"
+ ;;
+ check)
+ fail=0
+ say() { echo "vendor: $*" >&2; fail=1; }
+ listed=" $(for n in $(names); do field "$n" path; done | tr '\n' ' ') "
+ # every [patch.crates-io] path and every vendored crate directory is in the manifest
+ for p in $(awk '/^\[patch\.crates-io\]/{x=1; next} /^\[/{x=0} x && /path *=/' Cargo.toml | sed -E 's/.*path *= *"([^"]+)".*/\1/'); do
+ case $listed in *" $p "*) ;; *) say "Cargo.toml patches $p, which vendor/vendor.toml doesn't list" ;; esac
+ done
+ for d in $(ls -d vendor/*/ | sed 's#/$##'); do
+ case $listed in *" $d "*) ;; *) say "$d is vendored but not listed" ;; esac
+ done
+ # every copy lives under vendor/: a crate vendored anywhere else is out of place
+ for d in $(git ls-files '*/vendor/*/Cargo.toml' | xargs -n1 dirname | sort -u); do
+ [ -d "$d" ] && say "$d is vendored outside vendor/ (move it there and list it)"
+ done
+ for n in $(names); do
+ p=$(field "$n" path); k=$(field "$n" kind); up=$(field "$n" upstream)
+ for key in path upstream kind reason exit; do [ -n "$(field "$n" $key)" ] || say "$n has no $key"; done
+ [ -d "$p" ] || { say "$n: no $p"; continue; }
+ u=$(upstream_dir "$n" "$up") || { say "$n: no upstream copy to check against"; continue; }
+ src=$(changed_files "$u" "$p" | grep -vx Cargo.toml)
+ case $k in
+ bump) [ -z "$src" ] || say "$n is a bump but changes source: $(echo $src)" ;;
+ patch)
+ [ -n "$src" ] || say "$n is a patch but changes no source (a bump?)"
+ for f in $src; do grep -rqE "$MARK" "$p/$f" 2>/dev/null || say "$n: $f differs from upstream with no raea: mark"; done ;;
+ *) say "$n: kind is $k (bump or patch)" ;;
+ esac
+ done
+ [ $fail = 0 ] && echo "vendor: ok ($(names | wc -l | tr -d ' ') crates)"
+ exit $fail
+ ;;
+ bump)
+ n=${1:?crate}; new=${2:?version}; p=$(field "$n" path); up=$(field "$n" upstream)
+ [ -n "$p" ] || { echo "vendor: $n isn't in vendor/vendor.toml" >&2; exit 2; }
+ base=$(upstream_dir "$n" "$up") || exit 1
+ theirs=$(upstream_dir "$n" "crates.io:$new") || exit 1
+ conflicts=()
+ # every file of the new upstream, merged with our change to it (base = the upstream we patched)
+ while IFS= read -r f; do
+ [ "$f" = Cargo.toml.orig ] || [ "$f" = .cargo_vcs_info.json ] && continue
+ mkdir -p "$p/$(dirname "$f")"
+ if [ -f "$p/$f" ] && [ -f "$base/$f" ]; then
+ cp "$p/$f" "$p/$f.ours"
+ if ! git merge-file -L ours -L "$up" -L "crates.io:$new" "$p/$f.ours" "$base/$f" "$theirs/$f"; then conflicts+=("$f"); fi
+ mv "$p/$f.ours" "$p/$f"
+ elif [ ! -f "$p/$f" ]; then
+ cp "$theirs/$f" "$p/$f"
+ fi
+ done < <(cd "$theirs" && find . -type f | sed 's|^\./||')
+ # files upstream dropped since the base, which we hadn't changed, go too
+ while IFS= read -r f; do
+ [ -f "$theirs/$f" ] || { cmp -s "$base/$f" "$p/$f" && rm "$p/$f"; }
+ done < <(cd "$base" && find . -type f | sed 's|^\./||')
+ sed -i '' "/^\[$n\]\$/,/^\[/ s|^upstream = \".*\"|upstream = \"crates.io:$new\"|" "$M"
+ if [ ${#conflicts[@]} -gt 0 ]; then
+ echo "vendor: $n moved to $new with conflicts (marked <<<<<<< in each):"; printf ' %s/%s\n' "$p" "${conflicts[@]}"; exit 1
+ fi
+ echo "vendor: $n moved to $new cleanly; build it and run tools/vendor check"
+ ;;
+ outdated)
+ printf '%-17s %-14s %-14s %s\n' CRATE BASE NEWEST "OURS IN NEWEST"
+ for n in $(names); do
+ up=$(field "$n" upstream); base=${up#crates.io:}; p=$(field "$n" path)
+ # a pre-release base compares against every release, a stable one against stable releases only
+ case $base in *-*) key=max_version ;; *) key=max_stable_version ;; esac
+ newest=$(curl -fsS -A raea-vendor "https://crates.io/api/v1/crates/$n" 2>/dev/null | jq -r ".crate.$key // .crate.max_version")
+ [ -n "$newest" ] && [ "$newest" != null ] || { printf '%-17s %-14s %s\n' "$n" "$base" "(crates.io unreachable)"; continue; }
+ [ "$(printf '%s\n%s\n' "$base" "$newest" | sort -V | tail -1)" = "$base" ] && continue
+ b=$(upstream_dir "$n" "$up") && u=$(upstream_dir "$n" "crates.io:$newest") || continue
+ changed=$(changed_files "$b" "$p" | grep -vx Cargo.toml); total=$(printf '%s' "$changed" | grep -c .) same=0
+ for f in $changed; do cmp -s "$u/$f" "$p/$f" && same=$((same + 1)); done
+ printf '%-17s %-14s %-14s %s of %s files\n' "$n" "$base" "$newest" "$same" "$total"
+ done
+ ;;
+ *) sed -n '2,15p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2 ;;
+esac
diff --git a/vendor/bevy_text/src/editing.rs b/vendor/bevy_text/src/editing.rs
index 9091bdea..ddfbb458 100644
--- a/vendor/bevy_text/src/editing.rs
+++ b/vendor/bevy_text/src/editing.rs
@@ -295,7 +295,7 @@ impl EditableText {
/// Is the IME currently composing text for this input?
///
/// Some behavior (e.g. "submit on Enter") may want to be suppressed while the IME is active
- /// to avoid interrupting the founder's composition.
+ /// to avoid interrupting the user's composition.
pub fn is_composing(&self) -> bool {
self.editor.is_composing()
}
diff --git a/vendor/bevy_text/src/scroll.rs b/vendor/bevy_text/src/scroll.rs
index a18ec204..7d8ee731 100644
--- a/vendor/bevy_text/src/scroll.rs
+++ b/vendor/bevy_text/src/scroll.rs
@@ -1,7 +1,7 @@
//! `EditableText` scrolling logic
//!
//! - [`TextViewport`] is a rectangle aligned to the text layout's axis representing
-//! the founder's view of the text layout.
+//! the user's view of the text layout.
//! - Coordinates are in text layout space, increasing right and downwards.
//! - If the text layout is smaller than the viewport on an axis, the viewport is
//! given an offset of zero on that the axis.
diff --git a/vendor/bevy_ui_widgets/src/lib.rs b/vendor/bevy_ui_widgets/src/lib.rs
index 8aada0e4..c152cf75 100644
--- a/vendor/bevy_ui_widgets/src/lib.rs
+++ b/vendor/bevy_ui_widgets/src/lib.rs
@@ -126,7 +126,7 @@ pub struct ValueChange<T> {
/// The new value.
pub value: T,
/// If false, it means that we are in the middle of an interaction (slider being dragged,
- /// user typing), while if true it means that the founder's interaction is finished (mouse button
+ /// user typing), while if true it means that the user's interaction is finished (mouse button
/// released, drag ended, input lost focus).
pub is_final: bool,
}
diff --git a/vendor/blitz-dom/src/layout/inline.rs b/vendor/blitz-dom/src/layout/inline.rs
index a867cfef..1a863fb8 100644
--- a/vendor/blitz-dom/src/layout/inline.rs
+++ b/vendor/blitz-dom/src/layout/inline.rs
@@ -250,6 +250,10 @@ impl LayoutPassState<'_> {
..
} = inputs;
+ // raea: `data-raea-bevy-text` (sdk/render's bevy_ui <Text>) measures as bevy_text does: its size rounded up
+ // to whole device pixels (pipeline.rs: `layout_info.size = ...ceil()`), not to Chrome's 1/64 px layout unit
+ let unit: f32 = if self.nodes[node_id].is_bevy_text() { 1.0 } else { 64.0 };
+
// Take inline layout to satisfy borrow checker
let mut inline_layout = self.nodes[node_id]
.data
@@ -633,7 +637,7 @@ impl LayoutPassState<'_> {
};
// raea: rounded up to Chrome's layout unit (1/64 px), not to a whole pixel: a shrink-to-fit box around
// text is as wide as Chrome makes it (a 7-glyph label at 9.6 px a glyph is 67.2 px, not 68)
- let computed_width = (computed_width * 64.0).ceil() / 64.0;
+ let computed_width = (computed_width * unit).ceil() / unit;
let style_width = node_size.width.map(|w| w * scale);
let min_width = node_min_size.width.map(|w| w * scale);
@@ -676,7 +680,7 @@ impl LayoutPassState<'_> {
.inline_layout_data = Some(inline_layout);
let measured_size = inputs.known_dimensions.unwrap_or(taffy::Size {
- width: (width * 64.0).ceil() / 64.0 / scale,
+ width: (width * unit).ceil() / unit / scale,
// Height is ignored if RequestedAxis if Horizontal
height: 0.0,
});
@@ -994,6 +998,10 @@ impl LayoutPassState<'_> {
// `known_dimensions` must not be substituted in here: those are border-box sizes, and
// using them for the scrollable overflow rect (which adds padding below) would
// double-count padding, incorrectly making the container's content overflow it.
+ // raea: a bevy_text box's height rounded up as its width is (`unit` above)
+ if unit == 1.0 {
+ height = height.ceil();
+ }
let measured_size = taffy::Size {
width: width / scale,
height: height / scale,
diff --git a/vendor/blitz-dom/src/node/node.rs b/vendor/blitz-dom/src/node/node.rs
index 8f3d9718..10a22ffa 100644
--- a/vendor/blitz-dom/src/node/node.rs
+++ b/vendor/blitz-dom/src/node/node.rs
@@ -999,6 +999,12 @@ impl NodeData {
self.downcast_element()?.attr(name)
}
+ /// raea: a bevy_ui <Text>'s block (sdk/render's `data-raea-bevy-text`): laid out, filled and drawn as bevy_text
+ /// does (its size in whole pixels, a run's box over the line box)
+ pub fn is_bevy_text(&self) -> bool {
+ self.attr(LocalName::from("data-raea-bevy-text")).is_some()
+ }
+
pub fn has_attr(&self, name: impl PartialEq<LocalName>) -> bool {
self.downcast_element()
.is_some_and(|elem| elem.has_attr(name))
@@ -1052,6 +1058,11 @@ impl TextNodeData {
// }
impl Node {
+ /// raea: this node is a bevy_ui <Text>'s block (NodeData::is_bevy_text)
+ pub fn is_bevy_text(&self) -> bool {
+ self.data.is_bevy_text()
+ }
+
pub fn tree(&self) -> &crate::NodeTree {
unsafe { &*self.tree }
}
@@ -1859,6 +1870,9 @@ impl Node {
}
};
+ // raea: in a bevy_ui <Text>'s block (data-raea-bevy-text, layout/inline.rs) a run's box is bevy_text's run
+ // bounds (pipeline.rs RunGeometry): its whole advance across the line box, as TextBackgroundColor fills it
+ let bevy = inline_root.is_bevy_text();
let root_layout = inline_root.unrounded_layout();
let content_box_inset = root_layout.padding + root_layout.border;
let origin_x = content_box_inset.left;
@@ -1928,6 +1942,10 @@ impl Node {
// ▌ from Hiragino Sans is as tall as its Helvetica text
let (ascent, descent) = glyph_run.style_content_area();
let (y0, y1) = (glyph_run.baseline() - ascent.round(), glyph_run.baseline() + descent.round());
+ let (x1, y0, y1) = match bevy {
+ true => (x0 + glyph_run.advance(), line_metrics.block_min_coord, line_metrics.block_max_coord),
+ false => (x1, y0, y1),
+ };
let grow = |a: &mut Option<(f32, f32)>| *a = Some(a.map_or((y0, y1), |(p, q)| (p.min(y0), q.max(y1))));
if brush == target {
grow(&mut own_y);
diff --git a/vendor/blitz-dom/src/scrolling.rs b/vendor/blitz-dom/src/scrolling.rs
index f367bfb2..ea4a420b 100644
--- a/vendor/blitz-dom/src/scrolling.rs
+++ b/vendor/blitz-dom/src/scrolling.rs
@@ -74,7 +74,7 @@ pub(crate) struct ScrollRequest {
pub(crate) source: ScrollSource,
pub(crate) behavior: ScrollBehavior,
/// Whether to abort a smooth scroll in progress. Set for user-initiated scrolls, so that
- /// an animation does not fight the founder's input for the rest of its duration.
+ /// an animation does not fight the user's input for the rest of its duration.
pub(crate) interrupt_animation: bool,
}
diff --git a/vendor/blitz-paint/src/render.rs b/vendor/blitz-paint/src/render.rs
index c591e58d..f7d3291c 100644
--- a/vendor/blitz-paint/src/render.rs
+++ b/vendor/blitz-paint/src/render.rs
@@ -1039,11 +1039,27 @@ impl<'dom, 'a> BlitzDomPainter<'dom, 'a> {
// rectangle passed to descendants to the visible (clipped) region so that content
// scrolled out of view is culled rather than drawn and clipped away. The box used
// here matches the clip applied to the content below.
+ // raea: overflow clips each axis on its own: `overflow-x: clip` beside a visible y clips only x (as Chrome
+ // does, and bevy_ui's Overflow::clip_x), so the box of a lone clipping axis reaches far along the other
+ let (clips_x, clips_y) = (!matches!(overflow_x, Overflow::Visible), !matches!(overflow_y, Overflow::Visible));
+ let one_axis = clips_x != clips_y && !is_text_input && !is_image && !is_sub_doc && !contain_paint;
+ let clip_shape = |b: crate::kurbo_css::BoxShape| match one_axis {
+ true => {
+ let (r, far) = (b.bounding_box(), 1e4);
+ crate::kurbo_css::BoxShape::Rect(Rect::new(
+ if clips_x { r.x0 } else { -far },
+ if clips_y { r.y0 } else { -far },
+ if clips_x { r.x1 } else { far },
+ if clips_y { r.y1 } else { far },
+ ))
+ }
+ false => b,
+ };
let child_clip_rect = if should_clip {
let clip_box = if is_text_input {
cx.frame.content_box_path()
} else {
- cx.frame.padding_box_path()
+ clip_shape(cx.frame.padding_box_path())
};
clip_rect.intersect(screen_transform.transform_rect_bbox(clip_box.bounding_box()))
} else {
@@ -1220,7 +1236,7 @@ impl<'dom, 'a> BlitzDomPainter<'dom, 'a> {
let clip = if is_text_input {
&cx.frame.content_box_path()
} else {
- &cx.frame.padding_box_path()
+ &clip_shape(cx.frame.padding_box_path())
};
// Clip layer if box requires clipping. Opacity set to 1.0
diff --git a/vendor/blitz-paint/src/text.rs b/vendor/blitz-paint/src/text.rs
index 912415f2..6916daf6 100644
--- a/vendor/blitz-paint/src/text.rs
+++ b/vendor/blitz-paint/src/text.rs
@@ -392,6 +392,8 @@ struct DecorationRunGeometry {
underline_offset: f32,
underline_size: f32,
strikethrough_size: f32,
+ /// raea: the font's strikethrough offset above the baseline, where bevy_text puts the line (a bevy_ui <Text>)
+ strikethrough_offset: f32,
font: parley::FontData,
font_size: f32,
css_font_size: f64,
@@ -634,6 +636,7 @@ fn flush_line_decorations(
win_ascent_ratios: &mut WinAscentCache,
inline_root_id: NodeId,
line_baseline: f32,
+ bevy: bool,
) {
// Draw innermost boxes first so ancestors' decorations paint on top, matching the
// per-run drawing order this replaced (`stack.iter().rev()`).
@@ -678,12 +681,11 @@ fn flush_line_decorations(
};
if deco.line.contains(TextDecorationLine::UNDERLINE) {
- let size = decoration_size(
- &deco.thickness,
- geom.underline_size,
- geom.css_font_size,
- scale,
- );
+ // raea: in a bevy_ui <Text> (bevy), the font's thickness as bevy_text draws it, not floored to a pixel
+ let size = match bevy {
+ true => geom.underline_size,
+ false => decoration_size(&deco.thickness, geom.underline_size, geom.css_font_size, scale),
+ };
// `text-underline-offset` moves the underline away from the text. `auto` keeps
// the font's suggested position; otherwise it resolves against the font size
@@ -763,20 +765,21 @@ fn flush_line_decorations(
);
}
if deco.line.contains(TextDecorationLine::LINE_THROUGH) {
- let size = decoration_size(
- &deco.thickness,
- geom.strikethrough_size,
- geom.css_font_size,
- scale,
- );
+ let size = match bevy {
+ true => geom.strikethrough_size,
+ false => decoration_size(&deco.thickness, geom.strikethrough_size, geom.css_font_size, scale),
+ };
// Centre the line-through a third of the ascent above the baseline, matching
// Chrome (which places it `2/3 * ascent` below the text-top). Parley's
// `strikethrough_offset` (the font's `yStrikeoutPosition`) sits lower and would
// draw the line too close to the baseline.
- let ascent =
- win_ascent(win_ascent_ratios, &geom.font, geom.font_size).unwrap_or(geom.ascent);
- let offset = ascent / 3.0 + size / 2.0;
+ // raea: a bevy_ui <Text> puts it where bevy_text does, its top at that offset above the baseline
+ // (pipeline.rs: strikethrough_y = baseline - strikethrough_offset)
+ let offset = match bevy {
+ true => geom.strikethrough_offset,
+ false => win_ascent(win_ascent_ratios, &geom.font, geom.font_size).unwrap_or(geom.ascent) / 3.0 + size / 2.0,
+ };
draw_decoration_line(
scene,
@@ -821,6 +824,8 @@ pub(crate) fn stroke_text<'a>(
stack.clear();
path_scratch.clear();
deco_boxes.clear();
+ // raea: a bevy_ui <Text>'s block (blitz-dom's Node::is_bevy_text): its lines drawn as bevy_text draws them
+ let bevy = doc.get_node(inline_root_id).is_some_and(|n| n.is_bevy_text());
// Persistent stack mirroring the ancestor path (inline root -> current run's
// node) as we walk the runs. The `text-decoration-*` properties are *not*
@@ -1055,6 +1060,7 @@ pub(crate) fn stroke_text<'a>(
underline_offset: metrics.underline_offset,
underline_size: metrics.underline_size,
strikethrough_size: metrics.strikethrough_size,
+ strikethrough_offset: metrics.strikethrough_offset,
font: font.clone(),
font_size,
css_font_size,
@@ -1128,6 +1134,7 @@ pub(crate) fn stroke_text<'a>(
win_ascent_ratios,
inline_root_id,
line.metrics().baseline,
+ bevy,
);
}
}
diff --git a/vendor/firewheel-graph/src/ftz.rs b/vendor/firewheel-graph/src/ftz.rs
index 7b6d6043..a6739d29 100644
--- a/vendor/firewheel-graph/src/ftz.rs
+++ b/vendor/firewheel-graph/src/ftz.rs
@@ -20,7 +20,7 @@
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// an agent session OF THIS SOFTWARE.
+// PERFORMANCE OF THIS SOFTWARE.
use core::marker::PhantomData;
diff --git a/vendor/firewheel/DESIGN_DOC.md b/vendor/firewheel/DESIGN_DOC.md
index 460e1264..c57dedeb 100644
--- a/vendor/firewheel/DESIGN_DOC.md
+++ b/vendor/firewheel/DESIGN_DOC.md
@@ -79,7 +79,7 @@ Firewheel is a large library with a lot of rust-isms (enums, traits, generics, a
While Firewheel is meant to cover nearly every use case for games and generic applications, it is not meant to be a complete DAW (digital audio workstation) engine. Not only would this greatly increase complexity, but the needs of game audio engine and DAW audio engine are in conflict*.
-> \* This conflict arises in how state is expected to be synchronized between the founder's state and the state of the processor. In a DAW, the state is tied to the state of the "transport", and the host is allowed to discard any user-generated parameter update events that conflict with this transport state (or vice versa). However, in a game engine and other generic applications, the founder's state can dynamically change at any time. So to avoid the processor state from becoming desynchronized with the founder's state, parameter update events are only allowed to come from a single source (the user), and are guaranteed to not be discarded by the engine.
+> \* This conflict arises in how state is expected to be synchronized between the user's state and the state of the processor. In a DAW, the state is tied to the state of the "transport", and the host is allowed to discard any user-generated parameter update events that conflict with this transport state (or vice versa). However, in a game engine and other generic applications, the user's state can dynamically change at any time. So to avoid the processor state from becoming desynchronized with the user's state, parameter update events are only allowed to come from a single source (the user), and are guaranteed to not be discarded by the engine.
* MIDI on the audio-graph level (It will still be possible to create a custom sampler/synthesizer nodes that read MIDI files as input.)
* EDIT: There is now a similar way to achieve this using the `ProcStore`.