diff --git a/Cargo.lock b/Cargo.lock index bec4a246..251a5e45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -201,6 +201,25 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69" +[[package]] +name = "arboard" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1faa3c733d9a3dd6fbaf85da5d162a2e03b2e0033a90dceb0e2a90fdd1e5380a" +dependencies = [ + "clipboard-win", + "core-graphics 0.23.1", + "image", + "log", + "objc", + "objc-foundation", + "objc_id", + "parking_lot", + "thiserror", + "windows-sys 0.48.0", + "x11rb", +] + [[package]] name = "arrayref" version = "0.3.7" @@ -361,6 +380,7 @@ name = "bevy-strolle" version = "0.1.0" dependencies = [ "bevy", + "bevy_egui", "bevy_mod_raycast", "bevy_rapier3d", "lazy_static", @@ -576,6 +596,19 @@ dependencies = [ "syn 2.0.43", ] +[[package]] +name = "bevy_egui" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c90c01202dbcebc03315a01ea71553b35e1f20b0da6b1cc8c2605344032a3d96" +dependencies = [ + "arboard", + "bevy", + "egui", + "thread_local", + "webbrowser", +] + [[package]] name = "bevy_encase_derive" version = "0.12.1" @@ -1331,6 +1364,15 @@ dependencies = [ "libloading 0.7.4", ] +[[package]] +name = "clipboard-win" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ec832972fefb8cf9313b45a0d1945e29c9c251f1d4c6eafc5fe2124c02d2e81" +dependencies = [ + "error-code", +] + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -1444,6 +1486,19 @@ dependencies = [ "libc", ] +[[package]] +name = "core-graphics" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types 0.5.0", + "libc", +] + [[package]] name = "core-graphics-types" version = "0.1.3" @@ -1633,6 +1688,26 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "ecolor" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b7637fc2e74d17e52931bac90ff4fc061ac776ada9c7fa272f24cdca5991972" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "egui" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c55bcb864b764eb889515a38b8924757657a250738ad15126637ee2df291ee6b" +dependencies = [ + "ahash 0.8.6", + "epaint", + "nohash-hasher", +] + [[package]] name = "either" version = "1.9.0" @@ -1649,6 +1724,15 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "emath" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a045c6c0b44b35e98513fc1e9d183ab42881ac27caccb9fa345465601f56cce4" +dependencies = [ + "bytemuck", +] + [[package]] name = "encase" version = "0.6.1" @@ -1681,6 +1765,21 @@ dependencies = [ "syn 2.0.43", ] +[[package]] +name = "epaint" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d1b9e000d21bab9b535ce78f9f7745be28b3f777f6c7223936561c5c7fefab8" +dependencies = [ + "ab_glyph", + "ahash 0.8.6", + "bytemuck", + "ecolor", + "emath", + "nohash-hasher", + "parking_lot", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1696,6 +1795,22 @@ dependencies = [ "serde", ] +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "error-code" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "281e452d3bad4005426416cdba5ccfd4f5c1280e10099e21db27f7c1c28347fc" + [[package]] name = "euclid" version = "0.22.9" @@ -1820,6 +1935,15 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + [[package]] name = "futures-core" version = "0.3.30" @@ -1869,6 +1993,16 @@ dependencies = [ "byteorder", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.5", +] + [[package]] name = "getrandom" version = "0.2.11" @@ -2123,12 +2257,31 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "image" version = "0.24.7" @@ -2142,6 +2295,7 @@ dependencies = [ "num-rational", "num-traits", "png", + "tiff", ] [[package]] @@ -2261,6 +2415,22 @@ dependencies = [ "walkdir", ] +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -2387,6 +2557,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + [[package]] name = "lock_api" version = "0.4.11" @@ -2615,6 +2791,12 @@ dependencies = [ "libc", ] +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "nom" version = "7.1.3" @@ -2753,6 +2935,17 @@ dependencies = [ "objc_exception", ] +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + [[package]] name = "objc-sys" version = "0.2.0-beta.2" @@ -2788,6 +2981,15 @@ dependencies = [ "cc", ] +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + [[package]] name = "object" version = "0.32.2" @@ -3278,6 +3480,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "ruzstd" version = "0.4.0" @@ -3718,6 +3933,17 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tiff" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -3866,12 +4092,27 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.11" @@ -3884,6 +4125,17 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "uuid" version = "1.6.1" @@ -4021,6 +4273,29 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webbrowser" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b2391658b02c27719fc5a0a73d6e696285138e8b12fba9d4baa70451023c71" +dependencies = [ + "core-foundation", + "home", + "jni 0.21.1", + "log", + "ndk-context", + "objc", + "raw-window-handle", + "url", + "web-sys", +] + +[[package]] +name = "weezl" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" + [[package]] name = "wgpu" version = "0.17.2" @@ -4255,6 +4530,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -4436,7 +4720,7 @@ dependencies = [ "bitflags 1.3.2", "cfg_aliases", "core-foundation", - "core-graphics", + "core-graphics 0.22.3", "dispatch", "instant", "libc", @@ -4476,6 +4760,23 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "x11rb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" +dependencies = [ + "gethostname", + "rustix", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" + [[package]] name = "xi-unicode" version = "0.3.0" diff --git a/bevy-strolle/Cargo.toml b/bevy-strolle/Cargo.toml index 1464c116..683388d2 100644 --- a/bevy-strolle/Cargo.toml +++ b/bevy-strolle/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] bevy = "0.12.1" # TODO use default-features = false +bevy_egui = "0.24" log = "0.4.18" strolle = { path = "../strolle", features = ["metrics"] } wgpu = "0.17.2" diff --git a/bevy-strolle/examples/cornell.rs b/bevy-strolle/examples/cornell.rs index bd1116a2..594c4fb2 100644 --- a/bevy-strolle/examples/cornell.rs +++ b/bevy-strolle/examples/cornell.rs @@ -29,6 +29,7 @@ fn main() { LookTransformPlugin, OrbitCameraPlugin::default(), StrollePlugin, + SimpleGuiPlugin, )) .add_systems(Startup, setup) .add_systems(Update, animate) diff --git a/bevy-strolle/src/graph.rs b/bevy-strolle/src/graph.rs index 63bfc244..c9f34787 100644 --- a/bevy-strolle/src/graph.rs +++ b/bevy-strolle/src/graph.rs @@ -3,9 +3,11 @@ pub const NAME: &str = "strolle"; pub mod node { pub const RENDERING: &str = "strolle_rendering"; pub const TONEMAPPING: &str = "strolle_tonemapping"; + pub const FXAA: &str = "strolle_fxaa"; pub const UPSCALING: &str = "strolle_upscaling"; } +use bevy::core_pipeline::fxaa::FxaaNode; use bevy::core_pipeline::tonemapping::TonemappingNode; use bevy::core_pipeline::upscaling::UpscalingNode; use bevy::prelude::*; @@ -28,8 +30,12 @@ pub(crate) fn setup(render_app: &mut App) { NAME, node::UPSCALING, ) + .add_render_graph_node::>( + NAME, + node::FXAA, + ) .add_render_graph_edges( NAME, - &[node::RENDERING, node::TONEMAPPING, node::UPSCALING], + &[node::RENDERING,node::FXAA, node::TONEMAPPING, node::UPSCALING], ); } diff --git a/bevy-strolle/src/gui.rs b/bevy-strolle/src/gui.rs new file mode 100644 index 00000000..ff60b322 --- /dev/null +++ b/bevy-strolle/src/gui.rs @@ -0,0 +1,188 @@ +use bevy::core_pipeline::fxaa; +use bevy::core_pipeline::tonemapping::Tonemapping; +use bevy::prelude::*; +use bevy_egui::{egui, EguiContexts, EguiPlugin}; +pub struct SimpleGuiPlugin; + +impl Plugin for SimpleGuiPlugin { + fn build(&self, app: &mut App) { + app.init_resource::() + .add_plugins(EguiPlugin) + .add_systems(Update, gui) + .add_systems(Update, switch_mode); + } +} +#[derive(Resource, Debug, Default)] +struct GuiConfig { + // example + fxaa: bool, + fxaa_changed: bool, + tonemapping: Tonemapping, + tonemapping_changed: bool, +} +fn gui( + mut contexts: EguiContexts, + render_config: ResMut, + point_lights: Query<&mut PointLight>, + materials: ResMut>, + query_material_handles: Query<&mut Handle>, + time: Res