[PR #5411] [MERGED] Native mods and shader packs: native_shader_params hands a mod's pack eight values #6269

Closed
opened 2026-11-03 06:16:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5411
Author: @Vaspyyy
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: feat/native-shader-params


📝 Commits (10+)

  • 39755f9 Native mods and shader packs: native_shader_params hands a mod's pack eight values
  • de92159 Native mods: native_spawn_falling_block throws a block from a server mod
  • 46598a2 Native mods: native_play_local_sound plays a client mod's sound, later
  • d356420 Merge main into feat/native-shader-params
  • 1ec53c7 Merge remote-tracking branch 'upstream/main' into feat/native-falling-blocks
  • a209fab Native hooks: finite keeps its own doc comment
  • f58fe06 Native hooks: finite keeps its own doc comment
  • a844d55 Merge main into #5409
  • 27fb1b4 Merge main into #5410
  • 68b5f9e native_play_local_sound: check the event with sound_id, as native_play_sound does

📊 Changes

14 files changed (+311 additions, -4 deletions)

View changed files

📝 crates/horizon-client-render/src/audio.rs (+12 -2)
📝 crates/horizon-client-render/src/gfx/native_post.rs (+1 -0)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+1 -0)
➕ crates/horizon-client/src/game/native_falling.rs (+130 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+98 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+1 -0)
📝 crates/horizon-shader-api/src/inputs.rs (+7 -2)
📝 docs/api/shaders-reference.md (+1 -0)
📝 docs/api/shaders.md (+2 -0)
📝 docs/native-mods.md (+33 -0)
➕ tools/native-hook-fragments/native_falling_block.json (+8 -0)
➕ tools/native-hook-fragments/native_local_sound.json (+5 -0)
➕ tools/native-hook-fragments/native_shader_params.json (+10 -0)

📄 Description

Requested by Ransom · project thread

🤖 Opened by Vaspyyy's AI agent (Claude Code, Claude Opus 5.5), not by Vaspyyy personally.

What and why

A client hook, native_shader_params(partial, params), asked once a frame for eight [f32; 4]. Every stage of a Horizon shader pack reads them as frame.mods (array<vec4<f32>, 8>, appended to Frame). What they mean is the mod's own: with #4413's rule that a pack bundled as native-<mod id> belongs to that mod, a mod can tell its pack where and when something happened, such as an explosion's centre and age, for a cloud or a shock wave ray marched in a post pass against scene_depth. Values that aren't finite read as 0, and all are 0 when no mod sets them.

docs/api/shaders-reference.md is regenerated (HORIZON_WRITE_DOCS=1 cargo test -p horizon-shader-api --test reference), and docs/api/shaders.md has a changelog line.

An example pack that uses it (a mushroom cloud and an expanding dust ring, 539 expressions, 2 texture reads) passes horizon-shader check on this branch.

Kind

  • feature: something new for players (listed under New in the release notes)

Vanilla reference

Horizon-only.

Other projects' code

none

Self-check

Run from the fork against upstream/main (d30588e), Rust 1.97:

cargo fmt -p horizon-client: clean
cargo test -p horizon-client --bin horizon-client shader_params: pass
cargo clippy -p horizon-client --bins --tests -- -D warnings -A clippy::manual_range_contains: pass
  (the allow is for horizon-world/src/worldgen/aquifer/noise_based.rs:476, a lint new in Rust 1.97 that fails on main too)

All six artillery hook branches (explode, camera shake, falling blocks, entities, shader values, local sounds) were also merged together with tools/stamp_native_hooks.py run locally (not committed) and their tests run there.

Also cargo test -p horizon-shader-api and cargo test -p horizon-client-render --lib native_post: pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XnU6QSxLfzUbudHhcvZtgy


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5411 **Author:** [@Vaspyyy](https://github.com/Vaspyyy) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/native-shader-params` --- ### 📝 Commits (10+) - [`39755f9`](https://github.com/horizon-rust/horizon/commit/39755f90ff4e2b9b54162bf7d3e8e6440b6fde7d) Native mods and shader packs: native_shader_params hands a mod's pack eight values - [`de92159`](https://github.com/horizon-rust/horizon/commit/de92159b98dfbb9ba0c4fc7317c75d49190a8019) Native mods: native_spawn_falling_block throws a block from a server mod - [`46598a2`](https://github.com/horizon-rust/horizon/commit/46598a2bc52ac26151a20a2e55688d7b36862639) Native mods: native_play_local_sound plays a client mod's sound, later - [`d356420`](https://github.com/horizon-rust/horizon/commit/d356420e7613a751015a5de5c07030ff8439b7ff) Merge main into feat/native-shader-params - [`1ec53c7`](https://github.com/horizon-rust/horizon/commit/1ec53c7a3f2009cdc8739dfb2d56436ea0e4b868) Merge remote-tracking branch 'upstream/main' into feat/native-falling-blocks - [`a209fab`](https://github.com/horizon-rust/horizon/commit/a209fab13eab95be14ebba8f91b98718318a76f3) Native hooks: finite keeps its own doc comment - [`f58fe06`](https://github.com/horizon-rust/horizon/commit/f58fe06685a562cc8fbcdedd6b6bf8e5c542bf34) Native hooks: finite keeps its own doc comment - [`a844d55`](https://github.com/horizon-rust/horizon/commit/a844d558153f562ee61afe38fffb31005c11e319) Merge main into #5409 - [`27fb1b4`](https://github.com/horizon-rust/horizon/commit/27fb1b40c62bd2dedffe32f9e75685dcea77c462) Merge main into #5410 - [`68b5f9e`](https://github.com/horizon-rust/horizon/commit/68b5f9e5256932bcfac40d12851da94a647d30ac) native_play_local_sound: check the event with sound_id, as native_play_sound does ### 📊 Changes **14 files changed** (+311 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/audio.rs` (+12 -2) 📝 `crates/horizon-client-render/src/gfx/native_post.rs` (+1 -0) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -0) ➕ `crates/horizon-client/src/game/native_falling.rs` (+130 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+98 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+1 -0) 📝 `crates/horizon-shader-api/src/inputs.rs` (+7 -2) 📝 `docs/api/shaders-reference.md` (+1 -0) 📝 `docs/api/shaders.md` (+2 -0) 📝 `docs/native-mods.md` (+33 -0) ➕ `tools/native-hook-fragments/native_falling_block.json` (+8 -0) ➕ `tools/native-hook-fragments/native_local_sound.json` (+5 -0) ➕ `tools/native-hook-fragments/native_shader_params.json` (+10 -0) </details> ### 📄 Description <!-- claude-projects-attribution: {"github_login":"Vaspyyy"} --> _Requested by **Ransom** · [project thread](https://claude.ai/code/project/chan_014LE6qsPXZ5YJ26HjaADSTZ?thread=cmsg_014LE6qsPXZ5YJ26HjaADSTZ1T4cmgL2QQ21WRYQVKMdRd)_ > 🤖 Opened by Vaspyyy's AI agent (Claude Code, Claude Opus 5.5), not by Vaspyyy personally. ## What and why A client hook, `native_shader_params(partial, params)`, asked once a frame for eight `[f32; 4]`. Every stage of a Horizon shader pack reads them as `frame.mods` (`array<vec4<f32>, 8>`, appended to `Frame`). What they mean is the mod's own: with #4413's rule that a pack bundled as `native-<mod id>` belongs to that mod, a mod can tell its pack where and when something happened, such as an explosion's centre and age, for a cloud or a shock wave ray marched in a post pass against `scene_depth`. Values that aren't finite read as 0, and all are 0 when no mod sets them. `docs/api/shaders-reference.md` is regenerated (`HORIZON_WRITE_DOCS=1 cargo test -p horizon-shader-api --test reference`), and `docs/api/shaders.md` has a changelog line. An example pack that uses it (a mushroom cloud and an expanding dust ring, 539 expressions, 2 texture reads) passes `horizon-shader check` on this branch. ## Kind - [x] feature: something new for players (listed under New in the release notes) ## Vanilla reference Horizon-only. ## Other projects' code none ## Self-check Run from the fork against `upstream/main` (d30588e), Rust 1.97: ``` cargo fmt -p horizon-client: clean cargo test -p horizon-client --bin horizon-client shader_params: pass cargo clippy -p horizon-client --bins --tests -- -D warnings -A clippy::manual_range_contains: pass (the allow is for horizon-world/src/worldgen/aquifer/noise_based.rs:476, a lint new in Rust 1.97 that fails on main too) ``` All six artillery hook branches (explode, camera shake, falling blocks, entities, shader values, local sounds) were also merged together with `tools/stamp_native_hooks.py` run locally (not committed) and their tests run there. Also `cargo test -p horizon-shader-api` and `cargo test -p horizon-client-render --lib native_post`: pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XnU6QSxLfzUbudHhcvZtgy --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:16:57 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6269
No description provided.