This commit is contained in:
Tobias Berger 2022-12-11 22:24:17 +01:00
parent af05c1b761
commit 6a7ecc11b6
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
10 changed files with 393 additions and 183 deletions

262
Cargo.lock generated
View file

@ -55,9 +55,9 @@ dependencies = [
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.19" version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -131,20 +131,20 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]] [[package]]
name = "ash" name = "ash"
version = "0.37.0+1.3.209" version = "0.37.1+1.3.235"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "006ca68e0f2b03f22d6fa9f2860f85aed430d257fec20f8879b2145e7c7ae1a6" checksum = "911015c962d56e2e4052f40182ca5462ba60a3d2ff04e827c365a0ab3d65726d"
dependencies = [ dependencies = [
"libloading", "libloading",
] ]
[[package]] [[package]]
name = "async-channel" name = "async-channel"
version = "1.7.1" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
dependencies = [ dependencies = [
"concurrent-queue 1.2.4", "concurrent-queue 2.0.0",
"event-listener", "event-listener",
"futures-core", "futures-core",
] ]
@ -199,18 +199,18 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]] [[package]]
name = "bevy" name = "bevy"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3654d60973fcde065efcfe0c9066c81a76987d28c45233998b2ccdc581dcd914" checksum = "dae99b246505811f5bc19d2de1e406ec5d2816b421d58fa223779eb576f472c9"
dependencies = [ dependencies = [
"bevy_internal", "bevy_internal",
] ]
[[package]] [[package]]
name = "bevy_app" name = "bevy_app"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7240e455d6976b20d24bf8eda37cd9154116fe9cc2beef7bdc009b4c6fff139" checksum = "536e4d0018347478545ed8b6cb6e57b9279ee984868e81b7c0e78e0fb3222e42"
dependencies = [ dependencies = [
"bevy_derive", "bevy_derive",
"bevy_ecs", "bevy_ecs",
@ -223,9 +223,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_asset" name = "bevy_asset"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ca05c472cd4939aed5b2980ad9b416a250ae4674824e8c4b569ddf18ab5230" checksum = "6db1bb550168304df69c867c09125e1aae7ff51cf21575396e1598bf293442c4"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bevy_app", "bevy_app",
@ -250,9 +250,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_core" name = "bevy_core"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d344ff340874fb3f1e458f03eca2b731cb8174495e9c0828f5e4569765489cb" checksum = "96299aceb3c8362cb4aa39ff81c7ef758a5f4e768d16b5046a91628eff114ac0"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_ecs", "bevy_ecs",
@ -265,9 +265,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_core_pipeline" name = "bevy_core_pipeline"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13523e290f9aad62987e04836d66819fb97afeaf794847b6f64121c62a4db916" checksum = "dc128a9860aadf16fb343ae427f2768986fd91dce64d945455acda9759c48014"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_asset", "bevy_asset",
@ -285,9 +285,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_derive" name = "bevy_derive"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12e50d2ff8423438e971c44a90baefc9e351edd45b50b8d077f9ad4f7a0a2a5" checksum = "7baf73c58d41c353c6fd08e6764a2e7420c9f19e8227b391c50981db6d0282a6"
dependencies = [ dependencies = [
"bevy_macro_utils", "bevy_macro_utils",
"quote", "quote",
@ -296,9 +296,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_diagnostic" name = "bevy_diagnostic"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3415f3a220d8706daac84986d744374fd18883add3a22e894af8cddf2cf1c29" checksum = "63bf96ec7980fa25b77ff6c72dfafada477936c0dab76c1edf6c028c0e5fe0e4"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_core", "bevy_core",
@ -310,9 +310,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_ecs" name = "bevy_ecs"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b29e39772df5e8939f7f540ee152569eebeb3c2cc35a68670688ae008ba2cf" checksum = "d4c071d7c6bc9801253485e05d0c257284150de755391902746837ba21c0cf74"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"bevy_ecs_macros", "bevy_ecs_macros",
@ -330,9 +330,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_ecs_macros" name = "bevy_ecs_macros"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10b8e7e7fb3ab9554c77e0f8a2531abd05d40ddb0145a8dfa72434cefa52ee5c" checksum = "c15bd45438eeb681ad74f2d205bb07a5699f98f9524462a30ec764afab2742ce"
dependencies = [ dependencies = [
"bevy_macro_utils", "bevy_macro_utils",
"proc-macro2", "proc-macro2",
@ -342,9 +342,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_egui" name = "bevy_egui"
version = "0.17.0" version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33bf9a0085909f3dc3d5ca7be6a6e6792b8b30b98bba9cca13baa49e2f3e3206" checksum = "1cec5fb091ccae94917266fe9b1af8339ef1e47763360b38273a31457598b030"
dependencies = [ dependencies = [
"arboard", "arboard",
"bevy", "bevy",
@ -354,9 +354,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_encase_derive" name = "bevy_encase_derive"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a0773119830d63dde225338c0c556f84cd68e8e69de5b62a1b172fdddc5b915" checksum = "962b6bb0d30e92ec2e6c29837acce9e55b920733a634e7c3c5fd5a514bea7a24"
dependencies = [ dependencies = [
"bevy_macro_utils", "bevy_macro_utils",
"encase_derive_impl", "encase_derive_impl",
@ -364,9 +364,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_gltf" name = "bevy_gltf"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd77158983e09cbbb8115a2c629bdf3249cfff58e8e19f1c62861b1e5495eaf1" checksum = "e853e346ba412354e02292c7aa5b9a9dccdfa748e273b1b7ebf8f6a172f89712"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
@ -392,9 +392,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_hierarchy" name = "bevy_hierarchy"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b5181dc3d621c3d18a1209791e82199409d6ddf5376ee19f2e26ad7bfd9b06" checksum = "8dd6d50c48c6e1bcb5e08a768b765323292bb3bf3a439b992754c57ffb85b23a"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_core", "bevy_core",
@ -407,9 +407,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_input" name = "bevy_input"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f72c3037535eb41b863a22c2e58d3845a096401f9b92204b6a240e36a5151b" checksum = "3378b5171284f4c4c0e8307081718a9fe458f846444616bd82d69110dcabca51"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_ecs", "bevy_ecs",
@ -421,9 +421,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_internal" name = "bevy_internal"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ff89c2c2644c588d72cf505f15ad515479705c82ad7aa359ad2249646995a76" checksum = "4c46014b7e885b1311de06b6039e448454a4db55b8d35464798ba88faa186e11"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_asset", "bevy_asset",
@ -455,9 +455,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_log" name = "bevy_log"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66c1d5f2cbcf5c3ce87d42afb6ba98177f8f758278364cbc79a2b3bf38415f0e" checksum = "6c480bac54cf4ae76edc3ae9ae3fa7c5e1b385e7f2111ef5ec3fd00cf3a7998b"
dependencies = [ dependencies = [
"android_log-sys", "android_log-sys",
"bevy_app", "bevy_app",
@ -471,9 +471,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_macro_utils" name = "bevy_macro_utils"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "656fa7b3434ac5d5c2883dde3c075f834ff51178f2f48ef2454b6f2ada75cb15" checksum = "022bb69196deeea691b6997414af85bbd7f2b34a8914c4aa7a7ff4dfa44f7677"
dependencies = [ dependencies = [
"quote", "quote",
"syn", "syn",
@ -482,9 +482,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_math" name = "bevy_math"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b26459575a5f9695788e3487aa0a5f9252562e0fc57065e6f35f370dbfac7d4a" checksum = "d434c77ab766c806ed9062ef8a7285b3b02b47df51f188d4496199c3ac062eaf"
dependencies = [ dependencies = [
"glam", "glam",
"serde", "serde",
@ -492,18 +492,18 @@ dependencies = [
[[package]] [[package]]
name = "bevy_mikktspace" name = "bevy_mikktspace"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e67d9caff1be480eb097e1a5ee7332762e19a2ea3d07496017fc8221ea6bc46" checksum = "bbfb5908d33fd613069be516180b8f138aaaf6e41c36b1fd98c6c29c00c24a13"
dependencies = [ dependencies = [
"glam", "glam",
] ]
[[package]] [[package]]
name = "bevy_pbr" name = "bevy_pbr"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a2e5069b351743e5660f837671135a7aac585cd2c1d7d0b90d92a2d84c2a1fd" checksum = "310b1f260a475d81445623e138e1b7245759a42310bc1f84b550a3f4ff8763bf"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_asset", "bevy_asset",
@ -523,15 +523,15 @@ dependencies = [
[[package]] [[package]]
name = "bevy_ptr" name = "bevy_ptr"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36f4d3af0cda50c07e2010d0351ab79594681116edd280592ca394db73ef32b" checksum = "8ec44f7655039546bc5d34d98de877083473f3e9b2b81d560c528d6d74d3eff4"
[[package]] [[package]]
name = "bevy_reflect" name = "bevy_reflect"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c39f74d7786a0016c74b6bfb57f44928d536bef8bf6db7505d4cbe9435aeda7b" checksum = "6deae303a7f69dc243b2fa35b5e193cc920229f448942080c8eb2dbd9de6d37a"
dependencies = [ dependencies = [
"bevy_math", "bevy_math",
"bevy_ptr", "bevy_ptr",
@ -549,9 +549,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_reflect_derive" name = "bevy_reflect_derive"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b2c0aab36b060e88cd93c56710d9ce8ab6107596dc4cbb8a9d84ba98f39c63b" checksum = "a2bf4cb9cd5acb4193f890f36cb63679f1502e2de025e66a63b194b8b133d018"
dependencies = [ dependencies = [
"bevy_macro_utils", "bevy_macro_utils",
"bit-set", "bit-set",
@ -563,9 +563,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_render" name = "bevy_render"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14033813fdd9587663ffa6b6d84327f30bd0398b40386677704bd4d608625420" checksum = "2e3282a8f8779d2aced93207fbed73f740937c6c2bd27bd84f0799b081c7fca5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bevy_app", "bevy_app",
@ -605,9 +605,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_render_macros" name = "bevy_render_macros"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e29db44fb38743a08e71bed324a19b8ce2e9f2853abcb4640e03625dd55cc186" checksum = "b7acae697776ac05bea523e1725cf2660c91c53abe72c66782ea1e1b9eedb572"
dependencies = [ dependencies = [
"bevy_macro_utils", "bevy_macro_utils",
"proc-macro2", "proc-macro2",
@ -617,9 +617,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_scene" name = "bevy_scene"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b98c58cba6417961856a57ba1116d78db3364b8e791ac517175f04b9abdb6b" checksum = "ea9c66a628c833d53bae54fe94cbc0d3f12c29e9d2e6c3f2356d45ad57db0c8c"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bevy_app", "bevy_app",
@ -639,9 +639,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_sprite" name = "bevy_sprite"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b135b2ccf7c5eaf9b3e20e39ef80081842f122081c8ce988cb2054afd1af270e" checksum = "5ec01c7db7f698d95bcb70708527c3ae6bcdc78fc247abe74f935cae8f0a1145"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_asset", "bevy_asset",
@ -664,9 +664,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_tasks" name = "bevy_tasks"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5d91d94d2db1476d7452509c1967fe83d66da5f683f5d49ba31e0f455adfcdc" checksum = "680b16b53df9c9f24681dd95f4d772d83760bd19adf8bca00f358a3aad997853"
dependencies = [ dependencies = [
"async-channel", "async-channel",
"async-executor", "async-executor",
@ -679,9 +679,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_text" name = "bevy_text"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4282d77fb5dd38bb2a7736a770f5e499782b8c546b9f7d73f6893ab04c8041" checksum = "60c74c1bdaabde7db28f6728aa13bc7b1d744a2201b2bbfd83d2224404c57f5c"
dependencies = [ dependencies = [
"ab_glyph", "ab_glyph",
"anyhow", "anyhow",
@ -702,9 +702,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_time" name = "bevy_time"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a259a4b04f5ae2d02998247a69e5a711b0754eb22971320bf727c6f4d7bf38fa" checksum = "1a5c38a6d3ea929c7f81e6adf5a6c62cf7e8c40f5106c2174d6057e9d8ea624d"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_ecs", "bevy_ecs",
@ -715,9 +715,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_transform" name = "bevy_transform"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7b4cdac87f8a58c3ec166b5673dd35565c61eb0ec648e3b0cc30083170c0fb3" checksum = "ba13c57a040b89767191a6f6d720a635b7792793628bfa41a9e38b7026484aec"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_ecs", "bevy_ecs",
@ -728,9 +728,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_ui" name = "bevy_ui"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da6d85fcefe5a2bf259c2ff58a7a29b6102070242dc385b42a2656f4e8918883" checksum = "60e82ace6156f11fcdf2319102ff8fb8367b82d1e32b7d05d387a1963602f965"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_asset", "bevy_asset",
@ -757,9 +757,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_utils" name = "bevy_utils"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7473635355a99fcf7181091a2ac11df03561706b1696cb0cc72e4ddd010571" checksum = "16750aae52cd35bd7b60eb61cee883420b250e11b4a290b8d44b2b2941795739"
dependencies = [ dependencies = [
"ahash 0.7.6", "ahash 0.7.6",
"getrandom", "getrandom",
@ -771,9 +771,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_window" name = "bevy_window"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07a0d03022a6d1ec0d05c01a77f5592a9602bbc1cfc11ba457788b69f9ca175d" checksum = "0a44d3f3bd54a2261f4f57f614bf7bccc8d2832761493c0cd7dab81d98cc151e"
dependencies = [ dependencies = [
"bevy_app", "bevy_app",
"bevy_ecs", "bevy_ecs",
@ -786,9 +786,9 @@ dependencies = [
[[package]] [[package]]
name = "bevy_winit" name = "bevy_winit"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc7b4e4f83e268dcbd6f9c4e1c18f7382e457f5f1b160da4c85d9a3f489771a" checksum = "c7b7e647ecd0b3577468da37767dcdd7c26ca9f80da0060b2ec4c77336b6d2e1"
dependencies = [ dependencies = [
"approx", "approx",
"bevy_app", "bevy_app",
@ -871,12 +871,12 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]] [[package]]
name = "calloop" name = "calloop"
version = "0.10.2" version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "595eb0438b3c6d262395fe30e6de9a61beb57ea56290b00a07f227fe6e20cbf2" checksum = "5bcf530afb40e45e14440701e5e996d7fd139e84a912a4d83a8d6a0fb3e58663"
dependencies = [ dependencies = [
"log", "log",
"nix 0.24.2", "nix 0.25.1",
"slotmap", "slotmap",
"thiserror", "thiserror",
"vec_map", "vec_map",
@ -884,9 +884,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.76" version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -911,12 +911,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "cobs"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15"
[[package]] [[package]]
name = "cocoa" name = "cocoa"
version = "0.24.1" version = "0.24.1"
@ -994,9 +988,9 @@ dependencies = [
[[package]] [[package]]
name = "const_panic" name = "const_panic"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed2b28323eee4fb66bb824401daa3e46bd445b9a9298a3d382b320710ba69dd" checksum = "58baae561b85ca19b3122a9ddd35c8ec40c3bcd14fe89921824eae73f7baffbf"
[[package]] [[package]]
name = "core-foundation" name = "core-foundation"
@ -1060,9 +1054,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.12" version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
@ -1562,9 +1556,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.1" version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
@ -1634,9 +1628,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.137" version = "0.2.138"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -1834,9 +1828,9 @@ dependencies = [
[[package]] [[package]]
name = "ndk-sys" name = "ndk-sys"
version = "0.4.0" version = "0.4.1+23.1.7779620"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21d83ec9c63ec5bf950200a8e508bdad6659972187b625469f58ef8c08e29046" checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3"
dependencies = [ dependencies = [
"jni-sys", "jni-sys",
] ]
@ -1856,9 +1850,9 @@ dependencies = [
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.24.2" version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if", "cfg-if",
@ -1866,6 +1860,19 @@ dependencies = [
"memoffset", "memoffset",
] ]
[[package]]
name = "nix"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
dependencies = [
"autocfg",
"bitflags",
"cfg-if",
"libc",
"memoffset",
]
[[package]] [[package]]
name = "nohash-hasher" name = "nohash-hasher"
version = "0.2.0" version = "0.2.0"
@ -2043,9 +2050,9 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.9.4" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@ -2088,7 +2095,6 @@ version = "0.3.1"
dependencies = [ dependencies = [
"bevy", "bevy",
"crossbeam-channel", "crossbeam-channel",
"postcard",
"rand", "rand",
"serde", "serde",
] ]
@ -2105,16 +2111,6 @@ dependencies = [
"miniz_oxide 0.3.7", "miniz_oxide 0.3.7",
] ]
[[package]]
name = "postcard"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c2b180dc0bade59f03fd005cb967d3f1e5f69b13922dad0cd6e047cb8af2363"
dependencies = [
"cobs",
"serde",
]
[[package]] [[package]]
name = "pp-rs" name = "pp-rs"
version = "0.2.1" version = "0.2.1"
@ -2309,18 +2305,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2329,9 +2325,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.87" version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -2386,7 +2382,7 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"memmap2", "memmap2",
"nix 0.24.2", "nix 0.24.3",
"pkg-config", "pkg-config",
"wayland-client", "wayland-client",
"wayland-cursor", "wayland-cursor",
@ -2429,9 +2425,9 @@ checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.103" version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2624,9 +2620,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.2.1" version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"serde", "serde",
@ -2737,7 +2733,7 @@ dependencies = [
"bitflags", "bitflags",
"downcast-rs", "downcast-rs",
"libc", "libc",
"nix 0.24.2", "nix 0.24.3",
"scoped-tls", "scoped-tls",
"wayland-commons", "wayland-commons",
"wayland-scanner", "wayland-scanner",
@ -2750,7 +2746,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
dependencies = [ dependencies = [
"nix 0.24.2", "nix 0.24.3",
"once_cell", "once_cell",
"smallvec", "smallvec",
"wayland-sys", "wayland-sys",
@ -2762,7 +2758,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
dependencies = [ dependencies = [
"nix 0.24.2", "nix 0.24.3",
"wayland-client", "wayland-client",
"xcursor", "xcursor",
] ]
@ -2818,9 +2814,9 @@ checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.14.0" version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2272b17bffc8a0c7d53897435da7c1db587c87d3a14e8dae9cdb8d1d210fc0f" checksum = "81f643110d228fd62a60c5ed2ab56c4d5b3704520bd50561174ec4ec74932937"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"js-sys", "js-sys",
@ -2840,9 +2836,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.14.0" version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73d14cad393054caf992ee02b7da6a372245d39a484f7461c1f44f6f6359bd28" checksum = "6000d1284ef8eec6076fd5544a73125fd7eb9b635f18dceeb829d826f41724ca"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
@ -3097,9 +3093,9 @@ dependencies = [
[[package]] [[package]]
name = "x11-dl" name = "x11-dl"
version = "2.20.0" version = "2.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c83627bc137605acc00bb399c7b908ef460b621fc37c953db2b09f88c449ea6" checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"libc", "libc",

View file

@ -35,7 +35,7 @@ path = "planet"
default-features = false default-features = false
[dependencies.bevy] [dependencies.bevy]
version = "0.9.0" version = "0.9"
default-features = false default-features = false
[dependencies.fxhash] [dependencies.fxhash]

View file

@ -23,11 +23,6 @@ version = "1.0"
default-features = false default-features = false
features = ["derive"] features = ["derive"]
[dependencies.postcard]
version = "1.0.2"
default-features = false
features = ["use-std"]
[dependencies.crossbeam-channel] [dependencies.crossbeam-channel]
version = "0.5.6" version = "0.5.6"
default-features = false default-features = false

View file

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct HumanGroup { pub struct HumanGroup {
pub id: u32, pub id: u32,
pub population: u32, pub population: u32,

View file

@ -1,6 +1,9 @@
pub mod human_group; pub mod human_group;
pub use human_group::HumanGroup;
pub mod terrain_cell;
pub use terrain_cell::TerrainCell;
pub mod world; pub mod world;
pub use world::{TerrainCell, World, WorldGenError}; pub use world::{World, WorldGenError};
pub mod biome; pub mod biome;
pub use biome::{BiomeStats, BiomeType}; pub use biome::{BiomeStats, BiomeType};
pub mod world_manager; pub mod world_manager;

View file

@ -1,3 +1,5 @@
pub const MAX_PERMUTATION_VALUE: u32 = 16777216;
const PERMUTATION: [u8; 512] = [ const PERMUTATION: [u8; 512] = [
151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69,
142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219,

View file

@ -0,0 +1,148 @@
use {
crate::TerrainCell,
bevy::prelude::default,
serde::{
de::{Error, MapAccess, SeqAccess, Visitor},
Deserialize,
},
std::{
fmt::{self, Formatter},
sync::Weak,
},
};
impl<'de> Deserialize<'de> for TerrainCell {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
#[derive(Deserialize)]
#[serde(field_identifier, rename_all = "snake_case")]
enum Field {
Altitude,
Rainfall,
Temperature,
LocalIteration,
BiomePresences,
}
struct TerrainCellVisitor;
impl<'de> Visitor<'de> for TerrainCellVisitor {
type Value = TerrainCell;
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("struct TerrainCell")
}
fn visit_seq<V>(self, mut seq: V) -> Result<Self::Value, V::Error>
where
V: SeqAccess<'de>,
{
let altitude = seq
.next_element()?
.ok_or_else(|| Error::invalid_length(0, &self))?;
let rainfall = seq
.next_element()?
.ok_or_else(|| Error::invalid_length(1, &self))?;
let temperature = seq
.next_element()?
.ok_or_else(|| Error::invalid_length(2, &self))?;
let local_iteration = seq
.next_element()?
.ok_or_else(|| Error::invalid_length(3, &self))?;
let biome_presences = seq
.next_element()?
.ok_or_else(|| Error::invalid_length(4, &self))?;
Ok(TerrainCell {
altitude,
rainfall,
temperature,
local_iteration,
biome_presences,
x: default(),
y: default(),
})
}
fn visit_map<V>(self, mut map: V) -> Result<Self::Value, V::Error>
where
V: MapAccess<'de>,
{
let mut altitude = None;
let mut rainfall = None;
let mut temperature = None;
let mut local_iteration = None;
let mut biome_presences = None;
while let Some(key) = map.next_key()? {
match key {
Field::Altitude => {
if altitude.is_some() {
return Err(Error::duplicate_field("altitude"));
}
altitude = Some(map.next_value()?);
},
Field::Rainfall => {
if rainfall.is_some() {
return Err(Error::duplicate_field("rainfall"));
}
rainfall = Some(map.next_value()?);
},
Field::Temperature => {
if temperature.is_some() {
return Err(Error::duplicate_field("temperature"));
}
temperature = Some(map.next_value()?);
},
Field::LocalIteration => {
if local_iteration.is_some() {
return Err(Error::duplicate_field("local_iteration"));
}
local_iteration = Some(map.next_value()?);
},
Field::BiomePresences => {
if biome_presences.is_some() {
return Err(Error::duplicate_field("biome_presences"));
}
biome_presences = Some(map.next_value()?);
},
}
}
let altitude = altitude.ok_or_else(|| Error::missing_field("altitude"))?;
let rainfall = rainfall.ok_or_else(|| Error::missing_field("rainfall"))?;
let temperature = temperature.ok_or_else(|| Error::missing_field("temperature"))?;
let local_iteration =
local_iteration.ok_or_else(|| Error::missing_field("local_iteration"))?;
let biome_presences =
biome_presences.ok_or_else(|| Error::missing_field("biome_presences"))?;
Ok(TerrainCell {
altitude,
rainfall,
temperature,
local_iteration,
biome_presences,
x: default(),
y: default(),
})
}
}
const FIELDS: &'static [&'static str] = &[
"altitude",
"rainfall",
"temperature",
"local_iteration",
"biome_presences",
];
deserializer.deserialize_struct("TerrainCell", FIELDS, TerrainCellVisitor)
}
}

View file

@ -0,0 +1,50 @@
use {
crate::{perlin, BiomeType, HumanGroup, World},
serde::{Deserialize, Serialize},
};
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct TerrainCell {
pub altitude: f32,
pub rainfall: f32,
pub temperature: f32,
#[serde(skip)]
pub x: usize,
#[serde(skip)]
pub y: usize,
pub local_iteration: usize,
pub biome_presences: Vec<(BiomeType, f32)>,
pub human_groups: Vec<HumanGroup>,
}
impl TerrainCell {
pub fn get_next_local_random_int(&mut self, world: &World) -> u32 {
let seed = world.seed;
let x = seed as f32 + self.x as f32;
let y = seed as f32 + self.y as f32;
let z = seed as f32 + world.iteration as f32 + (self.local_iteration - 1) as f32;
self.local_iteration += 1;
perlin::permutation_value(x, y, z)
}
pub fn get_next_local_random_float(&mut self, world: &World) -> f32 {
self.get_next_local_random_int(world) as f32 / perlin::MAX_PERMUTATION_VALUE as f32
}
pub fn biome_presence(&self, biome: BiomeType) -> f32 {
if let Some(presence) = self
.biome_presences
.iter()
.find(|biome_presence| biome_presence.0 == biome)
{
presence.1
} else {
0.0
}
}
}

View file

@ -10,6 +10,7 @@ use {
perlin, perlin,
BiomeStats, BiomeStats,
BiomeType, BiomeType,
TerrainCell,
}, },
bevy::{ bevy::{
log::info, log::info,
@ -92,38 +93,10 @@ pub struct World {
pub iteration: usize, pub iteration: usize,
} }
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct TerrainCell {
pub altitude: f32,
pub rainfall: f32,
pub temperature: f32,
#[serde(skip)]
pub x: usize,
#[serde(skip)]
pub y: usize,
pub local_iteration: usize,
pub biome_presences: Vec<(BiomeType, f32)>,
}
impl TerrainCell {
pub fn get_next_local_random_int(&mut self, world: &World) -> f32 {
let seed = world.seed;
let x = seed as f32 + self.x as f32;
let y = seed as f32 + self.y as f32;
let z = seed as f32 + world.iteration as f32 + (self.local_iteration - 1) as f32;
drop(world);
self.local_iteration += 1;
perlin::perlin_value(x, y, z)
}
}
impl World { impl World {
pub const ALTITUDE_SPAN: f32 = World::MAX_ALTITUDE - World::MIN_ALTITUDE; pub const ALTITUDE_SPAN: f32 = World::MAX_ALTITUDE - World::MIN_ALTITUDE;
/// Circumference - in kilometers
pub const CIRCUMFERENCE: u32 = 40075;
pub const CONTINENT_MAX_SIZE_FACTOR: f32 = 8.7; pub const CONTINENT_MAX_SIZE_FACTOR: f32 = 8.7;
pub const CONTINENT_MIN_SIZE_FACTOR: f32 = 5.7; pub const CONTINENT_MIN_SIZE_FACTOR: f32 = 5.7;
pub const MAX_ALTITUDE: f32 = 15000.0; pub const MAX_ALTITUDE: f32 = 15000.0;
@ -139,6 +112,12 @@ impl World {
pub const TEMPERATURE_ALTITUDE_FACTOR: f32 = 2.05; pub const TEMPERATURE_ALTITUDE_FACTOR: f32 = 2.05;
pub const TEMPERATURE_SPAN: f32 = World::MAX_TEMPERATURE - World::MIN_TEMPERATURE; pub const TEMPERATURE_SPAN: f32 = World::MAX_TEMPERATURE - World::MIN_TEMPERATURE;
#[must_use]
#[inline(always)]
pub fn cell_max_widht(&self) -> f32 {
self.width as f32 / World::CIRCUMFERENCE as f32
}
pub fn new(width: u32, height: u32, seed: u32) -> World { pub fn new(width: u32, height: u32, seed: u32) -> World {
World { World {
width, width,

View file

@ -5,13 +5,20 @@ use {
}; };
iterable_enum_stringify!(WorldView { iterable_enum_stringify!(WorldView {
Population,
Biomes, Biomes,
Topography, Topography,
Coastlines Coastlines,
}); });
impl Default for WorldView {
fn default() -> Self {
WorldView::Population
}
}
iterable_enum_stringify!(WorldOverlay { iterable_enum_stringify!(WorldOverlay {
Temperature, Temperature,
Rainfall Rainfall,
}); });
#[cfg(feature = "render")] #[cfg(feature = "render")]
@ -32,18 +39,54 @@ impl WorldRenderSettings {
pub fn toggle_overlay(&mut self, overlay: &WorldOverlay) { pub fn toggle_overlay(&mut self, overlay: &WorldOverlay) {
if self.visible_overlays.contains(overlay) { if self.visible_overlays.contains(overlay) {
assert!( assert!(
self.visible_overlays.remove(overlay), self.visible_overlays.remove(overlay),
"Failed to remove overlay [{overlay:#?}], that shouldn't happen." "Failed to remove overlay [{overlay:#?}], that shouldn't happen."
); );
} else { } else {
assert!( assert!(
self.visible_overlays.insert(*overlay), self.visible_overlays.insert(*overlay),
"Failed to insert overlay [{overlay:#?}], that shouldn't happen." "Failed to insert overlay [{overlay:#?}], that shouldn't happen."
); );
} }
} }
} }
#[must_use]
fn population_color(world: &World, cell: &TerrainCell) -> Color {
let slant = world.get_slant(cell);
let altitude_difference = world.max_altitude - world.min_altitude;
let slant_factor = f32::min(1.0, (4.0 + (10.0 * slant / altitude_difference)) / 5.0);
let altitude_factor = f32::min(1.0, (0.5 + ((cell.altitude - altitude_difference) / altitude_difference)) / 1.5);
let mut total_population = 0;
for human_group in cell.human_groups {
total_population += human_group.population;
}
let color = if total_population > 0 {
Color::GREEN
} else {
let color = biome_color(world, cell);
let greyscale = (color.r() + color.g() + color.b()) / 4.5 + 0.25;
color.set_r(greyscale);
color.set_g(greyscale);
color.set_b(greyscale);
color
};
let r = color.r() * slant_factor * altitude_factor;
let g = color.g() * slant_factor * altitude_factor;
let b = color.b() * slant_factor * altitude_factor;
Color::rgb(r, g, b)
}
#[must_use] #[must_use]
fn altitude_contour_color(world: &World, altitude: f32) -> Color { fn altitude_contour_color(world: &World, altitude: f32) -> Color {
let mut color = Color::rgb(1.0, 0.6, 0.0); let mut color = Color::rgb(1.0, 0.6, 0.0);
@ -286,9 +329,3 @@ impl WorldRenderer {
Color::rgb(red / normalizer, green / normalizer, blue / normalizer) Color::rgb(red / normalizer, green / normalizer, blue / normalizer)
} }
} }
impl Default for WorldView {
fn default() -> Self {
WorldView::Biomes
}
}