This commit is contained in:
Leon Liu 2025-08-14 05:46:48 +09:00
parent ebf470f312
commit aa1ad4fbd7
4 changed files with 941 additions and 107 deletions

633
Cargo.lock generated
View File

@ -2,6 +2,22 @@
# It is not intended for manual editing.
version = 4
[[package]]
name = "ab_glyph"
version = "0.2.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e074464580a518d16a7126262fffaaa47af89d4099d4cb403f8ed938ba12ee7d"
dependencies = [
"ab_glyph_rasterizer",
"owned_ttf_parser",
]
[[package]]
name = "ab_glyph_rasterizer"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
[[package]]
name = "accesskit"
version = "0.18.0"
@ -28,9 +44,9 @@ dependencies = [
"accesskit",
"accesskit_consumer",
"hashbrown",
"objc2",
"objc2-app-kit",
"objc2-foundation",
"objc2 0.5.2",
"objc2-app-kit 0.2.2",
"objc2-foundation 0.2.2",
]
[[package]]
@ -67,6 +83,19 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "ahash"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
dependencies = [
"cfg-if",
"getrandom 0.3.3",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "aho-corasick"
version = "1.1.3"
@ -149,6 +178,26 @@ dependencies = [
"num-traits",
]
[[package]]
name = "arboard"
version = "3.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55f533f8e0af236ffe5eb979b99381df3258853f00ba2e44b6e1955292c75227"
dependencies = [
"clipboard-win",
"image",
"log",
"objc2 0.6.1",
"objc2-app-kit 0.3.1",
"objc2-core-foundation",
"objc2-core-graphics",
"objc2-foundation 0.3.1",
"parking_lot",
"percent-encoding",
"windows-sys 0.59.0",
"x11rb",
]
[[package]]
name = "arrayref"
version = "0.3.9"
@ -303,6 +352,51 @@ dependencies = [
"bevy_internal",
]
[[package]]
name = "bevy-inspector-egui"
version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0fec4d47c4a61bc1e9f85e63fb9faa649553811aa44ef61d4c04a776c9c0b44"
dependencies = [
"bevy-inspector-egui-derive",
"bevy_app",
"bevy_asset",
"bevy_color",
"bevy_core_pipeline",
"bevy_ecs",
"bevy_egui",
"bevy_image",
"bevy_log",
"bevy_math",
"bevy_pbr",
"bevy_platform",
"bevy_reflect",
"bevy_render",
"bevy_state",
"bevy_time",
"bevy_utils",
"bevy_window",
"bytemuck",
"disqualified",
"egui",
"fuzzy-matcher",
"image",
"smallvec",
"uuid",
"winit",
]
[[package]]
name = "bevy-inspector-egui-derive"
version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dbc1d8bba3b647207d73d3e212669977e2259a0c2a79360812a3665b9a3acc7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "bevy_a11y"
version = "0.16.1"
@ -338,7 +432,7 @@ dependencies = [
"bevy_utils",
"blake3",
"derive_more",
"downcast-rs",
"downcast-rs 2.0.1",
"either",
"petgraph",
"ron",
@ -365,7 +459,7 @@ dependencies = [
"cfg-if",
"console_error_panic_hook",
"ctrlc",
"downcast-rs",
"downcast-rs 2.0.1",
"log",
"thiserror 2.0.14",
"variadics_please",
@ -396,7 +490,7 @@ dependencies = [
"crossbeam-channel",
"derive_more",
"disqualified",
"downcast-rs",
"downcast-rs 2.0.1",
"either",
"futures-io",
"futures-lite",
@ -591,6 +685,44 @@ dependencies = [
"syn",
]
[[package]]
name = "bevy_egui"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a88030fa6940bb976943bee1a23271b8505cc3e07b4f699b44657bc7062ce69"
dependencies = [
"arboard",
"bevy_app",
"bevy_asset",
"bevy_core_pipeline",
"bevy_derive",
"bevy_ecs",
"bevy_image",
"bevy_input",
"bevy_log",
"bevy_math",
"bevy_platform",
"bevy_reflect",
"bevy_render",
"bevy_tasks",
"bevy_time",
"bevy_transform",
"bevy_window",
"bevy_winit",
"bytemuck",
"crossbeam-channel",
"egui",
"encase",
"image",
"js-sys",
"thread_local",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"wgpu-types",
"winit",
]
[[package]]
name = "bevy_encase_derive"
version = "0.16.1"
@ -985,7 +1117,7 @@ dependencies = [
"bevy_utils",
"derive_more",
"disqualified",
"downcast-rs",
"downcast-rs 2.0.1",
"erased-serde",
"foldhash",
"glam",
@ -1041,7 +1173,7 @@ dependencies = [
"bytemuck",
"codespan-reporting",
"derive_more",
"downcast-rs",
"downcast-rs 2.0.1",
"encase",
"fixedbitset",
"futures-lite",
@ -1448,7 +1580,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
dependencies = [
"objc2",
"objc2 0.5.2",
]
[[package]]
@ -1522,6 +1654,18 @@ dependencies = [
"thiserror 1.0.69",
]
[[package]]
name = "calloop-wayland-source"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
dependencies = [
"calloop",
"rustix 0.38.44",
"wayland-backend",
"wayland-client",
]
[[package]]
name = "cc"
version = "1.2.32"
@ -1571,6 +1715,15 @@ dependencies = [
"libloading",
]
[[package]]
name = "clipboard-win"
version = "5.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4"
dependencies = [
"error-code",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@ -1863,6 +2016,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
[[package]]
name = "dispatch2"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
dependencies = [
"bitflags 2.9.1",
"objc2 0.6.1",
]
[[package]]
name = "disqualified"
version = "1.0.0"
@ -1887,6 +2050,12 @@ dependencies = [
"litrs",
]
[[package]]
name = "downcast-rs"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "downcast-rs"
version = "2.0.1"
@ -1899,12 +2068,47 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
[[package]]
name = "ecolor"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a631732d995184114016fab22fc7e3faf73d6841c2d7650395fe251fbcd9285"
dependencies = [
"bytemuck",
"emath",
]
[[package]]
name = "egui"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8470210c95a42cc985d9ffebfd5067eea55bdb1c3f7611484907db9639675e28"
dependencies = [
"ahash",
"bitflags 2.9.1",
"emath",
"epaint",
"nohash-hasher",
"profiling",
"smallvec",
"unicode-segmentation",
]
[[package]]
name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "emath"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45f057b141e7e46340c321400be74b793543b1b213036f0f989c35d35957c32e"
dependencies = [
"bytemuck",
]
[[package]]
name = "encase"
version = "0.10.0"
@ -1937,6 +2141,29 @@ dependencies = [
"syn",
]
[[package]]
name = "epaint"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94cca02195f0552c17cabdc02f39aa9ab6fbd815dac60ab1cd3d5b0aa6f9551c"
dependencies = [
"ab_glyph",
"ahash",
"bytemuck",
"ecolor",
"emath",
"epaint_default_fonts",
"nohash-hasher",
"parking_lot",
"profiling",
]
[[package]]
name = "epaint_default_fonts"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8495e11ed527dff39663b8c36b6c2b2799d7e4287fb90556e455d72eca0b4d3"
[[package]]
name = "equivalent"
version = "1.0.2"
@ -1963,6 +2190,12 @@ dependencies = [
"windows-sys 0.60.2",
]
[[package]]
name = "error-code"
version = "3.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59"
[[package]]
name = "euclid"
version = "0.22.11"
@ -2129,6 +2362,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"
@ -2431,6 +2673,7 @@ dependencies = [
"byteorder-lite",
"num-traits",
"png",
"tiff",
]
[[package]]
@ -2545,6 +2788,12 @@ dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07"
[[package]]
name = "js-sys"
version = "0.3.77"
@ -2868,6 +3117,12 @@ dependencies = [
"libc",
]
[[package]]
name = "nohash-hasher"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]
name = "nom"
version = "7.1.3"
@ -2971,6 +3226,15 @@ dependencies = [
"objc2-encode",
]
[[package]]
name = "objc2"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88c6597e14493ab2e44ce58f2fdecf095a51f12ca57bec060a11c57332520551"
dependencies = [
"objc2-encode",
]
[[package]]
name = "objc2-app-kit"
version = "0.2.2"
@ -2980,13 +3244,25 @@ dependencies = [
"bitflags 2.9.1",
"block2",
"libc",
"objc2",
"objc2 0.5.2",
"objc2-core-data",
"objc2-core-image",
"objc2-foundation",
"objc2-foundation 0.2.2",
"objc2-quartz-core",
]
[[package]]
name = "objc2-app-kit"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6f29f568bec459b0ddff777cec4fe3fd8666d82d5a40ebd0ff7e66134f89bcc"
dependencies = [
"bitflags 2.9.1",
"objc2 0.6.1",
"objc2-core-graphics",
"objc2-foundation 0.3.1",
]
[[package]]
name = "objc2-cloud-kit"
version = "0.2.2"
@ -2995,9 +3271,9 @@ checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
dependencies = [
"bitflags 2.9.1",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-core-location",
"objc2-foundation",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3007,8 +3283,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
"objc2 0.5.2",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3019,8 +3295,8 @@ checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
dependencies = [
"bitflags 2.9.1",
"block2",
"objc2",
"objc2-foundation",
"objc2 0.5.2",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3030,6 +3306,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
dependencies = [
"bitflags 2.9.1",
"dispatch2",
"objc2 0.6.1",
]
[[package]]
name = "objc2-core-graphics"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "989c6c68c13021b5c2d6b71456ebb0f9dc78d752e86a98da7c716f4f9470f5a4"
dependencies = [
"bitflags 2.9.1",
"dispatch2",
"objc2 0.6.1",
"objc2-core-foundation",
"objc2-io-surface",
]
[[package]]
@ -3039,8 +3330,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
"objc2 0.5.2",
"objc2-foundation 0.2.2",
"objc2-metal",
]
@ -3051,9 +3342,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
dependencies = [
"block2",
"objc2",
"objc2 0.5.2",
"objc2-contacts",
"objc2-foundation",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3072,7 +3363,29 @@ dependencies = [
"block2",
"dispatch",
"libc",
"objc2",
"objc2 0.5.2",
]
[[package]]
name = "objc2-foundation"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c"
dependencies = [
"bitflags 2.9.1",
"objc2 0.6.1",
"objc2-core-foundation",
]
[[package]]
name = "objc2-io-surface"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7282e9ac92529fa3457ce90ebb15f4ecbc383e8338060960760fa2cf75420c3c"
dependencies = [
"bitflags 2.9.1",
"objc2 0.6.1",
"objc2-core-foundation",
]
[[package]]
@ -3082,9 +3395,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
dependencies = [
"block2",
"objc2",
"objc2-app-kit",
"objc2-foundation",
"objc2 0.5.2",
"objc2-app-kit 0.2.2",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3095,8 +3408,8 @@ checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
dependencies = [
"bitflags 2.9.1",
"block2",
"objc2",
"objc2-foundation",
"objc2 0.5.2",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3107,8 +3420,8 @@ checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
dependencies = [
"bitflags 2.9.1",
"block2",
"objc2",
"objc2-foundation",
"objc2 0.5.2",
"objc2-foundation 0.2.2",
"objc2-metal",
]
@ -3118,8 +3431,8 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
dependencies = [
"objc2",
"objc2-foundation",
"objc2 0.5.2",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3130,12 +3443,12 @@ checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
dependencies = [
"bitflags 2.9.1",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-cloud-kit",
"objc2-core-data",
"objc2-core-image",
"objc2-core-location",
"objc2-foundation",
"objc2-foundation 0.2.2",
"objc2-link-presentation",
"objc2-quartz-core",
"objc2-symbols",
@ -3150,8 +3463,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
"objc2 0.5.2",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3162,9 +3475,9 @@ checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
dependencies = [
"bitflags 2.9.1",
"block2",
"objc2",
"objc2 0.5.2",
"objc2-core-location",
"objc2-foundation",
"objc2-foundation 0.2.2",
]
[[package]]
@ -3239,6 +3552,15 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "owned_ttf_parser"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b"
dependencies = [
"ttf-parser 0.25.1",
]
[[package]]
name = "parking"
version = "2.2.1"
@ -3435,6 +3757,15 @@ version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
[[package]]
name = "quick-xml"
version = "0.37.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.40"
@ -3711,12 +4042,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.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec"
dependencies = [
"ab_glyph",
"log",
"memmap2",
"smithay-client-toolkit",
"tiny-skia",
]
[[package]]
name = "self_cell"
version = "1.2.0"
@ -3813,6 +4163,31 @@ version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "smithay-client-toolkit"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
dependencies = [
"bitflags 2.9.1",
"calloop",
"calloop-wayland-source",
"cursor-icon",
"libc",
"log",
"memmap2",
"rustix 0.38.44",
"thiserror 1.0.69",
"wayland-backend",
"wayland-client",
"wayland-csd-frame",
"wayland-cursor",
"wayland-protocols",
"wayland-protocols-wlr",
"wayland-scanner",
"xkeysym",
]
[[package]]
name = "smol_str"
version = "0.2.2"
@ -3827,6 +4202,7 @@ name = "solar-sim"
version = "0.1.0"
dependencies = [
"bevy",
"bevy-inspector-egui",
"bevy_panorbit_camera",
]
@ -3866,6 +4242,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 = "strum"
version = "0.26.3"
@ -4008,6 +4390,42 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "tiff"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e"
dependencies = [
"flate2",
"jpeg-decoder",
"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.9.0"
@ -4139,6 +4557,12 @@ version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"
[[package]]
name = "ttf-parser"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
[[package]]
name = "twox-hash"
version = "2.1.1"
@ -4354,6 +4778,115 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "wayland-backend"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673a33c33048a5ade91a6b139580fa174e19fb0d23f396dca9fa15f2e1e49b35"
dependencies = [
"cc",
"downcast-rs 1.2.1",
"rustix 1.0.8",
"scoped-tls",
"smallvec",
"wayland-sys",
]
[[package]]
name = "wayland-client"
version = "0.31.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c66a47e840dc20793f2264eb4b3e4ecb4b75d91c0dd4af04b456128e0bdd449d"
dependencies = [
"bitflags 2.9.1",
"rustix 1.0.8",
"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.9.1",
"cursor-icon",
"wayland-backend",
]
[[package]]
name = "wayland-cursor"
version = "0.31.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447ccc440a881271b19e9989f75726d60faa09b95b0200a9b7eb5cc47c3eeb29"
dependencies = [
"rustix 1.0.8",
"wayland-client",
"xcursor",
]
[[package]]
name = "wayland-protocols"
version = "0.32.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efa790ed75fbfd71283bd2521a1cfdc022aabcc28bdcff00851f9e4ae88d9901"
dependencies = [
"bitflags 2.9.1",
"wayland-backend",
"wayland-client",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols-plasma"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a07a14257c077ab3279987c4f8bb987851bf57081b93710381daea94f2c2c032"
dependencies = [
"bitflags 2.9.1",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-scanner",
]
[[package]]
name = "wayland-protocols-wlr"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd94963ed43cf9938a090ca4f7da58eb55325ec8200c3848963e98dc25b78ec"
dependencies = [
"bitflags 2.9.1",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-scanner",
]
[[package]]
name = "wayland-scanner"
version = "0.31.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54cb1e9dc49da91950bdfd8b848c49330536d9d1fb03d4bfec8cae50caa50ae3"
dependencies = [
"proc-macro2",
"quick-xml",
"quote",
]
[[package]]
name = "wayland-sys"
version = "0.31.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34949b42822155826b41db8e5d0c1be3a2bd296c747577a43a3e6daefc296142"
dependencies = [
"dlib",
"log",
"once_cell",
"pkg-config",
]
[[package]]
name = "web-sys"
version = "0.3.77"
@ -4374,6 +4907,12 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "weezl"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3"
[[package]]
name = "wgpu"
version = "24.0.5"
@ -5048,6 +5587,7 @@ version = "0.30.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732"
dependencies = [
"ahash",
"android-activity",
"atomic-waker",
"bitflags 2.9.1",
@ -5062,10 +5602,11 @@ dependencies = [
"dpi",
"js-sys",
"libc",
"memmap2",
"ndk 0.9.0",
"objc2",
"objc2-app-kit",
"objc2-foundation",
"objc2 0.5.2",
"objc2-app-kit 0.2.2",
"objc2-foundation 0.2.2",
"objc2-ui-kit",
"orbclient",
"percent-encoding",
@ -5073,11 +5614,17 @@ dependencies = [
"raw-window-handle",
"redox_syscall 0.4.1",
"rustix 0.38.44",
"sctk-adwaita",
"smithay-client-toolkit",
"smol_str",
"tracing",
"unicode-segmentation",
"wasm-bindgen",
"wasm-bindgen-futures",
"wayland-backend",
"wayland-client",
"wayland-protocols",
"wayland-protocols-plasma",
"web-sys",
"web-time",
"windows-sys 0.52.0",
@ -5136,6 +5683,12 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d"
[[package]]
name = "xcursor"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b"
[[package]]
name = "xkbcommon-dl"
version = "0.4.2"

View File

@ -5,6 +5,7 @@ edition = "2024"
[dependencies]
bevy = "0.16"
bevy-inspector-egui = "0.33.1"
bevy_panorbit_camera = "0.26"
# Enable a small amount of optimization in the dev profile.
@ -16,4 +17,4 @@ opt-level = 1
opt-level = 3
[features]
dev_mode = ["bevy/bevy_dev_tools", "bevy/dynamic_linking"]
default = ["bevy/bevy_dev_tools", "bevy/dynamic_linking"]

97
examples/light.rs Normal file
View File

@ -0,0 +1,97 @@
use bevy::{
core_pipeline::{bloom::Bloom, tonemapping::Tonemapping},
prelude::*,
window::WindowMode,
};
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin};
use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin};
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
commands.spawn((
PanOrbitCamera {
focus: Vec3::new(4.1, 0.0, 0.0),
zoom_lower_limit: 0.0001,
..default()
},
Camera {
hdr: true,
clear_color: ClearColorConfig::Custom(Color::BLACK),
..default()
},
Projection::Perspective(PerspectiveProjection {
near: 1e-9, // Very close near plane for extreme zooming
..default()
}),
Tonemapping::TonyMcMapface,
Bloom::NATURAL,
Transform::from_translation(Vec3::new(4.1, 0., 0.1)),
));
// Example setup for a PointLight component
commands.spawn((PointLight {
shadows_enabled: true,
..default()
},));
let sphere_mesh = meshes.add(Sphere::new(0.001));
let material = materials.add(StandardMaterial {
base_color: Color::WHITE,
..default()
});
commands.spawn((
Mesh3d(sphere_mesh),
MeshMaterial3d(material),
Transform::from_translation(Vec3::new(4.1, 0.0, 0.0)),
));
let sphere_mesh = meshes.add(Sphere::new(0.003));
let material = materials.add(StandardMaterial {
base_color: Color::WHITE,
..default()
});
commands.spawn((
Mesh3d(sphere_mesh),
MeshMaterial3d(material),
Transform::from_translation(Vec3::new(4.4, 0.2, 0.0)),
));
let sphere_mesh = meshes.add(Sphere::new(0.3));
let material = materials.add(StandardMaterial {
base_color: Color::WHITE,
emissive: LinearRgba::rgb(192., 191., 173.),
..default()
});
commands.spawn((Mesh3d(sphere_mesh), MeshMaterial3d(material)));
let sphere_mesh = meshes.add(Sphere::new(0.01));
let material = materials.add(StandardMaterial {
base_color: Color::WHITE,
..default()
});
commands.spawn((
Mesh3d(sphere_mesh),
MeshMaterial3d(material),
Transform::from_translation(Vec3::new(10., 0.2, 0.0)),
));
}
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "Solar Sim".to_string(),
mode: WindowMode::BorderlessFullscreen(MonitorSelection::Primary),
..default()
}),
..default()
}))
.add_plugins(EguiPlugin::default())
.add_plugins(WorldInspectorPlugin::new())
.add_plugins(PanOrbitCameraPlugin)
.add_systems(Startup, setup)
.run();
}

View File

@ -1,6 +1,17 @@
use bevy::{math::DVec3, prelude::*};
use bevy::{
core_pipeline::{bloom::Bloom, tonemapping::Tonemapping},
log::tracing_subscriber::field::debug,
math::DVec3,
prelude::*,
window::{WindowMode, WindowResolution},
};
use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin};
use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin};
// Scaling factor to convert AU to game units
// This makes the solar system larger so objects are visible at minimum camera zoom
const AU_TO_GAME_UNITS: f64 = 0.3;
// Unit wrapper types - all distances in AU
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct DistanceAu(pub f64);
@ -42,15 +53,33 @@ struct ObjectBundle {
velocity: Velocity,
}
#[derive(Component)]
struct Star;
// Component for UI name labels
#[derive(Component)]
struct ObjectLabel {
target_entity: Entity,
}
// Component to mark objects that can be focused on with proper zoom levels
#[derive(Component)]
struct Trackable {}
pub struct SolarRenderingPlugin;
impl Plugin for SolarRenderingPlugin {
fn build(&self, app: &mut App) {
app.add_systems(Startup, setup_rendering)
app.add_systems(Startup, (setup_rendering, setup_ui))
.add_systems(
FixedPostUpdate,
(sync_radius_to_mesh, sync_position_to_transform),
);
(
sync_radius_to_mesh,
sync_position_to_transform,
sync_name_labels,
),
)
.add_systems(Update, (update_label_positions, handle_label_clicks));
}
}
@ -58,17 +87,27 @@ fn sync_radius_to_mesh(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
query: Query<(Entity, &Radius, Option<&Mesh3d>), Changed<Radius>>,
query: Query<(Entity, &Radius, Option<&Star>, Option<&Mesh3d>), Changed<Radius>>,
) {
for (entity, radius, existing_mesh) in query.iter() {
// Radius is already in AU, use directly for rendering
let render_radius = radius.0.0;
for (entity, radius, star, existing_mesh) in query.iter() {
// Convert AU to game units for rendering
let render_radius = radius.0.0 * AU_TO_GAME_UNITS;
println!("render_radius: {:?}", render_radius);
// Create or update sphere mesh
let sphere_mesh = meshes.add(Sphere::new(render_radius as f32));
let material = materials.add(StandardMaterial {
base_color: Color::WHITE,
..default()
let material = materials.add(if star.is_none() {
StandardMaterial {
base_color: Color::WHITE,
..default()
}
} else {
StandardMaterial {
base_color: Color::WHITE, // Sun-like color for stars
emissive: LinearRgba::rgb(200.0, 200.0, 200.0),
..default()
}
});
if existing_mesh.is_none() {
@ -83,10 +122,26 @@ fn sync_radius_to_mesh(
}
}
fn sync_position_to_transform(mut query: Query<(&Position, &mut Transform), Changed<Position>>) {
for (position, mut transform) in query.iter_mut() {
// Convert AU to rendering units (1 AU = 1 unit for simplicity)
transform.translation = position.0.0.as_vec3();
fn sync_position_to_transform(
mut commands: Commands,
mut query: Query<(Entity, &Position, Option<&mut Transform>), Changed<Position>>,
) {
for (entity, position, transform) in query.iter_mut() {
// Convert AU to game units for rendering
let scaled_position = position.0.0 * AU_TO_GAME_UNITS;
println!("scaled_position: {:?}", scaled_position);
match transform {
Some(mut t) => {
// Update existing transform
t.translation = scaled_position.as_vec3();
}
None => {
// Insert a new Transform if it doesn't exist
commands
.entity(entity)
.insert(Transform::from_translation(scaled_position.as_vec3()));
}
};
}
}
@ -95,82 +150,210 @@ fn setup_rendering(mut commands: Commands) {
// Place it at a good distance to view the solar system
commands.spawn((
Camera3d::default(),
Camera {
hdr: true,
clear_color: ClearColorConfig::Custom(Color::BLACK),
..default()
},
Projection::Perspective(PerspectiveProjection {
near: 1e-9, // Very close near plane for extreme zooming
..default()
}),
Tonemapping::TonyMcMapface,
Transform::from_translation(Vec3::new(2.0, 1.5, 2.0)),
Bloom::NATURAL,
PanOrbitCamera {
pan_sensitivity: 0.0, // Disable panning by setting sensitivity to 0
focus: Vec3::ZERO,
radius: Some(3.0),
is_upside_down: false,
zoom_lower_limit: 1e-8,
..default()
},
));
// Spawn directional light from the sun's position
// This simulates sunlight illuminating the planets
commands.spawn((
DirectionalLight {
color: Color::WHITE,
illuminance: 10000.0, // Bright like the sun
shadows_enabled: true,
..default()
},
Transform::from_xyz(0.0, 0.0, 0.0).looking_at(Vec3::new(1.0, 0.0, 0.0), Vec3::Y),
));
commands.spawn(PointLight {
color: Color::WHITE,
shadows_enabled: true,
..default()
});
}
fn setup_ui(mut commands: Commands) {
// UI root node for labels
commands.spawn(Node {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
position_type: PositionType::Absolute,
..default()
});
}
fn sync_name_labels(
mut commands: Commands,
objects_with_names: Query<(Entity, &Name, &Position), Changed<Name>>,
existing_labels: Query<&ObjectLabel>,
) {
for (entity, name, _position) in objects_with_names.iter() {
// Check if label already exists for this entity
let has_label = existing_labels
.iter()
.any(|label| label.target_entity == entity);
if !has_label {
// Create new label
commands.spawn((
Text::new(name.0.0.clone()),
TextColor(Color::WHITE),
TextFont {
font_size: 16.0,
..default()
},
Node {
position_type: PositionType::Absolute,
left: Val::Px(0.0), // Will be updated by update_label_positions
top: Val::Px(0.0), // Will be updated by update_label_positions
..default()
},
BackgroundColor(Color::srgba(0.0, 0.0, 0.0, 0.7)),
Interaction::default(), // Make label clickable
ObjectLabel {
target_entity: entity,
},
));
}
}
}
fn update_label_positions(
mut label_query: Query<(&mut Node, &ObjectLabel, &mut Text), With<ObjectLabel>>,
objects_query: Query<(&Position, &Name, &Radius)>,
camera_query: Query<(&Camera, &GlobalTransform)>,
) {
let Ok((camera, camera_transform)) = camera_query.single() else {
return;
};
for (mut node, label, mut text) in label_query.iter_mut() {
if let Ok((position, name, radius)) = objects_query.get(label.target_entity) {
let world_pos = position.0.0 * AU_TO_GAME_UNITS;
if let Ok(screen_pos) = camera.world_to_viewport(camera_transform, world_pos.as_vec3())
{
// Position the label on screen, offset slightly to avoid overlapping the object
node.left = Val::Px(screen_pos.x + 10.0);
node.top = Val::Px(screen_pos.y - 10.0);
// Update text in case name changed
text.0 = name.0.0.clone();
} else {
// Object is off-screen, hide label by moving it off-screen
node.left = Val::Px(-1000.0);
node.top = Val::Px(-1000.0);
}
} else {
// Target entity no longer exists, remove label
// Note: In a more complex system, you might want to handle this in a separate cleanup system
}
}
}
fn handle_label_clicks(
interaction_query: Query<
(&Interaction, &ObjectLabel),
(Changed<Interaction>, With<ObjectLabel>),
>,
trackable_objects: Query<(&Position, &Trackable, &Radius)>,
mut camera_query: Query<&mut PanOrbitCamera>,
) {
for (interaction, label) in interaction_query.iter() {
if *interaction == Interaction::Pressed {
if let Ok((position, _trackable, radius)) = trackable_objects.get(label.target_entity) {
if let Ok(mut pan_orbit) = camera_query.single_mut() {
// Focus camera on the clicked object using target values for smooth transitions
pan_orbit.target_focus = (position.0.0 * AU_TO_GAME_UNITS).as_vec3();
pan_orbit.target_radius = (radius.0.0 * AU_TO_GAME_UNITS) as f32 * 4.;
// Also set the immediate values to ensure it takes effect
// pan_orbit.focus = position.0.0.as_vec3();
// pan_orbit.radius = Some(trackable.zoom_distance);
}
}
}
}
}
fn setup_solar_system(mut commands: Commands) {
// Sun - From NASA JPL Horizons data (J2000.0 epoch)
// Physical properties: Mass = 1988410 x 10^24 kg, Radius = 695700 km = 0.00465 AU
commands.spawn(ObjectBundle {
name: Name(ObjectName("Sun".to_string())),
position: Position(PositionAu(DVec3::new(0.0, 0.0, 0.0))), // At barycenter
velocity: Velocity(VelocityAuPerDay(DVec3::new(0.0, 0.0, 0.0))), // Stationary relative to barycenter
mass: Mass(MassKg(1.988410e30)), // Solar mass in kg
radius: Radius(DistanceAu(0.00465)), // Solar radius in AU (695700 km / 149597870.691)
});
commands.spawn((
ObjectBundle {
name: Name(ObjectName("Sun".to_string())),
position: Position(PositionAu(DVec3::new(0.0, 0.0, 0.0))), // At barycenter
velocity: Velocity(VelocityAuPerDay(DVec3::new(0.0, 0.0, 0.0))), // Stationary relative to barycenter
mass: Mass(MassKg(1.988410e30)), // Solar mass in kg
radius: Radius(DistanceAu(0.00465)), // Solar radius in AU (695700 km / 149597870.691)
},
Star,
Trackable {},
));
// Earth - From NASA JPL Horizons data (A.D. 2000-Jan-01 12:00:00.0000 TDB)
// Position and velocity vectors in ecliptic J2000.0 frame relative to Sun
// Mass = 5.97219 x 10^24 kg, Mean radius = 6371.01 km = 0.0000426 AU
commands.spawn(ObjectBundle {
name: Name(ObjectName("Earth".to_string())),
position: Position(PositionAu(DVec3::new(
-1.771350992727098e-1, // X = -0.177135 AU
9.672416867665306e-1, // Y = 0.967242 AU
-4.085281582511366e-6, // Z = -4.085e-6 AU
))),
velocity: Velocity(VelocityAuPerDay(DVec3::new(
-1.720762506872895e-2, // VX = -0.0172076 AU/day
-3.158782144324866e-3, // VY = -0.00315878 AU/day
1.049888594613343e-7, // VZ = 1.04989e-7 AU/day
))),
mass: Mass(MassKg(5.97219e24)), // Earth mass in kg
radius: Radius(DistanceAu(0.0000426)), // Mean radius in AU (6371.01 km / 149597870.691)
});
commands.spawn((
ObjectBundle {
name: Name(ObjectName("Earth".to_string())),
position: Position(PositionAu(DVec3::new(
-1.771350992727098e-1, // X = -0.177135 AU
9.672416867665306e-1, // Y = 0.967242 AU
-4.085281582511366e-6, // Z = -4.085e-6 AU
))),
velocity: Velocity(VelocityAuPerDay(DVec3::new(
-1.720762506872895e-2, // VX = -0.0172076 AU/day
-3.158782144324866e-3, // VY = -0.00315878 AU/day
1.049888594613343e-7, // VZ = 1.04989e-7 AU/day
))),
mass: Mass(MassKg(5.97219e24)), // Earth mass in kg
radius: Radius(DistanceAu(0.0000426)), // Mean radius in AU (6371.01 km / 149597870.691)
},
Trackable {},
));
// Moon - From NASA JPL Horizons data (A.D. 2000-Jan-01 12:00:00.0000 TDB)
// Position and velocity vectors in ecliptic J2000.0 frame relative to Sun
// Mass = 7.349 x 10^22 kg, Mean radius = 1737.53 km = 0.0000116 AU
commands.spawn(ObjectBundle {
name: Name(ObjectName("Moon".to_string())),
position: Position(PositionAu(DVec3::new(
-1.790843809223965e-1, // X = -0.179084 AU
9.654035607264573e-1, // Y = 0.965404 AU
2.383726922995396e-4, // Z = 0.000238373 AU
))),
velocity: Velocity(VelocityAuPerDay(DVec3::new(
-1.683595459141215e-2, // VX = -0.0168360 AU/day
-3.580960720855671e-3, // VY = -0.00358096 AU/day
-6.540550604528720e-6, // VZ = -6.54055e-6 AU/day
))),
mass: Mass(MassKg(7.349e22)), // Moon mass in kg
radius: Radius(DistanceAu(0.0000116)), // Mean radius in AU (1737.53 km / 149597870.691)
});
commands.spawn((
ObjectBundle {
name: Name(ObjectName("Moon".to_string())),
position: Position(PositionAu(DVec3::new(
-1.790843809223965e-1, // X = -0.179084 AU
9.654035607264573e-1, // Y = 0.965404 AU
2.383726922995396e-4, // Z = 0.000238373 AU
))),
velocity: Velocity(VelocityAuPerDay(DVec3::new(
-1.683595459141215e-2, // VX = -0.0168360 AU/day
-3.580960720855671e-3, // VY = -0.00358096 AU/day
-6.540550604528720e-6, // VZ = -6.54055e-6 AU/day
))),
mass: Mass(MassKg(7.349e22)), // Moon mass in kg
radius: Radius(DistanceAu(0.0000116)), // Mean radius in AU (1737.53 km / 149597870.691)
},
Trackable {},
));
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "Solar Sim".to_string(),
mode: WindowMode::BorderlessFullscreen(MonitorSelection::Primary),
..default()
}),
..default()
}))
.add_plugins(PanOrbitCameraPlugin)
.add_plugins(EguiPlugin::default())
.add_plugins(WorldInspectorPlugin::new())
.add_plugins(SolarRenderingPlugin)
.add_systems(Startup, setup_solar_system)
.run();