[PR #416] [MERGED] F3 shows vanilla's debug crosshair (world axes) #2548

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/416
Author: @ludovic111
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ludovic111

Base: main ← Head: fix/f3-crosshair


📝 Commits (1)

  • 850788d F3 shows the debug crosshair's world axes (#375)

📊 Changes

3 files changed (+73 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+9 -1)
📝 crates/horizon-client/src/game/debug_keys.rs (+5 -0)
📝 crates/horizon-client/src/gizmos.rs (+59 -0)

📄 Description

Fixes #375

What vanilla does

In the default debug profile (DebugScreenEntries.PROFILES), 3d_crosshair is IN_OVERLAY, so it's on whenever F3 is open. It is a DebugEntryNoop, hidden with reduced debug info.

  • Hud.extractCrosshair skips the 2D crosshair sprite, and the attack indicator with it, while the entry is enabled.
  • GameRenderer.renderLevel draws DebugCrosshairRenderer when the entry is on, in first person, with the HUD shown (not F1). It draws axes at one unit ahead in view space, turned by the camera's rotation so they stay aligned with the world, and scaled by 0.01 * guiScale (-x, y, -z, which cancels the view's 180° turn). Each axis is a 4 px black line (LINES) under a 2 px coloured one (LINES_DEPTH_BIAS): X 0xFFFF0000, Y 0xFF00FF00, Z 0xFF7F7FFF.

Fix

  • Gizmos::debug_crosshair builds the six lines from the camera position, pitch, yaw and GUI scale. The frame adds them to the on-top gizmo lines, black first.
  • Game::debug_crosshair() is the entry's state: overlay open and debug info not reduced. The 2D crosshair is skipped while it's on.

Difference: Horizon draws the axes as on-top lines, while vanilla depth-tests them. A block closer than one unit to the eye could hide part of vanilla's axes and won't hide these.

Verified

  • Unit test gizmos::tests::debug_crosshair_is_the_world_axes_ahead_of_the_camera: looking south at GUI scale 2, the lines start one block ahead and run +0.01*2 along X, Y and Z, black at 4 px, then red, green and light blue at 2 px. cargo test -p horizon-client --lib -- gizmos: 4 passed.
  • In the game, offscreen at 1280×720 (GUI scale 3) with F3 open: the 2D crosshair is gone and the three axes sit at the screen centre, about 15 px long, matching 0.03 blocks at one block with FOV 70 (screenshot checked).
  • Independent of the overlay PR (#414).

Self-check (combined branch of the batch's seven PRs, #406 #407 #409 #414 #416 #421 #423, on origin/main d28521f7; Mac mini):

  • cargo fmt --all --check: ok
  • cargo clippy --workspace --all-targets -- -D warnings: ok
  • cargo test -p horizon-client: 775 passed, 0 failed
  • tools/parity.py --changed origin/main (82 harnesses, including the new world_reopen): 82 pass.
    • The first pass found two #407 regressions, both fixed in #407 and rerun green: command_parse (suggestions were pruned in brigadier itself rather than only in the player's chat) and dedicated_server (dedicated-server guests lost their ops-based commands).
    • 34 harnesses passed on the combined commit before those two #407 fixes. The other 48 plus the two reruns passed after them.
  • Not run: the Linux and Windows checks (this batch was developed and checked on the Mac mini only).

🤖 Generated with Claude Code


🔄 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/416 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/f3-crosshair` --- ### 📝 Commits (1) - [`850788d`](https://github.com/horizon-rust/horizon/commit/850788d46c18b6c0808a06ea7b20439e34da49fb) F3 shows the debug crosshair's world axes (#375) ### 📊 Changes **3 files changed** (+73 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+9 -1) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+5 -0) 📝 `crates/horizon-client/src/gizmos.rs` (+59 -0) </details> ### 📄 Description Fixes #375 ## What vanilla does In the default debug profile (`DebugScreenEntries.PROFILES`), `3d_crosshair` is `IN_OVERLAY`, so it's on whenever F3 is open. It is a `DebugEntryNoop`, hidden with reduced debug info. - `Hud.extractCrosshair` skips the 2D crosshair sprite, and the attack indicator with it, while the entry is enabled. - `GameRenderer.renderLevel` draws `DebugCrosshairRenderer` when the entry is on, in first person, with the HUD shown (not F1). It draws axes at one unit ahead in view space, turned by the camera's rotation so they stay aligned with the world, and scaled by `0.01 * guiScale` (`-x, y, -z`, which cancels the view's 180° turn). Each axis is a 4 px black line (`LINES`) under a 2 px coloured one (`LINES_DEPTH_BIAS`): X `0xFFFF0000`, Y `0xFF00FF00`, Z `0xFF7F7FFF`. ## Fix - `Gizmos::debug_crosshair` builds the six lines from the camera position, pitch, yaw and GUI scale. The frame adds them to the on-top gizmo lines, black first. - `Game::debug_crosshair()` is the entry's state: overlay open and debug info not reduced. The 2D crosshair is skipped while it's on. Difference: Horizon draws the axes as on-top lines, while vanilla depth-tests them. A block closer than one unit to the eye could hide part of vanilla's axes and won't hide these. ## Verified - Unit test `gizmos::tests::debug_crosshair_is_the_world_axes_ahead_of_the_camera`: looking south at GUI scale 2, the lines start one block ahead and run `+0.01*2` along X, Y and Z, black at 4 px, then red, green and light blue at 2 px. `cargo test -p horizon-client --lib -- gizmos`: 4 passed. - In the game, offscreen at 1280×720 (GUI scale 3) with F3 open: the 2D crosshair is gone and the three axes sit at the screen centre, about 15 px long, matching `0.03` blocks at one block with FOV 70 (screenshot checked). - Independent of the overlay PR (#414). **Self-check** (combined branch of the batch's seven PRs, #406 #407 #409 #414 #416 #421 #423, on origin/main d28521f7; Mac mini): - `cargo fmt --all --check`: ok - `cargo clippy --workspace --all-targets -- -D warnings`: ok - `cargo test -p horizon-client`: 775 passed, 0 failed - `tools/parity.py --changed origin/main` (82 harnesses, including the new `world_reopen`): 82 pass. - The first pass found two #407 regressions, both fixed in #407 and rerun green: `command_parse` (suggestions were pruned in brigadier itself rather than only in the player's chat) and `dedicated_server` (dedicated-server guests lost their ops-based commands). - 34 harnesses passed on the combined commit before those two #407 fixes. The other 48 plus the two reruns passed after them. - Not run: the Linux and Windows checks (this batch was developed and checked on the Mac mini only). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:57:06 +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#2548
No description provided.