Compare commits
No commits in common. "wip" and "main" have entirely different histories.
16 changed files with 246 additions and 631 deletions
276
Cargo.lock
generated
276
Cargo.lock
generated
|
@ -55,9 +55,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.20"
|
||||
version = "0.7.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -131,20 +131,20 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
|||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.37.1+1.3.235"
|
||||
version = "0.37.0+1.3.209"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "911015c962d56e2e4052f40182ca5462ba60a3d2ff04e827c365a0ab3d65726d"
|
||||
checksum = "006ca68e0f2b03f22d6fa9f2860f85aed430d257fec20f8879b2145e7c7ae1a6"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "1.8.0"
|
||||
version = "1.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
|
||||
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28"
|
||||
dependencies = [
|
||||
"concurrent-queue 2.0.0",
|
||||
"concurrent-queue 1.2.4",
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
]
|
||||
|
@ -199,18 +199,18 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
|||
|
||||
[[package]]
|
||||
name = "bevy"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dae99b246505811f5bc19d2de1e406ec5d2816b421d58fa223779eb576f472c9"
|
||||
checksum = "3654d60973fcde065efcfe0c9066c81a76987d28c45233998b2ccdc581dcd914"
|
||||
dependencies = [
|
||||
"bevy_internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_app"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "536e4d0018347478545ed8b6cb6e57b9279ee984868e81b7c0e78e0fb3222e42"
|
||||
checksum = "e7240e455d6976b20d24bf8eda37cd9154116fe9cc2beef7bdc009b4c6fff139"
|
||||
dependencies = [
|
||||
"bevy_derive",
|
||||
"bevy_ecs",
|
||||
|
@ -223,9 +223,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_asset"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db1bb550168304df69c867c09125e1aae7ff51cf21575396e1598bf293442c4"
|
||||
checksum = "86ca05c472cd4939aed5b2980ad9b416a250ae4674824e8c4b569ddf18ab5230"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -250,9 +250,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_core"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96299aceb3c8362cb4aa39ff81c7ef758a5f4e768d16b5046a91628eff114ac0"
|
||||
checksum = "0d344ff340874fb3f1e458f03eca2b731cb8174495e9c0828f5e4569765489cb"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -265,9 +265,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_core_pipeline"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc128a9860aadf16fb343ae427f2768986fd91dce64d945455acda9759c48014"
|
||||
checksum = "13523e290f9aad62987e04836d66819fb97afeaf794847b6f64121c62a4db916"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -285,9 +285,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_derive"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7baf73c58d41c353c6fd08e6764a2e7420c9f19e8227b391c50981db6d0282a6"
|
||||
checksum = "a12e50d2ff8423438e971c44a90baefc9e351edd45b50b8d077f9ad4f7a0a2a5"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"quote",
|
||||
|
@ -296,9 +296,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_diagnostic"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63bf96ec7980fa25b77ff6c72dfafada477936c0dab76c1edf6c028c0e5fe0e4"
|
||||
checksum = "d3415f3a220d8706daac84986d744374fd18883add3a22e894af8cddf2cf1c29"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_core",
|
||||
|
@ -310,9 +310,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_ecs"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4c071d7c6bc9801253485e05d0c257284150de755391902746837ba21c0cf74"
|
||||
checksum = "43b29e39772df5e8939f7f540ee152569eebeb3c2cc35a68670688ae008ba2cf"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"bevy_ecs_macros",
|
||||
|
@ -330,9 +330,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_ecs_macros"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c15bd45438eeb681ad74f2d205bb07a5699f98f9524462a30ec764afab2742ce"
|
||||
checksum = "10b8e7e7fb3ab9554c77e0f8a2531abd05d40ddb0145a8dfa72434cefa52ee5c"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -342,9 +342,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_egui"
|
||||
version = "0.17.1"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cec5fb091ccae94917266fe9b1af8339ef1e47763360b38273a31457598b030"
|
||||
checksum = "33bf9a0085909f3dc3d5ca7be6a6e6792b8b30b98bba9cca13baa49e2f3e3206"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"bevy",
|
||||
|
@ -354,9 +354,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_encase_derive"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "962b6bb0d30e92ec2e6c29837acce9e55b920733a634e7c3c5fd5a514bea7a24"
|
||||
checksum = "3a0773119830d63dde225338c0c556f84cd68e8e69de5b62a1b172fdddc5b915"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"encase_derive_impl",
|
||||
|
@ -364,9 +364,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_gltf"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e853e346ba412354e02292c7aa5b9a9dccdfa748e273b1b7ebf8f6a172f89712"
|
||||
checksum = "fd77158983e09cbbb8115a2c629bdf3249cfff58e8e19f1c62861b1e5495eaf1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
@ -392,9 +392,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_hierarchy"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dd6d50c48c6e1bcb5e08a768b765323292bb3bf3a439b992754c57ffb85b23a"
|
||||
checksum = "23b5181dc3d621c3d18a1209791e82199409d6ddf5376ee19f2e26ad7bfd9b06"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_core",
|
||||
|
@ -407,9 +407,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_input"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3378b5171284f4c4c0e8307081718a9fe458f846444616bd82d69110dcabca51"
|
||||
checksum = "10f72c3037535eb41b863a22c2e58d3845a096401f9b92204b6a240e36a5151b"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -421,9 +421,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_internal"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c46014b7e885b1311de06b6039e448454a4db55b8d35464798ba88faa186e11"
|
||||
checksum = "0ff89c2c2644c588d72cf505f15ad515479705c82ad7aa359ad2249646995a76"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -455,9 +455,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_log"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c480bac54cf4ae76edc3ae9ae3fa7c5e1b385e7f2111ef5ec3fd00cf3a7998b"
|
||||
checksum = "66c1d5f2cbcf5c3ce87d42afb6ba98177f8f758278364cbc79a2b3bf38415f0e"
|
||||
dependencies = [
|
||||
"android_log-sys",
|
||||
"bevy_app",
|
||||
|
@ -471,9 +471,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_macro_utils"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "022bb69196deeea691b6997414af85bbd7f2b34a8914c4aa7a7ff4dfa44f7677"
|
||||
checksum = "656fa7b3434ac5d5c2883dde3c075f834ff51178f2f48ef2454b6f2ada75cb15"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
|
@ -482,9 +482,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_math"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d434c77ab766c806ed9062ef8a7285b3b02b47df51f188d4496199c3ac062eaf"
|
||||
checksum = "b26459575a5f9695788e3487aa0a5f9252562e0fc57065e6f35f370dbfac7d4a"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"serde",
|
||||
|
@ -492,18 +492,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_mikktspace"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbfb5908d33fd613069be516180b8f138aaaf6e41c36b1fd98c6c29c00c24a13"
|
||||
checksum = "1e67d9caff1be480eb097e1a5ee7332762e19a2ea3d07496017fc8221ea6bc46"
|
||||
dependencies = [
|
||||
"glam",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_pbr"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "310b1f260a475d81445623e138e1b7245759a42310bc1f84b550a3f4ff8763bf"
|
||||
checksum = "5a2e5069b351743e5660f837671135a7aac585cd2c1d7d0b90d92a2d84c2a1fd"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -523,15 +523,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_ptr"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ec44f7655039546bc5d34d98de877083473f3e9b2b81d560c528d6d74d3eff4"
|
||||
checksum = "c36f4d3af0cda50c07e2010d0351ab79594681116edd280592ca394db73ef32b"
|
||||
|
||||
[[package]]
|
||||
name = "bevy_reflect"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6deae303a7f69dc243b2fa35b5e193cc920229f448942080c8eb2dbd9de6d37a"
|
||||
checksum = "c39f74d7786a0016c74b6bfb57f44928d536bef8bf6db7505d4cbe9435aeda7b"
|
||||
dependencies = [
|
||||
"bevy_math",
|
||||
"bevy_ptr",
|
||||
|
@ -549,9 +549,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_reflect_derive"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bf4cb9cd5acb4193f890f36cb63679f1502e2de025e66a63b194b8b133d018"
|
||||
checksum = "5b2c0aab36b060e88cd93c56710d9ce8ab6107596dc4cbb8a9d84ba98f39c63b"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"bit-set",
|
||||
|
@ -563,9 +563,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_render"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e3282a8f8779d2aced93207fbed73f740937c6c2bd27bd84f0799b081c7fca5"
|
||||
checksum = "14033813fdd9587663ffa6b6d84327f30bd0398b40386677704bd4d608625420"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -605,9 +605,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_render_macros"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7acae697776ac05bea523e1725cf2660c91c53abe72c66782ea1e1b9eedb572"
|
||||
checksum = "e29db44fb38743a08e71bed324a19b8ce2e9f2853abcb4640e03625dd55cc186"
|
||||
dependencies = [
|
||||
"bevy_macro_utils",
|
||||
"proc-macro2",
|
||||
|
@ -617,9 +617,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_scene"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea9c66a628c833d53bae54fe94cbc0d3f12c29e9d2e6c3f2356d45ad57db0c8c"
|
||||
checksum = "b5b98c58cba6417961856a57ba1116d78db3364b8e791ac517175f04b9abdb6b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_app",
|
||||
|
@ -639,9 +639,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_sprite"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ec01c7db7f698d95bcb70708527c3ae6bcdc78fc247abe74f935cae8f0a1145"
|
||||
checksum = "b135b2ccf7c5eaf9b3e20e39ef80081842f122081c8ce988cb2054afd1af270e"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -664,9 +664,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_tasks"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "680b16b53df9c9f24681dd95f4d772d83760bd19adf8bca00f358a3aad997853"
|
||||
checksum = "a5d91d94d2db1476d7452509c1967fe83d66da5f683f5d49ba31e0f455adfcdc"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-executor",
|
||||
|
@ -679,9 +679,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_text"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60c74c1bdaabde7db28f6728aa13bc7b1d744a2201b2bbfd83d2224404c57f5c"
|
||||
checksum = "fe4282d77fb5dd38bb2a7736a770f5e499782b8c546b9f7d73f6893ab04c8041"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"anyhow",
|
||||
|
@ -702,9 +702,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_time"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a5c38a6d3ea929c7f81e6adf5a6c62cf7e8c40f5106c2174d6057e9d8ea624d"
|
||||
checksum = "a259a4b04f5ae2d02998247a69e5a711b0754eb22971320bf727c6f4d7bf38fa"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -715,9 +715,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_transform"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba13c57a040b89767191a6f6d720a635b7792793628bfa41a9e38b7026484aec"
|
||||
checksum = "b7b4cdac87f8a58c3ec166b5673dd35565c61eb0ec648e3b0cc30083170c0fb3"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -728,9 +728,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_ui"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60e82ace6156f11fcdf2319102ff8fb8367b82d1e32b7d05d387a1963602f965"
|
||||
checksum = "da6d85fcefe5a2bf259c2ff58a7a29b6102070242dc385b42a2656f4e8918883"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
|
@ -757,9 +757,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_utils"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16750aae52cd35bd7b60eb61cee883420b250e11b4a290b8d44b2b2941795739"
|
||||
checksum = "1d7473635355a99fcf7181091a2ac11df03561706b1696cb0cc72e4ddd010571"
|
||||
dependencies = [
|
||||
"ahash 0.7.6",
|
||||
"getrandom",
|
||||
|
@ -771,9 +771,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_window"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a44d3f3bd54a2261f4f57f614bf7bccc8d2832761493c0cd7dab81d98cc151e"
|
||||
checksum = "07a0d03022a6d1ec0d05c01a77f5592a9602bbc1cfc11ba457788b69f9ca175d"
|
||||
dependencies = [
|
||||
"bevy_app",
|
||||
"bevy_ecs",
|
||||
|
@ -786,9 +786,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bevy_winit"
|
||||
version = "0.9.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7b7e647ecd0b3577468da37767dcdd7c26ca9f80da0060b2ec4c77336b6d2e1"
|
||||
checksum = "ebc7b4e4f83e268dcbd6f9c4e1c18f7382e457f5f1b160da4c85d9a3f489771a"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"bevy_app",
|
||||
|
@ -804,15 +804,6 @@ dependencies = [
|
|||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.5.3"
|
||||
|
@ -880,12 +871,12 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
|
|||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
version = "0.10.4"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19457a0da465234abd76134a5c2a910c14bd3c5558463e4396ab9a37a328e465"
|
||||
checksum = "595eb0438b3c6d262395fe30e6de9a61beb57ea56290b00a07f227fe6e20cbf2"
|
||||
dependencies = [
|
||||
"log",
|
||||
"nix 0.25.1",
|
||||
"nix 0.24.2",
|
||||
"slotmap",
|
||||
"thiserror",
|
||||
"vec_map",
|
||||
|
@ -893,9 +884,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.77"
|
||||
version = "1.0.76"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
|
||||
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
@ -920,6 +911,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cobs"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15"
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.24.1"
|
||||
|
@ -997,9 +994,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "const_panic"
|
||||
version = "0.2.7"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58baae561b85ca19b3122a9ddd35c8ec40c3bcd14fe89921824eae73f7baffbf"
|
||||
checksum = "9ed2b28323eee4fb66bb824401daa3e46bd445b9a9298a3d382b320710ba69dd"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
|
@ -1063,9 +1060,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.14"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
|
||||
checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
@ -1565,9 +1562,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.2"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
||||
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
|
@ -1637,9 +1634,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.138"
|
||||
version = "0.2.137"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
|
||||
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
|
@ -1837,9 +1834,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ndk-sys"
|
||||
version = "0.4.1+23.1.7779620"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3"
|
||||
checksum = "21d83ec9c63ec5bf950200a8e508bdad6659972187b625469f58ef8c08e29046"
|
||||
dependencies = [
|
||||
"jni-sys",
|
||||
]
|
||||
|
@ -1859,9 +1856,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.24.3"
|
||||
version = "0.24.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
|
||||
checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
|
@ -1869,19 +1866,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "nohash-hasher"
|
||||
version = "0.2.0"
|
||||
|
@ -2059,9 +2043,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.5"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
|
||||
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
|
@ -2103,8 +2087,8 @@ name = "planet"
|
|||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"bincode",
|
||||
"crossbeam-channel",
|
||||
"postcard",
|
||||
"rand",
|
||||
"serde",
|
||||
]
|
||||
|
@ -2121,6 +2105,16 @@ dependencies = [
|
|||
"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]]
|
||||
name = "pp-rs"
|
||||
version = "0.2.1"
|
||||
|
@ -2315,18 +2309,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.149"
|
||||
version = "1.0.147"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "256b9932320c590e707b94576e3cc1f7c9024d0ee6612dfbcf1cb106cbe8e055"
|
||||
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.149"
|
||||
version = "1.0.147"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4eae9b04cbffdfd550eb462ed33bc6a1b68c935127d008b27444d08380f94e4"
|
||||
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2335,9 +2329,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.89"
|
||||
version = "1.0.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
|
||||
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -2392,7 +2386,7 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"log",
|
||||
"memmap2",
|
||||
"nix 0.24.3",
|
||||
"nix 0.24.2",
|
||||
"pkg-config",
|
||||
"wayland-client",
|
||||
"wayland-cursor",
|
||||
|
@ -2435,9 +2429,9 @@ checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.105"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
|
||||
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2606,9 +2600,9 @@ checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff"
|
|||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.16.0"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
|
@ -2630,9 +2624,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.2.2"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c"
|
||||
checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"serde",
|
||||
|
@ -2743,7 +2737,7 @@ dependencies = [
|
|||
"bitflags",
|
||||
"downcast-rs",
|
||||
"libc",
|
||||
"nix 0.24.3",
|
||||
"nix 0.24.2",
|
||||
"scoped-tls",
|
||||
"wayland-commons",
|
||||
"wayland-scanner",
|
||||
|
@ -2756,7 +2750,7 @@ version = "0.29.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
|
||||
dependencies = [
|
||||
"nix 0.24.3",
|
||||
"nix 0.24.2",
|
||||
"once_cell",
|
||||
"smallvec",
|
||||
"wayland-sys",
|
||||
|
@ -2768,7 +2762,7 @@ version = "0.29.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
|
||||
dependencies = [
|
||||
"nix 0.24.3",
|
||||
"nix 0.24.2",
|
||||
"wayland-client",
|
||||
"xcursor",
|
||||
]
|
||||
|
@ -2824,9 +2818,9 @@ checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
|
|||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "0.14.2"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81f643110d228fd62a60c5ed2ab56c4d5b3704520bd50561174ec4ec74932937"
|
||||
checksum = "c2272b17bffc8a0c7d53897435da7c1db587c87d3a14e8dae9cdb8d1d210fc0f"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"js-sys",
|
||||
|
@ -2846,9 +2840,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.14.2"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6000d1284ef8eec6076fd5544a73125fd7eb9b635f18dceeb829d826f41724ca"
|
||||
checksum = "73d14cad393054caf992ee02b7da6a372245d39a484f7461c1f44f6f6359bd28"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
|
@ -3103,9 +3097,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.20.1"
|
||||
version = "2.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0"
|
||||
checksum = "0c83627bc137605acc00bb399c7b908ef460b621fc37c953db2b09f88c449ea6"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
|
|
|
@ -35,7 +35,7 @@ path = "planet"
|
|||
default-features = false
|
||||
|
||||
[dependencies.bevy]
|
||||
version = "0.9"
|
||||
version = "0.9.0"
|
||||
default-features = false
|
||||
|
||||
[dependencies.fxhash]
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#!/bin/env /bin/sh
|
||||
echo "Debug-build with features: minimal"
|
||||
cargo build -j 6 --no-default-features --features= &&
|
||||
cargo build --no-default-features --features= &&
|
||||
echo "Debug-build with features: logging" &&
|
||||
cargo build -j 6 --no-default-features --features=logging &&
|
||||
cargo build --no-default-features --features=logging &&
|
||||
echo "Debug-build with features: render" &&
|
||||
cargo build -j 6 --no-default-features --features=render &&
|
||||
cargo build --no-default-features --features=render &&
|
||||
echo "Debug-build with features: logging render" &&
|
||||
cargo build -j 6 --no-default-features --features="logging,render" &&
|
||||
cargo build --no-default-features --features="logging,render" &&
|
||||
echo "Release-build with features: minimal"
|
||||
cargo build -j 6 --release --no-default-features --features= &&
|
||||
cargo build --release --no-default-features --features= &&
|
||||
echo "Release-build with features: logging" &&
|
||||
cargo build -j 6 --release --no-default-features --features=logging &&
|
||||
cargo build --release --no-default-features --features=logging &&
|
||||
echo "Release-build with features: render" &&
|
||||
cargo build -j 6 --release --no-default-features --features=render &&
|
||||
cargo build --release --no-default-features --features=render &&
|
||||
echo "Release-build with features: logging render" &&
|
||||
cargo build -j 6 --release --no-default-features --features="logging,render" &&
|
||||
cargo build --release --no-default-features --features="logging,render" &&
|
||||
echo "Done!"
|
|
@ -23,8 +23,10 @@ version = "1.0"
|
|||
default-features = false
|
||||
features = ["derive"]
|
||||
|
||||
[dependencies.bincode]
|
||||
version = "1.3.3"
|
||||
[dependencies.postcard]
|
||||
version = "1.0.2"
|
||||
default-features = false
|
||||
features = ["use-std"]
|
||||
|
||||
[dependencies.crossbeam-channel]
|
||||
version = "0.5.6"
|
||||
|
|
|
@ -1,17 +1,7 @@
|
|||
use {
|
||||
crate::World,
|
||||
core::hash::Hash,
|
||||
serde::{Deserialize, Serialize},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default, Eq, PartialEq, Hash)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct HumanGroup {
|
||||
pub id: u32,
|
||||
pub population: u32,
|
||||
}
|
||||
|
||||
impl HumanGroup {
|
||||
pub fn update(&self, _world: &World) {
|
||||
// TODO: Anything
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
pub mod human_group;
|
||||
pub use human_group::HumanGroup;
|
||||
pub mod terrain_cell;
|
||||
pub use terrain_cell::TerrainCell;
|
||||
pub mod world;
|
||||
pub use world::{World, WorldGenError};
|
||||
pub use world::{TerrainCell, World, WorldGenError};
|
||||
pub mod biome;
|
||||
pub use biome::{BiomeStats, BiomeType};
|
||||
pub mod world_manager;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
pub const MAX_PERMUTATION_VALUE: u32 = 16777216;
|
||||
|
||||
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,
|
||||
142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219,
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
pub mod terrain_cell;
|
||||
// pub mod terrain_cell;
|
||||
pub mod world;
|
||||
|
|
|
@ -1,247 +0,0 @@
|
|||
use {
|
||||
crate::{HumanGroup, TerrainCell},
|
||||
bevy::prelude::{debug, default},
|
||||
serde::{
|
||||
de::{Error, MapAccess, SeqAccess, Visitor},
|
||||
ser::SerializeStruct,
|
||||
Deserialize,
|
||||
Serialize,
|
||||
},
|
||||
std::{
|
||||
fmt::{self, Formatter},
|
||||
sync::Arc,
|
||||
},
|
||||
};
|
||||
|
||||
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,
|
||||
Height,
|
||||
Width,
|
||||
HumanGroups,
|
||||
}
|
||||
|
||||
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>,
|
||||
{
|
||||
std::mem::transmute::<u128>(seq);
|
||||
|
||||
let mut length = 0;
|
||||
let altitude = seq
|
||||
.next_element()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
length += 1;
|
||||
|
||||
let rainfall = seq
|
||||
.next_element()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
length += 1;
|
||||
|
||||
let temperature = seq
|
||||
.next_element()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
length += 1;
|
||||
|
||||
let local_iteration = seq
|
||||
.next_element()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
length += 1;
|
||||
|
||||
let biome_presences = seq
|
||||
.next_element()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
length += 1;
|
||||
|
||||
let height = seq
|
||||
.next_element()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
length += 1;
|
||||
|
||||
let width = seq
|
||||
.next_element()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
length += 1;
|
||||
|
||||
let human_groups = seq
|
||||
.next_element::<Vec<HumanGroup>>()?
|
||||
.ok_or_else(|| panic!("Invalid length {length}, expected 8"))?;
|
||||
// length += 1;
|
||||
|
||||
Ok(TerrainCell {
|
||||
altitude,
|
||||
rainfall,
|
||||
temperature,
|
||||
local_iteration,
|
||||
biome_presences,
|
||||
x: default(),
|
||||
y: default(),
|
||||
human_groups: human_groups.iter().map(|group| Arc::new(*group)).collect(),
|
||||
height,
|
||||
width,
|
||||
})
|
||||
}
|
||||
|
||||
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;
|
||||
let mut height = None;
|
||||
let mut width = None;
|
||||
let mut human_groups: Option<Vec<HumanGroup>> = 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()?);
|
||||
},
|
||||
Field::Height => {
|
||||
if height.is_some() {
|
||||
return Err(Error::duplicate_field("height"));
|
||||
}
|
||||
height = Some(map.next_value()?);
|
||||
},
|
||||
Field::Width => {
|
||||
if width.is_some() {
|
||||
return Err(Error::duplicate_field("width"));
|
||||
}
|
||||
width = Some(map.next_value()?);
|
||||
},
|
||||
Field::HumanGroups => {
|
||||
if human_groups.is_some() {
|
||||
return Err(Error::duplicate_field("human_groups"));
|
||||
}
|
||||
human_groups = 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"))?;
|
||||
let height = height.ok_or_else(|| Error::missing_field("height"))?;
|
||||
let width = width.ok_or_else(|| Error::missing_field("width"))?;
|
||||
let human_groups =
|
||||
human_groups.ok_or_else(|| Error::missing_field("human_groups"))?;
|
||||
|
||||
Ok(TerrainCell {
|
||||
altitude,
|
||||
rainfall,
|
||||
temperature,
|
||||
local_iteration,
|
||||
biome_presences,
|
||||
x: default(),
|
||||
y: default(),
|
||||
human_groups: human_groups.iter().map(|group| Arc::new(*group)).collect(),
|
||||
height,
|
||||
width,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const FIELDS: &'static [&'static str] = &[
|
||||
"altitude",
|
||||
"rainfall",
|
||||
"temperature",
|
||||
"local_iteration",
|
||||
"biome_presences",
|
||||
];
|
||||
|
||||
deserializer.deserialize_struct("TerrainCell", FIELDS, TerrainCellVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for TerrainCell {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
let TerrainCell {
|
||||
altitude,
|
||||
rainfall,
|
||||
temperature,
|
||||
x: _x,
|
||||
y: _y,
|
||||
local_iteration,
|
||||
biome_presences,
|
||||
human_groups,
|
||||
height,
|
||||
width,
|
||||
} = self;
|
||||
|
||||
let human_groups = &human_groups
|
||||
.iter()
|
||||
.map(|group_arc| **group_arc)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut serialized_struct = serializer.serialize_struct(stringify!(TerrainCell), 10)?;
|
||||
serialized_struct.serialize_field(stringify!(altitude), altitude)?;
|
||||
serialized_struct.serialize_field(stringify!(rainfall), rainfall)?;
|
||||
serialized_struct.serialize_field(stringify!(temperature), temperature)?;
|
||||
// #[skip]
|
||||
// serialized_struct.serialize_field(stringify!(x), x)?;
|
||||
// #[skip]
|
||||
// serialized_struct.serialize_field(stringify!(y), y)?;
|
||||
serialized_struct.serialize_field(stringify!(local_iteration), local_iteration)?;
|
||||
serialized_struct.serialize_field(stringify!(biome_presences), biome_presences)?;
|
||||
serialized_struct.serialize_field(stringify!(human_groups), human_groups)?;
|
||||
serialized_struct.serialize_field(stringify!(height), height)?;
|
||||
serialized_struct.serialize_field(stringify!(width), width)?;
|
||||
serialized_struct.end()
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{TerrainCell, World},
|
||||
bevy::{prelude::debug, utils::default},
|
||||
bevy::prelude::debug,
|
||||
rand::{rngs::StdRng, SeedableRng},
|
||||
serde::{
|
||||
de::{Error, MapAccess, SeqAccess, Visitor},
|
||||
|
@ -137,7 +137,6 @@ impl<'de> Deserialize<'de> for World {
|
|||
|
||||
rng: StdRng::seed_from_u64(seed as u64),
|
||||
iteration,
|
||||
human_groups_to_update: default(),
|
||||
};
|
||||
{
|
||||
let mut y = 0;
|
||||
|
@ -220,10 +219,10 @@ impl<'de> Deserialize<'de> for World {
|
|||
let mut terrain: Vec<Vec<TerrainCell>> =
|
||||
terrain.ok_or_else(|| Error::missing_field("terrain"))?;
|
||||
|
||||
for x in 0..width as u32 {
|
||||
for y in 0..height as u32 {
|
||||
terrain[y as usize][x as usize].x = x;
|
||||
terrain[y as usize][x as usize].y = y;
|
||||
for x in 0..width as usize {
|
||||
for y in 0..height as usize {
|
||||
terrain[y][x].x = x;
|
||||
terrain[y][x].y = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +279,6 @@ impl<'de> Deserialize<'de> for World {
|
|||
|
||||
rng: StdRng::seed_from_u64(seed as u64),
|
||||
iteration,
|
||||
human_groups_to_update: default(),
|
||||
};
|
||||
{
|
||||
let mut y = 0;
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
use {
|
||||
crate::{perlin, BiomeType, HumanGroup, World},
|
||||
std::sync::Arc,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct TerrainCell {
|
||||
pub altitude: f32,
|
||||
pub rainfall: f32,
|
||||
pub temperature: f32,
|
||||
|
||||
pub x: u32,
|
||||
pub y: u32,
|
||||
pub local_iteration: u64,
|
||||
|
||||
pub biome_presences: Vec<(BiomeType, f32)>,
|
||||
pub human_groups: Vec<Arc<HumanGroup>>,
|
||||
|
||||
pub height: f32,
|
||||
pub width: f32,
|
||||
}
|
||||
|
||||
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) -> Option<f32> {
|
||||
if let Some(presence) = self
|
||||
.biome_presences
|
||||
.iter()
|
||||
.find(|biome_presence| biome_presence.0 == biome)
|
||||
{
|
||||
Some(presence.1)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,8 +10,6 @@ use {
|
|||
perlin,
|
||||
BiomeStats,
|
||||
BiomeType,
|
||||
HumanGroup,
|
||||
TerrainCell,
|
||||
},
|
||||
bevy::{
|
||||
log::info,
|
||||
|
@ -21,12 +19,11 @@ use {
|
|||
},
|
||||
crossbeam_channel::Sender,
|
||||
rand::{rngs::StdRng, Rng, SeedableRng},
|
||||
serde::Serialize,
|
||||
serde::{Deserialize, Serialize},
|
||||
std::{
|
||||
error::Error,
|
||||
f32::consts::{PI, TAU},
|
||||
fmt::{Debug, Display},
|
||||
sync::{Arc, Weak},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -93,15 +90,40 @@ pub struct World {
|
|||
#[serde(skip)]
|
||||
pub rng: StdRng,
|
||||
pub iteration: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
||||
pub struct TerrainCell {
|
||||
pub altitude: f32,
|
||||
pub rainfall: f32,
|
||||
pub temperature: f32,
|
||||
|
||||
#[serde(skip)]
|
||||
pub human_groups_to_update: Vec<Weak<HumanGroup>>,
|
||||
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 {
|
||||
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_MIN_SIZE_FACTOR: f32 = 5.7;
|
||||
pub const MAX_ALTITUDE: f32 = 15000.0;
|
||||
|
@ -117,12 +139,6 @@ impl World {
|
|||
pub const TEMPERATURE_ALTITUDE_FACTOR: f32 = 2.05;
|
||||
pub const TEMPERATURE_SPAN: f32 = World::MAX_TEMPERATURE - World::MIN_TEMPERATURE;
|
||||
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
pub fn cell_max_width(&self) -> f32 {
|
||||
self.width as f32 / World::CIRCUMFERENCE as f32
|
||||
}
|
||||
|
||||
pub fn new(width: u32, height: u32, seed: u32) -> World {
|
||||
World {
|
||||
width,
|
||||
|
@ -139,7 +155,25 @@ impl World {
|
|||
min_temperature: World::MAX_TEMPERATURE,
|
||||
rng: StdRng::seed_from_u64(seed as u64),
|
||||
iteration: 0,
|
||||
human_groups_to_update: default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn async_new(width: u32, height: u32, seed: u32) -> World {
|
||||
World {
|
||||
width,
|
||||
height,
|
||||
seed,
|
||||
terrain: vec![vec![default(); width.try_into().unwrap()]; height.try_into().unwrap()],
|
||||
continent_offsets: [default(); World::NUM_CONTINENTS as usize],
|
||||
continent_sizes: [default(); World::NUM_CONTINENTS as usize],
|
||||
max_altitude: World::MIN_ALTITUDE,
|
||||
min_altitude: World::MAX_ALTITUDE,
|
||||
max_rainfall: World::MIN_RAINFALL,
|
||||
min_rainfall: World::MAX_RAINFALL,
|
||||
max_temperature: World::MIN_TEMPERATURE,
|
||||
min_temperature: World::MAX_TEMPERATURE,
|
||||
rng: StdRng::seed_from_u64(seed as u64),
|
||||
iteration: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,9 +197,6 @@ impl World {
|
|||
send_progress(progress_sender, 0.0, "Generating biomes");
|
||||
self.generate_biomes(progress_sender);
|
||||
|
||||
send_progress(progress_sender, 0.0, "Populating world");
|
||||
self.set_initial_human_groups(progress_sender);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -409,10 +440,8 @@ impl World {
|
|||
self.min_altitude = altitude;
|
||||
}
|
||||
|
||||
self.terrain[y][x].x = x as u32;
|
||||
self.terrain[y][x].y = y as u32;
|
||||
self.terrain[y][x].height = f32::sin(alpha) * self.cell_max_width();
|
||||
self.terrain[y][x].width = self.cell_max_width();
|
||||
self.terrain[y][x].x = x;
|
||||
self.terrain[y][x].y = y;
|
||||
}
|
||||
}
|
||||
info!("Done generating altitude");
|
||||
|
@ -494,10 +523,10 @@ impl World {
|
|||
let latitude_modifier_2 = f32::cos(latitude_factor);
|
||||
|
||||
let offset_cell_x_1 =
|
||||
(width + x + f32::floor(latitude_modifier_2 * width as f32 / 40.0) as usize)
|
||||
(width + x + f32::floor(latitude_modifier_2 * width as f32 / 20.0) as usize)
|
||||
% width;
|
||||
let offset_cell_x_2 =
|
||||
(width + x + f32::floor(latitude_modifier_2 * width as f32 / 20.0) as usize)
|
||||
(width + x + f32::floor(latitude_modifier_2 * width as f32 / 15.0) as usize)
|
||||
% width;
|
||||
let offset_cell_x_3 =
|
||||
(width + x + f32::floor(latitude_modifier_2 * width as f32 / 10.0) as usize)
|
||||
|
@ -532,7 +561,7 @@ impl World {
|
|||
- (offset_altitude_3 * 0.5)
|
||||
- (offset_altitude_4 * 0.4)
|
||||
- (offset_altitude_5 * 0.5)
|
||||
+ (World::MAX_ALTITUDE * 0.17 * random_noise_2)
|
||||
+ (World::MAX_ALTITUDE * 0.18 * random_noise_2)
|
||||
- (altitude_value * 0.25))
|
||||
/ World::MAX_ALTITUDE;
|
||||
|
||||
|
@ -726,12 +755,9 @@ impl World {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn cell_neighbors(&self, x: u32, y: u32) -> HashMap<CompassDirection, &TerrainCell> {
|
||||
pub fn cell_neighbors(&self, x: usize, y: usize) -> HashMap<CompassDirection, &TerrainCell> {
|
||||
let mut neighbors = HashMap::new();
|
||||
|
||||
let x = x as usize;
|
||||
let y = y as usize;
|
||||
|
||||
let height = self.height as usize;
|
||||
let width = self.width as usize;
|
||||
|
||||
|
@ -905,63 +931,6 @@ impl World {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
fn set_initial_human_groups(&mut self, progress_sender: &Sender<(f32, String)>) -> () {
|
||||
const MAX_GROUPS: u8 = 5;
|
||||
const MINIMUM_PRESENCE: f32 = 0.1;
|
||||
|
||||
let mut placed_groups = 0;
|
||||
let mut tries = 0;
|
||||
while placed_groups < MAX_GROUPS {
|
||||
tries += 1;
|
||||
send_progress(
|
||||
progress_sender,
|
||||
placed_groups as f32 / MAX_GROUPS as f32,
|
||||
format!("Placing initial population: {placed_groups}/{MAX_GROUPS} (try #{tries})"),
|
||||
);
|
||||
|
||||
let x = self.rng.gen_range(0..self.width as usize);
|
||||
let y = self.rng.gen_range(0..self.height as usize);
|
||||
|
||||
let grassland_presence = self.terrain[y][x].biome_presence(BiomeType::Grassland);
|
||||
|
||||
match grassland_presence {
|
||||
Some(presence) => {
|
||||
if presence < MINIMUM_PRESENCE {
|
||||
continue;
|
||||
}
|
||||
},
|
||||
None => continue,
|
||||
}
|
||||
|
||||
let new_human_group = Arc::new(HumanGroup {
|
||||
id: placed_groups as u32,
|
||||
population: 1000,
|
||||
});
|
||||
|
||||
self.human_groups_to_update
|
||||
.push(Arc::<HumanGroup>::downgrade(&new_human_group));
|
||||
self.terrain[y][x].human_groups.push(new_human_group);
|
||||
|
||||
placed_groups += 1;
|
||||
tries = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iterate(&mut self) {
|
||||
for group in self.human_groups_to_update.iter() {
|
||||
if let Some(group) = group.upgrade() {
|
||||
group.update(self);
|
||||
}
|
||||
}
|
||||
self.human_groups_to_update.clear();
|
||||
self.iteration += 1;
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn add_human_group_to_update(&mut self, group: Weak<HumanGroup>) {
|
||||
self.human_groups_to_update.push(group);
|
||||
}
|
||||
}
|
||||
|
||||
fn send_progress<T: Into<String>>(
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::io::{Write, BufReader};
|
||||
|
||||
use {
|
||||
crate::{World, WorldGenError},
|
||||
bevy::{
|
||||
|
@ -14,7 +12,7 @@ use {
|
|||
error::Error,
|
||||
fmt::Display,
|
||||
fs::File,
|
||||
io::{self, BufWriter},
|
||||
io::{self, Read, Write},
|
||||
path::Path,
|
||||
},
|
||||
};
|
||||
|
@ -22,7 +20,7 @@ use {
|
|||
#[derive(Debug)]
|
||||
pub enum LoadError {
|
||||
MissingSave(io::Error),
|
||||
InvalidSave(bincode::Error),
|
||||
InvalidSave(postcard::Error),
|
||||
}
|
||||
impl Error for LoadError {
|
||||
fn source(&self) -> Option<&(dyn Error + 'static)> {
|
||||
|
@ -31,8 +29,15 @@ impl Error for LoadError {
|
|||
LoadError::InvalidSave(error) => Some(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn description(&self) -> &str {
|
||||
"description() is deprecated; use Display"
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&dyn Error> {
|
||||
self.source()
|
||||
}
|
||||
}
|
||||
impl Display for LoadError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
|
@ -48,7 +53,7 @@ impl Display for LoadError {
|
|||
#[derive(Debug)]
|
||||
pub enum SaveError {
|
||||
MissingWorld,
|
||||
SerializationError(bincode::Error),
|
||||
SerializationError(postcard::Error),
|
||||
FailedToWrite(io::Error),
|
||||
}
|
||||
impl Error for SaveError {
|
||||
|
@ -98,31 +103,32 @@ impl WorldManager {
|
|||
return Err(SaveError::MissingWorld);
|
||||
};
|
||||
|
||||
let save_file = match File::create(path) {
|
||||
Ok(save_file) => save_file,
|
||||
Err(err) => return Err(SaveError::FailedToWrite(err)),
|
||||
};
|
||||
|
||||
let serialized = match bincode::serialize(world) {
|
||||
let serialized = match postcard::to_stdvec(world) {
|
||||
Ok(serialized) => serialized,
|
||||
Err(err) => return Err(SaveError::SerializationError(err)),
|
||||
Err(err) => {
|
||||
return Err(SaveError::SerializationError(err));
|
||||
},
|
||||
};
|
||||
|
||||
match BufWriter::new(save_file).write(serialized.as_slice()) {
|
||||
match File::create(path).unwrap().write_all(serialized.as_slice()) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(err) => Err(SaveError::FailedToWrite(err)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_world<P: AsRef<Path>>(&mut self, path: P) -> Result<(), LoadError> {
|
||||
let file = match File::open(path) {
|
||||
let mut file = match File::open(path) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
return Err(LoadError::MissingSave(err));
|
||||
},
|
||||
};
|
||||
|
||||
match bincode::deserialize_from(BufReader::new(file)) {
|
||||
let mut buf = vec![];
|
||||
if let Err(err) = file.read_to_end(&mut buf) {
|
||||
return Err(LoadError::MissingSave(err));
|
||||
};
|
||||
|
||||
match postcard::from_bytes(buf.as_slice()) {
|
||||
Ok(world) => {
|
||||
self.world = Some(world);
|
||||
Ok(())
|
||||
|
@ -136,11 +142,6 @@ impl WorldManager {
|
|||
self.world.as_ref()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn get_world_mut(&mut self) -> Option<&mut World> {
|
||||
self.world.as_mut()
|
||||
}
|
||||
|
||||
pub fn set_world(&mut self, world: World) {
|
||||
self.world = Some(world);
|
||||
}
|
||||
|
@ -152,7 +153,7 @@ impl WorldManager {
|
|||
) -> Task<Result<World, WorldGenError>> {
|
||||
AsyncComputeTaskPool::get().spawn(async move {
|
||||
let seed = seed.unwrap_or_else(random);
|
||||
let mut new_world = World::new(
|
||||
let mut new_world = World::async_new(
|
||||
WorldManager::NEW_WORLD_WIDTH,
|
||||
WorldManager::NEW_WORLD_HEIGHT,
|
||||
seed,
|
||||
|
|
|
@ -44,9 +44,6 @@ impl WindowSystem for TileInfo<'_, '_> {
|
|||
..
|
||||
} = &world.terrain[cursor_y as usize][cursor_x as usize];
|
||||
|
||||
_ = ui.label("Iteration");
|
||||
_ = ui.label(format!("{}", world.iteration));
|
||||
ui.end_row();
|
||||
_ = ui.label("Coordinates");
|
||||
_ = ui.label(format!("{x}:{y}"));
|
||||
ui.end_row();
|
||||
|
|
13
src/main.rs
13
src/main.rs
|
@ -232,11 +232,11 @@ fn update_gui(world: &mut World) {
|
|||
#[cfg(feature = "render")]
|
||||
fn redraw_map(
|
||||
mut should_redraw: ResMut<ShouldRedraw>,
|
||||
world_manager: Res<WorldManager>,
|
||||
mut world_renderer: ResMut<WorldRenderer>,
|
||||
render_settings: Res<WorldRenderSettings>,
|
||||
mut images: ResMut<Assets<Image>>,
|
||||
mut map_sprite: Query<&mut Sprite>,
|
||||
render_settings: Res<WorldRenderSettings>,
|
||||
world_manager: Res<WorldManager>,
|
||||
) {
|
||||
let Some(world) = world_manager.get_world() else {
|
||||
#[cfg(feature = "logging")]
|
||||
|
@ -278,12 +278,6 @@ fn redraw_map(
|
|||
}
|
||||
}
|
||||
|
||||
fn iterate_world(mut world_manager: ResMut<WorldManager>) {
|
||||
if let Some(world) = world_manager.get_world_mut() {
|
||||
world.iterate();
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "render")]
|
||||
const WORLD_SCALE: i32 = 4;
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
@ -309,8 +303,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
.add_system(update_gui)
|
||||
.add_system(update_cursor_map_position)
|
||||
.add_system(open_tile_info)
|
||||
.add_system(redraw_map)
|
||||
.add_system(iterate_world);
|
||||
.add_system(redraw_map);
|
||||
|
||||
app.add_plugins(WorldPlugins);
|
||||
}
|
||||
|
|
|
@ -5,20 +5,13 @@ use {
|
|||
};
|
||||
|
||||
iterable_enum_stringify!(WorldView {
|
||||
Population,
|
||||
Biomes,
|
||||
Topography,
|
||||
Coastlines,
|
||||
Coastlines
|
||||
});
|
||||
impl Default for WorldView {
|
||||
fn default() -> Self {
|
||||
WorldView::Population
|
||||
}
|
||||
}
|
||||
|
||||
iterable_enum_stringify!(WorldOverlay {
|
||||
Temperature,
|
||||
Rainfall,
|
||||
Rainfall
|
||||
});
|
||||
|
||||
#[cfg(feature = "render")]
|
||||
|
@ -51,29 +44,6 @@ impl WorldRenderSettings {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn population_color(world: &World, cell: &TerrainCell) -> Color {
|
||||
let cell_population = cell
|
||||
.human_groups
|
||||
.iter()
|
||||
.map(|group| group.population)
|
||||
.sum::<u32>();
|
||||
|
||||
if cell_population > 0 {
|
||||
debug!(cell.x, cell.y, "Population present");
|
||||
Color::GREEN
|
||||
} else {
|
||||
let color = biome_color(world, cell);
|
||||
|
||||
let grey = color.r() + color.g() + color.b();
|
||||
let r = (color.r() + grey) / 6.0;
|
||||
let g = (color.g() + grey) / 6.0;
|
||||
let b = (color.b() + grey) / 6.0;
|
||||
|
||||
Color::rgb(r, g, b)
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn altitude_contour_color(world: &World, altitude: f32) -> Color {
|
||||
let mut color = Color::rgb(1.0, 0.6, 0.0);
|
||||
|
@ -208,7 +178,6 @@ impl WorldRenderer {
|
|||
WorldView::Biomes => 0,
|
||||
WorldView::Topography => 1,
|
||||
WorldView::Coastlines => 2,
|
||||
WorldView::Population => 3,
|
||||
};
|
||||
let mut overlay_num = 0;
|
||||
for overlay in render_settings.visible_overlays.iter() {
|
||||
|
@ -280,7 +249,6 @@ impl WorldRenderer {
|
|||
WorldView::Biomes => biome_color(world, cell),
|
||||
WorldView::Topography => altitude_contour_color(world, cell.altitude),
|
||||
WorldView::Coastlines => coastline_color(world, cell),
|
||||
WorldView::Population => population_color(world, cell),
|
||||
};
|
||||
let mut normalizer = 1.0;
|
||||
|
||||
|
@ -318,3 +286,9 @@ impl WorldRenderer {
|
|||
Color::rgb(red / normalizer, green / normalizer, blue / normalizer)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for WorldView {
|
||||
fn default() -> Self {
|
||||
WorldView::Biomes
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue