diff --git a/Cargo.lock b/Cargo.lock index 46a67c64547551e9d726fad7a08e903095bf5961..e9ff38dc659b1766bfd5a6c8bec247bab9ab5004 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,7 +202,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bevy" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_internal", ] @@ -216,7 +216,7 @@ checksum = "0d5f2f58f0aec3c50a20799792c3705e80dd7df327e79791cacec197e84e5e61" [[package]] name = "bevy_app" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_derive", "bevy_ecs", @@ -229,7 +229,7 @@ dependencies = [ [[package]] name = "bevy_asset" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "anyhow", "bevy_app", @@ -256,7 +256,7 @@ dependencies = [ [[package]] name = "bevy_audio" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "anyhow", "bevy_app", @@ -271,7 +271,7 @@ dependencies = [ [[package]] name = "bevy_core" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_derive", @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -298,7 +298,7 @@ dependencies = [ [[package]] name = "bevy_derive" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "Inflector", "bevy_macro_utils", @@ -309,7 +309,7 @@ dependencies = [ [[package]] name = "bevy_diagnostic" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_core", @@ -321,7 +321,7 @@ dependencies = [ [[package]] name = "bevy_ecs" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "async-channel", "bevy_ecs_macros", @@ -338,7 +338,7 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_macro_utils", "proc-macro2 1.0.32", @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "bevy_gilrs" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_ecs", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "bevy_gltf2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "anyhow", "base64", @@ -386,7 +386,7 @@ dependencies = [ [[package]] name = "bevy_input" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_ecs", @@ -397,7 +397,7 @@ dependencies = [ [[package]] name = "bevy_internal" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -440,7 +440,6 @@ dependencies = [ "crevice", "kayak_components", "kayak_core", - "kayak_font", "kayak_render_macros", "serde", "serde_json", @@ -450,7 +449,7 @@ dependencies = [ [[package]] name = "bevy_log" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "android_log-sys", "bevy_app", @@ -464,7 +463,7 @@ dependencies = [ [[package]] name = "bevy_macro_utils" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "cargo-manifest", "quote 1.0.10", @@ -474,7 +473,7 @@ dependencies = [ [[package]] name = "bevy_math" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_reflect", "glam", @@ -483,7 +482,7 @@ dependencies = [ [[package]] name = "bevy_pbr" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -499,7 +498,7 @@ dependencies = [ [[package]] name = "bevy_pbr2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -520,7 +519,7 @@ dependencies = [ [[package]] name = "bevy_reflect" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_reflect_derive", "bevy_utils", @@ -536,7 +535,7 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_macro_utils", "proc-macro2 1.0.32", @@ -548,7 +547,7 @@ dependencies = [ [[package]] name = "bevy_render" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "anyhow", "bevy-glsl-to-spirv", @@ -578,7 +577,7 @@ dependencies = [ [[package]] name = "bevy_render2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "anyhow", "bevy_app", @@ -611,7 +610,7 @@ dependencies = [ [[package]] name = "bevy_scene" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "anyhow", "bevy_app", @@ -629,7 +628,7 @@ dependencies = [ [[package]] name = "bevy_sprite" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -652,7 +651,7 @@ dependencies = [ [[package]] name = "bevy_sprite2" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -676,7 +675,7 @@ dependencies = [ [[package]] name = "bevy_tasks" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "async-channel", "async-executor", @@ -689,7 +688,7 @@ dependencies = [ [[package]] name = "bevy_text" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "ab_glyph", "anyhow", @@ -711,7 +710,7 @@ dependencies = [ [[package]] name = "bevy_transform" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_ecs", @@ -724,7 +723,7 @@ dependencies = [ [[package]] name = "bevy_ui" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -748,7 +747,7 @@ dependencies = [ [[package]] name = "bevy_utils" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "ahash", "bevy_derive", @@ -761,7 +760,7 @@ dependencies = [ [[package]] name = "bevy_wgpu" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_asset", @@ -782,7 +781,7 @@ dependencies = [ [[package]] name = "bevy_window" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bevy_app", "bevy_math", @@ -794,7 +793,7 @@ dependencies = [ [[package]] name = "bevy_winit" version = "0.5.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "approx", "bevy_app", @@ -1209,7 +1208,7 @@ dependencies = [ [[package]] name = "crevice" version = "0.8.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "bytemuck", "crevice-derive", @@ -1220,7 +1219,7 @@ dependencies = [ [[package]] name = "crevice-derive" version = "0.8.0" -source = "git+https://github.com/StarArawn/bevy?rev=f3c82f2b0091aefa832ab45eaf15c2be2faa0785#f3c82f2b0091aefa832ab45eaf15c2be2faa0785" +source = "git+https://github.com/bevyengine/bevy?rev=38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c#38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" dependencies = [ "proc-macro2 1.0.32", "quote 1.0.10", diff --git a/Cargo.toml b/Cargo.toml index d73834461de7640443cc341013cf8f814e149471..5fd54873c67b2713c1155721b61a191f6d1313cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,5 +17,5 @@ kayak_components = { path = "kayak_components" } kayak_core = { path = "kayak_core" } [dev-dependencies] -bevy = { git = "https://github.com/StarArawn/bevy", rev = "f3c82f2b0091aefa832ab45eaf15c2be2faa0785" } +bevy = { git = "https://github.com/bevyengine/bevy", rev = "38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" } bevy_kayak_ui = { path = "bevy_kayak_ui" } diff --git a/bevy_kayak_ui/Cargo.toml b/bevy_kayak_ui/Cargo.toml index b9c9c2d951ff1f7ea60825194753942464d55b8b..074e9d38188e5639ddff6feb01740598a685420e 100644 --- a/bevy_kayak_ui/Cargo.toml +++ b/bevy_kayak_ui/Cargo.toml @@ -5,12 +5,12 @@ edition = "2021" [dependencies] bytemuck = "1.7.2" -bevy = { git = "https://github.com/StarArawn/bevy", rev = "f3c82f2b0091aefa832ab45eaf15c2be2faa0785" } +bevy = { git = "https://github.com/bevyengine/bevy", rev = "38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" } kayak_core = { path = "../kayak_core" } kayak_components = { path = "../kayak_components" } kayak_render_macros = { path = "../kayak_render_macros" } -kayak_font = { path = "../kayak_font" } -crevice = { git = "https://github.com/StarArawn/bevy", rev = "f3c82f2b0091aefa832ab45eaf15c2be2faa0785" } +#kayak_font = { path = "../kayak_font" } +crevice = { git = "https://github.com/bevyengine/bevy", rev = "38c7d5eb9e81ab8e1aec03673599b25a9aa0c69c" } serde = "1.0" serde_json = "1.0" serde_path_to_error = "0.1" diff --git a/bevy_kayak_ui/src/render/mod.rs b/bevy_kayak_ui/src/render/mod.rs index 970ea9c859b141e90548d502c16562a44cb9a9d0..47655a5ce9409965cdf1cffbbf4cbe9686758be2 100644 --- a/bevy_kayak_ui/src/render/mod.rs +++ b/bevy_kayak_ui/src/render/mod.rs @@ -1,4 +1,5 @@ use bevy::{ + core_pipeline::{node::MAIN_PASS_DRIVER, MainPass2dNode}, prelude::{Commands, Plugin, Res}, render2::{ camera::ActiveCameras, @@ -70,6 +71,9 @@ impl Plugin for BevyKayakUIRenderPlugin { graph .add_node_edge(node::UI_PASS_DEPENDENCIES, node::UI_PASS_DRIVER) .unwrap(); + graph + .add_node_edge(MAIN_PASS_DRIVER, node::UI_PASS_DRIVER) + .unwrap(); app.add_plugin(UnifiedRenderPlugin); } diff --git a/bevy_kayak_ui/src/render/ui_pass.rs b/bevy_kayak_ui/src/render/ui_pass.rs index 784c67c9205d0671e242ce1b3efcc0c9bfb7a1e3..d78ccec7aaa34b3b54905f03b580434c4de1913a 100644 --- a/bevy_kayak_ui/src/render/ui_pass.rs +++ b/bevy_kayak_ui/src/render/ui_pass.rs @@ -75,7 +75,7 @@ impl Node for MainPassUINode { view: &target.view, resolve_target: None, ops: Operations { - load: LoadOp::Clear(clear_color.0.into()), + load: LoadOp::Load, //Clear(clear_color.0.into()), store: true, }, }], diff --git a/bevy_kayak_ui/src/render/unified/font/extract.rs b/bevy_kayak_ui/src/render/unified/font/extract.rs index a4593ca192829d3f0a486b3268643aab5a90176a..be26bc88c30f0324332bd10acdb92620f485bafe 100644 --- a/bevy_kayak_ui/src/render/unified/font/extract.rs +++ b/bevy_kayak_ui/src/render/unified/font/extract.rs @@ -43,64 +43,12 @@ pub fn extract_texts( }; let font_handle = font_mapping.get_handle(font).unwrap(); - let new_chars = { - let font = fonts.get(font_handle.clone()).unwrap(); - font.font.check_chars(content.chars()) - }; - // Filter out non-renderable spaces. - let new_chars: Vec<_> = new_chars.into_iter().filter(|c| *c != ' ').collect(); - // Add chars to font. - if new_chars.len() > 0 { - let font = fonts.get_mut(font_handle.clone()).unwrap(); - for c in new_chars { - font.font.add_character(c); - } - } let font = fonts.get(font_handle.clone()).unwrap(); - let max_glyph_size = font - .sdf - .as_ref() - .and_then(|sdf| Some(sdf.max_glyph_size())) - .unwrap_or_default(); - // let char_layouts = font.font.get_layout( - // content, - // font_size, - // font.sdf.as_ref().unwrap().atlas.size, - // (max_glyph_size.x, max_glyph_size.y), - // ); - // let font_scale = font_size / font.font.units_per_em() as f32; - // for (c, (x, y), (width, height)) in char_layouts { - // // let size = font.font.get_size(c, font_size); - // let position_x = layout.posx + x; - // let position_y = layout.posy + y; - // extracted_texts.push(ExtractQuadBundle { - // extracted_quad: ExtractedQuad { - // font_handle: Some(font_handle.clone()), - // rect: Rect { - // min: Vec2::new(position_x, position_y), - // max: Vec2::new(position_x + width, position_y + height), - // }, - // color: to_bevy_color(background_color), - // vertex_index: 0, - // char_id: font.font.get_char_id(c), - // z_index: layout.z_index, - // quad_type: UIQuadType::Text, - // type_index: 0, - // border_radius: (0.0, 0.0, 0.0, 0.0), - // }, - // }); - // } + let max_glyph_size = font.sdf.max_glyph_size(); let mut x = 0.0; for c in content.chars() { - if let Some(glyph) = font - .sdf - .as_ref() - .unwrap() - .glyphs - .iter() - .find(|glyph| glyph.unicode == c) - { + if let Some(glyph) = font.sdf.glyphs.iter().find(|glyph| glyph.unicode == c) { let plane_bounds = glyph.plane_bounds.as_ref(); let (left, top, _width, _height) = match plane_bounds { Some(val) => ( @@ -112,7 +60,7 @@ pub fn extract_texts( None => (0.0, 0.0, 0.0, 0.0), }; - let font_ratio = font_size / font.sdf.as_ref().unwrap().atlas.size; + let font_ratio = font_size / font.sdf.atlas.size; let resized_max_glyph_size = (max_glyph_size.x * font_ratio, max_glyph_size.y * font_ratio); @@ -130,7 +78,7 @@ pub fn extract_texts( }, color: to_bevy_color(background_color), vertex_index: 0, - char_id: font.font.get_char_id(c), + char_id: font.get_char_id(c).unwrap(), z_index: layout.z_index, quad_type: UIQuadType::Text, type_index: 0, diff --git a/bevy_kayak_ui/src/render/unified/font/font.rs b/bevy_kayak_ui/src/render/unified/font/font.rs index 7bfd702adaee4a0e18a848ff620637398fb9da97..e081b89a6d21f2633126e510749d861eb01cdb7f 100644 --- a/bevy_kayak_ui/src/render/unified/font/font.rs +++ b/bevy_kayak_ui/src/render/unified/font/font.rs @@ -1,16 +1,34 @@ -use bevy::{prelude::Handle, reflect::TypeUuid, render2::texture::Image}; -use kayak_font::Font; +use std::collections::HashMap; use super::sdf::Sdf; +use bevy::{prelude::Handle, reflect::TypeUuid, render2::texture::Image}; #[derive(Debug, Clone, TypeUuid)] #[uuid = "4fe4732c-6731-49bb-bafc-4690d636b848"] pub struct KayakFont { - pub sdf: Option<Sdf>, - pub atlas_image: Option<Handle<Image>>, - pub font: Font, + pub sdf: Sdf, + pub atlas_image: Handle<Image>, + char_ids: HashMap<char, u32>, } -// impl KayakFont { -// pub fn from_atlas(atlas: Texture, ) -// } +impl KayakFont { + pub fn new(sdf: Sdf, atlas_image: Handle<Image>) -> Self { + Self { + sdf, + atlas_image, + char_ids: HashMap::default(), + } + } + + pub fn generate_char_ids(&mut self) { + let mut count = 0; + for glyph in self.sdf.glyphs.iter() { + self.char_ids.insert(glyph.unicode, count); + count += 1; + } + } + + pub fn get_char_id(&self, c: char) -> Option<u32> { + self.char_ids.get(&c).and_then(|id| Some(*id)) + } +} diff --git a/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs b/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs index f62e5e071b9343899967eeb773ee7275300eb25c..e195c2b6b5bdaad8c3e43c8b64e1bc30fcb29b27 100644 --- a/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs +++ b/bevy_kayak_ui/src/render/unified/font/font_texture_cache.rs @@ -70,52 +70,20 @@ impl FontTextureCache { for kayak_font_handle in new_fonts { let mut was_processed = true; if let Some(font) = self.fonts.get(&kayak_font_handle) { - if let Some(sdf) = &font.sdf { - let atlas_handle = font.atlas_image.as_ref().unwrap(); - if let Some(atlas_texture) = render_images.get(atlas_handle) { - Self::create_from_atlas( - &mut self.images, - &mut self.bind_groups, - sdf, - kayak_font_handle.clone_weak(), - device, - queue, - pipeline, - atlas_texture, - sdf.max_glyph_size(), - ); - } else { - was_processed = false; - } - } else { - Self::create_texture( + if let Some(atlas_texture) = render_images.get(&font.atlas_image) { + Self::create_from_atlas( &mut self.images, + &mut self.bind_groups, + &font.sdf, kayak_font_handle.clone_weak(), - (font.font.cache.dimensions.0, font.font.cache.dimensions.1), device, - TextureFormat::Rgba32Float, + queue, + pipeline, + atlas_texture, + font.sdf.max_glyph_size(), ); - - let gpu_image = self.images.get(&kayak_font_handle).unwrap(); - - // create bind group - let binding = device.create_bind_group(&BindGroupDescriptor { - label: Some("text_image_bind_group"), - entries: &[ - BindGroupEntry { - binding: 0, - resource: BindingResource::TextureView(&gpu_image.texture_view), - }, - BindGroupEntry { - binding: 1, - resource: BindingResource::Sampler(&gpu_image.sampler), - }, - ], - layout: &pipeline.font_image_layout, - }); - - self.bind_groups - .insert(kayak_font_handle.clone_weak(), binding); + } else { + was_processed = false; } } if !was_processed { @@ -124,20 +92,6 @@ impl FontTextureCache { } } - pub fn process_updated(&mut self, queue: &RenderQueue) { - let updated_fonts = self.updated_fonts.drain(..); - for kayak_font_handle in updated_fonts { - if let Some(font) = self.fonts.get_mut(&kayak_font_handle) { - Self::process_new_chars_into_texture( - &mut self.images, - kayak_font_handle, - font, - queue, - ); - } - } - } - fn create_texture( images: &mut HashMap<Handle<KayakFont>, GpuImage>, font_handle: Handle<KayakFont>, @@ -197,45 +151,6 @@ impl FontTextureCache { images.insert(font_handle, image); } - pub fn process_new_chars_into_texture( - images: &mut HashMap<Handle<KayakFont>, GpuImage>, - kayak_font_handle: Handle<KayakFont>, - font: &mut KayakFont, - queue: &RenderQueue, - ) { - let size = font.font.cache.dimensions; - if let Some(gpu_image) = images.get_mut(&kayak_font_handle) { - for (_, id, pixels) in font.font.get_data_to_process() { - let format_size = TextureFormat::Rgba32Float.pixel_size(); - queue.write_texture( - ImageCopyTexture { - texture: &gpu_image.texture, - mip_level: 0, - origin: Origin3d { - x: 0, - y: 0, - z: id as u32, - }, - aspect: TextureAspect::All, - }, - &pixels, - ImageDataLayout { - offset: 0, - bytes_per_row: Some( - std::num::NonZeroU32::new(size.0 * format_size as u32).unwrap(), - ), - rows_per_image: None, - }, - Extent3d { - width: size.0, - height: size.1, - depth_or_array_layers: 1, - }, - ); - } - } - } - pub fn get_empty( device: &RenderDevice, image_layout: &BindGroupLayout, diff --git a/bevy_kayak_ui/src/render/unified/font/mod.rs b/bevy_kayak_ui/src/render/unified/font/mod.rs index c00c84a67d1ad0d74fde8f407be6f9de4952e5ae..9728e4455d494359384e9783064b132ebaefb62d 100644 --- a/bevy_kayak_ui/src/render/unified/font/mod.rs +++ b/bevy_kayak_ui/src/render/unified/font/mod.rs @@ -59,27 +59,15 @@ fn load_fonts( mut font_mapping: ResMut<FontMapping>, asset_server: Res<AssetServer>, ) { - let font_bytes = include_bytes!("../../../../../resources/Roboto-Regular.ttf"); let sdf = Sdf::from_string(include_str!("../../../../../assets/roboto.json").to_string()); let max_glyph_size = sdf.max_glyph_size(); - let mut font = kayak_font::Font::new( - font_bytes, - (max_glyph_size.x as u32, max_glyph_size.y as u32), - ); let atlas_image: Handle<Image> = asset_server.load("roboto.png"); - for glyph in sdf.glyphs.iter() { - if !font.cache.has_character(glyph.unicode) { - font.cache.add_character(glyph.unicode); - } - } + let mut font = KayakFont::new(sdf, atlas_image); + font.generate_char_ids(); - let handle = font_assets.add(KayakFont { - font, - atlas_image: Some(atlas_image), - sdf: Some(sdf), - }); + let handle = font_assets.add(font); font_mapping.add(handle); } @@ -143,20 +131,18 @@ fn extract_fonts( for handle in changed_assets { let font_asset = font_assets.get(&handle).unwrap(); - if let Some(image) = font_asset.atlas_image.as_ref() { - if let Some(image) = textures.get(image) { - if !image - .texture_descriptor - .usage - .contains(TextureUsages::COPY_SRC) - { - not_processed.push(handle); - continue; - } - } else { + if let Some(image) = textures.get(&font_asset.atlas_image) { + if !image + .texture_descriptor + .usage + .contains(TextureUsages::COPY_SRC) + { not_processed.push(handle); continue; } + } else { + not_processed.push(handle); + continue; } let font = font_asset.clone(); @@ -184,5 +170,4 @@ fn create_and_update_font_cache_texture( images: Res<RenderAssets<Image>>, ) { font_texture_cache.process_new(&device, &queue, &pipeline, &images); - font_texture_cache.process_updated(&queue); } diff --git a/bevy_kayak_ui/src/render/unified/pipeline.rs b/bevy_kayak_ui/src/render/unified/pipeline.rs index 61c1bc10ae7121d3ba5a66e109eb5f8427f55364..c2d1819a38d55f87b50010f94871b3f852dd8283 100644 --- a/bevy_kayak_ui/src/render/unified/pipeline.rs +++ b/bevy_kayak_ui/src/render/unified/pipeline.rs @@ -306,7 +306,7 @@ pub struct ExtractedQuad { pub rect: Rect, pub color: Color, pub vertex_index: usize, - pub char_id: usize, + pub char_id: u32, pub z_index: f32, pub font_handle: Option<Handle<KayakFont>>, pub quad_type: UIQuadType, diff --git a/kayak_core/src/context.rs b/kayak_core/src/context.rs index 8e6fb4dde894c91e7767148bd542ac497e3fdb35..895ea2aaea2b604e1a1830a1a3a8cb4e3604f55c 100644 --- a/kayak_core/src/context.rs +++ b/kayak_core/src/context.rs @@ -68,7 +68,7 @@ impl KayakContext { let states = self.component_states.get(&self.current_id).unwrap(); if states.contains::<T>() { let mut mutate_t = states.get_mut::<T>().unwrap(); - self.widget_manager.dirty_nodes.push(self.current_id); + self.widget_manager.dirty_nodes.insert(self.current_id); *mutate_t = state; } else { panic!( @@ -96,22 +96,21 @@ impl KayakContext { } pub fn render(&mut self) { - let dirty_nodes = self.widget_manager.dirty_nodes.clone(); + let dirty_nodes: Vec<_> = self.widget_manager.dirty_nodes.drain().collect(); for node_index in dirty_nodes { - if self - .widget_manager - .dirty_nodes - .iter() - .any(|dirty_index| node_index == *dirty_index) - { + // if self + // .widget_manager + // .dirty_nodes + // .iter() + // .any(|dirty_index| node_index == *dirty_index) + // { let mut widget = self.widget_manager.take(node_index); widget.render(self); self.widget_manager.repossess(widget); - } + // } } - self.widget_manager.dirty_nodes.clear(); - + // self.widget_manager.dirty_nodes.clear(); self.widget_manager.render(); self.widget_manager.calculate_layout(); } diff --git a/kayak_core/src/widget_manager.rs b/kayak_core/src/widget_manager.rs index dd141b2000b077425f0792b647b780af24ebd17e..cee0ceafc7582ec01acad79e677c17563c93498b 100644 --- a/kayak_core/src/widget_manager.rs +++ b/kayak_core/src/widget_manager.rs @@ -1,3 +1,5 @@ +use std::collections::HashSet; + use crate::{ layout_cache::LayoutCache, node::{Node, NodeBuilder, NodeIndex}, @@ -13,7 +15,7 @@ use crate::{ pub struct WidgetManager { pub(crate) current_widgets: Arena<Option<Box<dyn Widget>>>, pub(crate) dirty_render_nodes: Vec<Index>, - pub(crate) dirty_nodes: Vec<Index>, + pub(crate) dirty_nodes: HashSet<Index>, pub(crate) nodes: Arena<Option<Node>>, pub tree: Tree, pub node_tree: Tree, @@ -26,7 +28,7 @@ impl WidgetManager { Self { current_widgets: Arena::new(), dirty_render_nodes: Vec::new(), - dirty_nodes: Vec::new(), + dirty_nodes: HashSet::new(), nodes: Arena::new(), tree: Tree::default(), node_tree: Tree::default(), @@ -40,11 +42,11 @@ impl WidgetManager { /// Can be slow. pub fn dirty(&mut self, force: bool) { // Force tree to re-render from root. - self.dirty_nodes.push(self.tree.root_node); + self.dirty_nodes.insert(self.tree.root_node); if force { for (node_index, _) in self.current_widgets.iter() { - self.dirty_nodes.push(node_index); + self.dirty_nodes.insert(node_index); self.dirty_render_nodes.push(node_index); } } @@ -62,9 +64,9 @@ impl WidgetManager { if let Some(widget_id) = parent_children.get(index) { widget.set_id(*widget_id); // Remove from the dirty nodes lists. - if let Some(index) = self.dirty_nodes.iter().position(|id| *widget_id == *id) { - self.dirty_nodes.remove(index); - } + // if let Some(index) = self.dirty_nodes.iter().position(|id| *widget_id == *id) { + // self.dirty_nodes.remove(index); + // } // TODO: Figure a good way of diffing props passed to children of a widget // that wont naturally-rerender it's children because of a lack of changes @@ -102,9 +104,9 @@ impl WidgetManager { self.dirty_render_nodes.push(widget_id); // Remove from the dirty nodes lists. - if let Some(index) = self.dirty_nodes.iter().position(|id| widget_id == *id) { - self.dirty_nodes.remove(index); - } + // if let Some(index) = self.dirty_nodes.iter().position(|id| widget_id == *id) { + // self.dirty_nodes.remove(index); + // } self.tree.add(0, widget_id, parent); self.layout_cache.add(NodeIndex(widget_id));