Skip to content

feat(examples): perry-embed — Bloom inside a Perry UI app, on stock Perry#103

Merged
proggeramlug merged 1 commit into
mainfrom
feat/perry-embed-example
Jul 15, 2026
Merged

feat(examples): perry-embed — Bloom inside a Perry UI app, on stock Perry#103
proggeramlug merged 1 commit into
mainfrom
feat/perry-embed-example

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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
.

screenshot

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

was now why
bloomViewGetHwnd bloomViewGetNativeHandle the old name is a deprecated alias (#5519)
attachToHwnd attachToNativeView portable, and returns whether it worked
setInterval(…, 16) onFrame + re-arm the host's run loop should drive us
attach on tick 1 attach on the first non-zero handle the view exists immediately; its handle is only usable once the window is on screen. The old code attached unconditionally and got away with it.

It also fixes a real trap in our own surface

The bloom root exported only attachToHwnd — the deprecated, Windows-only,
returns-void-so-you-can't-detect-failure one — while the portable
attachToNativeView was reachable only from bloom/core. Exporting only the
wrong call is a good way to make everyone write the wrong call.
The root now
exports the portable ones, and attachToHwnd carries a @deprecated pointing at
them.

Home

examples/, next to the other six — versioned with the engine that has to keep
it 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

  • builds and runs on stock Perry: window "Perry UI × Bloom" with the scene
    rendering inside the BloomView (screenshot above is that run);
  • shooter still builds and runs after the root-export change.

https://claude.ai/code/session_01J1UWgMcrTNvwWeXcJ1T3Fp

Summary by CodeRabbit

  • New Features

    • Added a Perry example that embeds and renders an animated Bloom 3D scene.
    • Added support for attaching Bloom to native platform views across supported platforms.
    • Added setup instructions and usage guidance for embedding Bloom in Perry applications.
  • Documentation

    • Marked the Windows-specific attachment method as deprecated and directed developers to the portable alternative.

…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
@proggeramlug proggeramlug merged commit 7bd016c into main Jul 15, 2026
@proggeramlug proggeramlug deleted the feat/perry-embed-example branch July 15, 2026 18:17
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bb2cdab-33e2-41c9-b8e0-a99772df4dc7

📥 Commits

Reviewing files that changed from the base of the PR and between 12ae8b9 and 9f79480.

⛔ Files ignored due to path filters (1)
  • examples/perry-embed/screenshot.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • examples/perry-embed/README.md
  • examples/perry-embed/main.ts
  • examples/perry-embed/package.json
  • src/core/index.ts
  • src/index.ts

📝 Walkthrough

Walkthrough

Adds a Perry UI example that embeds a live Bloom 3D scene through BloomView, exposes portable native-view attachment APIs, and documents deprecated Windows attachment guidance.

Changes

Perry Bloom embedding

Layer / File(s) Summary
Portable embedding API surface
src/index.ts, src/core/index.ts
Exports portable and platform-specific native-view attachment functions and documents attachToHwnd as deprecated.
Perry example setup
examples/perry-embed/package.json, examples/perry-embed/README.md, examples/perry-embed/main.ts
Adds package configuration, native-library permissions, embedding instructions, viewport setup, and Perry UI layout.
Frame-driven Bloom rendering
examples/perry-embed/main.ts
Waits for a non-zero native handle, attaches Bloom once, configures lighting, renders an animated scene, and re-arms onFrame.

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)
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/perry-embed-example

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant