Compare commits

..
Author SHA1 Message Date
shane a9ecc06820 Merge pull request #204 from shinyobjectz/win-noavx
Windows: raea.exe starts on a CPU without AVX; 0.1.8's notes for rc10-rc12
2026-11-19 19:19:25 -05:00
shinyobjectz 191314a69a whats-new 0.1.8: #169's workspaces, #112/#124, raea show, Intl, master's darks, no-AVX; Linux's requirements
The Windows fixes since the notes were written (rc10-rc12), in the notes' words, and what Linux needs: a processor
with AVX (the static ONNX Runtime's initializers use it) and glibc 2.39, in the notes' Known and the install page.
Dated the 19th.
2026-11-19 15:27:53 -08:00
shinyobjectz 865e608857 Windows: raea.exe starts on a CPU without AVX (Goldmont, Nehalem)
rc11's raea.exe stopped before main on a processor without AVX (Intel's SDE as a Goldmont Celeron and as a Nehalem:
"Executed instruction not valid", vmovaps ymm at raea.exe+0x123b5d40). The instruction is in one of seven C++
dynamic initializers in the CRT's table: ctt-etcpak's ETC1 tables (Tables.cpp's g_table_SIMD and the rest, set with
_mm_setr_epi16, which MSVC initializes at run time), from the copy ctt builds with /arch:AVX2. ctt picks an ISA's
copy at run time for its encoders, but every copy's static initializers run at start, on every CPU. With those seven
skipped (a patched rc11), raea.exe --version runs under SDE as both chips.

ctt comes only from Bevy's compressed_image_saver feature (bevy_image's CompressedImageSaver, BC7/ASTC/ETC2 for
Bevy's asset processing), which raea never runs. It's out of the plugin catalog's Bevy features (0.19 and 0.20),
engine/bevy-plugins' generated `bevy` feature (tools/bevy-plugins.sh sync agrees) and engine/render's bevy-all, so
ctt's eight crates, fast_image_resize, ispc-build-utils and zstd leave the lock; NOTICE and LICENSES are
tools/licenses.sh's on main with the change. compressed_image_saver_universal (basis-universal) stays.
2026-11-19 15:27:47 -08:00
shane 56cf86c5c8 Merge pull request #203 from shinyobjectz/windows-169-rc12
Windows: #169's last bugs, and what the agent shell got wrong there
2026-11-19 18:03:10 -05:00
shinyobjectz ee1f3bc32e JavaScriptCore modules get their import.meta.url on macOS 15 too
macOS 15's JavaScriptCore leaves import.meta.url undefined for a module from raea's Objective-C loader (macOS 27's
sets it), so new URL("./x.png", import.meta.url) threw there. jsengine's tests::jsc, run in CI for the first time by
#169's step, found it on the macos-15 runner. A module that reads import.meta gets `import.meta.url ??= "URL";` on
line 1, before its own first line, so every other line keeps its number and an engine's own URL is left alone.
2026-11-19 14:44:39 -08:00
shinyobjectz 040153449c CI runs what a Windows or Linux user meets: Intl on QuickJS, openh264 at master, git, the Node core (#169)
The matrix's unit tests left out raea-runtime-jsengine, raea-io-soft and raea-io-assets, and tests/node.rs and
io-soft's tests/quality.rs need features (modules, h264), so none of #169's fixes ran in CI.
2026-11-19 14:30:32 -08:00
shinyobjectz b60d901473 Git on a PC without it: found or fetched once, as the app's host does (#169)
raea workspace, project and controller failed with "git: program not found" on a PC whose only Git was the app's.
raea_io_assets::git(): $RAEA_GIT, the PATH's, then on Windows the app's (InstallLocation\git), Git for Windows off the
PATH, and raea's own in the tools cache, fetched once (dugite-native, the build the app's host uses, sha256 checked).
Elsewhere it says how to install git. The default root is joined a folder at a time. NOTICE names the fetch, and
FormatJS and CLDR for the Intl commit before this.
2026-11-19 14:30:31 -08:00
shinyobjectz 457121f804 raea show, brand and cut on Windows and Linux (#169)
raea show asked kill whether the app ran, looked only in /Applications and said it opened files in "the Mac's own
viewer". app.ts asks each system its own way through one Here a test can fake: tasklist and the installer's
InstallLocation (#178) on Windows, Explorer to open files and start the app, raea.desktop and xdg-open on Linux, and one
PowerShell listing to name the harness that ran it. The shell's absolute-path tests take C:\, \\server\share and \
(show.ts absolute/fromCwd). raea brand reads a logo's size from its own header (PNG, GIF, JPEG, WebP, ICO), sips only as
a Mac's fallback, and cutting by words off a Mac says what works there. conformance/app.test.ts fakes each system.
2026-11-19 14:30:17 -08:00
shinyobjectz 3f9d5eda2d The agent shell's Node core speaks Windows: platform, arch, ppid, paths, file URLs (#169)
process.platform was Rust's word ("windows", "macos"), so every === "win32" and === "darwin" in the shell was false, on
a Mac too; os.platform() said "darwin" and the arch "arm64" everywhere; there was no process.ppid. path was POSIX only:
resolve(".") named "/C:\Users\...", isAbsolute("C:\x") was false and dirname/basename ignored \. On Windows path
parses drives, shares and \ now and writes /, path.win32 parses them anywhere, and fileURLToPath, pathToFileURL,
createRequire, tmpdir, execSync (cmd) and the module URL (file:///C:/...) follow. tests/node.rs checks each against
Node 22's answer. The arch and parent-pid helpers live in node/os.rs (node.rs was over the size limit).
2026-11-19 14:30:17 -08:00
shinyobjectz 3a08d33f37 openh264 keeps every block of a slowly changing dark ground at --quality master (#169)
Its background detection took a dim glow drifting over black for still and copied old blocks forward: 6-8% of dark
blocks stepped in every sampled frame, at any bitrate or quantiser. Off, 0.1%, as a lossless encode of the same frames.
a_dark_glow_drifting_keeps_every_block_at_master asks under 3% (5.3% before, 1.6% now).
2026-11-19 14:30:17 -08:00
shinyobjectz 917bc94f59 Intl on QuickJS: a composition that formats a number works on Windows and Linux (#169)
QuickJS has no Intl, so toLocaleString or Intl.NumberFormat threw "Intl is not defined" off a Mac. FormatJS's polyfills
(MIT) and the CLDR data they carry (Unicode-3.0) are packed in runtime/jsengine/js/intl.pack (2.2 MB, deflate; js/intl
build.ts, versions pinned), and js/intl/loader.js runs the core the first time anything reads Intl or calls a toLocale*
method, and a locale's data the first time something asks for it, so a script that never formats pays nothing. A small
Collator (letters, then accents, then case) backs localeCompare. quickjs_formats_as_javascriptcore_does: fourteen cases
give JavaScriptCore's answers, and on a Mac it asks JavaScriptCore too. Apple builds are unchanged.
2026-11-19 14:30:17 -08:00
shane 69fb3d8f87 Merge pull request #202 from shinyobjectz/win-export-xml
Windows: export xml's paths open in Resolve (#195); DX12 with DXC renders 3D again (#196)
2026-11-19 15:37:33 -05:00
shane a669144986 Merge pull request #201 from shinyobjectz/whats-new-weather
whats-new 0.1.8: raea/wear's weather during a shot (WR9)
2026-11-19 14:46:12 -05:00
shinyobjectz b39dd4e7de release.yml windows-verify: the bundle's list beside release-check.sh, where it reads it
windows-verify checks the zip on a runner with only release-check.sh and lavapipe.sh checked out, and runs
release-check.sh from RUNNER_TEMP; since the Windows bundle it reads release/win-bundle.files beside itself, which
wasn't there, so the step would have stopped on it once rc9's pack step stopped failing. It's checked out and copied
there now.
2026-11-19 11:39:35 -08:00
shinyobjectz f46529b461 Release: the Windows bundle's list read without its \r (rc9's Windows pack failed on it)
GitHub's Windows runner checks text files out with CRLF, as the Models step already allows for (tr -d '\r' <
models.tsv), so release.sh looked for "vcruntime140.dll\r" in target/dist, beside the vcruntime140.dll win-bundle.sh
had just put there, and stopped. release.sh and release-check.sh, the list's two readers, now strip it.
2026-11-19 11:37:55 -08:00
shinyobjectz c3e7206581 DX12 with DXC: hanabi's utils shader named so DXC can read it; an export refuses a codec before rendering (#196)
wgpu hands DXC a shader module's label as its source's file name, and on Windows LLVM reads "hanabi:shader:utils"
as a root and a file, so DXC said "error reading 'hanabi:shader:utils'" and every Bevy app failed: on a PC where
dxcompiler.dll is on the PATH (wgpu loads it when it can, else FXC), rc8 rendered no 3D at all on DX12 (exit 101 on
an RTX 4070 with WGPU_BACKEND=dx12 and DXC 1.9.2609; the same render passed with FXC). raea export xml's passes were
where the reporter saw it, on a PC whose Intel iGPU puts raea on DX12. Bevy names its modules nothing; hanabi's
utils module and its contract tests' were the only labels with a colon, now underscores.

And an export refuses an alpha codec this machine can't write (ProRes or HEVC off a Mac) when it starts, not after the
reference render: Codec::chosen, which layers, capcut and render_movie share.
2026-11-19 11:37:55 -08:00
shinyobjectz 96c450fb75 export xml: a Windows path is a file URL an editor opens (#195)
0.1.8-rc8 percent-encoded a Windows path whole into <pathurl>: file://localhostD%3A%5CWork%5C... for D:\Work\...,
which DaVinci Resolve refused. The same XML imported at once with file:///D:/Work/... (the reporter's test). A drive's
path is now that, a share's file://nas/clips/..., separators as slashes and the \\?\ prefix off; a Mac's and
Linux's are as before. cargo test -p raea-app-layers passes, with a test of each kind of path.
2026-11-19 11:37:55 -08:00
shinyobjectz 85f4b98616 whats-new 0.1.8: raea/wear's weather during a shot (WR9)
The page named the bake and the shader but not the eight conditions or weatherAt, which change the weather as a
shot runs (rain soaking a front over minutes and drying over the hour after, snow settling, frost forming).
2026-11-19 10:59:41 -08:00
shane fcdcf1c883 Merge pull request #200 from shinyobjectz/wear-crumble
raea/wear: crumbling (WR6), weather during a shot (WR9), the corner house demo (WR7); wear on the public hook (EX9)
2026-11-19 13:55:36 -05:00
shane 3f99e479cd Merge pull request #199 from shinyobjectz/win-bundle
Windows: everything raea needs ships in bin\, under licences we can meet
2026-11-19 13:46:12 -05:00
shinyobjectz bb8b497b58 docs/wear.feature WR8: what the wear shader costs, measured before building the detail layers
At 4K on the M5 Pro the corner house renders 17.2 ms a frame plain and 17.2 worn (17.6 and 17.7 again), so the
recipes' per-pixel noise costs nothing a render can see; the bake's four maps hold 36 MB on the GPU, which BC7 would
take to about 9 MB once the class code has a map of its own. WR8 stays open: the detail layers, mips on arrays (with
them) and BC/KTX2 maps with a fallback where BC isn't.
2026-11-19 10:14:49 -08:00
shinyobjectz c37509d17f Debris thinned by raea-sys-touch's rule, a crack's bounds by parry's Aabb (two near copies folded)
raea-sys-damage kept its debris in seed order with none nearer than a gap, as touch's thin() does for spots, and
found a crack path's bounds with a fold pick.rs also has. touch's rule is now thin_by (any candidate with a place),
which thin_if and damage's debris both use, and the bounds are Aabb::from_points. The same spots come out:
cargo test -p raea-sys-touch -p raea-sys-damage -p raea-sys-weathering pass. Near-duplicate groups back to 58, so
tools/dupes.max goes down to it.
2026-11-19 10:14:49 -08:00
shinyobjectz 913931ad9a Windows: bin\ carries what raea needs, so a PC with nothing installed and no downloads works
tools/release/win-bundle.sh puts beside raea.exe, each with its licence: Microsoft's Visual C++ runtime
(vcruntime140, vcruntime140_1, msvcp140, msvcp140_1) from the runner's Visual Studio, app-local as Microsoft
documents; raea's LGPL FFmpeg 9.0.2 (tools-ffmpeg-9.0.2-lgpl, libvpx's licence and patent grant beside it); and
uv. Before, raea.exe didn't start without the VC++ Redistributable installed, and a PC that blocks GitHub's downloads
couldn't read a phone's video or set up a local model. Its pins are setup.rs's, so what ships and what raea fetches
where it isn't are the same build: setup.rs now fetches our LGPL zip (sha256 d3a3d8cd...) in place of GyanD's GPL
essentials. release.yml runs it, and release-check.sh refuses a Windows zip whose bin\ lacks a file
win-bundle.files lists, whose FFmpeg isn't the LGPL build, or that has no libvpx-vp9 or h264_mf. NOTICE, the README
and 0.1.8's what's new say so.

Checked on the Windows box with the published zip: LGPL, the libvpx VP8/VP9 decoders and h264_mf listed; a 2 s
H.264 clip with AAC cut by h264_mf at notes check's arguments; an alpha VP9 WebM decoded with its alpha (253,0,0,127);
the filters raea runs (ebur128, freezedetect, signalstats, scale, concat, showwavespic, ...) present.
2026-11-19 10:05:03 -08:00
shinyobjectz 02051ee992 One smoothstep for the systems: raea_core_ease::smoothstep (raea-sys-damage's copied raea-sys-foliage's)
Neither crate can depend on the other (systems don't reach sideways), so the cubic Hermite ease goes down to
raea-core-ease, the curves crate, and both use it; foliage keeps its name for it (smooth). Behaviour unchanged:
cargo test -p raea-core-ease -p raea-sys-damage -p raea-sys-foliage pass.
2026-11-19 09:58:24 -08:00
shinyobjectz adec0aef74 docs/wear.feature: WR6, WR7 and WR9 as built, done
Their crates, files, lines and proof: raea-sys-damage and raea/wear's crumbling (WR6), the corner house demo with
worn paint and EX9's deletion (WR7), and weather during a shot with the eight conditions named (WR9). WR8, detail
textures from mask stacks and what they cost, is what's left of raea/wear.
2026-11-19 09:55:02 -08:00
shinyobjectz 84b7659b09 Worn paint is a surface shader of raea's own; raea-sys-wear goes (docs/examples.feature EX9)
MeshStandardMaterial's wear and raea/pbr's <WearExtension> drew with the engine's own MaterialExtension
(systems/wear). They now write the same shader on the public surface hook (sdk/render/src/worn.ts, WORN_WESL: the
same noise, curvature edges, grime, rust and chips, in the mesh's own space), so wear is an author's shader like any
other and raea/wear's weather and the paint wear share one path. A parity scene (sharp, turned and round parts, every
setting) renders the same as before, RMSE 3.8e-5 of full scale. One change: clay draws custom surface shaders as they
are, so worn paint now shows in a clay render, as a ShaderExtension's does.

Deleted: systems/wear, its WearPlugin, its spawn branch, its mesh-row columns, its layer entries, and its type in
the registry snapshot, bevy.gen.tsx and sdk-coverage (reached 1557 -> 1556: the type is gone; wear is still
authored). wear with shader or grid on one material is refused (it was silently dropped). WearExtension keeps its
props, so the guides are unchanged; it carries no @bevy tag of its own now, since its Bevy type is ShaderExtension's.
2026-11-19 09:53:04 -08:00
shinyobjectz e8e3500466 Clip cuts pick the H.264 encoder this machine's ffmpeg has (raea_io_ffmpeg::h264)
raea notes check's sign-off clip and a postmortem's clip were cut with libx264, which only a GPL ffmpeg has:
Homebrew's and Linux distributions' do, and GyanD's Windows build did, but the LGPL build raea now ships on
Windows doesn't. h264() asks ffmpeg -encoders once and takes libx264, else Windows' own Media Foundation encoder
(h264_mf, in raea's LGPL build), else VideoToolbox's, at 8 Mb/s for the system ones; None without one (notes check
says so; a postmortem plays the whole piece, as it did when a cut failed).
2026-11-19 09:51:02 -08:00
shinyobjectz abc6828def Git for Windows' complete source, published beside raea's releases (tools/release/git-sources.sh)
The Windows app ships dugite-native's Git for Windows (GPLv2) so a workspace is made on a PC without Git. GPLv2
section 3 asks whoever distributes it to make its complete corresponding source available, and dugite-native's
repository alone isn't that: Git for Windows' MSYS2 runtime, bash, curl, OpenSSH and the rest are built from their
own source packages. git-sources.sh resolves each package the build's etc/package-versions.txt names to the source
package it came from (51: Git for Windows' pacman repository first, MSYS2's source mirror for the rest) and packs
them with the list; tools-git-sources.yml publishes that once as the prerelease tools-git-<tag>-sources, which the
app's git\SOURCE.txt names.
2026-11-19 09:49:58 -08:00
shinyobjectz d184deb4d1 FFmpeg for Windows, LGPL, built from FFmpeg's own release (tools/release/ffmpeg-win.sh)
raea ships FFmpeg beside raea.exe on Windows so a PC that can't download it still reads a phone's video. GyanD's
essentials build, which raea fetched until now, is GPLv3 with a dozen GPL libraries linked in; shipping it would
mean shipping all their sources. This build is FFmpeg's own code, zlib and libvpx's decoders (BSD, for alpha
WebM, #113), static, LGPL 2.1 or later, with no capture devices and no network; its H.264 encoder is Windows' own
through Media Foundation (h264_mf), since FFmpeg has none of its own and libx264 is GPL. Its complete source is
FFmpeg's signed tarball, libvpx's tarball and this script. tools-ffmpeg.yml builds it with mingw-w64 (apt reading
Ubuntu's archive, as the runner's own mirror trickled) and publishes it once as a prerelease with that source.
2026-11-19 09:49:58 -08:00
shinyobjectz 80ffc0f8e3 wear WR7: the corner house demo (examples/materials/wear)
A Berlin corner block made in code (house.ts): a sandstone plinth, a rusticated ground floor, plastered storeys,
sills, a string course, a cornice on consoles under a hipped slate roof, a door in a sandstone surround up granite
steps, an iron balcony, a zinc gutter and downpipe, an enamel street plate on each face of the corner, a cellar
hatch, a brick firewall, the walk and the road. Its openings go through the walls with the glass 15 cm in, so
cracks start at their corners; one glTF material per wear class. make-house.ts writes media/house.glb.

wear.tsx bakes it once and draws it new, after 80 years of a coal-burning city, as a ruin (with the debris its
age leaves lying, in lumps), at its door and its foot up close; each of the 16 causes in false colour; each of
WR9's eight conditions by day and at dusk; and a shower crossing it as a timelapse (weatherAt). Rendered on the
Mac, 0 errors on every still. Its tests (6) check the house's parts, the openings, the .glb and that the demo
lists every cause and condition.
2026-11-19 09:37:02 -08:00
shinyobjectz 80cc01f11d wear WR6: crumbling, from the same causes (raea-sys-damage, raea/wear); WR9's weather during a shot
Where a building breaks, by rules over the weathering bake's texels, in a crate of its own (raea-sys-damage 3):
- cracks from the re-entrant corners of a wall's openings: a wall texel is beside one when, of eight probes
  across and up the wall, only one diagonal misses it; about half the corners crack (which ones by place, so a
  house cracks the same way every bake), each leaving away from the opening, steeper than 45 degrees, 0.35-1.25 m,
  wandering. causes3's alpha is each texel's distance to the nearest crack on its own wall.
- the loss potential: how readily a coat comes off at the damp foot, where run-off soaks what the rain doesn't
  wash, at a knocked arris low down and along a crack (LOSS; raea/wear's test checks its copy against it).
- debris on the walk under outdoor plaster with a high loss potential, dropped onto the walk from 0.2 m out (none
  where a plinth or step is below first, none from a wall the rain never reaches, a room's or a hollow model's
  back), each with its potential (spots.json "loss"); touch's old debris rule, which waited for this, is gone
  (raea-sys-touch 5). raea-sys-weathering 7 keys on raea-sys-damage's version.

raea/wear draws it by neglect (years less what upkeep keeps up): render lost to the brick 2 cm behind it (drawn
at the view's parallax) under a shadowed lip, paint to red-lead primer and the wood, enamel flaking to rusting
iron, cracks no thinner than a pixel (stepped along brick's joints). What a lived-in house mends however poorly
it is kept (panes, most slates, fallen render on its walk) goes only once it is left empty: abandonOf, neglect
past ABANDON_FROM (0.85) by the house's own upkeep. wearSpots reads spots.json; wearDebris is the debris an age
leaves lying; debug views crack and loss.

WR9: weatherAt eases what lies on the surfaces (wet, snow, driven snow, frost) toward what the sky does, spell by
spell, each at its own rate (WEATHER_RATES, ASSUMED: wet in about 3 minutes, dry over an hour), exactly, so any
frame draws alone; WEAR_CONDITIONS are the eight conditions as weather.

Tests: cargo test -p raea-sys-damage (5: an opening's four corners and no others, cracks along the wall, about
half the corners crack, what loosens a coat, debris under outdoor plaster's foot and on the walk only),
-p raea-sys-weathering (11), -p raea-sys-touch (9); bun test in sdk/wear (22).
2026-11-19 09:37:01 -08:00
132 changed files with 3379 additions and 2270 deletions

No files matched your search

+12
View File
@@ -119,3 +119,15 @@ jobs:
env:
CARGO_PROFILE_TEST_DEBUG: "0"
run: cargo test --locked -p raea-runtime-plugins -p raea-io-media -p raea-core-fonts -p raea-native -p raea-core-brief -p raea-core-k -p raea-bundle -p raea-app-check -p raea-app-check-flash -p raea-io-ffmpeg -p raea-app-workspace -p raea-app-tools -p raea-app-targets
- name: Windows' and Linux's own (#169)
# what a Windows or Linux user meets that no other step ran: QuickJS's Intl (raea-runtime-jsengine's
# quickjs_formats_as_javascriptcore_does, on Linux), openh264 at --quality master (raea-io-soft), git found or
# fetched (raea-io-assets), and raea's Node core under the agent shell (raea-native's tests/node.rs: Node's names
# for the system, Windows' paths); tests/node.rs needs raea-native's modules feature and tests/quality.rs
# raea-io-soft's h264
env:
CARGO_PROFILE_TEST_DEBUG: "0"
run: |
cargo test --locked -p raea-native --features modules --test node
cargo test --locked -p raea-io-soft --features h264
cargo test --locked -p raea-runtime-jsengine -p raea-io-assets
+13 -6
View File
@@ -217,9 +217,10 @@ jobs:
retention-days: 3
compression-level: 0
# Windows in Git's bash on GitHub's runner, with the Visual Studio Build Tools in its image (their image terms; we
# accept no licence and download no Microsoft files). The C runtime is the DLL one (the VC++ redistributable): ort's
# prebuilt ONNX Runtime is built against it, so crt-static doesn't link (LNK2019 on __imp_ symbols, 10-29).
# Windows in Git's bash on GitHub's runner, with Visual Studio in its image. The C runtime is the DLL one: ONNX
# Runtime is built against it (crt-static didn't link: LNK2019 on __imp_ symbols, 10-29), and Microsoft's
# onnxruntime.dll imports it too, so the VC++ runtime's DLLs ship beside raea.exe from this image's Visual Studio
# (tools/release/win-bundle.sh), as Microsoft documents for app-local deployment.
windows:
runs-on: ${{ (vars.RELEASE_WINDOWS_RUNNER && fromJSON(vars.RELEASE_WINDOWS_RUNNER)) || 'windows-latest' }}
timeout-minutes: 350
@@ -333,12 +334,16 @@ jobs:
# static runtime ort links by default is built for AVX2 and stopped raea.exe at start on CPUs without it
- name: ONNX Runtime (tools/release/onnxruntime.sh)
run: bash tools/release/onnxruntime.sh target/dist
# which DLLs raea needs from the machine (the CRT's come from the VC++ redistributable)
# and what a PC with nothing installed and no downloads needs beside raea.exe: the VC++ runtime (from this
# runner's Visual Studio), FFmpeg (raea's LGPL build) and uv, each with its licence
- name: The Windows bundle (tools/release/win-bundle.sh)
run: bash tools/release/win-bundle.sh target/dist
# which DLLs raea needs from the machine (the CRT's now ship beside it: win-bundle.sh)
- name: What raea.exe imports
run: |
{ echo '### what raea.exe, raea_bundle.dll, raea-perceive.exe and onnxruntime.dll import'; echo '```'
dumpbin=$(ls "/c/Program Files/Microsoft Visual Studio"/*/*/VC/Tools/MSVC/*/bin/HostX64/x64/dumpbin.exe | head -1)
"$dumpbin" -nologo -dependents target/dist/raea.exe target/dist/raea_bundle.dll target/dist/raea-perceive.exe target/dist/onnxruntime.dll | grep -iE '\.dll$|Dump of' | sed 's/^ *//'
"$dumpbin" -nologo -dependents target/dist/raea.exe target/dist/raea_bundle.dll target/dist/raea-perceive.exe target/dist/onnxruntime.dll target/dist/ffmpeg.exe | grep -iE '\.dll$|Dump of' | sed 's/^ *//'
echo '```'; } | tee -a "$GITHUB_STEP_SUMMARY" || true
# release.sh's checks render on Mesa's lavapipe (software Vulkan, MIT; on the runner only, never in the zip): the
# runner has no GPU, and WARP, Windows' own software DX12, crashes compiling one of Bevy's compute shaders there
@@ -419,6 +424,7 @@ jobs:
lfs: false
sparse-checkout: |
tools/release-check.sh
tools/release/win-bundle.files
tools/release/lavapipe.sh
sparse-checkout-cone-mode: false
path: check
@@ -432,7 +438,8 @@ jobs:
run: |
set -e
v=${TAG#v}
cp check/tools/release-check.sh "$RUNNER_TEMP/"
# and the list of what bin\ must carry, where release-check.sh looks for it (release/ beside it)
cp check/tools/release-check.sh "$RUNNER_TEMP/" && mkdir -p "$RUNNER_TEMP/release" && cp check/tools/release/win-bundle.files "$RUNNER_TEMP/release/"
rm -rf check
cd "$RUNNER_TEMP/zip"
sha256sum -c "raea-$v-windows-x86_64.zip.sha256"
+49
View File
@@ -0,0 +1,49 @@
# FFmpeg for Windows as raea ships it (tools/release/ffmpeg-win.sh): built on Linux with mingw-w64 and published once
# as the prerelease tools-ffmpeg-<version>-lgpl, with FFmpeg's source tarball, its signature and the script, which are
# its complete source (LGPL 2.1 or later). io/assets/src/setup.rs pins the zip by its
# sha256, so a published zip is never replaced: a run whose release already holds one only builds it and says
# whether its own sha256 differs.
name: tools-ffmpeg
on:
workflow_dispatch:
push:
paths: [tools/release/ffmpeg-win.sh, .github/workflows/tools-ffmpeg.yml]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
lfs: false
# the x86_64 cross compiler only, and non-interactive: an install that asks (needrestart, debconf) waits forever.
# The runner's own EC2 mirror has trickled (35 MB in 11 minutes, 11-19), so apt reads Ubuntu's archive first
# and Azure's mirror after it, gives up on a stalled request and retries.
- name: mingw-w64
env:
DEBIAN_FRONTEND: noninteractive
NEEDRESTART_MODE: a
run: |
printf 'http://archive.ubuntu.com/ubuntu/\tpriority:1\nhttp://azure.archive.ubuntu.com/ubuntu/\tpriority:2\n' | sudo tee /etc/apt/apt-mirrors.txt
o="-o Acquire::Retries=5 -o Acquire::http::Timeout=30"
sudo -E apt-get $o update -q
sudo -E apt-get $o install -y -q --no-install-recommends gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 libz-mingw-w64-dev nasm make pkg-config xz-utils zip
timeout-minutes: 25
- name: build
run: bash tools/release/ffmpeg-win.sh out
- name: publish (once)
env:
GH_TOKEN: ${{ github.token }}
run: |
v=$(sed -n 's/^v=//p' tools/release/ffmpeg-win.sh)
tag=tools-ffmpeg-$v-lgpl; zip=ffmpeg-$v-lgpl-win64.zip
if gh release view "$tag" --json assets -q '.assets[].name' 2>/dev/null | grep -qx "$zip"; then
echo "$tag already has $zip (never replaced); this run's: $(cat out/$zip.sha256)"; exit 0
fi
curl -fsSL -o "out/ffmpeg-$v.tar.xz.asc" "https://ffmpeg.org/releases/ffmpeg-$v.tar.xz.asc"
cp tools/release/ffmpeg-win.sh out/
gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" --prerelease --title "FFmpeg $v for Windows (LGPL), as raea ships it" \
--notes "FFmpeg $v cross-built for Windows x64 by tools/release/ffmpeg-win.sh: static, FFmpeg's own code, zlib and libvpx's decoders (BSD), LGPL 2.1 or later; its H.264 encoder is Windows' own (Media Foundation). Its complete source is ffmpeg-$v.tar.xz (with FFmpeg's signature), the libvpx tarball and ffmpeg-win.sh, attached here. raea ships it beside raea.exe on Windows and fetches it where it isn't."
gh release upload "$tag" "out/$zip" "out/$zip.sha256" "out/ffmpeg-$v.tar.xz" "out/ffmpeg-$v.tar.xz.asc" out/libvpx-*.tar.gz out/ffmpeg-win.sh
+34
View File
@@ -0,0 +1,34 @@
# The complete corresponding source of the Git for Windows the Windows app ships (tools/release/git-sources.sh),
# published once as the prerelease tools-git-<tag>-sources, which the app's git\SOURCE.txt names: GPLv2 section 3
# asks whoever distributes Git to make it available, and dugite-native's own repository isn't all of it (Git for
# Windows' MSYS2 runtime, bash, curl and the rest are built from their own source packages). A run whose release
# already holds the archive changes nothing.
name: tools-git-sources
on:
workflow_dispatch:
push:
paths: [tools/release/git-sources.sh, .github/workflows/tools-git-sources.yml]
permissions:
contents: write
jobs:
sources:
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
lfs: false
- name: publish (once)
run: |
t=$(sed -n 's/^tag=//p' tools/release/git-sources.sh)
tag=tools-git-$t-sources; tar=git-for-windows-$t-sources.tar
if gh release view "$tag" --json assets -q '.assets[].name' 2>/dev/null | grep -qx "$tar"; then
echo "$tag already has $tar"; exit 0
fi
bash tools/release/git-sources.sh out
cp tools/release/git-sources.sh out/
gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" --prerelease --title "Git for Windows ($t) sources, as raea's Windows app ships it" \
--notes "The complete corresponding source of the Git for Windows (dugite-native $t) that raea's Windows app ships in its git folder: each package of its etc/package-versions.txt as the source package it was built from, from Git for Windows' pacman repository or MSYS2's source mirror (SOURCES.tsv inside says which), collected by git-sources.sh, attached here. raea runs Git as a separate program."
gh release upload "$tag" "out/$tar" "out/$tar.sha256" out/git-sources.sh
+3
View File
@@ -104,5 +104,8 @@ sdk/raea/.scratch-*/
# the Tripo CLI writes its last task id into the directory it runs in
.tripo/
# examples/materials/wear: its house is made by make-house.ts (media/) and baked at render time (assets/wear/)
/examples/materials/wear/media/
/examples/materials/wear/assets/
# 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
Generated
+17 -155
View File
@@ -2668,7 +2668,6 @@ dependencies = [
"bevy_utils",
"bitflags 2.13.2",
"bytemuck",
"ctt",
"ddsfile",
"futures-lite",
"guillotiere",
@@ -5567,100 +5566,6 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "ctt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c119cc328a986d0bae3a1753941595f1dc6a0f2d938b5f49edf8937bd606fa9"
dependencies = [
"bytemuck",
"ctt-astcenc",
"ctt-bc7enc-rdo",
"ctt-compressonator",
"ctt-etcpak",
"ctt-intel-texture-compressor",
"ddsfile",
"fast_image_resize",
"flate2",
"half",
"ktx2",
"log",
"miniz_oxide 0.8.9",
"profiling",
"thiserror 2.0.21",
"zstd",
]
[[package]]
name = "ctt-astcenc"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24a806826f523401c1c8a9afded1c5625f005fd8e6567ceba2fe6254d8c59e3e"
dependencies = [
"bitflags 2.13.2",
"cc",
"paste",
]
[[package]]
name = "ctt-bc7enc-rdo"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a4ad8fcbfcafc39a9e02bfb344fd517dd0bcd7adabcc25de19e9703eb3b99a3"
dependencies = [
"ctt-bc7enc-rdo-prebuilt",
"ispc-build-utils",
]
[[package]]
name = "ctt-bc7enc-rdo-prebuilt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f27a2776bbafcc2d335c0621aa9dbd40ecfecdb02a636d3fcd2a2379f96f7472"
dependencies = [
"ispc-build-utils",
]
[[package]]
name = "ctt-compressonator"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21eefd5a6f96023adc6bc8c95de1afccded8f958afdbf7e02fa98bf325c41058"
dependencies = [
"cc",
"thiserror 2.0.21",
]
[[package]]
name = "ctt-etcpak"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6025bf0456c4a8c0a693c803eb7368f045f74709adc6b271223ca7f76898ab"
dependencies = [
"cc",
"paste",
]
[[package]]
name = "ctt-intel-texture-compressor"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "452985b4223f1a68da0722161ff9a7dbb33bcb32cd30f341b541fd980c58fb26"
dependencies = [
"cc",
"ctt-intel-texture-compressor-prebuilt",
"ispc-build-utils",
]
[[package]]
name = "ctt-intel-texture-compressor-prebuilt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4031e53991b02e2b9fb903f3bb458ab9a2afcec99320800d4d4092dc43d33c"
dependencies = [
"ispc-build-utils",
]
[[package]]
name = "cursor-icon"
version = "1.2.0"
@@ -6839,18 +6744,6 @@ dependencies = [
"arrayvec",
]
[[package]]
name = "fast_image_resize"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9c50201dc184ba6553da1695aac20a042efffbe2d84542cee31917c86c3ab1e"
dependencies = [
"cfg-if",
"document-features",
"num-traits",
"thiserror 2.0.21",
]
[[package]]
name = "fastbloom"
version = "0.17.0"
@@ -8684,15 +8577,6 @@ version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "ispc-build-utils"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4cda913ddb107b9bb5c46769855e3849e62daa52fc7e70de0080ca4e6cfd030"
dependencies = [
"find-msvc-tools",
]
[[package]]
name = "itertools"
version = "0.10.5"
@@ -13954,6 +13838,7 @@ name = "raea-app-notes"
version = "0.1.0"
dependencies = [
"raea-core-facts",
"raea-io-ffmpeg",
"raea-io-home",
"raea-io-trace",
"serde",
@@ -14050,6 +13935,7 @@ dependencies = [
"raea-app-registry",
"raea-core-brief",
"raea-core-facts",
"raea-io-assets",
"raea-io-home",
"serde_json",
]
@@ -14953,7 +14839,6 @@ dependencies = [
"raea-sys-three-shader",
"raea-sys-viewbox",
"raea-sys-volume",
"raea-sys-wear",
"serde_json",
"wgpu",
]
@@ -15349,6 +15234,8 @@ dependencies = [
name = "raea-runtime-jsengine"
version = "0.1.0"
dependencies = [
"iana-time-zone",
"miniz_oxide 0.8.9",
"objc2 0.6.5",
"raea-io-home",
"rquickjs",
@@ -15495,7 +15382,6 @@ dependencies = [
"raea-sys-frame",
"raea-sys-layers",
"raea-sys-procmat",
"raea-sys-wear",
"serde_json",
]
@@ -15805,6 +15691,16 @@ dependencies = [
"raea-sys-shader",
]
[[package]]
name = "raea-sys-damage"
version = "0.1.0"
dependencies = [
"parry3d",
"raea-core-ease",
"raea-sys-touch",
"rayon",
]
[[package]]
name = "raea-sys-environment"
version = "0.1.0"
@@ -15867,6 +15763,7 @@ dependencies = [
"dunce",
"fastrand",
"image",
"raea-io-ffmpeg",
"raea-sys-columns",
"raea-sys-fingerprint",
"serde",
@@ -15902,6 +15799,7 @@ version = "0.1.0"
dependencies = [
"image",
"parry3d",
"raea-core-ease",
"raea-sys-glb",
"serde_json",
]
@@ -16523,15 +16421,6 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-sys-wear"
version = "0.1.0"
dependencies = [
"bevy",
"raea-core-program",
"serde_json",
]
[[package]]
name = "raea-sys-weathering"
version = "0.1.0"
@@ -16539,6 +16428,7 @@ dependencies = [
"image",
"parry3d",
"raea-core-meshcheck",
"raea-sys-damage",
"raea-sys-exposure",
"raea-sys-glb",
"raea-sys-runoff",
@@ -23811,34 +23701,6 @@ dependencies = [
"futures-io",
]
[[package]]
name = "zstd"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb02c3132d251ab1606e9fc913a7da6c6ed08cc263df15edf082e1dc497d157"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
version = "7.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c8ea04668f5de8d8d51051714ba560c9536519cadcdb8829bba4fe2ad159b03"
dependencies = [
"zstd-sys",
]
[[package]]
name = "zstd-sys"
version = "2.1.2+zstd.1.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "481ada9c543b2323cbb7bbdbb5249177fbf0188ed959ed2c15e4b22421c84ed3"
dependencies = [
"cc",
"pkg-config",
]
[[package]]
name = "zune-core"
version = "0.5.3"
+1 -1
View File
@@ -102,11 +102,11 @@ members = [
"systems/canvas",
"systems/tweak",
"systems/filters",
"systems/wear",
"systems/weathering",
"systems/runoff",
"systems/touch",
"systems/exposure",
"systems/damage",
"systems/glb",
"systems/procmat",
"systems/page",
-37
View File
@@ -1,37 +0,0 @@
ctt 0.5.0 ships no licence file of its own. Its Cargo.toml declares MIT OR Apache-2.0 OR Zlib, by The ctt developers.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers
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.
---- Zlib ----
Copyright (c) The ctt developers
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.
@@ -1,175 +0,0 @@
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.
@@ -1,178 +0,0 @@
Copyright (C) 2018-2021 Binomial LLC
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
@@ -1,20 +0,0 @@
ctt-bc7enc-rdo-prebuilt 0.5.0 ships no licence file of its own. Its Cargo.toml declares (MIT OR Apache-2.0) AND Apache-2.0, by The ctt developers, Rich Geldreich <[email protected]>.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers, Rich Geldreich <[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.
@@ -1,19 +0,0 @@
Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
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.
@@ -1,26 +0,0 @@
etcpak, an extremely fast ETC compression utility (https://github.com/wolfpld/etcpak)
Copyright (c) 2013-2026, Bartosz Taudul <wolf@nereid.pl>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,176 +0,0 @@
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
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2019 Graham Wihlidal
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.
@@ -1,19 +0,0 @@
Copyright 2017 Intel Corporation
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.
@@ -1,20 +0,0 @@
ctt-intel-texture-compressor-prebuilt 0.5.0 ships no licence file of its own. Its Cargo.toml declares (MIT OR Apache-2.0) AND MIT, by The ctt developers, Traverse Research <[email protected]>, Graham Wihlidal <[email protected]>, Intel Corporation.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers, Traverse Research <[email protected]>, Graham Wihlidal <[email protected]>, Intel Corporation
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.
@@ -1,201 +0,0 @@
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 (c) 2021 Kirill Kuzminykh
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.
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2021 Kirill Kuzminykh
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.
@@ -1,201 +0,0 @@
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 2020 Andrew Straw
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.
@@ -1,25 +0,0 @@
Copyright (c) 2020 Andrew D. Straw
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.
@@ -1,201 +0,0 @@
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 2020 Andrew Straw
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.
@@ -1,25 +0,0 @@
Copyright (c) 2020 Andrew D. Straw
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.
@@ -1,37 +0,0 @@
ispc-build-utils 0.5.0 ships no licence file of its own. Its Cargo.toml declares MIT OR Apache-2.0 OR Zlib, by The ctt developers.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) The ctt developers
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.
---- Zlib ----
Copyright (c) The ctt developers
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.
-28
View File
@@ -1,28 +0,0 @@
BSD 3-Clause License
Copyright (c) 2026, Alexandre Bury
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-28
View File
@@ -1,28 +0,0 @@
BSD 3-Clause License
Copyright (c) 2026, Alexandre Bury
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,28 +0,0 @@
BSD 3-Clause License
Copyright (c) 2026, Alexandre Bury
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,32 +0,0 @@
The auto-generated bindings are under the 3-clause BSD license:
BSD License
For Zstandard software
Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook, nor Meta, nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+14 -17
View File
@@ -20,8 +20,20 @@ animato (MIT OR Apache-2.0), usvg and resvg (Apache-2.0 OR MIT), mediabunny (MPL
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.
paths for Windows in runtime/bundle). Its bin\ also carries, each with its licence beside it (tools/release/win-bundle.sh):
Microsoft's Visual C++ runtime (vcruntime140.dll, vcruntime140_1.dll, msvcp140.dll, msvcp140_1.dll), redistributed
under Microsoft's Visual Studio licence terms; ONNX Runtime's onnxruntime.dll (Microsoft, MIT);
FFmpeg 9.0.2 (ffmpeg.exe, ffprobe.exe; LGPL-2.1-or-later), built from FFmpeg's release with FFmpeg's own code, zlib
and libvpx 1.17.0's decoders (BSD-3-Clause with the WebM project's patent grant: libvpx-LICENSE.txt,
libvpx-PATENTS.txt) by tools/release/ffmpeg-win.sh, its H.264 encoder Windows' own (Media Foundation), its source
published as the release tools-ffmpeg-9.0.2-lgpl;
uv (uv.exe; Astral, MIT OR Apache-2.0).
The Windows app adds Git for Windows with Git LFS (dugite-native; GPLv2 and its parts' licences, in git\), which raea
runs as a separate program; its complete corresponding source is published as the release tools-git-<tag>-sources.
raea.exe, on a PC with no Git, fetches the same build once into its tools cache (io/assets git()).
The Windows and Linux builds' JavaScript engine, QuickJS (rquickjs, MIT), carries FormatJS's Intl polyfills (MIT,
Copyright FormatJS) and the Unicode CLDR locale data they're made with (Unicode-3.0), packed in
runtime/jsengine/js/intl.pack; both licences are in runtime/jsengine/js/intl/LICENSE-FormatJS.md and in the pack.
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.
@@ -155,14 +167,6 @@ LICENSES/<crate>-<version>/.
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
@@ -188,7 +192,6 @@ LICENSES/<crate>-<version>/.
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
fid-rs 0.2.0: MIT OR Apache-2.0
@@ -219,14 +222,11 @@ LICENSES/<crate>-<version>/.
i_overlay 4.5.2: MIT OR Apache-2.0
i_shape 1.18.0: MIT
i_tree 0.18.0: MIT
iana-time-zone-haiku 0.1.2: MIT OR Apache-2.0
iana-time-zone 0.1.65: MIT OR Apache-2.0
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
@@ -428,9 +428,6 @@ LICENSES/<crate>-<version>/.
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
+2 -2
View File
@@ -86,8 +86,8 @@ On Windows 10 or 11, in PowerShell:
irm https://raea.io/install.ps1 | iex
```
It does the same under `~\.raea` and adds raea to your PATH. raea needs the Microsoft Visual C++ Redistributable
(x64), which most machines already have, and a DirectX 12 or Vulkan GPU driver.
It does the same under `~\.raea` and adds raea to your PATH. raea needs a DirectX 12 or Vulkan GPU driver; what
else it needs (the Visual C++ runtime, FFmpeg and uv) is in its `bin\` folder.
## Hello
+1 -1
View File
@@ -48,7 +48,7 @@ fn export(args: &[String]) -> R<String> {
let tsx = args.first().filter(|a| !a.starts_with('-')).ok_or(USAGE)?;
let tsx = dunce::canonicalize(&PathBuf::from(tsx)).map_err(|e| format!("{tsx}: {e}"))?;
let dir = tsx.parent().unwrap().to_path_buf();
let codec = flag(args, "--alpha-codec").map_or(Ok(raea_io_alpha::Codec::default_here()), |c| raea_io_alpha::Codec::parse(&c))?;
let codec = raea_io_alpha::Codec::chosen(flag(args, "--alpha-codec").as_deref())?;
let (root, in_store) = match flag(args, "-o") {
Some(o) => (PathBuf::from(o), false),
None => {
+1 -1
View File
@@ -145,7 +145,7 @@ pub fn export(args: &[String]) -> R<(Layers, String)> {
let tsx = args.first().filter(|a| !a.starts_with('-')).ok_or(USAGE)?;
let tsx = dunce::canonicalize(PathBuf::from(tsx)).map_err(|e| format!("{tsx}: {e}"))?;
let edit_dir = tsx.parent().unwrap().to_path_buf();
let codec = flag(args, "--alpha-codec").map_or(Ok(raea_io_alpha::Codec::default_here()), |c| raea_io_alpha::Codec::parse(&c))?;
let codec = raea_io_alpha::Codec::chosen(flag(args, "--alpha-codec").as_deref())?;
let name = named(args, &tsx);
let dir = flag(args, "-o").map_or_else(|| edit_dir.join("out/layers").join(&name), PathBuf::from);
std::fs::create_dir_all(&dir).map_err(|e| format!("{}: {e}", dir.display()))?;
+16
View File
@@ -402,3 +402,19 @@ fn a_pan_inside_its_box_is_keyed() {
let dw = 3840.0 * 1920.0 / 2160.0;
assert!(near(centre(&from), (dw / 2.0 - 540.0) / 1080.0) && near(centre(&to), -(dw / 2.0 - 540.0) / 1080.0));
}
#[test]
fn a_windows_path_is_a_file_url_an_editor_opens() {
// #195: 0.1.8-rc8 wrote file://localhostD%3A%5CWork%5C... for D:\Work\...; Resolve imported the same XML at once with
// file:///D:/Work/...
use crate::xml::pathurl;
use std::path::Path;
assert_eq!(pathurl(Path::new(r"D:\Work\_research\raea\xmltest\public\clip.mp4")), "file:///D:/Work/_research/raea/xmltest/public/clip.mp4");
assert_eq!(pathurl(Path::new(r"\\?\C:\Users\Jürgen\my clip.mp4")), "file:///C:/Users/J%C3%BCrgen/my%20clip.mp4");
assert_eq!(pathurl(Path::new("C:/Users/me/out/xml/edit/graphics.rle.mov")), "file:///C:/Users/me/out/xml/edit/graphics.rle.mov");
assert_eq!(pathurl(Path::new(r"\\nas\clips\a.mp4")), "file://nas/clips/a.mp4");
assert_eq!(pathurl(Path::new(r"\\?\UNC\nas\clips\a.mp4")), "file://nas/clips/a.mp4");
// a Mac's or Linux's as before, a backslash there being part of a name
assert_eq!(pathurl(Path::new("/Users/me/my clip.mp4")), "file://localhost/Users/me/my%20clip.mp4");
assert_eq!(pathurl(Path::new(r"/tmp/a\b.mp4")), "file://localhost/tmp/a%5Cb.mp4");
}
+25 -7
View File
@@ -57,14 +57,32 @@ fn esc(s: &str) -> String {
}
/// A file's path as xmeml's pathurl: file://localhost and the absolute path, each byte outside the unreserved set
/// percent-encoded.
fn pathurl(p: &Path) -> String {
let mut out = String::from("file://localhost");
for b in p.to_string_lossy().bytes() {
if b.is_ascii_alphanumeric() || b"/-_.~".contains(&b) {
out.push(b as char);
/// percent-encoded. A Windows path is made a URL as a path, not as text (#195: 0.1.8-rc8 wrote
/// file://localhostD%3A%5CWork%5C..., which Resolve refused): a drive's is file:///D:/Work/clip.mp4, the form Resolve
/// opened, and a share's file://nas/clips/clip.mp4, each with its separators as slashes and Windows' \\?\ prefix off.
pub(crate) fn pathurl(p: &Path) -> String {
let s = p.to_string_lossy();
let s = match (s.strip_prefix(r"\\?\UNC\"), s.strip_prefix(r"\\?\")) {
(Some(share), _) => format!(r"\\{share}"),
(None, Some(local)) => local.to_string(),
_ => s.into_owned(),
};
let b = s.as_bytes();
let drive = b.len() >= 3 && b[0].is_ascii_alphabetic() && b[1] == b':' && matches!(b[2], b'\\' | b'/');
let (mut out, rest, windows) = if drive {
(format!("file:///{}:", b[0] as char), &b[2..], true)
} else if let Some(share) = s.strip_prefix(r"\\") {
(String::from("file://"), share.as_bytes(), true)
} else {
(String::from("file://localhost"), b, false)
};
for &c in rest {
if windows && c == b'\\' {
out.push('/');
} else if c.is_ascii_alphanumeric() || b"/-_.~".contains(&c) {
out.push(c as char);
} else {
let _ = write!(out, "%{b:02X}");
let _ = write!(out, "%{c:02X}");
}
}
out
+2
View File
@@ -10,6 +10,8 @@ description = "A person's notes on a project as files the work is held to (docs/
# Note and Ask, the project found by its .raea/project, and the world a note is an entity in
raea-core-facts = { path = "../../core/facts" }
raea-io-home = { path = "../../io/home" }
# the H.264 encoder this machine's ffmpeg has, for a clip a person plays (raea_io_ffmpeg::h264)
raea-io-ffmpeg = { path = "../../io/ffmpeg" }
# when a run of an ask's check was (UTC), as raea check stamps its record
raea-io-trace = { path = "../../io/trace" }
# what each ask has been through, kept as JSON (state.rs)
+2 -1
View File
@@ -131,7 +131,8 @@ fn cut(out: &Path, [a, b]: [i64; 2], fps: f64, to: &Path) -> R<()> {
}
let (from, len) = (format!("{:.4}", a as f64 / fps), format!("{:.4}", (b - a) as f64 / fps));
let args = ["-hide_banner", "-loglevel", "error", "-y", "-ss", &from, "-i"];
let o = std::process::Command::new("ffmpeg").args(args).arg(out).args(["-t", &len, "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac"]).arg(to).output().map_err(|e| format!("ffmpeg: {e}"))?;
let h264 = raea_io_ffmpeg::h264().ok_or("ffmpeg here has no H.264 encoder (libx264, Windows' h264_mf or VideoToolbox's) to cut the clip with")?;
let o = std::process::Command::new("ffmpeg").args(args).arg(out).args(["-t", &len]).args(h264).args(["-c:a", "aac"]).arg(to).output().map_err(|e| format!("ffmpeg: {e}"))?;
if !o.status.success() {
return Err(format!("ffmpeg: {}", String::from_utf8_lossy(&o.stderr).trim()));
}
+2
View File
@@ -11,6 +11,8 @@ dunce = "1"
# the controller schema (core/brief controller.rs): a controller file is checked and normalized against it
raea-core-brief = { path = "../../core/brief" }
raea-io-home = { path = "../../io/home" }
# git, which a workspace is: the PATH's, else on Windows the app's or raea's own (raea_io_assets::git)
raea-io-assets = { path = "../../io/assets" }
serde_json = "1"
# a project's compositions, components and controllers read from their source (docs/projects.feature PJ8)
raea-app-registry = { path = "registry" }
+3 -3
View File
@@ -62,10 +62,10 @@ pub(crate) fn overrides(from: &Path) -> Vec<(String, String)> {
}
fn commit(ws: &Path, paths: &[&Path], what: &str, by: &str) -> R<()> {
let mut add = Command::new("git");
let mut add = Command::new(workspace::program());
add.arg("-C").arg(ws).args(["add", "-A", "--"]).args(paths);
add.status().map_err(|e| format!("git: {e}"))?;
let ok = workspace::git_cmd().arg("-C").arg(ws).args(["-c", &format!("user.name={by}"), "commit", "-q", "-m", &format!("{by}: {what}"), "--"]).args(paths).status().map_err(|e| format!("git: {e}"))?;
add.status().map_err(workspace::missing)?;
let ok = workspace::git_cmd().arg("-C").arg(ws).args(["-c", &format!("user.name={by}"), "commit", "-q", "-m", &format!("{by}: {what}"), "--"]).args(paths).status().map_err(workspace::missing)?;
if ok.success() { Ok(()) } else { Err(format!("couldn't commit {what}")) }
}
+26 -6
View File
@@ -13,7 +13,7 @@ const USAGE: &str = "usage: raea workspace [--json] | raea workspace init [NAME]
/// full name (a CI runner's, a container's) has no name either ("empty ident name ... not allowed"), and git has no
/// fallback below user.name to give it, so when no user.name is set the author and committer are named for the account.
pub(crate) fn git_cmd() -> Command {
let mut c = Command::new("git");
let mut c = Command::new(program());
let user = std::env::var("USER").unwrap_or_else(|_| "raea".into());
if std::env::var_os("EMAIL").is_none() {
c.env("EMAIL", format!("{user}@raea.local"));
@@ -24,14 +24,33 @@ pub(crate) fn git_cmd() -> Command {
c
}
/// The git raea runs (raea_io_assets::git: the PATH's, else on Windows the app's or raea's own, fetched once), found
/// once a process; "git" when there's none, its spawn then failing as `missing` says.
fn found() -> &'static Result<std::path::PathBuf, String> {
static GIT: std::sync::OnceLock<Result<std::path::PathBuf, String>> = std::sync::OnceLock::new();
GIT.get_or_init(raea_io_assets::git)
}
pub(crate) fn program() -> std::path::PathBuf {
found().clone().unwrap_or_else(|_| "git".into())
}
/// A git that didn't start, said as why: there's no git here (and how to get one), or what the system said
pub(crate) fn missing(e: std::io::Error) -> String {
match found() {
Err(why) if e.kind() == std::io::ErrorKind::NotFound => why.clone(),
_ => format!("git: {e}"),
}
}
/// Whether git has a user.name to sign commits with (asked once a process).
fn has_name() -> bool {
static HAS: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
*HAS.get_or_init(|| Command::new("git").args(["config", "--get", "user.name"]).output().is_ok_and(|o| o.status.success() && !o.stdout.trim_ascii().is_empty()))
*HAS.get_or_init(|| Command::new(program()).args(["config", "--get", "user.name"]).output().is_ok_and(|o| o.status.success() && !o.stdout.trim_ascii().is_empty()))
}
pub(crate) fn git(dir: &Path, args: &[&str]) -> R<String> {
let out = git_cmd().arg("-C").arg(dir).args(args).output().map_err(|e| format!("git: {e}"))?;
let out = git_cmd().arg("-C").arg(dir).args(args).output().map_err(missing)?;
if !out.status.success() {
return Err(format!("git {}: {}", args.join(" "), String::from_utf8_lossy(&out.stderr).trim()));
}
@@ -40,12 +59,12 @@ pub(crate) fn git(dir: &Path, args: &[&str]) -> R<String> {
/// `git config` on a file (or the global config when `file` is None), its output trimmed; Err when git says no.
pub(crate) fn config(file: Option<&Path>, args: &[&str]) -> R<String> {
let mut c = Command::new("git");
let mut c = Command::new(program());
c.arg("config");
if let Some(f) = file {
c.arg("-f").arg(f);
}
let out = c.args(args).output().map_err(|e| format!("git: {e}"))?;
let out = c.args(args).output().map_err(missing)?;
if !out.status.success() {
return Err(format!("git config {}: {}", args.join(" "), String::from_utf8_lossy(&out.stderr).trim()));
}
@@ -111,7 +130,8 @@ pub fn default_root(home: &Path) -> PathBuf {
if home.join("Library/Mobile Documents/com~apple~CloudDocs/Documents").is_dir() {
home.join("raea")
} else {
home.join("Documents/raea")
// a folder at a time: on Windows "Documents/raea" printed as C:\Users\you\Documents/raea\...
home.join("Documents").join("raea")
}
}
+7
View File
@@ -7,3 +7,10 @@ pub mod color;
pub mod easing;
pub mod interpolate;
pub mod spring;
/// 0 below `a`, 1 above `b`, and between them the cubic Hermite ease (WGSL's smoothstep), for a value that fades in
/// over a range rather than a key's time.
pub fn smoothstep(a: f32, b: f32, x: f32) -> f32 {
let t = ((x - a) / (b - a)).clamp(0.0, 1.0);
t * t * (3.0 - 2.0 * t)
}
+2
View File
@@ -176,6 +176,8 @@ the adopt-0.20 pass (2026-10-22); stills in that pass's report. Anything not lis
its formats), so a base colour would be averaged in gamma, not linear light; panels need premultiplied averages; and
CompressedImageSaver runs only in Bevy's asset processing (lossy BC7/ASTC through ctt), not on images loaded at run
time. Goes for baked assets once lightspeed's bake (F5) runs CompressedImageSaver; mip_chain stays for run-time images.
Its feature (compressed_image_saver) is out of the build since 0.1.8: ctt's AVX2 encoders run C++ initializers before
main on any CPU, so the bake has to bring it back without them (sdk/raea/docs/bevy-plugins.md).
- rt.rs (the traced-AO and passes' BLAS/TLAS) beside bevy_solari's scene layer. Solari's binder skips any mesh that
isn't u32-indexed with exactly position, normal, UV0 and tangent and `enable_raytracing` (raea's own shapes are
unindexed), and writes ray mask 0xFF on every instance (rt.rs's CASTS bit keeps NotShadowCaster stand-ins out of sun
+3 -4
View File
@@ -271,9 +271,8 @@ Used in: [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/rae
### `WearExtension`
raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension (systems/wear):
Bevy: `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>`.
raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension: a surface shader of
raea's own (worn.ts) on the hook a ShaderExtension uses, so its Bevy type is ShaderExtension's.
| Prop | Type | What it does |
| --- | --- | --- |
@@ -792,7 +791,7 @@ where density and heat come in: a burner, or an engine moving `at` -> `to` (a co
### `WearExtensionProps`
raea's extension of StandardMaterial that wears it (the engine's Wear MaterialExtension, systems/wear): its paint
raea's extension of StandardMaterial that wears it (a surface shader of raea's own, worn.ts): its paint
mottled, chipped back to `chip_color` on edges and a few spots, `grime` gathered low and underneath and `rust` run
down in streaks, fixed in the part's own space as it moves. `amount` 0-1; `chips`, `grime` and `rust` each 0-1 of it
(0.6, 0.5, 0.25); `scale` a blotch's size in metres (0.08); `seed` moves the pattern. It goes in an
+2 -2
View File
@@ -127,8 +127,8 @@ cargo build --release -p raea-cli # the binary is target/release/raea
| System | Status |
|---|---|
| macOS on Apple Silicon | Supported |
| Linux on x86_64 | Supported. raea needs ALSA and fontconfig (Ubuntu 24.04 and Debian: `apt install libasound2t64 libfontconfig1`; `libasound2` before 24.04). An app's window needs a display (X11, Wayland, or Xvfb on a server) |
| Windows 10 and 11 on x86_64 | Supported through `install.ps1` |
| Linux on x86_64 | Supported, on a processor with AVX (most from 2011 on) and glibc 2.39 or newer (Ubuntu 24.04, Debian 13, Fedora 40 and later). raea needs ALSA and fontconfig (Ubuntu 24.04 and Debian: `apt install libasound2t64 libfontconfig1`; `libasound2` before 24.04). An app's window needs a display (X11, Wayland, or Xvfb on a server) |
| Windows 10 and 11 on x86_64 | Supported through `install.ps1`, on any x86_64 processor |
| Intel Macs, Linux on ARM | Not yet |
raea draws on the GPU through Metal on the Mac, Vulkan on Linux, and DirectX 12 or Vulkan on Windows. Intel graphics
+35 -10
View File
@@ -1,7 +1,7 @@
---
title: "raea 0.1.8"
version: "0.1.8"
date: "2026-11-18"
date: "2026-11-19"
summary: "raea on Windows works: agents install and connect, phone and camera video plays, the local models set themselves up, and the installer asks where to go. Also your edit as layers for CapCut, Premiere and Resolve, labels on what agents show you, and a lighter app."
sources: ["https://github.com/shinyobjectz/raea/releases/tag/v0.1.8"]
---
@@ -24,8 +24,11 @@ On Windows, in PowerShell: `irm https://raea.io/install.ps1 | iex`.
## What changed since 0.1.7
**raea on Windows works.**
- ChatGPT, Claude, Gemini, OpenCode and Kimi install and connect on a Windows PC. A workspace is made even when Git
isn't installed.
- Nothing needs installing first, and nothing has to download. The app carries what raea needs from outside it:
Git, FFmpeg, uv (which sets up the local models) and Microsoft's Visual C++ runtime, so it works on a work PC
that blocks downloads. Before, raea.exe wouldn't start without the Visual C++ Redistributable, and a workspace
couldn't be made without Git.
- ChatGPT, Claude, Gemini, OpenCode and Kimi install and connect on a Windows PC.
- The app calls your PC a PC: Ctrl, not ⌘, everywhere, the whiteboard too.
- The installer asks where raea goes. It suggests a folder in your own profile, takes any empty folder you can
write to (or the folder raea is already in), and says why it won't use one that already holds other files. An update goes
@@ -35,14 +38,31 @@ On Windows, in PowerShell: `irm https://raea.io/install.ps1 | iex`.
(#155) and on Intel's integrated graphics. 3D on DirectX 12 is now drawn as on a Mac; with `WGPU_BACKEND=dx12`
set by hand, 0.1.7 drew a scene's shapes into one another.
- A phone's or a camera's video plays, probes and checks. raea's own decoders read H.264 without B-frames, which is
what raea writes. The first time you open a video they can't read (most phone and camera footage: H.264 with
B-frames, HEVC, VP9), raea fetches FFmpeg once, about 114 MB, and checks it before use. Nothing needs installing
first.
what raea writes, and the FFmpeg in the app reads the rest (most phone and camera footage: H.264 with B-frames,
HEVC, VP9). It's built from FFmpeg's own source with no GPL part (FFmpeg's code and libvpx's decoders, for
WebM with transparency), so its licence is the LGPL, and its source is published beside raea's releases. A clip
raea cuts for you to play, such as `raea notes check`'s, uses Windows' own H.264 encoder. With raea from the zip and no FFmpeg on the PC, raea fetches
the same build once and checks it before use.
- Agents' npm tools and MCP servers start without a shell, and their arguments arrive as written in folders with
spaces or letters outside ASCII.
- raea starts on a PC whose processor has no AVX2, such as an Intel Core from 2011 or 2012 (#110). The ONNX Runtime
raea linked was built for newer processors and stopped raea.exe before it did anything. raea now loads Microsoft's
own build when a model first runs, and it picks its code for the processor it finds.
- Workspaces work (#169). raea wrote Windows' `\\?\` form of a folder's path into a workspace's `.git/config`, so
every Git command in it failed and the app couldn't finish its first run, and a workspace's folder came out
doubled when `raea.root` wasn't set. On a PC whose only Git is the app's, or none at all, `raea workspace`,
`project` and `controller` use the app's Git or Git for Windows, or fetch raea's own once.
- The app no longer crashes at launch with a stack overflow (#112, #124). Its page host has the 8 MB stack it has on a
Mac, and turns a file's bytes into text a piece at a time.
- What your agent runs through raea understands Windows. `raea show` finds the app wherever the installer put it,
starts it, opens files in Explorer, and no longer says it opened them "in the Mac's own viewer". `raea init`,
`show`, `cut` and `brand` take `C:\` and `\\server\share` paths, which they used to treat as relative ones.
- Numbers, money and dates format on Windows and Linux. `toLocaleString` and `Intl` in a composition threw "Intl is
not defined" there; they now give the Mac's answers, in English and 40 other languages.
- `--quality master` keeps a dark background that changes slowly, such as a glow drifting over black, clean. It came
out blotchy before.
- raea starts on a PC whose processor has no AVX2, such as an Intel Core from 2011 or 2012 (#110), or no AVX at all,
such as a Celeron or Pentium from 2016 to 2019 or a Core from 2008 to 2010. Two things stopped raea.exe before it
did anything. The ONNX Runtime raea linked was built for newer processors: raea now loads Microsoft's own build when
a model first runs, and it picks its code for the processor it finds. And Bevy's texture compressors, which raea
never used, set up their AVX2 tables at start on every processor: they're no longer in raea.
**Local models with nothing installed first.** Stable Audio Open's sound effects, matchmove (`raea track`),
Gaussian splats (`raea splat train`), liquids and TokenSynth's instruments set themselves up on a Mac, Windows or
@@ -87,7 +107,10 @@ frame, on Windows too.
- raea/wear weathers a model by what weathers it. `wearBake` (and `raea wear bake`) works out once where rain
reaches and runs, where the sun falls, what people touch and how high each point stands over the street.
`wearShader` draws soot, stains, damp, rust, peeling paint and worn edges by material (plaster, brick, stone, wood,
iron and nine more), with the season's rain, snow, dust or leaves over them.
iron and nine more), with the season's rain, snow, dust or leaves over them. `WEAR_CONDITIONS` holds eight ready
ones, from spring's damp to a thunderstorm's soaking, and `weatherAt` changes the weather during a shot: a front
darkens over the minutes rain takes to soak it and dries over the hour after, snow settles and frost forms, and any
frame can be drawn alone. examples/materials/wear shows each condition by day and at dusk.
- `raea check` reads a video without FFmpeg. Where FFmpeg isn't installed, raea's own readers stand in, held to
FFmpeg's answers.
- `raea gen`: a fal step sends the resolution and aspect ratio its model takes, an image edit's mask reaches the
@@ -99,6 +122,8 @@ frame, on Windows too.
(MIT).
**Known**
- On Linux, raea needs a processor with AVX (most from 2011 on) and glibc 2.39 or newer (Ubuntu 24.04, Debian 13,
Fedora 40 and later).
- On Windows with Intel or AMD graphics, DirectX 12 compiles 3D shaders more slowly, so a 3D render can take
about 15 seconds longer to start.
- TokenSynth installs on Windows but hasn't been run end to end there yet, and it runs on the CPU there.
+3 -4
View File
@@ -14,7 +14,7 @@ reaches it yet).
| area | kind | tier 1 | tier 2 | tier 3 | not rendered | SVG attribute only | blocked upstream | excluded | unmapped | total |
|---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| bevy | asset | 9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
| bevy | component | 61 | 869 | 0 | 0 | 0 | 0 | 1 | 0 | 931 |
| bevy | component | 60 | 869 | 0 | 0 | 0 | 0 | 1 | 0 | 930 |
| bevy | event | 0 | 13 | 0 | 0 | 0 | 0 | 0 | 0 | 13 |
| bevy | message | 0 | 40 | 0 | 0 | 0 | 0 | 0 | 0 | 40 |
| bevy | resource | 4 | 86 | 0 | 0 | 0 | 0 | 1 | 0 | 91 |
@@ -23,9 +23,9 @@ reaches it yet).
| css | shorthand | 60 | 0 | 0 | 11 | 0 | 0 | 0 | 0 | 71 |
| element | html | 113 | 0 | 0 | 0 | 0 | 0 | 18 | 0 | 131 |
| plugin | declared | 0 | 0 | 53 | 0 | 0 | 21 | 0 | 3 | 77 |
| **all** | | **495** | **1009** | **53** | **55** | **14** | **21** | **21** | **3** | **1671** |
| **all** | | **494** | **1009** | **53** | **55** | **14** | **21** | **21** | **3** | **1670** |
Reached (tiers 1-3): **1557**. The ratchet (`tools/sdk-coverage --check`, in tools/agents/check) keeps it from dropping.
Reached (tiers 1-3): **1556**. The ratchet (`tools/sdk-coverage --check`, in tools/agents/check) keeps it from dropping.
## Bevy types (the plugin build's TypeRegistry)
@@ -624,7 +624,6 @@ Reached (tiers 1-3): **1557**. The ratchet (`tools/sdk-coverage --check`, in too
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_look::paint::Paint>>` | component | 2 | bevy.MeshMaterial3dExtendedMaterialStandardMaterialPaint (raea/plugins/bevy) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_material::toon::ToonExt>>` | component | 2 | bevy.MeshMaterial3dExtendedMaterialStandardMaterialToonExt (raea/plugins/bevy) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>>` | component | 1 | SurfaceShader (sdk/render/src/3d/materials.tsx) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>` | component | 1 | WearExtension (sdk/render/src/bevy3d/extensions.tsx) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial>` | component | 1 | Mesh3d (sdk/render/src/bevy3d/core.tsx) |
| `bevy_pbr::mesh_material::MeshMaterial3d<bevy_trenchbroom::special_textures::QuakeSkyMaterial>` | component | 2 | bevy.MeshMaterial3dQuakeSkyMaterial (raea/plugins/bevy) |
| `bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_fog::fire::FireMaterial>` | component | 2 | bevy.MeshMaterial3dFireMaterial (raea/plugins/bevy) |
-1
View File
@@ -593,7 +593,6 @@ bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMat
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
1 # The plugin build's TypeRegistry: every component, resource, event, message, state and asset (tools/sdk-coverage --registry)
593 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_look::paint::Paint>>
594 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_material::toon::ToonExt>>
595 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>>
bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>
596 bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial>
597 bevy_pbr::mesh_material::MeshMaterial3d<bevy_trenchbroom::special_textures::QuakeSkyMaterial>
598 bevy_pbr::mesh_material::MeshMaterial3d<raea_sys_fog::fire::FireMaterial>
+53 -4
View File
@@ -5,7 +5,7 @@ Feature: raea/wear, weathering that has a cause
version, "realistic procedural and highly intelligent seeding ... for what makes sense on wear, wear by material,
crumbling infrastructure, doors, walls, plates", and the same for how textures are built and made cheap.
raea's wear so far is shader-only (systems/wear: noise, screen-space curvature, grime on faces turned down;
raea's wear was shader-only (systems/wear: noise, screen-space curvature, grime on faces turned down;
systems/procmat: a pattern with dust, dirt and edges). Nothing in it knows where water runs, what is sheltered, where
hands touch or what a surface is made of, so the marks are scattered evenly rather than caused. The fix is the
method of the literature: the agents of wear are traced through the geometry from their sources, and they leave
@@ -246,14 +246,28 @@ Feature: raea/wear, weathering that has a cause
faded, the railing rusted; rain, snow with a storm and autumn render; an unbaked sphere under the same shader is
unchanged. The corner house with stills of every cause and condition is WR7's
@needs:WR5,WR3
@needs:WR5,WR3 @done
Scenario: WR6. Crumbling
Then where damage is high (ground band, edges, sheltered damp, neglect), plaster is gone to the brick 2 cm behind
it under a shadowed lip, paint to primer and wood, enamel to iron; cracks run from the corners of openings;
panes are broken or boarded by neglect; slates are missing; and spots.json puts debris under the losses
And the cracked-road fracture of the kit waits for a piece that needs it
And as built (11-19)
| crate | file | lines | job |
| raea-sys-damage | systems/damage/src/lib.rs | 241 | an opening's corners, a crack from about half of them (by a seed per corner), each point's loss potential (damp foot, soaked faces, knocked arrises, along a crack), debris under the losses where the rain falls, landed on the walk below; version 3 |
| raea-sys-damage | systems/damage/src/tests.rs | 190 | an opening's four corners and no others, cracks along the wall, what loosens a coat, debris under the foot (none indoors, none on a plinth), about half the corners cracking |
| raea-sys-weathering | src/lib.rs, rays.rs, touch.rs | +33 | causes3 a's crack, the loss potential and the debris spots from raea-sys-damage |
| raea-sys-touch | src/lib.rs, spots.rs | +18 | a spot's loss, the seed shared with damage |
| raea/wear | sdk/wear/src/causes.ts | 159 | neglect = (1 - e^(-years / 25)) x (1.15 - upkeep); abandon, the share of a house past what a lived-in one lets go (smoothstep from 0.85 of neglect at its base upkeep) |
| raea/wear | sdk/wear/src/recipes.ts | 303 | plaster off to the brick under its lip, paint to primer and wood, enamel flaked to iron, cracks opening by neglect (stepped through brick's joints), panes broken (38%) and boarded (16%) by abandon, slates gone by neglect and abandon |
| raea/wear | sdk/wear/src/index.ts | 257 | wearDebris: the bake's debris spots where loss x abandon reaches 0.3 |
And proof: `cargo test -p raea-sys-damage` (5 tests) and `-p raea-sys-weathering`; `bun test` in sdk/wear (22
tests: neglect and upkeep, abandonment's threshold in the shader's text, debris none at upkeep 0.35, all at 90
years and 0.05, some at 80 and 0.2); the corner house (WR7) rendered after 80 years and as a ruin: plaster off
the rusticated foot and around the openings, cracks from the window corners, the ruin's panes broken and
boarded and slates gone, heaps on the walk under the losses and none inside or on the plinth
@needs:WR5
@needs:WR5 @done
Scenario: WR9. Every season and weather, from uniforms over the causes
Given the look's date and weather, the values the realism lane's sets carry: `day` (the day of the year, 1-366)
and `hour`, from which the season's phase (day / 365.25) and the sun follow; snow, wet and ice as weather of
@@ -297,10 +311,18 @@ Feature: raea/wear, weathering that has a cause
posted as i-acp-mwlb9fb4-110
And still open: the mapping from the look's `day` and weather to these values is WR5's (the prototype takes
storm, leaves, dust and melt as values of their own); frost and algae; the flash of thunder is the light's
And the shader's half as built (11-19): the eight conditions are WR5's recipes over these causes (spring's damp
and algae, summer's dust, autumn's leaves, frost where December's sun misses, snow lying and driven, rain
wetting, streaming and puddling), named once, and weather that changes during a shot eases toward the sky's
| crate | file | lines | job |
| raea/wear | sdk/wear/src/weather.ts | 79 | WEAR_CONDITIONS (the eight as weather), weatherAt(base, spells, minutes): each value eased exactly toward the sky's per spell, so any frame draws alone; WEATHER_RATES (wetting in about 3 minutes, drying over an hour, snow settling over 20 and melting over 2 hours, driven snow in 10 and off in 30, frost over 30 and gone in 20; ASSUMED until measured) |
| raea/wear | sdk/wear/test/wear.test.ts | 216 | rain soaks and dries at its rates, frames stand alone with no jump at a spell, snow, storm and frost, spells out of order refused, each condition in its season |
And proof: `bun test` in sdk/wear; the corner house under all eight by day and at dusk, and a shower crossing it
(WR7's rain-passes: dry, soaked and drying at frames 0, 40 and 119)
Rule: 3. Shown, then cheap
@needs:WR5
@needs:WR5 @done
Scenario: WR7. The demo, and EX9
Then examples/materials/wear/ is a corner house made in code (plinth, rusticated ground floor, plastered storeys,
sills, string course, cornice on consoles, door, iron balcony, zinc gutter and downpipe, an enamel street
@@ -308,6 +330,22 @@ Feature: raea/wear, weathering that has a cause
colour and the house under each of WR9's eight conditions, by day and at dusk
And `wear` on MeshStandardMaterial and <WearExtension> are raea/wear's, and systems/wear, its spawn branch and
its row columns are deleted in the same landing (docs/examples.feature EX9)
And as built (11-19)
| crate | file | lines | job |
| example | examples/materials/wear/house.ts | 260 | the corner house as solids (each 8 corners), a hip roof, openings cut through each band, one .glb material per class |
| example | examples/materials/wear/make-house.ts | 11 | writes media/house.glb |
| example | examples/materials/wear/wear.tsx | 179 | before, new, after (80 sooty years), ruin, ruin-near, door; debug-CAUSE for all 16; the eight conditions and their -dusk; rain-passes (120 frames, half a minute each); paint (worn paint with no bake) |
| example | examples/materials/wear/wear.test.ts | 85 | every part WR7 names, the openings through the walls, the .glb, every cause and condition listed, the paint still |
| raea/render | sdk/render/src/worn.ts | 119 | worn paint as a surface shader on the public hook (WORN_WESL, wornShader): systems/wear's shader ported, same noise, curvature edges, grime, rust and chips in the mesh's own space |
| raea/render | sdk/render/src/3d/materials.tsx | +12 | a material's `wear` becomes that shader (none at amount 0; refused beside `shader` or `grid`) |
| deleted | systems/wear, spawn.rs, raea_plugins.rs, runtime/scene parts.rs | -480 | raea-sys-wear, its WearPlugin, spawn branch and row columns; its type out of the registry snapshot, bevy.gen.tsx and sdk-coverage |
And worn paint's shader lives in raea/render beside the material that takes it, not in raea/wear: raea/wear is
built on raea/render, so the other way would be a cycle. <WearExtension> and `wear` keep their props, and the
guides are unchanged
And proof: `bun test` in examples/materials/wear (7 tests) and conformance bevy3d.test.tsx (wear's shader, its
uniforms, none at amount 0, alone); a parity scene of worn paint (sharp, turned and round parts, every setting)
rendered through systems/wear and through worn.ts matches (RMSE 3.8e-5 of full scale); every still, and
rain-passes at frames 0, 40 and 119, render with 0 errors on the Mac. Clay now draws worn paint as it draws any custom surface shader
@needs:WR7
Scenario: WR8. Detail textures from mask stacks, and what they cost
@@ -315,3 +353,14 @@ Feature: raea/wear, weathering that has a cause
rendered by raea once into tiling layers, instead of noise evaluated per pixel per frame
And texture arrays get mips (SH9 arrays have none, so a tiling layer shimmers far off) and maps can be BC
compressed into KTX2, with the memory and frame time each saves measured
And measured first (11-19, M5 Pro, the corner house at 4K, 121-127 frames each, plain and worn interleaved): with
the machine quiet, 17.2 ms a frame plain and 17.2 worn, 17.6 and 17.7; under other sessions' load both rise
together (18-75 ms). The recipes' per-pixel noise costs no frame time a render can see, so detail layers
would save nothing yet; a live scene at 60 fps with many baked buildings is where to measure again
And the maps' memory: four RGBA8 maps of 2048 x 1108 for the house, 36 MB on the GPU; BC7 would take that to
about 9 MB, but causes2's alpha is the class code read exactly by textureLoad (it needs a map of its own
before the rest compress), and an iPhone has no BC (ASTC there). Worth it for a city of baked buildings, not
one house
And still open, so not done: the detail layers, mips on arrays (they come with the detail layers: adding them
now would grow the city's 40-layer room atlas by a third for no wear user), and BC/KTX2 maps with the class
split out and a fallback where BC isn't
+1 -1
View File
@@ -74,7 +74,7 @@ aseprite = ["dep:bevy_aseprite_ultra"]
asset_loader = ["dep:bevy_asset_loader"]
avian = ["dep:avian3d"]
avian2d = ["dep:avian2d"]
bevy = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/compressed_image_saver", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools", "dep:symphonia"]
bevy = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools", "dep:symphonia"]
big_space = ["dep:big_space"]
common_assets = ["dep:bevy_common_assets"]
console = ["dep:bevy_console", "raea-bevy-calls/console", "egui"]
+190
View File
@@ -0,0 +1,190 @@
// `raea show` and its app on a Mac, Windows and Linux (src/app.ts), each system faked (a Here): where the running
// app's host is, which app is installed, how files open without it, how it's started, and the harness found up the
// processes. #169: on Windows `raea show` asked `kill` whether the app ran, looked only in /Applications, and said
// it had opened the files "in the Mac's own viewer".
import { afterAll, describe, expect, test } from "bun:test";
import { appHost, computer, harness, installedApp, openFiles, show, type Here } from "../src/app";
import { pixelsOf } from "../src/brand";
import { absolute, fromCwd } from "../src/show";
const WIN_KEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\raea";
/** A system: `platform`, its files (path → text), and its programs' answers; every run is kept in `ran`. */
function here(platform: string, files: Record<string, string> = {}, answer: (cmd: string, args: string[]) => { status?: number; stdout?: string } = () => ({})) {
const ran: string[][] = [];
const h: Here & { ran: string[][] } = {
platform,
ran,
run: (cmd, args) => {
ran.push([cmd, ...args]);
const a = answer(cmd, args);
return { status: a.status ?? 0, stdout: a.stdout ?? "" };
},
exists: (p) => p in files,
read: (p) => {
if (!(p in files)) throw new Error(`ENOENT ${p}`);
return files[p];
},
env: { RAEA_NO_OPEN: undefined },
home: platform === "win32" ? "C:/Users/me" : "/home/you",
};
return h;
}
// the app's host, as the window's (apps/app host/show.ts): an item's link for a show, and /host/shown to say it finds it.
// Its own process: show() posts with a synchronous curl, which a server in this one couldn't answer
const host = Bun.spawn(["bun", "-e", `const s = Bun.serve({ port: 0, fetch: (r) => { const p = new URL(r.url).pathname; return p === "/host/show" ? Response.json({ url: "raea://item/7" }) : p === "/host/shown" ? Response.json({}) : new Response("not found", { status: 404 }); } }); console.log(s.port);`], { stdout: "pipe" });
afterAll(() => host.kill());
/** its first line: the port it listens on */
async function portOf(out: ReadableStream<Uint8Array>) {
const r = out.getReader();
let text = "";
while (!text.includes("\n")) {
const { value, done } = await r.read();
if (done) throw new Error(`the test's host stopped before it listened: ${text}`);
text += new TextDecoder().decode(value);
}
r.releaseLock();
return Number(text.trim());
}
const HOST = `http://127.0.0.1:${await portOf(host.stdout)}`;
describe("the running app's host", () => {
test("on Windows, its pid is asked of tasklist (Windows has no kill)", () => {
const file = { "C:/Users/me/.raea/app-host.json": JSON.stringify({ url: HOST, pid: 4321 }) };
const up = here("win32", file, (cmd, args) => (cmd === "tasklist" && args.includes("PID eq 4321") ? { stdout: '"raea.exe","4321","Console","1","80,000 K"\r\n' } : {}));
expect(appHost(up)).toBe(HOST);
expect(up.ran.some(([c]) => c === "kill")).toBe(false);
// a file a stopped app left: tasklist finds no such process ("INFO: No tasks are running...")
const gone = here("win32", file, () => ({ stdout: "INFO: No tasks are running which match the specified criteria.\r\n" }));
expect(appHost(gone)).toBeNull();
});
test("on a Mac or Linux, kill -0", () => {
const file = { "/home/you/.raea/app-host.json": JSON.stringify({ url: HOST, pid: 99 }) };
expect(appHost(here("linux", file, (cmd) => ({ status: cmd === "kill" ? 0 : 1 })))).toBe(HOST);
expect(appHost(here("linux", file, (cmd) => ({ status: cmd === "kill" ? 1 : 0 })))).toBeNull();
});
});
describe("the installed app", () => {
test("on Windows, raea.exe in the folder its installer was given (Settings > Apps keeps it)", () => {
const reg = `\r\nHKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\raea\r\n InstallLocation REG_SZ D:\\Apps\\raea\r\n\r\n`;
const up = here("win32", { "D:\\Apps\\raea\\raea.exe": "" }, (cmd, args) => (cmd === "reg" && args[1] === WIN_KEY ? { stdout: reg } : {}));
expect(installedApp(up)).toBe("D:\\Apps\\raea\\raea.exe");
});
test("on Windows with no InstallLocation, the default folder", () => {
const up = here("win32", { "C:\\Users\\me\\AppData\\Local\\Programs\\raea\\raea.exe": "" }, () => ({ status: 1 }));
up.env.LOCALAPPDATA = "C:\\Users\\me\\AppData\\Local";
expect(installedApp(up)).toBe("C:\\Users\\me\\AppData\\Local\\Programs\\raea\\raea.exe");
});
test("on a Mac, raea.app in Applications; on Linux, the launcher raea.desktop runs", () => {
expect(installedApp(here("darwin", { "/Applications/raea.app": "" }))).toBe("/Applications/raea.app");
const desktop = "[Desktop Entry]\nName=raea\nExec=\"/home/you/.local/share/raea-app/launch.sh\"\n";
expect(installedApp(here("linux", { "/home/you/.local/share/applications/raea.desktop": desktop, "/home/you/.local/share/raea-app/launch.sh": "" }))).toBe("/home/you/.local/share/raea-app/launch.sh");
expect(installedApp(here("linux"))).toBeUndefined();
});
});
describe("raea show without the app", () => {
test("on Windows, each file opens in Windows' own viewer through Explorer, its path in Windows' slashes", () => {
const up = here("win32", {}, () => ({ status: 1 }));
const r = show({ files: ["C:/Users/me/cut & keep/a.mp4", "C:/Users/me/b.png"] }, up) as { opened: string[]; viewer: string };
expect(r.viewer).toBe("Windows' own viewer");
expect(up.ran.filter(([c]) => c === "explorer.exe")).toEqual([["explorer.exe", "C:\\Users\\me\\cut & keep\\a.mp4"], ["explorer.exe", "C:\\Users\\me\\b.png"]]);
expect(up.ran.some(([c]) => c === "open")).toBe(false);
});
test("a question needs the app, said for the system it runs on", () => {
expect(() => show({ files: [], question: "Which?" }, here("win32", {}, () => ({ status: 1 })))).toThrow("isn't on this PC");
expect(() => show({ files: [], question: "Which?" }, here("darwin"))).toThrow("isn't on this Mac");
expect(computer(here("linux")).name).toBe("this computer");
});
test("on Linux, xdg-open", () => {
const up = here("linux");
openFiles(["/home/you/a.mp4"], up);
expect(up.ran).toEqual([["xdg-open", "/home/you/a.mp4"]]);
});
});
describe("raea show starting the app", () => {
test("on Windows: raea.exe started through Explorer, its host waited for, the item posted, no raea:// link", () => {
const files: Record<string, string> = { "C:\\Users\\me\\AppData\\Local\\Programs\\raea\\raea.exe": "" };
const up = here("win32", files, (cmd, args) => {
// the app, once started, writes its host's address
if (cmd === "explorer.exe" && args[0].endsWith("raea.exe")) files["C:/Users/me/.raea/app-host.json"] = JSON.stringify({ url: HOST, pid: 77 });
if (cmd === "tasklist") return { stdout: '"raea.exe","77","Console","1","1 K"' };
return { status: cmd === "reg" ? 1 : 0 };
});
up.env.LOCALAPPDATA = "C:\\Users\\me\\AppData\\Local";
const r = show({ files: ["C:/Users/me/a.mp4"] }, up) as { url: string; brought: boolean };
expect(r).toEqual({ url: "raea://item/7", brought: false });
expect(up.ran.some(([c]) => c === "open" || c === "pgrep")).toBe(false);
});
test("on a Mac: open -a, and the window brought up on the item it was started for", () => {
const files: Record<string, string> = { "/Applications/raea.app": "" };
const up = here("darwin", files, (cmd, args) => {
if (cmd === "open" && args[0] === "-a") files["/home/you/.raea/app-host.json"] = JSON.stringify({ url: HOST, pid: 77 });
return { status: cmd === "pgrep" ? 1 : 0 };
});
expect(show({ files: ["/tmp/a.mp4"] }, up)).toEqual({ url: "raea://item/7", brought: true });
expect(up.ran.at(-1)).toEqual(["open", "raea://item/7"]);
});
});
describe("the harness that ran raea show", () => {
test("on Windows, found up every process's record from one PowerShell call, claude.exe as claude", () => {
const list = [`${process.pid}\t500\t"C:\\Users\\me\\raea\\bin\\raea.exe" show a.mp4`, `500\t400\t"C:\\Users\\me\\.local\\bin\\claude.exe" --resume`, `400\t1\tC:\\Windows\\explorer.exe`].join("\r\n");
const up = here("win32", {}, (cmd) => (cmd === "powershell" ? { stdout: list } : { status: 1 }));
expect(harness(up)).toEqual({ name: "Claude Code", pid: 500 });
expect(up.ran.filter(([c]) => c === "powershell")).toHaveLength(1);
});
test("a runtime's script by its name, the quoted path's spaces kept", () => {
const list = [`${process.pid}\t600\traea.exe show`, `600\t1\t"C:\\Program Files\\nodejs\\node.exe" C:\\Users\\me\\AppData\\Roaming\\npm\\gemini.cmd`].join("\n");
expect(harness(here("win32", {}, () => ({ stdout: list })))).toEqual({ name: "Gemini", pid: 600 });
});
test("on a Mac or Linux, ps up from the parent", () => {
const up = here("linux", {}, (cmd, args) => (cmd === "ps" && args.at(-1) === String(process.ppid) ? { stdout: " 1 /usr/local/bin/codex exec" } : { stdout: "" }));
expect(harness(up)).toEqual({ name: "Codex", pid: process.ppid });
});
});
describe("a path from the cwd", () => {
test("a Windows one is absolute, with either slash, a share's too", () => {
for (const p of ["C:\\Users\\me\\a.mp4", "c:/x", "\\\\nas\\clips\\a.mp4", "\\x", "/x"]) expect(absolute(p)).toBe(true);
for (const p of ["a.mp4", "cuts\\a.mp4", "C:a.mp4", "./a"]) expect(absolute(p)).toBe(false);
expect(fromCwd("C:/Users/me/proj", "D:\\clips\\a.mp4")).toBe("D:\\clips\\a.mp4");
expect(fromCwd("C:/Users/me/proj/", "out\\a.png")).toBe("C:/Users/me/proj/out\\a.png");
expect(fromCwd("/home/you", "a.png")).toBe("/home/you/a.png");
});
});
describe("a logo's pixels, on any system", () => {
// until 0.1.8 asked of sips, a Mac's: on Windows and Linux every raster logo in brand.json had no size. Each is the
// head of a 37x23 image from a real encoder (ffmpeg's PNG, GIF and ICO; cwebp's lossy and lossless; Pillow's WebP with
// alpha, VP8X; sips's JPEG, an Exif and a Photoshop block before its frame; ImageMagick's progressive JPEG)
const HEADS: Record<string, string> = {
png: "iVBORw0KGgoAAAANSUhEUgAAACUAAAAX",
gif: "R0lGODlhJQAXAA==",
"webp lossy": "UklGRiACAABXRUJQVlA4IBQCAAAwDwCdASolABcA",
"webp lossless": "UklGRrIAAABXRUJQVlA4TKUAAAAvJIAF",
"webp with alpha": "UklGRkwCAABXRUJQVlA4IEACAABQDwCdASolABcA",
ico: "AAABAAEAJRc=",
jpeg: "/9j/4AAQSkZJRgABAQAASABIAAD/4QBMRXhpZgAATU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAJaADAAQAAAABAAAAFwAAAAD/7QA4UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/8AAEQgAFwAlAw==",
"jpeg progressive": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wgARCAAXACUD",
};
for (const [kind, head] of Object.entries(HEADS)) {
test(kind, () => expect(pixelsOf(Buffer.from(head, "base64"))).toEqual({ width: 37, height: 23 }));
}
test("anything else, or a header cut short, has none", () => {
expect(pixelsOf(new TextEncoder().encode("II*\0 a TIFF"))).toBeUndefined();
expect(pixelsOf(Buffer.from(HEADS.png, "base64").subarray(0, 18))).toBeUndefined();
expect(pixelsOf(new Uint8Array())).toBeUndefined();
});
});
+134 -28
View File
@@ -1,25 +1,104 @@
// The raea app's host, as the native `raea` reaches it (native.ts): where the running app listens, and the verbs that
// post to it: `raea show` (and its --on tasks), `raea library`, and the agent harness a show names as its poster.
// post to it: `raea show` (and its --on tasks), `raea library`, and the agent harness a show names as its poster. On a
// Mac, Windows or Linux (#169: on Windows `raea show` never found the running app, since it asked `kill`, and said it
// had opened the files "in the Mac's own viewer", which it hadn't).
import { spawnSync } from "node:child_process";
import { existsSync, readFileSync } from "node:fs";
import { homedir } from "node:os";
import { basename } from "node:path";
import { HARNESSES } from "./show";
/** What these verbs ask of the computer they run on (a test gives its own: conformance/app.test.ts). */
export interface Here {
platform: string;
run: (cmd: string, args: string[]) => { status: number | null; stdout: string };
exists: (path: string) => boolean;
read: (path: string) => string;
env: Record<string, string | undefined>;
home: string;
}
export const HERE: Here = {
platform: process.platform,
run: (cmd, args) => {
const r = spawnSync(cmd, args, { encoding: "utf8" });
return { status: r.status, stdout: r.stdout ?? "" };
},
exists: existsSync,
read: (p) => readFileSync(p, "utf8"),
env: process.env,
home: homedir(),
};
/** This computer as raea names it, and the viewer files open in without the app. */
export function computer(h: Here = HERE): { name: string; viewer: string } {
if (h.platform === "darwin") return { name: "this Mac", viewer: "the Mac's own viewer" };
if (h.platform === "win32") return { name: "this PC", viewer: "Windows' own viewer" };
return { name: "this computer", viewer: "the desktop's own viewer" };
}
/** Whether process `pid` is running: `kill -0`, or on Windows (which has no kill) tasklist. */
function alive(pid: number, h: Here): boolean {
if (h.platform !== "win32") return h.run("kill", ["-0", String(pid)]).status === 0;
return h.run("tasklist", ["/FI", `PID eq ${pid}`, "/NH", "/FO", "CSV"]).stdout.includes(`"${pid}"`);
}
/** The running raea app's host: RAEA_FEED_HOST for an agent the app started, else the address the installed app leaves
* in ~/.raea/app-host.json while it runs (apps/app host/host-file.ts), if its process is still there. */
function appHost(): string | null {
if (process.env.RAEA_FEED_HOST) return process.env.RAEA_FEED_HOST;
const file = process.env.RAEA_HOST_FILE || `${homedir()}/.raea/app-host.json`;
export function appHost(h: Here = HERE): string | null {
if (h.env.RAEA_FEED_HOST) return h.env.RAEA_FEED_HOST;
const file = h.env.RAEA_HOST_FILE || `${h.home}/.raea/app-host.json`;
try {
const h = JSON.parse(readFileSync(file, "utf8")) as { url?: string; pid?: number };
if (h.url && h.pid && spawnSync("kill", ["-0", String(h.pid)]).status === 0) return h.url;
const x = JSON.parse(h.read(file)) as { url?: string; pid?: number };
if (x.url && x.pid && alive(x.pid, h)) return x.url;
} catch {
// no app running, or a file left by one that stopped
}
return null;
}
/** The installed raea app, RAEA_APP first: on a Mac raea.app in Applications; on Windows raea.exe in the folder its
* installer put it in (the person picks it, #178; Settings > Apps keeps it as InstallLocation), else the default; on
* Linux the launch.sh that linux/install.sh's raea.desktop runs. */
export function installedApp(h: Here = HERE): string | undefined {
const at: (string | undefined)[] = [h.env.RAEA_APP];
if (h.platform === "darwin") at.push("/Applications/raea.app", `${h.home}/Applications/raea.app`);
else if (h.platform === "win32") {
const q = h.run("reg", ["query", "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\raea", "/v", "InstallLocation"]).stdout;
const dir = /InstallLocation\s+REG_\w+\s+(.+?)\s*$/m.exec(q)?.[1];
if (dir) at.push(`${dir.replace(/[\\/]$/, "")}\\raea.exe`);
if (h.env.LOCALAPPDATA) at.push(`${h.env.LOCALAPPDATA}\\Programs\\raea\\raea.exe`);
} else {
try {
const entry = h.read(`${h.env.XDG_DATA_HOME || `${h.home}/.local/share`}/applications/raea.desktop`);
at.push(/^Exec="?([^"\n]+?)"?\s*$/m.exec(entry)?.[1]);
} catch {
// not in the desktop's app list
}
}
return at.find((p) => p && h.exists(p));
}
/** Files opened as the system opens them (a double-click's app): open, Windows' Explorer, xdg-open. */
export function openFiles(files: string[], h: Here = HERE) {
if (h.platform === "darwin") h.run("open", files);
// Explorer, not cmd's start: start reads its line as cmd does, so a folder named with & or ^ breaks it
else if (h.platform === "win32") for (const f of files) h.run("explorer.exe", [f.replace(/\//g, "\\")]);
else for (const f of files) h.run("xdg-open", [f]);
}
/** The installed app started: open -a on a Mac, Explorer on Windows, its launch.sh in the background on Linux. */
export function startApp(app: string, h: Here = HERE) {
if (h.platform === "darwin") h.run("open", ["-a", app]);
else if (h.platform === "win32") h.run("explorer.exe", [app]);
else h.run("sh", ["-c", 'nohup "$0" >/dev/null 2>&1 &', app]);
}
/** A quarter of a second between looks for the app's host (Windows has no sleep command: PowerShell's). */
function pause(h: Here) {
if (h.platform === "win32") h.run("powershell", ["-NoProfile", "-Command", "Start-Sleep -Milliseconds 250"]);
else h.run("/bin/sleep", ["0.25"]);
}
/** POST a host route of the raea app at `at`, answering its JSON; its refusal is thrown as it says it. */
function postHost(at: string, route: string, a: Record<string, unknown>): any {
const r = spawnSync("curl", ["-sS", "--max-time", "120", "-w", "\n%{http_code}", "-H", "content-type: application/json", "--data-binary", "@-", `${at.replace(/\/$/, "")}${route}`], { input: JSON.stringify(a), encoding: "utf8", maxBuffer: 64 << 20 });
@@ -33,24 +112,26 @@ function postHost(at: string, route: string, a: Record<string, unknown>): any {
/** `raea show` (show.ts): the item made by the raea app's host (apps/app host/show.ts), the app started first when it's
* installed and not running. The window is brought up on it by its raea:// link only with --open or when the app was
* just started; otherwise the page finds it and says so. Without the app, the files open in the Mac's own viewer. */
export function show(a: Record<string, unknown>): unknown {
let at = appHost();
* just started (on a Mac or Linux: Windows' app has no raea:// link, so there the post lands as its notice); otherwise
* the page finds it and says so. Without the app, the files open in the system's own viewer. */
export function show(a: Record<string, unknown>, h: Here = HERE): unknown {
let at = appHost(h);
let launched = false;
if (!at) {
const app = [process.env.RAEA_APP, "/Applications/raea.app", `${homedir()}/Applications/raea.app`].find((p) => p && existsSync(p));
const app = installedApp(h);
const files = (a.files as string[]) ?? [];
if (!app) {
if (a.question || a.questions) throw new Error("a question needs the raea app, and it isn't on this Mac (raea.io)");
spawnSync("open", files);
return { opened: files };
if (a.question || a.questions) throw new Error(`a question needs the raea app, and it isn't on ${computer(h).name} (raea.io)`);
openFiles(files, h);
return { opened: files, ...computer(h) };
}
if (spawnSync("pgrep", ["-f", `${app}/Contents/MacOS/raea-window`]).status === 0)
if (h.platform === "darwin" && h.run("pgrep", ["-f", `${app}/Contents/MacOS/raea-window`]).status === 0)
throw new Error("the raea app running here is older than raea show (it leaves no ~/.raea/app-host.json); quit it and open it again to update, then show it again");
spawnSync("open", ["-a", app]);
startApp(app, h);
launched = true;
// the window's host writes its address once it listens: a minute at most, in quarter seconds
for (let i = 0; i < 240 && !(at = appHost()); i++) spawnSync("/bin/sleep", ["0.25"]);
// the window's host writes its address once it listens: a minute at most
const until = Date.now() + 60_000;
while (!(at = appHost(h)) && Date.now() < until) pause(h);
if (!at) throw new Error(`the raea app didn't start (no ~/.raea/app-host.json after a minute); open ${app} and show it again`);
}
let shown: { url: string };
@@ -72,23 +153,48 @@ export function show(a: Record<string, unknown>): unknown {
return false;
}
})();
const brought = !process.env.RAEA_NO_OPEN && (a.open === true || launched || !finds);
if (brought) spawnSync("open", [shown.url]);
const brought = !h.env.RAEA_NO_OPEN && h.platform !== "win32" && (a.open === true || launched || !finds);
if (brought) h.run(h.platform === "darwin" ? "open" : "xdg-open", [shown.url]);
return { ...shown, brought };
}
/** A process's parent and command line: ps, or on Windows every process's at once from PowerShell (one call, not one
* per step up: each takes a good part of a second there). */
function processes(h: Here): { start: number; of: (pid: number) => { ppid: number; args: string } | undefined } {
if (h.platform !== "win32") {
return {
start: process.ppid,
of: (pid) => {
const m = /^\s*(\d+)\s+(.*)$/.exec(h.run("ps", ["-o", "ppid=,args=", "-p", String(pid)]).stdout);
return m ? { ppid: Number(m[1]), args: m[2] } : undefined;
},
};
}
const all = new Map<number, { ppid: number; args: string }>();
const list = h.run("powershell", ["-NoProfile", "-NonInteractive", "-Command", "Get-CimInstance Win32_Process | ForEach-Object { '{0}`t{1}`t{2}' -f $_.ProcessId, $_.ParentProcessId, $_.CommandLine }"]).stdout;
for (const line of list.split(/\r?\n/)) {
const [pid, ppid, ...args] = line.split("\t");
if (Number(pid) > 0) all.set(Number(pid), { ppid: Number(ppid), args: args.join("\t") });
}
return { start: all.get(process.pid)?.ppid ?? 0, of: (pid) => all.get(pid) };
}
/** The agent harness that started this command (show.ts HARNESSES), found up its parent processes: a program's own
* name, or the script a runtime runs (`node .../gemini`). Nothing when no harness is up there. */
export function harness(): { name: string; pid: number } | undefined {
let pid = process.ppid;
* name (claude, or on Windows claude.exe), or the script a runtime runs (`node .../gemini`). Nothing when no harness
* is up there. (Until 0.1.8 raea's engine had no process.ppid, so this found none anywhere.) */
export function harness(h: Here = HERE): { name: string; pid: number } | undefined {
const up = processes(h);
let pid = up.start;
for (let i = 0; i < 16 && pid > 1; i++) {
const m = /^\s*(\d+)\s+(.*)$/.exec(spawnSync("ps", ["-o", "ppid=,args=", "-p", String(pid)], { encoding: "utf8" }).stdout ?? "");
if (!m) return undefined;
for (const w of m[2].split(/\s+/).slice(0, 2).map((w) => basename(w).toLowerCase())) {
const p = up.of(pid);
if (!p) return undefined;
// a Windows command line quotes a path with spaces in it: "C:\Program Files\nodejs\node.exe" ...
const words = (p.args.match(/"[^"]*"|\S+/g) ?? []).slice(0, 2).map((w) => w.replace(/^"|"$/g, ""));
for (const w of words.map((w) => w.split(/[\\/]/).pop()!.toLowerCase().replace(/\.(exe|cmd|bat|ps1)$/, ""))) {
const hit = HARNESSES.find(([re]) => re.test(w));
if (hit) return { name: hit[1], pid };
}
pid = Number(m[1]);
pid = p.ppid;
}
return undefined;
}
@@ -109,7 +215,7 @@ export function task(a: Record<string, unknown>): unknown {
/** An op of the feed host's libraries (apps/app host/library/service.ts): POST <the app's host>/host/library. */
export function library(a: Record<string, unknown>): unknown {
const at = appHost();
if (!at) throw new Error("libraries live in the raea app: open it on this Mac (or set RAEA_FEED_HOST to its address)");
if (!at) throw new Error(`libraries live in the raea app: open it on ${computer().name} (or set RAEA_FEED_HOST to its address)`);
return postHost(at, "/host/library", a);
}
+29
View File
@@ -251,3 +251,32 @@ export function brandKit(input: BrandInput, date = new Date().toISOString().slic
];
return { files, said: said.join("\n") };
}
/** A raster's pixels from its header: PNG, GIF, JPEG, WebP or ICO (a logo's formats), on any system */
export function pixelsOf(b: Uint8Array): { width: number; height: number } | undefined {
const v = new DataView(b.buffer, b.byteOffset, b.byteLength);
const tag = (at: number, s: string) => String.fromCharCode(...b.subarray(at, at + s.length)) === s;
const wh = (width: number, height: number) => (width > 0 && height > 0 ? { width, height } : undefined);
try {
if (tag(1, "PNG")) return wh(v.getUint32(16), v.getUint32(20));
if (tag(0, "GIF8")) return wh(v.getUint16(6, true), v.getUint16(8, true));
if (tag(0, "RIFF") && tag(8, "WEBP")) {
if (tag(12, "VP8 ")) return wh(v.getUint16(26, true) & 0x3fff, v.getUint16(28, true) & 0x3fff);
if (tag(12, "VP8L")) return wh(1 + (((b[22] & 0x3f) << 8) | b[21]), 1 + (((b[24] & 0xf) << 10) | (b[23] << 2) | ((b[22] & 0xc0) >> 6)));
if (tag(12, "VP8X")) return wh(1 + (b[24] | (b[25] << 8) | (b[26] << 16)), 1 + (b[27] | (b[28] << 8) | (b[29] << 16)));
}
if (b[0] === 0 && b[1] === 0 && b[2] === 1 && b[3] === 0) return wh(b[6] || 256, b[7] || 256);
if (b[0] === 0xff && b[1] === 0xd8) {
// JPEG: its segments up to the first frame header (SOF0-15, not DHT, JPG or DAC)
for (let i = 2; i + 9 < b.length; ) {
if (b[i] !== 0xff) return undefined;
const m = b[i + 1];
if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xc8 && m !== 0xcc) return wh(v.getUint16(i + 7), v.getUint16(i + 5));
i += 2 + v.getUint16(i + 2);
}
}
} catch {
// a header cut short
}
return undefined;
}
+9 -5
View File
@@ -24,7 +24,7 @@ const out = (stdout: string, exitCode = 0, stderr = "") => ({ stdout, stderr, ex
// `raea library` (library.ts), kept apart from the imports above
import { libraryVerb } from "./library";
// `raea show` (show.ts): what a session shows the person, in the raea app
import { labelsIn, showVerb } from "./show";
import { absolute, fromCwd, labelsIn, showVerb } from "./show";
// `raea clothes` (clothes.ts): garments for SOMA's body from words
import { clothesVerb } from "./clothes";
// `raea bug` (bug.ts): an agent's report of a bug in raea, to raea's server
@@ -113,8 +113,12 @@ Not there: React hooks come from "react" (useMemo, useState), not from raea.
/** The workspace a folder is in: the nearest folder at or above it holding .raea/workspace, through the shell's fs. */
async function workspaceAbove(c: Ctx, from: string): Promise<string | undefined> {
for (let d = from.replace(/\/$/, ""); d; d = d.slice(0, d.lastIndexOf("/"))) {
// up to the root, / or on Windows C:
for (let d = from.replace(/[\\/]+$/, ""); d; ) {
if (await c.fs.exists(`${d}/.raea/workspace`)) return d;
const up = Math.max(d.lastIndexOf("/"), d.lastIndexOf("\\"));
if (up < 0) break;
d = d.slice(0, up);
}
return undefined;
}
@@ -123,7 +127,7 @@ async function workspaceAbove(c: Ctx, from: string): Promise<string | undefined>
export function raeaHandler(host?: Host, engine?: Engine) {
return async (args: string[], ctx: unknown) => {
const c = ctx as unknown as Ctx;
const p = (rel: string) => (rel.startsWith("/") ? rel : `${c.cwd.replace(/\/$/, "")}/${rel}`);
const p = (rel: string) => fromCwd(c.cwd, rel);
const ask = (op: string, a: Record<string, unknown> = {}) => {
if (!host) throw new Error(`raea ${op} needs a host (the native raea's src/native.ts); this shell has none`);
return host(op, a);
@@ -163,7 +167,7 @@ export function raeaHandler(host?: Host, engine?: Engine) {
if (args.includes("--layout") && args[args.indexOf("--layout") + 1] !== "feature") return out("", 2, "raea init [--layout feature]\n");
if (args.includes("--layout")) {
for (const d of FEATURE_DIRS) await c.fs.mkdir(p(d), { recursive: true });
const name = c.cwd.replace(/\/$/, "").split("/").pop() || "project";
const name = c.cwd.replace(/[\\/]$/, "").split(/[\\/]/).pop() || "project";
for (const [f, body] of Object.entries(featureLayout(name, shape))) await put(f, body);
return out(made.length ? `made ${made.join(", ")}; render it with raea render src/main.tsx\n` : "nothing to make: the project's files are here\n");
}
@@ -205,7 +209,7 @@ export function raeaHandler(host?: Host, engine?: Engine) {
}
await c.fs.mkdir(p(home), { recursive: true });
const done: string[] = [];
const shown = (rel: string) => (home.startsWith("/") ? `shared/components/${rel.slice(home.length + 1)}` : rel);
const shown = (rel: string) => (absolute(home) ? `shared/components/${rel.slice(home.length + 1)}` : rel);
for (const n of names) {
const set = REGISTRY[n];
if (set) {
+9 -3
View File
@@ -7,16 +7,17 @@ import { spawnSync } from "node:child_process";
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { basename, delimiter, dirname, extname } from "node:path";
import { brandKit } from "./brand";
import { brandKit, pixelsOf } from "./brand";
import { readSite, stylesOf } from "./scrape";
import { wordsOf } from "./heard";
import { harness, library, show, task } from "./app";
import { fromCwd } from "./show";
import { clothesHost } from "./wardrobe";
import { raeaHandler, type Engine, type Host } from "./index";
const [raea, ...args] = process.argv.slice(2);
const cwd = process.cwd();
const at = (p: string) => (p.startsWith("/") ? p : `${cwd}/${p}`);
const at = (p: string) => fromCwd(cwd, p);
/** The project's shape: its cut's (cuts.json's edit), else a 1080x1920 vertical at 30 fps */
function shape() {
@@ -98,6 +99,9 @@ function ensure(name: string): string {
}
function hearTake(take: string, out: string) {
// parakeet-mlx is Apple silicon's (MLX); elsewhere raea has no transcriber yet, so the two ways that work there
if (process.platform !== "darwin")
throw new Error(`cutting ${take} by its words needs its transcript, and raea transcribes only on a Mac so far: give it one as ${basename(out)} ([{ "text", "start_ms", "end_ms" }], beside it), or cut it by time: --at A-B`);
const dir = mkdtempSync(`${tmpdir()}/raea-hear-`);
try {
const wav = `${dir}/take.wav`;
@@ -339,13 +343,15 @@ function curl(url: string, o: { out?: string; secs?: number } = {}): { body: str
return { body, url: final || url };
}
/** A logo's size: an SVG's viewBox or width/height, a raster's pixels by sips */
/** A logo's size: an SVG's viewBox or width/height, a raster's pixels from its header (else, on a Mac, by sips) */
function sizeOf(file: string): { width?: number; height?: number } {
if (file.endsWith(".svg")) {
const head = readFileSync(file, "utf8").slice(0, 2000);
const vb = /viewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(head);
return vb ? { width: Math.round(+vb[1]), height: Math.round(+vb[2]) } : {};
}
const own = pixelsOf(readFileSync(file));
if (own || process.platform !== "darwin") return own ?? {};
const r = spawnSync("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file], { encoding: "utf8" });
const n = (k: string) => Number(new RegExp(`${k}: (\\d+)`).exec(r.stdout ?? "")?.[1]) || undefined;
return { width: n("pixelWidth"), height: n("pixelHeight") };
+10 -2
View File
@@ -50,6 +50,14 @@ const FLAGS = new Set(["--open"]);
/** The harness an agent runs in, named as the feed shows it, from the program that started this command (native.ts
* walks up its parents): any harness, not only the ones that mark their shells. */
/** Whether a path is absolute: POSIX's /..., and Windows' C:\... (or C:/...), \\server\share\... and \... Until 0.1.8
* only a POSIX one was, so on Windows `raea show C:\...\cut.mp4` named a file under the cwd (#169). Here, not node:path:
* index.ts runs in the app's own shell too, with no Node. */
export const absolute = (f: string) => /^(?:[\\/]|[A-Za-z]:[\\/])/.test(f);
/** `f` from `cwd`: itself when it's absolute */
export const fromCwd = (cwd: string, f: string) => (absolute(f) ? f : `${cwd.replace(/[\\/]$/, "")}/${f}`);
export const HARNESSES: [RegExp, string][] = [
[/^claude$/, "Claude Code"], [/^codex/, "Codex"], [/^gemini$/, "Gemini"], [/^kimi$/, "Kimi"], [/^opencode$/, "OpenCode"],
[/^goose$/, "Goose"], [/^cursor-agent$/, "Cursor"], [/^amp$/, "Amp"], [/^qwen$/, "Qwen Code"], [/^crush$/, "Crush"], [/^aider$/, "Aider"],
@@ -80,7 +88,7 @@ export function parseShow(args: string[], cwd: string) {
const choices = many("--choice");
const unknown = args.find((a, i) => a.startsWith("--") && !WITH_VALUE.has(a) && !FLAGS.has(a) && !WITH_VALUE.has(args[i - 1] ?? ""));
if (unknown) throw new Error(`no ${unknown} here\n${SHOW_USAGE}`);
const abs = (f: string) => (f.startsWith("/") ? f : `${cwd.replace(/\/$/, "")}/${f}`);
const abs = (f: string) => fromCwd(cwd, f);
const files = args.filter((a, i) => !a.startsWith("--") && !WITH_VALUE.has(args[i - 1] ?? "")).map(abs);
// the questions in order: each --question starts one and its --choice's follow; a --preview after a --choice is that
// choice's, after the --question (before any choice) the question's own
@@ -151,7 +159,7 @@ export function showVerb(ask: Ask, args: string[], cwd: string, env: Record<stri
if (a.sign !== undefined && (a.working.length !== 1 || a.done.length || !a.clip || !a.render)) throw new Error(`--sign N shows one comment's clip: raea show --on ITEM --working ID --sign N --clip FILE --render HASH\n${SHOW_USAGE}`);
if ((a.clip || a.render) && a.sign === undefined) throw new Error(`--clip and --render go with --sign N, the ask the clip is for\n${SHOW_USAGE}`);
if (a.states && a.asks.length && a.states.length !== a.asks.length) throw new Error(`--states says one state for each --ask: ${a.asks.length} asks, ${a.states.length} states\n${SHOW_USAGE}`);
const sign = a.sign === undefined ? undefined : { ask: Number(a.sign), clip: a.clip!.startsWith("/") ? a.clip : `${cwd.replace(/\/$/, "")}/${a.clip}`, render: a.render };
const sign = a.sign === undefined ? undefined : { ask: Number(a.sign), clip: fromCwd(cwd, a.clip!), render: a.render };
const mark = (item: string, comments: string[], state: "working" | "done", version?: string) =>
ask("task", { item, comments, state, by, sub: a.sub, note: state === "done" ? a.note : undefined, asks: state === "working" && a.asks.length ? a.asks : undefined, version, ...(state === "working" ? { status: a.status, states: a.states, sign } : {}) }) as { item: string; comments: string[] };
const said = (m: { item: string; comments: string[] }, state: string) => `Marked ${m.comments.join(", ")} ${state} on ${m.item}: the person sees ${a.sub ? `${by.name} · ${a.sub}` : by.name} ${state === "working" ? "on them" : "finished them"}${state === "working" && a.status ? `; it reads "${a.status}"${a.states?.length ? ` (its asks: ${a.states.join(", ")})` : ""}` : ""}.`;
+3 -1
View File
@@ -186,7 +186,9 @@ fn run_here(root: &Path, cwd: &Path, entry: Entry, argv: Vec<String>, env: serde
let globals = [
("__raea_argv", json!(argv)),
("__raea_env", Value::Object(env)),
("__raea_platform", json!(if cfg!(target_os = "ios") { "ios" } else { std::env::consts::OS })),
// process.platform in Node's words (darwin, win32, linux): until 0.1.8 Rust's (macos, windows), so the agent
// shell's every test for a Mac or a Windows PC was false (#169)
("__raea_platform", json!(match std::env::consts::OS { "macos" => "darwin", "windows" => "win32", os => os })),
("__raea_stdin", json!(stdin)),
("__raea_cwd", json!(cwd.display().to_string())),
];
+106 -53
View File
@@ -97,7 +97,12 @@
return encoding ? b.toString(encoding) : b;
};
// ---- path (POSIX) -------------------------------------------------------------------------------------------------
// ---- path ---------------------------------------------------------------------------------------------------------
// POSIX's, and on Windows Windows' parsing: a drive's root (C:\), a share's (\\server\share\) and the cwd's drive's
// (\) start an absolute path, and \ separates as / does. A Windows path comes out with / (which Windows' calls all
// take), so the tools' own "a/b" joins, splits and prefix tests hold there too. Until 0.1.8 every Windows path was a
// relative one here: resolve(".") named "/C:\Users\...", no folder at all, and isAbsolute("C:\x") was false (#169).
const win = g.process.platform === "win32";
const normalizeParts = (parts, abs) => {
const out = [];
for (const p of parts) {
@@ -107,48 +112,79 @@
}
return out;
};
const path = {
sep: "/", delimiter: ":",
normalize(p) {
if (p === "") return ".";
const abs = p.startsWith("/"), trail = p.endsWith("/");
let s = normalizeParts(p.split("/"), abs).join("/");
if (!s && !abs) s = ".";
if (s && trail) s += "/";
return (abs ? "/" : "") + s;
},
join(...a) { const s = a.filter((x) => x !== "").join("/"); return s ? path.normalize(s) : "."; },
resolve(...a) {
let r = "";
for (let i = a.length - 1; i >= 0 && !r.startsWith("/"); i--) if (a[i]) r = a[i] + (r ? "/" + r : "");
if (!r.startsWith("/")) r = proc.cwd() + (r ? "/" + r : "");
const s = "/" + normalizeParts(r.split("/"), true).join("/");
return s;
},
isAbsolute: (p) => p.startsWith("/"),
dirname(p) {
if (!p) return ".";
const s = p.replace(/\/+$/, "");
if (!s) return "/";
const i = s.lastIndexOf("/");
return i < 0 ? "." : i === 0 ? "/" : s.slice(0, i);
},
basename(p, ext) {
let b = p.replace(/\/+$/, "");
b = b.slice(b.lastIndexOf("/") + 1);
return ext && b.endsWith(ext) && b !== ext ? b.slice(0, -ext.length) : b;
},
extname(p) { const b = path.basename(p); const i = b.lastIndexOf("."); return i <= 0 ? "" : b.slice(i); },
relative(from, to) {
const f = path.resolve(from).split("/").filter(Boolean), t = path.resolve(to).split("/").filter(Boolean);
let i = 0;
while (i < f.length && i < t.length && f[i] === t[i]) i++;
return [...Array(f.length - i).fill(".."), ...t.slice(i)].join("/");
},
parse(p) { const base = path.basename(p), ext = path.extname(p); return { root: p.startsWith("/") ? "/" : "", dir: path.dirname(p), base, ext, name: ext ? base.slice(0, -ext.length) : base }; },
format(o) { return (o.dir ? o.dir + "/" : o.root || "") + (o.base || (o.name || "") + (o.ext || "")); },
/** path for POSIX or (`windows`) Windows, its paths written with / */
const pathFor = (windows) => {
const slash = windows ? (x) => String(x).replace(/\\/g, "/") : (x) => String(x);
// the root an absolute path starts with, "" for a relative one: "/", and on Windows "C:/" or "//server/share/"
const rootOf = (x) => {
if (!windows) return x.startsWith("/") ? "/" : "";
const share = /^\/\/[^/]+\/[^/]+(?:\/|$)/.exec(x);
if (share) return share[0].endsWith("/") ? share[0] : share[0] + "/";
const drive = /^[A-Za-z]:\//.exec(x);
return drive ? drive[0] : x.startsWith("/") ? "/" : "";
};
// Windows' names don't care about case
const same = windows ? (a, b) => a.toLowerCase() === b.toLowerCase() : (a, b) => a === b;
const P = {
sep: "/", delimiter: windows ? ";" : ":",
normalize(x) {
x = slash(x);
if (x === "") return ".";
const root = rootOf(x), trail = x.endsWith("/") && x.length > root.length;
let s = normalizeParts(x.slice(root.length).split("/"), !!root).join("/");
if (!s && !root) s = ".";
if (s && trail) s += "/";
return root + s;
},
join(...a) { const s = a.filter((x) => x !== "").join("/"); return s ? P.normalize(s) : "."; },
resolve(...a) {
let r = "";
for (let i = a.length - 1; i >= 0 && !rootOf(r); i--) if (a[i]) r = slash(a[i]) + (r ? "/" + r : "");
const here = slash(proc.cwd());
if (!rootOf(r)) r = here + (r ? "/" + r : "");
// a bare \ on Windows is the cwd's drive's root
if (windows && rootOf(r) === "/") r = (/^[A-Za-z]:/.exec(here) || [""])[0] + r;
const root = rootOf(r);
return root + normalizeParts(r.slice(root.length).split("/"), true).join("/");
},
isAbsolute: (x) => rootOf(slash(x)) !== "",
dirname(x) {
if (!x) return ".";
x = slash(x);
const root = rootOf(x), s = x.replace(/\/+$/, "");
if (s.length < root.length) return root;
const i = s.lastIndexOf("/");
return i < 0 ? "." : i < root.length ? root : s.slice(0, i);
},
basename(x, ext) {
x = slash(x);
let b = x.replace(/\/+$/, "");
b = b.length < rootOf(x).length ? "" : b.slice(b.lastIndexOf("/") + 1);
return ext && b.endsWith(ext) && b !== ext ? b.slice(0, -ext.length) : b;
},
extname(x) { const b = P.basename(x); const i = b.lastIndexOf("."); return i <= 0 ? "" : b.slice(i); },
relative(from, to) {
const a = P.resolve(from), b = P.resolve(to);
// another drive (or share) on Windows: no way there but the whole path
if (!same(rootOf(a), rootOf(b))) return b;
const f = a.slice(rootOf(a).length).split("/").filter(Boolean), t = b.slice(rootOf(b).length).split("/").filter(Boolean);
let i = 0;
while (i < f.length && i < t.length && same(f[i], t[i])) i++;
return [...Array(f.length - i).fill(".."), ...t.slice(i)].join("/");
},
parse(x) { const base = P.basename(x), ext = P.extname(x); return { root: rootOf(slash(x)), dir: P.dirname(x), base, ext, name: ext ? base.slice(0, -ext.length) : base }; },
format(o) { return (o.dir ? o.dir + "/" : o.root || "") + (o.base || (o.name || "") + (o.ext || "")); },
};
return P;
};
path.posix = path;
const path = pathFor(win);
path.posix = win ? pathFor(false) : path;
// Windows' parsing on any system (Node's path.win32 writes \; this one /, as raea's Windows does)
path.win32 = win ? path : pathFor(true);
path.posix.posix = path.win32.posix = path.posix;
path.posix.win32 = path.win32.win32 = path.win32;
/** a path a native gave, as path writes it: / on Windows */
const fwd = win ? (x) => String(x).replace(/\\/g, "/") : (x) => x;
// ---- fs ---------------------------------------------------------------------------------------------------------------
const stats = (s) => ({
@@ -171,8 +207,8 @@
rmdirSync(p, o) { call("rm", pathOf(p), !!(o && o.recursive), false); },
renameSync: (a, b) => call("rename", pathOf(a), pathOf(b)),
copyFileSync: (a, b) => call("copyFile", pathOf(a), pathOf(b)),
realpathSync: (p) => call("realpath", pathOf(p)),
mkdtempSync: (prefix) => call("mkdtemp", String(prefix)),
realpathSync: (p) => fwd(call("realpath", pathOf(p))),
mkdtempSync: (prefix) => fwd(call("mkdtemp", String(prefix))),
constants: { F_OK: 0, R_OK: 4, W_OK: 2, X_OK: 1 },
createWriteStream(p) { fs.writeFileSync(p, ""); return { write(d) { fs.appendFileSync(p, d); return true; }, end(d) { if (d) fs.appendFileSync(p, d); }, on() { return this; } }; },
};
@@ -186,9 +222,11 @@
fs.promises = promises;
// ---- os, crypto, child_process --------------------------------------------------------------------------------------
// the system's own words, as Node gives them (until 0.1.8 every system here was an arm64 Mac's)
const os = {
tmpdir: () => call("tmpdir"), homedir: () => call("homedir"), platform: () => "darwin", arch: () => "arm64", EOL: "\n",
cpus: () => Array.from({ length: 8 }, () => ({ model: "", speed: 0 })), type: () => "Darwin", release: () => "", hostname: () => "raea", endianness: () => "LE",
tmpdir: () => fwd(call("tmpdir")), homedir: () => fwd(call("homedir")), platform: () => proc.platform, arch: () => proc.arch, EOL: win ? "\r\n" : "\n",
cpus: () => Array.from({ length: 8 }, () => ({ model: "", speed: 0 })), type: () => ({ darwin: "Darwin", win32: "Windows_NT", linux: "Linux" })[proc.platform] || proc.platform,
release: () => "", hostname: () => "raea", endianness: () => "LE",
};
const crypto = {
createHash(alg) {
@@ -226,18 +264,23 @@
if (r.status !== 0) { const e = new Error(`Command failed: ${cmd} ${(args || []).join(" ")}\n${r.stderr}`); e.status = r.status; e.stdout = r.stdout; e.stderr = r.stderr; throw e; }
return r.stdout;
},
execSync(command, o) { return childProcess.execFileSync("/bin/sh", ["-c", String(command)], o); },
// a command line through the system's shell, as Node's: sh, or on Windows cmd
execSync(command, o) { return win ? childProcess.execFileSync(g.process.env.ComSpec || "cmd.exe", ["/d", "/s", "/c", String(command)], o) : childProcess.execFileSync("/bin/sh", ["-c", String(command)], o); },
};
// ---- process, url, util, events, module ---------------------------------------------------------------------------
const proc = g.process;
let cwd = call("cwd");
let cwd = fwd(call("cwd"));
proc.cwd = () => cwd;
proc.chdir = (d) => { cwd = path.resolve(d); };
proc.version = "v22.0.0";
proc.versions = { node: "22.0.0", raea: "1" };
proc.arch = "arm64";
proc.pid = 1;
// the process's own (until 0.1.8 a pid of 1 and no ppid, so `raea show` never found the harness that ran it)
const own = call("process");
proc.arch = own.arch;
proc.pid = own.pid;
let parent;
Object.defineProperty(proc, "ppid", { get: () => (parent === undefined ? (parent = call("ppid")) : parent), configurable: true });
proc.execPath = "raea";
proc.exitCode = undefined;
proc.nextTick = (fn, ...a) => queueMicrotask(() => fn(...a));
@@ -249,9 +292,19 @@
proc.memoryUsage = () => ({ rss: 0, heapTotal: 0, heapUsed: 0, external: 0, arrayBuffers: 0 });
proc.on = proc.once = proc.off = () => proc;
proc.emitWarning = () => {};
// file:///C:/x on Windows is C:/x, and file://server/share/x is //server/share/x
const url = {
fileURLToPath: (u) => decodeURIComponent(new URL(String(u)).pathname),
pathToFileURL: (p) => new URL("file://" + encodeURI(path.resolve(String(p)))),
fileURLToPath(u) {
const x = new URL(String(u));
const p = decodeURIComponent(x.pathname);
if (!win) return p;
return x.hostname ? "//" + x.hostname + p : /^\/[A-Za-z]:(\/|$)/.test(p) ? p.slice(1) : p;
},
pathToFileURL(p) {
const r = path.resolve(String(p));
const share = win && r.startsWith("//");
return new URL("file:" + (share ? "" : win ? "///" : "//") + encodeURI(r).replace(/[?#]/g, encodeURIComponent));
},
URL: g.URL, URLSearchParams: g.URLSearchParams,
};
const inspect = (x) => { try { return typeof x === "string" ? x : JSON.stringify(x); } catch { return String(x); } };
@@ -304,7 +357,7 @@
req.cache = cache;
return req;
};
builtins.module = { createRequire: (from) => requireFrom(path.dirname(pathOf(from).replace(/^file:\/\//, ""))), builtinModules: Object.keys(builtins) };
builtins.module = { createRequire: (from) => { const f = String(from instanceof URL ? from.href : from); return requireFrom(path.dirname(f.startsWith("file:") ? url.fileURLToPath(f) : f)); }, builtinModules: Object.keys(builtins) };
g.__raea_node_builtins = builtins;
g.__raea_node_require = requireFrom;
g.Buffer = Buffer;
+8 -3
View File
@@ -10,7 +10,7 @@ use base64::Engine as _;
use serde_json::{json, Value};
mod os;
use os::{mode_ctime, signal};
use os::{mode_ctime, node_arch, parent_pid, signal};
/// The builtins node.js defines, by the names an import or require gives them (with or without `node:`)
@@ -181,7 +181,8 @@ fn js_string(s: &str) -> String {
/// looked for packages from "."
pub fn load(path: &Path, entry: bool) -> Result<String, String> {
let abs = std::path::absolute(path).unwrap_or_else(|_| path.to_path_buf());
let url = js_string(&format!("file://{}", abs.display()));
// file:///C:/... on Windows (until 0.1.8 file://C:\..., a URL with no path a fileURLToPath could read)
let url = js_string(&url::Url::from_file_path(&abs).map(String::from).unwrap_or_else(|_| format!("file://{}", abs.display())));
load_module(path).map(|s| s.replace("import.meta.main", if entry { "true" } else { "false" }).replace("import.meta.url", &url))
}
@@ -358,7 +359,11 @@ pub fn call(op: &str, a: &[Value]) -> Value {
json!(b64(&v))
}
"spawn" => spawn(&s(0), a.get(1), a.get(2).unwrap_or(&Value::Null)),
"tmpdir" => json!(std::env::temp_dir().display().to_string().trim_end_matches('/')),
// without its last separator, as Node's (Windows' TEMP ends in \\)
"tmpdir" => json!(std::env::temp_dir().display().to_string().trim_end_matches(['/', '\\'])),
// process.arch and process.pid, in Node's words (x64, arm64)
"process" => json!({"arch": node_arch(), "pid": std::process::id()}),
"ppid" => parent_pid().map(Value::from).unwrap_or(Value::Null),
"homedir" => json!(raea_io_home::user_home().unwrap_or_default().display().to_string()),
"cwd" => json!(std::env::current_dir().map(|p| p.display().to_string()).unwrap_or_default()),
"resolve" => resolve_file(&s(0), Path::new(&s(1)), false).map(|p| json!(p.display().to_string())).unwrap_or_else(|e| err("MODULE_NOT_FOUND", e)),
+30
View File
@@ -38,3 +38,33 @@ fn signal_name(n: i32) -> String {
n => format!("SIG{n}"),
}
}
/// process.arch: Node's word for the CPU this was built for
pub(super) fn node_arch() -> &'static str {
match std::env::consts::ARCH {
"x86_64" => "x64",
"aarch64" => "arm64",
"x86" => "ia32",
other => other,
}
}
/// process.ppid: the process that started this one. Windows keeps it in a process's own record, read here through
/// PowerShell (once, when asked: the agent shell asks only to find the harness that ran `raea show`).
pub(super) fn parent_pid() -> Option<u32> {
#[cfg(unix)]
{
// SAFETY: getppid takes nothing and can't fail
Some(unsafe { libc::getppid() } as u32)
}
#[cfg(windows)]
{
let q = format!("(Get-CimInstance Win32_Process -Filter 'ProcessId={}').ParentProcessId", std::process::id());
let o = std::process::Command::new("powershell").args(["-NoProfile", "-NonInteractive", "-Command", &q]).stdin(std::process::Stdio::null()).output().ok()?;
String::from_utf8_lossy(&o.stdout).trim().parse().ok()
}
#[cfg(not(any(unix, windows)))]
{
None
}
}
+52
View File
@@ -93,3 +93,55 @@ fn a_script_that_sets_exit_code_exits_with_it() {
assert_eq!((set.exit, set.stderr.as_str()), (3, "refused\n"));
assert_eq!((plain.exit, plain.stdout.as_str()), (0, "ok"));
}
/// The system as Node names it, and Windows' paths parsed as Windows does (#169: on a Windows PC raea's Node core said
/// it was an arm64 Mac, process.platform was Rust's "windows", resolve(".") named "/C:\Users\...", no folder at all, and
/// there was no process.ppid on any system, so `raea show` never found the harness that ran it). path.win32 parses
/// Windows' paths on any system, as the Windows path does there, writing them with /. Each answer is Node 22's, its \
/// written as /.
#[test]
fn names_the_system_as_node_does_and_parses_windows_paths() {
let d = std::env::temp_dir().join(format!("raea-node-system-{}", std::process::id()));
std::fs::create_dir_all(&d).unwrap();
std::fs::write(d.join("system.ts"), r#"
import { arch, platform, type, tmpdir, homedir } from "os";
import path from "path";
import { fileURLToPath, pathToFileURL } from "url";
const w = path.win32;
process.stdout.write(JSON.stringify({
system: [process.platform === platform(), process.arch === arch(), process.pid > 1, process.ppid > 1 && process.ppid !== process.pid, type()],
here: [path.isAbsolute(process.cwd()), path.resolve(".") === process.cwd(), path.isAbsolute(tmpdir()), !/[\\/]$/.test(tmpdir()), path.isAbsolute(homedir())],
resolve: [w.resolve("C:\\a", "b\\..\\c"), w.resolve("C:\\a", "D:\\x", "y"), w.resolve("\\\\nas\\clips\\", "a.mp4"), w.resolve("C:/a/", "..", "..")],
absolute: ["C:\\x", "c:/x", "\\\\nas\\clips", "\\x", "x", "C:x"].map((p) => w.isAbsolute(p)),
parts: [w.dirname("C:\\a\\b.txt"), w.dirname("C:\\a"), w.dirname("C:\\"), w.basename("C:\\a\\b.txt", ".txt"), w.extname("C:\\a.b\\c.mp4"), w.basename("C:\\")],
join: [w.join("C:\\Users\\me", ".raea", "app-host.json"), w.normalize("C:\\a\\.\\b\\..\\c\\"), w.parse("C:\\a\\b.txt").root],
relative: [w.relative("C:\\a\\b", "C:\\a\\c\\d"), w.relative("C:\\A\\b", "c:\\a\\B\\x"), w.relative("C:\\a", "D:\\b")],
delimiter: [w.delimiter, path.posix.delimiter, path.posix.resolve("/a", "b"), path.posix.isAbsolute("C:\\x")],
url: [fileURLToPath(pathToFileURL(path.resolve("a b#1.txt"))) === path.resolve("a b#1.txt"), pathToFileURL("/x y").href.startsWith("file:///")],
}));
"#).unwrap();
let r = raea_native::js::run_node(&d.join("system.ts"), &[], String::new(), Duration::from_secs(20));
let _ = std::fs::remove_dir_all(&d);
let got: serde_json::Value = serde_json::from_str(&r.stdout).unwrap_or_else(|e| panic!("{e}: {} / {}", r.stdout, r.stderr));
let kind = match std::env::consts::OS { "macos" => "Darwin", "windows" => "Windows_NT", "linux" => "Linux", os => os };
let want = serde_json::json!({
"system": [true, true, true, true, kind],
"here": [true, true, true, true, true],
"resolve": ["C:/a/c", "D:/x/y", "//nas/clips/a.mp4", "C:/"],
"absolute": [true, true, true, true, false, false],
"parts": ["C:/a", "C:/", "C:/", "b", ".mp4", ""],
"join": ["C:/Users/me/.raea/app-host.json", "C:/a/c/", "C:/"],
"relative": ["../c/d", "x", "D:/b"],
"delimiter": [";", ":", "/a/b", false],
"url": [true, true],
});
assert_eq!(got, want);
// and Node's own words for this system
let platform = match std::env::consts::OS { "macos" => "darwin", "windows" => "win32", os => os };
let probe = d.with_extension("platform.ts");
std::fs::write(&probe, "process.stdout.write(process.platform + ' ' + process.arch);\n").unwrap();
let r = raea_native::js::run_node(&probe, &[], String::new(), Duration::from_secs(20));
let _ = std::fs::remove_file(&probe);
let arch = match std::env::consts::ARCH { "x86_64" => "x64", "aarch64" => "arm64", a => a };
assert_eq!(r.stdout, format!("{platform} {arch}"));
}
+3 -3
View File
@@ -21,8 +21,6 @@ bevy = { version = "=0.20.0", default-features = false, features = ["std", "defa
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "hdr"] }
# an edit as rows keyed per frame, and 3D shapes as values (docs/media.feature M2)
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" }
@@ -97,7 +95,9 @@ network = ["native"]
# every Bevy feature a game developer or animator might use: the plugin catalog's "bevy" declaration
# (sdk/raea/bench/bevy-plugins/package.json, 0.20). Measured beside the default build before it joins `default`
# (the adopt-0.20 pass, docs/bevy-upgrade.md); native only, so the web build goes without
bevy-all = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/compressed_image_saver", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools"]
# (but compressed_image_saver: ctt's AVX2 encoders set up C++ tables before main on any CPU, so raea.exe stopped at
# start on a PC without AVX; sdk/raea/docs/bevy-plugins.md)
bevy-all = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools"]
# per-system spans as a chrome trace (RUST_LOG=info, trace-*.json in the working directory)
trace = ["bevy/trace", "bevy/trace_chrome"]
-1
View File
@@ -55,7 +55,6 @@ raea_plugin! {
Draws2dPlugin: raea_sys_sprite::install, "Plugins' 2D drawing brings up the scene's 2D camera (raea-sys-sprite's Draws2d).";
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).";
-3
View File
@@ -281,9 +281,6 @@ pub(crate) fn spawn_3d(world: &mut World, e: Entity, t: &Tup, inserted: &[Tup],
} 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() {
// 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)
+260
View File
@@ -0,0 +1,260 @@
// The corner house raea/wear's demo weathers (docs/wear.feature WR7), made in code: a four-storey block on a street
// corner, its south front on x = 0..12 facing +z, its east front on z = -10..0 facing +x, the corner at (12, 0).
// A sandstone plinth, a rusticated ground floor, plastered storeys, sandstone sills and a string course, a cornice
// on consoles under a slate roof, a door in a sandstone surround up granite steps, an iron balcony, a zinc gutter and
// downpipe, an enamel street plate on each face of the corner, a cellar hatch in the walk, a brick firewall on the
// west, and the walk all round. The openings go through the walls (glass 15 cm in, frames in the reveals), so cracks
// can start at their corners. One glTF material per wear class, named for it. y up, metres.
// houseGlb() the .glb's bytes (make-house.ts writes assets/house.glb)
type V3 = [number, number, number];
/** a hexahedron: its eight corners, corner (i, j, k) at index i + 2j + 4k */
type Solid = V3[];
export const CLASSES = ["plaster", "brick", "sandstone", "granite", "wood", "iron", "zinc", "copper", "slate", "felt", "glass", "enamel", "brass", "ground"] as const;
export type HouseClass = (typeof CLASSES)[number];
const LOOK: Record<HouseClass, { color: V3; rough: number; metal: number }> = {
plaster: { color: [0.8, 0.72, 0.56], rough: 0.85, metal: 0 },
brick: { color: [0.45, 0.2, 0.13], rough: 0.9, metal: 0 },
sandstone: { color: [0.68, 0.57, 0.4], rough: 0.85, metal: 0 },
granite: { color: [0.46, 0.46, 0.47], rough: 0.7, metal: 0 },
wood: { color: [0.17, 0.28, 0.21], rough: 0.6, metal: 0 },
iron: { color: [0.06, 0.07, 0.065], rough: 0.5, metal: 0.6 },
zinc: { color: [0.55, 0.58, 0.6], rough: 0.4, metal: 0.9 },
copper: { color: [0.62, 0.33, 0.18], rough: 0.35, metal: 1 },
slate: { color: [0.2, 0.21, 0.24], rough: 0.7, metal: 0 },
felt: { color: [0.08, 0.08, 0.08], rough: 0.9, metal: 0 },
glass: { color: [0.07, 0.09, 0.11], rough: 0.05, metal: 0.2 },
enamel: { color: [0.08, 0.16, 0.5], rough: 0.25, metal: 0 },
brass: { color: [0.75, 0.58, 0.25], rough: 0.3, metal: 1 },
ground: { color: [0.33, 0.32, 0.3], rough: 0.9, metal: 0 },
};
export const SOUTH = { x0: 0, x1: 12 };
export const EAST = { z0: -10, z1: 0 };
export const TOP = 14.2;
/** the storeys' floor heights and their windows' sill and head */
export const STOREYS = [
{ floor: 0.6, sill: 1.5, head: 3.4 },
{ floor: 4.2, sill: 5.1, head: 7.2 },
{ floor: 7.6, sill: 8.5, head: 10.5 },
{ floor: 10.9, sill: 11.7, head: 13.5 },
];
/** the windows' middles along each front (metres from its west or south end), 1.2 m wide; the door's bay is 6 on the south */
export const BAYS = { south: [1.5, 4.0, 6.0, 8.5, 10.6], east: [1.6, 4.4, 7.2, 9.0] };
export const DOOR = { at: 6.0, w: 1.4, h: 2.9 };
const WIN = 1.2;
const T = 0.5;
const parts = new Map<HouseClass, Solid[]>(CLASSES.map((c) => [c, []]));
/** a parallelepiped from a corner and its three edges */
const add = (c: HouseClass, [o, u, v, w]: [V3, V3, V3, V3]) => {
const s: Solid = [];
for (let n = 0; n < 8; n++) {
const [i, j, k] = [n & 1, (n >> 1) & 1, (n >> 2) & 1];
s.push([o[0] + u[0] * i + v[0] * j + w[0] * k, o[1] + u[1] * i + v[1] * j + w[1] * k, o[2] + u[2] * i + v[2] * j + w[2] * k]);
}
parts.get(c)!.push(s);
};
/** a slab `t` thick upward from a planar quad (its corners in order round it) */
const slab = (c: HouseClass, q: [V3, V3, V3, V3], t: number) => {
const base = [q[0], q[1], q[3], q[2]];
parts.get(c)!.push([...base, ...base.map((p): V3 => [p[0], p[1] + t, p[2]])]);
};
/** an axis-aligned box from its two corners */
const box = (c: HouseClass, a: V3, b: V3) => add(c, [a, [b[0] - a[0], 0, 0], [0, b[1] - a[1], 0], [0, 0, b[2] - a[2]]]);
/** A front: `along` and `out` its axes, `at` where it starts; a wall of `c` from y0 to y1 with rectangular openings
* (u0, u1, v0, v1 along it and up) cut through, as boxes round them. */
function wall(c: HouseClass, at: V3, along: V3, out: V3, len: number, y0: number, y1: number, holes: [number, number, number, number][], depth = T, proud = 0) {
const cuts = [...new Set([0, len, ...holes.flatMap((h) => [h[0], h[1]])])].sort((a, b) => a - b);
for (let i = 0; i + 1 < cuts.length; i++) {
const [u0, u1] = [cuts[i], cuts[i + 1]];
const mid = (u0 + u1) / 2;
// the openings in this column, clipped to the wall's own height
const cut = holes.filter((h) => h[0] <= mid && mid <= h[1] && h[3] > y0 && h[2] < y1).flatMap((h) => [Math.max(h[2], y0), Math.min(h[3], y1)]);
const ys = [y0, y1, ...cut].sort((a, b) => a - b);
for (let j = 0; j + 1 < ys.length; j += 2) {
if (ys[j + 1] - ys[j] < 1e-4) continue;
const o: V3 = [at[0] + along[0] * u0 - out[0] * (depth - proud), ys[j], at[2] + along[2] * u0 - out[2] * (depth - proud)];
add(c, [o, [along[0] * (u1 - u0), 0, along[2] * (u1 - u0)], [0, ys[j + 1] - ys[j], 0], [out[0] * depth, 0, out[2] * depth]]);
}
}
}
/** A window in the opening (u0..u1, v0..v1) of the front at `at`: glass 15 cm in, a frame round it in the reveal and a
* transom, a sandstone sill below standing out 8 cm. */
function window(at: V3, along: V3, out: V3, u0: number, u1: number, v0: number, v1: number, sill = true) {
const p = (u: number, v: number, o: number): V3 => [at[0] + along[0] * u + out[0] * o, v, at[2] + along[2] * u + out[2] * o];
const piece = (cl: HouseClass, ua: number, ub: number, va: number, vb: number, oa: number, ob: number) => {
const o = p(ua, va, oa);
add(cl, [o, [along[0] * (ub - ua), 0, along[2] * (ub - ua)], [0, vb - va, 0], [out[0] * (ob - oa), 0, out[2] * (ob - oa)]]);
};
piece("glass", u0 + 0.06, u1 - 0.06, v0 + 0.06, v1 - 0.06, -0.17, -0.15);
piece("wood", u0, u0 + 0.06, v0, v1, -0.2, -0.1);
piece("wood", u1 - 0.06, u1, v0, v1, -0.2, -0.1);
piece("wood", u0, u1, v0, v0 + 0.06, -0.2, -0.1);
piece("wood", u0, u1, v1 - 0.06, v1, -0.2, -0.1);
const tr = v0 + (v1 - v0) * 0.72;
piece("wood", u0, u1, tr - 0.03, tr + 0.03, -0.2, -0.12);
piece("wood", (u0 + u1) / 2 - 0.03, (u0 + u1) / 2 + 0.03, v0, tr, -0.2, -0.12);
if (sill) piece("sandstone", u0 - 0.08, u1 + 0.08, v0 - 0.08, v0, -0.12, 0.08);
}
function build() {
for (const v of parts.values()) v.length = 0;
const S: V3 = [SOUTH.x0, 0, 0];
const E: V3 = [SOUTH.x1, 0, EAST.z1];
const X: V3 = [1, 0, 0];
const Z: V3 = [0, 0, 1];
const NZ: V3 = [0, 0, -1];
const fronts = [
{ at: S, along: X, out: Z, len: SOUTH.x1 - SOUTH.x0, bays: BAYS.south, door: true },
{ at: E, along: NZ, out: X, len: EAST.z1 - EAST.z0, bays: BAYS.east, door: false },
];
for (const f of fronts) {
const holes: [number, number, number, number][] = [];
for (const [k, st] of STOREYS.entries()) {
for (const b of f.bays) {
if (f.door && k === 0 && b === DOOR.at) continue;
holes.push([b - WIN / 2, b + WIN / 2, st.sill, st.head]);
}
}
if (f.door) holes.push([DOOR.at - DOOR.w / 2, DOOR.at + DOOR.w / 2, 0.6, 0.6 + DOOR.h]);
// the ground floor rendered in rusticated bands (a 2 cm groove every 0.4 m), the storeys above plain
const ground = holes.filter((h) => h[2] < 4.2);
for (let y = 0.6; y < 4.2 - 1e-6; y += 0.4) {
const top = Math.min(y + 0.38, 4.2);
wall("plaster", f.at, f.along, f.out, f.len, y, top, ground);
wall("plaster", f.at, f.along, f.out, f.len, top, Math.min(y + 0.4, 4.2), ground, T, -0.02);
}
wall("plaster", f.at, f.along, f.out, f.len, 4.2, TOP, holes.filter((h) => h[2] >= 4.2));
// the plinth, standing 8 cm out, the string course over the ground floor and the cornice's frieze
wall("sandstone", f.at, f.along, f.out, f.len, 0, 0.6, f.door ? [[DOOR.at - DOOR.w / 2, DOOR.at + DOOR.w / 2, 0, 0.6]] : [], T, 0.08);
wall("sandstone", f.at, f.along, f.out, f.len, 4.05, 4.25, [], T, 0.14);
for (const h of holes) {
if (f.door && h[0] === DOOR.at - DOOR.w / 2) continue;
window(f.at, f.along, f.out, h[0], h[1], h[2], h[3]);
}
// the cornice on its consoles, every 0.9 m
wall("sandstone", f.at, f.along, f.out, f.len + 0.6, TOP, TOP + 0.4, [], T, 0.6);
for (let u = 0.45; u < f.len; u += 0.9) {
const p: V3 = [f.at[0] + f.along[0] * u, TOP - 0.45, f.at[2] + f.along[2] * u];
add("sandstone", [[p[0] - f.along[0] * 0.09, p[1], p[2] - f.along[2] * 0.09], [f.along[0] * 0.18, 0, f.along[2] * 0.18], [0, 0.45, 0], [f.out[0] * 0.45, 0, f.out[2] * 0.45]]);
}
// the zinc gutter along the cornice's lip
add("zinc", [[f.at[0] + f.out[0] * 0.6 - f.along[0] * 0.0, TOP + 0.4, f.at[2] + f.out[2] * 0.6], [f.along[0] * (f.len + 0.6), 0, f.along[2] * (f.len + 0.6)], [0, 0.14, 0], [f.out[0] * 0.16, 0, f.out[2] * 0.16]]);
}
// the door: wood in a sandstone surround, granite steps up to it, a brass handle and bell plate, a copper canopy
const d0 = DOOR.at - DOOR.w / 2, d1 = DOOR.at + DOOR.w / 2;
box("wood", [d0, 0.6, -0.2], [d1, 0.6 + DOOR.h, -0.12]);
box("sandstone", [d0 - 0.25, 0.6, 0], [d0, 0.6 + DOOR.h + 0.3, 0.1]);
box("sandstone", [d1, 0.6, 0], [d1 + 0.25, 0.6 + DOOR.h + 0.3, 0.1]);
box("sandstone", [d0, 0.6 + DOOR.h, 0], [d1, 0.6 + DOOR.h + 0.3, 0.1]);
for (const [k, w] of [0.2, 0.4, 0.6].entries()) box("granite", [d0 - 0.4 + k * 0.05, 0, 0.1], [d1 + 0.4 - k * 0.05, w, 0.1 + 0.9 - k * 0.3]);
box("brass", [d1 - 0.22, 1.55, -0.12], [d1 - 0.12, 1.62, -0.07]);
box("brass", [d1 + 0.05, 1.75, 0.1], [d1 + 0.2, 1.95, 0.115]);
add("copper", [[d0 - 0.4, 0.6 + DOOR.h + 0.4, 0], [DOOR.w + 0.8, 0, 0], [0, -0.25, 0.8], [0, 0.04, 0]]);
// the iron balcony at the first floor's corner bay on the south front: a stone slab, balusters and a rail
const bx = BAYS.south[4];
box("sandstone", [bx - 1.1, 4.25, 0], [bx + 1.1, 4.4, 0.95]);
for (let i = 0; i <= 14; i++) box("iron", [bx - 1.05 + i * 0.15, 4.4, 0.86], [bx - 1.03 + i * 0.15, 5.35, 0.88]);
box("iron", [bx - 1.08, 5.35, 0.84], [bx + 1.08, 5.4, 0.9]);
// the downpipe down the south front's west end, from the gutter to the walk
box("zinc", [0.25, 0.05, 0.62], [0.35, TOP + 0.45, 0.72]);
box("zinc", [0.25, 0.05, 0.0], [0.35, 0.15, 0.72]);
// an enamel street plate on each face of the corner, 2.6-2.9 m up
box("enamel", [SOUTH.x1 - 0.9, 2.6, 0], [SOUTH.x1 - 0.2, 2.9, 0.012]);
box("enamel", [SOUTH.x1, 2.6, -0.9], [SOUTH.x1 + 0.012, 2.9, -0.2]);
// the cellar hatch: iron plates in the walk by the east front
box("iron", [SOUTH.x1 + 0.3, -0.01, -6.5], [SOUTH.x1 + 1.1, 0.03, -5.3]);
// the slate roof: a slope up from each front's cornice to a ridge 3 m higher, meeting on a hip over the corner,
// and a felt flat behind them
const [r, d, e, ex, ez] = [3.0, 3.2, TOP + 0.5, SOUTH.x1 + 0.1, EAST.z1 + 0.1];
slab("slate", [[SOUTH.x0, e, ez], [ex, e, ez], [ex - d, e + r, ez - d], [SOUTH.x0, e + r, ez - d]], 0.06);
slab("slate", [[ex, e, EAST.z0], [ex - d, e + r, EAST.z0], [ex - d, e + r, ez - d], [ex, e, ez]], 0.06);
box("felt", [SOUTH.x0, e + r, EAST.z0], [ex - d, e + r + 0.05, ez - d]);
// the house's own back and its neighbour: a brick firewall on the west, standing above the roof
box("brick", [SOUTH.x0 - 0.4, 0, EAST.z0], [SOUTH.x0, TOP + 4.2, -T]);
box("plaster", [SOUTH.x0, 0, EAST.z0 - 0.1], [SOUTH.x1, TOP + 0.4, EAST.z0]);
box("plaster", [SOUTH.x0, 0, EAST.z0], [SOUTH.x1 - T, TOP + 0.4, -T]);
// the walk round the corner, a granite kerb and the road 15 cm below it
box("ground", [-6, -0.2, -16], [SOUTH.x1 + 3.5, 0, 3.5]);
box("granite", [-6, -0.2, 3.5], [SOUTH.x1 + 3.8, 0, 3.8]);
box("granite", [SOUTH.x1 + 3.5, -0.2, -16], [SOUTH.x1 + 3.8, 0, 3.5]);
box("ground", [-6, -0.5, 3.8], [SOUTH.x1 + 12, -0.15, 14]);
box("ground", [SOUTH.x1 + 3.8, -0.5, -16], [SOUTH.x1 + 12, -0.15, 3.8]);
}
/** Each class's solids (after `houseGlb` or `solids` builds them). */
export function solids(): Map<HouseClass, Solid[]> {
build();
return parts;
}
/** The corner house as a .glb: one primitive and one material per class, each solid's six faces with flat normals. */
export function houseGlb(): Uint8Array {
build();
const pos: number[] = [], nrm: number[] = [], idx: number[] = [];
const prims: { first: number; count: number; mat: number }[] = [];
const mats: unknown[] = [];
const sub = (a: V3, b: V3): V3 => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
const cross = (a: V3, b: V3): V3 => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
const norm = (a: V3): V3 => { const l = Math.hypot(...a) || 1; return [a[0] / l, a[1] / l, a[2] / l]; };
for (const c of CLASSES) {
const first = idx.length;
for (const s of parts.get(c)!) {
const at = (i: number, j: number, k: number): V3 => s[i + 2 * j + 4 * k];
const mid: V3 = [0, 1, 2].map((a) => s.reduce((t, p) => t + p[a], 0) / 8) as V3;
const quads: V3[][] = [
[at(0, 0, 0), at(0, 1, 0), at(0, 1, 1), at(0, 0, 1)], [at(1, 0, 0), at(1, 0, 1), at(1, 1, 1), at(1, 1, 0)],
[at(0, 0, 0), at(0, 0, 1), at(1, 0, 1), at(1, 0, 0)], [at(0, 1, 0), at(1, 1, 0), at(1, 1, 1), at(0, 1, 1)],
[at(0, 0, 0), at(1, 0, 0), at(1, 1, 0), at(0, 1, 0)], [at(0, 0, 1), at(0, 1, 1), at(1, 1, 1), at(1, 0, 1)],
];
for (let q of quads) {
let n = norm(cross(sub(q[1], q[0]), sub(q[2], q[0])));
const centre: V3 = [(q[0][0] + q[2][0]) / 2, (q[0][1] + q[2][1]) / 2, (q[0][2] + q[2][2]) / 2];
const away = sub(centre, mid);
if (n[0] * away[0] + n[1] * away[1] + n[2] * away[2] < 0) { q = [q[0], q[3], q[2], q[1]]; n = [-n[0], -n[1], -n[2]]; }
const b = pos.length / 3;
for (const p of q) { pos.push(...p); nrm.push(...n); }
idx.push(b, b + 1, b + 2, b, b + 2, b + 3);
}
}
if (idx.length > first) {
prims.push({ first, count: idx.length - first, mat: mats.length });
const l = LOOK[c];
mats.push({ name: c, pbrMetallicRoughness: { baseColorFactor: [...l.color, 1], roughnessFactor: l.rough, metallicFactor: l.metal } });
}
}
const f32 = new Float32Array([...pos, ...nrm]);
const u32 = new Uint32Array(idx);
const bin = new Uint8Array(f32.byteLength + u32.byteLength);
bin.set(new Uint8Array(f32.buffer), 0);
bin.set(new Uint8Array(u32.buffer), f32.byteLength);
const n = pos.length / 3;
const lo = [0, 1, 2].map((k) => Math.min(...pos.filter((_, i) => i % 3 === k)));
const hi = [0, 1, 2].map((k) => Math.max(...pos.filter((_, i) => i % 3 === k)));
const json = {
asset: { version: "2.0", generator: "raea examples/materials/wear/house.ts" }, scene: 0, scenes: [{ nodes: [0] }], nodes: [{ mesh: 0, name: "corner-house" }],
meshes: [{ primitives: prims.map((p, i) => ({ attributes: { POSITION: 0, NORMAL: 1 }, indices: 2 + i, material: p.mat })) }],
materials: mats,
buffers: [{ byteLength: bin.byteLength }],
bufferViews: [{ buffer: 0, byteOffset: 0, byteLength: n * 12 }, { buffer: 0, byteOffset: n * 12, byteLength: n * 12 }, { buffer: 0, byteOffset: n * 24, byteLength: u32.byteLength }],
accessors: [
{ bufferView: 0, componentType: 5126, count: n, type: "VEC3", min: lo, max: hi },
{ bufferView: 1, componentType: 5126, count: n, type: "VEC3" },
...prims.map((p) => ({ bufferView: 2, byteOffset: p.first * 4, componentType: 5125, count: p.count, type: "SCALAR" })),
],
};
const pad = (b: Uint8Array, fill: number) => { const out = new Uint8Array(Math.ceil(b.length / 4) * 4).fill(fill); out.set(b); return out; };
const j = pad(new TextEncoder().encode(JSON.stringify(json)), 0x20);
const bb = pad(bin, 0);
const glb = new Uint8Array(12 + 8 + j.length + 8 + bb.length);
const dv = new DataView(glb.buffer);
dv.setUint32(0, 0x46546c67, true); dv.setUint32(4, 2, true); dv.setUint32(8, glb.length, true);
dv.setUint32(12, j.length, true); dv.setUint32(16, 0x4e4f534a, true); glb.set(j, 20);
dv.setUint32(20 + j.length, bb.length, true); dv.setUint32(24 + j.length, 0x004e4942, true); glb.set(bb, 28 + j.length);
return glb;
}
+11
View File
@@ -0,0 +1,11 @@
// Writes the corner house (house.ts) to media/house.glb, where wear.tsx's staticFile reads it.
// bun examples/materials/wear/make-house.ts
import { mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { houseGlb } from "./house";
const dir = join(import.meta.dir, "media");
mkdirSync(dir, { recursive: true });
const glb = houseGlb();
writeFileSync(join(dir, "house.glb"), glb);
console.log(`make-house: ${join(dir, "house.glb")} (${glb.length} bytes)`);
+85
View File
@@ -0,0 +1,85 @@
// The corner house (house.ts) and raea/wear's demo (wear.tsx): every part docs/wear.feature WR7 lists, openings cut
// through the walls (where cracks start), a valid .glb with one material per class, a still for every cause and for
// each of WR9's eight conditions by day and at dusk, and worn paint (docs/examples.feature EX9).
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { DEBUG_CAUSES, WEAR_CLASSES, WEAR_CONDITIONS } from "raea/wear";
import { BAYS, CLASSES, DOOR, houseGlb, solids, SOUTH, STOREYS } from "./house";
type V3 = [number, number, number];
const box = (s: V3[]) => [0, 1, 2].map((a) => [Math.min(...s.map((p) => p[a])), Math.max(...s.map((p) => p[a]))]);
const parts = solids();
/** Whether any solid of `cls` holds the point. */
const solidAt = (p: V3, cls = [...parts.keys()]) =>
cls.some((c) => parts.get(c)!.some((s) => box(s).every(([lo, hi], a) => p[a] > lo + 1e-6 && p[a] < hi - 1e-6)));
describe("the corner house", () => {
test("its classes are raea/wear's, every one used", () => {
const names = WEAR_CLASSES.map((c) => c.name);
for (const c of CLASSES) expect(names).toContain(c);
for (const c of CLASSES) expect(parts.get(c)!.length).toBeGreaterThan(0);
});
test("has every part WR7 names", () => {
const n = (c: string) => parts.get(c as (typeof CLASSES)[number])!.length;
// plinth, string course, sills, cornice and consoles, the door's surround; steps; balcony and hatch; gutter and
// downpipe; the two street plates; the roof
expect(n("sandstone")).toBeGreaterThan(40);
expect(n("granite")).toBeGreaterThanOrEqual(3);
expect(n("iron")).toBeGreaterThan(10);
expect(n("zinc")).toBeGreaterThanOrEqual(4);
expect(n("enamel")).toBe(2);
expect(n("slate")).toBe(2);
expect(n("copper")).toBe(1);
// the ground floor rusticated: bands set back 2 cm every 0.4 m up to the string course
const grooves = parts.get("plaster")!.filter((s) => { const b = box(s); return b[1][0] < 4.2 && Math.abs(b[2][1] + 0.02) < 1e-6; });
expect(grooves.length).toBeGreaterThan(20);
});
test("its windows and door go through the walls, their glass 15 cm in", () => {
for (const st of STOREYS) {
for (const x of BAYS.south) {
if (st === STOREYS[0] && x === DOOR.at) continue;
const mid: V3 = [x, (st.sill + st.head) / 2 + 0.3, -0.05];
expect(solidAt(mid, ["plaster"])).toBe(false);
expect(solidAt([x - 0.3, (st.sill + st.head) / 2 + 0.3, -0.16], ["glass"])).toBe(true);
}
for (const z of BAYS.east) expect(solidAt([SOUTH.x1 - 0.05, (st.sill + st.head) / 2 + 0.3, -z], ["plaster"])).toBe(false);
}
expect(solidAt([DOOR.at, 1.5, -0.05], ["plaster"])).toBe(false);
// and the wall between them is solid
expect(solidAt([(BAYS.south[0] + BAYS.south[1]) / 2, 2.5, -0.25], ["plaster"])).toBe(true);
});
test("is a .glb with one material per class, named for it", () => {
const glb = houseGlb();
const dv = new DataView(glb.buffer, glb.byteOffset);
expect(dv.getUint32(0, true)).toBe(0x46546c67);
expect(dv.getUint32(8, true)).toBe(glb.length);
const len = dv.getUint32(12, true);
const json = JSON.parse(new TextDecoder().decode(glb.subarray(20, 20 + len)));
expect(json.materials.map((m: { name: string }) => m.name)).toEqual([...CLASSES]);
expect(json.meshes[0].primitives).toHaveLength(CLASSES.length);
expect(houseGlb()).toEqual(glb);
});
});
describe("the demo", () => {
const src = readFileSync(join(import.meta.dir, "wear.tsx"), "utf8");
test("has a still of every cause in false colour", () => {
const listed = src.match(/const CAUSES: WearCause\[\] = \[([^\]]+)\]/)![1].match(/"(\w+)"/g)!.map((s) => s.slice(1, -1));
expect(listed.sort()).toEqual(Object.keys(DEBUG_CAUSES).sort());
});
test("draws worn paint with no bake, as <WearExtension> (EX9), from light to heavy", () => {
expect(src).toContain("paint: () => <Paint />");
const amounts = [...src.matchAll(/shape: "\w+", wear: \{ amount: ([\d.]+)/g)].map((m) => Number(m[1]));
expect(amounts).toEqual([0.5, 0.8, 1]);
expect(src).toContain("extension={<WearExtension {...wear} />}");
});
test("draws each of WR9's eight conditions by day and at dusk", () => {
expect(Object.keys(WEAR_CONDITIONS)).toHaveLength(8);
expect(src).toContain("CONDITIONS.flatMap((c) => [");
expect(src).toContain("[`${c}-dusk`, () => <House look={{ ...old, weather: WEAR_CONDITIONS[c] }} sky={SKY[c]} dusk />]");
});
});
+179
View File
@@ -0,0 +1,179 @@
// raea/wear's demo (docs/wear.feature WR7): the corner house (house.ts) baked once and shaded. It is drawn new,
// after 80 years of a coal-burning city, and as a ruin. Each cause appears in false colour, and the house stands
// under each of WR9's eight conditions by day and at dusk. A shower crosses it as a timelapse (rain-passes). `paint`
// is the other wear, worn paint with no bake (<WearExtension>, a material's `wear`; docs/examples.feature EX9).
// bun examples/materials/wear/make-house.ts (once: writes media/house.glb)
// raea render examples/materials/wear/wear.tsx --composition after
// The south front faces +z and the east front +x, so north is -z. The corner stands at (12, 0, 0).
import { AbsoluteFill, Composition, registerRoot, staticFile, useCurrentFrame } from "raea";
import { Cuboid, Cylinder, Model, ToneMapping } from "raea/3d";
import { ExtendedMaterial, ShaderExtension, StandardMaterial, WearExtension, type WearExtensionProps } from "raea/pbr";
import { Camera3d } from "raea/camera";
import { AmbientLight, DirectionalLight } from "raea/light";
import { Mesh3d } from "raea/mesh";
import { Quat, Transform } from "raea/transform";
import { WEAR_CONDITIONS, wearBake, wearDebris, wearShader, weatherAt, type WearAge, type WearCause, type WearCondition, type WearShaderOptions, type WearSpell } from "raea/wear";
import { CLASSES, SOUTH } from "./house";
type V3 = [number, number, number];
/** The house's bake: each material is its own class, Berlin's latitude, the walk round the corner trodden. */
export function bakeHouse() {
return wearBake({
src: staticFile("house.glb"),
env: { up: [0, 1, 0], north: [0, 0, -1], density: 16, walk: ["ground"], sun: { lat: 52.5 } },
classes: Object.fromEntries(CLASSES.map((c) => [c, c])),
});
}
/** The ages the demo shows: a fresh coat, 80 years in a coal-burning city, and 90 years left to go. */
export const AGES = {
new: { years: 0 },
old: { years: 80, soot: 0.85, upkeep: 0.35 },
ruin: { years: 90, soot: 0.85, upkeep: 0.05 },
} as const satisfies Record<string, WearAge>;
/** The light for a time of day and the sky's weather: the sun and its colour, the sky's fill, the backdrop. */
function lightOf(dusk: boolean, sky: "clear" | "overcast" | "storm") {
// the sun from the south-west, so the south front is lit and the east one in shade; at dusk low in the west
const sun: V3 = dusk ? [-30, 4, 12] : [-8, 14, 20];
const dim = sky === "clear" ? 1 : sky === "overcast" ? 0.25 : 0.1;
return {
sun,
lux: (dusk ? 1800 : 9000) * dim,
color: dusk ? "#ffb070" : "#f2ece0",
fill: (dusk ? 140 : 500) * (sky === "clear" ? 1 : 1.4),
fillColor: dusk ? "#5a6890" : sky === "clear" ? "#c4ccd6" : "#a9b0b8",
backdrop: dusk ? (sky === "clear" ? "#3a4568" : "#2a2f3a") : sky === "clear" ? "#aab8c8" : "#8c939b",
};
}
const SKY: Record<WearCondition, "clear" | "overcast" | "storm"> = { spring: "clear", summer: "clear", autumn: "overcast", winter: "clear", snow: "overcast", blizzard: "storm", rain: "overcast", thunder: "storm" };
interface HouseProps {
look?: Omit<WearShaderOptions, "baked">;
debug?: WearCause;
dusk?: boolean;
sky?: "clear" | "overcast" | "storm";
eye?: V3;
at?: V3;
fov?: number;
}
/** The corner house from across the junction, weathered by `look` (or a cause in false colour), with the debris its
* age has brought down on the walk. */
export function House({ look, debug, dusk = false, sky = "clear", eye = [24, 4, 17], at = [9, 6.5, -2], fov = 52 }: HouseProps) {
const baked = bakeHouse();
const shader = look || debug ? wearShader({ baked, ...look, debug }) : undefined;
const debris = look?.age && !debug ? wearDebris(baked, look.age) : [];
const l = lightOf(dusk, sky);
const flat = debug !== undefined;
return (
<AbsoluteFill style={{ background: flat ? "#202020" : l.backdrop }}>
<>
<Camera3d transform={Transform.fromXyz(...eye).lookingAt(at)} projection={{ Perspective: { fov: (fov * Math.PI) / 180, near: 0.1, far: 300 } }} />
<ToneMapping mode={flat ? "none" : "agx"} />
<AmbientLight brightness={flat ? 0 : l.fill} color={l.fillColor} />
<DirectionalLight transform={Transform.fromXyz(...l.sun).lookingAt([6, 4, -4])} illuminance={flat ? 0 : l.lux} color={l.color} shadow_maps_enabled />
<Model name={`corner-house-${debug ?? "look"}`} src={baked.file}>
{shader ? <ExtendedMaterial base={<StandardMaterial />} extension={<ShaderExtension {...shader} />} /> : null}
</Model>
{debris.flatMap((d, i) =>
// a heap is a few lumps of render lying along its front's foot (the east front's runs along z), more and
// bigger under a looser coat; each rests on the walk, which the clipping check reads as passing into the house
lumps(d.loss ?? 0.5, i).map(([u, w, size, yaw], k) => {
const alongX = d.at[0] <= SOUTH.x1;
const half: V3 = [size * (alongX ? 1.6 : 1), size * 0.5, size * (alongX ? 1 : 1.6)];
return (
<Mesh3d key={`${i}-${k}`} allowOverlap transform={Transform.fromXyz(d.at[0] + (alongX ? u : w), d.at[1] + half[1], d.at[2] + (alongX ? w : u)).withRotation(Quat.fromEuler("XYZ", 0, yaw, 0))}>
<Cuboid half_size={half} />
<StandardMaterial base_color={k % 2 ? "#b8ab92" : "#8f8270"} perceptual_roughness={0.95} />
</Mesh3d>
);
}),
)}
</>
</AbsoluteFill>
);
}
/** A heap's lumps: [along the wall, out from it, size, yaw], three to five by its loss potential, placed by its index. */
function lumps(loss: number, seed: number): [number, number, number, number][] {
const r = (k: number) => {
const x = Math.sin(seed * 12.9898 + k * 78.233) * 43758.5453;
return x - Math.floor(x);
};
const n = 3 + Math.round(2 * loss);
return Array.from({ length: n }, (_, k) => [(r(4 * k) - 0.5) * 0.5, (r(4 * k + 1) - 0.5) * 0.18, 0.025 + 0.04 * r(4 * k + 2) * loss, (r(4 * k + 3) - 0.5) * 1.4]);
}
const old = { age: AGES.old };
/** Where the losses are easiest to read: the east front's ground floor and its foot, up close from the walk. */
const NEAR = { eye: [16.8, 1.7, -0.8] as V3, at: [12, 1.2, -4.6] as V3, fov: 50 };
const DOOR = { eye: [8.5, 1.8, 6.5] as V3, at: [6, 1.9, 0] as V3, fov: 50 };
/** A shower crossing the house: dry, raining from minute 6 to 40, drying after. A frame is half a minute. */
export const SHOWER: WearSpell[] = [{ at: 0 }, { at: 6, rain: 1 }, { at: 40 }];
function RainPasses() {
const minutes = useCurrentFrame() * 0.5;
const weather = weatherAt({ day: 130 }, SHOWER, minutes);
const raining = minutes >= 6 && minutes < 40;
return <House look={{ ...old, weather }} sky={raining ? "overcast" : "clear"} />;
}
/** Worn paint with no bake: street iron painted green, its edges chipped to the metal, grime low and rust run down,
* by how worn each is (a bollard, a cabinet turned on the walk, a railing post). */
export const PAINTED: { at: V3; yaw: number; shape: "bollard" | "cabinet" | "post"; wear: WearExtensionProps }[] = [
{ at: [-1.4, 0, 0], yaw: 0, shape: "bollard", wear: { amount: 0.5 } },
{ at: [0.2, 0, -0.3], yaw: 0.6, shape: "cabinet", wear: { amount: 0.8, grime: 0.7, seed: 3 } },
{ at: [1.6, 0, 0.2], yaw: 0, shape: "post", wear: { amount: 1, chips: 0.9, rust: 0.7, rust_color: "#7e4220", seed: 5 } },
];
function Paint() {
const green = <StandardMaterial base_color="#2e5a3c" perceptual_roughness={0.45} metallic={0.1} />;
return (
<AbsoluteFill style={{ background: "#b9c2cc" }}>
<>
<Camera3d transform={Transform.fromXyz(0.4, 1.6, 4.6).lookingAt([0.2, 0.6, 0])} projection={{ Perspective: { fov: 0.7, near: 0.05, far: 50 } }} />
<ToneMapping mode="agx" />
<AmbientLight brightness={500} color="#c4ccd6" />
<DirectionalLight transform={Transform.fromXyz(-3, 5, 4).lookingAt([0, 0, 0])} illuminance={9000} color="#f2ece0" shadow_maps_enabled />
{PAINTED.map(({ at, yaw, shape, wear }) => (
<Mesh3d key={shape} transform={Transform.fromXyz(at[0], at[1] + (shape === "cabinet" ? 0.6 : shape === "post" ? 0.55 : 0.45), at[2]).withRotation(Quat.fromEuler("XYZ", 0, yaw, 0))}>
{shape === "cabinet" ? <Cuboid half_size={[0.4, 0.6, 0.22]} /> : <Cylinder radius={shape === "post" ? 0.06 : 0.11} half_height={shape === "post" ? 0.55 : 0.45} />}
<ExtendedMaterial base={green} extension={<WearExtension {...wear} />} />
</Mesh3d>
))}
<Mesh3d transform={Transform.fromXyz(0, -0.05, 0)}><Cuboid half_size={[4, 0.05, 3]} /><StandardMaterial base_color="#8d8a84" perceptual_roughness={0.9} /></Mesh3d>
</>
</AbsoluteFill>
);
}
const CAUSES: WearCause[] = ["class", "sky", "sun", "cavity", "edge", "flow", "deposit", "touch", "ground", "element", "open", "winter", "drift", "litter", "crack", "loss"];
const CONDITIONS = Object.keys(WEAR_CONDITIONS) as WearCondition[];
export const SHOTS: Record<string, () => JSX.Element> = {
before: () => <House />,
new: () => <House look={{ age: AGES.new }} />,
after: () => <House look={{ ...old, weather: { day: 172 } }} />,
ruin: () => <House look={{ age: AGES.ruin, weather: { day: 172 } }} />,
"ruin-near": () => <House look={{ age: AGES.ruin, weather: { day: 172 } }} {...NEAR} />,
door: () => <House look={{ ...old, weather: { day: 172 } }} {...DOOR} />,
paint: () => <Paint />,
...Object.fromEntries(CAUSES.map((c) => [`debug-${c}`, () => <House debug={c} />])),
...Object.fromEntries(CONDITIONS.flatMap((c) => [
[c, () => <House look={{ ...old, weather: WEAR_CONDITIONS[c] }} sky={SKY[c]} />],
[`${c}-dusk`, () => <House look={{ ...old, weather: WEAR_CONDITIONS[c] }} sky={SKY[c]} dusk />],
])),
};
registerRoot(() => (
<>
{Object.entries(SHOTS).map(([id, Shot]) => (
<Composition key={id} id={id} width={1280} height={800} fps={30} durationInFrames={1} component={Shot} />
))}
<Composition id="rain-passes" width={1280} height={800} fps={30} durationInFrames={120} component={RainPasses} />
</>
));
+13 -3
View File
@@ -59,6 +59,18 @@ impl Codec {
pub fn here(self) -> bool {
cfg!(target_vendor = "apple") || matches!(self, Codec::Rle | Codec::Png)
}
/// It, or what to use instead where this build can't write it.
pub fn usable(self) -> R<Codec> {
if self.here() { Ok(self) } else { Err(format!("{} is written through VideoToolbox, on a Mac: --alpha-codec rle (QuickTime Animation) or png here", self.name())) }
}
/// The codec `--alpha-codec` names (this machine's own when it names none), refused when it can't be written here:
/// what an export asks for before it renders anything, so a Windows PC told prores hears so before the reference
/// render, not after it (#196).
pub fn chosen(flag: Option<&str>) -> R<Codec> {
flag.map_or(Ok(Codec::default_here()), Codec::parse)?.usable()
}
}
/// A transparent movie being written: frames in, `finish` makes the file.
@@ -79,9 +91,7 @@ enum Inner {
impl Writer {
/// A movie of `codec` at `out`; `quality` (0..1) is HEVC's, which the others don't take.
pub fn create(out: &Path, codec: Codec, width: u32, height: u32, fps: f64, quality: f32) -> R<Writer> {
if !codec.here() {
return Err(format!("{} is written through VideoToolbox, on a Mac: use --alpha-codec rle or png here", codec.name()));
}
codec.usable()?;
if width == 0 || height == 0 || width > 0xFFFF || height > 0xFFFF {
return Err(format!("a {width}x{height} movie can't be written"));
}
+1 -4
View File
@@ -11,10 +11,7 @@ use crate::{Codec, R, encode_dir};
/// --manifest, HEVC's quality 0..1), from the frames `render` writes when given the same arguments with -o FOLDER/ and
/// --manifest in place of -o OUT.mov; what it said, APPLIED as the movie.
pub fn render_movie(args: &[String], out: &Path, codec: Option<&str>, manifest: Option<PathBuf>, quality: f32, render: impl Fn(&[String]) -> R<String>) -> R<String> {
let codec = codec.map_or(Ok(Codec::default_here()), Codec::parse)?;
if !codec.here() {
return Err(format!("{} is written through VideoToolbox, on a Mac: --alpha-codec rle (QuickTime Animation) or png here", codec.name()));
}
let codec = Codec::chosen(codec)?;
if let Some(d) = out.parent().filter(|d| !d.as_os_str().is_empty()) {
std::fs::create_dir_all(d).map_err(|e| format!("{}: {e}", d.display()))?;
}
+1 -1
View File
@@ -25,7 +25,7 @@ pub use splat::{ensure_splat, splat_dir, splat_params};
mod local;
use local::*;
mod setup;
pub use setup::{ffmpeg_tool, run_setup, setup_how, uv, venv_python};
pub use setup::{ffmpeg_tool, git, run_setup, setup_how, uv, venv_python};
#[cfg(test)]
mod tests;
+114 -20
View File
@@ -30,18 +30,32 @@ fn on_path(name: &str) -> Option<PathBuf> {
std::env::split_paths(&std::env::var_os("PATH")?).map(|d| d.join(&exe)).find(|p| p.is_file())
}
/// The FFmpeg raea fetches on Windows when none is installed: GyanD's essentials build (the one winget's
/// Gyan.FFmpeg.Essentials installs), kept on GitHub for each release; its SHA-256 is GitHub's digest for the asset
const FFMPEG: &str = "9.0.2";
const FFMPEG_SUM: &str = "60f467265b1e312373dbcd92200c2618a74850f98d3d078e94296bb3fa2047ba";
/// The tool shipped beside raea's own executable: on Windows the release puts FFmpeg and uv in raea.exe's bin/// (tools/release/win-bundle.sh), so raea finds them however it was started and fetches nothing
fn beside_exe(name: &str) -> Option<PathBuf> {
beside(&std::env::current_exe().ok()?, name)
}
/// `ffmpeg` or `ffprobe` as raea runs it: the one on the PATH; else raea's own in $RAEA_TOOLS_CACHE (else
/// ~/.cache/raea-tools)/ffmpeg/bin. On Windows, where FFmpeg is rarely installed, raea's own is fetched there once
/// (114 MB; ffmpeg.exe, ffprobe.exe and its LICENSE kept, about 210 MB) the first time a video raea's own decoders
/// can't read needs it, when `fetch`: H.264 with B-frames, HEVC, VP9 (a phone's or a camera's). Elsewhere FFmpeg is
/// the system's: a Mac reads those on VideoToolbox, and Linux has FFmpeg in its package manager.
fn beside(exe_path: &Path, name: &str) -> Option<PathBuf> {
Some(exe_path.parent()?.join(exe(name))).filter(|p| p.is_file())
}
/// The FFmpeg raea ships beside raea.exe on Windows and fetches where it isn't: raea's own build of FFmpeg's release,
/// LGPL 2.1 or later: FFmpeg's own code, zlib and libvpx's decoders, its H.264 encoder Windows' own (Media
/// Foundation) (tools/release/ffmpeg-win.sh, published with its source as the prerelease tools-ffmpeg-9.0.2-lgpl). Until 0.1.8 raea fetched GyanD's essentials build, GPLv3 with GPL libraries
/// linked in, which raea couldn't ship. tools/release/win-bundle.sh reads these pins.
const FFMPEG: &str = "9.0.2";
const FFMPEG_TOP: &str = "ffmpeg-9.0.2-lgpl-win64";
const FFMPEG_URL: &str = "https://github.com/shinyobjectz/raea/releases/download/tools-ffmpeg-9.0.2-lgpl/ffmpeg-9.0.2-lgpl-win64.zip";
const FFMPEG_SUM: &str = "d3a3d8cdcd3ee488a94328200293a312e9c81923902b9fc3c9fa5dd18779ba8c";
/// `ffmpeg` or `ffprobe` as raea runs it: the one on the PATH; else the one beside raea's executable (the Windows
/// release ships it there); else raea's own in $RAEA_TOOLS_CACHE (else ~/.cache/raea-tools)/ffmpeg/bin. On Windows,
/// where FFmpeg is rarely installed, raea's own is fetched there once the first time a video raea's own decoders
/// can't read needs it, when `fetch`, if the release's copy is missing: H.264 with B-frames, HEVC, VP9 (a phone's or a
/// camera's). Elsewhere FFmpeg is the system's: a Mac reads those on VideoToolbox, and Linux has FFmpeg in its package
/// manager.
pub fn ffmpeg_tool(name: &str, fetch: bool) -> Result<PathBuf, String> {
if let Some(p) = on_path(name) {
if let Some(p) = on_path(name).or_else(|| beside_exe(name)) {
return Ok(p);
}
let dir = raea_io_home::env_path("RAEA_TOOLS_CACHE", ".cache/raea-tools").join("ffmpeg");
@@ -63,13 +77,11 @@ pub fn ffmpeg_tool(name: &str, fetch: bool) -> Result<PathBuf, String> {
return Ok(bin);
}
raea_io_home::offline(&format!("fetching FFmpeg {FFMPEG} to read a video raea's own decoders can't"))?;
eprintln!("raea: this video needs FFmpeg, which isn't installed; fetching FFmpeg {FFMPEG} (114 MB, once) into {}", dir.display());
let name_zip = format!("ffmpeg-{FFMPEG}-essentials_build.zip");
let url = format!("https://github.com/GyanD/codexffmpeg/releases/download/{FFMPEG}/{name_zip}");
let top = format!("ffmpeg-{FFMPEG}-essentials_build");
let members = [format!("{top}/bin/ffmpeg.exe"), format!("{top}/bin/ffprobe.exe"), format!("{top}/LICENSE")];
eprintln!("raea: this video needs FFmpeg, which isn't installed; fetching FFmpeg {FFMPEG} (once) into {}", dir.display());
let name_zip = format!("{FFMPEG_TOP}.zip");
let members = [format!("{FFMPEG_TOP}/bin/ffmpeg.exe"), format!("{FFMPEG_TOP}/bin/ffprobe.exe"), format!("{FFMPEG_TOP}/LICENSE")];
let part = dir.with_file_name(format!("ffmpeg.part{}", std::process::id()));
let fetched = fetch_archive(&part, &url, &name_zip, FFMPEG_SUM, true, &members.each_ref().map(String::as_str));
let fetched = fetch_archive(&part, FFMPEG_URL, &name_zip, FFMPEG_SUM, true, &members.each_ref().map(String::as_str));
settle(&part, &dir, &bin, fetched, "FFmpeg")
}
@@ -78,13 +90,14 @@ pub fn venv_python(dir: &Path) -> PathBuf {
if cfg!(windows) { dir.join(".venv").join("Scripts").join("python.exe") } else { dir.join(".venv").join("bin").join("python") }
}
/// uv: $RAEA_UV, the one on the PATH, or raea's own, fetched the first time (about 20 MB) into $RAEA_TOOLS_CACHE (else
/// ~/.cache/raea-tools)/uv, as tools/ensure.sh does
/// uv: $RAEA_UV, the one on the PATH, the one beside raea's executable (the Windows release ships it there), or
/// raea's own, fetched the first time (about 20 MB) into $RAEA_TOOLS_CACHE (else ~/.cache/raea-tools)/uv, as
/// tools/ensure.sh does
pub fn uv() -> Result<PathBuf, String> {
if let Some(p) = std::env::var_os("RAEA_UV").map(PathBuf::from).filter(|p| p.is_file()) {
return Ok(p);
}
if let Some(p) = on_path("uv") {
if let Some(p) = on_path("uv").or_else(|| beside_exe("uv")) {
return Ok(p);
}
let dir = raea_io_home::env_path("RAEA_TOOLS_CACHE", ".cache/raea-tools").join("uv");
@@ -111,6 +124,62 @@ pub fn uv() -> Result<PathBuf, String> {
settle(&part, &dir, &bin, fetched, "uv")
}
/// The Git for Windows raea fetches where there's none (the app's host, apps/app host/tools.ts WIN_GIT, fetches the same
/// into the same folder, so either finds the other's): dugite-native's portable build with git-lfs, GitHub Desktop's
const WIN_GIT_URL: &str = "https://github.com/desktop/dugite-native/releases/download/v2.56.0-2/dugite-native-v2.56.0-a44aeca-windows-x64.tar.gz";
const WIN_GIT_DIR: &str = "git-v2.56.0-2-windows-x64";
const WIN_GIT_SUM: &str = "f1e17876337d7be143e5d51976da36643d65528125cfbc14d57f171de0fd5f14";
/// git, which a workspace is (raea workspace, project, controller): $RAEA_GIT, else the one on the PATH. On Windows,
/// where Git is rarely installed, then the raea app's (its installer puts Git in its folder, which Settings > Apps
/// keeps as InstallLocation), a Git for Windows that isn't on the PATH, and raea's own in $RAEA_TOOLS_CACHE (else
/// ~/.cache/raea-tools), fetched there the first time (47 MB). Until 0.1.8 raea.exe took git from the PATH only, and on
/// a PC with only the app's every workspace command failed with "git: program not found" (#169).
pub fn git() -> Result<PathBuf, String> {
if let Some(p) = std::env::var_os("RAEA_GIT").map(PathBuf::from).filter(|p| p.is_file()) {
return Ok(p);
}
if let Some(p) = on_path("git") {
return Ok(p);
}
if !cfg!(windows) {
let how = if cfg!(target_os = "macos") { "xcode-select --install" } else { "apt install git, or dnf install git" };
return Err(format!("raea's workspaces are git repos, and git isn't installed: {how}"));
}
let cache = raea_io_home::env_path("RAEA_TOOLS_CACHE", ".cache/raea-tools").join(WIN_GIT_DIR);
let bin = cache.join("cmd").join("git.exe");
if let Some(p) = windows_gits().into_iter().chain([bin.clone()]).find(|p| p.is_file()) {
return Ok(p);
}
static FETCHING: std::sync::Mutex<()> = std::sync::Mutex::new(());
let _one = FETCHING.lock().unwrap_or_else(|e| e.into_inner());
if bin.is_file() {
return Ok(bin);
}
raea_io_home::offline("fetching Git for Windows: raea's workspaces are git repos")?;
eprintln!("raea: a workspace is a git repo, and this PC has no Git; fetching raea's own (Git for Windows, once, 47 MB) into {}", cache.display());
let part = cache.with_file_name(format!("{WIN_GIT_DIR}.part{}", std::process::id()));
let fetched = fetch_archive(&part, WIN_GIT_URL, "git.tar.gz", WIN_GIT_SUM, false, &[]);
// it runs before it's taken, as the app's host checks it
let runs = |p: &Path| std::process::Command::new(p).arg("--version").output().is_ok_and(|o| o.status.success());
let fetched = fetched.and_then(|()| if runs(&part.join("cmd").join("git.exe")) { Ok(()) } else { Err("the Git raea fetched doesn't run".into()) });
settle(&part, &cache, &bin, fetched, "Git for Windows")
}
/// The gits a Windows PC may have off its PATH: the raea app's (its install folder's git\cmd), else in the folder its
/// installer uses by default, and Git for Windows' own for everyone and for the one account.
fn windows_gits() -> Vec<PathBuf> {
let key = r"HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\raea";
let reg = std::process::Command::new("reg").args(["query", key, "/v", "InstallLocation"]).output().ok();
let app = reg.and_then(|o| String::from_utf8_lossy(&o.stdout).lines().find_map(|l| l.trim().strip_prefix("InstallLocation").map(|v| v.trim().trim_start_matches("REG_EXPAND_SZ").trim_start_matches("REG_SZ").trim().to_string())));
let env = |k: &str| std::env::var_os(k).map(PathBuf::from);
let mut at: Vec<PathBuf> = app.filter(|d| !d.is_empty()).map(|d| PathBuf::from(d).join("git")).into_iter().collect();
at.extend(env("LOCALAPPDATA").map(|d| d.join("Programs").join("raea").join("git")));
at.extend(env("ProgramFiles").map(|d| d.join("Git")));
at.extend(env("LOCALAPPDATA").map(|d| d.join("Programs").join("Git")));
at.into_iter().map(|d| d.join("cmd").join("git.exe")).collect()
}
/// A fetch's end: its `part` folder moved in as `dir` when it's whole and nothing got there first, the part removed,
/// and, once the tool is in place, the parts stopped fetches left beside it swept (`NAME.part<pid>`, from a Ctrl+C or
/// a killed process: FFmpeg's held a 114 MB zip, and each run made a new one). A part another process is still
@@ -192,6 +261,31 @@ pub fn run_setup(script: &Path, var: &str, dir: &Path) -> Result<std::process::E
mod tests {
use super::*;
// the release's own copy beside the executable is found; a missing one isn't
#[test]
fn a_tool_beside_the_executable_is_found() {
let root = std::env::temp_dir().join(format!("raea-beside-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&root);
std::fs::create_dir_all(root.join("bin")).unwrap();
std::fs::write(root.join("bin").join(exe("ffmpeg")), b"").unwrap();
let raea = root.join("bin").join(exe("raea"));
assert_eq!(beside(&raea, "ffmpeg"), Some(root.join("bin").join(exe("ffmpeg"))));
assert_eq!(beside(&raea, "uv"), None);
let _ = std::fs::remove_dir_all(&root);
}
// the pins tools/release/win-bundle.sh reads: one line each, as its sed expects
#[test]
fn the_bundle_reads_these_pins() {
let src = include_str!("setup.rs");
for c in ["FFMPEG_URL", "FFMPEG_SUM", "FFMPEG_TOP", "UV"] {
assert_eq!(src.lines().filter(|l| l.starts_with(&format!("const {c}: &str = \""))).count(), 1, "{c}");
}
assert!(FFMPEG_URL.ends_with(&format!("/{FFMPEG_TOP}.zip")) && FFMPEG_TOP.contains(FFMPEG));
assert!(FFMPEG_SUM.len() == 64 && FFMPEG_SUM.bytes().all(|b| b.is_ascii_hexdigit()), "FFMPEG_SUM is a sha256");
assert!(src.contains(" (\"x86_64-pc-windows-msvc\", \""));
}
// a fetch's end sweeps the parts stopped fetches left beside its tool, and only those
#[test]
fn settle_sweeps_stopped_fetches() {
@@ -203,7 +297,7 @@ mod tests {
std::fs::write(p.join(f), b"x").unwrap();
};
// two stopped fetches (one with its zip), another tool's part, and this run's finished part
mk(&root.join("ffmpeg.part111"), "ffmpeg-9.0.2-essentials_build.zip");
mk(&root.join("ffmpeg.part111"), "ffmpeg-9.0.2-lgpl-win64.zip");
mk(&root.join("ffmpeg.part222"), "x");
mk(&root.join("uv.part333"), "x");
let part = root.join("ffmpeg.part444");
+12
View File
@@ -46,6 +46,18 @@ fn says(option: &str) -> String {
String::from_utf8_lossy(&out).into_owned()
}
/// The H.264 encoder this machine's ffmpeg has, as its arguments, for a clip a person plays (in a browser or on a
/// phone): libx264 where ffmpeg was built with it (Homebrew's, Linux distributions'), else the system's own (Windows'
/// Media Foundation, h264_mf, in the LGPL build raea ships there; macOS's VideoToolbox) at 8 Mb/s; None without one.
pub fn h264() -> Option<Vec<&'static str>> {
static ENCODERS: std::sync::OnceLock<String> = std::sync::OnceLock::new();
let have = ENCODERS.get_or_init(|| says("-encoders"));
let has = |c: &str| have.split_whitespace().any(|w| w == c);
let enc = ["libx264", "h264_mf", "h264_videotoolbox"].into_iter().find(|c| has(c))?;
let rate: &[&'static str] = if enc == "libx264" { &[] } else { &["-b:v", "8M"] };
Some([&["-c:v", enc][..], rate, &["-pix_fmt", "yuv420p"]].concat())
}
/// The facts, the presentation times, whether the colour matrix is untagged, and the decoder a VP8 or VP9 stream with
/// alpha needs (libvpx: ffmpeg's own VP9 decoder drops the alpha WebM keeps beside the picture, #113).
fn probe(path: &Path) -> R<(Info, Vec<f64>, bool, Option<&'static str>)> {
+6
View File
@@ -282,6 +282,12 @@ pub fn h264_encoder(out: &Path, o: &EncodeOpts, intra_qp: Option<u8>) -> R<Box<d
.rate_control_mode(RateControlMode::Bitrate)
// every frame is a sample: rate control may not drop one (the edit has a frame for every tick)
.skip_frames(false)
// no background detection: it takes a slowly changing dark ground (a night scene's sky, a glow drifting over
// black) for still and copies its old blocks forward, which undoes the bits adaptive quantization gives flat
// darks. A dim glow drifting at --quality master blotched in every sampled frame (6-8% of dark blocks
// stepping, raea check) at any bitrate or quantiser; without it, 0.1%, as a lossless encode of the same
// frames (#169). Adaptive quantization stays on: off, the darks blotch with or without this.
.background_detection(false)
// BT.709 limited range, as raea_io_codec::yuv converts the frames and as the Mac's encoder tags them (vt.rs):
// untagged, ffmpeg and other players read it as BT.601 and shift reds and greens
.vui(openh264::encoder::VuiConfig::bt709());
+41
View File
@@ -75,3 +75,44 @@ fn a_quantiser_below_openh264s_floor_is_its_floor() {
// openh264 refuses a pinned QP under 14 with rate control on (Native:3); asked for less, it gets 14
assert!(gop(4) == gop(14));
}
/// A dim glow drifting over near-black, frame `k` of a slow move: the flat darks of a night scene, which openh264's
/// background detection took for still ground and copied forward from earlier frames (#169, "the encoder starved the
/// near-blacks" at --quality master on Windows)
fn glow(w: u32, h: u32, k: u32) -> Vec<u8> {
let (cx, cy, r) = (w as f32 * (0.3 + k as f32 * 0.004), h as f32 * 0.45, w as f32 * 0.8);
(0..w * h).flat_map(|i| {
let (dx, dy) = ((i % w) as f32 - cx, (i / w) as f32 - cy);
let v = (2.0 + 36.0 * (1.0 - (dx * dx + dy * dy).sqrt() / r).max(0.0).powi(2)).round() as u8;
[v, v, v, 255]
}).collect()
}
/// The share of 8x8 blocks whose mean red is more than a level off between two RGBA pictures
fn blocks_off(a: &[u8], b: &[u8], w: u32, h: u32) -> f64 {
let (bw, bh) = (w as usize / 8, h as usize / 8);
let mean = |p: &[u8], bx: usize, by: usize| (0..64).map(|k| p[((by * 8 + k / 8) * w as usize + bx * 8 + k % 8) * 4] as f32).sum::<f32>() / 64.0;
let off = (0..bw * bh).filter(|i| (mean(a, i % bw, i / bw) - mean(b, i % bw, i / bw)).abs() > 1.0).count();
off as f64 / (bw * bh) as f64
}
#[test]
fn a_dark_glow_drifting_keeps_every_block_at_master() {
use raea_io_codec::Backend;
let (w, h, n) = (640, 360, 45);
let o = EncodeOpts { width: w, height: h, fps: 30.0, kbps: 10_000, quality: Some(0.95), nv12: false, realtime: false };
let out = std::env::temp_dir().join(format!("raea-soft-darks-{}.mp4", std::process::id()));
let mut enc = h264_encoder(&out, &o, None).unwrap();
for k in 0..n {
enc.push(&glow(w, h, k)).unwrap();
}
enc.finish(None).unwrap();
let mut dec = raea_io_soft::Soft.open_video(&out).unwrap();
let last = dec.frame_at((n - 1) as f64 / 30.0).unwrap();
let _ = std::fs::remove_file(&out);
let off = blocks_off(&last.rgba, &glow(w, h, n - 1), w, h);
eprintln!("blocks off by more than a level: {:.2}%", off * 100.0);
// with background detection on, the ground lagged the glow: blocks stood where earlier frames had left them, 5.3% of
// them more than a level off by frame 44; without it 1.6% (the rest is the quantiser's)
assert!(off < 0.03, "{:.1}% of 8x8 blocks more than a level off the picture at frame {}", off * 100.0, n - 1);
}
+4 -2
View File
@@ -79,8 +79,10 @@
g.__ui_frame = 0;
g.__ui_setFrame = (n) => void (g.__ui_frame = n);
// Number's toLocaleString through one Intl.NumberFormat per locale and options, kept (JavaScriptCore made a
// formatter at every call: a counter formatted each frame was most of its frame). Only where there's an Intl
if (typeof Intl !== "undefined" && Intl.NumberFormat) {
// formatter at every call: a counter formatted each frame was most of its frame). Only where there's an Intl, asked
// with `in`: QuickJS's (raea-runtime-jsengine js/intl) is unpacked the first time it's read, and a page that never
// formats shouldn't pay for it
if ("Intl" in globalThis) {
const formats = new Map();
const toLocale = Number.prototype.toLocaleString;
Object.defineProperty(Number.prototype, "toLocaleString", {
+6 -1
View File
@@ -11,11 +11,14 @@ name = "raea_runtime_jsengine"
[features]
# QuickJS on Apple too, beside JavaScriptCore: how the portable path is tested on a Mac
portable = ["dep:rquickjs"]
portable = ["dep:rquickjs", "dep:miniz_oxide", "dep:iana-time-zone"]
[dependencies]
raea-io-home = { path = "../../io/home" }
rquickjs = { version = "0.14", optional = true, features = ["loader"] }
# QuickJS's Intl (js/intl): its pack's chunks are raw deflate, and the date polyfill's default zone is the system's
miniz_oxide = { version = "0.8", optional = true }
iana-time-zone = { version = "0.1", optional = true }
[target.'cfg(target_vendor = "apple")'.dependencies]
# JavaScriptCore's Objective-C module loader (JSScript, JSModuleLoaderDelegate): ES modules on the system engine
@@ -23,3 +26,5 @@ objc2 = "0.6"
[target.'cfg(not(target_vendor = "apple"))'.dependencies]
rquickjs = { version = "0.14", features = ["loader"] }
miniz_oxide = "0.8"
iana-time-zone = "0.1"
Binary file not shown.
+56
View File
@@ -0,0 +1,56 @@
MIT License
Copyright (c) 2022, 2023, 2026 FormatJS (intl-supportedvaluesof 2022, the polyfills 2023, bigdecimal 2026)
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.
---
The locale data (each locale's entry in intl.pack, and the English in its core) is FormatJS's, made from the Unicode
Common Locale Data Repository (CLDR), under the Unicode License:
UNICODE LICENSE V3
COPYRIGHT AND PERMISSION NOTICE
Copyright © Unicode, Inc.
NOTICE TO USER: Carefully read the following legal agreement. BY
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
Permission is hereby granted, free of charge, to any person obtaining a
copy of data files and any associated documentation (the "Data Files") or
software and any associated documentation (the "Software") to deal in the
Data Files or Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, and/or sell
copies of the Data Files or Software, and to permit persons to whom the
Data Files or Software are furnished to do so, provided that either (a)
this copyright and permission notice appear with all copies of the Data
Files or Software, or (b) this copyright and permission notice appear in
associated Documentation.
THE DATA FILES AND SOFTWARE ARE 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 OF
THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL 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 PERFORMANCE OF THE DATA
FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in these Data Files or Software without prior written
authorization of the copyright holder.
SPDX-License-Identifier: Unicode-3.0
+38
View File
@@ -0,0 +1,38 @@
// QuickJS's Intl, packed (docs/ports.feature PT0b): `bun install --frozen-lockfile && bun build.ts` here writes
// ../intl.pack, which raea-runtime-jsengine embeds (src/quickjs.rs) and loader.js reads. QuickJS has no Intl, so a
// composition that formatted a number threw "Intl is not defined" on Windows and Linux (#169) while JavaScriptCore,
// the Mac's, formatted it. The pack is entries of [name length u16][name][length u32][raw deflate], little-endian:
// "core" (core.js bundled: FormatJS's polyfills, English, the common time zones), "index" (the JSON list of the other
// locales) and one entry per locale, its data for each polyfill that has some. Uncompressed the 37 locales are 20 MB.
import { deflateRawSync } from "node:zlib";
import { existsSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const here = import.meta.dir;
/** the locales besides English: the languages most of raea's people write in, and the regions that format apart */
export const LOCALES = ["en-GB", "en-AU", "en-CA", "en-IN", "de", "fr", "fr-CA", "es", "es-419", "es-MX", "it", "pt", "pt-PT", "nl", "sv", "da", "nb", "fi", "pl", "cs", "sk", "hu", "ro", "el", "tr", "ru", "uk", "he", "ar", "hi", "bn", "th", "id", "ms", "vi", "ja", "ko", "zh", "zh-Hant", "fil"];
const DATA = ["intl-pluralrules", "intl-numberformat", "intl-datetimeformat", "intl-relativetimeformat", "intl-listformat"];
const built = await Bun.build({ entrypoints: [join(here, "core.js")], minify: true, format: "iife", target: "browser" });
if (!built.success) throw new Error(built.logs.join("\n"));
const licence = readFileSync(join(here, "LICENSE-FormatJS.md"), "utf8").trim().split("\n").map((l) => ` * ${l}`.trimEnd()).join("\n");
const core = `/*\n * FormatJS's Intl polyfills, packed for raea's QuickJS (runtime/jsengine/js/intl):\n${licence}\n */\n${await built.outputs[0].text()}`;
const entries: [string, string][] = [["core", core], ["index", JSON.stringify(LOCALES)]];
for (const l of LOCALES) {
const parts = DATA.map((p) => join(here, "node_modules/@formatjs", p, "locale-data", `${l}.js`)).filter(existsSync);
if (parts.length < 4) throw new Error(`${l}: data for ${parts.length} of the ${DATA.length} polyfills`);
entries.push([l, parts.map((f) => readFileSync(f, "utf8")).join(";\n")]);
}
const chunks: Buffer[] = [];
for (const [name, src] of entries) {
const n = Buffer.from(name), z = deflateRawSync(Buffer.from(src), { level: 9 });
const head = Buffer.alloc(6 + n.length);
head.writeUInt16LE(n.length, 0);
n.copy(head, 2);
head.writeUInt32LE(z.length, 2 + n.length);
chunks.push(head, z);
}
const pack = Buffer.concat(chunks);
writeFileSync(join(here, "..", "intl.pack"), pack);
console.log(`intl.pack: ${entries.length} entries, ${(pack.length / 1024).toFixed(0)} KB (core ${(core.length / 1024).toFixed(0)} KB before deflate)`);
+41
View File
@@ -0,0 +1,41 @@
{
"lockfileVersion": 2,
"configVersion": 1,
"workspaces": {
"": {
"name": "raea-intl",
"dependencies": {
"@formatjs/intl-datetimeformat": "8.0.2",
"@formatjs/intl-getcanonicallocales": "3.3.0",
"@formatjs/intl-listformat": "9.0.1",
"@formatjs/intl-locale": "5.4.2",
"@formatjs/intl-numberformat": "10.0.2",
"@formatjs/intl-pluralrules": "7.0.2",
"@formatjs/intl-relativetimeformat": "13.0.1",
},
},
},
"packages": {
"@formatjs/bigdecimal": ["@formatjs/[email protected]", "", {}, "sha512-npIs6UARNOg5amJY5UOVsd6HUQQfzYjet0sa0SWIqzsnVhxLSpaIx2DjoIVrr/vqmjURjvroeW6dItjfy3Uf8A=="],
"@formatjs/fast-memoize": ["@formatjs/[email protected]", "", {}, "sha512-zXfhLpvA6T7+efdt9JLbBwZ00tT7NsBMDVnDu8rpHeNNv8KfRZAMo2gkG0k9lK/Nzc//3kJ9pImsfuJxk3KhUA=="],
"@formatjs/intl-datetimeformat": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/bigdecimal": "0.2.10", "@formatjs/intl-localematcher": "0.10.1" } }, "sha512-isKDo8jeQ8VoYvrweku92ajF/Z9fJ76DDnw2eCmKBTJTwZa5GeGl4u40RJiFYPbR6ROluvN0CsbNtGtnd2NyIQ=="],
"@formatjs/intl-getcanonicallocales": ["@formatjs/[email protected]", "", {}, "sha512-ndj9jw/LHAftSe34D/A6+lj3Y7GHVfPEZ6FZP2wjd8/beYeh3d1sjlSpZSBlzegSKS3U3mUEIzLCpI0+jKNT6w=="],
"@formatjs/intl-listformat": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/intl-localematcher": "0.10.1" } }, "sha512-V7kMddXDOLeyXAVCBEp8eBnllmPMBqu39U1GO/82xzlaUyK/Gkc3Qgal+9HJx6n1xfCvUn7XHK5t5dSlF7Y2lA=="],
"@formatjs/intl-locale": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/intl-getcanonicallocales": "3.3.0", "@formatjs/intl-supportedvaluesof": "3.0.0" } }, "sha512-2upVZtpzktEkLMffAk14T2HB62B7ytqrlppZuVX4StnbOHNc4qx5ovimMMMn8mkqvAwFlPX+UZygetny+quqIQ=="],
"@formatjs/intl-localematcher": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/fast-memoize": "3.1.7" } }, "sha512-gBqglQK9rXuHsLmM8wzTMBy4Xo4d0jamirIVKuEL8F1rwbskWdpMA1kZarSkny+uvr5q/K6GSzE0Rcq1wZLl3g=="],
"@formatjs/intl-numberformat": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/bigdecimal": "0.2.10", "@formatjs/intl-localematcher": "0.10.1" } }, "sha512-iLS3ly1lGZ/a/IVpcSUgC37RjQUZ2wN6zR9+Zbr2uXsxATfMLD+fBqggiXuFudLmZXpbPueCs4Mz3vDsaOVE9A=="],
"@formatjs/intl-pluralrules": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/bigdecimal": "0.2.10", "@formatjs/intl-localematcher": "0.10.1" } }, "sha512-PJ4+ldlqXlo3csmP02u2HqyXw09TDB/fatYpDCyWryfEQeVWl2EbMzij9SBksPaW2U//+q69lXR3IMnCRQAmrw=="],
"@formatjs/intl-relativetimeformat": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/intl-localematcher": "0.10.1" } }, "sha512-Gl5dCHb7elEC19tTzxIyllWLHaHnN+HpQYEaA9xxAt9rKgRLwC3vGty1w8bVGG7p2YcGSPIg5c4qn4KdkGcTqg=="],
"@formatjs/intl-supportedvaluesof": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/fast-memoize": "3.1.7" } }, "sha512-9rG37qcIBFyX+HSyPelJKpAatFaO+ElvnWYO/FFMERVZG9e9Wj51CWAvF7+ozYd7B1uKBL2ub6aLzrkWA0UBxA=="],
}
}
+16
View File
@@ -0,0 +1,16 @@
// Generated into ../intl.pack by build.ts: the Intl QuickJS lacks, FormatJS's polyfills (MIT, LICENSE-FormatJS.md)
// in the order each needs the one before, with English's data and the common time zones. Every other locale's data is
// its own chunk in the pack, run the first time a script asks for that locale (loader.js).
import "@formatjs/intl-getcanonicallocales/polyfill.js";
import "@formatjs/intl-locale/polyfill.js";
import "@formatjs/intl-pluralrules/polyfill.js";
import "@formatjs/intl-pluralrules/locale-data/en.js";
import "@formatjs/intl-numberformat/polyfill.js";
import "@formatjs/intl-numberformat/locale-data/en.js";
import "@formatjs/intl-datetimeformat/polyfill.js";
import "@formatjs/intl-datetimeformat/locale-data/en.js";
import "@formatjs/intl-datetimeformat/add-golden-tz.js";
import "@formatjs/intl-relativetimeformat/polyfill.js";
import "@formatjs/intl-relativetimeformat/locale-data/en.js";
import "@formatjs/intl-listformat/polyfill.js";
import "@formatjs/intl-listformat/locale-data/en.js";
+148
View File
@@ -0,0 +1,148 @@
// QuickJS's Intl (src/quickjs.rs runs this first in every context): JavaScriptCore, the Mac's engine, has Intl, and
// QuickJS, Windows' and Linux's, has none, so a composition that formatted a number threw there (#169). FormatJS's
// polyfills are the core of intl.pack (build.ts), unpacked and run the first time anything reads Intl or calls a
// toLocale* method, so a script that never formats pays nothing; a locale's data runs the first time something asks
// for that locale. FormatJS has no Collator: the small one here sorts by letter, then accent, then case (lower first),
// as ICU's root order does for words, and needs none of the core.
(() => {
const g = globalThis;
if (typeof g.Intl !== "undefined") return;
const chunk = g.__raea_intl_chunk;
const zone = g.__raea_intl_zone;
delete g.__raea_intl_chunk;
delete g.__raea_intl_zone;
const run = (src) => (0, eval)(src);
let intl;
let packed = [];
const loaded = new Set(["en"]);
// the pack's locale for a tag: itself, else its language (zh-TW, zh-HK and zh-MO are written as zh-Hant)
const packedFor = (tag) => {
const t = String(tag);
const traditional = /^zh-(Hant|TW|HK|MO)\b/i.test(t) ? "zh-Hant" : null;
for (const c of [t, traditional, t.split("-")[0]]) {
const hit = c && packed.find((p) => p.toLowerCase() === c.toLowerCase());
if (hit) return hit;
}
return null;
};
const need = (locales) => {
boot();
const tags = locales === undefined || locales === null ? [] : typeof locales === "string" || typeof locales[Symbol.iterator] !== "function" ? [locales] : [...locales];
for (const tag of tags) {
const p = packedFor(tag);
if (p && !loaded.has(p)) {
loaded.add(p);
run(chunk(p));
}
}
};
// a constructor that runs its locales' data first: the same prototype (instanceof holds), and its statics
const wrap = (Native) => {
function Intl(locales, options) {
need(locales);
return new.target ? Reflect.construct(Native, [locales, options], new.target === Intl ? Native : new.target) : Native(locales, options);
}
Object.setPrototypeOf(Intl, Native);
Object.defineProperty(Intl, "name", { value: Native.name });
Intl.prototype = Native.prototype;
if (Native.supportedLocalesOf) Intl.supportedLocalesOf = (locales, options) => (need(locales), Native.supportedLocalesOf(locales, options));
return Intl;
};
// the toLocale* methods: until the core runs, each is one of these, which runs it and then FormatJS's own
// (impl); whatever wraps them later (raea-runtime-js's prelude keeps one NumberFormat per locale) is kept
const METHODS = [[Number.prototype, "toLocaleString"], [Date.prototype, "toLocaleString"], [Date.prototype, "toLocaleDateString"], [Date.prototype, "toLocaleTimeString"]];
if (typeof BigInt !== "undefined") METHODS.push([BigInt.prototype, "toLocaleString"]);
const impl = METHODS.map(([proto, name]) => proto[name]);
METHODS.forEach(([proto, name], i) => {
const mine = { [name](locales, options) {
need(locales);
return impl[i].call(this, locales, options);
} }[name];
Object.defineProperty(proto, name, { value: mine, writable: true, configurable: true });
});
let booting = false;
const boot = () => {
if (intl) return intl;
// the core asking for Intl while it runs gets what it has made so far, not a second core
if (booting) return g.Intl;
booting = true;
const before = METHODS.map(([proto, name]) => proto[name]);
delete g.Intl;
run(chunk("core"));
intl = g.Intl;
packed = JSON.parse(chunk("index"));
METHODS.forEach(([proto, name], i) => {
if (proto[name] !== before[i]) impl[i] = proto[name];
Object.defineProperty(proto, name, { value: before[i], writable: true, configurable: true });
});
if (zone) {
try {
intl.DateTimeFormat.__setDefaultTimeZone(zone);
} catch {
// a zone outside the common ones in the pack: UTC
}
}
const put = (k, v) => Object.defineProperty(intl, k, { value: v, writable: true, configurable: true });
for (const k of ["DateTimeFormat", "NumberFormat", "PluralRules", "RelativeTimeFormat", "ListFormat"]) if (intl[k]) put(k, wrap(intl[k]));
put("Collator", Collator);
return intl;
};
const plain = (s) => s.normalize("NFD").replace(/[̀-ͯ]/g, "");
const cmp = (x, y) => (x < y ? -1 : x > y ? 1 : 0);
// numbers in words by their value: "item 2" before "item 10"
const nat = (x, y) => {
const a = x.match(/\d+|\D+/g) ?? [];
const b = y.match(/\d+|\D+/g) ?? [];
for (let i = 0; i < Math.min(a.length, b.length); i++) {
const d = /^\d/.test(a[i]) && /^\d/.test(b[i]) ? Number(a[i]) - Number(b[i]) : cmp(a[i], b[i]);
if (d) return Math.sign(d);
}
return Math.sign(a.length - b.length);
};
class Collator {
constructor(locales, o = {}) {
const tag = (typeof locales === "string" ? locales : locales?.[0]) ?? "en";
this.o = { locale: String(tag), usage: o.usage ?? "sort", sensitivity: o.sensitivity ?? "variant", ignorePunctuation: !!o.ignorePunctuation, collation: "default", numeric: !!o.numeric, caseFirst: o.caseFirst ?? "false" };
const { sensitivity: s, caseFirst } = this.o;
const by = this.o.numeric ? nat : cmp;
const drop = this.o.ignorePunctuation ? (x) => x.replace(/[\p{P}\s]/gu, "") : (x) => x;
this.compare = (a, b) => {
const x = drop(String(a));
const y = drop(String(b));
const letters = by(plain(x).toLowerCase(), plain(y).toLowerCase());
if (letters || s === "base") return letters;
if (s !== "case") {
const accents = by(x.toLowerCase(), y.toLowerCase());
if (accents || s === "accent") return accents;
}
// "case": a and A differ, a and á don't
const cased = s === "case" ? by(plain(x), plain(y)) : by(x, y);
return caseFirst === "upper" ? cased : -cased;
};
}
resolvedOptions() {
return { ...this.o };
}
static supportedLocalesOf(locales) {
return boot().getCanonicalLocales(locales ?? []);
}
}
const collators = new Map();
Object.defineProperty(String.prototype, "localeCompare", {
value: function localeCompare(that, locales, options) {
const key = options === undefined && (locales === undefined || typeof locales === "string") ? (locales ?? "") : null;
let c = key === null ? undefined : collators.get(key);
if (!c) {
c = new Collator(locales, options);
if (key !== null && collators.size < 32) collators.set(key, c);
}
return c.compare(String(this), String(that));
},
writable: true,
configurable: true,
});
Object.defineProperty(g, "Intl", { get: boot, set: (v) => Object.defineProperty(g, "Intl", { value: v, writable: true, configurable: true }), configurable: true });
})();
+18
View File
@@ -0,0 +1,18 @@
{
"name": "raea-intl",
"private": true,
"description": "QuickJS's Intl (raea-runtime-jsengine): FormatJS's polyfills and their CLDR data, packed by build.ts into ../intl.pack",
"license": "MIT",
"scripts": {
"build": "bun build.ts"
},
"dependencies": {
"@formatjs/intl-getcanonicallocales": "3.3.0",
"@formatjs/intl-locale": "5.4.2",
"@formatjs/intl-pluralrules": "7.0.2",
"@formatjs/intl-numberformat": "10.0.2",
"@formatjs/intl-datetimeformat": "8.0.2",
"@formatjs/intl-relativetimeformat": "13.0.1",
"@formatjs/intl-listformat": "9.0.1"
}
}
+38
View File
@@ -49,8 +49,33 @@ fn rs(o: &AnyObject) -> String {
}
}
/// `source` with its import.meta.url set when it reads it: macOS 15's JavaScriptCore leaves it undefined for a module
/// from this loader (macOS 27's sets the module's URL), and `new URL("./x.png", import.meta.url)` then threw. `??=`
/// leaves a URL the engine gave alone. On line 1 before the module's own first line (imports are hoisted), so every
/// other line keeps its number; a #! line has to stay first, so it's left as it is.
fn with_meta_url(url: &str, source: &str) -> String {
if !source.contains("import.meta") || source.starts_with("#!") {
return source.to_string();
}
let mut lit = String::with_capacity(url.len() + 2);
lit.push('"');
for c in url.chars() {
match c {
'"' | '\\' => {
lit.push('\\');
lit.push(c);
}
c if (c as u32) < 0x20 || c == '\u{2028}' || c == '\u{2029}' => lit.push_str(&format!("\\u{:04x}", c as u32)),
c => lit.push(c),
}
}
lit.push('"');
format!("import.meta.url ??= {lit};{source}")
}
/// A module script for `url`, or JavaScriptCore's reason it isn't one (a syntax error).
fn script(vm: &AnyObject, url: &str, source: &str) -> Result<Retained<AnyObject>, String> {
let source = &with_meta_url(url, source);
unsafe {
let u: Option<Retained<AnyObject>> = msg_send![objc2::class!(NSURL), URLWithString: &*ns(url)];
let Some(u) = u else { return Err(format!("{url}: not a URL")) };
@@ -146,3 +171,16 @@ impl Modules {
unsafe extern "C" {
fn JSValueProtect(ctx: *const c_void, v: *const c_void);
}
#[cfg(test)]
mod tests {
use super::with_meta_url;
#[test]
fn a_module_that_reads_import_meta_gets_its_url_on_line_one() {
assert_eq!(with_meta_url("file:///m/a.mjs", "export const x = 1;\n"), "export const x = 1;\n");
assert_eq!(with_meta_url("file:///m/a.mjs", "f(import.meta.url);\ng();"), "import.meta.url ??= \"file:///m/a.mjs\";f(import.meta.url);\ng();");
assert_eq!(with_meta_url("file:///C:/a \"b\"\\c.mjs", "import.meta"), "import.meta.url ??= \"file:///C:/a \\\"b\\\"\\\\c.mjs\";import.meta");
assert_eq!(with_meta_url("file:///m/a.mjs", "#!/usr/bin/env raea\nimport.meta.url"), "#!/usr/bin/env raea\nimport.meta.url");
}
}
+46
View File
@@ -230,6 +230,52 @@ mod tests {
assert!(stopped(&e), "{}: {e}", js.name());
}
/// What a composition formats, as JavaScriptCore formats it (#169: QuickJS had no Intl, so these threw on Windows
/// and Linux): numbers, money, percents and compact counts, dates in a zone, plural rules, relative times, lists,
/// and words sorted. Each case is [expression, JavaScriptCore's answer].
const INTL: [(&str, &str); 14] = [
("(1234567.891).toLocaleString('en-US')", "1,234,567.891"),
("(1234567.891).toLocaleString('de-DE')", "1.234.567,891"),
("new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(12.5)", "$12.50"),
("new Intl.NumberFormat('en-US', { style: 'currency', currency: 'EUR' }).format(5000)", "\u{20ac}5,000.00"),
("new Intl.NumberFormat('en', { notation: 'compact' }).format(1234567)", "1.2M"),
("(0.256).toLocaleString('en-US', { style: 'percent' })", "26%"),
("new Intl.NumberFormat('zh-TW').format(1234.5)", "1,234.5"),
("new Intl.DateTimeFormat('en-GB', { dateStyle: 'long', timeZone: 'UTC' }).format(new Date(Date.UTC(2026, 10, 19)))", "19 November 2026"),
("new Intl.DateTimeFormat('fr-FR', { weekday: 'long', day: 'numeric', month: 'long', timeZone: 'UTC' }).format(new Date(Date.UTC(2026, 10, 19)))", "jeudi 19 novembre"),
("new Date(Date.UTC(2026, 10, 19, 15, 4)).toLocaleDateString('en-US', { timeZone: 'UTC' })", "11/19/2026"),
("[new Intl.PluralRules('en-US').select(2), new Intl.PluralRules('ru').select(3)].join(' ')", "other few"),
("new Intl.RelativeTimeFormat('en', { numeric: 'auto' }).format(-1, 'day')", "yesterday"),
("new Intl.ListFormat('en', { type: 'conjunction' }).format(['a', 'b', 'c'])", "a, b, and c"),
("['b', 'a', 'B', '\\u00e1'].sort((x, y) => x.localeCompare(y)).join(',')", "a,\u{e1},b,B"),
];
/// Each INTL case's answer on `engine`, or what it threw
fn intl(engine: Engine) -> Vec<String> {
let mut js = engine.start().unwrap();
let seen = Rc::new(RefCell::new(Vec::new()));
let s = seen.clone();
js.native("note", Box::new(move |a| {
s.borrow_mut().push(a.join("|"));
Ok(Ret::Undefined)
}))
.unwrap();
for (expr, _) in INTL {
js.eval(&format!("try {{ note({expr}) }} catch (e) {{ note('threw ' + e) }}"), "intl.js").unwrap();
}
seen.take()
}
#[cfg(any(feature = "portable", not(target_vendor = "apple")))]
#[test]
fn quickjs_formats_as_javascriptcore_does() {
let got = intl(Engine::QuickJs);
assert_eq!(got, INTL.map(|(_, want)| want.to_string()));
// and on a Mac, as the engine there does
#[cfg(target_vendor = "apple")]
assert_eq!(got, intl(Engine::Jsc));
}
#[cfg(target_vendor = "apple")]
#[test]
fn jsc() {
+32 -1
View File
@@ -24,7 +24,9 @@ impl Quick {
// React's commit recurses through the tree; give it room (the host runs on the main thread's 8 MB stack)
rt.set_max_stack_size(4 << 20);
let ctx = Context::full(&rt).map_err(|e| e.to_string())?;
Ok(Quick { rt, ctx })
let mut q = Quick { rt, ctx };
intl(&mut q)?;
Ok(q)
}
/// The promise jobs queued, run until none is left (one that throws is logged, as an unhandled rejection is).
@@ -42,6 +44,35 @@ impl Quick {
}
}
/// FormatJS's Intl polyfills and their CLDR data (js/intl/build.ts): "core", "index" and one entry per locale, each
/// raw deflate. QuickJS has no Intl; JavaScriptCore has, so this is QuickJS's alone.
const INTL_PACK: &[u8] = include_bytes!("../js/intl.pack");
/// An entry of the Intl pack, inflated: its source (or the index's JSON), None when there's no such entry.
pub(crate) fn intl_chunk(name: &str) -> Option<String> {
let mut at = 0;
while at + 2 <= INTL_PACK.len() {
let n = u16::from_le_bytes([INTL_PACK[at], INTL_PACK[at + 1]]) as usize;
let key = INTL_PACK.get(at + 2..at + 2 + n)?;
let len = u32::from_le_bytes(INTL_PACK.get(at + 2 + n..at + 6 + n)?.try_into().ok()?) as usize;
let body = INTL_PACK.get(at + 6 + n..at + 6 + n + len)?;
if key == name.as_bytes() {
return String::from_utf8(miniz_oxide::inflate::decompress_to_vec(body).ok()?).ok();
}
at += 6 + n + len;
}
None
}
/// Intl in the context, the first time it's used (js/intl/loader.js): the pack's chunks through a native, and the
/// system's time zone as the date polyfill's default (JavaScriptCore formats dates in local time; TZ first, as there).
fn intl(q: &mut Quick) -> Result<(), String> {
q.native("__raea_intl_chunk", Box::new(|a| intl_chunk(crate::arg(a, 0)).map(Ret::Str).ok_or_else(|| format!("no Intl data {:?}", crate::arg(a, 0)))))?;
let zone = std::env::var("TZ").ok().filter(|z| z.contains('/')).or_else(|| iana_time_zone::get_timezone().ok()).unwrap_or_default();
q.ctx.with(|ctx| ctx.globals().set("__raea_intl_zone", zone)).map_err(|e| e.to_string())?;
q.eval(include_str!("../js/intl/loader.js"), "intl-loader.js")
}
/// Imports name their modules by URL already (the host rewrote them); one relative to its importer is joined to its folder.
struct Urls;
-2
View File
@@ -13,8 +13,6 @@ raea-runtime-look = { path = "../look" }
raea-runtime-scene2d = { path = "../scene2d" }
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
-1
View File
@@ -231,7 +231,6 @@ 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);
+2 -12
View File
@@ -1,6 +1,6 @@
// Generated by raea-bevy-sdk from raea's Bevy App's TypeRegistry (bevy (bevy)); don't edit, regenerate
// (tools/bevy-plugins.sh gen). 389 component, 12 event, 38 message, 53 resource.
// - In a scene (TSX): 442 wrappers, each a <BevyComponent> (or <BevyResource>) naming its type path, which raea-render
// (tools/bevy-plugins.sh gen). 388 component, 12 event, 38 message, 53 resource.
// - In a scene (TSX): 441 wrappers, each a <BevyComponent> (or <BevyResource>) naming its type path, which raea-render
// applies with ReflectComponent::insert. Put a component inside the <Mesh3d> it belongs to; <BevySettings> sets the
// plugin's resources.
// - In a TypeScript program (raea/bevy's BevyApp): `bevy` holds a typed handle for every component,
@@ -2555,9 +2555,6 @@ export type MeshMaterial3dExtendedMaterialStandardMaterialProcedural = string |
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>> */
export type MeshMaterial3dExtendedMaterialStandardMaterialShaderExt = string | Record<string, unknown> /* bevy_asset::handle::Handle<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>>: in a Canvas3D an asset path or the asset inline */;
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> */
export type MeshMaterial3dExtendedMaterialStandardMaterialWear = string | Record<string, unknown> /* bevy_asset::handle::Handle<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>: in a Canvas3D an asset path or the asset inline */;
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial> */
export type MeshMaterial3dStandardMaterial = string | Record<string, unknown> /* bevy_asset::handle::Handle<bevy_pbr::pbr_material::StandardMaterial>: in a Canvas3D an asset path or the asset inline */;
@@ -6016,11 +6013,6 @@ export function MeshMaterial3dExtendedMaterialStandardMaterialShaderExt(props: {
return <BevyComponent type="bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>>" value={props.value ?? {"Uuid":"97128bb1-2588-480b-bdc6-87b4adbec477"}} from={props.from} />;
}
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> (component); default {"Uuid":"97128bb1-2588-480b-bdc6-87b4adbec477"} */
export function MeshMaterial3dExtendedMaterialStandardMaterialWear(props: { value?: MeshMaterial3dExtendedMaterialStandardMaterialWear; from?: number }) {
return <BevyComponent type="bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>" value={props.value ?? {"Uuid":"97128bb1-2588-480b-bdc6-87b4adbec477"}} from={props.from} />;
}
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial> (component); default {"Uuid":"97128bb1-2588-480b-bdc6-87b4adbec477"} */
export function MeshMaterial3dStandardMaterial(props: { value?: MeshMaterial3dStandardMaterial; from?: number }) {
return <BevyComponent type="bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial>" value={props.value ?? {"Uuid":"97128bb1-2588-480b-bdc6-87b4adbec477"}} from={props.from} />;
@@ -7703,8 +7695,6 @@ export const bevy = {
MeshMaterial3dExtendedMaterialStandardMaterialProcedural: component<MeshMaterial3dExtendedMaterialStandardMaterialProcedural>("bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_procmat::Procedural>>"),
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>> (component) */
MeshMaterial3dExtendedMaterialStandardMaterialShaderExt: component<MeshMaterial3dExtendedMaterialStandardMaterialShaderExt>("bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_shader::ShaderExt>>"),
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> (component) */
MeshMaterial3dExtendedMaterialStandardMaterialWear: component<MeshMaterial3dExtendedMaterialStandardMaterialWear>("bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>>"),
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial> (component) */
MeshMaterial3dStandardMaterial: component<MeshMaterial3dStandardMaterial>("bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::pbr_material::StandardMaterial>"),
/** bevy_pbr::mesh_material::MeshMaterial3d<bevy_trenchbroom::special_textures::QuakeSkyMaterial> (component) */
-2
View File
@@ -166,7 +166,6 @@
"qoi",
"pnm",
"tiff",
"compressed_image_saver",
"picking",
"bevy_picking",
"mesh_picking",
@@ -253,7 +252,6 @@
"qoi",
"pnm",
"tiff",
"compressed_image_saver",
"picking",
"bevy_picking",
"mesh_picking",
+12
View File
@@ -168,6 +168,18 @@ describe("Mesh3d, Camera3d and StandardMaterial", () => {
expect(() => html(<ExtendedMaterial base={<StandardMaterial unlit />} extension={<WearExtension amount={0.5} />} />)).toThrow(/unlit/);
});
test("wear is a surface shader of raea's own (EX9): its uniforms, none at amount 0, alone", () => {
const out = html(<MeshStandardMaterial color="#d9c69c" wear={{ amount: 0.6, seed: 2, chipColor: "#333333" }} />);
expect(out).not.toContain("wear&quot;:{");
expect(out).toContain("fn surface(in: VertexOutput, pbr: ptr&lt;function, PbrInput&gt;)");
expect(out).toContain("&quot;wear&quot;:[0.6,0.08,0.6,0.5]");
expect(out).toContain("&quot;wear2&quot;:[0.25,2,0,0]");
expect(out).toContain("&quot;chip_color&quot;:&quot;#333333&quot;");
expect(html(<MeshStandardMaterial color="#d9c69c" wear={{ amount: 0 }} />)).toBe(html(<MeshStandardMaterial color="#d9c69c" />));
expect(() => html(<MeshStandardMaterial wear={{ amount: 0.5 }} shader={{ wesl: "fn surface(in: VertexOutput, pbr: ptr<function, PbrInput>) {}" }} />)).toThrow(/wear or shader/);
expect(() => html(<MeshStandardMaterial wear={{ amount: 0.5 }} grid={{ cell: 0.5 }} />)).toThrow(/grid or wear/);
});
test("inside a Model a StandardMaterial re-covers with only the fields given, as the old material did", () => {
const m = (el: React.ReactElement) => html(<Model src="chair.glb">{el}</Model>);
expect(m(<StandardMaterial material="Fabric" base_color="#7a3b2e" />)).toBe(m(<MeshStandardMaterial color="#7a3b2e" material="Fabric" />));
+4 -1
View File
@@ -232,7 +232,10 @@ They are, by group:
- rendering: area_light_luts (rect lights), experimental_pbr_pcss (soft shadows), every pbr_* texture, the dfg, smaa
and tonemapping LUTs, bluenoise_texture, meshlet and meshlet_processor, bevy_solari;
- images: png, jpeg, ktx2, zstd_rust, basis-universal, exr, hdr, webp, dds, tga, bmp, gif, ico, qoi, pnm, tiff, and
the compressed image saver;
compressed_image_saver_universal. compressed_image_saver is left out (0.1.8): its encoders (ctt's etcpak, astcenc and
compressonator) build a copy for AVX2 whose C++ tables are set up before main on every CPU, so raea.exe stopped at
start on a PC without AVX (a Goldmont Celeron, a Nehalem; Intel's SDE showed it), and raea never runs Bevy's asset
processing, its only user;
- audio: bevy_audio with mp3, flac, vorbis, wav and aac;
- animation: bevy_animation, gltf_animation, morph and morph_animation;
- tools: bevy_gizmos, bevy_dev_tools, debug, bevy_ui_debug, bevy_debug_stepping, sysinfo_plugin, reflect_functions,
+12 -2
View File
@@ -1,6 +1,7 @@
// Materials: surfaces drawn on, standard and physical materials, toon bands and outlines.
import { toHex } from "../colour";
import { checkOverlays, type GridOverlay, type PaintOverlay, type ProceduralSurface, type WearOverlay } from "../overlays";
import { wornShader } from "../worn";
import { useAnimation3d } from "@raea/math/animate";
import { Animate3d, apply3d, node3d } from "./all";
@@ -60,7 +61,8 @@ export interface MeshStandardMaterialProps extends SurfaceDrawProps {
grid?: GridOverlay;
/** under a paint look, the surface broken up by noise: PaintOverlay, overlays.ts */
paint?: PaintOverlay;
/** a worn surface, fixed on the part as it moves (systems/wear): WearOverlay, overlays.ts */
/** a worn surface, fixed on the part as it moves (worn.ts, a surface shader; not with `shader` or `grid`):
* WearOverlay, overlays.ts */
wear?: WearOverlay;
/** a pattern made on the GPU with dust, dirt and worn edges (systems/procmat): ProceduralSurface, overlays.ts */
procedural?: ProceduralSurface;
@@ -301,6 +303,14 @@ export function checkMaterial(owner: string, props: Record<string, unknown>): vo
const v = props[k];
if (v !== undefined && !(k === "map" && v === null) && !(typeof v === "string" && v !== "")) throw new TypeError(`${owner}: ${k} must be a picture's path (staticFile("floor_diff.jpg")) or a data: URL, got ${JSON.stringify(v)}`);
}
// `wear` is a surface shader of raea's own (worn.ts, docs/examples.feature EX9); none at amount 0
if (props.wear !== undefined) {
if (props.shader !== undefined) throw new TypeError(`${owner}: wear is a surface shader of its own; give wear or shader, not both`);
if (props.grid !== undefined) throw new TypeError(`${owner}: grid draws alone; give grid or wear, not both`);
const w = props.wear as WearOverlay;
delete props.wear;
if (w.amount > 0) props.shader = wornShader(w);
}
if (props.shader !== undefined) props.shader = surfaceShader(owner, props.shader as SurfaceShaderSpec);
if (props.sampler !== undefined) samplerSpec(owner, props.sampler as SamplerSpec);
if (props.samplers !== undefined) {
@@ -318,7 +328,7 @@ export function checkMaterial(owner: string, props: Record<string, unknown>): vo
/** A physically based surface for the Mesh it's inside.
* `grid` draws graph paper over it (engine/render grid.rs):
* `wear` chips, grimes and rusts it in the part's own space (systems/wear):
* `wear` chips, grimes and rusts it in the part's own space (worn.ts):
* @deprecated <StandardMaterial>, raea/pbr (Bevy's fields: base_color, perceptual_roughness, metallic)
*/
export function MeshStandardMaterial(props: MeshStandardMaterialProps) {
+3 -3
View File
@@ -51,7 +51,7 @@ export function PaintExtension(_: PaintExtensionProps): ReactNode {
throw new TypeError("PaintExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<PaintExtension scale={0.5} />} />");
}
/** raea's extension of StandardMaterial that wears it (the engine's Wear MaterialExtension, systems/wear): its paint
/** raea's extension of StandardMaterial that wears it (a surface shader of raea's own, worn.ts): its paint
* mottled, chipped back to `chip_color` on edges and a few spots, `grime` gathered low and underneath and `rust` run
* down in streaks, fixed in the part's own space as it moves. `amount` 0-1; `chips`, `grime` and `rust` each 0-1 of it
* (0.6, 0.5, 0.25); `scale` a blotch's size in metres (0.08); `seed` moves the pattern. It goes in an
@@ -77,8 +77,8 @@ export interface WearExtensionProps {
rust_color?: string;
}
/** raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension (systems/wear):
* @bevy bevy_pbr::mesh_material::MeshMaterial3d<bevy_pbr::extended_material::ExtendedMaterial<bevy_pbr::pbr_material::StandardMaterial, raea_sys_wear::Wear>> */
/** raea's chips, grime and rust over a StandardMaterial, as an ExtendedMaterial's extension: a surface shader of
* raea's own (worn.ts) on the hook a ShaderExtension uses, so its Bevy type is ShaderExtension's. */
export function WearExtension(_: WearExtensionProps): ReactNode {
throw new TypeError("WearExtension goes in an ExtendedMaterial: <ExtendedMaterial base={<StandardMaterial />} extension={<WearExtension amount={0.6} />} />");
}
+4 -4
View File
@@ -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), 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`.
// A material's overlays, drawn over its standard surface: graph paper (`grid`, raea-render's grid.rs), a paint look's
// breakup (`paint`, paint.rs), wear (`wear`, a surface shader of raea's own, worn.ts) 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
@@ -13,7 +13,7 @@ export interface GridOverlay { cell: number; major?: number; color?: string; edg
* uneven paint */
export interface PaintOverlay { breakup?: number; scale?: number; color?: string; amount?: number }
/** a worn surface (systems/wear), fixed in the part's own space so it rides with a moving part: `amount` 0..1 of
/** a worn surface (worn.ts), fixed in the part's own space so it rides with a moving part: `amount` 0..1 of
* wear, its paint chipped back to `chipColor` at edges (`chips`), `grime` low and underneath, `rust` run down in
* 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 }
+119
View File
@@ -0,0 +1,119 @@
// Worn paint (docs/examples.feature EX9): the standard material with use written over it, as a surface shader on
// raea's public hook (raea-sys-shader), where it was the engine's own MaterialExtension (raea-sys-wear) until 11-19.
// MeshStandardMaterial's `wear` and raea/pbr's <WearExtension> draw it. Paint mottled by noise, its edges chipped back
// to `chipColor` (the metal under the paint, shinier), grime gathered low and on undersides, and rust run down in
// streaks. The noise is taken in the mesh's own space, not the world's, so a walking robot's wear stays where it is on
// each part instead of swimming over it; parts built in one space (a rigged build's pieces, in the rest pose) share
// it, so their wear lines up across a seam. Edges are found from how fast the surface's normal turns on screen
// against how fast its position does (its curvature, 1 / radius), so a rounded edge of a few millimetres chips and a
// broad face doesn't. raea/wear's wearShader is the other wear: the weather's, baked from a building's own shape.
import type { WearOverlay } from "./overlays";
/** The surface hook. Its uniforms: `wear` (amount, a blotch's size in metres, chips, grime), `wear2` (rust, seed),
* and the chips', grime's and rust's colours. */
export const WORN_WESL = /* wgsl */ `
fn worn_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 worn_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(worn_hash(i), worn_hash(i + vec3(1.0, 0.0, 0.0)), u.x), mix(worn_hash(i + vec3(0.0, 1.0, 0.0)), worn_hash(i + vec3(1.0, 1.0, 0.0)), u.x), u.y);
let b = mix(mix(worn_hash(i + vec3(0.0, 0.0, 1.0)), worn_hash(i + vec3(1.0, 0.0, 1.0)), u.x), mix(worn_hash(i + vec3(0.0, 1.0, 1.0)), worn_hash(i + vec3(1.0, 1.0, 1.0)), u.x), u.y);
return mix(a, b, u.z);
}
// four octaves, 0..1
fn worn_fbm(p: vec3<f32>) -> f32 {
var s = 0.0;
var w = 0.5;
var q = p;
for (var k = 0; k < 4; k++) {
s += w * worn_vnoise(q);
q = q * 2.03 + vec3(1.7, 9.2, 3.1);
w *= 0.5;
}
return s / 0.9375;
}
fn surface(in: VertexOutput, pbr: ptr<function, PbrInput>) {
let amount = u_wear().x;
let scale = u_wear().y;
let chips = u_wear().z;
let grimes = u_wear().w;
let rusts = u_wear2().x;
let seed = u_wear2().y;
var p = in.world_position.xyz;
var n = normalize(in.world_normal);
@if(VERTEX_OUTPUT_INSTANCE_INDEX) {
// the mesh's own space, so the wear rides with the part
let m = bevy_pbr::render::mesh_functions::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 q = p / scale + vec3(seed * 13.1);
// curvature (1 / metres): how fast the normal turns against how fast the position moves, on screen
let curve = length(fwidth(in.world_normal)) / max(length(fwidth(in.world_position.xyz)), 1e-5);
let edge = smoothstep(25.0, 90.0, curve) + 0.5 * smoothstep(0.12, 0.35, 1.0 - max(abs(n.x), max(abs(n.y), abs(n.z))));
let a = amount;
var c = (*pbr).material.base_color.rgb;
var rough = (*pbr).material.perceptual_roughness;
var metal = (*pbr).material.metallic;
// paint: mottled a little, and duller where it's thin
let mottle = worn_fbm(q * 0.6);
c *= 1.0 + (mottle - 0.5) * 0.22 * a;
rough = clamp(rough + (worn_fbm(q * 1.7 + 5.0) - 0.5) * 0.3 * a, 0.04, 1.0);
// grime: low, in hollows and undersides, broken up
let low = clamp(-n.y, 0.0, 1.0) * 0.6 + smoothstep(0.55, 0.85, worn_fbm(q * 0.35 + 20.0));
let g = clamp(low * grimes * a, 0.0, 0.85) * smoothstep(0.3, 0.7, worn_fbm(q * 2.3 + 40.0) + 0.25);
c = mix(c, u_grime_color().rgb, g);
rough = mix(rough, 0.9, g);
// rust: streaks run down from blotches (noise squashed along local y)
let streak = worn_fbm(vec3(q.x * 3.0, q.y * 0.25, q.z * 3.0) + 60.0);
let blotch = smoothstep(0.6, 0.8, worn_fbm(q * 0.5 + 80.0));
let r = clamp((blotch + smoothstep(0.62, 0.8, streak) * 0.6) * rusts * a, 0.0, 0.9);
c = mix(c, u_rust_color().rgb * (0.7 + 0.6 * worn_vnoise(q * 6.0)), r);
rough = mix(rough, 0.95, r);
metal = mix(metal, 0.0, r);
// chips: the paint gone at edges and a few scattered spots, the metal under it showing, shinier; an edge lowers
// the bar a long way, so at full wear most edges chip and only the odd spot on a broad face does
let s = chips * a;
let field = worn_fbm(q * 2.5 + 100.0) + edge * 0.5 - 0.2;
let chip = smoothstep(1.0 - s * 0.55, 1.04 - s * 0.55, field);
c = mix(c, u_chip_color().rgb, chip);
rough = mix(rough, 0.32, chip);
metal = mix(metal, 0.85, chip);
(*pbr).material.base_color = vec4(c, (*pbr).material.base_color.a);
(*pbr).material.perceptual_roughness = rough;
(*pbr).material.metallic = metal;
}
`;
const share = (v: number | undefined, d: number) => Math.min(1, Math.max(0, v ?? d));
/** A material's `wear` as the surface shader that draws it: `{ wesl, uniforms }` for its `shader`. */
export function wornShader(w: WearOverlay): { wesl: string; uniforms: Record<string, number[] | string> } {
const amount = Math.min(1, w.amount);
return {
wesl: WORN_WESL,
uniforms: {
wear: [amount, w.scale !== undefined && w.scale > 0 ? w.scale : 0.08, share(w.chips, 0.6), share(w.grime, 0.5)],
wear2: [share(w.rust, 0.25), w.seed ?? 0, 0, 0],
chip_color: w.chipColor ?? "#3a3c40",
grime_color: w.grimeColor ?? "#3b3226",
rust_color: w.rustColor ?? "#7a3f1c",
},
};
}
+48 -14
View File
@@ -3,10 +3,25 @@
// causes0 = sky (rain's reach), sun (the year's sun), cavity, edge (convex arris)
// causes1 = flow (run-off passing), deposit (what it left), deposit kind (60 x: 1 grime, 2 rust, 3 copper, 4 zinc), touch
// causes2 = ground (height over the walk, 0-4 m), element (the chart's number), open (the whole sky seen), class
// causes3 = winter sun (December's), drift (driven snow), litter (where blown leaves and snow settle)
// causes3 = winter sun (December's), drift (driven snow), litter (where blown leaves and snow settle), crack (1 - the
// distance to the nearest crack from an opening's corner over CRACK_REACH; raea-sys-damage, WR6)
// The maps load as colour (sRGB) textures, so a colour channel is re-encoded to read the byte the bake wrote; alpha is
// stored linear. Element and class are numbers, read with textureLoad so a filtered read never blends two into a third.
/** How far the bake keeps a texel's distance to a crack, metres (raea-sys-damage's REACH). */
export const CRACK_REACH = 0.25;
/** The loss potential's edges and weights, as raea-sys-damage's LOSS has them (its test compares the two): how readily
* a coat comes off at the damp foot (ground 0.7-1.3 m), where run-off soaks what the rain doesn't wash (flow 0.5-0.9,
* the rain's reach 0.35-0.85), at a knocked arris low down (edge 0.75-0.9, below 1.4-2.2 m) and along a crack
* (within 0.12 m); then the soak's, the arris's and (CRACK_WEIGHT) the crack's weight against the foot's 1. */
export const LOSS = [0.7, 1.3, 0.5, 0.9, 0.35, 0.85, 0.75, 0.9, 1.4, 2.2, 0.12, 0.8, 0.7] as const;
export const CRACK_WEIGHT = 0.6;
/** Neglect past this is a house left empty (its panes broken and boarded, its slates gone, fallen render left on the
* walk), full at 1: a lived-in house mends and sweeps these however poorly it is kept. */
export const ABANDON_FROM = 0.85;
const f = (x: number) => (Number.isInteger(x) ? `${x}.0` : `${x}`);
const L = LOSS.map(f);
/** The uniforms the module reads: `up` (the bake's up), `age` (years since the last repair, soot, upkeep, the bake's
* texels a metre), `wx` (wet, snow, storm, ice) and `season` (damp, dust, leaves, melt). */
export const CAUSES = /* wgsl */ `
@@ -16,7 +31,7 @@ struct WearCauses {
sky: f32, sun: f32, cav: f32, edge: f32,
flow: f32, dep: f32, kind: i32, touch: f32,
ground: f32, elem: f32, open: f32, cls: i32,
dec: f32, drift: f32, litter: f32
dec: f32, drift: f32, litter: f32, crack: f32
}
fn wear_causes(uv: vec2<f32>) -> WearCauses {
@@ -33,10 +48,19 @@ fn wear_causes(uv: vec2<f32>) -> WearCauses {
wear_enc(a.r), wear_enc(a.g), wear_enc(a.b), a.a,
wear_enc(f.r), wear_enc(f.g), kind, f.a,
wear_enc(b.r) * 4.0, round(wear_enc(x.g) * 255.0), wear_enc(b.b), cls,
wear_enc(d.r), wear_enc(d.g), wear_enc(d.b)
wear_enc(d.r), wear_enc(d.g), wear_enc(d.b), (1.0 - d.a) * ${f(CRACK_REACH)}
);
}
// how readily the coat here comes off (WR6): raea-sys-damage's loss, so the debris the bake put down lies under it
fn wear_loss(c: WearCauses) -> f32 {
let foot = 1.0 - smoothstep(${L[0]}, ${L[1]}, c.ground);
let soak = smoothstep(${L[2]}, ${L[3]}, c.flow) * (1.0 - smoothstep(${L[4]}, ${L[5]}, c.sky));
let arris = smoothstep(${L[6]}, ${L[7]}, c.edge) * (1.0 - smoothstep(${L[8]}, ${L[9]}, c.ground));
let near = 1.0 - smoothstep(0.0, ${L[10]}, c.crack);
return max(max(foot, ${L[11]} * soak), max(${L[12]} * arris, ${f(CRACK_WEIGHT)} * near));
}
// value noise over the face, in metres
fn wear_h21(p: vec2<f32>) -> f32 {
var q = fract(p * vec2<f32>(123.34, 456.21));
@@ -62,24 +86,28 @@ fn wear_fbm2(p: vec2<f32>) -> f32 {
}
// where the point is: how far its face looks up, its place on the face in metres (along a wall and up it; two
// horizontal axes on a level face), its height over the walk, and how upright the face is
struct WearGeo { up: f32, p: vec2<f32>, h: f32, wall: f32 }
// horizontal axes on a level face), its height over the walk, how upright the face is, a pixel's size in metres
// (from the caller, before any branch: derivatives need uniform control flow) and the parallax: how far a point a
// metre behind the face shifts in its place as the eye sees it (what's behind lost render is drawn there)
struct WearGeo { up: f32, p: vec2<f32>, h: f32, wall: f32, px: f32, par: vec2<f32> }
fn wear_geo(wp: vec3<f32>, nrm: vec3<f32>, c: WearCauses) -> WearGeo {
fn wear_geo(wp: vec3<f32>, nrm: vec3<f32>, c: WearCauses, eye: vec3<f32>, px: f32) -> WearGeo {
let U = normalize(u_up());
let n = normalize(nrm);
let up = dot(n, U);
let side = n - U * up;
var p: vec2<f32>;
var ax = U;
var ay = U;
if (length(side) > 0.3) {
let t = normalize(cross(U, side));
p = vec2<f32>(dot(wp, t), dot(wp, U));
ax = normalize(cross(U, side));
} else {
let r = select(vec3<f32>(1.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 1.0), abs(U.x) > 0.9);
let e1 = normalize(cross(U, r));
p = vec2<f32>(dot(wp, e1), dot(wp, cross(U, e1)));
ax = normalize(cross(U, r));
ay = cross(U, ax);
}
return WearGeo(up, p, c.ground, 1.0 - smoothstep(0.5, 0.8, abs(up)));
let v = normalize(eye);
let par = -vec2<f32>(dot(v, ax), dot(v, ay)) / max(dot(v, n), 0.25);
return WearGeo(up, vec2<f32>(dot(wp, ax), dot(wp, ay)), c.ground, 1.0 - smoothstep(0.5, 0.8, abs(up)), px, par);
}
// what years of weather left, by cause: the same in every season
@@ -87,7 +115,7 @@ struct WearMarks {
age: f32, upkeep: f32, wear: f32,
wash: f32, shelter: f32, tuck: f32, crust: f32,
tear: f32, stain: f32, damp: f32, salt: f32, splash: f32,
low: f32, chip: f32
low: f32, chip: f32, loss: f32, neglect: f32, abandon: f32
}
fn wear_marks(c: WearCauses, g: WearGeo) -> WearMarks {
@@ -117,7 +145,13 @@ fn wear_marks(c: WearCauses, g: WearGeo) -> WearMarks {
// chips need a real arris, so a bake of 12 texels a metre or finer (at 4 an edge spreads 25 cm); people and carts
// reach below 2.2 m
let chip = step(12.0, u_age().w) * smoothstep(0.75, 0.9, c.edge) * low * step(0.68 - 0.2 * (1.0 - upkeep), wear_vn2(g.p * 16.0 + vec2<f32>(c.elem * 9.0, 0.0))) * step(0.05, age);
return WearMarks(age, upkeep, wear, wash, shelter, tuck, crust, tear, stain, damp, salt, splash, low, chip);
// WR6: how readily the coat comes off here, and how far neglect has let things go (little while kept up)
let loss = wear_loss(c) * g.wall;
let neglect = clamp(age * (1.15 - upkeep), 0.0, 1.0);
// left empty: neglect past what a lived-in house lets go (broken panes, slates and fallen render are mended or
// swept while anyone lives there), the whole house's, so by its own upkeep and not each element's draw
let abandon = smoothstep(${f(ABANDON_FROM)}, 1.0, age * (1.15 - clamp(u_age().z, 0.0, 1.0)));
return WearMarks(age, upkeep, wear, wash, shelter, tuck, crust, tear, stain, damp, salt, splash, low, chip, loss, neglect, abandon);
}
// a surface's own colour, roughness and metalness as the recipes change them
+4
View File
@@ -32,6 +32,10 @@ export const DEBUG_CAUSES = {
litter: "vec3<f32>(1.0, 0.5, 0.1) * c.litter",
/** the material class, by WEAR_CLASSES' colour; magenta where the bake found none */
class: "wear_class_colour(c.cls)",
/** nearness to a crack from an opening's corner (WR6), in red */
crack: "vec3<f32>(1.0, 0.25, 0.1) * (1.0 - c.crack / 0.25)",
/** how readily the coat comes off (WR6): the damp foot, soaked faces, knocked arrises, cracks */
loss: "vec3<f32>(wear_loss(c))",
} as const;
export type WearCause = keyof typeof DEBUG_CAUSES;
+67 -9
View File
@@ -10,29 +10,33 @@
//
// The same spec goes on one glTF material (<StandardMaterial material="facade"/> as the base), a
// <MeshStandardMaterial shader={wear}>, or a <SurfaceShader {...wear}> over the whole scene. A surface without the
// bake's second UV set is drawn as it was.
// bake's second UV set is drawn as it was. Crumbling (WR6) follows the same age: render lost to the brick, paint to
// the primer and the wood, enamel to the iron, cracks from the openings' corners, panes broken or boarded, slates
// gone; `wearDebris(baked, age)` is the debris that age has brought down, where the bake put it.
import { hasNative, native, type NativeCalls } from "@raea/app/native";
import { CAUSES } from "./causes";
import { ABANDON_FROM, CAUSES } from "./causes";
import { debugHook, DEBUG_CAUSES, type WearCause } from "./debug";
import { HELPERS, RECIPES, SHARED, WEATHER } from "./recipes";
export { DEBUG_CAUSES, type WearCause } from "./debug";
export { ABANDON_FROM, CRACK_REACH, CRACK_WEIGHT, LOSS } from "./causes";
export { WEAR_CONDITIONS, WEATHER_RATES, weatherAt, type WearCondition, type WearSpell } from "./weather";
/** The material classes, in the bake's order (causes2's alpha is 16 x (the place + 1)), each with its colour in the
* debug view and what the causes do to it. */
export const WEAR_CLASSES = [
{ name: "plaster", colour: [0.95, 0.9, 0.75], marks: "washed clean and chalky; soot grey where sheltered, darkest under cornices; dark tears from sill ends; splash to 0.4 m and a damp tide at 0.6-1.2 m; blown at the foot; chipped arrises low down; a grease band" },
{ name: "brick", colour: [0.75, 0.3, 0.2], marks: "mortar washed out; soot black where sheltered; efflorescence under ledges; a tide line, green on north faces; spalled faces" },
{ name: "plaster", colour: [0.95, 0.9, 0.75], marks: "washed clean and chalky; soot grey where sheltered, darkest under cornices; dark tears from sill ends; splash to 0.4 m and a damp tide at 0.6-1.2 m; by neglect blown to the brick behind at the damp foot, under sills, at knocked arrises and along cracks, and cracked from the openings' corners; chipped arrises low down; a grease band" },
{ name: "brick", colour: [0.75, 0.3, 0.2], marks: "mortar washed out; soot black where sheltered; efflorescence under ledges; a tide line, green on north faces; spalled faces; cracks stepping along the joints from the openings' corners" },
{ name: "sandstone", colour: [0.9, 0.75, 0.45], marks: "washed light; a black crust where sheltered; black and white streaks under ledges; rounded arrises" },
{ name: "granite", colour: [0.6, 0.6, 0.62], marks: "little: soot where sheltered" },
{ name: "wood", colour: [0.55, 0.35, 0.15], marks: "sun-faded and alligatored on the faces the sun reaches; peeling at bottom rails; rot at the foot; worn to the wood where held and kicked" },
{ name: "wood", colour: [0.55, 0.35, 0.15], marks: "sun-faded and alligatored on the faces the sun reaches; peeling to the primer and the wood at bottom rails, and by neglect wherever the coat's loosened; rot at the foot; worn to the wood where held and kicked" },
{ name: "iron", colour: [0.25, 0.3, 0.4], marks: "paint flaking at joints and arrises; rust at the foot and on the stone below; bright where held" },
{ name: "zinc", colour: [0.7, 0.8, 0.85], marks: "a pale patina where rain-washed; white streaks below" },
{ name: "copper", colour: [0.3, 0.7, 0.55], marks: "verdigris where rain-washed, brown-black where sheltered; green streaks below" },
{ name: "slate", colour: [0.35, 0.35, 0.45], marks: "lichen where the sun misses; soot in the laps" },
{ name: "slate", colour: [0.35, 0.35, 0.45], marks: "lichen where the sun misses; soot in the laps; slates gone by neglect, most along ridges, verges and eaves" },
{ name: "felt", colour: [0.15, 0.15, 0.15], marks: "greyed by the sun; washed where the rain runs" },
{ name: "glass", colour: [0.5, 0.85, 1.0], marks: "a grime film where sheltered, thickest at the bottom and corners" },
{ name: "enamel", colour: [0.2, 0.3, 0.9], marks: "rust bled from its screws; chipped to black iron at holes and edges" },
{ name: "glass", colour: [0.5, 0.85, 1.0], marks: "a grime film where sheltered, thickest at the bottom and corners; panes broken or boarded by neglect" },
{ name: "enamel", colour: [0.2, 0.3, 0.9], marks: "rust bled from its screws; chipped to black iron at holes and edges, and by neglect flaking in sheets to rusting iron" },
{ name: "brass", colour: [0.9, 0.7, 0.2], marks: "dull brown, more where rain-washed; bright where touched" },
{ name: "ground", colour: [0.4, 0.55, 0.3], marks: "dirt in corners and at the wall's foot; moss where the sun misses; polished where feet pass" },
] as const satisfies readonly { name: string; colour: [number, number, number]; marks: string }[];
@@ -90,6 +94,59 @@ export interface WearWeather {
melt?: number;
}
/** A thing the bake's rules put on the model (spots.json, docs/wear.feature WR3, WR6): what, who put it there, its
* middle, the face it's on and its size (across, up); debris also carries the loss potential of the plaster above it. */
export interface WearSpot {
what: "bill" | "street plate" | "nameplate" | "debris";
by: string;
at: [number, number, number];
n: [number, number, number];
size: [number, number];
loss?: number;
}
const spotsOf = new Map<string, WearSpot[]>();
/** The spots the bake put down (bills, street plates, nameplates, debris), read once from its spots.json. */
export function wearSpots(baked: Pick<WearBaked, "spots">): WearSpot[] {
const path = baked?.spots;
if (typeof path !== "string") throw new TypeError("wearSpots: baked is wearBake's answer, with its spots");
let s = spotsOf.get(path);
if (!s) {
if (!hasNative()) throw new Error("wearSpots: reading the bake's spots needs the raea engine (raea render)");
const got = native("asset.read", { path });
// spots.json is ASCII (the rules' names and numbers), so atob's binary string is its text
s = JSON.parse(atob(got.base64)) as WearSpot[];
spotsOf.set(path, s);
}
return s;
}
/** How far neglect has let things go at an age (wearShader's own: the marks' age, less what upkeep keeps up). */
export function neglectOf(age: WearAge = {}): number {
const years = age.years ?? 30;
const upkeep = age.upkeep ?? 0.5;
return Math.min(1, Math.max(0, (1 - Math.exp(-Math.max(years, 0) / 25)) * (1.15 - upkeep)));
}
/** How far a house is left empty at an age, 0..1 (wearShader's own): neglect past ABANDON_FROM. A lived-in house
* mends its panes and slates and sweeps its walk however poorly it is kept. */
export function abandonOf(age: WearAge = {}): number {
const t = Math.min(1, Math.max(0, (neglectOf(age) - ABANDON_FROM) / (1 - ABANDON_FROM)));
return t * t * (3 - 2 * t);
}
/** A heap shows where the plaster above it has come off and nobody sweeps: loss potential x abandonment past this. */
export const DEBRIS_AT = 0.3;
/** The debris an age has left lying (WR6): the bake's debris under plaster whose loss potential has let it go, on
* the walk of a house left empty. `spots` is wearSpots' answer, or wearBake's to read it. */
export function wearDebris(spots: readonly WearSpot[] | Pick<WearBaked, "spots">, age: WearAge = {}): WearSpot[] {
const all = Array.isArray(spots) ? (spots as readonly WearSpot[]) : wearSpots(spots as Pick<WearBaked, "spots">);
const a = abandonOf(age);
return all.filter((s) => s.what === "debris" && (s.loss ?? 0) * a >= DEBRIS_AT);
}
export interface WearShaderOptions {
/** wearBake's answer: its maps are the shader's textures, its density decides whether edges can chip */
baked: Pick<WearBaked, "maps" | "density">;
@@ -179,8 +236,9 @@ ${cases.join("\n")}
const SURFACE = /* wgsl */ `
fn wear_surface(uv: vec2<f32>, pbr: ptr<function, PbrInput>) {
let px = length(fwidth((*pbr).world_position.xyz));
let c = wear_causes(uv);
let g = wear_geo((*pbr).world_position.xyz, (*pbr).world_normal, c);
let g = wear_geo((*pbr).world_position.xyz, (*pbr).world_normal, c, (*pbr).V, px);
let m = wear_marks(c, g);
var s = WearSurf((*pbr).material.base_color.rgb, (*pbr).material.perceptual_roughness, (*pbr).material.metallic);
if (!wear_class(&s, c, g, m)) { return; }
+68 -16
View File
@@ -14,16 +14,21 @@ export const RECIPES: Record<string, string> = {
(*s).rough = mix((*s).rough, 0.95, m.wash * 0.4 * m.age);
// sheltered: soot grey, darkest tucked under cornices
(*s).col = mix((*s).col, (*s).col * vec3<f32>(0.3, 0.29, 0.27), m.crust);
// the foot: render blown where the damp and the frost work, the brick behind it showing (worst where let go)
let blowN = wear_fbm2(g.p * vec2<f32>(0.9, 1.4) + vec2<f32>(c.elem * 0.31, 5.0));
let blowAt = 0.74 - 0.2 * (1.0 - m.upkeep) - 0.12 * (1.0 - smoothstep(0.15, 0.9, g.h));
let foot = (1.0 - smoothstep(0.7, 1.3, g.h)) * g.wall * step(0.2, m.wear);
let blown = smoothstep(blowAt, blowAt + 0.015, blowN) * foot;
let lip = smoothstep(blowAt - 0.04, blowAt, blowN) * (1.0 - blown) * foot;
(*s).col = mix((*s).col, wear_bond(g.p) * mix(1.0, 0.55, m.crust), blown);
(*s).col = (*s).col * (1.0 - 0.45 * lip);
// WR6: the render lost where the causes loosen it (the damp foot, soaked faces, knocked arrises, along a crack) and
// neglect lets it go, to the brick 2 cm behind it; the broken edge's lip shades the hole under it
let lost = m.loss * m.neglect;
let lossAt = 0.8 - 0.34 * lost;
let q = g.p * vec2<f32>(0.9, 1.4) + vec2<f32>(c.elem * 0.31, 5.0);
let blowN = wear_fbm2(q);
let gone = smoothstep(lossAt, lossAt + 0.012, blowN) * step(0.03, lost);
let over = smoothstep(lossAt, lossAt + 0.012, wear_fbm2(q + vec2<f32>(0.0, 0.042)));
let lip = smoothstep(lossAt - 0.035, lossAt, blowN) * (1.0 - gone) * step(0.03, lost);
let behind = wear_bond(g.p + g.par * 0.02) * mix(1.0, 0.55, m.crust);
(*s).col = mix((*s).col, behind * (1.0 - 0.55 * (1.0 - over)), gone);
(*s).col = (*s).col * (1.0 - 0.4 * lip);
(*s).rough = mix((*s).rough, 0.95, gone);
// chipped arrises low down: the lime coat knocked off to the brick
(*s).col = mix((*s).col, mix(vec3<f32>(0.78, 0.76, 0.7), wear_bond(g.p), 0.5), m.chip * (1.0 - blown));
(*s).col = mix((*s).col, mix(vec3<f32>(0.78, 0.76, 0.7), wear_bond(g.p), 0.5), m.chip * (1.0 - gone));
// a grease band where shoulders and hubs rub
(*s).col = mix((*s).col, (*s).col * vec3<f32>(0.5, 0.48, 0.45), c.touch * 0.6 * g.wall);
(*s).rough = mix((*s).rough, 0.55, c.touch * 0.5);`,
@@ -66,9 +71,14 @@ export const RECIPES: Record<string, string> = {
(*s).col = mix((*s).col, vec3<f32>(dot((*s).col, vec3<f32>(0.33))) * 1.25 + vec3<f32>(0.04), c.sun * 0.45 * m.wear);
let cells = abs(wear_vn2(g.p * vec2<f32>(14.0, 9.0)) - 0.5);
(*s).col = (*s).col * (1.0 - 0.45 * (1.0 - smoothstep(0.015, 0.05, cells)) * smoothstep(0.3, 0.8, c.sun) * m.wear);
// under a ledge and at the bottom rails: peeling where the run-off soaks the timber, the grey wood showing
// under a ledge and at the bottom rails: peeling where the run-off soaks the timber, and by neglect (WR6) wherever
// the coat's loosened: the top coat off to the red-lead primer, then to the grey wood
let wetWood = clamp(c.flow + (1.0 - smoothstep(0.04, 0.5, g.h)) * g.wall, 0.0, 1.0);
let peel = smoothstep(0.5, 0.56, wear_fbm2(g.p * vec2<f32>(9.0, 4.0)) + 0.2 * wetWood * m.wear) * wetWood * step(0.1, m.wear);
let bare = wear_fbm2(g.p * vec2<f32>(9.0, 4.0)) + 0.2 * wetWood * m.wear + 0.25 * m.loss * m.neglect;
let reach = max(wetWood, m.loss * smoothstep(0.1, 0.5, m.neglect)) * step(0.1, m.wear);
let primer = smoothstep(0.46, 0.49, bare) * reach;
let peel = smoothstep(0.53, 0.56, bare) * reach;
(*s).col = mix((*s).col, vec3<f32>(0.58, 0.34, 0.25) * (0.9 + 0.2 * wear_vn2(g.p * 25.0)), primer * (1.0 - peel));
(*s).col = mix((*s).col, vec3<f32>(0.3, 0.27, 0.22) * (0.8 + 0.3 * wear_vn2(vec2<f32>(g.p.x * 30.0, g.p.y * 2.0))), max(peel, m.chip));
// rot at the foot
let rot = (1.0 - smoothstep(0.02, 0.25, g.h)) * m.wear * g.wall;
@@ -114,7 +124,16 @@ export const RECIPES: Record<string, string> = {
// lichen on the faces the sun misses, soot in the laps
let lichen = (1.0 - c.sun) * smoothstep(0.55, 0.75, wear_fbm2(g.p * 2.5 + vec2<f32>(c.elem * 0.13, 1.0))) * m.age;
(*s).col = mix((*s).col, vec3<f32>(0.2, 0.22, 0.13), lichen * 0.6);
(*s).col = mix((*s).col, vec3<f32>(0.03), m.crust * 0.5);`,
(*s).col = mix((*s).col, vec3<f32>(0.03), m.crust * 0.5);
// WR6: slates slipped and gone, the odd one by neglect and many once the house is empty, more along the ridge, the
// verges and the eaves, the battens and the
// felt under them showing (courses 11 cm up the slope's height, slates 25 cm across, broken bond)
let course = floor(g.p.y / 0.11);
let across = g.p.x / 0.25 + select(0.0, 0.5, i32(course) % 2 == 1);
let missing = step(wear_h21(vec2<f32>(floor(across) + c.elem * 17.0, course)), 0.1 * (0.15 * m.neglect + 0.85 * m.abandon) * (1.0 + 2.0 * c.edge));
let batten = 1.0 - smoothstep(0.0, 0.18, abs(fract(g.p.y / 0.11) - 0.5) * 2.0 - 0.6);
(*s).col = mix((*s).col, mix(vec3<f32>(0.04, 0.035, 0.03), vec3<f32>(0.3, 0.21, 0.12), batten), missing);
(*s).rough = mix((*s).rough, 0.95, missing);`,
felt: /* wgsl */ `
// roofing felt: greyed by the sun, its grit washed off where the rain runs
@@ -125,7 +144,23 @@ export const RECIPES: Record<string, string> = {
// sheltered: a grime film, thickest in the corners and at the bottom where the frame holds the dirt
let film = clamp(m.shelter * 0.5 + c.cav * 0.8 + (1.0 - m.wash) * 0.2, 0.0, 1.0) * m.age * (1.0 - 0.6 * m.upkeep);
(*s).col = mix((*s).col, (*s).col * vec3<f32>(0.62, 0.6, 0.55), film * 0.7);
(*s).rough = mix((*s).rough, 0.55, film * 0.6);`,
(*s).rough = mix((*s).rough, 0.55, film * 0.6);
// WR6: a house left empty has its panes broken and boarded over, one fate per pane
let fate = wear_h21(vec2<f32>(c.elem, 11.0));
if (fate < 0.16 * m.abandon) {
// boarded: planks of grey, weathered deal across the opening
let row = fract(g.p.y / 0.15);
let tone = 0.75 + 0.4 * wear_h21(vec2<f32>(floor(g.p.y / 0.15), c.elem));
let gap = 1.0 - smoothstep(0.0, 0.06, min(row, 1.0 - row));
(*s).col = vec3<f32>(0.36, 0.32, 0.26) * tone * (0.85 + 0.3 * wear_vn2(vec2<f32>(g.p.x * 30.0, g.p.y * 3.0))) * (1.0 - 0.7 * gap);
(*s).rough = 0.9;
(*s).metal = 0.0;
} else if (fate < 0.38 * m.abandon) {
// broken: the dark room behind, shards left in the putty at the frame
let shard = smoothstep(0.52, 0.56, wear_fbm2(g.p * 7.0 + vec2<f32>(c.elem, 0.0)) * 0.6 + 0.7 * c.cav);
(*s).col = mix(vec3<f32>(0.012, 0.011, 0.01), (*s).col, shard);
(*s).rough = mix(1.0, (*s).rough, shard);
}`,
enamel: /* wgsl */ `
// rust bled from its screws, in short tails below them
@@ -133,10 +168,17 @@ export const RECIPES: Record<string, string> = {
let screw = step(0.8, wear_h21(vec2<f32>(col, c.elem)));
let tail = screw * (1.0 - smoothstep(0.0, 0.04, abs(fract(g.p.x * 6.0) - 0.5) / 6.0)) * smoothstep(0.3, 0.9, wear_vn2(vec2<f32>(col, g.p.y * 3.0)));
(*s).col = mix((*s).col, vec3<f32>(0.3, 0.12, 0.04), tail * m.wear * 0.8);
// chipped to black iron at its holes and edges
// chipped to black iron at its holes and edges, and by neglect (WR6) flaking off in sheets from them to the iron,
// which rusts, and rust creeping under the enamel's broken edge
let chipped = smoothstep(0.65, 0.9, c.edge) * step(0.62 - 0.3 * m.wear, wear_vn2(g.p * 30.0)) * step(0.05, m.wear);
(*s).col = mix((*s).col, vec3<f32>(0.03, 0.03, 0.035), chipped);
(*s).rough = mix((*s).rough, 0.7, chipped);`,
let flakeN = wear_fbm2(g.p * 14.0 + vec2<f32>(c.elem * 3.1, 0.0));
let flakeAt = 0.82 - 0.38 * m.neglect * max(smoothstep(0.5, 0.9, c.edge), 0.5 * m.loss + 0.3);
let flake = smoothstep(flakeAt, flakeAt + 0.01, flakeN) * step(0.05, m.neglect);
let creep = smoothstep(flakeAt - 0.03, flakeAt, flakeN) * (1.0 - flake) * step(0.05, m.neglect);
let iron = mix(vec3<f32>(0.03, 0.03, 0.035), vec3<f32>(0.2, 0.08, 0.03), smoothstep(0.3, 0.7, wear_vn2(g.p * 40.0)) * flake);
(*s).col = mix((*s).col, iron, max(chipped, flake));
(*s).col = mix((*s).col, vec3<f32>(0.25, 0.1, 0.04), creep * 0.7);
(*s).rough = mix((*s).rough, 0.75, max(chipped, flake));`,
brass: /* wgsl */ `
// tarnished dull brown, more where the rain reaches; bright where hands touch it
@@ -195,6 +237,16 @@ fn wear_shared(s: ptr<function, WearSurf>, c: WearCauses, g: WearGeo, m: WearMar
(*s).col = mix((*s).col, vec3<f32>(0.8, 0.79, 0.74), m.salt * 0.3 * porous * smoothstep(0.4, 0.75, wear_vn2(vec2<f32>(g.p.x * 1.3, g.p.y * 3.0))));
if (c.cls != 13 && c.cls != 10) { (*s).col = mix((*s).col, (*s).col * 0.62, m.splash * 0.7); }
(*s).rough = mix((*s).rough, 0.97, m.crust * 0.5);
// WR6: cracks from the openings' corners, opening as neglect grows and gathering dirt along them; in brick a crack
// steps along the joints. Drawn no thinner than a pixel, fading as it gets thinner than one
let opened = smoothstep(0.1, 0.7, m.neglect) * porous;
let wide = 0.0035 * opened;
let dd = max(c.crack + (wear_vn2(g.p * 38.0) - 0.5) * 0.006, 0.0);
let line = (1.0 - smoothstep(0.5 * wide, 0.5 * wide + g.px, dd)) * min(1.0, wide / max(g.px, 0.0001) + 0.25) * step(0.0001, wide);
let stepped = (1.0 - smoothstep(0.02, 0.05, c.crack)) * wear_bond_joint(g.p) * opened;
let crack = select(line, stepped, c.cls == 1);
let halo = (1.0 - smoothstep(0.0, 0.03, dd)) * opened;
(*s).col = (*s).col * (1.0 - 0.8 * crack) * (1.0 - 0.15 * halo);
}
`;
+79
View File
@@ -0,0 +1,79 @@
// Weather that changes during a shot (docs/wear.feature WR9): rain starting, snow settling, frost forming. What lies
// on the surfaces (wet, snow, driven snow, frost) follows what the sky does at its own rate, so a shot that starts
// dry darkens over the minutes rain takes to soak a front and dries over the hour it takes to dry. `weatherAt` gives
// the surfaces' weather at a moment, for wearShader each frame.
//
// const spells = [{ at: 0 }, { at: 2, rain: 1 }, { at: 40 }]; // dry, raining from minute 2 to 40
// const minutes = (frame / fps) * 60; // a timelapse: a second a minute
// wearShader({ baked, weather: weatherAt({ day: 120 }, spells, minutes) })
import type { WearWeather } from "./index";
/** What the sky does from minute `at` of the shot on: rain, snow falling, a storm driving it, frost (each 0..1;
* what a spell leaves out is 0). */
export interface WearSpell {
at: number;
rain?: number;
snow?: number;
storm?: number;
ice?: number;
}
/** How fast the surfaces follow the sky, the share of the way left covered per minute (ASSUMED until measured):
* wetting in about 3 minutes of steady rain, drying over about an hour; snow settling over about 20 minutes and
* melting over about two hours; driven snow plastering in about 10 and falling off over 30; frost forming over half
* an hour and going in 20. */
export const WEATHER_RATES = { wet: 1 / 3, dry: 1 / 60, settle: 1 / 20, melt: 1 / 120, plaster: 1 / 10, shed: 1 / 30, freeze: 1 / 30, thaw: 1 / 20 } as const;
type Lying = { wet: number; snow: number; storm: number; ice: number };
const KEYS = [
["wet", "rain", "wet", "dry"],
["snow", "snow", "settle", "melt"],
["storm", "storm", "plaster", "shed"],
["ice", "ice", "freeze", "thaw"],
] as const;
/** The surfaces' weather `minutes` into the shot: `base` is how they lie when it starts (its day, and its wet, snow,
* storm and ice), `spells` what the sky does from when (in order). Each value eases toward the sky's at its rate,
* exactly (an exponential over each spell), so any frame can be drawn alone. */
export function weatherAt(base: WearWeather, spells: readonly WearSpell[], minutes: number): WearWeather {
if (!Number.isFinite(minutes)) throw new RangeError(`weatherAt: minutes is a number, got ${minutes}`);
for (let i = 1; i < spells.length; i++) if (!(spells[i].at >= spells[i - 1].at)) throw new RangeError("weatherAt: spells are in order of `at`");
const v: Lying = { wet: base.wet ?? 0, snow: base.snow ?? 0, storm: base.storm ?? 0, ice: base.ice ?? 0 };
let t = spells.length ? Math.min(spells[0].at, minutes) : minutes;
for (let i = 0; i < spells.length && spells[i].at <= minutes; i++) {
const s = spells[i];
const end = Math.min(i + 1 < spells.length ? spells[i + 1].at : minutes, minutes);
const dt = Math.max(0, end - Math.max(t, s.at));
for (const [k, sky, up, down] of KEYS) {
const target = s[sky] ?? 0;
if (!(target >= 0 && target <= 1)) throw new RangeError(`weatherAt: a spell's ${sky} is 0..1, got ${target}`);
const rate = WEATHER_RATES[target > v[k] ? up : down];
v[k] = target + (v[k] - target) * Math.exp(-rate * dt);
}
t = end;
}
const r = (x: number) => Math.round(x * 1e4) / 1e4;
return { ...base, wet: r(v.wet), snow: r(v.snow), storm: r(v.storm), ice: r(v.ice) };
}
/** WR9's eight conditions as weather on the surfaces: a day of the year in its season and what lies on them. The
* light that goes with each (overcast for rain, a flash for thunder) is the scene's. */
export const WEAR_CONDITIONS = {
/** damp lingering on north faces and plinths, algae where the run-off and the shade meet */
spring: { day: 105, damp: 0.85 },
/** dry: dust on ledges and treads */
summer: { day: 205 },
/** leaves where blown things settle, wet and dark after a shower */
autumn: { day: 300, wet: 0.35, leaves: 1 },
/** frost on the faces the winter sun misses */
winter: { day: 20, ice: 0.8 },
/** snow lying on what is open above, deeper in the lee */
snow: { day: 30, snow: 0.85, ice: 0.4 },
/** snow, and driven snow plastered on the faces the storm reaches */
blizzard: { day: 40, snow: 1, storm: 0.9, ice: 0.6 },
/** wet where the rain reaches, rivulets down the run-off's paths, puddles in the walk's hollows */
rain: { day: 130, wet: 0.8 },
/** heavy rain: wet through */
thunder: { day: 200, wet: 1 },
} as const satisfies Record<string, WearWeather>;
export type WearCondition = keyof typeof WEAR_CONDITIONS;
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff. Show more