Skip to content

macOS display backend + parented-text / spritesheet / hierarchical-visibility engine fixes#7

Open
a-korath wants to merge 5 commits into
code-wolf-byte:mainfrom
a-korath:macos
Open

macOS display backend + parented-text / spritesheet / hierarchical-visibility engine fixes#7
a-korath wants to merge 5 commits into
code-wolf-byte:mainfrom
a-korath:macos

Conversation

@a-korath

Copy link
Copy Markdown

Adds a macOS display backend (counterpart of the Wayland one) plus three engine fixes found while testing scenes on macOS. Rebuilt on top of current main (merged in the audio/particle/3D-mesh/drop-dead-render-stack work first), builds clean, tests green.

macOS backend (src/platform/macos/mod.rs, +321)

  • Implements DisplayPlatform: a scene renders into a borderless winit window on a wgpu Metal surface (GpuSceneInstance::render_to_view, no readback), pinned to the desktop layer via pin_to_desktop (kCGDesktopWindowLevel, CanJoinAllSpaces | Stationary, ignoresMouseEvents).
  • Because winit needs the main thread, spawn_wallpaper launches a child wp-engine set-file <dir> process; run_wallpaper_on_main drives the loop. detect_platform() selects the backend at runtime.
  • Wayland deps gated to Linux in Cargo.toml; wgpu metal feature enabled. The egui browser lists Workshop items on macOS and "Apply Wallpaper" works.
  • Known gaps (documented): activation-policy .accessory/click-through, clean SIGINT exit, multi-monitor, Static/Video routing, GUI child-process Drop-stop.

Engine fixes (platform-independent)

  • Hierarchical visibilityScene::visibility_mask() culls a layer when it or any ancestor is hidden (fixes overlapping multi-language clock/date groups). Folded in main's per-object visible_script() rule so script-driven-visibility layers survive load. Unit-tested.
  • Parented script-text stays put on content change — the authored-size text quad's rect is left untouched when the text swaps (the old per-change ortho recompute from the un-parented local origin moved a parented clock off-screen).
  • SPRITESHEET frame selection + the thisLayer.getTextureAnimation().setFrame(n) script API — a 2-frame AM/PM atlas now shows only the current period lit instead of both cells ("doubled").

Note on tests

Removes tests/{frame_context,render_graph,wgpu_scene,shader,workshop}.rs — they import modules deleted by main's "drop dead render stack" and no longer compile on main. Follow-up worth doing: a workshop-scan smoke test against the new render stack.

🤖 Generated with Claude Code

Akorath and others added 5 commits July 13, 2026 23:08
Wire a macOS display backend into the existing DisplayPlatform seam and make
the crate build on macOS.

- Gate the Wayland dependency stack + `wayland` module + WaylandPlatform branch
  of `detect_platform` to `#[cfg(target_os = "linux")]`; keep raw-window-handle
  shared. This removes the libwayland link that blocked macOS builds.
- Flatten src/platform/macos/mod.rs (drop the double-nested inner module) and
  add MacOSPlatform: DisplayPlatform, returned by detect_platform on macOS.
  Rendering is stubbed (spawn_wallpaper bails with a clear message) pending the
  winit/wgpu-surface render loop.
- Pin macOS deps to winit's objc2 line (winit 0.30, objc2 0.5, objc2-app-kit
  0.2) so MacOSPlatform shares winit's NSWindow types.
- Document shaderc-on-macOS (brew + gitignored .cargo/config.toml
  SHADERC_LIB_DIR) in README; gitignore .cargo/ and CLAUDE.md.
- Add DECISIONS.md, INTERVIEW.md, PROGRESS.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…old render_TRS into render

Desktop backend now behaves as a wallpaper:
- pin_to_desktop sinks the winit window to kCGDesktopWindowLevel with
  CanJoinAllSpaces | Stationary + ignoresMouseEvents; app-lifecycle wiring runs
  the loop on the main thread (run_wallpaper_on_main).
- find_steam_library_roots also scans ~/Library/Application Support/Steam
  (existence-filtered, inert on Linux) so the egui browser lists Workshop items
  on macOS.

Engine:
- Fold the iterated render_TRS.rs back into src/engine/render.rs and drop the
  #[path] override; delete the old shadowed render.rs. Rename only.
- Ripple/water band-aid: WP_ENGINE_ADDITIVE_BRIGHTNESS (default 0.55) scales
  additive image layers down so the LonelyCat water layer doesn't blow out white.
  Real fix (backdrop capture coupled with a replace composite) is documented in
  PROGRESS.md / DECISIONS.md for the engine track.

Docs: PROGRESS/DECISIONS/README/CLAUDE updated for the above and the known
window-focus gap (NSApp .accessory still pending).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fix code-wolf-byte#1 (LonelyCat clock vanishing on minute change): apply_parent_transforms
now pushes TextDynamic::raw_origin through the parent world transform and
scales by the parent scale, so the minute-rollover re-rasterize computes the
rect in world space instead of the un-parented local origin.

Fix code-wolf-byte#3 (LonelyCat AM/PM doubled): expose thisLayer.getTextureAnimation()
.setFrame(n) in the boa script engine (+ eval_frame to capture the side
effect); LoadedImage now carries the .tex TEXS frames (sprite_frames) when the
model->material chain declares the SPRITESHEET combo, and select_spritesheet_frame
swaps in the single cell the object's frame script selects. Frame is picked once
at load from the wall clock (ponytail ceiling noted).

SAO hair (attachment) remains a documented gap: real cause is unimplemented
puppet bone `attachment`, not cropoffset (ruled out). See PROGRESS.md.

Also: macOS spawn_wallpaper launches a child `set-file` process so the egui
GUI's "Apply Wallpaper" works (two winit loops can't share the main thread).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…dir)

These are local working notes for the macOS-compat effort, not something to
carry in the wp-engine repo or upstream in a PR. Relocated one level up to
WP-Engine/ alongside CLAUDE.md; README.md remains the tracked source of truth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…econcile

Brings in ~12 upstream commits (audio reactivity, GPU particle rendering,
static 3D mesh loading, particle remapvalue + puppet animation-layer blending,
scripted transforms/text fidelity, and the "drop dead render stack" removal of
frame_context/render_graph/engine/engine_object/effect_diagnostics/shader/
wgpu_scene) on top of the macOS backend + engine fixes.

Conflict resolution (render.rs, gpu_renderer.rs) — both intents preserved:
- kept hierarchical visibility (Scene::visibility_mask) AND upstream's light +
  3D-mesh layer branches; folded upstream's per-object visible_script() rule
  into visibility_mask so script-driven-visibility layers survive load.
- kept Fix code-wolf-byte#1 (parented text: leave the authored-size quad's rect untouched on
  content change) over upstream's raw_origin rect-recompute — self-consistent
  with the merged TextDynamic (no raw_origin field). Verified: LonelyCat clock
  renders in place.
- kept Fix code-wolf-byte#3 (SPRITESHEET frame select) AND upstream's puppet animationlayers.
  Verified: AM lit / PM dimmed at 11:00 (not doubled).
- kept text aspect-fit AND upstream's baked-bg no-retint; took upstream's mesh
  material/color helpers and transform-scripts block wholesale.

Removed 5 test files orphaned by upstream's stack removal (they import the
deleted modules and are already red on origin/main): frame_context,
render_graph, wgpu_scene, shader, workshop. Follow-up: re-add a workshop-scan
smoke test against the new render stack.

cargo build + cargo test (158 lib + camera/effect/properties + doctests) green.

Co-Authored-By: Claude Opus 4.8 <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.

2 participants