diff --git a/Cargo.lock b/Cargo.lock index 0a629f9..f8c513f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,9 +207,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.21" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -228,9 +228,9 @@ checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] @@ -507,7 +507,7 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bevy" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_internal", ] @@ -515,7 +515,7 @@ dependencies = [ [[package]] name = "bevy_a11y" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "accesskit", "bevy_app", @@ -527,7 +527,7 @@ dependencies = [ [[package]] name = "bevy_android" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "android-activity", ] @@ -535,7 +535,7 @@ dependencies = [ [[package]] name = "bevy_animation" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_animation_macros", "bevy_app", @@ -567,7 +567,7 @@ dependencies = [ [[package]] name = "bevy_animation_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "quote", @@ -577,7 +577,7 @@ dependencies = [ [[package]] name = "bevy_anti_alias" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -599,7 +599,7 @@ dependencies = [ [[package]] name = "bevy_app" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_derive", "bevy_ecs", @@ -621,7 +621,7 @@ dependencies = [ [[package]] name = "bevy_asset" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "async-broadcast", "async-channel", @@ -664,7 +664,7 @@ dependencies = [ [[package]] name = "bevy_asset_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -675,7 +675,7 @@ dependencies = [ [[package]] name = "bevy_audio" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -692,7 +692,7 @@ dependencies = [ [[package]] name = "bevy_camera" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -717,7 +717,7 @@ dependencies = [ [[package]] name = "bevy_color" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_math", "bevy_reflect", @@ -732,7 +732,7 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -760,7 +760,7 @@ dependencies = [ [[package]] name = "bevy_derive" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "quote", @@ -770,7 +770,7 @@ dependencies = [ [[package]] name = "bevy_dev_tools" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -801,7 +801,7 @@ dependencies = [ [[package]] name = "bevy_diagnostic" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "atomic-waker", "bevy_app", @@ -818,7 +818,7 @@ dependencies = [ [[package]] name = "bevy_ecs" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "arrayvec", "bevy_ecs_macros", @@ -845,7 +845,7 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -856,7 +856,7 @@ dependencies = [ [[package]] name = "bevy_encase_derive" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -865,7 +865,7 @@ dependencies = [ [[package]] name = "bevy_feathers" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "accesskit", "bevy_a11y", @@ -894,7 +894,7 @@ dependencies = [ [[package]] name = "bevy_gilrs" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_ecs", @@ -909,7 +909,7 @@ dependencies = [ [[package]] name = "bevy_gizmos" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -928,7 +928,7 @@ dependencies = [ [[package]] name = "bevy_gizmos_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "quote", @@ -938,7 +938,7 @@ dependencies = [ [[package]] name = "bevy_gizmos_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -963,7 +963,7 @@ dependencies = [ [[package]] name = "bevy_gltf" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "async-lock", "base64", @@ -998,7 +998,7 @@ dependencies = [ [[package]] name = "bevy_image" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1026,7 +1026,7 @@ dependencies = [ [[package]] name = "bevy_input" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_ecs", @@ -1042,7 +1042,7 @@ dependencies = [ [[package]] name = "bevy_input_focus" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_ecs", @@ -1058,7 +1058,7 @@ dependencies = [ [[package]] name = "bevy_internal" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_a11y", "bevy_android", @@ -1114,7 +1114,7 @@ dependencies = [ [[package]] name = "bevy_light" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1138,7 +1138,7 @@ dependencies = [ [[package]] name = "bevy_log" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "android_log-sys", "bevy_app", @@ -1155,7 +1155,7 @@ dependencies = [ [[package]] name = "bevy_macro_utils" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "proc-macro2", "quote", @@ -1166,7 +1166,7 @@ dependencies = [ [[package]] name = "bevy_material" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_asset", "bevy_derive", @@ -1188,7 +1188,7 @@ dependencies = [ [[package]] name = "bevy_material_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "quote", @@ -1198,7 +1198,7 @@ dependencies = [ [[package]] name = "bevy_math" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "approx", "arrayvec", @@ -1217,7 +1217,7 @@ dependencies = [ [[package]] name = "bevy_mesh" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1274,7 +1274,7 @@ dependencies = [ [[package]] name = "bevy_pbr" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "arrayvec", "bevy_app", @@ -1315,7 +1315,7 @@ dependencies = [ [[package]] name = "bevy_picking" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1338,7 +1338,7 @@ dependencies = [ [[package]] name = "bevy_platform" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "critical-section", "foldhash 0.2.0", @@ -1359,7 +1359,7 @@ dependencies = [ [[package]] name = "bevy_post_process" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1383,12 +1383,12 @@ dependencies = [ [[package]] name = "bevy_ptr" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" [[package]] name = "bevy_reflect" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "assert_type_match", "bevy_platform", @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "indexmap", @@ -1429,7 +1429,7 @@ dependencies = [ [[package]] name = "bevy_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "async-channel", "bevy_app", @@ -1481,7 +1481,7 @@ dependencies = [ [[package]] name = "bevy_render_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -1492,7 +1492,7 @@ dependencies = [ [[package]] name = "bevy_scene" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "bevy_shader" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_asset", "bevy_platform", @@ -1531,7 +1531,7 @@ dependencies = [ [[package]] name = "bevy_sprite" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1556,7 +1556,7 @@ dependencies = [ [[package]] name = "bevy_sprite_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1588,7 +1588,7 @@ dependencies = [ [[package]] name = "bevy_state" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_ecs", @@ -1603,7 +1603,7 @@ dependencies = [ [[package]] name = "bevy_state_macros" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_macro_utils", "quote", @@ -1613,7 +1613,7 @@ dependencies = [ [[package]] name = "bevy_tasks" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "async-channel", "async-executor", @@ -1631,7 +1631,7 @@ dependencies = [ [[package]] name = "bevy_text" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1658,7 +1658,7 @@ dependencies = [ [[package]] name = "bevy_time" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_ecs", @@ -1672,7 +1672,7 @@ dependencies = [ [[package]] name = "bevy_transform" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_ecs", @@ -1689,7 +1689,7 @@ dependencies = [ [[package]] name = "bevy_ui" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "accesskit", "bevy_a11y", @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "bevy_ui_render" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1754,7 +1754,7 @@ dependencies = [ [[package]] name = "bevy_ui_widgets" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "accesskit", "bevy_a11y", @@ -1773,7 +1773,7 @@ dependencies = [ [[package]] name = "bevy_utils" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "async-channel", "bevy_platform", @@ -1784,7 +1784,7 @@ dependencies = [ [[package]] name = "bevy_window" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "bevy_app", "bevy_asset", @@ -1802,7 +1802,7 @@ dependencies = [ [[package]] name = "bevy_winit" version = "0.19.0-dev" -source = "git+https://github.com/bevyengine/bevy?branch=main#0dcba0d0c66974462282323b2d5ee34ffbb36119" +source = "git+https://github.com/bevyengine/bevy?branch=main#3fea954eaaf25947af172ff5ba6e14e5771f78ff" dependencies = [ "accesskit", "accesskit_winit", @@ -2103,18 +2103,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.60" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" +checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.60" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstream", "anstyle", @@ -2124,9 +2124,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "codespan-reporting" @@ -4689,9 +4689,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" @@ -4701,9 +4701,9 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "orbclient" -version = "0.3.50" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ad2c6bae700b7aa5d1cc30c59bdd3a1c180b09dbaea51e2ae2b8e1cf211fdd" +checksum = "59aed3b33578edcfa1bc96a321d590d31832b6ad55a26f0313362ce687e9abd6" dependencies = [ "libc", "libredox", @@ -5833,9 +5833,9 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" [[package]] name = "tempfile" -version = "3.26.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", "getrandom 0.4.2", @@ -7524,9 +7524,9 @@ dependencies = [ [[package]] name = "zune-jpeg" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "410e9ecef634c709e3831c2cfdb8d9c32164fae1c67496d5b68fff728eec37fe" +checksum = "ec5f41c76397b7da451efd19915684f727d7e1d516384ca6bd0ec43ec94de23c" dependencies = [ "zune-core", ] diff --git a/Cargo.toml b/Cargo.toml index 525ca13..ff08ae4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,6 +89,14 @@ path = "examples/midi.rs" name = "gltf_load" path = "examples/gltf_load.rs" +[[example]] +name = "stroke_2d" +path = "examples/stroke_2d.rs" + +[[example]] +name = "stroke_3d" +path = "examples/stroke_3d.rs" + [[example]] name = "custom_material" path = "examples/custom_material.rs" diff --git a/crates/processing_ffi/src/lib.rs b/crates/processing_ffi/src/lib.rs index 15a7402..361ef65 100644 --- a/crates/processing_ffi/src/lib.rs +++ b/crates/processing_ffi/src/lib.rs @@ -281,6 +281,32 @@ pub extern "C" fn processing_set_stroke_weight(graphics_id: u64, weight: f32) { error::check(|| graphics_record_command(graphics_entity, DrawCommand::StrokeWeight(weight))); } +/// Set the stroke cap mode. +#[unsafe(no_mangle)] +pub extern "C" fn processing_set_stroke_cap(graphics_id: u64, cap: u8) { + error::clear_error(); + let graphics_entity = Entity::from_bits(graphics_id); + error::check(|| { + graphics_record_command( + graphics_entity, + DrawCommand::StrokeCap(processing::prelude::StrokeCapMode::from(cap)), + ) + }); +} + +/// Set the stroke join mode. +#[unsafe(no_mangle)] +pub extern "C" fn processing_set_stroke_join(graphics_id: u64, join: u8) { + error::clear_error(); + let graphics_entity = Entity::from_bits(graphics_id); + error::check(|| { + graphics_record_command( + graphics_entity, + DrawCommand::StrokeJoin(processing::prelude::StrokeJoinMode::from(join)), + ) + }); +} + /// Disable fill for subsequent shapes. /// /// SAFETY: @@ -694,6 +720,14 @@ pub const PROCESSING_TOPOLOGY_LINE_STRIP: u8 = 2; pub const PROCESSING_TOPOLOGY_TRIANGLE_LIST: u8 = 3; pub const PROCESSING_TOPOLOGY_TRIANGLE_STRIP: u8 = 4; +pub const PROCESSING_STROKE_CAP_ROUND: u8 = 0; +pub const PROCESSING_STROKE_CAP_SQUARE: u8 = 1; +pub const PROCESSING_STROKE_CAP_PROJECT: u8 = 2; + +pub const PROCESSING_STROKE_JOIN_ROUND: u8 = 0; +pub const PROCESSING_STROKE_JOIN_MITER: u8 = 1; +pub const PROCESSING_STROKE_JOIN_BEVEL: u8 = 2; + #[unsafe(no_mangle)] pub extern "C" fn processing_geometry_layout_create() -> u64 { error::clear_error(); diff --git a/crates/processing_pyo3/src/graphics.rs b/crates/processing_pyo3/src/graphics.rs index 32b43b0..e39f839 100644 --- a/crates/processing_pyo3/src/graphics.rs +++ b/crates/processing_pyo3/src/graphics.rs @@ -319,6 +319,22 @@ impl Graphics { .map_err(|e| PyRuntimeError::new_err(format!("{e}"))) } + pub fn stroke_cap(&self, cap: u8) -> PyResult<()> { + graphics_record_command( + self.entity, + DrawCommand::StrokeCap(processing::prelude::StrokeCapMode::from(cap)), + ) + .map_err(|e| PyRuntimeError::new_err(format!("{e}"))) + } + + pub fn stroke_join(&self, join: u8) -> PyResult<()> { + graphics_record_command( + self.entity, + DrawCommand::StrokeJoin(processing::prelude::StrokeJoinMode::from(join)), + ) + .map_err(|e| PyRuntimeError::new_err(format!("{e}"))) + } + pub fn rect( &self, x: f32, diff --git a/crates/processing_pyo3/src/lib.rs b/crates/processing_pyo3/src/lib.rs index 9c38752..bdd9759 100644 --- a/crates/processing_pyo3/src/lib.rs +++ b/crates/processing_pyo3/src/lib.rs @@ -70,6 +70,16 @@ fn processing(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(stroke, m)?)?; m.add_function(wrap_pyfunction!(no_stroke, m)?)?; m.add_function(wrap_pyfunction!(stroke_weight, m)?)?; + m.add_function(wrap_pyfunction!(stroke_cap, m)?)?; + m.add_function(wrap_pyfunction!(stroke_join, m)?)?; + + m.add("ROUND", 0u8)?; + m.add("SQUARE", 1u8)?; + m.add("PROJECT", 2u8)?; + + m.add("MITER", 1u8)?; + m.add("BEVEL", 2u8)?; + m.add_function(wrap_pyfunction!(rect, m)?)?; m.add_function(wrap_pyfunction!(image, m)?)?; m.add_function(wrap_pyfunction!(draw_geometry, m)?)?; @@ -435,6 +445,18 @@ fn stroke_weight(module: &Bound<'_, PyModule>, weight: f32) -> PyResult<()> { graphics!(module).stroke_weight(weight) } +#[pyfunction] +#[pyo3(pass_module)] +fn stroke_cap(module: &Bound<'_, PyModule>, cap: u8) -> PyResult<()> { + graphics!(module).stroke_cap(cap) +} + +#[pyfunction] +#[pyo3(pass_module)] +fn stroke_join(module: &Bound<'_, PyModule>, join: u8) -> PyResult<()> { + graphics!(module).stroke_join(join) +} + #[pyfunction] #[pyo3(pass_module, signature = (x, y, w, h, tl=0.0, tr=0.0, br=0.0, bl=0.0))] fn rect( diff --git a/crates/processing_render/src/lib.rs b/crates/processing_render/src/lib.rs index fca7e25..d9071b0 100644 --- a/crates/processing_render/src/lib.rs +++ b/crates/processing_render/src/lib.rs @@ -279,6 +279,7 @@ fn create_app(config: Config) -> App { LightPlugin, material::MaterialPlugin, MidiPlugin, + bevy::pbr::wireframe::WireframePlugin::default(), material::custom::CustomMaterialPlugin, )); app.add_systems(First, (clear_transient_meshes, activate_cameras)) diff --git a/crates/processing_render/src/render/command.rs b/crates/processing_render/src/render/command.rs index a26f915..2ebb9e7 100644 --- a/crates/processing_render/src/render/command.rs +++ b/crates/processing_render/src/render/command.rs @@ -1,5 +1,45 @@ use bevy::prelude::*; +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] +#[repr(u8)] +pub enum StrokeCapMode { + #[default] + Round = 0, + Square = 1, + Project = 2, +} + +impl From for StrokeCapMode { + fn from(v: u8) -> Self { + match v { + 0 => Self::Round, + 1 => Self::Square, + 2 => Self::Project, + _ => Self::default(), + } + } +} + +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] +#[repr(u8)] +pub enum StrokeJoinMode { + #[default] + Round = 0, + Miter = 1, + Bevel = 2, +} + +impl From for StrokeJoinMode { + fn from(v: u8) -> Self { + match v { + 0 => Self::Round, + 1 => Self::Miter, + 2 => Self::Bevel, + _ => Self::default(), + } + } +} + #[derive(Debug, Clone)] pub enum DrawCommand { BackgroundColor(Color), @@ -9,6 +49,8 @@ pub enum DrawCommand { StrokeColor(Color), NoStroke, StrokeWeight(f32), + StrokeCap(StrokeCapMode), + StrokeJoin(StrokeJoinMode), Roughness(f32), Metallic(f32), Emissive(Color), diff --git a/crates/processing_render/src/render/mod.rs b/crates/processing_render/src/render/mod.rs index 187187b..fe10a0b 100644 --- a/crates/processing_render/src/render/mod.rs +++ b/crates/processing_render/src/render/mod.rs @@ -12,7 +12,7 @@ use bevy::{ }; use command::{CommandBuffer, DrawCommand}; use material::MaterialKey; -use primitive::{TessellationMode, box_mesh, empty_mesh, sphere_mesh}; +use primitive::{StrokeConfig, TessellationMode, box_mesh, empty_mesh, sphere_mesh}; use transform::TransformStack; use crate::{ @@ -65,6 +65,7 @@ pub struct RenderState { pub fill_color: Option, pub stroke_color: Option, pub stroke_weight: f32, + pub stroke_config: StrokeConfig, pub material_key: MaterialKey, pub transform: TransformStack, } @@ -75,6 +76,7 @@ impl RenderState { fill_color: Some(Color::WHITE), stroke_color: Some(Color::BLACK), stroke_weight: 1.0, + stroke_config: StrokeConfig::default(), material_key: MaterialKey::Color { transparent: false, background_image: None, @@ -87,6 +89,7 @@ impl RenderState { self.fill_color = Some(Color::WHITE); self.stroke_color = Some(Color::BLACK); self.stroke_weight = 1.0; + self.stroke_config = StrokeConfig::default(); self.material_key = MaterialKey::Color { transparent: false, background_image: None, @@ -152,6 +155,12 @@ pub fn flush_draw_commands( DrawCommand::StrokeWeight(weight) => { state.stroke_weight = weight; } + DrawCommand::StrokeCap(cap) => { + state.stroke_config.line_cap = cap; + } + DrawCommand::StrokeJoin(join) => { + state.stroke_config.line_join = join; + } DrawCommand::Roughness(r) => { state.material_key = match state.material_key { MaterialKey::Pbr { @@ -223,11 +232,24 @@ pub fn flush_draw_commands( }; } DrawCommand::Rect { x, y, w, h, radii } => { + let stroke_config = state.stroke_config; add_fill( &mut res, &mut batch, &state, - |mesh, color| rect(mesh, x, y, w, h, radii, color, TessellationMode::Fill), + |mesh, color| { + rect( + mesh, + x, + y, + w, + h, + radii, + color, + TessellationMode::Fill, + &stroke_config, + ) + }, &p_material_handles, ); @@ -245,6 +267,7 @@ pub fn flush_draw_commands( radii, color, TessellationMode::Stroke(weight), + &stroke_config, ) }, &p_material_handles, @@ -556,12 +579,13 @@ fn add_shape3d( mesh: Mesh, material_handles: &Query<&UntypedMaterial>, ) { + use bevy::pbr::wireframe::{Wireframe, WireframeColor, WireframeLineWidth, WireframeTopology}; + flush_batch(res, batch, material_handles); let mesh_handle = res.meshes.add(mesh); - let material_key = material_key_with_fill(state); - - let material_handle = match &material_key { + let fill_color = state.fill_color.unwrap_or(Color::WHITE); + let material_handle = match &state.material_key { MaterialKey::Custom(entity) => match material_handles.get(*entity) { Ok(handle) => handle.0.clone(), Err(_) => { @@ -569,14 +593,34 @@ fn add_shape3d( return; } }, - _ => material_key.to_material(&mut res.materials), + // TODO: in 2d, we use vertex colors. `to_material` becomes complicated if we also encode + // a base color in the material, so for simplicity we just create a new material here + // that is unlit and uses the fill color as the base color + MaterialKey::Color { transparent, .. } => { + let mat = StandardMaterial { + base_color: fill_color, + unlit: true, + cull_mode: None, + alpha_mode: if *transparent { + AlphaMode::Blend + } else { + AlphaMode::Opaque + }, + ..default() + }; + res.materials.add(mat).untyped() + } + _ => { + let key = material_key_with_fill(state); + key.to_material(&mut res.materials) + } }; let z_offset = -(batch.draw_index as f32 * 0.001); let mut transform = state.transform.to_bevy_transform(); transform.translation.z += z_offset; - res.commands.spawn(( + let mut entity = res.commands.spawn(( Mesh3d(mesh_handle), UntypedMaterial(material_handle), BelongsToGraphics(batch.graphics_entity), @@ -584,6 +628,19 @@ fn add_shape3d( batch.render_layers.clone(), )); + if let Some(stroke_color) = state.stroke_color { + entity.insert(( + Wireframe, + WireframeColor { + color: stroke_color, + }, + WireframeLineWidth { + width: state.stroke_weight, + }, + WireframeTopology::Quads, + )); + } + batch.draw_index += 1; } diff --git a/crates/processing_render/src/render/primitive/mod.rs b/crates/processing_render/src/render/primitive/mod.rs index 6ef4e93..9d2188b 100644 --- a/crates/processing_render/src/render/primitive/mod.rs +++ b/crates/processing_render/src/render/primitive/mod.rs @@ -15,6 +15,7 @@ use lyon::{ pub use rect::rect; pub use shape3d::{box_mesh, sphere_mesh}; +use super::command::{StrokeCapMode, StrokeJoinMode}; use super::mesh_builder::MeshBuilder; pub enum TessellationMode { @@ -22,7 +23,48 @@ pub enum TessellationMode { Stroke(f32), } -pub fn tessellate_path(mesh: &mut Mesh, path: &Path, color: Color, mode: TessellationMode) { +#[derive(Debug, Clone, Copy)] +pub struct StrokeConfig { + pub line_cap: StrokeCapMode, + pub line_join: StrokeJoinMode, +} + +impl Default for StrokeConfig { + fn default() -> Self { + Self { + line_cap: StrokeCapMode::Round, + line_join: StrokeJoinMode::Round, + } + } +} + +impl StrokeCapMode { + pub fn to_lyon(self) -> LineCap { + match self { + Self::Round => LineCap::Round, + Self::Square => LineCap::Square, + Self::Project => LineCap::Butt, + } + } +} + +impl StrokeJoinMode { + pub fn to_lyon(self) -> LineJoin { + match self { + Self::Round => LineJoin::Round, + Self::Miter => LineJoin::Miter, + Self::Bevel => LineJoin::Bevel, + } + } +} + +pub fn tessellate_path( + mesh: &mut Mesh, + path: &Path, + color: Color, + mode: TessellationMode, + stroke_config: &StrokeConfig, +) { let mut builder = MeshBuilder::new(mesh, color); match mode { TessellationMode::Fill => { @@ -35,8 +77,8 @@ pub fn tessellate_path(mesh: &mut Mesh, path: &Path, color: Color, mode: Tessell let mut tessellator = StrokeTessellator::new(); let options = StrokeOptions::default() .with_line_width(weight) - .with_line_cap(LineCap::Round) - .with_line_join(LineJoin::Round); + .with_line_cap(stroke_config.line_cap.to_lyon()) + .with_line_join(stroke_config.line_join.to_lyon()); tessellator .tessellate_path(path, &options, &mut builder) diff --git a/crates/processing_render/src/render/primitive/rect.rs b/crates/processing_render/src/render/primitive/rect.rs index 20c5827..36decaa 100644 --- a/crates/processing_render/src/render/primitive/rect.rs +++ b/crates/processing_render/src/render/primitive/rect.rs @@ -4,7 +4,7 @@ use bevy::{ }; use lyon::{geom::Point, path::Path}; -use crate::render::primitive::{TessellationMode, tessellate_path}; +use crate::render::primitive::{StrokeConfig, TessellationMode, tessellate_path}; fn rect_path(x: f32, y: f32, w: f32, h: f32, radii: [f32; 4]) -> Path { let mut path_builder = Path::builder(); @@ -56,12 +56,13 @@ pub fn rect( radii: [f32; 4], // [tl, tr, br, bl] color: Color, mode: TessellationMode, + stroke_config: &StrokeConfig, ) { if radii == [0.0; 4] && matches!(mode, TessellationMode::Fill) { simple_rect(mesh, x, y, w, h, color); } else { let path = rect_path(x, y, w, h, radii); - tessellate_path(mesh, &path, color, mode); + tessellate_path(mesh, &path, color, mode, stroke_config); } } diff --git a/crates/processing_wasm/src/lib.rs b/crates/processing_wasm/src/lib.rs index 572623d..92090b5 100644 --- a/crates/processing_wasm/src/lib.rs +++ b/crates/processing_wasm/src/lib.rs @@ -105,6 +105,24 @@ pub fn js_stroke_weight(surface_id: u64, weight: f32) -> Result<(), JsValue> { )) } +#[wasm_bindgen(js_name = "strokeCap")] +pub fn js_stroke_cap(surface_id: u64, cap: u8) -> Result<(), JsValue> { + check(graphics_record_command( + Entity::from_bits(surface_id), + DrawCommand::StrokeCap(processing_render::render::command::StrokeCapMode::from(cap)), + )) +} + +#[wasm_bindgen(js_name = "strokeJoin")] +pub fn js_stroke_join(surface_id: u64, join: u8) -> Result<(), JsValue> { + check(graphics_record_command( + Entity::from_bits(surface_id), + DrawCommand::StrokeJoin(processing_render::render::command::StrokeJoinMode::from( + join, + )), + )) +} + #[wasm_bindgen(js_name = "noFill")] pub fn js_no_fill(surface_id: u64) -> Result<(), JsValue> { check(graphics_record_command( diff --git a/examples/stroke_2d.rs b/examples/stroke_2d.rs new file mode 100644 index 0000000..51d83c9 --- /dev/null +++ b/examples/stroke_2d.rs @@ -0,0 +1,67 @@ +mod glfw; + +use glfw::GlfwContext; +use processing::prelude::*; +use processing_render::render::command::DrawCommand; + +fn main() { + sketch().unwrap(); + exit(0).unwrap(); +} + +fn sketch() -> error::Result<()> { + let mut glfw_ctx = GlfwContext::new(600, 300)?; + init(Config::default())?; + + let surface = glfw_ctx.create_surface(600, 300)?; + let graphics = graphics_create(surface, 600, 300, TextureFormat::Rgba16Float)?; + + let joins = [ + StrokeJoinMode::Round, + StrokeJoinMode::Miter, + StrokeJoinMode::Bevel, + ]; + + while glfw_ctx.poll_events() { + graphics_begin_draw(graphics)?; + + graphics_record_command( + graphics, + DrawCommand::BackgroundColor(bevy::color::Color::srgb(0.15, 0.15, 0.2)), + )?; + + graphics_record_command(graphics, DrawCommand::StrokeWeight(12.0))?; + + for (i, &join) in joins.iter().enumerate() { + let x = 30.0 + i as f32 * 190.0; + let y = 50.0; + + graphics_record_command(graphics, DrawCommand::StrokeJoin(join))?; + + let hue = i as f32 * 0.3; + graphics_record_command( + graphics, + DrawCommand::Fill(bevy::color::Color::srgb(0.3 + hue, 0.5, 0.8 - hue)), + )?; + graphics_record_command( + graphics, + DrawCommand::StrokeColor(bevy::color::Color::srgb(1.0, 0.9, 0.3)), + )?; + + graphics_record_command( + graphics, + DrawCommand::Rect { + x, + y, + w: 150.0, + h: 180.0, + radii: [0.0; 4], + }, + )?; + } + + graphics_end_draw(graphics)?; + } + + Ok(()) +} diff --git a/examples/stroke_3d.rs b/examples/stroke_3d.rs new file mode 100644 index 0000000..ce80ee5 --- /dev/null +++ b/examples/stroke_3d.rs @@ -0,0 +1,143 @@ +mod glfw; + +use glfw::GlfwContext; +use processing::prelude::*; +use processing_render::render::command::DrawCommand; + +fn main() { + sketch().unwrap(); + exit(0).unwrap(); +} + +fn sketch() -> error::Result<()> { + let mut glfw_ctx = GlfwContext::new(600, 400)?; + init(Config::default())?; + + let surface = glfw_ctx.create_surface(600, 400)?; + let graphics = graphics_create(surface, 600, 400, TextureFormat::Rgba16Float)?; + + graphics_mode_3d(graphics)?; + transform_set_position(graphics, 200.0, 150.0, 350.0)?; + transform_look_at(graphics, 0.0, 0.0, 0.0)?; + + let _light = + light_create_directional(graphics, bevy::color::Color::srgb(0.9, 0.85, 0.8), 800.0)?; + + let mut angle: f32 = 0.0; + + while glfw_ctx.poll_events() { + graphics_begin_draw(graphics)?; + + graphics_record_command( + graphics, + DrawCommand::BackgroundColor(bevy::color::Color::srgb(0.08, 0.08, 0.12)), + )?; + + // thin wireframe box + graphics_record_command(graphics, DrawCommand::PushMatrix)?; + graphics_record_command(graphics, DrawCommand::Translate { x: -80.0, y: 0.0 })?; + graphics_record_command(graphics, DrawCommand::Rotate { angle })?; + + graphics_record_command( + graphics, + DrawCommand::Fill(bevy::color::Color::srgb(0.3, 0.4, 0.7)), + )?; + graphics_record_command( + graphics, + DrawCommand::StrokeColor(bevy::color::Color::srgb(1.0, 1.0, 1.0)), + )?; + graphics_record_command(graphics, DrawCommand::StrokeWeight(1.0))?; + + graphics_record_command( + graphics, + DrawCommand::Box { + width: 60.0, + height: 60.0, + depth: 60.0, + }, + )?; + graphics_record_command(graphics, DrawCommand::PopMatrix)?; + + // thick wireframe box + graphics_record_command(graphics, DrawCommand::PushMatrix)?; + graphics_record_command(graphics, DrawCommand::Translate { x: 0.0, y: 0.0 })?; + graphics_record_command(graphics, DrawCommand::Rotate { angle: angle * 0.7 })?; + + graphics_record_command( + graphics, + DrawCommand::Fill(bevy::color::Color::srgb(0.7, 0.3, 0.4)), + )?; + graphics_record_command( + graphics, + DrawCommand::StrokeColor(bevy::color::Color::srgb(1.0, 0.9, 0.2)), + )?; + graphics_record_command(graphics, DrawCommand::StrokeWeight(3.0))?; + + graphics_record_command( + graphics, + DrawCommand::Box { + width: 50.0, + height: 70.0, + depth: 50.0, + }, + )?; + graphics_record_command(graphics, DrawCommand::PopMatrix)?; + + // thick wireframe sphere + graphics_record_command(graphics, DrawCommand::PushMatrix)?; + graphics_record_command(graphics, DrawCommand::Translate { x: 80.0, y: 0.0 })?; + graphics_record_command(graphics, DrawCommand::Rotate { angle: angle * 0.5 })?; + + graphics_record_command( + graphics, + DrawCommand::Fill(bevy::color::Color::srgb(0.3, 0.7, 0.4)), + )?; + graphics_record_command( + graphics, + DrawCommand::StrokeColor(bevy::color::Color::srgb(0.9, 0.4, 1.0)), + )?; + graphics_record_command(graphics, DrawCommand::StrokeWeight(2.0))?; + + graphics_record_command( + graphics, + DrawCommand::Sphere { + radius: 35.0, + sectors: 16, + stacks: 12, + }, + )?; + graphics_record_command(graphics, DrawCommand::PopMatrix)?; + + // wireframe-only sphere (no fill) + graphics_record_command(graphics, DrawCommand::PushMatrix)?; + graphics_record_command(graphics, DrawCommand::Translate { x: 160.0, y: 0.0 })?; + graphics_record_command( + graphics, + DrawCommand::Rotate { + angle: -angle * 0.3, + }, + )?; + + graphics_record_command(graphics, DrawCommand::NoFill)?; + graphics_record_command( + graphics, + DrawCommand::StrokeColor(bevy::color::Color::srgb(0.2, 0.8, 1.0)), + )?; + graphics_record_command(graphics, DrawCommand::StrokeWeight(1.5))?; + + graphics_record_command( + graphics, + DrawCommand::Sphere { + radius: 30.0, + sectors: 24, + stacks: 16, + }, + )?; + graphics_record_command(graphics, DrawCommand::PopMatrix)?; + + graphics_end_draw(graphics)?; + angle += 0.015; + } + + Ok(()) +} diff --git a/src/prelude.rs b/src/prelude.rs index df9de2d..c23d694 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,3 +1,7 @@ pub use bevy::prelude::default; pub use bevy::render::render_resource::TextureFormat; -pub use processing_render::{config::*, render::command::DrawCommand, *}; +pub use processing_render::{ + config::*, + render::command::{DrawCommand, StrokeCapMode, StrokeJoinMode}, + *, +};