From 45d606d55a7079fd57d18a0783381beb5c5c54e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?charlotte=20=F0=9F=8C=B8?= Date: Tue, 10 Mar 2026 13:56:39 -0700 Subject: [PATCH 1/6] Add processing_core crate and webcam support --- Cargo.lock | 653 ++++++++++++++---- Cargo.toml | 17 + crates/processing_core/Cargo.toml | 13 + .../src/config.rs | 4 - .../src/error.rs | 2 + crates/processing_core/src/lib.rs | 49 ++ crates/processing_pyo3/Cargo.toml | 2 + crates/processing_pyo3/src/graphics.rs | 8 +- crates/processing_pyo3/src/lib.rs | 19 + crates/processing_pyo3/src/webcam.rs | 61 ++ crates/processing_render/Cargo.toml | 5 +- .../src/geometry/attribute.rs | 2 +- .../processing_render/src/geometry/layout.rs | 2 +- crates/processing_render/src/geometry/mod.rs | 2 +- crates/processing_render/src/gltf.rs | 4 +- crates/processing_render/src/graphics.rs | 2 +- crates/processing_render/src/image.rs | 13 +- crates/processing_render/src/lib.rs | 280 ++------ crates/processing_render/src/material/mod.rs | 2 +- crates/processing_render/src/material/pbr.rs | 2 +- crates/processing_render/src/sketch.rs | 2 +- crates/processing_render/src/surface.rs | 3 +- crates/processing_render/src/transform.rs | 2 +- crates/processing_webcam/Cargo.toml | 13 + crates/processing_webcam/src/lib.rs | 112 +++ examples/glfw.rs | 2 +- examples/webcam.rs | 52 ++ src/lib.rs | 143 ++++ src/prelude.rs | 5 +- 29 files changed, 1092 insertions(+), 384 deletions(-) create mode 100644 crates/processing_core/Cargo.toml rename crates/{processing_render => processing_core}/src/config.rs (85%) rename crates/{processing_render => processing_core}/src/error.rs (95%) create mode 100644 crates/processing_core/src/lib.rs create mode 100644 crates/processing_pyo3/src/webcam.rs create mode 100644 crates/processing_webcam/Cargo.toml create mode 100644 crates/processing_webcam/src/lib.rs create mode 100644 examples/webcam.rs diff --git a/Cargo.lock b/Cargo.lock index 676be54..0b254fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,7 +90,7 @@ version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "getrandom 0.3.4", "once_cell", "version_check", @@ -138,7 +138,7 @@ checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43" dependencies = [ "alsa-sys", "bitflags 2.11.0", - "cfg-if", + "cfg-if 1.0.4", "libc", ] @@ -379,7 +379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" dependencies = [ "autocfg", - "cfg-if", + "cfg-if 1.0.4", "concurrent-queue", "futures-io", "futures-lite", @@ -487,7 +487,7 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bevy" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_internal", ] @@ -495,7 +495,7 @@ dependencies = [ [[package]] name = "bevy_a11y" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "accesskit", "bevy_app", @@ -507,7 +507,7 @@ dependencies = [ [[package]] name = "bevy_android" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "android-activity", ] @@ -515,7 +515,7 @@ dependencies = [ [[package]] name = "bevy_animation" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_animation_macros", "bevy_app", @@ -547,7 +547,7 @@ dependencies = [ [[package]] name = "bevy_animation_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "quote", @@ -557,7 +557,7 @@ dependencies = [ [[package]] name = "bevy_anti_alias" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -579,7 +579,7 @@ dependencies = [ [[package]] name = "bevy_app" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_derive", "bevy_ecs", @@ -587,7 +587,7 @@ dependencies = [ "bevy_reflect", "bevy_tasks", "bevy_utils", - "cfg-if", + "cfg-if 1.0.4", "console_error_panic_hook", "ctrlc", "downcast-rs 2.0.2", @@ -601,7 +601,7 @@ dependencies = [ [[package]] name = "bevy_asset" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "async-broadcast", "async-channel", @@ -644,7 +644,7 @@ dependencies = [ [[package]] name = "bevy_asset_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -655,7 +655,7 @@ dependencies = [ [[package]] name = "bevy_audio" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -672,7 +672,7 @@ dependencies = [ [[package]] name = "bevy_camera" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -697,7 +697,7 @@ dependencies = [ [[package]] name = "bevy_color" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_math", "bevy_reflect", @@ -712,7 +712,7 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -740,7 +740,7 @@ dependencies = [ [[package]] name = "bevy_derive" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "quote", @@ -750,7 +750,7 @@ dependencies = [ [[package]] name = "bevy_dev_tools" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -781,7 +781,7 @@ dependencies = [ [[package]] name = "bevy_diagnostic" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "atomic-waker", "bevy_app", @@ -798,7 +798,7 @@ dependencies = [ [[package]] name = "bevy_ecs" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "arrayvec", "bevy_ecs_macros", @@ -825,7 +825,7 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -836,7 +836,7 @@ dependencies = [ [[package]] name = "bevy_encase_derive" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -845,7 +845,7 @@ dependencies = [ [[package]] name = "bevy_feathers" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "accesskit", "bevy_a11y", @@ -874,7 +874,7 @@ dependencies = [ [[package]] name = "bevy_gilrs" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_ecs", @@ -889,7 +889,7 @@ dependencies = [ [[package]] name = "bevy_gizmos" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -908,7 +908,7 @@ dependencies = [ [[package]] name = "bevy_gizmos_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "quote", @@ -918,7 +918,7 @@ dependencies = [ [[package]] name = "bevy_gizmos_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -943,7 +943,7 @@ dependencies = [ [[package]] name = "bevy_gltf" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "async-lock", "base64", @@ -978,7 +978,7 @@ dependencies = [ [[package]] name = "bevy_image" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1006,7 +1006,7 @@ dependencies = [ [[package]] name = "bevy_input" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_ecs", @@ -1022,7 +1022,7 @@ dependencies = [ [[package]] name = "bevy_input_focus" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_ecs", @@ -1038,7 +1038,7 @@ dependencies = [ [[package]] name = "bevy_internal" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_a11y", "bevy_android", @@ -1094,7 +1094,7 @@ dependencies = [ [[package]] name = "bevy_light" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1118,7 +1118,7 @@ dependencies = [ [[package]] name = "bevy_log" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "android_log-sys", "bevy_app", @@ -1135,7 +1135,7 @@ dependencies = [ [[package]] name = "bevy_macro_utils" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "proc-macro2", "quote", @@ -1146,7 +1146,7 @@ dependencies = [ [[package]] name = "bevy_material" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_asset", "bevy_derive", @@ -1168,7 +1168,7 @@ dependencies = [ [[package]] name = "bevy_material_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "quote", @@ -1178,7 +1178,7 @@ dependencies = [ [[package]] name = "bevy_math" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "approx", "arrayvec", @@ -1197,13 +1197,13 @@ dependencies = [ [[package]] name = "bevy_mesh" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", "bevy_derive", "bevy_ecs", - "bevy_image", + "bevy_encase_derive", "bevy_math", "bevy_mikktspace", "bevy_platform", @@ -1212,28 +1212,14 @@ dependencies = [ "bitflags 2.11.0", "bytemuck", "derive_more", + "encase", + "glam", "hexasphere", "thiserror 2.0.18", "tracing", "wgpu-types", ] -[[package]] -name = "bevy_midi" -version = "0.13.0" -source = "git+https://github.com/BlackPhlox/bevy_midi?branch=latest#79963a94198b158de0ca0913942bb2d088f900b2" -dependencies = [ - "bevy", - "crossbeam-channel", - "getrandom 0.3.4", - "js-sys", - "midir", - "send_wrapper", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "bevy_mikktspace" version = "1.0.0" @@ -1243,8 +1229,9 @@ checksum = "bff34eb29ff4b8a8688bc7299f14fb6b597461ca80fec03ed7d22939ab33e48f" [[package]] name = "bevy_pbr" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ + "arrayvec", "bevy_app", "bevy_asset", "bevy_camera", @@ -1283,7 +1270,7 @@ dependencies = [ [[package]] name = "bevy_picking" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1306,7 +1293,7 @@ dependencies = [ [[package]] name = "bevy_platform" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "critical-section", "foldhash 0.2.0", @@ -1317,17 +1304,17 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde", - "spin", + "spin 0.10.0", "wasm-bindgen", "wasm-bindgen-futures", "web-time", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "bevy_post_process" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1351,12 +1338,12 @@ dependencies = [ [[package]] name = "bevy_ptr" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" [[package]] name = "bevy_reflect" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "assert_type_match", "bevy_platform", @@ -1384,7 +1371,7 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "indexmap", @@ -1397,7 +1384,7 @@ dependencies = [ [[package]] name = "bevy_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "async-channel", "bevy_app", @@ -1449,7 +1436,7 @@ dependencies = [ [[package]] name = "bevy_render_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -1460,7 +1447,7 @@ dependencies = [ [[package]] name = "bevy_scene" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1481,7 +1468,7 @@ dependencies = [ [[package]] name = "bevy_shader" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_asset", "bevy_platform", @@ -1498,7 +1485,7 @@ dependencies = [ [[package]] name = "bevy_sprite" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1523,7 +1510,7 @@ dependencies = [ [[package]] name = "bevy_sprite_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1555,7 +1542,7 @@ dependencies = [ [[package]] name = "bevy_state" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_ecs", @@ -1570,7 +1557,7 @@ dependencies = [ [[package]] name = "bevy_state_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_macro_utils", "quote", @@ -1580,7 +1567,7 @@ dependencies = [ [[package]] name = "bevy_tasks" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "async-channel", "async-executor", @@ -1598,7 +1585,7 @@ dependencies = [ [[package]] name = "bevy_text" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1625,7 +1612,7 @@ dependencies = [ [[package]] name = "bevy_time" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_ecs", @@ -1639,7 +1626,7 @@ dependencies = [ [[package]] name = "bevy_transform" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_ecs", @@ -1656,7 +1643,7 @@ dependencies = [ [[package]] name = "bevy_ui" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "accesskit", "bevy_a11y", @@ -1690,7 +1677,7 @@ dependencies = [ [[package]] name = "bevy_ui_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1721,7 +1708,7 @@ dependencies = [ [[package]] name = "bevy_ui_widgets" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "accesskit", "bevy_a11y", @@ -1740,7 +1727,7 @@ dependencies = [ [[package]] name = "bevy_utils" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "async-channel", "bevy_platform", @@ -1751,7 +1738,7 @@ dependencies = [ [[package]] name = "bevy_window" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "bevy_app", "bevy_asset", @@ -1769,7 +1756,7 @@ dependencies = [ [[package]] name = "bevy_winit" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#54b217b9a2d72ff4facb5caa8253e18078546630" +source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" dependencies = [ "accesskit", "accesskit_winit", @@ -1790,7 +1777,7 @@ dependencies = [ "bevy_tasks", "bevy_window", "bytemuck", - "cfg-if", + "cfg-if 1.0.4", "js-sys", "tracing", "wasm-bindgen", @@ -1799,6 +1786,29 @@ dependencies = [ "winit", ] +[[package]] +name = "bindgen" +version = "0.65.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 1.1.0", + "shlex", + "syn", + "which", +] + [[package]] name = "bindgen" version = "0.72.1" @@ -1872,7 +1882,7 @@ dependencies = [ "arrayref", "arrayvec", "cc", - "cfg-if", + "cfg-if 1.0.4", "constant_time_eq", "cpufeatures", ] @@ -2036,6 +2046,12 @@ dependencies = [ "nom 7.1.3", ] +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.4" @@ -2086,6 +2102,34 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" +[[package]] +name = "cocoa" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c49e86fc36d5704151f5996b7b3795385f50ce09e3be0f47a0cfde869681cf8" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation 0.7.0", + "core-graphics 0.19.2", + "foreign-types 0.3.2", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81411967c50ee9a1fc11365f8c585f863a22a9697c89239c452292c40ba79b0d" +dependencies = [ + "bitflags 2.11.0", + "block", + "core-foundation 0.10.1", + "core-graphics-types 0.2.0", + "objc", +] + [[package]] name = "codespan-reporting" version = "0.12.0" @@ -2135,7 +2179,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "wasm-bindgen", ] @@ -2184,13 +2228,23 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys 0.7.0", + "libc", +] + [[package]] name = "core-foundation" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.7", "libc", ] @@ -2200,16 +2254,34 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.7", "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "core-graphics" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.7.0", + "foreign-types 0.3.2", + "libc", +] + [[package]] name = "core-graphics" version = "0.23.2" @@ -2219,7 +2291,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", "core-graphics-types 0.1.3", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -2245,6 +2317,31 @@ dependencies = [ "libc", ] +[[package]] +name = "core-media-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "273bf3fc5bf51fd06a7766a84788c1540b6527130a0bce39e00567d6ab9f31f1" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "libc", +] + +[[package]] +name = "core-video-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "metal 0.18.0", + "objc", +] + [[package]] name = "core2" version = "0.4.0" @@ -2270,7 +2367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace" dependencies = [ "bitflags 1.3.2", - "core-foundation-sys", + "core-foundation-sys 0.8.7", "coreaudio-sys", ] @@ -2280,7 +2377,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ceec7a6067e62d6f931a2baf6f3a751f4a892595bcec1461a3c94ef9949864b6" dependencies = [ - "bindgen", + "bindgen 0.72.1", ] [[package]] @@ -2291,7 +2388,7 @@ checksum = "964eb3e10ea8b0d29c797086aab3ca730f75e06dced0cb980642fd274a5cca30" dependencies = [ "block", "core-foundation 0.9.4", - "core-foundation-sys", + "core-foundation-sys 0.8.7", "coremidi-sys", ] @@ -2301,7 +2398,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc9504310988d938e49fff1b5f1e56e3dafe39bb1bae580c19660b58b83a191e" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.7", ] [[package]] @@ -2311,7 +2408,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "873dab07c8f743075e57f524c583985fbaf745602acbe916a01539364369a779" dependencies = [ "alsa", - "core-foundation-sys", + "core-foundation-sys 0.8.7", "coreaudio-rs", "dasp_sample", "jni", @@ -2342,7 +2439,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", ] [[package]] @@ -2523,6 +2620,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.15.0" @@ -2724,6 +2827,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin 0.9.8", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2766,6 +2881,15 @@ dependencies = [ "smallvec", ] +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -2773,7 +2897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared", + "foreign-types-shared 0.3.1", ] [[package]] @@ -2787,6 +2911,12 @@ dependencies = [ "syn", ] +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -2847,6 +2977,12 @@ dependencies = [ "syn", ] +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + [[package]] name = "futures-task" version = "0.3.32" @@ -2876,13 +3012,26 @@ dependencies = [ "windows-link", ] +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if 1.0.4", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + [[package]] name = "getrandom" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "js-sys", "libc", "r-efi", @@ -2896,7 +3045,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "libc", "r-efi", "wasip2", @@ -2944,7 +3093,7 @@ dependencies = [ "vec_map", "wasm-bindgen", "web-sys", - "windows 0.62.2", + "windows 0.58.0", ] [[package]] @@ -3069,7 +3218,7 @@ dependencies = [ "log", "presser", "thiserror 2.0.18", - "windows 0.62.2", + "windows 0.58.0", ] [[package]] @@ -3114,7 +3263,7 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "crunchy", "num-traits", "zerocopy", @@ -3204,6 +3353,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "icu_locale_core" version = "2.1.1" @@ -3367,7 +3525,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" dependencies = [ "cesu8", - "cfg-if", + "cfg-if 1.0.4", "combine", "jni-sys", "log", @@ -3454,6 +3612,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "leb128fmt" version = "0.1.0" @@ -3499,7 +3663,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "windows-link", ] @@ -3669,7 +3833,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "rayon", ] @@ -3697,6 +3861,21 @@ dependencies = [ "autocfg", ] +[[package]] +name = "metal" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa", + "core-graphics 0.19.2", + "foreign-types 0.3.2", + "log", + "objc", +] + [[package]] name = "metal" version = "0.33.0" @@ -3706,7 +3885,7 @@ dependencies = [ "bitflags 2.11.0", "block", "core-graphics-types 0.2.0", - "foreign-types", + "foreign-types 0.5.0", "log", "objc", "paste", @@ -3767,6 +3946,31 @@ dependencies = [ "pxfm", ] +[[package]] +name = "mozjpeg" +version = "0.10.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7891b80aaa86097d38d276eb98b3805d6280708c4e0a1e6f6aed9380c51fec9" +dependencies = [ + "arrayvec", + "bytemuck", + "libc", + "mozjpeg-sys", + "rgb", +] + +[[package]] +name = "mozjpeg-sys" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f0dc668bf9bf888c88e2fb1ab16a406d2c380f1d082b20d51dd540ab2aa70c1" +dependencies = [ + "cc", + "dunce", + "libc", + "nasm-rs", +] + [[package]] name = "naga" version = "28.0.0" @@ -3776,7 +3980,7 @@ dependencies = [ "arrayvec", "bit-set", "bitflags 2.11.0", - "cfg-if", + "cfg-if 1.0.4", "cfg_aliases", "codespan-reporting", "half", @@ -3811,6 +4015,49 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "nannou_midi" +version = "0.1.0" +source = "git+https://github.com/nannou-org/nannou?branch=bevy-refactor#4347507fb0684bad53e8f86e9e8cbbe81fe0f1a7" +dependencies = [ + "bevy", + "crossbeam-channel", + "midir", +] + +[[package]] +name = "nannou_webcam" +version = "0.1.0" +source = "git+https://github.com/nannou-org/nannou?branch=bevy-refactor#4347507fb0684bad53e8f86e9e8cbbe81fe0f1a7" +dependencies = [ + "bevy", + "console_error_panic_hook", + "flume", + "getrandom 0.3.4", + "nokhwa", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "nasm-rs" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "706bf8a5e8c8ddb99128c3291d31bd21f4bcde17f0f4c20ec678d85c74faa149" +dependencies = [ + "jobserver", + "log", +] + [[package]] name = "ndk" version = "0.8.0" @@ -3877,11 +4124,77 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ "bitflags 2.11.0", - "cfg-if", + "cfg-if 1.0.4", "cfg_aliases", "libc", ] +[[package]] +name = "nokhwa" +version = "0.10.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cae50786bfa1214ed441f98addbea51ca1b9aaa9e4bf5369cda36654b3efaa" +dependencies = [ + "flume", + "image", + "nokhwa-bindings-linux", + "nokhwa-bindings-macos", + "nokhwa-bindings-windows", + "nokhwa-core", + "paste", + "thiserror 2.0.18", +] + +[[package]] +name = "nokhwa-bindings-linux" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd666aaa41d14357817bd9a981773a73c4d00b34d344cfc244e47ebd397b1ec" +dependencies = [ + "nokhwa-core", + "v4l", +] + +[[package]] +name = "nokhwa-bindings-macos" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de78eb4a2d47a68f490899aa0516070d7a972f853ec2bb374ab53be0bd39b60f" +dependencies = [ + "block", + "cocoa-foundation", + "core-foundation 0.10.1", + "core-media-sys", + "core-video-sys", + "flume", + "nokhwa-core", + "objc", + "once_cell", +] + +[[package]] +name = "nokhwa-bindings-windows" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899799275c93ef69bbe8cb888cf6f8249abe751cbc50be5299105022aec14a1c" +dependencies = [ + "nokhwa-core", + "once_cell", + "windows 0.62.2", +] + +[[package]] +name = "nokhwa-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109975552bbd690894f613bce3d408222911e317197c72b2e8b9a1912dc261ae" +dependencies = [ + "bytes", + "image", + "mozjpeg", + "thiserror 2.0.18", +] + [[package]] name = "nom" version = "7.1.3" @@ -4051,6 +4364,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", + "objc_exception", ] [[package]] @@ -4411,6 +4725,15 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + [[package]] name = "oboe" version = "0.6.1" @@ -4515,7 +4838,7 @@ version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "libc", "redox_syscall 0.5.18", "smallvec", @@ -4548,6 +4871,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "percent-encoding" version = "2.3.2" @@ -4629,7 +4958,7 @@ version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "concurrent-queue", "hermit-abi", "pin-project-lite", @@ -4710,8 +5039,25 @@ version = "0.1.0" dependencies = [ "bevy", "glfw", + "js-sys", + "processing_core", "processing_midi", "processing_render", + "processing_webcam", + "tracing", + "tracing-subscriber", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "processing_core" +version = "0.1.0" +dependencies = [ + "bevy", + "raw-window-handle", + "thiserror 2.0.18", + "tracing", ] [[package]] @@ -4728,7 +5074,8 @@ name = "processing_midi" version = "0.1.0" dependencies = [ "bevy", - "bevy_midi", + "nannou_midi", + "processing_core", ] [[package]] @@ -4739,6 +5086,7 @@ dependencies = [ "glfw", "png", "processing", + "processing_webcam", "pyo3", ] @@ -4753,11 +5101,8 @@ dependencies = [ "lyon", "objc2 0.6.3", "objc2-app-kit 0.3.2", - "processing_midi", + "processing_core", "raw-window-handle", - "thiserror 2.0.18", - "tracing", - "tracing-subscriber", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -4777,6 +5122,16 @@ dependencies = [ "web-sys", ] +[[package]] +name = "processing_webcam" +version = "0.1.0" +dependencies = [ + "bevy", + "nannou_webcam", + "processing_core", + "processing_render", +] + [[package]] name = "profiling" version = "1.0.17" @@ -4986,7 +5341,7 @@ dependencies = [ "av1-grain", "bitstream-io", "built", - "cfg-if", + "cfg-if 1.0.4", "interpolate_name", "itertools 0.14.0", "libc", @@ -5132,6 +5487,9 @@ name = "rgb" version = "0.8.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +dependencies = [ + "bytemuck", +] [[package]] name = "rodio" @@ -5412,6 +5770,15 @@ dependencies = [ "serde", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + [[package]] name = "spin" version = "0.10.0" @@ -5502,9 +5869,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.38.0" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe840c5b1afe259a5657392a4dbb74473a14c8db999c3ec2f4ae812e028a94da" +checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f" dependencies = [ "libc", "memchr", @@ -5600,7 +5967,7 @@ version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", ] [[package]] @@ -5626,7 +5993,7 @@ dependencies = [ "arrayref", "arrayvec", "bytemuck", - "cfg-if", + "cfg-if 1.0.4", "log", "tiny-skia-path", ] @@ -5781,7 +6148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76902d2a8d5f9f55a81155c08971734071968c90f2d9bfe645fe700579b2950" dependencies = [ "cc", - "cfg-if", + "cfg-if 1.0.4", "tracing-core", "tracing-subscriber", ] @@ -5887,6 +6254,26 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "v4l" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8fbfea44a46799d62c55323f3c55d06df722fbe577851d848d328a1041c3403" +dependencies = [ + "bitflags 1.3.2", + "libc", + "v4l2-sys-mit", +] + +[[package]] +name = "v4l2-sys-mit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6779878362b9bacadc7893eac76abe69612e8837ef746573c4a5239daf11990b" +dependencies = [ + "bindgen 0.65.1", +] + [[package]] name = "v_frame" version = "0.3.9" @@ -5967,7 +6354,7 @@ version = "0.2.113" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60722a937f594b7fde9adb894d7c092fc1bb6612897c46368d18e7a20208eff2" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "once_cell", "rustversion", "wasm-bindgen-macro", @@ -5980,7 +6367,7 @@ version = "0.4.63" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a89f4650b770e4521aa6573724e2aed4704372151bd0de9d16a3bbabb87441a" dependencies = [ - "cfg-if", + "cfg-if 1.0.4", "futures-util", "js-sys", "once_cell", @@ -6197,7 +6584,7 @@ dependencies = [ "arrayvec", "bitflags 2.11.0", "bytemuck", - "cfg-if", + "cfg-if 1.0.4", "cfg_aliases", "document-features", "hashbrown 0.16.1", @@ -6289,7 +6676,7 @@ dependencies = [ "bitflags 2.11.0", "block", "bytemuck", - "cfg-if", + "cfg-if 1.0.4", "cfg_aliases", "core-graphics-types 0.2.0", "glow", @@ -6302,7 +6689,7 @@ dependencies = [ "libc", "libloading", "log", - "metal", + "metal 0.33.0", "naga", "ndk-sys 0.6.0+11769913", "objc", @@ -6338,6 +6725,18 @@ dependencies = [ "web-sys", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", +] + [[package]] name = "winapi" version = "0.3.9" @@ -6863,7 +7262,7 @@ dependencies = [ "cfg_aliases", "concurrent-queue", "core-foundation 0.9.4", - "core-graphics", + "core-graphics 0.23.2", "cursor-icon", "dpi", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index d873fef..f8852e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ workspace = true default = ["wayland"] wayland = ["processing_render/wayland"] x11 = ["processing_render/x11"] +webcam = ["dep:processing_webcam"] [workspace] resolver = "3" @@ -23,14 +24,25 @@ too_many_arguments = "allow" [workspace.dependencies] bevy = { git = "https://github.com/bevyengine/bevy", branch = "main" } processing = { path = "." } +processing_core = { path = "crates/processing_core" } processing_pyo3 = { path = "crates/processing_pyo3" } processing_render = { path = "crates/processing_render" } processing_midi = { path = "crates/processing_midi" } +processing_webcam = { path = "crates/processing_webcam" } [dependencies] bevy = { workspace = true } +processing_core = { workspace = true } processing_render = { workspace = true } processing_midi = { workspace = true } +processing_webcam = { workspace = true, optional = true } +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +wasm-bindgen-futures = "0.4" +js-sys = "0.3" +web-sys = { version = "0.3", features = ["Window"] } [dev-dependencies] glfw = "0.60.0" @@ -86,6 +98,11 @@ path = "examples/midi.rs" name = "gltf_load" path = "examples/gltf_load.rs" +[[example]] +name = "webcam" +path = "examples/webcam.rs" +required-features = ["webcam"] + [profile.wasm-release] inherits = "release" opt-level = "z" diff --git a/crates/processing_core/Cargo.toml b/crates/processing_core/Cargo.toml new file mode 100644 index 0000000..791a656 --- /dev/null +++ b/crates/processing_core/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "processing_core" +version = "0.1.0" +edition = "2024" + +[lints] +workspace = true + +[dependencies] +bevy = { workspace = true } +raw-window-handle = "0.6" +thiserror = "2" +tracing = "0.1" diff --git a/crates/processing_render/src/config.rs b/crates/processing_core/src/config.rs similarity index 85% rename from crates/processing_render/src/config.rs rename to crates/processing_core/src/config.rs index 97aee72..a10edd0 100644 --- a/crates/processing_render/src/config.rs +++ b/crates/processing_core/src/config.rs @@ -1,7 +1,3 @@ -//! Options object for configuring various aspects of libprocessing. -//! -//! To add a new Config just add a new enum with associated value - use bevy::prelude::Resource; use std::collections::HashMap; diff --git a/crates/processing_render/src/error.rs b/crates/processing_core/src/error.rs similarity index 95% rename from crates/processing_render/src/error.rs rename to crates/processing_core/src/error.rs index 9a3ab90..715355f 100644 --- a/crates/processing_render/src/error.rs +++ b/crates/processing_core/src/error.rs @@ -36,4 +36,6 @@ pub enum ProcessingError { UnknownMaterialProperty(String), #[error("GLTF load error: {0}")] GltfLoadError(String), + #[error("Webcam not connected")] + WebcamNotConnected, } diff --git a/crates/processing_core/src/lib.rs b/crates/processing_core/src/lib.rs new file mode 100644 index 0000000..9de4d39 --- /dev/null +++ b/crates/processing_core/src/lib.rs @@ -0,0 +1,49 @@ +pub mod config; +pub mod error; + +use std::cell::RefCell; +use std::sync::OnceLock; + +use bevy::app::App; +use tracing::debug; + +static IS_INIT: OnceLock<()> = OnceLock::new(); + +thread_local! { + static APP: RefCell> = const { RefCell::new(None) }; +} + +pub fn app_mut(cb: impl FnOnce(&mut App) -> error::Result) -> error::Result { + let res = APP.with(|app_cell| { + let mut app_borrow = app_cell.borrow_mut(); + let app = app_borrow + .as_mut() + .ok_or(error::ProcessingError::AppAccess)?; + cb(app) + })?; + Ok(res) +} + +pub fn is_already_init() -> error::Result { + let is_init = IS_INIT.get().is_some(); + let thread_has_app = APP.with(|app_cell| app_cell.borrow().is_some()); + if is_init && !thread_has_app { + return Err(error::ProcessingError::AppAccess); + } + if is_init && thread_has_app { + debug!("App already initialized"); + return Ok(true); + } + Ok(false) +} + +pub fn set_app(app: App) { + APP.with(|app_cell| { + IS_INIT.get_or_init(|| ()); + *app_cell.borrow_mut() = Some(app); + }); +} + +pub fn take_app() -> Option { + APP.with(|app_cell| app_cell.borrow_mut().take()) +} diff --git a/crates/processing_pyo3/Cargo.toml b/crates/processing_pyo3/Cargo.toml index cb0c15e..26616ff 100644 --- a/crates/processing_pyo3/Cargo.toml +++ b/crates/processing_pyo3/Cargo.toml @@ -14,10 +14,12 @@ crate-type = ["cdylib"] default = ["wayland"] wayland = ["processing/wayland", "glfw/wayland"] x11 = ["processing/x11"] +webcam = ["processing/webcam", "dep:processing_webcam"] [dependencies] pyo3 = "0.27.0" processing = { workspace = true } +processing_webcam = { workspace = true, optional = true } bevy = { workspace = true, features = ["file_watcher"] } glfw = { version = "0.60.0"} png = "0.18" diff --git a/crates/processing_pyo3/src/graphics.rs b/crates/processing_pyo3/src/graphics.rs index 5d58765..0336cc7 100644 --- a/crates/processing_pyo3/src/graphics.rs +++ b/crates/processing_pyo3/src/graphics.rs @@ -59,7 +59,13 @@ impl Light { #[pyclass] #[derive(Debug)] pub struct Image { - entity: Entity, + pub(crate) entity: Entity, +} + +impl Image { + pub(crate) fn from_entity(entity: Entity) -> Self { + Self { entity } + } } impl Drop for Image { diff --git a/crates/processing_pyo3/src/lib.rs b/crates/processing_pyo3/src/lib.rs index f67b645..c37f47a 100644 --- a/crates/processing_pyo3/src/lib.rs +++ b/crates/processing_pyo3/src/lib.rs @@ -12,6 +12,8 @@ mod glfw; mod gltf; mod graphics; pub(crate) mod material; +#[cfg(feature = "webcam")] +mod webcam; use graphics::{Geometry, Graphics, Image, Light, Topology, get_graphics, get_graphics_mut}; use material::Material; @@ -79,6 +81,12 @@ fn processing(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(emissive, m)?)?; m.add_function(wrap_pyfunction!(unlit, m)?)?; + #[cfg(feature = "webcam")] + { + m.add_class::()?; + m.add_function(wrap_pyfunction!(create_webcam, m)?)?; + } + Ok(()) } @@ -544,3 +552,14 @@ fn emissive(module: &Bound<'_, PyModule>, args: &Bound<'_, PyTuple>) -> PyResult fn unlit(module: &Bound<'_, PyModule>) -> PyResult<()> { graphics!(module).unlit() } + +#[cfg(feature = "webcam")] +#[pyfunction] +#[pyo3(signature = (width=None, height=None, framerate=None))] +fn create_webcam( + width: Option, + height: Option, + framerate: Option, +) -> PyResult { + webcam::Webcam::new(width, height, framerate) +} diff --git a/crates/processing_pyo3/src/webcam.rs b/crates/processing_pyo3/src/webcam.rs new file mode 100644 index 0000000..695f736 --- /dev/null +++ b/crates/processing_pyo3/src/webcam.rs @@ -0,0 +1,61 @@ +use bevy::prelude::Entity; +use processing_webcam::{ + WebcamFormat, webcam_create, webcam_create_with_format, webcam_destroy, webcam_image, + webcam_is_connected, webcam_resolution, +}; +use pyo3::{exceptions::PyRuntimeError, prelude::*}; + +use crate::graphics::Image; + +#[pyclass(unsendable)] +pub struct Webcam { + entity: Entity, +} + +#[pymethods] +impl Webcam { + #[new] + #[pyo3(signature = (width=None, height=None, framerate=None))] + pub fn new( + width: Option, + height: Option, + framerate: Option, + ) -> PyResult { + let entity = match (width, height, framerate) { + (Some(w), Some(h), Some(fps)) => webcam_create_with_format(WebcamFormat::Exact { + resolution: bevy::math::UVec2::new(w, h), + framerate: fps, + }), + (Some(w), Some(h), None) => webcam_create_with_format(WebcamFormat::Resolution( + bevy::math::UVec2::new(w, h), + )), + (None, None, Some(fps)) => webcam_create_with_format(WebcamFormat::FrameRate(fps)), + _ => webcam_create(), + } + .map_err(|e| PyRuntimeError::new_err(format!("{e}")))?; + + Ok(Self { entity }) + } + + pub fn is_connected(&self) -> PyResult { + webcam_is_connected(self.entity) + .map_err(|e| PyRuntimeError::new_err(format!("{e}"))) + } + + pub fn resolution(&self) -> PyResult<(u32, u32)> { + webcam_resolution(self.entity) + .map_err(|e| PyRuntimeError::new_err(format!("{e}"))) + } + + pub fn image(&self) -> PyResult { + let entity = webcam_image(self.entity) + .map_err(|e| PyRuntimeError::new_err(format!("{e}")))?; + Ok(Image::from_entity(entity)) + } +} + +impl Drop for Webcam { + fn drop(&mut self) { + let _ = webcam_destroy(self.entity); + } +} diff --git a/crates/processing_render/Cargo.toml b/crates/processing_render/Cargo.toml index 64a976d..ba82ae2 100644 --- a/crates/processing_render/Cargo.toml +++ b/crates/processing_render/Cargo.toml @@ -15,12 +15,9 @@ x11 = ["bevy/x11"] bevy = { workspace = true } lyon = "1.0" raw-window-handle = "0.6" -thiserror = "2" -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } half = "2.7" crossbeam-channel = "0.5" -processing_midi = { workspace = true } +processing_core = { workspace = true } [target.'cfg(target_os = "macos")'.dependencies] objc2 = { version = "0.6", default-features = false } diff --git a/crates/processing_render/src/geometry/attribute.rs b/crates/processing_render/src/geometry/attribute.rs index 3e26472..27395b5 100644 --- a/crates/processing_render/src/geometry/attribute.rs +++ b/crates/processing_render/src/geometry/attribute.rs @@ -7,7 +7,7 @@ use bevy::{ render::render_resource::VertexFormat, }; -use crate::error::{ProcessingError, Result}; +use processing_core::error::{ProcessingError, Result}; use super::{Geometry, hash_attr_name}; diff --git a/crates/processing_render/src/geometry/layout.rs b/crates/processing_render/src/geometry/layout.rs index 0d355f8..bf17555 100644 --- a/crates/processing_render/src/geometry/layout.rs +++ b/crates/processing_render/src/geometry/layout.rs @@ -1,7 +1,7 @@ use bevy::prelude::*; use super::BuiltinAttributes; -use crate::error::{ProcessingError, Result}; +use processing_core::error::{ProcessingError, Result}; // bevy requires an attribute id for each unique vertex attribute. we don't really want to // expose this to users, so we hash the attribute name to generate a unique id. in theory diff --git a/crates/processing_render/src/geometry/mod.rs b/crates/processing_render/src/geometry/mod.rs index 02572a6..5ff455c 100644 --- a/crates/processing_render/src/geometry/mod.rs +++ b/crates/processing_render/src/geometry/mod.rs @@ -16,7 +16,7 @@ use bevy::{ render::render_resource::PrimitiveTopology, }; -use crate::error::{ProcessingError, Result}; +use processing_core::error::{ProcessingError, Result}; use crate::render::primitive::{box_mesh, sphere_mesh}; pub struct GeometryPlugin; diff --git a/crates/processing_render/src/gltf.rs b/crates/processing_render/src/gltf.rs index 47056cc..d5d0df1 100644 --- a/crates/processing_render/src/gltf.rs +++ b/crates/processing_render/src/gltf.rs @@ -13,8 +13,8 @@ use bevy::{ scene::SceneSpawner, }; -use crate::config::{Config, ConfigKey}; -use crate::error::{ProcessingError, Result}; +use processing_core::config::{Config, ConfigKey}; +use processing_core::error::{ProcessingError, Result}; use crate::geometry::{BuiltinAttributes, Geometry, layout::VertexLayout}; use crate::graphics; use crate::render::material::UntypedMaterial; diff --git a/crates/processing_render/src/graphics.rs b/crates/processing_render/src/graphics.rs index a4737bd..078f96f 100644 --- a/crates/processing_render/src/graphics.rs +++ b/crates/processing_render/src/graphics.rs @@ -25,9 +25,9 @@ use bevy::{ window::WindowRef, }; +use processing_core::error::{ProcessingError, Result}; use crate::{ Flush, - error::{ProcessingError, Result}, image::{Image, bytes_to_pixels, create_readback_buffer, pixel_size, pixels_to_bytes}, render::{ RenderState, diff --git a/crates/processing_render/src/image.rs b/crates/processing_render/src/image.rs index b4f7c21..60f64c0 100644 --- a/crates/processing_render/src/image.rs +++ b/crates/processing_render/src/image.rs @@ -24,8 +24,8 @@ use bevy::{ }; use half::f16; -use crate::config::{Config, ConfigKey}; -use crate::error::{ProcessingError, Result}; +use processing_core::config::{Config, ConfigKey}; +use processing_core::error::{ProcessingError, Result}; pub struct ImagePlugin; @@ -112,7 +112,6 @@ pub fn is_loaded(world: &World, handle: &Handle) -> bool { ) } -#[cfg(target_arch = "wasm32")] pub fn from_handle( In(handle): In>, world: &mut World, @@ -365,15 +364,13 @@ pub fn prepare_update_region( pub fn destroy( In(entity): In, mut commands: Commands, - mut p_images: Query<&mut Image>, - mut images: ResMut>, + p_images: Query<&Image>, mut p_image_textures: ResMut, ) -> Result<()> { - let p_image = p_images - .get_mut(entity) + p_images + .get(entity) .map_err(|_| ProcessingError::ImageNotFound)?; - images.remove(&p_image.handle); p_image_textures.remove(&entity); commands.entity(entity).despawn(); Ok(()) diff --git a/crates/processing_render/src/lib.rs b/crates/processing_render/src/lib.rs index b603247..8c08095 100644 --- a/crates/processing_render/src/lib.rs +++ b/crates/processing_render/src/lib.rs @@ -1,5 +1,3 @@ -pub mod config; -pub mod error; pub mod geometry; pub mod gltf; mod graphics; @@ -8,54 +6,76 @@ pub mod light; pub mod material; pub mod render; pub mod sketch; -mod surface; +pub(crate) mod surface; pub mod transform; -use std::{cell::RefCell, num::NonZero, path::PathBuf, sync::OnceLock}; +use std::path::PathBuf; -use config::*; - -#[cfg(not(target_arch = "wasm32"))] -use bevy::log::tracing_subscriber; -use bevy::render::RenderPlugin; -use bevy::render::settings::{RenderCreation, WgpuSettings}; use bevy::{ - app::{App, AppExit}, asset::{AssetEventSystems, io::AssetSourceBuilder}, prelude::*, render::render_resource::{Extent3d, TextureFormat}, }; -use render::material::add_standard_materials; -use render::{activate_cameras, clear_transient_meshes, flush_draw_commands}; -use tracing::debug; +use processing_core::app_mut; +use processing_core::config::*; +use processing_core::error; use crate::geometry::{AttributeFormat, AttributeValue}; use crate::graphics::flush; -use crate::{ - graphics::GraphicsPlugin, image::ImagePlugin, light::LightPlugin, render::command::DrawCommand, - surface::SurfacePlugin, -}; +use crate::render::command::DrawCommand; -use processing_midi::MidiPlugin; +#[derive(Component)] +pub struct Flush; -static IS_INIT: OnceLock<()> = OnceLock::new(); +pub struct ProcessingRenderPlugin; -thread_local! { - static APP: RefCell> = const { RefCell::new(None) }; -} +impl Plugin for ProcessingRenderPlugin { + fn build(&self, app: &mut App) { + use render::material::add_standard_materials; + use render::{activate_cameras, clear_transient_meshes, flush_draw_commands}; -#[derive(Component)] -pub struct Flush; + let config = app.world().resource::().clone(); -fn app_mut(cb: impl FnOnce(&mut App) -> error::Result) -> error::Result { - let res = APP.with(|app_cell| { - let mut app_borrow = app_cell.borrow_mut(); - let app = app_borrow - .as_mut() - .ok_or(error::ProcessingError::AppAccess)?; - cb(app) - })?; - Ok(res) + if let Some(asset_path) = config.get(ConfigKey::AssetRootPath) { + app.register_asset_source( + "assets_directory", + AssetSourceBuilder::platform_default(asset_path, None), + ); + } + + let has_sketch_file = config + .get(ConfigKey::SketchFileName) + .is_some_and(|f| !f.is_empty()); + if has_sketch_file { + if let Some(sketch_path) = config.get(ConfigKey::SketchRootPath) { + app.register_asset_source( + "sketch_directory", + AssetSourceBuilder::platform_default(sketch_path, None), + ); + } + } + + if has_sketch_file { + app.add_plugins(sketch::LivecodePlugin); + } + + app.add_plugins(( + image::ImagePlugin, + graphics::GraphicsPlugin, + surface::SurfacePlugin, + geometry::GeometryPlugin, + light::LightPlugin, + material::MaterialPlugin, + )); + + app.add_systems(First, (clear_transient_meshes, activate_cameras)) + .add_systems( + Update, + (flush_draw_commands, add_standard_materials) + .chain() + .before(AssetEventSystems), + ); + } } /// Create a WebGPU surface from a macOS NSWindow handle. @@ -217,160 +237,6 @@ pub fn surface_resize(graphics_entity: Entity, width: u32, height: u32) -> error }) } -fn create_app(config: Config) -> App { - let mut app = App::new(); - - app.insert_resource(config.clone()); - - if let Some(asset_path) = config.get(ConfigKey::AssetRootPath) { - app.register_asset_source( - "assets_directory", - AssetSourceBuilder::platform_default(asset_path, None), - ); - } - - let has_sketch_file = config - .get(ConfigKey::SketchFileName) - .is_some_and(|f| !f.is_empty()); - if has_sketch_file { - if let Some(sketch_path) = config.get(ConfigKey::SketchRootPath) { - app.register_asset_source( - "sketch_directory", - AssetSourceBuilder::platform_default(sketch_path, None), - ); - } - } - - #[cfg(not(target_arch = "wasm32"))] - let plugins = DefaultPlugins - .build() - .set(RenderPlugin { - synchronous_pipeline_compilation: true, - ..default() - }) - .disable::() - .disable::() - .disable::() - .set(WindowPlugin { - primary_window: None, - exit_condition: bevy::window::ExitCondition::DontExit, - ..default() - }); - - #[cfg(target_arch = "wasm32")] - let plugins = DefaultPlugins - .build() - .disable::() - .disable::() - .set(WindowPlugin { - primary_window: None, - exit_condition: bevy::window::ExitCondition::DontExit, - ..default() - }); - - app.add_plugins(plugins); - - if has_sketch_file { - app.add_plugins(sketch::LivecodePlugin); - } - - app.add_plugins(( - ImagePlugin, - GraphicsPlugin, - SurfacePlugin, - geometry::GeometryPlugin, - LightPlugin, - material::MaterialPlugin, - MidiPlugin, - )); - app.add_systems(First, (clear_transient_meshes, activate_cameras)) - .add_systems( - Update, - (flush_draw_commands, add_standard_materials) - .chain() - .before(AssetEventSystems), - ); - - app -} - -fn is_already_init() -> error::Result { - let is_init = IS_INIT.get().is_some(); - let thread_has_app = APP.with(|app_cell| app_cell.borrow().is_some()); - if is_init && !thread_has_app { - return Err(error::ProcessingError::AppAccess); - } - if is_init && thread_has_app { - debug!("App already initialized"); - return Ok(true); - } - Ok(false) -} - -fn set_app(app: App) { - APP.with(|app_cell| { - IS_INIT.get_or_init(|| ()); - *app_cell.borrow_mut() = Some(app); - }); -} - -/// Initialize the app, if not already initialized. Must be called from the main thread and cannot -/// be called concurrently from multiple threads. -#[cfg(not(target_arch = "wasm32"))] -pub fn init(config: Config) -> error::Result<()> { - if is_already_init()? { - return Ok(()); - } - setup_tracing(config.get(ConfigKey::LogLevel).map(|s| s.as_str()))?; - - let mut app = create_app(config); - // contrary to what the following methods might imply, this is just finishing plugin setup - // which normally happens in the app runner (i.e. in a "normal" bevy app), but since we don't - // have one we need to do it manually here - app.finish(); - app.cleanup(); - // also, we need to run the main schedule once to ensure all systems are initialized before we - // return from init, to ensure any plugins that need to do setup in their first update can rely - // on that - app.update(); - set_app(app); - - Ok(()) -} - -/// Initialize the app asynchronously -#[cfg(target_arch = "wasm32")] -pub async fn init(config: Config) -> error::Result<()> { - use bevy::app::PluginsState; - - if is_already_init()? { - return Ok(()); - } - setup_tracing(config.get(ConfigKey::LogLevel).map(|s| s.as_str()))?; - - let mut app = create_app(config); - - // we need to avoid blocking the main thread while waiting for plugins to initialize - while app.plugins_state() == PluginsState::Adding { - // yield to event loop - wasm_bindgen_futures::JsFuture::from(js_sys::Promise::new(&mut |resolve, _| { - web_sys::window() - .unwrap() - .set_timeout_with_callback_and_timeout_and_arguments_0(&resolve, 0) - .unwrap(); - })) - .await - .unwrap(); - } - - app.finish(); - app.cleanup(); - app.update(); - set_app(app); - - Ok(()) -} - /// Create a new graphics surface for rendering. pub fn graphics_create( surface_entity: Entity, @@ -499,44 +365,6 @@ pub fn graphics_update_region( }) } -pub fn exit(exit_code: u8) -> error::Result<()> { - app_mut(|app| { - app.world_mut().write_message(match exit_code { - 0 => AppExit::Success, - _ => AppExit::Error(NonZero::new(exit_code).unwrap()), - }); - - // one final update to process the exit message - app.update(); - Ok(()) - })?; - - // we need to drop the app in a deterministic manner to ensure resources are cleaned up - // otherwise we'll get wgpu graphics backend errors on exit - APP.with(|app_cell| { - let app = app_cell.borrow_mut().take(); - drop(app); - }); - - Ok(()) -} - -fn setup_tracing(log_level: Option<&str>) -> error::Result<()> { - // TODO: figure out wasm compatible tracing subscriber - #[cfg(not(target_arch = "wasm32"))] - { - use tracing_subscriber::EnvFilter; - - let filter = EnvFilter::try_new(log_level.unwrap_or("info")) - .unwrap_or_else(|_| EnvFilter::new("info")); - let subscriber = tracing_subscriber::FmtSubscriber::builder() - .with_env_filter(filter) - .finish(); - tracing::subscriber::set_global_default(subscriber)?; - } - Ok(()) -} - /// Record a drawing command for a window pub fn graphics_record_command(graphics_entity: Entity, cmd: DrawCommand) -> error::Result<()> { app_mut(|app| { diff --git a/crates/processing_render/src/material/mod.rs b/crates/processing_render/src/material/mod.rs index 1148c81..01d191a 100644 --- a/crates/processing_render/src/material/mod.rs +++ b/crates/processing_render/src/material/mod.rs @@ -2,7 +2,7 @@ pub mod pbr; use bevy::prelude::*; -use crate::error::{ProcessingError, Result}; +use processing_core::error::{ProcessingError, Result}; use crate::render::material::UntypedMaterial; pub struct MaterialPlugin; diff --git a/crates/processing_render/src/material/pbr.rs b/crates/processing_render/src/material/pbr.rs index ed40533..df3df23 100644 --- a/crates/processing_render/src/material/pbr.rs +++ b/crates/processing_render/src/material/pbr.rs @@ -1,7 +1,7 @@ use bevy::prelude::*; use super::MaterialValue; -use crate::error::{ProcessingError, Result}; +use processing_core::error::{ProcessingError, Result}; /// Set a property on a StandardMaterial by name. pub fn set_property( diff --git a/crates/processing_render/src/sketch.rs b/crates/processing_render/src/sketch.rs index 26ee32e..056f19e 100644 --- a/crates/processing_render/src/sketch.rs +++ b/crates/processing_render/src/sketch.rs @@ -9,7 +9,7 @@ use bevy::{ }; use std::path::Path; -use crate::config::{Config, ConfigKey}; +use processing_core::config::{Config, ConfigKey}; /// Plugin that registers the Sketch asset type and its loader. pub struct LivecodePlugin; diff --git a/crates/processing_render/src/surface.rs b/crates/processing_render/src/surface.rs index d952a76..ac7bd3d 100644 --- a/crates/processing_render/src/surface.rs +++ b/crates/processing_render/src/surface.rs @@ -35,9 +35,8 @@ use raw_window_handle::{ RawWindowHandle, WindowHandle, }; +use processing_core::error::{self, ProcessingError, Result}; use crate::{ - error, - error::{ProcessingError, Result}, image::{Image, ImageTextures}, }; diff --git a/crates/processing_render/src/transform.rs b/crates/processing_render/src/transform.rs index 9209c77..5b902c5 100644 --- a/crates/processing_render/src/transform.rs +++ b/crates/processing_render/src/transform.rs @@ -1,6 +1,6 @@ use bevy::prelude::*; -use crate::error::{ProcessingError, Result}; +use processing_core::error::{ProcessingError, Result}; pub fn set_position( In((entity, x, y, z)): In<(Entity, f32, f32, f32)>, diff --git a/crates/processing_webcam/Cargo.toml b/crates/processing_webcam/Cargo.toml new file mode 100644 index 0000000..196b55a --- /dev/null +++ b/crates/processing_webcam/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "processing_webcam" +version = "0.1.0" +edition = "2024" + +[lints] +workspace = true + +[dependencies] +bevy = { workspace = true } +nannou_webcam = { git = "https://github.com/nannou-org/nannou", branch = "bevy-refactor" } +processing_core = { workspace = true } +processing_render = { workspace = true } diff --git a/crates/processing_webcam/src/lib.rs b/crates/processing_webcam/src/lib.rs new file mode 100644 index 0000000..1758dd8 --- /dev/null +++ b/crates/processing_webcam/src/lib.rs @@ -0,0 +1,112 @@ +use bevy::ecs::system::RunSystemOnce; +use bevy::prelude::*; + +pub use nannou_webcam::{ + Webcam, WebcamConnected, WebcamDevice, WebcamDeviceAdded, WebcamDeviceRemoved, + WebcamDisconnected, WebcamError, WebcamFormat, WebcamPlugin, WebcamStream, + WebcamSupportedFormat, +}; + +use processing_core::app_mut; +use processing_core::error::{ProcessingError, Result}; +use processing_render::image; + +#[derive(Component)] +pub struct ProcessingWebcam; + +fn create(In(()): In<()>, mut commands: Commands) -> Entity { + commands + .spawn((ProcessingWebcam, Webcam::default())) + .id() +} + +fn create_with_format(In(format): In, mut commands: Commands) -> Entity { + commands + .spawn(( + ProcessingWebcam, + Webcam { + format, + ..default() + }, + )) + .id() +} + +fn create_image(In(entity): In, world: &mut World) -> Result { + let stream = world + .get::(entity) + .ok_or(ProcessingError::WebcamNotConnected)?; + let handle = stream.image.clone(); + + let child = world + .run_system_once_with(image::from_handle, handle) + .unwrap()?; + world.entity_mut(entity).add_child(child); + Ok(child) +} + +fn is_connected(In(entity): In, streams: Query<&WebcamStream>) -> Result { + Ok(streams.get(entity).is_ok()) +} + +fn resolution(In(entity): In, streams: Query<&WebcamStream>) -> Result<(u32, u32)> { + let stream = streams + .get(entity) + .map_err(|_| ProcessingError::WebcamNotConnected)?; + Ok((stream.resolution.x, stream.resolution.y)) +} + +fn destroy(In(entity): In, mut commands: Commands) -> Result<()> { + commands.entity(entity).despawn(); + Ok(()) +} + +pub fn webcam_create() -> Result { + app_mut(|app| { + Ok(app + .world_mut() + .run_system_cached_with(create, ()) + .unwrap()) + }) +} + +pub fn webcam_create_with_format(format: WebcamFormat) -> Result { + app_mut(|app| { + Ok(app + .world_mut() + .run_system_cached_with(create_with_format, format) + .unwrap()) + }) +} + +pub fn webcam_is_connected(entity: Entity) -> Result { + app_mut(|app| { + app.world_mut() + .run_system_cached_with(is_connected, entity) + .unwrap() + }) +} + +pub fn webcam_image(entity: Entity) -> Result { + app_mut(|app| { + app.world_mut() + .run_system_cached_with(create_image, entity) + .unwrap() + }) +} + +pub fn webcam_resolution(entity: Entity) -> Result<(u32, u32)> { + app_mut(|app| { + app.world_mut() + .run_system_cached_with(resolution, entity) + .unwrap() + }) +} + +pub fn webcam_destroy(entity: Entity) -> Result<()> { + app_mut(|app| { + app.world_mut() + .run_system_cached_with(destroy, entity) + .unwrap() + }) +} diff --git a/examples/glfw.rs b/examples/glfw.rs index 366640e..e7118d3 100644 --- a/examples/glfw.rs +++ b/examples/glfw.rs @@ -1,7 +1,7 @@ /// Minimal GLFW helper for Processing examples use bevy::prelude::Entity; use glfw::{Glfw, GlfwReceiver, PWindow, WindowEvent, WindowMode}; -use processing_render::error::Result; +use processing_core::error::Result; pub struct GlfwContext { glfw: Glfw, diff --git a/examples/webcam.rs b/examples/webcam.rs new file mode 100644 index 0000000..b9d2adb --- /dev/null +++ b/examples/webcam.rs @@ -0,0 +1,52 @@ +mod glfw; + +use glfw::GlfwContext; +use processing::prelude::*; +use processing_render::render::command::DrawCommand; +use processing_webcam::{webcam_create, webcam_destroy, webcam_image, webcam_is_connected}; + +fn main() { + match sketch() { + Ok(_) => { + eprintln!("Sketch completed successfully"); + exit(0).unwrap(); + } + Err(e) => { + eprintln!("Sketch error: {:?}", e); + exit(1).unwrap(); + } + }; +} + +fn sketch() -> error::Result<()> { + let width = 640; + let height = 480; + + let mut glfw_ctx = GlfwContext::new(width, height)?; + init(Config::default())?; + + let scale_factor = 1.0; + let surface = glfw_ctx.create_surface(width, height, scale_factor)?; + let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?; + + let webcam = webcam_create()?; + let mut image_entity = None; + + while glfw_ctx.poll_events() { + graphics_begin_draw(graphics)?; + + // Once connected, grab an image entity from the webcam stream + if image_entity.is_none() && webcam_is_connected(webcam)? { + image_entity = Some(webcam_image(webcam)?); + } + + if let Some(img) = image_entity { + graphics_record_command(graphics, DrawCommand::BackgroundImage(img))?; + } + + graphics_end_draw(graphics)?; + } + + webcam_destroy(webcam)?; + Ok(()) +} diff --git a/src/lib.rs b/src/lib.rs index b9d7209..d7281e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,144 @@ pub mod prelude; + +use std::num::NonZero; + +use bevy::app::{App, AppExit}; +use bevy::prelude::*; +use bevy::render::RenderPlugin; + +use processing_core::config::{Config, ConfigKey}; +use processing_core::error; + +fn create_app(config: Config) -> App { + let mut app = App::new(); + + app.insert_resource(config.clone()); + + #[cfg(not(target_arch = "wasm32"))] + let plugins = DefaultPlugins + .build() + .set(RenderPlugin { + synchronous_pipeline_compilation: true, + ..default() + }) + .disable::() + .disable::() + .disable::() + .set(WindowPlugin { + primary_window: None, + exit_condition: bevy::window::ExitCondition::DontExit, + ..default() + }); + + #[cfg(target_arch = "wasm32")] + let plugins = DefaultPlugins + .build() + .disable::() + .disable::() + .set(WindowPlugin { + primary_window: None, + exit_condition: bevy::window::ExitCondition::DontExit, + ..default() + }); + + app.add_plugins(plugins); + app.add_plugins(processing_midi::MidiPlugin); + app.add_plugins(processing_render::ProcessingRenderPlugin); + + #[cfg(feature = "webcam")] + app.add_plugins(processing_webcam::WebcamPlugin); + + app +} + +/// Initialize the app, if not already initialized. Must be called from the main thread and cannot +/// be called concurrently from multiple threads. +#[cfg(not(target_arch = "wasm32"))] +pub fn init(config: Config) -> error::Result<()> { + if processing_core::is_already_init()? { + return Ok(()); + } + setup_tracing(config.get(ConfigKey::LogLevel).map(|s| s.as_str()))?; + + let mut app = create_app(config); + // contrary to what the following methods might imply, this is just finishing plugin setup + // which normally happens in the app runner (i.e. in a "normal" bevy app), but since we don't + // have one we need to do it manually here + app.finish(); + app.cleanup(); + // also, we need to run the main schedule once to ensure all systems are initialized before we + // return from init, to ensure any plugins that need to do setup in their first update can rely + // on that + app.update(); + processing_core::set_app(app); + + Ok(()) +} + +/// Initialize the app asynchronously +#[cfg(target_arch = "wasm32")] +pub async fn init(config: Config) -> error::Result<()> { + use bevy::app::PluginsState; + + if processing_core::is_already_init()? { + return Ok(()); + } + setup_tracing(config.get(ConfigKey::LogLevel).map(|s| s.as_str()))?; + + let mut app = create_app(config); + + // we need to avoid blocking the main thread while waiting for plugins to initialize + while app.plugins_state() == PluginsState::Adding { + // yield to event loop + wasm_bindgen_futures::JsFuture::from(js_sys::Promise::new(&mut |resolve, _| { + web_sys::window() + .unwrap() + .set_timeout_with_callback_and_timeout_and_arguments_0(&resolve, 0) + .unwrap(); + })) + .await + .unwrap(); + } + + app.finish(); + app.cleanup(); + app.update(); + processing_core::set_app(app); + + Ok(()) +} + +pub fn exit(exit_code: u8) -> error::Result<()> { + processing_core::app_mut(|app| { + app.world_mut().write_message(match exit_code { + 0 => AppExit::Success, + _ => AppExit::Error(NonZero::new(exit_code).unwrap()), + }); + + // one final update to process the exit message + app.update(); + Ok(()) + })?; + + // we need to drop the app in a deterministic manner to ensure resources are cleaned up + // otherwise we'll get wgpu graphics backend errors on exit + drop(processing_core::take_app()); + + Ok(()) +} + +fn setup_tracing(log_level: Option<&str>) -> error::Result<()> { + // TODO: figure out wasm compatible tracing subscriber + #[cfg(not(target_arch = "wasm32"))] + { + use tracing_subscriber::EnvFilter; + + let filter = EnvFilter::try_new(log_level.unwrap_or("info")) + .unwrap_or_else(|_| EnvFilter::new("info")); + let subscriber = tracing_subscriber::FmtSubscriber::builder() + .with_env_filter(filter) + .finish(); + tracing::subscriber::set_global_default(subscriber)?; + } + Ok(()) +} diff --git a/src/prelude.rs b/src/prelude.rs index df9de2d..8e56f8e 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,3 +1,6 @@ pub use bevy::prelude::default; pub use bevy::render::render_resource::TextureFormat; -pub use processing_render::{config::*, render::command::DrawCommand, *}; +pub use processing_core::{config::*, error}; +pub use processing_render::{render::command::DrawCommand, *}; + +pub use crate::{exit, init}; From 1df71478a3dd5ecb8044caea8288d581ff59136d Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 12 Mar 2026 16:41:52 -0700 Subject: [PATCH 2/6] Ci. --- crates/processing_render/src/surface.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/processing_render/src/surface.rs b/crates/processing_render/src/surface.rs index 813fca2..1c3e062 100644 --- a/crates/processing_render/src/surface.rs +++ b/crates/processing_render/src/surface.rs @@ -32,11 +32,12 @@ use raw_window_handle::{ }; use processing_core::error::{self, ProcessingError, Result}; +use std::ptr::NonNull; + use crate::{ image::{Image, ImageTextures}, }; - #[derive(Component, Debug, Clone)] pub struct Surface; From 9507043ce4d579ca6f733d9be08a91a38f5de652 Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 12 Mar 2026 17:09:24 -0700 Subject: [PATCH 3/6] Bump nannou version. --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index af50765..07a5083 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4253,7 +4253,7 @@ dependencies = [ [[package]] name = "nannou_webcam" version = "0.1.0" -source = "git+https://github.com/nannou-org/nannou?branch=bevy-refactor#4347507fb0684bad53e8f86e9e8cbbe81fe0f1a7" +source = "git+https://github.com/nannou-org/nannou?branch=bevy-refactor#f38e6d9f3c22b4a7b5df94ede8acf9a254ccf117" dependencies = [ "bevy", "console_error_panic_hook", From caa809b879d4a8000b48c819d30fd4e79b18ec1f Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 12 Mar 2026 17:46:57 -0700 Subject: [PATCH 4/6] Bump nannou version. --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 07a5083..b2244a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4253,7 +4253,7 @@ dependencies = [ [[package]] name = "nannou_webcam" version = "0.1.0" -source = "git+https://github.com/nannou-org/nannou?branch=bevy-refactor#f38e6d9f3c22b4a7b5df94ede8acf9a254ccf117" +source = "git+https://github.com/nannou-org/nannou?branch=bevy-refactor#da69830a7fd1b40045b14aa18b28d5d51e02ee49" dependencies = [ "bevy", "console_error_panic_hook", From c0ca121f6c301739b9ce4acf4dc6869452a81de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moon=20Dav=C3=A9?= Date: Thu, 12 Mar 2026 21:57:34 -0400 Subject: [PATCH 5/6] ignore dead code warning for `from_entity` on Image --- crates/processing_pyo3/src/graphics.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/processing_pyo3/src/graphics.rs b/crates/processing_pyo3/src/graphics.rs index d0959bd..477d24f 100644 --- a/crates/processing_pyo3/src/graphics.rs +++ b/crates/processing_pyo3/src/graphics.rs @@ -63,6 +63,7 @@ pub struct Image { } impl Image { + #[expect(dead_code)] // it's only used by webcam atm pub(crate) fn from_entity(entity: Entity) -> Self { Self { entity } } From f2a9fc73bbba677145312e5e4512904ded464839 Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 12 Mar 2026 19:29:49 -0700 Subject: [PATCH 6/6] Fmt. --- crates/processing_pyo3/src/lib.rs | 2 +- crates/processing_pyo3/src/webcam.rs | 22 +++++++------------ crates/processing_render/src/geometry/mod.rs | 2 +- crates/processing_render/src/gltf.rs | 4 ++-- crates/processing_render/src/graphics.rs | 2 +- .../processing_render/src/material/custom.rs | 4 ++-- crates/processing_render/src/material/mod.rs | 2 +- crates/processing_render/src/surface.rs | 4 +--- crates/processing_webcam/src/lib.rs | 11 ++-------- 9 files changed, 19 insertions(+), 34 deletions(-) diff --git a/crates/processing_pyo3/src/lib.rs b/crates/processing_pyo3/src/lib.rs index 301039f..1bf1b0a 100644 --- a/crates/processing_pyo3/src/lib.rs +++ b/crates/processing_pyo3/src/lib.rs @@ -12,9 +12,9 @@ mod glfw; mod gltf; mod graphics; pub(crate) mod material; +pub(crate) mod shader; #[cfg(feature = "webcam")] mod webcam; -pub(crate) mod shader; use graphics::{Geometry, Graphics, Image, Light, Topology, get_graphics, get_graphics_mut}; use material::Material; diff --git a/crates/processing_pyo3/src/webcam.rs b/crates/processing_pyo3/src/webcam.rs index 695f736..3cc06ba 100644 --- a/crates/processing_pyo3/src/webcam.rs +++ b/crates/processing_pyo3/src/webcam.rs @@ -16,19 +16,15 @@ pub struct Webcam { impl Webcam { #[new] #[pyo3(signature = (width=None, height=None, framerate=None))] - pub fn new( - width: Option, - height: Option, - framerate: Option, - ) -> PyResult { + pub fn new(width: Option, height: Option, framerate: Option) -> PyResult { let entity = match (width, height, framerate) { (Some(w), Some(h), Some(fps)) => webcam_create_with_format(WebcamFormat::Exact { resolution: bevy::math::UVec2::new(w, h), framerate: fps, }), - (Some(w), Some(h), None) => webcam_create_with_format(WebcamFormat::Resolution( - bevy::math::UVec2::new(w, h), - )), + (Some(w), Some(h), None) => { + webcam_create_with_format(WebcamFormat::Resolution(bevy::math::UVec2::new(w, h))) + } (None, None, Some(fps)) => webcam_create_with_format(WebcamFormat::FrameRate(fps)), _ => webcam_create(), } @@ -38,18 +34,16 @@ impl Webcam { } pub fn is_connected(&self) -> PyResult { - webcam_is_connected(self.entity) - .map_err(|e| PyRuntimeError::new_err(format!("{e}"))) + webcam_is_connected(self.entity).map_err(|e| PyRuntimeError::new_err(format!("{e}"))) } pub fn resolution(&self) -> PyResult<(u32, u32)> { - webcam_resolution(self.entity) - .map_err(|e| PyRuntimeError::new_err(format!("{e}"))) + webcam_resolution(self.entity).map_err(|e| PyRuntimeError::new_err(format!("{e}"))) } pub fn image(&self) -> PyResult { - let entity = webcam_image(self.entity) - .map_err(|e| PyRuntimeError::new_err(format!("{e}")))?; + let entity = + webcam_image(self.entity).map_err(|e| PyRuntimeError::new_err(format!("{e}")))?; Ok(Image::from_entity(entity)) } } diff --git a/crates/processing_render/src/geometry/mod.rs b/crates/processing_render/src/geometry/mod.rs index 88c2536..fc8d4b9 100644 --- a/crates/processing_render/src/geometry/mod.rs +++ b/crates/processing_render/src/geometry/mod.rs @@ -16,8 +16,8 @@ use bevy::{ render::render_resource::PrimitiveTopology, }; -use processing_core::error::{ProcessingError, Result}; use crate::render::primitive::{box_mesh, sphere_mesh}; +use processing_core::error::{ProcessingError, Result}; pub struct GeometryPlugin; diff --git a/crates/processing_render/src/gltf.rs b/crates/processing_render/src/gltf.rs index d5d0df1..3eca339 100644 --- a/crates/processing_render/src/gltf.rs +++ b/crates/processing_render/src/gltf.rs @@ -13,11 +13,11 @@ use bevy::{ scene::SceneSpawner, }; -use processing_core::config::{Config, ConfigKey}; -use processing_core::error::{ProcessingError, Result}; use crate::geometry::{BuiltinAttributes, Geometry, layout::VertexLayout}; use crate::graphics; use crate::render::material::UntypedMaterial; +use processing_core::config::{Config, ConfigKey}; +use processing_core::error::{ProcessingError, Result}; #[derive(Component)] pub struct GltfNodeTransform(pub Transform); diff --git a/crates/processing_render/src/graphics.rs b/crates/processing_render/src/graphics.rs index e58f357..2dda6ee 100644 --- a/crates/processing_render/src/graphics.rs +++ b/crates/processing_render/src/graphics.rs @@ -25,7 +25,6 @@ use bevy::{ window::WindowRef, }; -use processing_core::error::{ProcessingError, Result}; use crate::{ Flush, image::{Image, create_readback_buffer, pixel_size, pixels_to_bytes}, @@ -35,6 +34,7 @@ use crate::{ }, surface::Surface, }; +use processing_core::error::{ProcessingError, Result}; pub struct GraphicsPlugin; diff --git a/crates/processing_render/src/material/custom.rs b/crates/processing_render/src/material/custom.rs index b1f29ee..56617b1 100644 --- a/crates/processing_render/src/material/custom.rs +++ b/crates/processing_render/src/material/custom.rs @@ -42,10 +42,10 @@ use bevy_naga_reflect::dynamic_shader::DynamicShader; use bevy::shader::Shader as ShaderAsset; -use processing_core::config::{Config, ConfigKey}; -use processing_core::error::{ProcessingError, Result}; use crate::material::MaterialValue; use crate::render::material::UntypedMaterial; +use processing_core::config::{Config, ConfigKey}; +use processing_core::error::{ProcessingError, Result}; #[derive(Asset, TypePath, Clone)] pub struct CustomMaterial { diff --git a/crates/processing_render/src/material/mod.rs b/crates/processing_render/src/material/mod.rs index 09e9a55..288751a 100644 --- a/crates/processing_render/src/material/mod.rs +++ b/crates/processing_render/src/material/mod.rs @@ -3,8 +3,8 @@ pub mod pbr; use bevy::prelude::*; -use processing_core::error::{ProcessingError, Result}; use crate::render::material::UntypedMaterial; +use processing_core::error::{ProcessingError, Result}; pub struct MaterialPlugin; diff --git a/crates/processing_render/src/surface.rs b/crates/processing_render/src/surface.rs index 1c3e062..6ca44da 100644 --- a/crates/processing_render/src/surface.rs +++ b/crates/processing_render/src/surface.rs @@ -34,9 +34,7 @@ use raw_window_handle::{ use processing_core::error::{self, ProcessingError, Result}; use std::ptr::NonNull; -use crate::{ - image::{Image, ImageTextures}, -}; +use crate::image::{Image, ImageTextures}; #[derive(Component, Debug, Clone)] pub struct Surface; diff --git a/crates/processing_webcam/src/lib.rs b/crates/processing_webcam/src/lib.rs index 1758dd8..7b66dfc 100644 --- a/crates/processing_webcam/src/lib.rs +++ b/crates/processing_webcam/src/lib.rs @@ -15,9 +15,7 @@ use processing_render::image; pub struct ProcessingWebcam; fn create(In(()): In<()>, mut commands: Commands) -> Entity { - commands - .spawn((ProcessingWebcam, Webcam::default())) - .id() + commands.spawn((ProcessingWebcam, Webcam::default())).id() } fn create_with_format(In(format): In, mut commands: Commands) -> Entity { @@ -62,12 +60,7 @@ fn destroy(In(entity): In, mut commands: Commands) -> Result<()> { } pub fn webcam_create() -> Result { - app_mut(|app| { - Ok(app - .world_mut() - .run_system_cached_with(create, ()) - .unwrap()) - }) + app_mut(|app| Ok(app.world_mut().run_system_cached_with(create, ()).unwrap())) } pub fn webcam_create_with_format(format: WebcamFormat) -> Result {