update inspector
added general render distance system
This commit is contained in:
380
Cargo.lock
generated
380
Cargo.lock
generated
@@ -331,13 +331,13 @@ version = "0.23.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb36c3adb02afa4496085250d437217b2a5280d8dd464937c6c5b21bc88830c0"
|
||||
dependencies = [
|
||||
"bevy-inspector-egui-derive",
|
||||
"bevy-inspector-egui-derive 0.23.0",
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
"bevy_core",
|
||||
"bevy_core_pipeline",
|
||||
"bevy_ecs",
|
||||
"bevy_egui",
|
||||
"bevy_egui 0.25.0",
|
||||
"bevy_hierarchy",
|
||||
"bevy_log",
|
||||
"bevy_math",
|
||||
@@ -347,7 +347,38 @@ dependencies = [
|
||||
"bevy_time",
|
||||
"bevy_utils",
|
||||
"bevy_window",
|
||||
"egui",
|
||||
"egui 0.26.2",
|
||||
"image",
|
||||
"once_cell",
|
||||
"pretty-type-name",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy-inspector-egui"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a437cb56d4ca4d3b770889e0bd9c464cfd8e68ef370e232bd39cb4f40d880a7f"
|
||||
dependencies = [
|
||||
"bevy-inspector-egui-derive 0.24.0",
|
||||
"bevy_app",
|
||||
"bevy_asset",
|
||||
"bevy_core",
|
||||
"bevy_core_pipeline",
|
||||
"bevy_ecs",
|
||||
"bevy_egui 0.27.0",
|
||||
"bevy_hierarchy",
|
||||
"bevy_log",
|
||||
"bevy_math",
|
||||
"bevy_pbr",
|
||||
"bevy_reflect",
|
||||
"bevy_render",
|
||||
"bevy_time",
|
||||
"bevy_utils",
|
||||
"bevy_window",
|
||||
"egui 0.27.2",
|
||||
"egui-dropdown",
|
||||
"fuzzy-matcher",
|
||||
"image",
|
||||
"once_cell",
|
||||
"pretty-type-name",
|
||||
@@ -365,6 +396,17 @@ dependencies = [
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy-inspector-egui-derive"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "975d905908c2d621b5a55a6925ac331feac19df430e4c8818b35ef1b95142b14"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_a11y"
|
||||
version = "0.13.2"
|
||||
@@ -578,12 +620,33 @@ checksum = "b84bfb8d4104a1467910cf2090bc6a6d394ebde39c0dbc02397b45aa9ef88e80"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"bevy",
|
||||
"egui",
|
||||
"egui 0.26.2",
|
||||
"thread_local",
|
||||
"web-sys",
|
||||
"webbrowser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_egui"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eac153cb176b04eb0734c60fbc2912aa6fb2539f5b64ba832661c1c4cf9e298a"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"bevy",
|
||||
"console_log",
|
||||
"crossbeam-channel",
|
||||
"egui 0.27.2",
|
||||
"js-sys",
|
||||
"log",
|
||||
"thread_local",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"webbrowser",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bevy_encase_derive"
|
||||
version = "0.13.2"
|
||||
@@ -1307,6 +1370,18 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop-wayland-source"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02"
|
||||
dependencies = [
|
||||
"calloop",
|
||||
"rustix",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "camera_system"
|
||||
version = "0.1.0"
|
||||
@@ -1447,6 +1522,16 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console_log"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f"
|
||||
dependencies = [
|
||||
"log",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-fnv1a-hash"
|
||||
version = "1.1.0"
|
||||
@@ -1698,6 +1783,15 @@ dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ecolor"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20930a432bbd57a6d55e07976089708d4893f3d556cf42a0d79e9e321fa73b10"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui"
|
||||
version = "0.26.2"
|
||||
@@ -1705,10 +1799,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180f595432a5b615fc6b74afef3955249b86cfea72607b40740a4cd60d5297d0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"epaint",
|
||||
"epaint 0.26.2",
|
||||
"nohash-hasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "584c5d1bf9a67b25778a3323af222dbe1a1feb532190e103901187f92c7fe29a"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"epaint 0.27.2",
|
||||
"nohash-hasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui-dropdown"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240e9423d44c6fd18a72208b442b1101ac871f9636c06d30cc6555d125f57db0"
|
||||
dependencies = [
|
||||
"egui 0.27.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.10.0"
|
||||
@@ -1724,6 +1838,15 @@ dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "emath"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4c3a552cfca14630702449d35f41c84a0d15963273771c6059175a803620f3f"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encase"
|
||||
version = "0.7.0"
|
||||
@@ -1765,8 +1888,23 @@ dependencies = [
|
||||
"ab_glyph",
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
"ecolor",
|
||||
"emath",
|
||||
"ecolor 0.26.2",
|
||||
"emath 0.26.2",
|
||||
"nohash-hasher",
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "epaint"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b381f8b149657a4acf837095351839f32cd5c4aec1817fc4df84e18d76334176"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
"ecolor 0.27.2",
|
||||
"emath 0.27.2",
|
||||
"nohash-hasher",
|
||||
"parking_lot",
|
||||
]
|
||||
@@ -1957,6 +2095,15 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuzzy-matcher"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
|
||||
dependencies = [
|
||||
"thread_local",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gethostname"
|
||||
version = "0.4.3"
|
||||
@@ -2563,6 +2710,15 @@ version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metal"
|
||||
version = "0.27.0"
|
||||
@@ -3065,7 +3221,7 @@ name = "phos"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"bevy-inspector-egui",
|
||||
"bevy-inspector-egui 0.23.4",
|
||||
"bevy_rapier3d",
|
||||
"camera_system",
|
||||
"iyes_perf_ui",
|
||||
@@ -3176,6 +3332,15 @@ version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58"
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.35"
|
||||
@@ -3487,12 +3652,31 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sctk-adwaita"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"log",
|
||||
"memmap2",
|
||||
"smithay-client-toolkit",
|
||||
"tiny-skia",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.197"
|
||||
@@ -3585,6 +3769,31 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"calloop",
|
||||
"calloop-wayland-source",
|
||||
"cursor-icon",
|
||||
"libc",
|
||||
"log",
|
||||
"memmap2",
|
||||
"rustix",
|
||||
"thiserror",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-csd-frame",
|
||||
"wayland-cursor",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-wlr",
|
||||
"wayland-scanner",
|
||||
"xkeysym",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smol_str"
|
||||
version = "0.2.1"
|
||||
@@ -3621,6 +3830,12 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strict-num"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
|
||||
|
||||
[[package]]
|
||||
name = "svg_fmt"
|
||||
version = "0.4.2"
|
||||
@@ -3725,6 +3940,31 @@ dependencies = [
|
||||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiny-skia"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec",
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
"log",
|
||||
"tiny-skia-path",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiny-skia-path"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"bytemuck",
|
||||
"strict-num",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
@@ -4028,6 +4268,115 @@ version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"downcast-rs",
|
||||
"rustix",
|
||||
"scoped-tls",
|
||||
"smallvec",
|
||||
"wayland-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.31.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"rustix",
|
||||
"wayland-backend",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-csd-frame"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cursor-icon",
|
||||
"wayland-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-cursor"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71ce5fa868dd13d11a0d04c5e2e65726d0897be8de247c0c5a65886e283231ba"
|
||||
dependencies = [
|
||||
"rustix",
|
||||
"wayland-client",
|
||||
"xcursor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols"
|
||||
version = "0.31.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-plasma"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-wlr"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-scanner"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quick-xml",
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-sys"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af"
|
||||
dependencies = [
|
||||
"dlib",
|
||||
"log",
|
||||
"once_cell",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.69"
|
||||
@@ -4510,6 +4859,7 @@ version = "0.29.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"android-activity",
|
||||
"atomic-waker",
|
||||
"bitflags 2.5.0",
|
||||
@@ -4523,6 +4873,7 @@ dependencies = [
|
||||
"js-sys",
|
||||
"libc",
|
||||
"log",
|
||||
"memmap2",
|
||||
"ndk",
|
||||
"ndk-sys",
|
||||
"objc2 0.4.1",
|
||||
@@ -4532,10 +4883,16 @@ dependencies = [
|
||||
"raw-window-handle 0.6.0",
|
||||
"redox_syscall 0.3.5",
|
||||
"rustix",
|
||||
"sctk-adwaita",
|
||||
"smithay-client-toolkit",
|
||||
"smol_str",
|
||||
"unicode-segmentation",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-plasma",
|
||||
"web-sys",
|
||||
"web-time",
|
||||
"windows-sys 0.48.0",
|
||||
@@ -4559,6 +4916,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"asset_loader",
|
||||
"bevy",
|
||||
"bevy-inspector-egui 0.24.0",
|
||||
"noise 0.9.0",
|
||||
"rayon",
|
||||
"serde",
|
||||
@@ -4597,6 +4955,12 @@ version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34"
|
||||
|
||||
[[package]]
|
||||
name = "xcursor"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911"
|
||||
|
||||
[[package]]
|
||||
name = "xi-unicode"
|
||||
version = "0.3.0"
|
||||
|
||||
@@ -12,3 +12,4 @@ serde = {version="1.0.197", features=["derive"]}
|
||||
serde_json = "1.0.115"
|
||||
asset_loader = {path = "../asset_loader"}
|
||||
rayon = "1.10.0"
|
||||
bevy-inspector-egui = "0.24.0"
|
||||
|
||||
@@ -54,7 +54,7 @@ fn create_tile_collider(
|
||||
if n_height < pos.y {
|
||||
create_tile_wall_collider(
|
||||
idx,
|
||||
Vec3::new(pos.x, n_height.min(pos.y - 0.5), pos.z),
|
||||
Vec3::new(pos.x, n_height.min(pos.y - OUTER_RADIUS / 2.), pos.z),
|
||||
i,
|
||||
verts,
|
||||
indices,
|
||||
|
||||
@@ -141,9 +141,7 @@ impl HexCoord {
|
||||
}
|
||||
|
||||
pub fn distance(&self, other: &HexCoord) -> i32 {
|
||||
return (self.hex.x - other.hex.x).abs()
|
||||
+ (self.hex.y - other.hex.y).abs()
|
||||
+ (self.hex.z - other.hex.z).abs();
|
||||
return (self.hex.x - other.hex.x).abs() + (self.hex.y - other.hex.y).abs() + (self.hex.z - other.hex.z).abs();
|
||||
}
|
||||
|
||||
pub fn rotate_around(&self, center: &HexCoord, angle: i32) -> HexCoord {
|
||||
|
||||
@@ -11,8 +11,10 @@ pub mod prelude {
|
||||
use crate::hex_utils::{HexCoord, INNER_RADIUS, OUTER_RADIUS};
|
||||
use bevy::math::{IVec2, UVec2, Vec2, Vec3};
|
||||
use bevy::prelude::Resource;
|
||||
use bevy::prelude::*;
|
||||
use bevy::render::mesh::MeshVertexAttribute;
|
||||
use bevy::render::render_resource::VertexFormat;
|
||||
use bevy_inspector_egui::InspectorOptions;
|
||||
pub const TEX_MULTI: Vec2 = Vec2::new(1000., 1.);
|
||||
|
||||
pub const HEX_CORNERS: [Vec3; 6] = [
|
||||
@@ -25,30 +27,16 @@ pub mod prelude {
|
||||
];
|
||||
|
||||
pub const HEX_NORMALS: [Vec3; 6] = [
|
||||
Vec3::new(
|
||||
INNER_RADIUS / 2.,
|
||||
0.,
|
||||
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.,
|
||||
),
|
||||
Vec3::new(INNER_RADIUS / 2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.),
|
||||
Vec3::Z,
|
||||
Vec3::new(
|
||||
INNER_RADIUS / -2.,
|
||||
0.,
|
||||
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.,
|
||||
),
|
||||
Vec3::new(
|
||||
INNER_RADIUS / -2.,
|
||||
0.,
|
||||
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.,
|
||||
),
|
||||
Vec3::new(INNER_RADIUS / -2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / 2.),
|
||||
Vec3::new(INNER_RADIUS / -2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.),
|
||||
Vec3::NEG_Z,
|
||||
Vec3::new(
|
||||
INNER_RADIUS / 2.,
|
||||
0.,
|
||||
(OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.,
|
||||
),
|
||||
Vec3::new(INNER_RADIUS / 2., 0., (OUTER_RADIUS + 0.5 * OUTER_RADIUS) / -2.),
|
||||
];
|
||||
|
||||
#[derive(Resource, Reflect, Default)]
|
||||
#[reflect(Resource)]
|
||||
pub struct GenerationConfig {
|
||||
pub noise_scale: f64,
|
||||
pub sea_level: f64,
|
||||
@@ -66,6 +54,7 @@ pub mod prelude {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Reflect, InspectorOptions)]
|
||||
pub struct GeneratorLayer {
|
||||
pub strength: f64,
|
||||
pub min_value: f64,
|
||||
|
||||
@@ -1,37 +1,28 @@
|
||||
use crate::prelude::PhosCamera;
|
||||
use bevy::core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAntiAliasPlugin};
|
||||
use bevy::input::mouse::MouseMotion;
|
||||
use bevy::pbr::ScreenSpaceAmbientOcclusionBundle;
|
||||
use bevy::prelude::*;
|
||||
use bevy::window::CursorGrabMode;
|
||||
|
||||
pub mod prelude {
|
||||
use bevy::prelude::Component;
|
||||
|
||||
#[derive(Component, Default)]
|
||||
pub struct PhosCamera {
|
||||
pub min_height: f32,
|
||||
pub max_height: f32,
|
||||
pub speed: f32,
|
||||
}
|
||||
}
|
||||
pub mod prelude;
|
||||
|
||||
pub struct PhosCameraPlugin;
|
||||
|
||||
impl Plugin for PhosCameraPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(Startup, setup).add_systems(
|
||||
Update,
|
||||
(grab_mouse, (update_camera, update_camera_mouse).chain()),
|
||||
);
|
||||
app.add_systems(Startup, setup)
|
||||
.add_systems(Update, (grab_mouse, (update_camera, update_camera_mouse).chain()));
|
||||
|
||||
app.add_plugins(TemporalAntiAliasPlugin);
|
||||
}
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands) {
|
||||
fn setup(mut commands: Commands, mut msaa: ResMut<Msaa>) {
|
||||
commands
|
||||
.spawn((
|
||||
Camera3dBundle {
|
||||
transform: Transform::from_xyz(0., 30., 0.)
|
||||
.looking_at(Vec3::new(1000., 0., 1000.), Vec3::Y),
|
||||
transform: Transform::from_xyz(0., 30., 0.).looking_at(Vec3::new(1000., 0., 1000.), Vec3::Y),
|
||||
..default()
|
||||
},
|
||||
PhosCamera {
|
||||
@@ -39,7 +30,10 @@ fn setup(mut commands: Commands) {
|
||||
..default()
|
||||
},
|
||||
))
|
||||
.insert(ScreenSpaceAmbientOcclusionBundle::default());
|
||||
.insert(ScreenSpaceAmbientOcclusionBundle::default())
|
||||
.insert(TemporalAntiAliasBundle::default());
|
||||
|
||||
*msaa = Msaa::Off;
|
||||
}
|
||||
fn update_camera(
|
||||
mut cam_query: Query<(&PhosCamera, &mut Transform)>,
|
||||
@@ -106,16 +100,11 @@ fn update_camera_mouse(
|
||||
pitch = pitch.clamp(-1.54, 1.54);
|
||||
|
||||
// Order is important to prevent unintended roll
|
||||
transform.rotation =
|
||||
Quat::from_axis_angle(Vec3::Y, yaw) * Quat::from_axis_angle(Vec3::X, pitch);
|
||||
transform.rotation = Quat::from_axis_angle(Vec3::Y, yaw) * Quat::from_axis_angle(Vec3::X, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
fn grab_mouse(
|
||||
mut windows: Query<&mut Window>,
|
||||
mouse: Res<ButtonInput<MouseButton>>,
|
||||
key: Res<ButtonInput<KeyCode>>,
|
||||
) {
|
||||
fn grab_mouse(mut windows: Query<&mut Window>, mouse: Res<ButtonInput<MouseButton>>, key: Res<ButtonInput<KeyCode>>) {
|
||||
let mut window = windows.single_mut();
|
||||
|
||||
if mouse.just_pressed(MouseButton::Middle) {
|
||||
@@ -128,3 +117,8 @@ fn grab_mouse(
|
||||
window.cursor.grab_mode = CursorGrabMode::None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn rts_camera_system(){
|
||||
|
||||
}
|
||||
14
game/camera_system/src/prelude.rs
Normal file
14
game/camera_system/src/prelude.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Component, Default)]
|
||||
pub struct PhosCamera {
|
||||
pub min_height: f32,
|
||||
pub max_height: f32,
|
||||
pub speed: f32,
|
||||
pub zoom_speed: f32,
|
||||
}
|
||||
|
||||
pub struct CameraBounds {
|
||||
pub min: Vec2,
|
||||
pub max: Vec2,
|
||||
}
|
||||
@@ -8,6 +8,7 @@ mod map_init;
|
||||
mod phos;
|
||||
mod prelude;
|
||||
mod shader_extensions;
|
||||
mod utlis;
|
||||
use phos::PhosGamePlugin;
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -1,33 +1,43 @@
|
||||
use bevy::{asset::LoadState, pbr::ExtendedMaterial, prelude::*};
|
||||
use bevy_inspector_egui::quick::ResourceInspectorPlugin;
|
||||
use bevy_rapier3d::geometry::{Collider, TriMeshFlags};
|
||||
use camera_system::prelude::PhosCamera;
|
||||
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
||||
use world_generation::{
|
||||
biome_painter::*, chunk_colliders::generate_chunk_collider, heightmap::generate_heightmap,
|
||||
hex_utils::offset_to_world, mesh_generator::generate_chunk_mesh, prelude::*, tile_manager::*,
|
||||
biome_painter::*,
|
||||
chunk_colliders::generate_chunk_collider,
|
||||
heightmap::generate_heightmap,
|
||||
hex_utils::{offset_to_world, tile_to_world_distance},
|
||||
mesh_generator::generate_chunk_mesh,
|
||||
prelude::*,
|
||||
tile_manager::*,
|
||||
tile_mapper::*,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
prelude::{ChunkAtlas, PhosChunk, PhosMap},
|
||||
shader_extensions::chunk_material::ChunkMaterial,
|
||||
utlis::render_distance_system::RenderDistanceVisibility,
|
||||
};
|
||||
|
||||
pub struct MapInitPlugin;
|
||||
|
||||
impl Plugin for MapInitPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(Startup, init_map)
|
||||
.add_systems(Startup, (load_textures, load_tiles, create_map).chain());
|
||||
app.add_plugins((
|
||||
ResourceInspectorPlugin::<PhosMap>::default(),
|
||||
ResourceInspectorPlugin::<GenerationConfig>::default(),
|
||||
));
|
||||
|
||||
app.add_systems(Update, (finalize_texture, spawn_map));
|
||||
app.add_systems(Startup, (load_textures, load_tiles, create_map));
|
||||
|
||||
app.add_systems(Update, finalize_texture);
|
||||
app.add_systems(PostUpdate, (despawn_map, spawn_map).chain());
|
||||
app.insert_resource(TileManager::default());
|
||||
app.insert_resource(PhosMap::default());
|
||||
}
|
||||
}
|
||||
|
||||
fn init_map(mut commands: Commands) {
|
||||
commands.insert_resource(PhosMap::default());
|
||||
commands.insert_resource(TileManager::default());
|
||||
}
|
||||
|
||||
fn load_textures(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
let main_tex = asset_server.load("textures/world/stack.png");
|
||||
commands.insert_resource(ChunkAtlas {
|
||||
@@ -77,69 +87,88 @@ fn finalize_texture(
|
||||
map.regenerate = true;
|
||||
}
|
||||
|
||||
fn create_map(mut commands: Commands) {
|
||||
let heightmap = generate_heightmap(
|
||||
&GenerationConfig {
|
||||
layers: vec![
|
||||
GeneratorLayer {
|
||||
base_roughness: 2.14,
|
||||
roughness: 0.87,
|
||||
strength: 2.93,
|
||||
min_value: -0.2,
|
||||
persistence: 0.77,
|
||||
is_rigid: false,
|
||||
weight: 0.,
|
||||
weight_multi: 0.,
|
||||
layers: 4,
|
||||
first_layer_mask: false,
|
||||
},
|
||||
GeneratorLayer {
|
||||
base_roughness: 2.85,
|
||||
roughness: 2.,
|
||||
strength: -0.23,
|
||||
min_value: -0.,
|
||||
persistence: 1.,
|
||||
is_rigid: false,
|
||||
weight: 0.,
|
||||
weight_multi: 0.,
|
||||
layers: 4,
|
||||
first_layer_mask: false,
|
||||
},
|
||||
GeneratorLayer {
|
||||
base_roughness: 2.6,
|
||||
roughness: 4.,
|
||||
strength: 10.44,
|
||||
min_value: 0.,
|
||||
persistence: 1.57,
|
||||
is_rigid: true,
|
||||
weight: 1.,
|
||||
weight_multi: 0.35,
|
||||
layers: 4,
|
||||
first_layer_mask: true,
|
||||
},
|
||||
GeneratorLayer {
|
||||
base_roughness: 3.87,
|
||||
roughness: 5.8,
|
||||
strength: -1.,
|
||||
min_value: 0.,
|
||||
persistence: 0.,
|
||||
is_rigid: true,
|
||||
weight: 1.,
|
||||
weight_multi: 4.57,
|
||||
layers: 3,
|
||||
first_layer_mask: true,
|
||||
},
|
||||
],
|
||||
noise_scale: 350.,
|
||||
sea_level: 4.,
|
||||
border_size: 64.,
|
||||
size: UVec2::splat(1024 / Chunk::SIZE as u32),
|
||||
// size: UVec2::splat(1),
|
||||
},
|
||||
4,
|
||||
);
|
||||
fn create_map(mut commands: Commands, mut cam: Query<&mut Transform, With<PhosCamera>>) {
|
||||
let config = GenerationConfig {
|
||||
layers: vec![
|
||||
GeneratorLayer {
|
||||
base_roughness: 2.14,
|
||||
roughness: 0.87,
|
||||
strength: 2.93,
|
||||
min_value: -0.2,
|
||||
persistence: 0.77,
|
||||
is_rigid: false,
|
||||
weight: 0.,
|
||||
weight_multi: 0.,
|
||||
layers: 4,
|
||||
first_layer_mask: false,
|
||||
},
|
||||
GeneratorLayer {
|
||||
base_roughness: 2.85,
|
||||
roughness: 2.,
|
||||
strength: -0.23,
|
||||
min_value: -0.,
|
||||
persistence: 1.,
|
||||
is_rigid: false,
|
||||
weight: 0.,
|
||||
weight_multi: 0.,
|
||||
layers: 4,
|
||||
first_layer_mask: false,
|
||||
},
|
||||
GeneratorLayer {
|
||||
base_roughness: 2.6,
|
||||
roughness: 4.,
|
||||
strength: 4.3,
|
||||
min_value: 0.,
|
||||
persistence: 1.57,
|
||||
is_rigid: true,
|
||||
weight: 1.,
|
||||
weight_multi: 0.35,
|
||||
layers: 4,
|
||||
first_layer_mask: true,
|
||||
},
|
||||
GeneratorLayer {
|
||||
base_roughness: 3.87,
|
||||
roughness: 5.8,
|
||||
strength: -1.,
|
||||
min_value: 0.,
|
||||
persistence: 0.,
|
||||
is_rigid: true,
|
||||
weight: 1.,
|
||||
weight_multi: 4.57,
|
||||
layers: 3,
|
||||
first_layer_mask: true,
|
||||
},
|
||||
GeneratorLayer {
|
||||
base_roughness: 3.87,
|
||||
roughness: 5.8,
|
||||
strength: -1.5,
|
||||
min_value: 0.,
|
||||
persistence: 0.3,
|
||||
is_rigid: true,
|
||||
weight: 1.,
|
||||
weight_multi: 4.57,
|
||||
layers: 3,
|
||||
first_layer_mask: true,
|
||||
},
|
||||
],
|
||||
noise_scale: 450.,
|
||||
sea_level: 8.5,
|
||||
border_size: 64.,
|
||||
size: UVec2::splat(1024 / Chunk::SIZE as u32),
|
||||
// size: UVec2::splat(1),
|
||||
};
|
||||
let heightmap = generate_heightmap(&config, 4);
|
||||
|
||||
commands.insert_resource(heightmap);
|
||||
|
||||
// let mut cam_t = cam.single_mut();
|
||||
// cam_t.translation = Vec3::new(
|
||||
// tile_to_world_distance(config.size.x as i32 / 2),
|
||||
// cam_t.translation.y,
|
||||
// tile_to_world_distance(config.size.y as i32 / 2),
|
||||
// );
|
||||
|
||||
commands.insert_resource(config);
|
||||
}
|
||||
|
||||
fn spawn_map(
|
||||
@@ -172,8 +201,7 @@ fn spawn_map(
|
||||
.chunks
|
||||
.par_iter()
|
||||
.map(|chunk: &Chunk| {
|
||||
let mesh =
|
||||
generate_chunk_mesh(chunk, &heightmap, cur_painter, &tile_assets, &tile_mappers);
|
||||
let mesh = generate_chunk_mesh(chunk, &heightmap, cur_painter, &tile_assets, &tile_mappers);
|
||||
let collision = generate_chunk_collider(chunk, &heightmap);
|
||||
return (
|
||||
mesh,
|
||||
@@ -192,11 +220,29 @@ fn spawn_map(
|
||||
..default()
|
||||
},
|
||||
PhosChunk,
|
||||
Collider::trimesh_with_flags(
|
||||
col_verts,
|
||||
col_indicies,
|
||||
TriMeshFlags::MERGE_DUPLICATE_VERTICES,
|
||||
),
|
||||
RenderDistanceVisibility::default().with_offset(Vec3::new(
|
||||
tile_to_world_distance(Chunk::SIZE as i32 / 2),
|
||||
0.,
|
||||
tile_to_world_distance(Chunk::SIZE as i32 / 2),
|
||||
)),
|
||||
Collider::trimesh_with_flags(col_verts, col_indicies, TriMeshFlags::MERGE_DUPLICATE_VERTICES),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn despawn_map(
|
||||
mut commands: Commands,
|
||||
mut heightmap: ResMut<Map>,
|
||||
cfg: Res<GenerationConfig>,
|
||||
map: Res<PhosMap>,
|
||||
chunks: Query<Entity, With<PhosChunk>>,
|
||||
) {
|
||||
if !map.regenerate {
|
||||
return;
|
||||
}
|
||||
for chunk in chunks.iter() {
|
||||
commands.entity(chunk).despawn();
|
||||
}
|
||||
|
||||
*heightmap = generate_heightmap(&cfg, 4);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::map_init::MapInitPlugin;
|
||||
use crate::prelude::*;
|
||||
use crate::shader_extensions::chunk_material::ChunkMaterial;
|
||||
use crate::utlis::render_distance_system::RenderDistancePlugin;
|
||||
use bevy::pbr::ExtendedMaterial;
|
||||
use bevy::{
|
||||
pbr::{wireframe::WireframeConfig, CascadeShadowConfig},
|
||||
@@ -9,12 +10,10 @@ use bevy::{
|
||||
use bevy_rapier3d::dynamics::{Ccd, RigidBody, Velocity};
|
||||
use bevy_rapier3d::geometry::Collider;
|
||||
use bevy_rapier3d::plugin::{NoUserData, RapierPhysicsPlugin};
|
||||
use bevy_rapier3d::render::RapierDebugRenderPlugin;
|
||||
use camera_system::prelude::PhosCamera;
|
||||
use camera_system::PhosCameraPlugin;
|
||||
use iyes_perf_ui::prelude::*;
|
||||
use world_generation::biome_painter::BiomePainterPlugin;
|
||||
use world_generation::prelude::*;
|
||||
use world_generation::tile_manager::TileAssetPlugin;
|
||||
use world_generation::tile_mapper::TileMapperAssetPlugin;
|
||||
|
||||
@@ -26,13 +25,14 @@ impl Plugin for PhosGamePlugin {
|
||||
PhosCameraPlugin,
|
||||
MapInitPlugin,
|
||||
MaterialPlugin::<ExtendedMaterial<StandardMaterial, ChunkMaterial>>::default(),
|
||||
RenderDistancePlugin,
|
||||
));
|
||||
|
||||
//Systems - Startup
|
||||
app.add_systems(Startup, init_game);
|
||||
|
||||
//Systems - Update
|
||||
app.add_systems(Update, (spawn_sphere, render_distance_system));
|
||||
app.add_systems(Update, spawn_sphere);
|
||||
|
||||
//Perf UI
|
||||
app.add_plugins(bevy::diagnostic::FrameTimeDiagnosticsPlugin)
|
||||
@@ -111,19 +111,3 @@ fn spawn_sphere(
|
||||
));
|
||||
}
|
||||
}
|
||||
fn render_distance_system(
|
||||
mut chunks: Query<(&Transform, &mut Visibility), With<PhosChunk>>,
|
||||
camera: Query<&Transform, With<PhosCamera>>,
|
||||
) {
|
||||
let cam = camera.single();
|
||||
for (transform, mut visibility) in chunks.iter_mut() {
|
||||
let dist = (transform.translation - cam.translation
|
||||
+ Vec3::new((Chunk::SIZE / 2) as f32, 0., (Chunk::SIZE / 2) as f32))
|
||||
.length();
|
||||
if dist > 500. {
|
||||
*visibility = Visibility::Hidden;
|
||||
} else {
|
||||
*visibility = Visibility::Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use bevy::asset::Handle;
|
||||
use bevy::prelude::*;
|
||||
use bevy::prelude::{Component, Image, Resource};
|
||||
use bevy::reflect::Reflect;
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct ChunkAtlas {
|
||||
@@ -7,7 +9,8 @@ pub struct ChunkAtlas {
|
||||
pub is_loaded: bool,
|
||||
}
|
||||
|
||||
#[derive(Resource, Default)]
|
||||
#[derive(Resource, Default, Reflect)]
|
||||
#[reflect(Resource)]
|
||||
pub struct PhosMap {
|
||||
pub ready: bool,
|
||||
pub regenerate: bool,
|
||||
|
||||
1
game/main/src/utlis/mod.rs
Normal file
1
game/main/src/utlis/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod render_distance_system;
|
||||
75
game/main/src/utlis/render_distance_system.rs
Normal file
75
game/main/src/utlis/render_distance_system.rs
Normal file
@@ -0,0 +1,75 @@
|
||||
use bevy::prelude::*;
|
||||
use camera_system::prelude::PhosCamera;
|
||||
|
||||
pub struct RenderDistancePlugin;
|
||||
|
||||
impl Plugin for RenderDistancePlugin {
|
||||
fn build(&self, app: &mut bevy::prelude::App) {
|
||||
app.register_type::<RenderDistanceSettings>();
|
||||
app.add_systems(PostUpdate, render_distance_system)
|
||||
.insert_resource(RenderDistanceSettings::default());
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Resource, Reflect)]
|
||||
#[reflect(Resource)]
|
||||
pub struct RenderDistanceSettings {
|
||||
pub render_distance: f32,
|
||||
}
|
||||
|
||||
impl RenderDistanceSettings {
|
||||
pub fn new(distance: f32) -> Self {
|
||||
return Self {
|
||||
render_distance: distance,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for RenderDistanceSettings {
|
||||
fn default() -> Self {
|
||||
Self::new(500.)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct RenderDistanceVisibility {
|
||||
pub distance_multiplier: f32,
|
||||
pub offset: Vec3,
|
||||
}
|
||||
|
||||
impl RenderDistanceVisibility {
|
||||
pub fn with_offset(mut self, offset: Vec3) -> Self {
|
||||
self.offset = offset;
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn with_multiplier(mut self, distance_multiplier: f32) -> Self {
|
||||
self.distance_multiplier = distance_multiplier;
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for RenderDistanceVisibility {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
distance_multiplier: 1.,
|
||||
offset: Vec3::ZERO,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn render_distance_system(
|
||||
mut objects: Query<(&Transform, &mut Visibility, &RenderDistanceVisibility)>,
|
||||
camera_query: Query<&Transform, With<PhosCamera>>,
|
||||
settings: Res<RenderDistanceSettings>,
|
||||
) {
|
||||
let camera = camera_query.single();
|
||||
for (t, mut vis, r) in objects.iter_mut() {
|
||||
let dist = (camera.translation - (t.translation + r.offset)).length() * r.distance_multiplier;
|
||||
if settings.render_distance < dist {
|
||||
*vis = Visibility::Hidden;
|
||||
} else {
|
||||
*vis = Visibility::Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
hard_tabs=true
|
||||
hard_tabs=true
|
||||
max_width=120
|
||||
Reference in New Issue
Block a user