feat(examples): perry-embed — Bloom inside a Perry UI app, on stock Perry#103
Merged
Conversation
…erry
Adds examples/perry-embed: a normal Perry UI app whose viewport is a live Bloom
3D scene. Verified building AND running against the stock toolchain — no fork.
This supersedes a demo that had been sitting outside any repo, unversioned, next
to a 25 MB binary, with a README whose headline requirement was
`PERRY=/path/to/perry-with-bloomview/perry.exe`. That requirement is VOID:
BloomView merged upstream (perry #2395, extended by #5519), it is in Perry's
public API manifest, and Perry implements it on windows/macos/ios/tvos/visionos/
android/gtk4 — so "Currently implemented on the Windows target" was wrong too.
Retargeted to the current API while moving it:
- bloomViewGetNativeHandle, not bloomViewGetHwnd (a deprecated alias, #5519)
- attachToNativeView, not attachToHwnd (Windows-only, and returns void so a
caller cannot tell whether the attach failed)
- onFrame + re-arm, not setInterval — the host's run loop should drive us
- attach on the first frame the handle is NON-ZERO, not merely the first tick:
the native view exists immediately but its handle is only usable once the
window is on screen. The old code attached unconditionally on tick 1 and got
away with it.
Also fixes a real trap in the engine's own surface: the `bloom` ROOT exported
ONLY attachToHwnd — the deprecated, Windows-only, can't-fail-loudly one — while
the portable attachToNativeView was reachable only from `bloom/core`. The root
now exports the portable ones too, and attachToHwnd carries a @deprecated note
pointing at them. Exporting only the wrong call is a good way to make everyone
write the wrong call.
Home: examples/ next to the other six, versioned with the engine that has to keep
it working, rather than a standalone repo that can rot unnoticed.
Verified: builds + runs on stock Perry (window "Perry UI × Bloom" with the 3D
scene rendering inside the BloomView); shooter still builds + runs after the
root-export change.
Claude-Session: https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a Perry UI example that embeds a live Bloom 3D scene through ChangesPerry Bloom embedding
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PerryApp
participant BloomView
participant BloomRenderer
PerryApp->>BloomView: create embedded viewport
PerryApp->>BloomView: read native handle on frame
BloomView-->>PerryApp: return non-zero native handle
PerryApp->>BloomRenderer: attachToNativeView(handle)
PerryApp->>BloomRenderer: configure lights and draw animated scene
PerryApp->>PerryApp: re-arm onFrame(frame)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Adds
examples/perry-embed: a normal Perry UI app whose viewport is a liveBloom 3D scene. Verified building and running against the stock toolchain —
no fork.
The premise it was built on is void
This supersedes a demo that sat outside any repo, unversioned, next to a
25 MB binary, whose README's headline requirement was
PERRY=/path/to/perry-with-bloomview/perry.exe.BloomView merged upstream — perry #2395, extended by #5519. It's in
Perry's public API manifest, and Perry implements it on windows, macos, ios,
tvos, visionos, android and gtk4 — so "Currently implemented on the Windows
target" was wrong too. The demo was a fork-requiring, Windows-only,
deprecated-API copy of something upstream does better on seven platforms.
Retargeted to the current API
bloomViewGetHwndbloomViewGetNativeHandleattachToHwndattachToNativeViewsetInterval(…, 16)onFrame+ re-armIt also fixes a real trap in our own surface
The
bloomroot exported onlyattachToHwnd— the deprecated, Windows-only,returns-
void-so-you-can't-detect-failure one — while the portableattachToNativeViewwas reachable only frombloom/core. Exporting only thewrong call is a good way to make everyone write the wrong call. The root now
exports the portable ones, and
attachToHwndcarries a@deprecatedpointing atthem.
Home
examples/, next to the other six — versioned with the engine that has to keepit working, rather than a standalone repo that rots unnoticed. (Perry ships a 2D
version at
examples/bloomview_embed_demo.ts; this is the 3D counterpart —lighting, camera, depth.)
Verified
rendering inside the
BloomView(screenshot above is that run);https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp
Summary by CodeRabbit
New Features
Documentation