Merge branch 'prettify'
This commit is contained in:
commit
5e41ed0112
9 changed files with 430 additions and 261 deletions
229
Cargo.lock
generated
229
Cargo.lock
generated
|
@ -73,15 +73,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.52"
|
||||
version = "1.0.53"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3"
|
||||
checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0"
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e"
|
||||
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
@ -128,9 +128,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "async-task"
|
||||
version = "4.0.3"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"
|
||||
checksum = "677d306121baf53310a3fd342d88dc0824f6bbeace68347593658525565abee8"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
|
@ -153,6 +153,8 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
|||
[[package]]
|
||||
name = "bevy"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b77ad2987710ed960746c43813ad8c103db5c4c090f5cbc9c32c0a90a91bc599"
|
||||
dependencies = [
|
||||
"bevy_internal",
|
||||
]
|
||||
|
@ -160,6 +162,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy-crevice-derive"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4cf594c9277eb1e426f45a00eaf70aa9ffdf479268d7e4538270263811e20bc"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -170,6 +174,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_app"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58fe3d3f4140fb11cd294f43be7cb66a5783d9277ba0270743e2860e32b25ab5"
|
||||
dependencies = [
|
||||
"bevy_derive",
|
||||
"bevy_ecs",
|
||||
|
@ -182,6 +188,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_asset"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb68a0259e2f857a32c4f05eb9b9447db1072297c61864ad07d02fea1838bde9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -207,6 +215,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_core"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c156430a5312c04a1b25fa434eeeab6349a41c6bb96ea0385406d53b3c43658"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_derive",
|
||||
|
@ -221,6 +231,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_core_pipeline"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b422dca94195c904964ab21bc4557fbd11f692c299d46e38364715ac931841e"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -232,6 +244,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_crevice"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06d3eeb3237df793e8e01a110ee71824eacd15421821f9b175f3bafca864614c"
|
||||
dependencies = [
|
||||
"bevy-crevice-derive",
|
||||
"bytemuck",
|
||||
|
@ -242,6 +256,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_derive"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "918dc0dff01e8b4e8f989db89d74fd4042810ea80a70642d0459b3c265995e59"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"quote",
|
||||
|
@ -251,6 +267,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_diagnostic"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adbe98f48873d4b20f6479723de18d957f4bc00c653efd36c245e6a66d6e8b71"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_core",
|
||||
|
@ -262,6 +280,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_ecs"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b182092396e6c2caf5ab30d738511fcd382628aa86ef35878d28fabb325c933"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"bevy_ecs_macros",
|
||||
|
@ -278,6 +298,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_ecs_macros"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7e9e664b3ea45cfc9ab3251ee0255dfa6410f675b3a405e7bac8e59b2d76aa9"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -288,6 +310,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_gilrs"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b457f720b1c54ede34afd6007beae3708503c0dd7a4ab4b416e36cb8bbd05ac1"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -299,6 +323,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_gltf"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34e4711f4f77542dccd59eec249c98f02e34e28a25ee079c14cd351061d08e5c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
@ -322,6 +348,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_input"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33989693efa636960dd40e540029ed7b7bc1af2f3eef26c009555b5e2a4e185a"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -332,6 +360,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_internal"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f92af28d95bba80d11840c24fa4ce8ff84ae27af1def2f5cf8a6891acce5d714"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -363,6 +393,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_log"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bf0083e72bf76cbfa6607311ac6baef2f4f7c9306c35942cece8c0589cd3e5e"
|
||||
dependencies = [
|
||||
"android_log-sys",
|
||||
"bevy_app",
|
||||
|
@ -376,6 +408,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_macro_utils"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57cf90b3b67606d0818cdac6c9134eb66fa174959977a4abba893364a571a7cd"
|
||||
dependencies = [
|
||||
"cargo-manifest",
|
||||
"quote",
|
||||
|
@ -385,6 +419,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_math"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b0f9ebf2ef80a8fff3e5dca817594071004048cd089e72b9a1bf4e494b66112"
|
||||
dependencies = [
|
||||
"bevy_reflect",
|
||||
"glam",
|
||||
|
@ -393,6 +429,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_pbr"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f5c00c4d1d806a93caf554c28ca9708cc6717463a63dd400e70b106918bd32c"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -409,9 +447,20 @@ dependencies = [
|
|||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_polyline"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"bitflags",
|
||||
"naga",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_reflect"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d84ce8cbd484a39d67171831eaf72c20d2684de71f1e9d79333c8dd6d6f3ebca"
|
||||
dependencies = [
|
||||
"bevy_reflect_derive",
|
||||
"bevy_utils",
|
||||
|
@ -427,6 +476,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_reflect_derive"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7af3100febf44583a7c052d1469fbdb411f56aa85729333a0ac106a016bd379c"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -438,6 +489,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_render"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4175b9afe0963d04d485980438f631c1e2b02d3a57f58503b8e9239c44d5c2bf"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -472,6 +525,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_scene"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21eb2b01e4d1b074c75ea59a92409739cac24b56b1c723491ef80936d50e95df"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -489,6 +544,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_sprite"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66439831ff57c11c7fb2692e7ccf8d0551f4368a9908908d3c38f2da53115b33"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -513,6 +570,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_tasks"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9dc4bce7f4cddbb489636092f52478b103dc26ee8526c585289bbdd9c0d0a99f"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-executor",
|
||||
|
@ -525,6 +584,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_text"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "233c4bb933435e8e6c34a1310317fd7f8c6617526270de572e643816070b236a"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"anyhow",
|
||||
|
@ -547,6 +608,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_transform"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9974c494f9cc721df46d2ba27c6a8df2a955ed8360a23adabd2bd66d1f73fa8f"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -559,6 +622,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_ui"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f30583acee76b40bf1961ece57887ba067becc1e4694ef5dddf18ce2c038886"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -585,6 +650,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_utils"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "252f6674aa3ba68bacfec506b91570a3cc206ad09b7ef4b23661959ef0246396"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bevy_derive",
|
||||
|
@ -597,6 +664,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_window"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f4b52b766baf565e96f24f61dbc51bc85151f23202fed2b3650769f2edd0b21"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_math",
|
||||
|
@ -608,6 +677,8 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "bevy_winit"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "699c927ef5422a09b71134e5907497117210fe5063676fc7250b7551926f4bba"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"bevy_app",
|
||||
|
@ -894,9 +965,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.3.0"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836"
|
||||
checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
@ -980,7 +1051,9 @@ name = "cyber_rider"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"bevy_polyline",
|
||||
"heron",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1085,9 +1158,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "erased-serde"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44a5d80251b806a14cd3e4e1a582e912d5cbf6904ab19fdefbd7a56adca088e1"
|
||||
checksum = "56047058e1ab118075ca22f9ecd737bcc961aa3566a3019cb71388afa280bd8a"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -1103,15 +1176,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "2.5.1"
|
||||
version = "2.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59"
|
||||
checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.6.0"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2"
|
||||
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
@ -1297,9 +1370,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gpu-alloc"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e64cbb8d36508d3e19da95e56e196a84f674fc190881f2cc010000798838aa6"
|
||||
checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"gpu-alloc-types",
|
||||
|
@ -1322,7 +1395,7 @@ checksum = "a538f217be4d405ff4719a283ca68323cc2384003eca5baaa87501e821c81dda"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"gpu-descriptor-types",
|
||||
"hashbrown 0.11.2",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1344,12 +1417,6 @@ dependencies = [
|
|||
"svg_fmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
|
@ -1379,7 +1446,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "heron"
|
||||
version = "1.0.1-rc.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54579e36436e33827e21f046ea6752b3a93dbd0b05884bffe982568af7b3bebd"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"cfg_aliases",
|
||||
|
@ -1390,7 +1459,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "heron_core"
|
||||
version = "1.0.1-rc.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7099a07736abf70026b1e474fff8d74a8fa88a834cfd33e974541e6b056abb41"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"cfg_aliases",
|
||||
|
@ -1399,16 +1470,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "heron_macros"
|
||||
version = "1.0.1-rc.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a09c1e02655f04faf8d6b485f6c27422f3769343c30c39e51a2cd25f3f2869c3"
|
||||
dependencies = [
|
||||
"heron_core",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heron_rapier"
|
||||
version = "1.0.1-rc.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bf94fface67dce71dfd0ab2c0a8b211cacf7b1d02532669671892350765b340"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"cfg_aliases",
|
||||
|
@ -1464,12 +1538,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.6.2"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
|
||||
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown 0.9.1",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1520,9 +1594,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
|
|||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.55"
|
||||
version = "0.3.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
|
||||
checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
@ -1545,15 +1619,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.112"
|
||||
version = "0.2.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
|
||||
checksum = "b0005d08a8f7b65fb8073cb697aa0b12b631ed251ce73d862ce50eeb52ce3b50"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.2"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52"
|
||||
checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"winapi",
|
||||
|
@ -1697,9 +1771,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.8.2"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dfa3912b150e6bfb38a7e94d3f53b950a456a905bb8858590af02006e2e78be"
|
||||
checksum = "3012f2dbcc79e8e0b5825a4836a7106a75dd9b2fe42c528163be0f572538c705"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bitflags",
|
||||
|
@ -2110,9 +2184,9 @@ checksum = "9145ac0af1d93c638c98c40cf7d25665f427b2a44ad0a99b1dccf3e2f25bb987"
|
|||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
|
||||
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
@ -2327,18 +2401,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.133"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a"
|
||||
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.133"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537"
|
||||
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2347,9 +2421,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.74"
|
||||
version = "1.0.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
|
||||
checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -2358,9 +2432,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
|
||||
checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770"
|
||||
dependencies = [
|
||||
"sha1_smol",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1_smol"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
|
@ -2493,9 +2576,9 @@ checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.85"
|
||||
version = "1.0.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
|
||||
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2533,9 +2616,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
|
||||
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
@ -2595,9 +2678,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.5"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d81bfa81424cc98cb034b837c985b7a290f592e5b4322f353f94a0ab0f9f594"
|
||||
checksum = "5312f325fe3588e277415f5a6cca1f4ccad0f248c4cd5a4bd33032d7286abc22"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"lazy_static",
|
||||
|
@ -2688,9 +2771,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
|
||||
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
|
@ -2698,9 +2781,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b"
|
||||
checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
|
@ -2713,9 +2796,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.28"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39"
|
||||
checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"js-sys",
|
||||
|
@ -2725,9 +2808,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
|
||||
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
@ -2735,9 +2818,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
|
||||
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2748,15 +2831,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"
|
||||
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.55"
|
||||
version = "0.3.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
|
||||
checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -2808,9 +2891,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "0.12.2"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92e33cb9c380dd1166f316dfc511ad9646f72cf2deb47e90bd714db3617a6998"
|
||||
checksum = "93b1a9400e8d7f32dd4dd909bb9a391015d70633d639775ddd3f14d1104bc970"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ash",
|
||||
|
@ -2855,9 +2938,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wide"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "476da2f1d225632b1fffe638ff979a4bc03907e29b0ab596efca7624014f8b62"
|
||||
checksum = "b3aba2d1dac31ac7cae82847ac5b8be822aee8f99a4e100f279605016b185c5f"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"safe_arch",
|
||||
|
|
24
Cargo.toml
24
Cargo.toml
|
@ -3,10 +3,11 @@ name = "cyber_rider"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[dependencies]
|
||||
rand = "0.8"
|
||||
|
||||
[dependencies.bevy]
|
||||
path = "../bevy/"
|
||||
version = "0.6"
|
||||
default-features = false
|
||||
features = [
|
||||
"bevy_gilrs",
|
||||
|
@ -18,20 +19,17 @@ features = [
|
|||
]
|
||||
|
||||
[dependencies.heron]
|
||||
path = "../heron/"
|
||||
version = "1.1"
|
||||
features = ["3d"]
|
||||
|
||||
[patch.crates-io]
|
||||
bevy = { path = "../bevy/" }
|
||||
heron = { path = "../heron/" }
|
||||
|
||||
[patch."https://github.com/bevyengine/bevy"]
|
||||
bevy = { path = "../bevy/" }
|
||||
|
||||
# Enable optimizations for dependencies (incl. Bevy), but not for our code:
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 3
|
||||
# until this is on crates.io
|
||||
[dependencies.bevy_polyline]
|
||||
path = "../bevy_polyline"
|
||||
|
||||
# Maybe also enable only a small amount of optimization for our code:
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
||||
# Enable optimizations for dependencies (incl. Bevy), but not for our code:
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 3
|
||||
|
|
|
@ -24,8 +24,8 @@ fn follow_cyberbike(
|
|||
let bike_xform = bike_query.single();
|
||||
let up = bike_xform.translation.normalize();
|
||||
|
||||
let look_at = bike_xform.translation + (bike_xform.forward() * CAM_DIST);
|
||||
let cam_pos = bike_xform.translation + (bike_xform.back() * CAM_DIST * 1.5) + (up * CAM_DIST);
|
||||
let look_at = bike_xform.translation + (bike_xform.forward() * 200.0);
|
||||
let cam_pos = bike_xform.translation + (bike_xform.back() * 2.7) + (up * 2.4);
|
||||
|
||||
let mut cam_xform = cam_query.single_mut();
|
||||
cam_xform.translation = cam_pos;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use bevy::prelude::*;
|
||||
use heron::prelude::{CollisionShape, RigidBody};
|
||||
|
||||
pub const PLANET_RADIUS: f32 = 350.0;
|
||||
use crate::Label;
|
||||
|
||||
pub const PLANET_RADIUS: f32 = 360.0;
|
||||
pub(crate) const SPAWN_ALTITUDE: f32 = PLANET_RADIUS + 100.0;
|
||||
|
||||
#[derive(Component, Debug)]
|
||||
|
@ -19,7 +21,7 @@ fn spawn_giant_sphere(
|
|||
.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::Icosphere {
|
||||
radius: PLANET_RADIUS,
|
||||
subdivisions: 8,
|
||||
subdivisions: 32,
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::GRAY,
|
||||
|
@ -53,8 +55,8 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
})
|
||||
.insert(CyberBike)
|
||||
.insert(RigidBody::Dynamic)
|
||||
.insert(CollisionShape::Cone {
|
||||
half_height: 2.0,
|
||||
.insert(CollisionShape::Capsule {
|
||||
half_segment: 2.0,
|
||||
radius: 0.8,
|
||||
})
|
||||
.insert(CyberBikeState::default());
|
||||
|
@ -63,7 +65,7 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
pub struct CyberGeomPlugin;
|
||||
impl Plugin for CyberGeomPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_startup_system(spawn_giant_sphere)
|
||||
.add_startup_system(spawn_cyberbike);
|
||||
app.add_startup_system(spawn_giant_sphere.label(Label::Geometry))
|
||||
.add_startup_system(spawn_cyberbike.label(Label::Geometry));
|
||||
}
|
||||
}
|
||||
|
|
86
src/glamor.rs
Normal file
86
src/glamor.rs
Normal file
|
@ -0,0 +1,86 @@
|
|||
use bevy::{
|
||||
pbr::wireframe::{Wireframe, WireframeConfig, WireframePlugin},
|
||||
prelude::*,
|
||||
render::{
|
||||
mesh::{Indices, VertexAttributeValues},
|
||||
options::WgpuOptions,
|
||||
render_resource::WgpuFeatures,
|
||||
},
|
||||
};
|
||||
use bevy_polyline::{Polyline, PolylineBundle, PolylineMaterial, PolylinePlugin};
|
||||
use rand::{thread_rng, Rng};
|
||||
|
||||
use crate::{geometry::CyberSphere, lights::AnimateCyberLightWireframe};
|
||||
|
||||
fn wireframe_planet(
|
||||
mut commands: Commands,
|
||||
meshes: Res<Assets<Mesh>>,
|
||||
mut polylines: ResMut<Assets<Polyline>>,
|
||||
mut polymats: ResMut<Assets<PolylineMaterial>>,
|
||||
query: Query<&Handle<Mesh>, With<CyberSphere>>,
|
||||
) {
|
||||
let handle = query.single();
|
||||
let mesh = meshes.get(handle).unwrap();
|
||||
let vertices = mesh.attribute(Mesh::ATTRIBUTE_POSITION).unwrap();
|
||||
|
||||
let mut pts = Vec::with_capacity(vertices.len());
|
||||
|
||||
if let VertexAttributeValues::Float32x3(verts) = vertices {
|
||||
let indices = mesh.indices().unwrap();
|
||||
if let Indices::U32(indices) = indices {
|
||||
for i in indices.iter() {
|
||||
let v = verts[*i as usize];
|
||||
let v = Vec3::from_slice(&v);
|
||||
pts.push(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !pts.is_empty() {
|
||||
commands.spawn_bundle(PolylineBundle {
|
||||
polyline: polylines.add(Polyline { vertices: pts }),
|
||||
material: polymats.add(PolylineMaterial {
|
||||
width: 6.0,
|
||||
color: Color::hsla(292.0, 1.0, 0.60, 1.0),
|
||||
perspective: false,
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn wireframify_lights(
|
||||
mut commands: Commands,
|
||||
no_wires: Query<Entity, (With<AnimateCyberLightWireframe>, Without<Wireframe>)>,
|
||||
wires: Query<Entity, (With<AnimateCyberLightWireframe>, With<Wireframe>)>,
|
||||
) {
|
||||
let chance = 0.005;
|
||||
|
||||
let rng = &mut thread_rng();
|
||||
for e in no_wires.iter() {
|
||||
if rng.gen::<f32>() < chance {
|
||||
commands.entity(e).insert(Wireframe);
|
||||
}
|
||||
}
|
||||
for e in wires.iter() {
|
||||
if rng.gen::<f32>() < chance {
|
||||
commands.entity(e).remove::<Wireframe>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// public plugin
|
||||
pub struct CyberGlamorPlugin;
|
||||
impl Plugin for CyberGlamorPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.insert_resource(WgpuOptions {
|
||||
features: WgpuFeatures::POLYGON_MODE_LINE,
|
||||
..Default::default()
|
||||
})
|
||||
.insert_resource(WireframeConfig { global: false })
|
||||
.add_startup_system_to_stage(StartupStage::PostStartup, wireframe_planet)
|
||||
.add_system(wireframify_lights)
|
||||
.add_plugin(PolylinePlugin)
|
||||
.add_plugin(WireframePlugin);
|
||||
}
|
||||
}
|
36
src/lib.rs
36
src/lib.rs
|
@ -1,14 +1,46 @@
|
|||
use bevy::prelude::{ResMut, Windows};
|
||||
use bevy::{
|
||||
ecs::schedule::StageLabel,
|
||||
prelude::{ResMut, SystemLabel, Vec3, Windows},
|
||||
};
|
||||
|
||||
pub mod action;
|
||||
pub mod camera;
|
||||
pub mod geometry;
|
||||
pub mod glamor;
|
||||
pub mod input;
|
||||
pub mod lights;
|
||||
pub mod action;
|
||||
pub mod ui;
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, SystemLabel, StageLabel)]
|
||||
pub enum Label {
|
||||
Geometry,
|
||||
Glamor,
|
||||
Input,
|
||||
Action,
|
||||
}
|
||||
|
||||
pub fn disable_mouse_trap(mut windows: ResMut<Windows>) {
|
||||
let window = windows.get_primary_mut().unwrap();
|
||||
window.set_cursor_lock_mode(false);
|
||||
window.set_cursor_visibility(true);
|
||||
}
|
||||
|
||||
pub fn random_unit_vec(r: &mut impl rand::prelude::Rng) -> Vec3 {
|
||||
// https://mathworld.wolfram.com/SpherePointPicking.html
|
||||
// Marsaglia (1972) for picking x1 and x2 from (-1, 1) and generating surface
|
||||
// points directly if their sum is less than 1.
|
||||
|
||||
let mut x1: f32 = 0.0;
|
||||
let mut x2: f32 = 0.0;
|
||||
let mut ssum = std::f32::MAX;
|
||||
while ssum >= 1.0 {
|
||||
x1 = r.gen_range(-1.0..=1.0);
|
||||
x2 = r.gen_range(-1.0..=1.0);
|
||||
ssum = x1.powi(2) + x2.powi(2);
|
||||
}
|
||||
let sqrt = (1.0 - ssum).sqrt();
|
||||
let x = 2.0 * x1 * sqrt;
|
||||
let y = 2.0 * x2 * sqrt;
|
||||
let z = 1.0 - 2.0 * ssum;
|
||||
Vec3::new(x, y, z).normalize()
|
||||
}
|
||||
|
|
272
src/lights.rs
272
src/lights.rs
|
@ -1,23 +1,104 @@
|
|||
use std::f32::consts::TAU;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use rand::prelude::*;
|
||||
|
||||
use crate::geometry::PLANET_RADIUS;
|
||||
|
||||
pub const LIGHT_RANGE: f32 = PLANET_RADIUS * 0.6;
|
||||
pub const LIGHT_DIST: f32 = PLANET_RADIUS * 1.2;
|
||||
pub const LIGHT_RANGE: f32 = 50.0;
|
||||
|
||||
#[derive(Component)]
|
||||
struct Animate;
|
||||
struct AnimatedCyberLight {
|
||||
axis: Vec3,
|
||||
rate: f32,
|
||||
}
|
||||
|
||||
fn spawn_lights(
|
||||
#[derive(Component)]
|
||||
pub(crate) struct AnimateCyberLightWireframe;
|
||||
|
||||
fn spawn_moving_lights(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
let red_light = PointLight {
|
||||
intensity: 1_000.0,
|
||||
let rng = &mut thread_rng();
|
||||
// spawn orbiting bisexual lights
|
||||
for _ in 0..511 {
|
||||
// mechanics
|
||||
let axis = crate::random_unit_vec(rng);
|
||||
let angle = rng.gen_range(0.0..TAU);
|
||||
let rate: f32 = rng.gen_range(7.0..10.0);
|
||||
let rate = rate.to_radians();
|
||||
let rotation = Quat::from_axis_angle(axis, angle);
|
||||
let altitude = PLANET_RADIUS + rng.gen_range(8.0..20.0);
|
||||
let perp = axis.any_orthonormal_vector();
|
||||
let translation = perp * altitude;
|
||||
let transform = Transform::from_translation(translation);
|
||||
|
||||
// optics
|
||||
let hue = rng.gen_range(240.0..300.0);
|
||||
let saturation = rng.gen_range(0.85..0.99);
|
||||
let lightness = rng.gen_range(0.3..0.7);
|
||||
let color = Color::hsl(hue, saturation, lightness);
|
||||
let intensity = rng.gen_range(500.0..900.0);
|
||||
let radius = rng.gen::<f32>() * 2.2; // why can't this infer the gen type?
|
||||
let point_light = PointLight {
|
||||
intensity,
|
||||
range: LIGHT_RANGE,
|
||||
color,
|
||||
radius: radius - 0.1,
|
||||
shadows_enabled: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
commands
|
||||
// first, spawn an entity with a transform we can rotate
|
||||
.spawn_bundle((
|
||||
AnimatedCyberLight { axis, rate },
|
||||
Transform::from_rotation(rotation),
|
||||
GlobalTransform::default(),
|
||||
))
|
||||
.with_children(|parent| {
|
||||
parent
|
||||
// now spawn a child entity with a pointlight, and a relative transform that's
|
||||
// just translation from the parent
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform,
|
||||
point_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
builder
|
||||
// now a simple mesh to show a wireframe.
|
||||
.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::Icosphere {
|
||||
radius,
|
||||
subdivisions: 1,
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::hsla(272.0, 0.7, 0.56, 0.7),
|
||||
emissive: color,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
})
|
||||
.insert(AnimateCyberLightWireframe);
|
||||
}); // mesh child
|
||||
}); // light child
|
||||
}
|
||||
}
|
||||
|
||||
fn spawn_static_lights(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
let pink_light = PointLight {
|
||||
intensity: 1_00.0,
|
||||
range: LIGHT_RANGE,
|
||||
color: Color::RED,
|
||||
color: Color::PINK,
|
||||
radius: 1.0,
|
||||
shadows_enabled: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -26,14 +107,7 @@ fn spawn_lights(
|
|||
range: LIGHT_RANGE,
|
||||
color: Color::BLUE,
|
||||
radius: 1.0,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let purple_light = PointLight {
|
||||
intensity: 1_000.0,
|
||||
range: LIGHT_RANGE,
|
||||
color: Color::PURPLE,
|
||||
radius: 1.0,
|
||||
shadows_enabled: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -42,121 +116,11 @@ fn spawn_lights(
|
|||
brightness: 0.32,
|
||||
});
|
||||
|
||||
// east light
|
||||
commands
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform: Transform::from_xyz(LIGHT_DIST, 0.0, 0.0),
|
||||
point_light: purple_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
builder.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::UVSphere {
|
||||
radius: 10.0,
|
||||
..Default::default()
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::PURPLE,
|
||||
emissive: Color::rgba_linear(50.0, 0.0, 50.0, 0.0),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
})
|
||||
.insert(Animate);
|
||||
|
||||
// west light
|
||||
commands
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform: Transform::from_xyz(-LIGHT_DIST, 0.0, 0.0),
|
||||
point_light: purple_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
builder.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::UVSphere {
|
||||
radius: 10.0,
|
||||
..Default::default()
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::PURPLE,
|
||||
emissive: Color::rgba_linear(50.0, 0.0, 50.0, 0.0),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
})
|
||||
.insert(Animate);
|
||||
// north light
|
||||
commands
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform: Transform::from_xyz(0.0, 0.0, LIGHT_DIST),
|
||||
point_light: purple_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
builder.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::UVSphere {
|
||||
radius: 10.0,
|
||||
..Default::default()
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::PURPLE,
|
||||
emissive: Color::rgba_linear(50.0, 0.0, 50.0, 0.0),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
})
|
||||
.insert(Animate);
|
||||
// south light
|
||||
commands
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform: Transform::from_xyz(0.0, 0.0, -LIGHT_DIST),
|
||||
point_light: purple_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
builder.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::UVSphere {
|
||||
radius: 10.0,
|
||||
..Default::default()
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::PURPLE,
|
||||
emissive: Color::rgba_linear(50.0, 0.0, 50.0, 0.0),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
})
|
||||
.insert(Animate);
|
||||
// up light
|
||||
commands
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform: Transform::from_xyz(0.0, LIGHT_DIST, 0.0),
|
||||
point_light: red_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
builder.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::Icosphere {
|
||||
radius: 10.0,
|
||||
subdivisions: 2,
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::RED,
|
||||
emissive: Color::rgba_linear(100.0, 0.0, 0.0, 0.0),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
});
|
||||
// down light
|
||||
commands
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform: Transform::from_xyz(0.0, -LIGHT_DIST, 0.0),
|
||||
point_light: blue_light,
|
||||
transform: Transform::from_xyz(0.0, PLANET_RADIUS + 30.0, 0.0),
|
||||
point_light: pink_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
|
@ -167,7 +131,28 @@ fn spawn_lights(
|
|||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::BLUE,
|
||||
emissive: Color::rgba_linear(0.0, 0.0, 100.0, 0.0),
|
||||
emissive: Color::PINK,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
});
|
||||
// down light
|
||||
commands
|
||||
.spawn_bundle(PointLightBundle {
|
||||
transform: Transform::from_xyz(0.0, -PLANET_RADIUS - 30.0, 0.0),
|
||||
point_light: blue_light,
|
||||
..Default::default()
|
||||
})
|
||||
.with_children(|builder| {
|
||||
builder.spawn_bundle(PbrBundle {
|
||||
mesh: meshes.add(Mesh::from(shape::Icosphere {
|
||||
radius: 10.0,
|
||||
subdivisions: 2,
|
||||
})),
|
||||
material: materials.add(StandardMaterial {
|
||||
base_color: Color::PINK,
|
||||
emissive: Color::BLUE,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
|
@ -175,35 +160,20 @@ fn spawn_lights(
|
|||
});
|
||||
}
|
||||
|
||||
fn animate_lights(
|
||||
time: Res<Time>,
|
||||
mut query: Query<&mut Transform, (With<PointLight>, With<Animate>)>,
|
||||
) {
|
||||
fn orbit_lights(time: Res<Time>, mut query: Query<(&mut Transform, &AnimatedCyberLight)>) {
|
||||
let dt = time.delta_seconds();
|
||||
for mut transform in query.iter_mut() {
|
||||
let translation = &transform.translation;
|
||||
let x = translation.x;
|
||||
let y = translation.y;
|
||||
let z = if translation.z.abs() < 0.1 {
|
||||
translation.z + 0.15
|
||||
} else {
|
||||
translation.z
|
||||
};
|
||||
|
||||
let rads = 10.0f32.to_radians();
|
||||
let anim_rate = rads * dt;
|
||||
let theta = z.atan2(x) + anim_rate;
|
||||
let x_new = LIGHT_DIST * theta.cos();
|
||||
let z_new = LIGHT_DIST * theta.sin();
|
||||
|
||||
*transform = Transform::from_xyz(x_new, y, z_new);
|
||||
for (mut transform, light) in query.iter_mut() {
|
||||
let AnimatedCyberLight { axis, rate } = *light;
|
||||
let theta = rate * dt;
|
||||
transform.rotation *= Quat::from_axis_angle(axis, theta);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CyberSpaceLightsPlugin;
|
||||
impl Plugin for CyberSpaceLightsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_startup_system(spawn_lights)
|
||||
.add_system(animate_lights);
|
||||
app.add_startup_system(spawn_static_lights)
|
||||
.add_startup_system(spawn_moving_lights)
|
||||
.add_system(orbit_lights);
|
||||
}
|
||||
}
|
||||
|
|
13
src/main.rs
13
src/main.rs
|
@ -4,6 +4,7 @@ use cyber_rider::{
|
|||
camera::CyberCamPlugin,
|
||||
disable_mouse_trap,
|
||||
geometry::CyberGeomPlugin,
|
||||
glamor::CyberGlamorPlugin,
|
||||
input::CyberInputPlugin,
|
||||
lights::CyberSpaceLightsPlugin,
|
||||
ui::CyberUIPlugin,
|
||||
|
@ -17,10 +18,11 @@ const MOVEMENT_SETTINGS: MovementSettings = MovementSettings {
|
|||
};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.insert_resource(Msaa { samples: 4 })
|
||||
let mut app = App::new();
|
||||
app.insert_resource(Msaa { samples: 4 })
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_plugin(CyberGeomPlugin)
|
||||
.add_plugin(CyberGlamorPlugin)
|
||||
.add_plugin(CyberInputPlugin)
|
||||
.add_plugin(CyberPhysicsPlugin)
|
||||
.insert_resource(MOVEMENT_SETTINGS)
|
||||
|
@ -28,6 +30,9 @@ fn main() {
|
|||
.add_plugin(CyberSpaceLightsPlugin)
|
||||
.add_plugin(CyberUIPlugin)
|
||||
.add_startup_system(disable_mouse_trap)
|
||||
.add_system(bevy::input::system::exit_on_esc_system)
|
||||
.run();
|
||||
.add_system(bevy::input::system::exit_on_esc_system);
|
||||
|
||||
//bevy_mod_debugdump::print_schedule(&mut app);
|
||||
|
||||
app.run();
|
||||
}
|
||||
|
|
13
src/ui.rs
13
src/ui.rs
|
@ -1,6 +1,6 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
use crate::{action::CyberBikeState, geometry::PLANET_RADIUS};
|
||||
use crate::action::CyberBikeState;
|
||||
|
||||
#[derive(Component)]
|
||||
struct UpText;
|
||||
|
@ -32,17 +32,10 @@ fn setup_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
.insert(UpText);
|
||||
}
|
||||
|
||||
fn update_ui(
|
||||
state_query: Query<(&CyberBikeState, &Transform)>,
|
||||
mut text_query: Query<&mut Text, With<UpText>>,
|
||||
) {
|
||||
fn update_ui(state_query: Query<&CyberBikeState>, mut text_query: Query<&mut Text, With<UpText>>) {
|
||||
let mut text = text_query.single_mut();
|
||||
let state = state_query.single();
|
||||
text.sections[0].value = format!(
|
||||
"spd: {:.2}\nalt: {:.2}",
|
||||
state.0.velocity.length(),
|
||||
state.1.translation.length() - PLANET_RADIUS
|
||||
);
|
||||
text.sections[0].value = format!("spd: {:.2}", state.velocity.length(),);
|
||||
}
|
||||
|
||||
pub struct CyberUIPlugin;
|
||||
|
|
Loading…
Reference in a new issue