I MADE A GRID USING WGSL

This commit is contained in:
RustyStriker 2022-08-24 19:37:07 +03:00
parent 5adc76505d
commit f43cf6728b
8 changed files with 264 additions and 163 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target
/.vscode

304
Cargo.lock generated
View file

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "ab_glyph"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24606928a235e73cdef55a0c909719cadd72fce573e5713d58cb2952d8f5794c"
checksum = "846ffacb9d0c8b879ef9e565b59e18fb76d6a61013e5bd24ecc659864e6b1a1f"
dependencies = [
"ab_glyph_rasterizer",
"owned_ttf_parser",
@ -110,9 +110,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.58"
version = "1.0.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704"
checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305"
[[package]]
name = "approx"
@ -165,9 +165,9 @@ dependencies = [
[[package]]
name = "async-channel"
version = "1.6.1"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28"
dependencies = [
"concurrent-queue",
"event-listener",
@ -226,18 +226,18 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "bevy"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55f08528a4e59d607460513a823b40f602d013c1a00f57b824f1075d5d48c3cd"
checksum = "fea147ef1ebb92d41294cfad804c40de151b174c711ce6e0a4a40eba23eae1a4"
dependencies = [
"bevy_internal",
]
[[package]]
name = "bevy_animation"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e243169af495ad616ff701247c0d3e40078a26ed8de231cf9e54bde6b3c4bb45"
checksum = "a4365465fca7bd78295eb81d0a04afc049399852793d562eb017849bb5d6c55e"
dependencies = [
"bevy_app",
"bevy_asset",
@ -253,9 +253,9 @@ dependencies = [
[[package]]
name = "bevy_app"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d26d6ffdf493609d2fedc1018a2ef0cb4d8e48f6d3bcea56fa2df81867e464"
checksum = "9e4ae0a6ed2adf3b153511b4645241660a93f747c05ecd1e5a909dafc803cad4"
dependencies = [
"bevy_derive",
"bevy_ecs",
@ -268,9 +268,9 @@ dependencies = [
[[package]]
name = "bevy_asset"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d8fb95306d5f18fa70df40632cd984993aeb71e91ce059ae99699098a4f9ce9"
checksum = "2ec773c861a7e9d9978771f59f385500ec6da3a1ab5487705cddb054393d3d19"
dependencies = [
"anyhow",
"bevy_app",
@ -296,9 +296,9 @@ dependencies = [
[[package]]
name = "bevy_audio"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eee08ac575397ce17477dd291862bafa15226334bdfb82c02bbc3d10bad7bdb8"
checksum = "1e5cf4713a24f318841f73a9e030854cfd5bad46bc81fa1acc9590cdab053c6f"
dependencies = [
"anyhow",
"bevy_app",
@ -312,9 +312,9 @@ dependencies = [
[[package]]
name = "bevy_core"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6712146d54fff9e1865362e9f39a7b63c7b037ddb72a3d7bb05b959213fb61e"
checksum = "c53172003d5cde7780870b5403c66c8ede3581faf3e510e916d8b4baa5b538d2"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -327,9 +327,9 @@ dependencies = [
[[package]]
name = "bevy_core_pipeline"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "080bb00399b6d7697e505f871d67c6de8b52eb06b47b0cda2be80c2396805983"
checksum = "5e60efd10d593f6d122f2687f74c09ad55835a8f999c35bed6380ddd8e6ff7f2"
dependencies = [
"bevy_app",
"bevy_asset",
@ -345,9 +345,9 @@ dependencies = [
[[package]]
name = "bevy_derive"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4b8f0786d1fc7e0d35297917be463db3d0886f7bd8d4221ca3d565502579ffb"
checksum = "0e6345431bbe6d7b6c165cd860ecd0b35da929779571259c5df970ac256d45f9"
dependencies = [
"bevy_macro_utils",
"quote",
@ -356,9 +356,9 @@ dependencies = [
[[package]]
name = "bevy_diagnostic"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adab74ee5375fbf5d2b1d3da41de8d1491a8a706d17441b5e31214b65349d692"
checksum = "58ac9f4c2815f412be4b6e21e4b299cdafa710f651d064f6d40b2a8377a0d17c"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -369,9 +369,9 @@ dependencies = [
[[package]]
name = "bevy_ecs"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5643dc27b7d6778e3a66c8e0f6ad1fd33309aa2fa61d935f360ccc85b7be6a2"
checksum = "c174066a24ed8a14d15ea58b0aea1c1f5c763f4bb36ebdc2b1dc78026007d0f5"
dependencies = [
"async-channel",
"bevy_ecs_macros",
@ -388,9 +388,9 @@ dependencies = [
[[package]]
name = "bevy_ecs_macros"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5f2f12677f8725d40930d0a19652f007fe0ef5ac38e23817cfc4930c61f5680"
checksum = "cc50c39e49e8febccc74e8e731680adb0cb4aef1f53275740cbaa95c6da71f4f"
dependencies = [
"bevy_macro_utils",
"proc-macro2",
@ -400,9 +400,9 @@ dependencies = [
[[package]]
name = "bevy_egui"
version = "0.15.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ab46f07c3f360507fae9bc3b9c000c583e0d67661f0dd6dd5a24a709775b1e"
checksum = "acbf44ff770566dca66b805a6829df783f64700bd01d35aec1034dff31b531a4"
dependencies = [
"arboard",
"bevy",
@ -413,9 +413,9 @@ dependencies = [
[[package]]
name = "bevy_encase_derive"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76a767adc36ce1fc917a736843b026d4de7069d90ed5e669c852481ef69fd5aa"
checksum = "68bc194009c5e9b97da64a08142dd183c264885d99c985cf849868103018adf1"
dependencies = [
"bevy_macro_utils",
"encase_derive_impl",
@ -423,9 +423,9 @@ dependencies = [
[[package]]
name = "bevy_gilrs"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "963940426127533164af2a556971a03c493143c0afb95afadb4a070b6ab8c3df"
checksum = "cb15a3427d9707be92b457e5d66900b02d853b475c21dd8662bdda387ba9f24e"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -436,9 +436,9 @@ dependencies = [
[[package]]
name = "bevy_gltf"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "150cc6782c4472600c2ade5d78c6ce481c992690f0499e63765aba752d7e0f04"
checksum = "79db7d7e71b47a69953fbe8407ded5c6308eaeecf9a05efd5dfb42992f400a16"
dependencies = [
"anyhow",
"base64",
@ -465,9 +465,9 @@ dependencies = [
[[package]]
name = "bevy_hierarchy"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2e4c20d7c843cd26ef3c5d7b4c20e3e32c275943e2437ecaca1cfd6cfe3b30"
checksum = "5eb1ec76099ea5a716de08ea42ff41f036ebe2502df1d569168b58f16458a85e"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -478,9 +478,9 @@ dependencies = [
[[package]]
name = "bevy_input"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a11c70573fb4d4c056ba32cfa553daa7e6e1245cb876ccfbe322640928b7ee1c"
checksum = "1821c4b760ba6ddb4fe61806e9cc33f40b09a884557aca4553a29b8c7d73c6b4"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -490,9 +490,9 @@ dependencies = [
[[package]]
name = "bevy_internal"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d603b597772130782eab6e604706cbb764fb037f9cf0a1904b6f342845b6f44"
checksum = "ee63ad1e3f95a26ff2c227fadb1534a7bfe3a098e0e45c347f2f2575a573d9bc"
dependencies = [
"bevy_animation",
"bevy_app",
@ -528,9 +528,9 @@ dependencies = [
[[package]]
name = "bevy_log"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cafb12fc84734236e36f407ab62c72d5d4279fa4777e40a95d7cc973cbabcd1"
checksum = "092daf498887814a064331dfcd1cf487a5ddab01fd38629b84a35b8b664462a1"
dependencies = [
"android_log-sys",
"bevy_app",
@ -543,9 +543,9 @@ dependencies = [
[[package]]
name = "bevy_macro_utils"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d081af83b701e16cad209255ba6b383744dfa49efa99eb6505989f293305ab3"
checksum = "43fb5137e5198302d7c6c33d1e454cf48a586e7c6fd12f4860f12863951e16b9"
dependencies = [
"quote",
"syn",
@ -554,27 +554,27 @@ dependencies = [
[[package]]
name = "bevy_math"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db5394e86c5708d3aa506c6e98ec4ed2a4083a7a018c6693d9ac0e77ebfabfc2"
checksum = "531f2b90c7e861a96f418b3d560131b3354c5e67a67eba3953a45a56ea0114d2"
dependencies = [
"glam",
]
[[package]]
name = "bevy_mikktspace"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40b299a61175a6f7e7398f83cd5b50920fd8bad4df674e614ad94f25f8426509"
checksum = "941e7d3d4e1dbb735f040e4cdc1558be1d3c38d43f1d9fdbb039c39a7849a00b"
dependencies = [
"glam",
]
[[package]]
name = "bevy_pbr"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed9a81bbd02f5e0a57899a41aec37d9cb14965e1e4d510547f3f680323d05c0f"
checksum = "176073021a4caeb8b448f24ce790fb57fde74b114f345064a8b102d2f7bed905"
dependencies = [
"bevy_app",
"bevy_asset",
@ -604,15 +604,15 @@ dependencies = [
[[package]]
name = "bevy_ptr"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d92d5679e89602a18682a37846573dcd1979410179e14204280460ba9fb8713a"
checksum = "9960c19e582b43cebe1894b6679520a4f50802d1cc5b6fa432f8d685ed232f09"
[[package]]
name = "bevy_reflect"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08798e67f2d4e6898ef117d8c99cf3b50a8eebc8da4159e6dad2657a0fbe9a4e"
checksum = "3fc689dd7a7df3b3768884a4754711d406aa302ea48da483c03b52715fa95045"
dependencies = [
"bevy_ptr",
"bevy_reflect_derive",
@ -629,9 +629,9 @@ dependencies = [
[[package]]
name = "bevy_reflect_derive"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19209a7f0238053802b7de04e6724bd90d4ed7d90e87101dbd1b64cca64ff694"
checksum = "8c36fa5100832c787c10558d31632ddc454c221e8dfacbbef836938f59614754"
dependencies = [
"bevy_macro_utils",
"proc-macro2",
@ -642,9 +642,9 @@ dependencies = [
[[package]]
name = "bevy_render"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb49530388ef17cff3fb8bd5e47372fb3cfeb4befc73e3036f6462ac20f049ef"
checksum = "600bcef85c7efac6e38ed725707f0e5b7c59b510430034ba2f743f472493f845"
dependencies = [
"anyhow",
"bevy_app",
@ -685,9 +685,9 @@ dependencies = [
[[package]]
name = "bevy_render_macros"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7d0b7a51fa819c20c64f43856c5aaea40f853050bbb09b9ba3672e5ff2688a5"
checksum = "1be90adc9e5d5808833e363670818da5fe68ccafd7ca983a457f90957d2a430b"
dependencies = [
"bevy_macro_utils",
"proc-macro2",
@ -697,9 +697,9 @@ dependencies = [
[[package]]
name = "bevy_scene"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0064d73ebb0de39901478b493604a1a6d448fd337b66803004c60f41f1fa6c37"
checksum = "a045d575d2c8f776d8ea965363c81660243fefbfc3712ead938b00dfd6797216"
dependencies = [
"anyhow",
"bevy_app",
@ -719,9 +719,9 @@ dependencies = [
[[package]]
name = "bevy_sprite"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f83dfe8897d6c0d9d5ce3818d49a13e58ae2b9b9ecf4f4bb85aa31bb0678f68"
checksum = "69c419f3db09d7ac1f4d45e0874d349d5d6f47f48bc10d55cd0da36413e2331e"
dependencies = [
"bevy_app",
"bevy_asset",
@ -745,9 +745,9 @@ dependencies = [
[[package]]
name = "bevy_tasks"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff874c91a36eaac3ef957c6f3b590fb71332d9d136671cc858847d56fe9f80a3"
checksum = "719b753acb3d5b9dbfd77038560fe1893c17d4ee0a4242c2ee70da9d59430537"
dependencies = [
"async-channel",
"async-executor",
@ -760,9 +760,9 @@ dependencies = [
[[package]]
name = "bevy_text"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef05a788c2c04aaa5db95b22a8f0fff0d3a0b08a7bcd1a71f050a628b38eec6e"
checksum = "c265b7515faf55a3b92fd6ce0ab65dd246f247e11d737d6f5cdaf49c2be42c63"
dependencies = [
"ab_glyph",
"anyhow",
@ -783,9 +783,9 @@ dependencies = [
[[package]]
name = "bevy_time"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74ec681d641371df81d7bfbcb0eea725ed873f38a094f34b5f7b436f0889e77c"
checksum = "22830665b8476292b861216383fd79922aef2b540f9fd09d49144e3e5e94550e"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -796,9 +796,9 @@ dependencies = [
[[package]]
name = "bevy_transform"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42e1528e35f30bede46a50ee4134f150efc01f5c1002c340b3b2e6a0bfcb8aa5"
checksum = "a4bb8760f03e9667e7499a5ceec1f7630fc3e45702781ac0df56cb969e8ae668"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -809,9 +809,9 @@ dependencies = [
[[package]]
name = "bevy_ui"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac181a7b637da61fad72981ff9d2e5b899283ca7d54b2b7ea49c431121331c53"
checksum = "062ce086de1a4a470e5df48cb5c16a1dc97ab610e635cafabdef26c4a1ef5756"
dependencies = [
"bevy_app",
"bevy_asset",
@ -837,13 +837,13 @@ dependencies = [
[[package]]
name = "bevy_utils"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bda6dada53e546845887ae7357eec57b8d547ef71627b716b33839b4a98b687"
checksum = "f6e9aa1866c1cf7ee000f281ce9e90d02d701f5c7380a107252017e58e2f5246"
dependencies = [
"ahash",
"getrandom",
"hashbrown 0.12.3",
"hashbrown",
"instant",
"tracing",
"uuid",
@ -851,9 +851,9 @@ dependencies = [
[[package]]
name = "bevy_window"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3bdc3a220a9bb2fad9bd30d5f44c6645725398fe1bc588fc87abf09f092696e"
checksum = "707dbbebfac72b1e63e874e7a11a345feab8c440355c0bd71e6dff26709fba9a"
dependencies = [
"bevy_app",
"bevy_ecs",
@ -866,9 +866,9 @@ dependencies = [
[[package]]
name = "bevy_winit"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57537a56ac4f4e1ffcad95227bcab37cd17b51770dacff82374a2d88be376322"
checksum = "98b15fee4b75472e3441b0c7221467303e4ce59b342a94a328e447e7cdb5a43c"
dependencies = [
"approx",
"bevy_app",
@ -932,24 +932,24 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "bumpalo"
version = "3.10.0"
version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
[[package]]
name = "bytemuck"
version = "1.11.0"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5377c8865e74a160d21f29c2d40669f53286db6eab59b88540cbb12ffc8b835"
checksum = "2f5715e491b5a1598fc2bef5a606847b5dc1d48ea625bd3c02c00de8285591da"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.1.1"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfd2f4180c5721da6335cc9e9061cce522b87a35e51cc57636d28d22a9863c80"
checksum = "1b9e1f5fa78f69496407a27ae9ed989e3c3b072310286f5ef385525e4cbc24a9"
dependencies = [
"proc-macro2",
"quote",
@ -964,9 +964,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e"
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
[[package]]
name = "cache-padded"
@ -1106,9 +1106,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "combine"
version = "4.6.4"
version = "4.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948"
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
dependencies = [
"bytes",
"memchr",
@ -1116,9 +1116,9 @@ dependencies = [
[[package]]
name = "concurrent-queue"
version = "1.2.2"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c"
dependencies = [
"cache-padded",
]
@ -1463,9 +1463,9 @@ dependencies = [
[[package]]
name = "erased-serde"
version = "0.3.21"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81d013529d5574a60caeda29e179e695125448e5de52e3874f7b4c1d7360e18e"
checksum = "003000e712ad0f95857bd4d2ef8d1890069e06554101697d12050668b2f6f020"
dependencies = [
"serde",
]
@ -1491,9 +1491,9 @@ dependencies = [
[[package]]
name = "event-listener"
version = "2.5.2"
version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "fastrand"
@ -1579,15 +1579,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115"
[[package]]
name = "futures-io"
version = "0.3.21"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5"
[[package]]
name = "futures-lite"
@ -1715,9 +1715,9 @@ dependencies = [
[[package]]
name = "glam"
version = "0.21.2"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "781aa11be58ef14b0cd7326618afcbd9cdb5ba686bdab7193d87cdc322cd7033"
checksum = "518faa5064866338b013ff9b2350dc318e14cc4fcd6cb8206d7e7c9886c98815"
dependencies = [
"bytemuck",
"serde",
@ -1829,13 +1829,13 @@ dependencies = [
[[package]]
name = "gpu-descriptor"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a538f217be4d405ff4719a283ca68323cc2384003eca5baaa87501e821c81dda"
checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a"
dependencies = [
"bitflags",
"gpu-descriptor-types",
"hashbrown 0.11.2",
"hashbrown",
]
[[package]]
@ -1895,15 +1895,6 @@ dependencies = [
"syn",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
dependencies = [
"ahash",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
@ -2006,7 +1997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
"hashbrown",
]
[[package]]
@ -2065,9 +2056,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "jni"
@ -2169,9 +2160,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.126"
version = "0.2.132"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
[[package]]
name = "libloading"
@ -2701,15 +2692,15 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.13.0"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e"
[[package]]
name = "owned_ttf_parser"
version = "0.15.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb1e509cfe7a12db2a90bfa057dfcdbc55a347f5da677c506b53dd099cfec9d"
checksum = "07ef1a404ae479dd6906f4fa2c88b3c94028f1284beb42a47c183a7c27ee9a3e"
dependencies = [
"ttf-parser",
]
@ -2849,19 +2840,20 @@ dependencies = [
[[package]]
name = "proc-macro-crate"
version = "1.1.3"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a"
checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9"
dependencies = [
"once_cell",
"thiserror",
"toml",
]
[[package]]
name = "proc-macro2"
version = "1.0.41"
version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdcc2916cde080c1876ff40292a396541241fe0072ef928cd76582e9ea5d60d2"
checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
dependencies = [
"unicode-ident",
]
@ -2874,9 +2866,9 @@ checksum = "2f61dcf0b917cd75d4521d7343d1ffff3d1583054133c9b5cbea3375c703c40d"
[[package]]
name = "quote"
version = "1.0.20"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
"proc-macro2",
]
@ -2919,9 +2911,9 @@ checksum = "a0d463f2884048e7153449a55166f91028d5b0ea53c79377099ce4e8cf0cf9bb"
[[package]]
name = "redox_syscall"
version = "0.2.15"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534cfe58d6a18cc17120fbf4635d53d14691c1fe4d951064df9bd326178d7d5a"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
@ -3022,9 +3014,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.10"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
name = "same-file"
@ -3049,18 +3041,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
version = "1.0.140"
version = "1.0.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.140"
version = "1.0.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da"
checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00"
dependencies = [
"proc-macro2",
"quote",
@ -3069,9 +3061,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.82"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
dependencies = [
"itoa",
"ryu",
@ -3182,9 +3174,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.98"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13"
dependencies = [
"proc-macro2",
"quote",
@ -3228,18 +3220,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.31"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.31"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21"
dependencies = [
"proc-macro2",
"quote",
@ -3292,9 +3284,9 @@ dependencies = [
[[package]]
name = "tracing"
version = "0.1.35"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
dependencies = [
"cfg-if 1.0.0",
"pin-project-lite",
@ -3315,9 +3307,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.28"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
dependencies = [
"once_cell",
"valuable",
@ -3383,9 +3375,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]]
name = "unicode-ident"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7"
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
[[package]]
name = "unicode-normalization"
@ -3831,9 +3823,9 @@ dependencies = [
[[package]]
name = "x11-dl"
version = "2.19.1"
version = "2.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59"
checksum = "0c83627bc137605acc00bb399c7b908ef460b621fc37c953db2b09f88c449ea6"
dependencies = [
"lazy_static",
"libc",

View file

@ -10,7 +10,7 @@ Eventually, this will be a level editor... But until then, I guess it's just fun
- [x] Highlight opened shapes in the tree(maybe allow only 1 opened shape? - I dont think egui allows me to do that)
- [x] Drag camera around
- [x] Zome in/out
- [ ] Import images:
- [x] Import images:
- [x] Insert images
- [x] Show images in tree view
- [x] Show/Hide images
@ -23,7 +23,8 @@ Eventually, this will be a level editor... But until then, I guess it's just fun
- [x] Control shape Z value
- [x] Snap to grid
- [x] Change grid size
- [ ] Show/Hide grid(also make a visible grid in the first place)
- [x] Show/Hide grid(also make a visible grid in the first place)
- [ ] Make grid fill the screen at all times
- [ ] Save? (maybe just import and export directly?)
- [ ] Export
- [ ] Import

34
assets/shaders/grid.wgsl Normal file
View file

@ -0,0 +1,34 @@
@group(1) @binding(0)
var<uniform> grid_width: f32;
@group(1) @binding(1)
var<uniform> grid_size: vec2<f32>;
@group(1) @binding(2)
var<uniform> visible: u32;
let grid_color: vec4<f32> = vec4<f32>(1.0, 1.0, 1.0, 0.3);
let x_color: vec4<f32> = vec4<f32>(1.0, 0.0, 0.0, 1.0);
let y_color :vec4<f32> = vec4<f32>(0.0, 1.0, 0.0, 1.0);
@fragment
fn fragment(
@builtin(position) position: vec4<f32>,
#import bevy_sprite::mesh2d_vertex_output
) -> @location(0) vec4<f32> {
if abs(world_position.y) < grid_width && abs(world_position.x) < grid_width {
return grid_color;
}
else if abs(world_position.y) < grid_width {
return x_color;
}
else if abs(world_position.x) < grid_width {
return y_color;
}
else if visible == u32(0) {
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
else if abs(world_position.x) % grid_size.x <= grid_width || abs(world_position.y) % grid_size.y <= grid_width {
return grid_color;
}
else {
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
}

61
src/infinite_grid.rs Normal file
View file

@ -0,0 +1,61 @@
use bevy::prelude::*;
use bevy::reflect::TypeUuid;
use bevy::render::render_resource::AsBindGroup;
use bevy::sprite::{MaterialMesh2dBundle, Material2d};
use crate::MainCamera;
#[derive(AsBindGroup, TypeUuid, Debug, Clone)]
#[uuid = "b56a4075-b836-4866-a6f6-3e34ef3ae44f"]
pub struct GridMaterial {
#[uniform(0)]
width: f32,
#[uniform(1)]
size: Vec2,
#[uniform(2)]
visible: u32,
}
impl Material2d for GridMaterial {
fn fragment_shader() -> bevy::render::render_resource::ShaderRef {
"shaders/grid.wgsl".into()
}
}
pub fn spawn_grid(
mut coms: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut mats: ResMut<Assets<GridMaterial>>,
) {
coms.spawn().insert_bundle(MaterialMesh2dBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1000.0 })).into(),
transform: Transform::from_xyz(0.0, 0.0, 0.0),
material: mats.add(GridMaterial { width: 2.0, size: Vec2::splat(15.0), visible: 1 }),
..default()
});
}
pub fn update_grid_shader(
snap_grid: Res<crate::SnapGrid>,
handles: Query<&Handle<GridMaterial>>,
mut mats: ResMut<Assets<GridMaterial>>,
) {
for h in handles.iter() {
if let Some(mut m) = mats.get_mut(h) {
m.size = Vec2::new(snap_grid.width, snap_grid.height);
m.visible = snap_grid.visible as u32;
}
}
}
pub fn update_grid_position(
cam: Query<&GlobalTransform, With<MainCamera>>,
mut grid: Query<&mut Transform, With<Handle<GridMaterial>>>,
) {
let mut cam_pos = cam.get_single().map(|c| c.translation()).unwrap_or(Vec3::ZERO);
cam_pos.z = 0.0;
for mut t in grid.iter_mut() {
t.translation = cam_pos;
}
}

View file

@ -1,5 +1,3 @@
#![feature(let_chains)]
use bevy::prelude::*;
use bevy_egui::egui;
@ -7,6 +5,7 @@ pub mod create;
pub mod helpers;
pub mod modify;
pub mod ui;
pub mod infinite_grid;
pub use modify::modify_sys;
pub use create::create_sys;
pub use helpers::*;
@ -17,11 +16,12 @@ pub struct SnapGrid {
pub height: f32,
pub snap: bool,
pub offset: Vec2,
pub visible: bool,
}
impl SnapGrid {
pub fn snap_to_grid(&self, v: Vec2) -> Vec2 {
if self.snap {
let w = v - self.offset;
let w = v - self.offset + 0.5 * Vec2::new(self.width.copysign(v.x), self.height.copysign(v.y));
let snapped = Vec2::new(w.x - w.x % self.width, w.y - w.y % self.height);
snapped + self.offset
@ -33,7 +33,7 @@ impl SnapGrid {
}
impl Default for SnapGrid {
fn default() -> Self {
Self { width: 15.0, height: 15.0, snap: false, offset: Vec2::ZERO }
Self { width: 15.0, height: 15.0, snap: false, offset: Vec2::ZERO, visible: true }
}
}

View file

@ -1,6 +1,7 @@
use bevy::ecs::schedule::ShouldRun;
use bevy::input::mouse::{MouseMotion, MouseWheel};
use bevy::math::Vec3Swizzles;
use bevy::sprite::Material2dPlugin;
use bevy::{prelude::*, window::PresentMode, winit::WinitSettings};
use bevy_egui::{egui, EguiContext, EguiPlugin};
use bevy_prototype_lyon::prelude::*;
@ -31,11 +32,16 @@ fn main() {
.add_plugins(DefaultPlugins)
.add_plugin(EguiPlugin)
.add_plugin(ShapePlugin)
.add_plugin(Material2dPlugin::<infinite_grid::GridMaterial>::default())
;
app
.add_startup_system(configure_visuals)
.add_startup_system(basic_setup_sys)
.add_startup_system(infinite_grid::spawn_grid)
;
app
.add_system(create_sys.with_run_criteria(|state: Res<UiState>, mut ec: ResMut<EguiContext>|
if !ec.ctx_mut().is_pointer_over_area() && state.current_action == Action::Create { ShouldRun::Yes } else { ShouldRun::No }
))
@ -51,6 +57,8 @@ fn main() {
.add_system(drag_camera_sys)
.add_system(zoom_camera_sys)
.add_system(scale_points)
.add_system(infinite_grid::update_grid_shader)
.add_system(infinite_grid::update_grid_position)
;
app.run();

View file

@ -88,7 +88,11 @@ pub fn grid_window_sys(
.title_bar(true)
.resizable(false)
.show(egui_ctx.ctx_mut(), |ui| {
ui.checkbox(&mut grid.snap, "Snap Enabled");
ui.horizontal(|hui| {
hui.checkbox(&mut grid.snap, "Snap Enabled");
hui.checkbox(&mut grid.visible, "Visible");
});
ui.label("Grid size:");
ui.horizontal(|hui| {
hui.label("Width:");