feat(engine): camera focal point and multi-plane parallax#97
Merged
Conversation
- Camera gains origin {x, y} (frame px, absent = centre, keyframable
as origin.x/origin.y following the component dotted convention):
translate/rotate/zoom pivot around the resolved origin at all four
call sites — zoom onto an element, pan the focal point between
keyframes
- CssStyle gains depth (default 1.0): planes are the scene's direct
children; with a camera and any explicit depth, rendering switches
to per-plane camera application (pan*d, zoom'=1+(zoom-1)*d,
rotation*d around the origin, content-space clip) carried through
PaintFrame; depth 0 locks a background, >1 amplifies foregrounds;
no depth declared anywhere keeps the global path untouched and the
depth-1 invariant is byte-identity-tested against it
- hit-map follows each plane's matrix (tested), geometry validate is
layout-space (unaffected), world views stay on the global path,
incremental hashing follows automatically; dynamic-depth skill rule
gains the real-parallax mechanism
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 #89. Closes #90. Second PR of the dynamic-videos wave (#95), rebuilt cleanly on main after the foundations squash.
#89 — camera focal point:
camera.origin {x, y}(frame px; absent = centre, byte-identical), keyframable asorigin.x/origin.y(dotted, matching the component convention). Translate/rotate/zoom pivot around the resolved origin at all four call sites (render, hit-map, world per-scene, incremental fg) — "zoom onto this element, then pan the focal point" is now one keyframe track. Documented footgun: a partial origin defaults the missing axis to 0.#90 — multi-plane parallax:
style.depth(default 1.0). Planes are the scene's direct children; with a camera and any explicit depth, rendering switches to per-plane camera application (pan·d,zoom' = 1+(zoom−1)·d,rotation·daround the origin, content-space clip) carried viaPaintFrame. Depth 0 locks a background; >1 amplifies foregrounds; nested depths have no camera effect in v1 (documented). No depth anywhere → the untouched global path, and the depth-1 invariant is byte-identity-tested against it. Hit-map follows each plane's matrix (tested); geometry validate is layout-space (unaffected); world views stay global; incremental hashing follows.Tests: 8 new (exact predicted centroids for corner-origin zoom, keyframed origin travel, locked/2×/identity planes, plane-aware hit rects). 448 total on the rebuilt branch, all green; 3 example scenarios validate unchanged.
Verify:
cargo test --workspace→ 448 passed ✓ ·cargo fmt --check✓ · clippy gated ≤1 ✓