fix(world): size world backgrounds from the camera's extent, not viewport * 5 - #199
Merged
Conversation
…port * 5 A halo config behaved differently in a slide view and a world view: the same radius: 0.55 that reads as a half-screen glow became a wash flooding every frame. HaloZone documents its fields as fractions of width/height; in a world view they were fractions of a hardcoded 5x viewport. Two problems in one line. The unit changed silently with the view type, and 5.0 was unrelated to the world's actual extent — a world spanning two viewports got the same canvas as one spanning ten, so calibrating a halo was trial and error with no rule to reason from. WorldTimeline::world_extent derives the surface from the camera's own waypoints: the union of one viewport-sized rect per waypoint, which is exactly the span the camera ever shows. The origin travels with it, so negative world-positions are inside the world rather than off its edge. HaloZone's doc comments now name the surface for both view types. Visual change: any world-view halo calibrated against the old 5x canvas covers a different share of the frame now — proportionally larger for a world smaller than five screens, which is most of them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #189.
What
The same
haloconfig behaved differently in aslideview and aworldview: aradius: 0.55that reads as a half-screen glow became a >5000px wash flooding every frame.crates/rustmotion/src/engine/render/background.rs:68:while
HaloZonedocuments its fields as fractions of width/height.Two problems in one line:
5.0was unrelated to the world's actual extent, which is determined by the scenes'world-positionvalues. A world spanning two viewports got the same canvas as one spanning ten — so calibrating a halo was trial and error with no rule to reason from.How
WorldTimeline::world_extent(vw, vh)returns the union of one viewport-sized rect per camera waypoint — exactly the span the camera ever shows — as(x, y, width, height). The origin travels with it, so negativeworld-positions are inside the world rather than off its edge, which the old0..w*5framing could not express.draw_world_bg_with_parallaxtakes that extent instead of computing its own, andHaloZone's doc comments name the surface for both view types.Visual change
Any world-view halo calibrated against the old 5x canvas now covers a different share of the frame — proportionally larger for a world smaller than five screens, which is most of them. Checked against the 3-beat world view in the showcase scenario: the halos went from near-invisible points to a proportionate ambient glow, text still legible, register unchanged. Slide views are untouched.
Tests
Four on
world_extent, no rendering needed:viewport * 5.0claimed five, and divided every radius by five with itcargo test --workspacegreen,cargo fmt --checkandcargo clippy --all-targets -- -D warningsclean.