Skip to content

feat: add nemo-bevy crate for Bevy 3D embedding in GPUI#4

Open
geoffjay wants to merge 1 commit intomainfrom
bevy-embed
Open

feat: add nemo-bevy crate for Bevy 3D embedding in GPUI#4
geoffjay wants to merge 1 commit intomainfrom
bevy-embed

Conversation

@geoffjay
Copy link
Owner

Summary

  • Adds nemo-bevy crate implementing a headless Bevy 0.15 renderer on a background thread that streams RGBA frames to GPUI via ImageSource::Custom + RenderImage
  • Adds BevyScene GPUI component with continuous repaint (request_animation_frame), mouse move/click, and scroll wheel input forwarding
  • Feature-gated behind bevy feature flag on the nemo crate — existing builds are unaffected

Architecture

GPUI main thread                        Bevy background thread
──────────────                          ─────────────────────
BevyScene component                     App::new() headless
  └── img(ImageSource::Custom(..))        + ScheduleRunnerPlugin (60fps)
        └── reads LatestFrame               + ImageCopyPlugin (render graph)
              ↑                               + Camera → RenderTarget::Image
              └──── crossbeam channel ←──── texture → buffer → Vec<u8>

New files

  • crates/nemo-bevy/ — standalone crate with BevyRenderer, FrameData, LatestFrame, BevyInputEvent
  • crates/nemo/src/components/bevy_scene.rsBevyScene + BevySceneState GPUI component

Modified files

  • Workspace Cargo.toml — added member + dependency
  • crates/nemo/Cargo.toml — optional nemo-bevy dep + bevy feature
  • crates/nemo/src/components/{mod,state}.rs — cfg-gated module + ComponentState::Bevy variant
  • crates/nemo/src/app.rsget_or_create_bevy_state() + "bevy_scene" render arm
  • crates/nemo-registry/src/builtins.rs — registered bevy_scene with width/height schema

Test plan

  • cargo check -p nemo-bevy — standalone compilation
  • cargo check -p nemo --features bevy — integration compilation
  • cargo check -p nemo — existing build unaffected (no bevy feature)
  • cargo test -p nemo-bevy — 4 unit tests pass (frame conversion, LatestFrame store/take/peek)
  • cargo test -p nemo-registry — builtins registration test passes with new component
  • Manual: create XML config with <bevy_scene> and verify spinning cube renders in GPUI window

🤖 Generated with Claude Code

Implements a headless Bevy renderer on a background thread that sends
RGBA frames to GPUI via ImageSource::Custom + RenderImage. Includes a
custom render graph node (ImageCopyPlugin) for GPU texture readback,
frame forwarding with RGBA/BGRA conversion, and input event bridging.

- New crate: nemo-bevy with BevyRenderer, FrameData, LatestFrame types
- New component: BevyScene with continuous repaint and mouse/scroll forwarding
- Feature-gated behind `bevy` feature on the nemo crate
- Default demo scene: spinning cube with directional light
- Registered bevy_scene component with width/height schema

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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