mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-22 14:58:44 -06:00
Compare commits
No commits in common. "906f4882a24423b5743bbaf1b25c8ca9cb9e836a" and "4ff284288ebc3d0b049ff5227f90ac3e5e7237a2" have entirely different histories.
906f4882a2
...
4ff284288e
299
Cargo.lock
generated
299
Cargo.lock
generated
|
@ -52,6 +52,27 @@ version = "0.2.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android-activity"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289"
|
||||||
|
dependencies = [
|
||||||
|
"android-properties",
|
||||||
|
"bitflags 2.5.0",
|
||||||
|
"cc",
|
||||||
|
"cesu8",
|
||||||
|
"jni",
|
||||||
|
"jni-sys",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"ndk 0.8.0",
|
||||||
|
"ndk-context",
|
||||||
|
"ndk-sys 0.5.0+25.2.9519653",
|
||||||
|
"num_enum",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "android-activity"
|
name = "android-activity"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
@ -66,7 +87,7 @@ dependencies = [
|
||||||
"jni-sys",
|
"jni-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"ndk",
|
"ndk 0.9.0",
|
||||||
"ndk-context",
|
"ndk-context",
|
||||||
"ndk-sys 0.6.0+11769913",
|
"ndk-sys 0.6.0+11769913",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
|
@ -171,15 +192,15 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.3.0"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.22.1"
|
version = "0.22.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bincode"
|
name = "bincode"
|
||||||
|
@ -223,13 +244,32 @@ version = "0.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-sys"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7"
|
||||||
|
dependencies = [
|
||||||
|
"objc-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block2"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68"
|
||||||
|
dependencies = [
|
||||||
|
"block-sys",
|
||||||
|
"objc2 0.4.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block2"
|
name = "block2"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43ff7d91d3c1d568065b06c899777d1e48dcf76103a672a0adbc238a7f247f1e"
|
checksum = "43ff7d91d3c1d568065b06c899777d1e48dcf76103a672a0adbc238a7f247f1e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc2",
|
"objc2 0.5.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -249,9 +289,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytemuck_derive"
|
name = "bytemuck_derive"
|
||||||
version = "1.6.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60"
|
checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -298,9 +338,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.96"
|
version = "1.0.95"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd"
|
checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -403,9 +443,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "concurrent-queue"
|
name = "concurrent-queue"
|
||||||
version = "2.5.0"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
|
checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-utils",
|
"crossbeam-utils",
|
||||||
]
|
]
|
||||||
|
@ -680,9 +720,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.30"
|
version = "1.0.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
|
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
|
@ -712,7 +752,7 @@ version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9099a2f86b8e674b75d03ff154b3fe4c5208ed249ced8d69cc313a9fa40bb488"
|
checksum = "9099a2f86b8e674b75d03ff154b3fe4c5208ed249ced8d69cc313a9fa40bb488"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
"ttf-parser",
|
"ttf-parser",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -780,9 +820,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gilrs"
|
name = "gilrs"
|
||||||
version = "0.10.7"
|
version = "0.10.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b54e5e39844ab5cddaf3bbbdfdc2923a6cb34e36818b95618da4e3f26302c24c"
|
checksum = "499067aa54af19f88732dc418f61f23d5912de1518665bb0eca034ca0d07574c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fnv",
|
"fnv",
|
||||||
"gilrs-core",
|
"gilrs-core",
|
||||||
|
@ -894,7 +934,7 @@ checksum = "9c08c1f623a8d0b722b8b99f821eb0ba672a1618f0d3b16ddbee1cedd2dd8557"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"gpu-descriptor-types",
|
"gpu-descriptor-types",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -923,9 +963,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.14.5"
|
version = "0.14.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
|
@ -987,28 +1027,27 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hui"
|
name = "hui"
|
||||||
version = "0.1.0-alpha.5"
|
version = "0.1.0-alpha.4"
|
||||||
source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
|
source = "git+https://github.com/griffi-gh/hui?rev=dd5af8b9e2#dd5af8b9e2dc4cb2beb0b130d82167258ea2bd4e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"derive_setters",
|
"derive_setters",
|
||||||
"document-features",
|
"document-features",
|
||||||
"fontdue",
|
"fontdue",
|
||||||
"glam",
|
"glam",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
"hui-derive",
|
"hui-derive",
|
||||||
"image",
|
"image",
|
||||||
"log",
|
"log",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
"rect_packer",
|
"rect_packer",
|
||||||
"rustc-hash",
|
|
||||||
"tinyset",
|
"tinyset",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hui-derive"
|
name = "hui-derive"
|
||||||
version = "0.1.0-alpha.5"
|
version = "0.1.0-alpha.4"
|
||||||
source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
|
source = "git+https://github.com/griffi-gh/hui?rev=dd5af8b9e2#dd5af8b9e2dc4cb2beb0b130d82167258ea2bd4e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.60",
|
"syn 2.0.60",
|
||||||
|
@ -1016,13 +1055,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hui-winit"
|
name = "hui-winit"
|
||||||
version = "0.1.0-alpha.5"
|
version = "0.1.0-alpha.4"
|
||||||
source = "git+https://github.com/griffi-gh/hui?rev=3a50d2d0dde#3a50d2d0dde7044d02860dac9ab059bd353657a2"
|
source = "git+https://github.com/griffi-gh/hui?rev=dd5af8b9e2#dd5af8b9e2dc4cb2beb0b130d82167258ea2bd4e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"hui",
|
"hui",
|
||||||
"log",
|
"log",
|
||||||
"winit",
|
"winit 0.29.15",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1054,6 +1093,17 @@ dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "icrate"
|
||||||
|
version = "0.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319"
|
||||||
|
dependencies = [
|
||||||
|
"block2 0.3.0",
|
||||||
|
"dispatch",
|
||||||
|
"objc2 0.4.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ident_case"
|
name = "ident_case"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -1090,7 +1140,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1202,14 +1252,13 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||||
name = "kubi"
|
name = "kubi"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-activity",
|
"android-activity 0.5.2",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"atomic",
|
"atomic",
|
||||||
"bytemuck",
|
|
||||||
"flume",
|
"flume",
|
||||||
"gilrs",
|
"gilrs",
|
||||||
"glam",
|
"glam",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
"hui",
|
"hui",
|
||||||
"hui-winit",
|
"hui-winit",
|
||||||
"image",
|
"image",
|
||||||
|
@ -1217,9 +1266,8 @@ dependencies = [
|
||||||
"kubi-shared",
|
"kubi-shared",
|
||||||
"log",
|
"log",
|
||||||
"lz4_flex",
|
"lz4_flex",
|
||||||
"ndk",
|
"ndk 0.8.0",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
"pollster",
|
|
||||||
"postcard",
|
"postcard",
|
||||||
"rand",
|
"rand",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
|
@ -1232,7 +1280,7 @@ dependencies = [
|
||||||
"uflow",
|
"uflow",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
"winapi",
|
"winapi",
|
||||||
"winit",
|
"winit 0.30.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1251,7 +1299,7 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"flume",
|
"flume",
|
||||||
"glam",
|
"glam",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
"kubi-logging",
|
"kubi-logging",
|
||||||
"kubi-shared",
|
"kubi-shared",
|
||||||
"log",
|
"log",
|
||||||
|
@ -1276,7 +1324,7 @@ dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"fastnoise-lite",
|
"fastnoise-lite",
|
||||||
"glam",
|
"glam",
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
"nz",
|
"nz",
|
||||||
|
@ -1298,9 +1346,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.154"
|
version = "0.2.153"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
|
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
|
@ -1363,9 +1411,9 @@ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.12"
|
version = "0.4.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
|
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
|
@ -1471,6 +1519,21 @@ dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ndk"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.5.0",
|
||||||
|
"jni-sys",
|
||||||
|
"log",
|
||||||
|
"ndk-sys 0.5.0+25.2.9519653",
|
||||||
|
"num_enum",
|
||||||
|
"raw-window-handle",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ndk"
|
name = "ndk"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
|
@ -1536,9 +1599,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.19"
|
version = "0.2.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
@ -1566,9 +1629,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nz"
|
name = "nz"
|
||||||
version = "0.3.5"
|
version = "0.3.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d1e9655df3f51323812726b25a00d787562c5fa64177d286603429787b4386a9"
|
checksum = "cb749eec2b3be2f169dd4facfec40a28cc40f2b02ad3c4d2c51ce578c3f635b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc"
|
name = "objc"
|
||||||
|
@ -1585,6 +1648,16 @@ version = "0.3.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "da284c198fb9b7b0603f8635185e85fbd5b64ee154b1ed406d489077de2d6d60"
|
checksum = "da284c198fb9b7b0603f8635185e85fbd5b64ee154b1ed406d489077de2d6d60"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d"
|
||||||
|
dependencies = [
|
||||||
|
"objc-sys",
|
||||||
|
"objc2-encode 3.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2"
|
name = "objc2"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -1592,7 +1665,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4b25e1034d0e636cd84707ccdaa9f81243d399196b8a773946dcffec0401659"
|
checksum = "b4b25e1034d0e636cd84707ccdaa9f81243d399196b8a773946dcffec0401659"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc-sys",
|
"objc-sys",
|
||||||
"objc2-encode",
|
"objc2-encode 4.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1601,8 +1674,8 @@ version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fb79768a710a9a1798848179edb186d1af7e8a8679f369e4b8d201dd2a034047"
|
checksum = "fb79768a710a9a1798848179edb186d1af7e8a8679f369e4b8d201dd2a034047"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2 0.5.0",
|
||||||
"objc2",
|
"objc2 0.5.1",
|
||||||
"objc2-core-data",
|
"objc2-core-data",
|
||||||
"objc2-foundation",
|
"objc2-foundation",
|
||||||
]
|
]
|
||||||
|
@ -1613,11 +1686,17 @@ version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6e092bc42eaf30a08844e6a076938c60751225ec81431ab89f5d1ccd9f958d6c"
|
checksum = "6e092bc42eaf30a08844e6a076938c60751225ec81431ab89f5d1ccd9f958d6c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2 0.5.0",
|
||||||
"objc2",
|
"objc2 0.5.1",
|
||||||
"objc2-foundation",
|
"objc2-foundation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc2-encode"
|
||||||
|
version = "3.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc2-encode"
|
name = "objc2-encode"
|
||||||
version = "4.0.1"
|
version = "4.0.1"
|
||||||
|
@ -1630,9 +1709,9 @@ version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cfaefe14254871ea16c7d88968c0ff14ba554712a20d76421eec52f0a7fb8904"
|
checksum = "cfaefe14254871ea16c7d88968c0ff14ba554712a20d76421eec52f0a7fb8904"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block2",
|
"block2 0.5.0",
|
||||||
"dispatch",
|
"dispatch",
|
||||||
"objc2",
|
"objc2 0.5.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1764,12 +1843,6 @@ dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pollster"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "postcard"
|
name = "postcard"
|
||||||
version = "1.0.8"
|
version = "1.0.8"
|
||||||
|
@ -1920,6 +1993,15 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d8ffb4dfda4b01cc420847665dc480760d596ce186f2772a66ed32fe9acb1c45"
|
checksum = "d8ffb4dfda4b01cc420847665dc480760d596ce186f2772a66ed32fe9acb1c45"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
@ -2066,18 +2148,18 @@ checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.200"
|
version = "1.0.198"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f"
|
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.200"
|
version = "1.0.198"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb"
|
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -2106,9 +2188,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with"
|
name = "serde_with"
|
||||||
version = "3.8.1"
|
version = "3.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20"
|
checksum = "2c85f8e96d1d6857f13768fcbd895fcb06225510022a2774ed8b5150581847b0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -2124,9 +2206,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with_macros"
|
name = "serde_with_macros"
|
||||||
version = "3.8.1"
|
version = "3.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2"
|
checksum = "c8b3a576c4eb2924262d5951a3b737ccaf16c931e39a2810c36f9a7e25575557"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -2139,7 +2221,7 @@ name = "shipyard"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
source = "git+https://github.com/leudz/shipyard?rev=aacf3b1df5#aacf3b1df540c7d9d384830d7431ba618eee75c9"
|
source = "git+https://github.com/leudz/shipyard?rev=aacf3b1df5#aacf3b1df540c7d9d384830d7431ba618eee75c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown 0.14.5",
|
"hashbrown 0.14.3",
|
||||||
"lock_api",
|
"lock_api",
|
||||||
"rayon",
|
"rayon",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -2449,7 +2531,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"winnow 0.6.7",
|
"winnow 0.6.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2726,6 +2808,16 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "web-time"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-time"
|
name = "web-time"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
@ -2910,6 +3002,15 @@ dependencies = [
|
||||||
"windows-targets 0.42.2",
|
"windows-targets 0.42.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.48.5",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.52.0"
|
version = "0.52.0"
|
||||||
|
@ -3097,6 +3198,41 @@ version = "0.52.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winit"
|
||||||
|
version = "0.29.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca"
|
||||||
|
dependencies = [
|
||||||
|
"android-activity 0.5.2",
|
||||||
|
"atomic-waker",
|
||||||
|
"bitflags 2.5.0",
|
||||||
|
"calloop",
|
||||||
|
"cfg_aliases 0.1.1",
|
||||||
|
"core-foundation",
|
||||||
|
"core-graphics",
|
||||||
|
"cursor-icon",
|
||||||
|
"icrate",
|
||||||
|
"js-sys",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"ndk 0.8.0",
|
||||||
|
"ndk-sys 0.5.0+25.2.9519653",
|
||||||
|
"objc2 0.4.1",
|
||||||
|
"once_cell",
|
||||||
|
"orbclient",
|
||||||
|
"redox_syscall 0.3.5",
|
||||||
|
"rustix",
|
||||||
|
"smol_str",
|
||||||
|
"unicode-segmentation",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"web-time 0.2.4",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
"xkbcommon-dl",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winit"
|
name = "winit"
|
||||||
version = "0.30.0"
|
version = "0.30.0"
|
||||||
|
@ -3104,7 +3240,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea9e6d5d66cbf702e0dd820302144f51b69a95acdc495dd98ca280ff206562b1"
|
checksum = "ea9e6d5d66cbf702e0dd820302144f51b69a95acdc495dd98ca280ff206562b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"android-activity",
|
"android-activity 0.6.0",
|
||||||
"atomic-waker",
|
"atomic-waker",
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
@ -3118,8 +3254,8 @@ dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"memmap2",
|
"memmap2",
|
||||||
"ndk",
|
"ndk 0.9.0",
|
||||||
"objc2",
|
"objc2 0.5.1",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit",
|
||||||
"objc2-foundation",
|
"objc2-foundation",
|
||||||
"orbclient",
|
"orbclient",
|
||||||
|
@ -3140,7 +3276,7 @@ dependencies = [
|
||||||
"wayland-protocols",
|
"wayland-protocols",
|
||||||
"wayland-protocols-plasma",
|
"wayland-protocols-plasma",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"web-time",
|
"web-time 1.1.0",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
"x11-dl",
|
"x11-dl",
|
||||||
"x11rb",
|
"x11rb",
|
||||||
|
@ -3158,9 +3294,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.6.7"
|
version = "0.6.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578"
|
checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
@ -3178,9 +3314,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11rb"
|
name = "x11rb"
|
||||||
version = "0.13.1"
|
version = "0.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12"
|
checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as-raw-xcb-connection",
|
"as-raw-xcb-connection",
|
||||||
"gethostname",
|
"gethostname",
|
||||||
|
@ -3193,9 +3329,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11rb-protocol"
|
name = "x11rb-protocol"
|
||||||
version = "0.13.1"
|
version = "0.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d"
|
checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xcursor"
|
name = "xcursor"
|
||||||
|
@ -3247,3 +3383,8 @@ dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.60",
|
"syn 2.0.60",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[patch.unused]]
|
||||||
|
name = "glium"
|
||||||
|
version = "0.34.0"
|
||||||
|
source = "git+https://github.com/glium/glium?rev=a352c667#a352c667c145e2dda1f5fe1fc2482cbe99de23be"
|
||||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -21,13 +21,10 @@ opt-level = 1
|
||||||
[profile.dev.package.uflow]
|
[profile.dev.package.uflow]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
||||||
[profile.dev.package.wgpu]
|
[profile.dev.package.glium]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
||||||
[profile.dev.package.wgpu-core]
|
[profile.dev.package.bracket-noise]
|
||||||
opt-level = 3
|
|
||||||
|
|
||||||
[profile.dev.package.wgpu-hal]
|
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
||||||
[profile.dev.package.fastnoise-lite]
|
[profile.dev.package.fastnoise-lite]
|
||||||
|
@ -40,3 +37,6 @@ opt-level = 3
|
||||||
#enabling debug assertions here causes the game to abort
|
#enabling debug assertions here causes the game to abort
|
||||||
[profile.dev.package.android-activity]
|
[profile.dev.package.android-activity]
|
||||||
debug-assertions = false
|
debug-assertions = false
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
glium = { git = "https://github.com/glium/glium", rev = "a352c667" }
|
||||||
|
|
|
@ -1,64 +1,64 @@
|
||||||
//! Custom env_logger options and styling
|
//! Custom env_logger options and styling
|
||||||
|
|
||||||
/// Custom env_logger options and styling
|
/// Custom env_logger options and styling
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use env_logger::{fmt::Color, Builder, Env};
|
use env_logger::{fmt::Color, Builder, Env};
|
||||||
|
|
||||||
let env = Env::default()
|
let env = Env::default()
|
||||||
.filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn,wgpu=warn,wgpu_core=warn,wgpu_hal=warn,hui=info,hui-winit=info,hui-glium=info,hui-wgpu=info");
|
.filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn");
|
||||||
Builder::from_env(env)
|
Builder::from_env(env)
|
||||||
.format(|buf, record| {
|
.format(|buf, record| {
|
||||||
let mut level_style = buf.style();
|
let mut level_style = buf.style();
|
||||||
level_style.set_color(match record.level() {
|
level_style.set_color(match record.level() {
|
||||||
Level::Error => Color::Red,
|
Level::Error => Color::Red,
|
||||||
Level::Warn => Color::Yellow,
|
Level::Warn => Color::Yellow,
|
||||||
Level::Debug | Level::Trace => Color::Cyan,
|
Level::Debug | Level::Trace => Color::Cyan,
|
||||||
_ => Color::Blue
|
_ => Color::Blue
|
||||||
}).set_bold(true);
|
}).set_bold(true);
|
||||||
|
|
||||||
let mut bold_style = buf.style();
|
let mut bold_style = buf.style();
|
||||||
bold_style.set_bold(true);
|
bold_style.set_bold(true);
|
||||||
|
|
||||||
let mut location_style = buf.style();
|
let mut location_style = buf.style();
|
||||||
location_style.set_bold(true);
|
location_style.set_bold(true);
|
||||||
location_style.set_dimmed(true);
|
location_style.set_dimmed(true);
|
||||||
|
|
||||||
let mut location_line_style = buf.style();
|
let mut location_line_style = buf.style();
|
||||||
location_line_style.set_dimmed(true);
|
location_line_style.set_dimmed(true);
|
||||||
|
|
||||||
let text = format!("{}", record.args());
|
let text = format!("{}", record.args());
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
buf,
|
buf,
|
||||||
"{} {:<50}\t{}{}{}{}",
|
"{} {:<50}\t{}{}{}{}",
|
||||||
level_style.value(match record.level() {
|
level_style.value(match record.level() {
|
||||||
Level::Error => "[e]",
|
Level::Error => "[e]",
|
||||||
Level::Warn => "[w]",
|
Level::Warn => "[w]",
|
||||||
Level::Info => "[i]",
|
Level::Info => "[i]",
|
||||||
Level::Debug => "[d]",
|
Level::Debug => "[d]",
|
||||||
Level::Trace => "[t]",
|
Level::Trace => "[t]",
|
||||||
}),
|
}),
|
||||||
text,
|
text,
|
||||||
bold_style.value((text.len() > 50).then_some("\n ╰─ ").unwrap_or_default()),
|
bold_style.value((text.len() > 50).then_some("\n ╰─ ").unwrap_or_default()),
|
||||||
location_style.value(record.target()),
|
location_style.value(record.target()),
|
||||||
location_line_style.value(" :"),
|
location_line_style.value(" :"),
|
||||||
location_line_style.value(record.line().unwrap_or(0))
|
location_line_style.value(record.line().unwrap_or(0))
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.init();
|
.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Custom env_logger options and styling
|
/// Custom env_logger options and styling
|
||||||
#[inline]
|
#[inline]
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use android_logger::Config;
|
use android_logger::Config;
|
||||||
android_logger::init_once(
|
android_logger::init_once(
|
||||||
Config::default().with_max_level(LevelFilter::Trace),
|
Config::default().with_max_level(LevelFilter::Trace),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ glam = { version = "0.27", features = ["debug-glam-assert", "fast-math"] }
|
||||||
hashbrown = "0.14"
|
hashbrown = "0.14"
|
||||||
nohash-hasher = "0.2"
|
nohash-hasher = "0.2"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
rayon = "1.10"
|
rayon = "1.7"
|
||||||
flume = "0.11"
|
flume = "0.11"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
uflow = "0.7"
|
uflow = "0.7"
|
||||||
|
|
|
@ -11,12 +11,10 @@ crate-type = ["lib", "cdylib"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
kubi-shared = { path = "../kubi-shared" }
|
kubi-shared = { path = "../kubi-shared" }
|
||||||
kubi-logging = { path = "../kubi-logging" }
|
kubi-logging = { path = "../kubi-logging" }
|
||||||
hui = { git = "https://github.com/griffi-gh/hui", rev = "3a50d2d0dde" }
|
hui = { version = "0.1.0-alpha.4", git = "https://github.com/griffi-gh/hui", rev = "dd5af8b9e2" }
|
||||||
hui-winit = { git = "https://github.com/griffi-gh/hui", rev = "3a50d2d0dde", features = ["winit_30"] }
|
hui-winit = { version = "0.1.0-alpha.4", git = "https://github.com/griffi-gh/hui", rev = "dd5af8b9e2" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
wgpu = { version = "0.20", features = ["webgl"] }
|
wgpu = { version = "0.20", features = ["webgl"] }
|
||||||
pollster = "0.3"
|
|
||||||
bytemuck = { version = "1.15", features = ["derive"] }
|
|
||||||
winit = { version = "0.30", features = ["android-native-activity"] }
|
winit = { version = "0.30", features = ["android-native-activity"] }
|
||||||
raw-window-handle = "0.6"
|
raw-window-handle = "0.6"
|
||||||
glam = { version = "0.27", features = ["debug-glam-assert", "fast-math"] }
|
glam = { version = "0.27", features = ["debug-glam-assert", "fast-math"] }
|
||||||
|
@ -24,7 +22,7 @@ image = { version = "0.25", default_features = false, features = ["png"] }
|
||||||
strum = { version = "0.26", features = ["derive"] }
|
strum = { version = "0.26", features = ["derive"] }
|
||||||
hashbrown = "0.14"
|
hashbrown = "0.14"
|
||||||
nohash-hasher = "0.2"
|
nohash-hasher = "0.2"
|
||||||
rayon = "1.10"
|
rayon = "1.7"
|
||||||
shipyard = { git = "https://github.com/leudz/shipyard", rev = "aacf3b1df5", default-features = false, features = ["std", "proc", "thread_local"] }
|
shipyard = { git = "https://github.com/leudz/shipyard", rev = "aacf3b1df5", default-features = false, features = ["std", "proc", "thread_local"] }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
flume = "0.11"
|
flume = "0.11"
|
||||||
|
@ -38,10 +36,9 @@ serde_json = { version = "1.0", optional = true } #only used for `generate_visua
|
||||||
rand = { version = "0.8", features = ["alloc", "small_rng"]}
|
rand = { version = "0.8", features = ["alloc", "small_rng"]}
|
||||||
atomic = "0.6"
|
atomic = "0.6"
|
||||||
|
|
||||||
|
|
||||||
[target.'cfg(target_os = "android")'.dependencies]
|
[target.'cfg(target_os = "android")'.dependencies]
|
||||||
android-activity = "0.6"
|
android-activity = "^0.5.2"
|
||||||
ndk = "0.9"
|
ndk = "0.8"
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
winapi = { version = "0.3", features = ["wincon"] }
|
winapi = { version = "0.3", features = ["wincon"] }
|
||||||
|
|
12
kubi/shaders/colored.frag
Normal file
12
kubi/shaders/colored.frag
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#version 300 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
out vec4 out_color;
|
||||||
|
uniform vec4 color;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// discard fully transparent pixels
|
||||||
|
if (color.w <= 0.) discard;
|
||||||
|
out_color = color;
|
||||||
|
}
|
13
kubi/shaders/colored.vert
Normal file
13
kubi/shaders/colored.vert
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#version 300 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
in vec3 position;
|
||||||
|
uniform mat4 model;
|
||||||
|
uniform mat4 perspective;
|
||||||
|
uniform mat4 view;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
mat4 modelview = view * model;
|
||||||
|
gl_Position = perspective * modelview * vec4(position, 1.);
|
||||||
|
}
|
10
kubi/shaders/colored2.frag
Normal file
10
kubi/shaders/colored2.frag
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#version 300 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
out vec4 out_color;
|
||||||
|
uniform vec4 color;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
out_color = color;
|
||||||
|
}
|
9
kubi/shaders/colored2.vert
Normal file
9
kubi/shaders/colored2.vert
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#version 300 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
in vec2 position;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_Position = vec4(position, 0.0, 1.0);
|
||||||
|
}
|
26
kubi/shaders/world.frag
Normal file
26
kubi/shaders/world.frag
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#version 300 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
precision lowp sampler2DArray;
|
||||||
|
|
||||||
|
in vec3 v_normal;
|
||||||
|
in vec2 v_uv;
|
||||||
|
flat in uint v_tex_index;
|
||||||
|
out vec4 color;
|
||||||
|
uniform sampler2DArray tex;
|
||||||
|
uniform bool discard_alpha;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// base color from texture
|
||||||
|
color = texture(tex, vec3(v_uv, v_tex_index));
|
||||||
|
|
||||||
|
// discard fully transparent pixels
|
||||||
|
if (discard_alpha ? (color.w < 0.5) : (color.w == 0.)) discard;
|
||||||
|
|
||||||
|
//basic "lighting"
|
||||||
|
float light = abs(v_normal.x) + .8 * abs(v_normal.y) + .6 * abs(v_normal.z);
|
||||||
|
color *= vec4(vec3(light), 1.);
|
||||||
|
|
||||||
|
//discard alpha
|
||||||
|
if (discard_alpha) color.w = 1.;
|
||||||
|
}
|
27
kubi/shaders/world.vert
Normal file
27
kubi/shaders/world.vert
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#version 300 es
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
//TODO pack this data:
|
||||||
|
// uint position_normal_uv
|
||||||
|
// XXYYZZNU
|
||||||
|
// wehere Normal and Uv are enums
|
||||||
|
// maybe somehow pack in tex index too
|
||||||
|
|
||||||
|
in vec3 position;
|
||||||
|
in vec3 normal;
|
||||||
|
in vec2 uv;
|
||||||
|
in uint tex_index;
|
||||||
|
out vec2 v_uv;
|
||||||
|
out vec3 v_normal;
|
||||||
|
flat out uint v_tex_index;
|
||||||
|
uniform vec3 position_offset;
|
||||||
|
uniform mat4 perspective;
|
||||||
|
uniform mat4 view;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
v_normal = normal;
|
||||||
|
v_tex_index = tex_index;
|
||||||
|
v_uv = uv;
|
||||||
|
gl_Position = perspective * view * vec4(position + position_offset, 1.);
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
use shipyard::{AllStoragesView, IntoIter, NonSendSync, Unique, UniqueView, UniqueViewMut, View};
|
use shipyard::{AllStoragesView, IntoIter, NonSendSync, Unique, UniqueView, UniqueViewMut, View};
|
||||||
use crate::{events::InputDeviceEvent, rendering::Renderer};
|
use crate::{events::InputDeviceEvent, rendering::{Renderer, WindowSize}};
|
||||||
use winit::{
|
use winit::{
|
||||||
dpi::PhysicalPosition, event::{DeviceEvent, ElementState, RawKeyEvent}, keyboard::{KeyCode, PhysicalKey}, window::CursorGrabMode
|
dpi::PhysicalPosition, event::{DeviceEvent, ElementState, RawKeyEvent}, keyboard::{KeyCode, PhysicalKey}, window::CursorGrabMode
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ pub fn update_cursor_lock_state(
|
||||||
}
|
}
|
||||||
if lock.is_inserted_or_modified() {
|
if lock.is_inserted_or_modified() {
|
||||||
//TODO MIGRATION
|
//TODO MIGRATION
|
||||||
let window = display.window();
|
let window = &display.window;
|
||||||
window.set_cursor_grab(match lock.0 {
|
window.set_cursor_grab(match lock.0 {
|
||||||
true => CursorGrabMode::Confined,
|
true => CursorGrabMode::Confined,
|
||||||
false => CursorGrabMode::None,
|
false => CursorGrabMode::None,
|
||||||
|
@ -42,6 +42,7 @@ pub fn debug_toggle_lock(
|
||||||
mut lock: UniqueViewMut<CursorLock>,
|
mut lock: UniqueViewMut<CursorLock>,
|
||||||
device_events: View<InputDeviceEvent>,
|
device_events: View<InputDeviceEvent>,
|
||||||
ren: NonSendSync<UniqueView<Renderer>>,
|
ren: NonSendSync<UniqueView<Renderer>>,
|
||||||
|
size: UniqueView<WindowSize>,
|
||||||
) {
|
) {
|
||||||
for evt in device_events.iter() {
|
for evt in device_events.iter() {
|
||||||
if let DeviceEvent::Key(RawKeyEvent {
|
if let DeviceEvent::Key(RawKeyEvent {
|
||||||
|
@ -50,8 +51,8 @@ pub fn debug_toggle_lock(
|
||||||
}) = evt.event {
|
}) = evt.event {
|
||||||
lock.0 = !lock.0;
|
lock.0 = !lock.0;
|
||||||
if !lock.0 {
|
if !lock.0 {
|
||||||
let center = PhysicalPosition::new(ren.size().width as f64 / 2., ren.size().height as f64 / 2.);
|
let center = PhysicalPosition::new(size.0.x as f64 / 2., size.0.y as f64 / 2.);
|
||||||
let _ = ren.window().set_cursor_position(center);
|
let _ = ren.window.set_cursor_position(center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub fn initial_resize_event(
|
||||||
) {
|
) {
|
||||||
let (w, h) = {
|
let (w, h) = {
|
||||||
let renderer = storages.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
let renderer = storages.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
||||||
(renderer.size().width, renderer.size().height)
|
renderer.display.get_framebuffer_dimensions()
|
||||||
};
|
};
|
||||||
storages.add_entity((
|
storages.add_entity((
|
||||||
EventComponent,
|
EventComponent,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use hui::UiInstance;
|
use hui::UiInstance;
|
||||||
//use hui_glium::GliumUiRenderer;
|
//use hui_glium::GliumUiRenderer;
|
||||||
use shipyard::{AllStoragesView, Unique, UniqueView, NonSendSync, UniqueViewMut};
|
use shipyard::{AllStoragesView, Unique, UniqueView, NonSendSync, UniqueViewMut};
|
||||||
use crate::rendering::{Renderer, WindowSize};
|
use crate::rendering::{RenderTarget, Renderer, WindowSize};
|
||||||
|
|
||||||
#[derive(Unique)]
|
#[derive(Unique)]
|
||||||
pub struct UiState {
|
pub struct UiState {
|
||||||
|
@ -34,13 +34,13 @@ pub fn kubi_ui_end(
|
||||||
//renderer.update(hui);
|
//renderer.update(hui);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn kubi_ui_draw(
|
pub fn kubi_ui_draw(
|
||||||
// ui: NonSendSync<UniqueView<UiState>>,
|
ui: NonSendSync<UniqueView<UiState>>,
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
// size: UniqueView<WindowSize>
|
size: UniqueView<WindowSize>
|
||||||
// ) {
|
) {
|
||||||
// ui.renderer.draw(&mut target.0, size.0.as_vec2());
|
//ui.renderer.draw(&mut target.0, size.0.as_vec2());
|
||||||
// }
|
}
|
||||||
|
|
||||||
pub fn hui_process_winit_events(
|
pub fn hui_process_winit_events(
|
||||||
event: &winit::event::Event<()>,
|
event: &winit::event::Event<()>,
|
||||||
|
|
|
@ -75,13 +75,18 @@ use events::{
|
||||||
};
|
};
|
||||||
use input::{init_input, process_inputs};
|
use input::{init_input, process_inputs};
|
||||||
use player_controller::{debug_switch_ctl_type, update_player_controllers};
|
use player_controller::{debug_switch_ctl_type, update_player_controllers};
|
||||||
// use rendering::{
|
|
||||||
// clear_background, entities::render_entities, init_window_size, primitives::init_primitives, resize_renderer, selection_box::render_selection_box, sumberge::render_submerged_view, update_window_size, world::{draw_current_chunk_border, draw_world, draw_world_trans, init_trans_chunk_queue}, BackgroundColor, RenderTarget, Renderer
|
|
||||||
// };
|
|
||||||
use rendering::{
|
use rendering::{
|
||||||
init_window_size, render_master, resize_renderer, update_window_size,
|
Renderer,
|
||||||
world::{init_trans_chunk_queue, TransChunkQueue},
|
RenderTarget,
|
||||||
BackgroundColor, Renderer,
|
BackgroundColor,
|
||||||
|
clear_background,
|
||||||
|
init_window_size,
|
||||||
|
update_window_size,
|
||||||
|
primitives::init_primitives,
|
||||||
|
world::{init_trans_chunk_queue, draw_world, draw_world_trans, draw_current_chunk_border},
|
||||||
|
selection_box::render_selection_box,
|
||||||
|
entities::render_entities,
|
||||||
|
sumberge::render_submerged_view,
|
||||||
};
|
};
|
||||||
use block_placement::update_block_placement;
|
use block_placement::update_block_placement;
|
||||||
use delta_time::{DeltaTime, init_delta_time};
|
use delta_time::{DeltaTime, init_delta_time};
|
||||||
|
@ -90,7 +95,7 @@ use control_flow::{exit_on_esc, insert_control_flow_unique, RequestExit};
|
||||||
use state::{is_ingame, is_ingame_or_loading, is_loading, init_state, update_state, is_connecting};
|
use state::{is_ingame, is_ingame_or_loading, is_loading, init_state, update_state, is_connecting};
|
||||||
use networking::{update_networking, update_networking_late, is_multiplayer, disconnect_on_exit, is_singleplayer};
|
use networking::{update_networking, update_networking_late, is_multiplayer, disconnect_on_exit, is_singleplayer};
|
||||||
use init::initialize_from_args;
|
use init::initialize_from_args;
|
||||||
use hui_integration::{kubi_ui_begin, /*kubi_ui_draw,*/ kubi_ui_end, kubi_ui_init};
|
use hui_integration::{kubi_ui_begin, kubi_ui_draw, kubi_ui_end, kubi_ui_init};
|
||||||
use loading_screen::update_loading_screen;
|
use loading_screen::update_loading_screen;
|
||||||
use connecting_screen::update_connecting_screen;
|
use connecting_screen::update_connecting_screen;
|
||||||
use fixed_timestamp::init_fixed_timestamp_storage;
|
use fixed_timestamp::init_fixed_timestamp_storage;
|
||||||
|
@ -116,7 +121,7 @@ fn startup() -> Workload {
|
||||||
init_window_size,
|
init_window_size,
|
||||||
kubi_ui_init,
|
kubi_ui_init,
|
||||||
load_prefabs,
|
load_prefabs,
|
||||||
//init_primitives,
|
init_primitives,
|
||||||
insert_lock_state,
|
insert_lock_state,
|
||||||
init_state,
|
init_state,
|
||||||
initialize_from_args,
|
initialize_from_args,
|
||||||
|
@ -127,6 +132,7 @@ fn startup() -> Workload {
|
||||||
init_client_physics,
|
init_client_physics,
|
||||||
init_chat_manager,
|
init_chat_manager,
|
||||||
init_crosshair_image,
|
init_crosshair_image,
|
||||||
|
init_trans_chunk_queue,
|
||||||
).into_sequential_workload()
|
).into_sequential_workload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,12 +140,10 @@ fn update() -> Workload {
|
||||||
(
|
(
|
||||||
debug_toggle_lock,
|
debug_toggle_lock,
|
||||||
update_window_size,
|
update_window_size,
|
||||||
resize_renderer,
|
|
||||||
update_cursor_lock_state,
|
update_cursor_lock_state,
|
||||||
process_inputs,
|
process_inputs,
|
||||||
kubi_ui_begin,
|
kubi_ui_begin,
|
||||||
(
|
(
|
||||||
init_trans_chunk_queue.run_if_missing_unique::<TransChunkQueue>(),
|
|
||||||
init_game_world.run_if_missing_unique::<ChunkTaskManager>(),
|
init_game_world.run_if_missing_unique::<ChunkTaskManager>(),
|
||||||
(
|
(
|
||||||
spawn_player.run_if_storage_empty::<MainPlayer>(),
|
spawn_player.run_if_storage_empty::<MainPlayer>(),
|
||||||
|
@ -177,20 +181,20 @@ fn update() -> Workload {
|
||||||
).into_sequential_workload()
|
).into_sequential_workload()
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn render() -> Workload {
|
fn render() -> Workload {
|
||||||
// (
|
(
|
||||||
// clear_background,
|
clear_background,
|
||||||
// (
|
(
|
||||||
// draw_world,
|
draw_world,
|
||||||
// draw_current_chunk_border,
|
draw_current_chunk_border,
|
||||||
// render_selection_box,
|
render_selection_box,
|
||||||
// render_entities,
|
render_entities,
|
||||||
// draw_world_trans,
|
draw_world_trans,
|
||||||
// render_submerged_view,
|
render_submerged_view,
|
||||||
// ).into_sequential_workload().run_if(is_ingame),
|
).into_sequential_workload().run_if(is_ingame),
|
||||||
// kubi_ui_draw,
|
kubi_ui_draw,
|
||||||
// ).into_sequential_workload()
|
).into_sequential_workload()
|
||||||
// }
|
}
|
||||||
|
|
||||||
fn after_frame_end() -> Workload {
|
fn after_frame_end() -> Workload {
|
||||||
(
|
(
|
||||||
|
@ -240,7 +244,7 @@ pub fn kubi_main(
|
||||||
world.add_workload(pre_startup);
|
world.add_workload(pre_startup);
|
||||||
world.add_workload(startup);
|
world.add_workload(startup);
|
||||||
world.add_workload(update);
|
world.add_workload(update);
|
||||||
//world.add_workload(render);
|
world.add_workload(render);
|
||||||
world.add_workload(after_frame_end);
|
world.add_workload(after_frame_end);
|
||||||
|
|
||||||
//Save _visualizer.json
|
//Save _visualizer.json
|
||||||
|
@ -321,21 +325,19 @@ pub fn kubi_main(
|
||||||
//Run update workflows
|
//Run update workflows
|
||||||
world.run_workload(update).unwrap();
|
world.run_workload(update).unwrap();
|
||||||
|
|
||||||
world.run(render_master);
|
|
||||||
|
|
||||||
//Start rendering (maybe use custom views for this?)
|
//Start rendering (maybe use custom views for this?)
|
||||||
// let target = {
|
let target = {
|
||||||
// let renderer = world.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
let renderer = world.borrow::<NonSendSync<UniqueView<Renderer>>>().unwrap();
|
||||||
// renderer.display.draw()
|
renderer.display.draw()
|
||||||
// };
|
};
|
||||||
// world.add_unique_non_send_sync(RenderTarget(target));
|
world.add_unique_non_send_sync(RenderTarget(target));
|
||||||
|
|
||||||
//Run render workflow
|
//Run render workflow
|
||||||
//world.run_workload(render).unwrap();
|
world.run_workload(render).unwrap();
|
||||||
|
|
||||||
//Finish rendering
|
//Finish rendering
|
||||||
// let target = world.remove_unique::<RenderTarget>().unwrap();
|
let target = world.remove_unique::<RenderTarget>().unwrap();
|
||||||
// target.0.finish().unwrap();
|
target.0.finish().unwrap();
|
||||||
|
|
||||||
//After frame end
|
//After frame end
|
||||||
world.run_workload(after_frame_end).unwrap();
|
world.run_workload(after_frame_end).unwrap();
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
use std::{io::{BufReader, Read}, path::Path};
|
use std::{io::{BufReader, Read}, path::Path};
|
||||||
use hui::text::FontHandle;
|
use hui::text::FontHandle;
|
||||||
use shipyard::{AllStoragesView, NonSendSync, Unique, UniqueView, UniqueViewMut};
|
use shipyard::{AllStoragesView, NonSendSync, Unique, UniqueView, UniqueViewMut};
|
||||||
|
use glium::{texture::{SrgbTexture2dArray, MipmapsOption}, Program};
|
||||||
use kubi_shared::block::BlockTexture;
|
use kubi_shared::block::BlockTexture;
|
||||||
use crate::{filesystem::AssetManager, hui_integration::UiState, rendering::Renderer};
|
use crate::{filesystem::AssetManager, hui_integration::UiState, rendering::Renderer};
|
||||||
|
|
||||||
mod texture;
|
mod texture;
|
||||||
mod shaders;
|
mod shaders;
|
||||||
|
|
||||||
//use texture::load_texture2darray_prefab;
|
use texture::load_texture2darray_prefab;
|
||||||
|
use shaders::include_shader_prefab;
|
||||||
|
|
||||||
pub trait AssetPaths {
|
pub trait AssetPaths {
|
||||||
fn file_name(self) -> &'static str;
|
fn file_name(self) -> &'static str;
|
||||||
|
@ -39,7 +41,7 @@ impl AssetPaths for BlockTexture {
|
||||||
|
|
||||||
#[derive(Unique)]
|
#[derive(Unique)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct BlockTexturesPrefab(pub wgpu::Texture);
|
pub struct BlockTexturesPrefab(pub SrgbTexture2dArray);
|
||||||
|
|
||||||
// #[derive(Unique)]
|
// #[derive(Unique)]
|
||||||
// #[repr(transparent)]
|
// #[repr(transparent)]
|
||||||
|
@ -63,15 +65,15 @@ pub fn load_prefabs(
|
||||||
mut ui: NonSendSync<UniqueViewMut<UiState>>,
|
mut ui: NonSendSync<UniqueViewMut<UiState>>,
|
||||||
assman: UniqueView<AssetManager>
|
assman: UniqueView<AssetManager>
|
||||||
) {
|
) {
|
||||||
// log::info!("Loading textures...");
|
log::info!("Loading textures...");
|
||||||
// storages.add_unique_non_send_sync(BlockTexturesPrefab(
|
storages.add_unique_non_send_sync(BlockTexturesPrefab(
|
||||||
// load_texture2darray_prefab::<BlockTexture, _>(
|
load_texture2darray_prefab::<BlockTexture, _>(
|
||||||
// &assman,
|
&assman,
|
||||||
// "blocks".into(),
|
"blocks".into(),
|
||||||
// &renderer.display,
|
&renderer.display,
|
||||||
// MipmapsOption::AutoGeneratedMipmaps
|
MipmapsOption::AutoGeneratedMipmaps
|
||||||
// )
|
)
|
||||||
// ));
|
));
|
||||||
|
|
||||||
log::info!("Loading the UI stuff...");
|
log::info!("Loading the UI stuff...");
|
||||||
{
|
{
|
||||||
|
@ -83,33 +85,33 @@ pub fn load_prefabs(
|
||||||
storages.add_unique(UiFontPrefab(font_handle));
|
storages.add_unique(UiFontPrefab(font_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
//log::info!("Compiling shaders...");
|
log::info!("Compiling shaders...");
|
||||||
// storages.add_unique_non_send_sync(ChunkShaderPrefab(
|
storages.add_unique_non_send_sync(ChunkShaderPrefab(
|
||||||
// include_shader_prefab!(
|
include_shader_prefab!(
|
||||||
// "world",
|
"world",
|
||||||
// "../shaders/world.vert",
|
"../shaders/world.vert",
|
||||||
// "../shaders/world.frag",
|
"../shaders/world.frag",
|
||||||
// &renderer.display
|
&renderer.display
|
||||||
// )
|
)
|
||||||
// ));
|
));
|
||||||
// storages.add_unique_non_send_sync(ColoredShaderPrefab(
|
storages.add_unique_non_send_sync(ColoredShaderPrefab(
|
||||||
// include_shader_prefab!(
|
include_shader_prefab!(
|
||||||
// "colored",
|
"colored",
|
||||||
// "../shaders/colored.vert",
|
"../shaders/colored.vert",
|
||||||
// "../shaders/colored.frag",
|
"../shaders/colored.frag",
|
||||||
// &renderer.display
|
&renderer.display
|
||||||
// )
|
)
|
||||||
// ));
|
));
|
||||||
// storages.add_unique_non_send_sync(Colored2ShaderPrefab(
|
storages.add_unique_non_send_sync(Colored2ShaderPrefab(
|
||||||
// include_shader_prefab!(
|
include_shader_prefab!(
|
||||||
// "colored",
|
"colored",
|
||||||
// "../shaders/colored2.vert",
|
"../shaders/colored2.vert",
|
||||||
// "../shaders/colored2.frag",
|
"../shaders/colored2.frag",
|
||||||
// &renderer.display
|
&renderer.display
|
||||||
// )
|
)
|
||||||
// ));
|
));
|
||||||
|
|
||||||
//log::info!("releasing shader compiler");
|
log::info!("releasing shader compiler");
|
||||||
|
|
||||||
//renderer.display.release_shader_compiler();
|
//renderer.display.release_shader_compiler();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,46 @@
|
||||||
// use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
// use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
// use std::{path::PathBuf, io::BufReader};
|
use std::{path::PathBuf, io::BufReader};
|
||||||
// use crate::filesystem::AssetManager;
|
use glium::{texture::{SrgbTexture2dArray, RawImage2d, MipmapsOption}, backend::Facade};
|
||||||
// use super::AssetPaths;
|
use crate::filesystem::AssetManager;
|
||||||
|
use super::AssetPaths;
|
||||||
// pub fn load_texture2darray_prefab<
|
|
||||||
// T: AssetPaths + IntoEnumIterator,
|
pub fn load_texture2darray_prefab<
|
||||||
// E: Facade
|
T: AssetPaths + IntoEnumIterator,
|
||||||
// >(
|
E: Facade
|
||||||
// assman: &AssetManager,
|
>(
|
||||||
// directory: PathBuf,
|
assman: &AssetManager,
|
||||||
// facade: &E,
|
directory: PathBuf,
|
||||||
// mipmaps: MipmapsOption,
|
facade: &E,
|
||||||
// ) -> SrgbTexture2dArray {
|
mipmaps: MipmapsOption,
|
||||||
// log::info!("started loading {}", directory.as_os_str().to_str().unwrap());
|
) -> SrgbTexture2dArray {
|
||||||
// //Load raw images
|
log::info!("started loading {}", directory.as_os_str().to_str().unwrap());
|
||||||
// let tex_files: Vec<&'static str> = T::iter().map(|x| x.file_name()).collect();
|
//Load raw images
|
||||||
// let raw_images: Vec<RawImage2d<u8>> = tex_files.par_iter().map(|&file_name| {
|
let tex_files: Vec<&'static str> = T::iter().map(|x| x.file_name()).collect();
|
||||||
// log::info!("loading texture {}", file_name);
|
let raw_images: Vec<RawImage2d<u8>> = tex_files.par_iter().map(|&file_name| {
|
||||||
// //Get path to the image and open the file
|
log::info!("loading texture {}", file_name);
|
||||||
// let reader = {
|
//Get path to the image and open the file
|
||||||
// let path = directory.join(file_name);
|
let reader = {
|
||||||
// BufReader::new(assman.open_asset(&path).expect("Failed to open texture file"))
|
let path = directory.join(file_name);
|
||||||
// };
|
BufReader::new(assman.open_asset(&path).expect("Failed to open texture file"))
|
||||||
// //Parse image data
|
};
|
||||||
// let (image_data, dimensions) = {
|
//Parse image data
|
||||||
// let image = image::load(
|
let (image_data, dimensions) = {
|
||||||
// reader,
|
let image = image::load(
|
||||||
// image::ImageFormat::Png
|
reader,
|
||||||
// ).unwrap().to_rgba8();
|
image::ImageFormat::Png
|
||||||
// let dimensions = image.dimensions();
|
).unwrap().to_rgba8();
|
||||||
// (image.into_raw(), dimensions)
|
let dimensions = image.dimensions();
|
||||||
// };
|
(image.into_raw(), dimensions)
|
||||||
// //Create a glium RawImage
|
};
|
||||||
// RawImage2d::from_raw_rgba_reversed(
|
//Create a glium RawImage
|
||||||
// &image_data,
|
RawImage2d::from_raw_rgba_reversed(
|
||||||
// dimensions
|
&image_data,
|
||||||
// )
|
dimensions
|
||||||
// }).collect();
|
)
|
||||||
// log::info!("done loading texture files, uploading to the gpu");
|
}).collect();
|
||||||
// //Upload images to the GPU
|
log::info!("done loading texture files, uploading to the gpu");
|
||||||
// SrgbTexture2dArray::with_mipmaps(facade, raw_images, mipmaps)
|
//Upload images to the GPU
|
||||||
// .expect("Failed to upload texture array to GPU")
|
SrgbTexture2dArray::with_mipmaps(facade, raw_images, mipmaps)
|
||||||
// }
|
.expect("Failed to upload texture array to GPU")
|
||||||
|
}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
use pollster::FutureExt;
|
use shipyard::{Unique, NonSendSync, UniqueView, UniqueViewMut, View, IntoIter, AllStoragesView};
|
||||||
use raw_window_handle::HasRawWindowHandle;
|
|
||||||
use shipyard::{AllStoragesView, AllStoragesViewMut, IntoIter, NonSendSync, Unique, UniqueView, UniqueViewMut, View};
|
|
||||||
use wgpu::SurfaceTargetUnsafe;
|
|
||||||
use winit::{
|
use winit::{
|
||||||
event_loop::ActiveEventLoop,
|
event_loop::ActiveEventLoop,
|
||||||
window::{WindowAttributes, Fullscreen, Window},
|
window::{WindowAttributes, Fullscreen, Window},
|
||||||
dpi::PhysicalSize
|
dpi::PhysicalSize
|
||||||
};
|
};
|
||||||
use glam::{Vec3, UVec2};
|
use glam::{Vec3, UVec2};
|
||||||
use crate::{events::WindowResizedEvent, settings::{FullscreenMode, GameSettings}, state::is_ingame};
|
use crate::{events::WindowResizedEvent, settings::{GameSettings, FullscreenMode}};
|
||||||
|
|
||||||
pub mod primitives;
|
pub mod primitives;
|
||||||
pub mod world;
|
pub mod world;
|
||||||
|
@ -16,40 +13,24 @@ pub mod selection_box;
|
||||||
pub mod entities;
|
pub mod entities;
|
||||||
pub mod sumberge;
|
pub mod sumberge;
|
||||||
|
|
||||||
pub struct BufferPair {
|
|
||||||
pub index: wgpu::Buffer,
|
|
||||||
pub vertex: wgpu::Buffer,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Unique)]
|
#[derive(Unique)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct BackgroundColor(pub Vec3);
|
pub struct BackgroundColor(pub Vec3);
|
||||||
|
|
||||||
#[derive(Unique, Clone, Copy)]
|
#[derive(Unique, Clone, Copy)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[deprecated = "use Renderer.size instead"]
|
|
||||||
#[allow(deprecated)]
|
|
||||||
pub struct WindowSize(pub UVec2);
|
pub struct WindowSize(pub UVec2);
|
||||||
|
|
||||||
#[derive(Unique)]
|
#[derive(Unique)]
|
||||||
pub struct Renderer {
|
pub struct Renderer {
|
||||||
instance: wgpu::Instance,
|
pub window: Window,
|
||||||
surface: wgpu::Surface<'static>,
|
|
||||||
device: wgpu::Device,
|
|
||||||
queue: wgpu::Queue,
|
|
||||||
surface_config: wgpu::SurfaceConfiguration,
|
|
||||||
size: PhysicalSize<u32>,
|
|
||||||
// pub depth_texture: wgpu::Texture,
|
|
||||||
|
|
||||||
//must be last due to drop order
|
|
||||||
window: Window,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Renderer {
|
impl Renderer {
|
||||||
pub fn init(event_loop: &ActiveEventLoop, settings: &GameSettings) -> Self {
|
pub fn init(event_loop: &ActiveEventLoop, settings: &GameSettings) -> Self {
|
||||||
log::info!("initializing display");
|
log::info!("initializing display");
|
||||||
|
|
||||||
let window_attributes = Window::default_attributes()
|
let wb = WindowAttributes::new()
|
||||||
.with_title("kubi")
|
.with_title("kubi")
|
||||||
.with_maximized(true)
|
.with_maximized(true)
|
||||||
.with_min_inner_size(PhysicalSize::new(640, 480))
|
.with_min_inner_size(PhysicalSize::new(640, 480))
|
||||||
|
@ -63,7 +44,6 @@ impl Renderer {
|
||||||
let monitor = event_loop.primary_monitor().or_else(|| {
|
let monitor = event_loop.primary_monitor().or_else(|| {
|
||||||
event_loop.available_monitors().next()
|
event_loop.available_monitors().next()
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(monitor) = monitor {
|
if let Some(monitor) = monitor {
|
||||||
log::info!("monitor: {}", monitor.name().unwrap_or_else(|| "generic".into()));
|
log::info!("monitor: {}", monitor.name().unwrap_or_else(|| "generic".into()));
|
||||||
match fs_settings.mode {
|
match fs_settings.mode {
|
||||||
|
@ -95,151 +75,16 @@ impl Renderer {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let window = event_loop.create_window(window_attributes).unwrap();
|
|
||||||
|
|
||||||
let size = window.inner_size();
|
Self { window }
|
||||||
|
|
||||||
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
|
|
||||||
backends: wgpu::Backends::BROWSER_WEBGPU | wgpu::Backends::VULKAN | wgpu::Backends::GL,
|
|
||||||
..Default::default()
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a surface with `create_surface_unsafe` to get a surface with 'static lifetime
|
|
||||||
// It should never outlive the window it's created from
|
|
||||||
let surface = unsafe {
|
|
||||||
instance.create_surface_unsafe(SurfaceTargetUnsafe::from_window(&window).unwrap()).unwrap()
|
|
||||||
};
|
|
||||||
|
|
||||||
let adapter = instance.request_adapter(
|
|
||||||
&wgpu::RequestAdapterOptions {
|
|
||||||
power_preference: wgpu::PowerPreference::HighPerformance,
|
|
||||||
compatible_surface: Some(&surface),
|
|
||||||
force_fallback_adapter: false,
|
|
||||||
},
|
|
||||||
).block_on().unwrap();
|
|
||||||
|
|
||||||
let (device, queue) = adapter.request_device(
|
|
||||||
&wgpu::DeviceDescriptor {
|
|
||||||
label: None,
|
|
||||||
required_features: wgpu::Features::empty(),
|
|
||||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
|
||||||
},
|
|
||||||
None,
|
|
||||||
).block_on().unwrap();
|
|
||||||
|
|
||||||
let surface_config = surface.get_default_config(&adapter, size.width, size.height).unwrap();
|
|
||||||
surface.configure(&device, &surface_config);
|
|
||||||
|
|
||||||
Self { window, instance, surface, device, queue, surface_config, size }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn resize(&mut self, size: PhysicalSize<u32>) {
|
|
||||||
if size.width == 0 || size.height == 0 {
|
|
||||||
log::warn!("Ignoring resize event with zero width or height");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if self.size == size {
|
|
||||||
log::warn!("Ignoring resize event with same size");
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log::debug!("resizing surface to {:?}", size);
|
|
||||||
self.size = size;
|
|
||||||
self.surface_config.width = size.width;
|
|
||||||
self.surface_config.height = size.height;
|
|
||||||
self.surface.configure(&self.device, &self.surface_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reconfigure(&self) {
|
|
||||||
self.surface.configure(&self.device, &self.surface_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
//getters:
|
|
||||||
pub fn size(&self) -> PhysicalSize<u32> {
|
|
||||||
self.size
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn window(&self) -> &Window {
|
|
||||||
&self.window
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn surface(&self) -> &wgpu::Surface<'static> {
|
|
||||||
&self.surface
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn device(&self) -> &wgpu::Device {
|
|
||||||
&self.device
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn queue(&self) -> &wgpu::Queue {
|
|
||||||
&self.queue
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn surface_config(&self) -> &wgpu::SurfaceConfiguration {
|
|
||||||
&self.surface_config
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render_master(storages: AllStoragesViewMut) {
|
pub fn clear_background(
|
||||||
let renderer = storages.borrow::<UniqueView<Renderer>>().unwrap();
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
|
color: UniqueView<BackgroundColor>,
|
||||||
let mut encoder = renderer.device.create_command_encoder(&wgpu::CommandEncoderDescriptor {
|
|
||||||
label: Some("main_encoder"),
|
|
||||||
});
|
|
||||||
let surface_texture = renderer.surface().get_current_texture().unwrap();
|
|
||||||
let surface_view = surface_texture.texture.create_view(&wgpu::TextureViewDescriptor::default());
|
|
||||||
|
|
||||||
if storages.run(is_ingame) {
|
|
||||||
let bg_color = storages.borrow::<UniqueView<BackgroundColor>>().unwrap();
|
|
||||||
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
|
||||||
label: Some("main0_pass"),
|
|
||||||
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
|
|
||||||
view: &surface_view,
|
|
||||||
resolve_target: None,
|
|
||||||
ops: wgpu::Operations {
|
|
||||||
load: wgpu::LoadOp::Clear(wgpu::Color {
|
|
||||||
r: bg_color.0.x as f64,
|
|
||||||
g: bg_color.0.y as f64,
|
|
||||||
b: bg_color.0.z as f64,
|
|
||||||
a: 1.0,
|
|
||||||
}),
|
|
||||||
store: wgpu::StoreOp::Store,
|
|
||||||
},
|
|
||||||
})],
|
|
||||||
depth_stencil_attachment: None,
|
|
||||||
..Default::default()
|
|
||||||
});
|
|
||||||
|
|
||||||
let data = (&mut render_pass, &*renderer);
|
|
||||||
|
|
||||||
storages.run_with_data(world::draw_world, data);
|
|
||||||
|
|
||||||
// render_pass.set_pipeline(&renderer.pipeline);
|
|
||||||
// render_pass.set_bind_group(0, &renderer.bind_group, &[]);
|
|
||||||
// render_pass.set_vertex_buffer(0, renderer.vertex_buffer.slice(..));
|
|
||||||
// render_pass.set_index_buffer(renderer.index_buffer.slice(..));
|
|
||||||
// render_pass.draw_indexed(0..renderer.num_indices, 0, 0..1);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.queue().submit(std::iter::once(encoder.finish()));
|
|
||||||
surface_texture.present();
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn clear_background(
|
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
|
||||||
// color: UniqueView<BackgroundColor>,
|
|
||||||
// ) {
|
|
||||||
// target.0.clear_color_srgb_and_depth((color.0.x, color.0.y, color.0.z, 1.), 1.);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Resize the renderer
|
|
||||||
|
|
||||||
pub fn resize_renderer(
|
|
||||||
mut renderer: UniqueViewMut<Renderer>,
|
|
||||||
resize: View<WindowResizedEvent>,
|
|
||||||
) {
|
) {
|
||||||
if let Some(size) = resize.iter().last() {
|
target.0.clear_color_srgb_and_depth((color.0.x, color.0.y, color.0.z, 1.), 1.);
|
||||||
renderer.resize(PhysicalSize::new(size.0.x, size.0.y));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//not sure if this belongs here
|
//not sure if this belongs here
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
// use shipyard::{NonSendSync, UniqueViewMut, UniqueView, View, IntoIter, IntoWithId};
|
use shipyard::{NonSendSync, UniqueViewMut, UniqueView, View, IntoIter, IntoWithId};
|
||||||
// use glium::{DepthTest, Depth, PolygonMode, BackfaceCullingMode, DrawParameters, Surface, uniform};
|
use glium::{DepthTest, Depth, PolygonMode, BackfaceCullingMode, DrawParameters, Surface, uniform};
|
||||||
// use kubi_shared::{entity::Entity, transform::Transform};
|
use kubi_shared::{entity::Entity, transform::Transform};
|
||||||
// use crate::{
|
use crate::{
|
||||||
// prefabs::ColoredShaderPrefab,
|
prefabs::ColoredShaderPrefab,
|
||||||
// camera::Camera,
|
camera::Camera,
|
||||||
// settings::GameSettings
|
settings::GameSettings
|
||||||
// };
|
};
|
||||||
// use super::{
|
use super::{
|
||||||
// RenderTarget,
|
RenderTarget,
|
||||||
// primitives::cube::CenteredCubePrimitive
|
primitives::cube::CenteredCubePrimitive
|
||||||
// };
|
};
|
||||||
|
|
||||||
// // TODO: entity models
|
// TODO: entity models
|
||||||
// pub fn render_entities(
|
pub fn render_entities(
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
// buffers: NonSendSync<UniqueView<CenteredCubePrimitive>>,
|
buffers: NonSendSync<UniqueView<CenteredCubePrimitive>>,
|
||||||
// program: NonSendSync<UniqueView<ColoredShaderPrefab>>,
|
program: NonSendSync<UniqueView<ColoredShaderPrefab>>,
|
||||||
// camera: View<Camera>,
|
camera: View<Camera>,
|
||||||
// settings: UniqueView<GameSettings>,
|
settings: UniqueView<GameSettings>,
|
||||||
// entities: View<Entity>,
|
entities: View<Entity>,
|
||||||
// transform: View<Transform>,
|
transform: View<Transform>,
|
||||||
// ) {
|
) {
|
||||||
// let (camera_id, camera) = camera.iter().with_id().next().expect("No cameras in the scene");
|
let (camera_id, camera) = camera.iter().with_id().next().expect("No cameras in the scene");
|
||||||
|
|
||||||
// let draw_parameters = DrawParameters {
|
let draw_parameters = DrawParameters {
|
||||||
// depth: Depth {
|
depth: Depth {
|
||||||
// test: DepthTest::IfLess,
|
test: DepthTest::IfLess,
|
||||||
// write: true,
|
write: true,
|
||||||
// ..Default::default()
|
..Default::default()
|
||||||
// },
|
},
|
||||||
// multisampling: settings.msaa.is_some(),
|
multisampling: settings.msaa.is_some(),
|
||||||
// polygon_mode: PolygonMode::Fill,
|
polygon_mode: PolygonMode::Fill,
|
||||||
// backface_culling: BackfaceCullingMode::CullClockwise,
|
backface_culling: BackfaceCullingMode::CullClockwise,
|
||||||
// ..Default::default()
|
..Default::default()
|
||||||
// };
|
};
|
||||||
// let view = camera.view_matrix.to_cols_array_2d();
|
let view = camera.view_matrix.to_cols_array_2d();
|
||||||
// let perspective = camera.perspective_matrix.to_cols_array_2d();
|
let perspective = camera.perspective_matrix.to_cols_array_2d();
|
||||||
|
|
||||||
// for (entity_id, (_, trans)) in (&entities, &transform).iter().with_id() {
|
for (entity_id, (_, trans)) in (&entities, &transform).iter().with_id() {
|
||||||
// //skip rendering camera holder (as the entity would block the view)
|
//skip rendering camera holder (as the entity would block the view)
|
||||||
// if entity_id == camera_id { continue }
|
if entity_id == camera_id { continue }
|
||||||
|
|
||||||
// //render entity
|
//render entity
|
||||||
// target.0.draw(
|
target.0.draw(
|
||||||
// &buffers.0,
|
&buffers.0,
|
||||||
// &buffers.1,
|
&buffers.1,
|
||||||
// &program.0,
|
&program.0,
|
||||||
// &uniform! {
|
&uniform! {
|
||||||
// color: [1.0, 1.0, 1.0, 1.0_f32],
|
color: [1.0, 1.0, 1.0, 1.0_f32],
|
||||||
// model: trans.0.to_cols_array_2d(),
|
model: trans.0.to_cols_array_2d(),
|
||||||
// view: view,
|
view: view,
|
||||||
// perspective: perspective,
|
perspective: perspective,
|
||||||
// },
|
},
|
||||||
// &draw_parameters
|
&draw_parameters
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
// use shipyard::{Workload, IntoWorkload};
|
use shipyard::{Workload, IntoWorkload};
|
||||||
// use glium::implement_vertex;
|
use glium::implement_vertex;
|
||||||
|
|
||||||
// pub mod cube;
|
pub mod cube;
|
||||||
// pub mod rect;
|
pub mod rect;
|
||||||
// pub mod stri;
|
pub mod stri;
|
||||||
|
|
||||||
// use cube::init_cube_primitive;
|
use cube::init_cube_primitive;
|
||||||
// use rect::init_rect_primitive;
|
use rect::init_rect_primitive;
|
||||||
// use stri::init_stri_primitive;
|
use stri::init_stri_primitive;
|
||||||
|
|
||||||
// #[derive(Clone, Copy, Default)]
|
#[derive(Clone, Copy, Default)]
|
||||||
// pub struct PositionOnlyVertex {
|
pub struct PositionOnlyVertex {
|
||||||
// pub position: [f32; 3],
|
pub position: [f32; 3],
|
||||||
// }
|
}
|
||||||
// implement_vertex!(PositionOnlyVertex, position);
|
implement_vertex!(PositionOnlyVertex, position);
|
||||||
|
|
||||||
// #[derive(Clone, Copy, Default)]
|
#[derive(Clone, Copy, Default)]
|
||||||
// pub struct PositionOnlyVertex2d {
|
pub struct PositionOnlyVertex2d {
|
||||||
// pub position: [f32; 2],
|
pub position: [f32; 2],
|
||||||
// }
|
}
|
||||||
// implement_vertex!(PositionOnlyVertex2d, position);
|
implement_vertex!(PositionOnlyVertex2d, position);
|
||||||
|
|
||||||
// pub fn init_primitives() -> Workload {
|
pub fn init_primitives() -> Workload {
|
||||||
// (
|
(
|
||||||
// init_cube_primitive,
|
init_cube_primitive,
|
||||||
// init_rect_primitive,
|
init_rect_primitive,
|
||||||
// init_stri_primitive,
|
init_stri_primitive,
|
||||||
// ).into_workload()
|
).into_workload()
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,85 +1,85 @@
|
||||||
// use shipyard::{AllStoragesView, NonSendSync, UniqueView, Unique};
|
use shipyard::{AllStoragesView, NonSendSync, UniqueView, Unique};
|
||||||
// use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType};
|
use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType};
|
||||||
// use crate::rendering::Renderer;
|
use crate::rendering::Renderer;
|
||||||
// use super::PositionOnlyVertex;
|
use super::PositionOnlyVertex;
|
||||||
|
|
||||||
// #[derive(Unique)]
|
#[derive(Unique)]
|
||||||
// pub struct CubePrimitive(pub VertexBuffer<PositionOnlyVertex>, pub IndexBuffer<u16>);
|
pub struct CubePrimitive(pub VertexBuffer<PositionOnlyVertex>, pub IndexBuffer<u16>);
|
||||||
|
|
||||||
// #[derive(Unique)]
|
#[derive(Unique)]
|
||||||
// pub struct CenteredCubePrimitive(pub VertexBuffer<PositionOnlyVertex>, pub IndexBuffer<u16>);
|
pub struct CenteredCubePrimitive(pub VertexBuffer<PositionOnlyVertex>, pub IndexBuffer<u16>);
|
||||||
|
|
||||||
// const CENTERED_CUBE_VERTICES: &[PositionOnlyVertex] = &[
|
const CENTERED_CUBE_VERTICES: &[PositionOnlyVertex] = &[
|
||||||
// // front
|
// front
|
||||||
// PositionOnlyVertex { position: [-0.5, -0.5, 0.5] },
|
PositionOnlyVertex { position: [-0.5, -0.5, 0.5] },
|
||||||
// PositionOnlyVertex { position: [ 0.5, -0.5, 0.5] },
|
PositionOnlyVertex { position: [ 0.5, -0.5, 0.5] },
|
||||||
// PositionOnlyVertex { position: [ 0.5, 0.5, 0.5] },
|
PositionOnlyVertex { position: [ 0.5, 0.5, 0.5] },
|
||||||
// PositionOnlyVertex { position: [-0.5, 0.5, 0.5] },
|
PositionOnlyVertex { position: [-0.5, 0.5, 0.5] },
|
||||||
// // back
|
// back
|
||||||
// PositionOnlyVertex { position: [-0.5, -0.5, -0.5] },
|
PositionOnlyVertex { position: [-0.5, -0.5, -0.5] },
|
||||||
// PositionOnlyVertex { position: [ 0.5, -0.5, -0.5] },
|
PositionOnlyVertex { position: [ 0.5, -0.5, -0.5] },
|
||||||
// PositionOnlyVertex { position: [ 0.5, 0.5, -0.5] },
|
PositionOnlyVertex { position: [ 0.5, 0.5, -0.5] },
|
||||||
// PositionOnlyVertex { position: [-0.5, 0.5, -0.5] },
|
PositionOnlyVertex { position: [-0.5, 0.5, -0.5] },
|
||||||
// ];
|
];
|
||||||
// const CUBE_VERTICES: &[PositionOnlyVertex] = &[
|
const CUBE_VERTICES: &[PositionOnlyVertex] = &[
|
||||||
// // front
|
// front
|
||||||
// PositionOnlyVertex { position: [0.0, 0.0, 1.0] },
|
PositionOnlyVertex { position: [0.0, 0.0, 1.0] },
|
||||||
// PositionOnlyVertex { position: [1.0, 0.0, 1.0] },
|
PositionOnlyVertex { position: [1.0, 0.0, 1.0] },
|
||||||
// PositionOnlyVertex { position: [1.0, 1.0, 1.0] },
|
PositionOnlyVertex { position: [1.0, 1.0, 1.0] },
|
||||||
// PositionOnlyVertex { position: [0.0, 1.0, 1.0] },
|
PositionOnlyVertex { position: [0.0, 1.0, 1.0] },
|
||||||
// // back
|
// back
|
||||||
// PositionOnlyVertex { position: [0.0, 0.0, 0.0] },
|
PositionOnlyVertex { position: [0.0, 0.0, 0.0] },
|
||||||
// PositionOnlyVertex { position: [1.0, 0.0, 0.0] },
|
PositionOnlyVertex { position: [1.0, 0.0, 0.0] },
|
||||||
// PositionOnlyVertex { position: [1.0, 1.0, 0.0] },
|
PositionOnlyVertex { position: [1.0, 1.0, 0.0] },
|
||||||
// PositionOnlyVertex { position: [0.0, 1.0, 0.0] },
|
PositionOnlyVertex { position: [0.0, 1.0, 0.0] },
|
||||||
// ];
|
];
|
||||||
// const CUBE_INDICES: &[u16] = &[
|
const CUBE_INDICES: &[u16] = &[
|
||||||
// // front
|
// front
|
||||||
// 0, 1, 2,
|
0, 1, 2,
|
||||||
// 2, 3, 0,
|
2, 3, 0,
|
||||||
// // right
|
// right
|
||||||
// 1, 5, 6,
|
1, 5, 6,
|
||||||
// 6, 2, 1,
|
6, 2, 1,
|
||||||
// // back
|
// back
|
||||||
// 7, 6, 5,
|
7, 6, 5,
|
||||||
// 5, 4, 7,
|
5, 4, 7,
|
||||||
// // left
|
// left
|
||||||
// 4, 0, 3,
|
4, 0, 3,
|
||||||
// 3, 7, 4,
|
3, 7, 4,
|
||||||
// // bottom
|
// bottom
|
||||||
// 4, 5, 1,
|
4, 5, 1,
|
||||||
// 1, 0, 4,
|
1, 0, 4,
|
||||||
// // top
|
// top
|
||||||
// 3, 2, 6,
|
3, 2, 6,
|
||||||
// 6, 7, 3
|
6, 7, 3
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// pub(super) fn init_cube_primitive(
|
pub(super) fn init_cube_primitive(
|
||||||
// storages: AllStoragesView,
|
storages: AllStoragesView,
|
||||||
// display: NonSendSync<UniqueView<Renderer>>
|
display: NonSendSync<UniqueView<Renderer>>
|
||||||
// ) {
|
) {
|
||||||
// {
|
{
|
||||||
// let vert = VertexBuffer::immutable(
|
let vert = VertexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// CUBE_VERTICES
|
CUBE_VERTICES
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// let index = IndexBuffer::immutable(
|
let index = IndexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// PrimitiveType::TrianglesList,
|
PrimitiveType::TrianglesList,
|
||||||
// CUBE_INDICES
|
CUBE_INDICES
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// storages.add_unique_non_send_sync(CubePrimitive(vert, index));
|
storages.add_unique_non_send_sync(CubePrimitive(vert, index));
|
||||||
// }
|
}
|
||||||
// {
|
{
|
||||||
// let vert = VertexBuffer::immutable(
|
let vert = VertexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// CENTERED_CUBE_VERTICES
|
CENTERED_CUBE_VERTICES
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// let index = IndexBuffer::immutable(
|
let index = IndexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// PrimitiveType::TrianglesList,
|
PrimitiveType::TrianglesList,
|
||||||
// CUBE_INDICES
|
CUBE_INDICES
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// storages.add_unique_non_send_sync(CenteredCubePrimitive(vert, index));
|
storages.add_unique_non_send_sync(CenteredCubePrimitive(vert, index));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
// use shipyard::{Unique, AllStoragesView, NonSendSync, UniqueView};
|
use shipyard::{Unique, AllStoragesView, NonSendSync, UniqueView};
|
||||||
// use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType};
|
use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType};
|
||||||
// use crate::rendering::Renderer;
|
use crate::rendering::Renderer;
|
||||||
// use super::PositionOnlyVertex2d;
|
use super::PositionOnlyVertex2d;
|
||||||
|
|
||||||
// #[derive(Unique)]
|
#[derive(Unique)]
|
||||||
// pub struct RectPrimitive(pub VertexBuffer<PositionOnlyVertex2d>, pub IndexBuffer<u16>);
|
pub struct RectPrimitive(pub VertexBuffer<PositionOnlyVertex2d>, pub IndexBuffer<u16>);
|
||||||
|
|
||||||
// const RECT_VERTEX: &[PositionOnlyVertex2d] = &[
|
const RECT_VERTEX: &[PositionOnlyVertex2d] = &[
|
||||||
// PositionOnlyVertex2d { position: [0., 0.] },
|
PositionOnlyVertex2d { position: [0., 0.] },
|
||||||
// PositionOnlyVertex2d { position: [1., 0.] },
|
PositionOnlyVertex2d { position: [1., 0.] },
|
||||||
// PositionOnlyVertex2d { position: [0., 1.] },
|
PositionOnlyVertex2d { position: [0., 1.] },
|
||||||
// PositionOnlyVertex2d { position: [1., 1.] },
|
PositionOnlyVertex2d { position: [1., 1.] },
|
||||||
// ];
|
];
|
||||||
// const RECT_INDEX: &[u16] = &[0, 1, 2, 1, 3, 2];
|
const RECT_INDEX: &[u16] = &[0, 1, 2, 1, 3, 2];
|
||||||
|
|
||||||
// pub(super) fn init_rect_primitive(
|
pub(super) fn init_rect_primitive(
|
||||||
// storages: AllStoragesView,
|
storages: AllStoragesView,
|
||||||
// display: NonSendSync<UniqueView<Renderer>>
|
display: NonSendSync<UniqueView<Renderer>>
|
||||||
// ) {
|
) {
|
||||||
// let vert = VertexBuffer::immutable(
|
let vert = VertexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// RECT_VERTEX
|
RECT_VERTEX
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// let index = IndexBuffer::immutable(
|
let index = IndexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// PrimitiveType::TrianglesList,
|
PrimitiveType::TrianglesList,
|
||||||
// RECT_INDEX
|
RECT_INDEX
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// storages.add_unique_non_send_sync(RectPrimitive(vert, index));
|
storages.add_unique_non_send_sync(RectPrimitive(vert, index));
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
// use shipyard::{Unique, AllStoragesView, NonSendSync, UniqueView};
|
use shipyard::{Unique, AllStoragesView, NonSendSync, UniqueView};
|
||||||
// use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType};
|
use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType};
|
||||||
// use crate::rendering::Renderer;
|
use crate::rendering::Renderer;
|
||||||
// use super::PositionOnlyVertex2d;
|
use super::PositionOnlyVertex2d;
|
||||||
|
|
||||||
// #[derive(Unique)]
|
#[derive(Unique)]
|
||||||
// pub struct STriPrimitive(pub VertexBuffer<PositionOnlyVertex2d>, pub IndexBuffer<u16>);
|
pub struct STriPrimitive(pub VertexBuffer<PositionOnlyVertex2d>, pub IndexBuffer<u16>);
|
||||||
|
|
||||||
// const STRI_VERTEX: &[PositionOnlyVertex2d] = &[
|
const STRI_VERTEX: &[PositionOnlyVertex2d] = &[
|
||||||
// PositionOnlyVertex2d { position: [-1., -1.] },
|
PositionOnlyVertex2d { position: [-1., -1.] },
|
||||||
// PositionOnlyVertex2d { position: [ 3., -1.] },
|
PositionOnlyVertex2d { position: [ 3., -1.] },
|
||||||
// PositionOnlyVertex2d { position: [-1., 3.] },
|
PositionOnlyVertex2d { position: [-1., 3.] },
|
||||||
// ];
|
];
|
||||||
// const STRI_INDEX: &[u16] = &[0, 1, 2];
|
const STRI_INDEX: &[u16] = &[0, 1, 2];
|
||||||
|
|
||||||
// pub(super) fn init_stri_primitive(
|
pub(super) fn init_stri_primitive(
|
||||||
// storages: AllStoragesView,
|
storages: AllStoragesView,
|
||||||
// display: NonSendSync<UniqueView<Renderer>>
|
display: NonSendSync<UniqueView<Renderer>>
|
||||||
// ) {
|
) {
|
||||||
// let vert = VertexBuffer::immutable(
|
let vert = VertexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// STRI_VERTEX
|
STRI_VERTEX
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// let index = IndexBuffer::immutable(
|
let index = IndexBuffer::immutable(
|
||||||
// &display.display,
|
&display.display,
|
||||||
// PrimitiveType::TrianglesList,
|
PrimitiveType::TrianglesList,
|
||||||
// STRI_INDEX
|
STRI_INDEX
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// storages.add_unique_non_send_sync(STriPrimitive(vert, index));
|
storages.add_unique_non_send_sync(STriPrimitive(vert, index));
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,59 +1,59 @@
|
||||||
// use glam::{Mat4, Vec3, Quat};
|
use glam::{Mat4, Vec3, Quat};
|
||||||
// use shipyard::{View, IntoIter, NonSendSync, UniqueViewMut, UniqueView};
|
use shipyard::{View, IntoIter, NonSendSync, UniqueViewMut, UniqueView};
|
||||||
// use glium::{
|
use glium::{
|
||||||
// Surface,
|
Surface,
|
||||||
// DrawParameters,
|
DrawParameters,
|
||||||
// BackfaceCullingMode,
|
BackfaceCullingMode,
|
||||||
// Blend, Depth, DepthTest,
|
Blend, Depth, DepthTest,
|
||||||
// uniform,
|
uniform,
|
||||||
// };
|
};
|
||||||
// use crate::{
|
use crate::{
|
||||||
// world::raycast::LookingAtBlock,
|
world::raycast::LookingAtBlock,
|
||||||
// camera::Camera,
|
camera::Camera,
|
||||||
// prefabs::ColoredShaderPrefab
|
prefabs::ColoredShaderPrefab
|
||||||
// };
|
};
|
||||||
// use super::{
|
use super::{
|
||||||
// RenderTarget,
|
RenderTarget,
|
||||||
// primitives::cube::CubePrimitive,
|
primitives::cube::CubePrimitive,
|
||||||
// };
|
};
|
||||||
|
|
||||||
// const SMOL: f32 = 0.0025;
|
const SMOL: f32 = 0.0025;
|
||||||
|
|
||||||
// pub fn render_selection_box(
|
pub fn render_selection_box(
|
||||||
// lookat: View<LookingAtBlock>,
|
lookat: View<LookingAtBlock>,
|
||||||
// camera: View<Camera>,
|
camera: View<Camera>,
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
// program: NonSendSync<UniqueView<ColoredShaderPrefab>>,
|
program: NonSendSync<UniqueView<ColoredShaderPrefab>>,
|
||||||
// buffers: NonSendSync<UniqueView<CubePrimitive>>,
|
buffers: NonSendSync<UniqueView<CubePrimitive>>,
|
||||||
// ) {
|
) {
|
||||||
// let camera = camera.iter().next().unwrap();
|
let camera = camera.iter().next().unwrap();
|
||||||
// let Some(lookat) = lookat.iter().next() else { return };
|
let Some(lookat) = lookat.iter().next() else { return };
|
||||||
// let Some(lookat) = lookat.0 else { return };
|
let Some(lookat) = lookat.0 else { return };
|
||||||
|
|
||||||
// //Darken block
|
//Darken block
|
||||||
// target.0.draw(
|
target.0.draw(
|
||||||
// &buffers.0,
|
&buffers.0,
|
||||||
// &buffers.1,
|
&buffers.1,
|
||||||
// &program.0,
|
&program.0,
|
||||||
// &uniform! {
|
&uniform! {
|
||||||
// color: [0., 0., 0., 0.5_f32],
|
color: [0., 0., 0., 0.5_f32],
|
||||||
// model: Mat4::from_scale_rotation_translation(
|
model: Mat4::from_scale_rotation_translation(
|
||||||
// Vec3::splat(1. + SMOL * 2.),
|
Vec3::splat(1. + SMOL * 2.),
|
||||||
// Quat::default(),
|
Quat::default(),
|
||||||
// lookat.block_position.as_vec3() - Vec3::splat(SMOL)
|
lookat.block_position.as_vec3() - Vec3::splat(SMOL)
|
||||||
// ).to_cols_array_2d(),
|
).to_cols_array_2d(),
|
||||||
// perspective: camera.perspective_matrix.to_cols_array_2d(),
|
perspective: camera.perspective_matrix.to_cols_array_2d(),
|
||||||
// view: camera.view_matrix.to_cols_array_2d(),
|
view: camera.view_matrix.to_cols_array_2d(),
|
||||||
// },
|
},
|
||||||
// &DrawParameters {
|
&DrawParameters {
|
||||||
// backface_culling: BackfaceCullingMode::CullClockwise,
|
backface_culling: BackfaceCullingMode::CullClockwise,
|
||||||
// blend: Blend::alpha_blending(),
|
blend: Blend::alpha_blending(),
|
||||||
// depth: Depth {
|
depth: Depth {
|
||||||
// //this may be unreliable... unless scale is applied! hacky...
|
//this may be unreliable... unless scale is applied! hacky...
|
||||||
// test: DepthTest::IfLessOrEqual,
|
test: DepthTest::IfLessOrEqual,
|
||||||
// ..Default::default()
|
..Default::default()
|
||||||
// },
|
},
|
||||||
// ..Default::default()
|
..Default::default()
|
||||||
// }
|
}
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
// use glium::{uniform, Blend, DrawParameters, Surface};
|
use glium::{uniform, Blend, DrawParameters, Surface};
|
||||||
// use kubi_shared::transform::Transform;
|
use kubi_shared::transform::Transform;
|
||||||
// use shipyard::{IntoIter, NonSendSync, UniqueView, UniqueViewMut, View};
|
use shipyard::{IntoIter, NonSendSync, UniqueView, UniqueViewMut, View};
|
||||||
// use crate::{
|
use crate::{
|
||||||
// player::MainPlayer,
|
player::MainPlayer,
|
||||||
// prefabs::Colored2ShaderPrefab,
|
prefabs::Colored2ShaderPrefab,
|
||||||
// rendering::primitives::stri::STriPrimitive,
|
rendering::primitives::stri::STriPrimitive,
|
||||||
// world::ChunkStorage,
|
world::ChunkStorage,
|
||||||
// };
|
};
|
||||||
// use super::RenderTarget;
|
use super::RenderTarget;
|
||||||
|
|
||||||
// pub fn render_submerged_view(
|
pub fn render_submerged_view(
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
// primitive: NonSendSync<UniqueView<STriPrimitive>>,
|
primitive: NonSendSync<UniqueView<STriPrimitive>>,
|
||||||
// program: NonSendSync<UniqueView<Colored2ShaderPrefab>>,
|
program: NonSendSync<UniqueView<Colored2ShaderPrefab>>,
|
||||||
// plr: View<MainPlayer>,
|
plr: View<MainPlayer>,
|
||||||
// trans: View<Transform>,
|
trans: View<Transform>,
|
||||||
// world: UniqueView<ChunkStorage>,
|
world: UniqueView<ChunkStorage>,
|
||||||
// ) {
|
) {
|
||||||
// let (_, plr_trans) = (&plr, &trans).iter().next().expect("Main player MIA");
|
let (_, plr_trans) = (&plr, &trans).iter().next().expect("Main player MIA");
|
||||||
// let plr_pos = plr_trans.0.to_scale_rotation_translation().2;
|
let plr_pos = plr_trans.0.to_scale_rotation_translation().2;
|
||||||
// let block_at_pos = world.get_block(plr_pos.floor().as_ivec3());
|
let block_at_pos = world.get_block(plr_pos.floor().as_ivec3());
|
||||||
// let Some(block_at_pos) = block_at_pos else { return };
|
let Some(block_at_pos) = block_at_pos else { return };
|
||||||
// let Some(color) = block_at_pos.descriptor().submerge else { return };
|
let Some(color) = block_at_pos.descriptor().submerge else { return };
|
||||||
|
|
||||||
// let draw_parameters = DrawParameters {
|
let draw_parameters = DrawParameters {
|
||||||
// blend: Blend::alpha_blending(),
|
blend: Blend::alpha_blending(),
|
||||||
// ..Default::default()
|
..Default::default()
|
||||||
// };
|
};
|
||||||
// target.0.draw(
|
target.0.draw(
|
||||||
// &primitive.0,
|
&primitive.0,
|
||||||
// &primitive.1,
|
&primitive.1,
|
||||||
// &program.0,
|
&program.0,
|
||||||
// &uniform! {
|
&uniform! {
|
||||||
// color: color.to_array(),
|
color: color.to_array(),
|
||||||
// },
|
},
|
||||||
// &draw_parameters,
|
&draw_parameters,
|
||||||
// ).unwrap();
|
).unwrap();
|
||||||
// }
|
}
|
||||||
|
|
|
@ -1,31 +1,38 @@
|
||||||
use bytemuck::{Pod, Zeroable};
|
use glam::{ivec3, IVec3, Mat4, Quat, Vec3};
|
||||||
use glam::IVec3;
|
use shipyard::{track, AllStoragesView, IntoIter, NonSendSync, Unique, UniqueView, UniqueViewMut, View};
|
||||||
use shipyard::{AllStoragesView, NonSendSync, Unique, UniqueView, UniqueViewMut, View};
|
use glium::{
|
||||||
use kubi_shared::transform::Transform;
|
draw_parameters::{
|
||||||
use crate::{camera::Camera, settings::GameSettings, world::{ChunkMeshStorage, ChunkStorage}};
|
BackfaceCullingMode, Depth, DepthTest, PolygonMode
|
||||||
use super::Renderer;
|
}, implement_vertex, uniform, uniforms::{
|
||||||
|
MagnifySamplerFilter, MinifySamplerFilter, Sampler, SamplerBehavior, SamplerWrapFunction
|
||||||
|
}, Blend, DrawParameters, Smooth, Surface
|
||||||
|
};
|
||||||
|
use crate::{
|
||||||
|
camera::Camera,
|
||||||
|
player::MainPlayer,
|
||||||
|
transform::Transform,
|
||||||
|
prefabs::{
|
||||||
|
ChunkShaderPrefab,
|
||||||
|
BlockTexturesPrefab,
|
||||||
|
ColoredShaderPrefab,
|
||||||
|
},
|
||||||
|
world::{
|
||||||
|
ChunkStorage,
|
||||||
|
ChunkMeshStorage,
|
||||||
|
chunk::CHUNK_SIZE,
|
||||||
|
}, settings::GameSettings,
|
||||||
|
};
|
||||||
|
use super::{RenderTarget, primitives::cube::CubePrimitive};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Pod, Zeroable)]
|
#[derive(Clone, Copy)]
|
||||||
#[repr(C, packed)]
|
#[repr(C)]
|
||||||
pub struct ChunkVertex {
|
pub struct ChunkVertex {
|
||||||
pub position: [f32; 3],
|
pub position: [f32; 3],
|
||||||
pub normal: [f32; 3],
|
pub normal: [f32; 3],
|
||||||
pub uv: [f32; 2],
|
pub uv: [f32; 2],
|
||||||
pub tex_index: u8,
|
pub tex_index: u8,
|
||||||
}
|
}
|
||||||
|
implement_vertex!(ChunkVertex, position, normal, uv, tex_index);
|
||||||
impl ChunkVertex {
|
|
||||||
pub const LAYOUT: wgpu::VertexBufferLayout<'static> = wgpu::VertexBufferLayout {
|
|
||||||
array_stride: std::mem::size_of::<ChunkVertex>() as wgpu::BufferAddress,
|
|
||||||
step_mode: wgpu::VertexStepMode::Vertex,
|
|
||||||
attributes: &wgpu::vertex_attr_array![
|
|
||||||
0 => Float32x3,
|
|
||||||
1 => Float32x3,
|
|
||||||
2 => Float32x2,
|
|
||||||
3 => Uint32,
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Unique)]
|
#[derive(Unique)]
|
||||||
pub struct TransChunkQueue(pub Vec<IVec3>);
|
pub struct TransChunkQueue(pub Vec<IVec3>);
|
||||||
|
@ -34,221 +41,208 @@ pub fn init_trans_chunk_queue(storages: AllStoragesView) {
|
||||||
storages.add_unique(TransChunkQueue(Vec::with_capacity(512)));
|
storages.add_unique(TransChunkQueue(Vec::with_capacity(512)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn draw_params(settings: &GameSettings) -> DrawParameters {
|
||||||
|
DrawParameters {
|
||||||
|
depth: Depth {
|
||||||
|
test: DepthTest::IfLess,
|
||||||
|
write: true,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
multisampling: settings.msaa.is_some(),
|
||||||
|
polygon_mode: PolygonMode::Fill, //Change to Line for wireframe
|
||||||
|
backface_culling: BackfaceCullingMode::CullClockwise,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn texture_sampler<'a, T>(texture: &'a T, settings: &GameSettings) -> Sampler<'a, T> {
|
||||||
|
Sampler(texture, SamplerBehavior {
|
||||||
|
minify_filter: MinifySamplerFilter::LinearMipmapLinear,
|
||||||
|
magnify_filter: MagnifySamplerFilter::Nearest,
|
||||||
|
max_anisotropy: settings.max_anisotropy.unwrap_or_default(),
|
||||||
|
wrap_function: (SamplerWrapFunction::Clamp, SamplerWrapFunction::Clamp, SamplerWrapFunction::Clamp),
|
||||||
|
depth_texture_comparison: None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn draw_world(
|
pub fn draw_world(
|
||||||
(render_pass, renderer): (&mut wgpu::RenderPass, &Renderer),
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
chunks: UniqueView<ChunkStorage>,
|
chunks: UniqueView<ChunkStorage>,
|
||||||
meshes: NonSendSync<UniqueView<ChunkMeshStorage>>,
|
meshes: NonSendSync<UniqueView<ChunkMeshStorage>>,
|
||||||
|
program: NonSendSync<UniqueView<ChunkShaderPrefab>>,
|
||||||
|
texture: NonSendSync<UniqueView<BlockTexturesPrefab>>,
|
||||||
transform: View<Transform>,
|
transform: View<Transform>,
|
||||||
camera: View<Camera>,
|
camera: View<Camera>,
|
||||||
settings: UniqueView<GameSettings>,
|
settings: UniqueView<GameSettings>,
|
||||||
mut trans_queue: UniqueViewMut<TransChunkQueue>,
|
mut trans_queue: UniqueViewMut<TransChunkQueue>,
|
||||||
) {
|
) {
|
||||||
//TODO
|
// let (camera, transform) = (&camera, &transform).iter().next().expect("No cameras in the scene");
|
||||||
|
// let camera_position = transform.0.to_scale_rotation_translation().2;
|
||||||
|
|
||||||
|
let camera = camera.iter().next().expect("No cameras in the scene");
|
||||||
|
let view = camera.view_matrix.to_cols_array_2d();
|
||||||
|
let perspective = camera.perspective_matrix.to_cols_array_2d();
|
||||||
|
|
||||||
|
let draw_parameters = draw_params(&settings);
|
||||||
|
let texture_sampler = texture_sampler(&texture.0, &settings);
|
||||||
|
|
||||||
|
for (&position, chunk) in &chunks.chunks {
|
||||||
|
if let Some(key) = chunk.mesh_index {
|
||||||
|
let mesh = meshes.get(key).expect("Mesh index pointing to nothing");
|
||||||
|
let world_position = position.as_vec3() * CHUNK_SIZE as f32;
|
||||||
|
|
||||||
|
//Skip mesh if its empty
|
||||||
|
if mesh.index_buffer.len() == 0 && mesh.trans_index_buffer.len() == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
//Frustum culling
|
||||||
|
{
|
||||||
|
let minp = world_position;
|
||||||
|
let maxp = world_position + Vec3::splat(CHUNK_SIZE as f32);
|
||||||
|
if !camera.frustum.is_box_visible(minp, maxp) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Draw chunk mesh
|
||||||
|
if mesh.index_buffer.len() > 0 {
|
||||||
|
target.0.draw(
|
||||||
|
&mesh.vertex_buffer,
|
||||||
|
&mesh.index_buffer,
|
||||||
|
&program.0,
|
||||||
|
&uniform! {
|
||||||
|
position_offset: world_position.to_array(),
|
||||||
|
view: view,
|
||||||
|
perspective: perspective,
|
||||||
|
tex: texture_sampler,
|
||||||
|
discard_alpha: true,
|
||||||
|
},
|
||||||
|
&draw_parameters
|
||||||
|
).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if mesh.trans_index_buffer.len() > 0 {
|
||||||
|
trans_queue.0.push(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// const HALF_CHUNK_SIZE: IVec3 = IVec3::splat((CHUNK_SIZE >> 1) as i32);
|
||||||
|
// trans_queue.0.sort_by_cached_key(|&pos| -(
|
||||||
|
// (pos + HALF_CHUNK_SIZE).distance_squared(camera_position.as_ivec3())
|
||||||
|
// ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn draw_world_trans(
|
||||||
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
|
chunks: UniqueView<ChunkStorage>,
|
||||||
|
meshes: NonSendSync<UniqueView<ChunkMeshStorage>>,
|
||||||
|
program: NonSendSync<UniqueView<ChunkShaderPrefab>>,
|
||||||
|
texture: NonSendSync<UniqueView<BlockTexturesPrefab>>,
|
||||||
|
camera: View<Camera>,
|
||||||
|
settings: UniqueView<GameSettings>,
|
||||||
|
mut trans_queue: UniqueViewMut<TransChunkQueue>,
|
||||||
|
) {
|
||||||
|
let camera = camera.iter().next().expect("No cameras in the scene");
|
||||||
|
let view = camera.view_matrix.to_cols_array_2d();
|
||||||
|
let perspective = camera.perspective_matrix.to_cols_array_2d();
|
||||||
|
|
||||||
// fn draw_params(settings: &GameSettings) -> DrawParameters {
|
let mut draw_parameters = draw_params(&settings);
|
||||||
// DrawParameters {
|
draw_parameters.blend = Blend::alpha_blending();
|
||||||
// depth: Depth {
|
draw_parameters.backface_culling = BackfaceCullingMode::CullingDisabled;
|
||||||
// test: DepthTest::IfLess,
|
draw_parameters.smooth = Some(Smooth::Fastest);
|
||||||
// write: true,
|
|
||||||
// ..Default::default()
|
|
||||||
// },
|
|
||||||
// multisampling: settings.msaa.is_some(),
|
|
||||||
// polygon_mode: PolygonMode::Fill, //Change to Line for wireframe
|
|
||||||
// backface_culling: BackfaceCullingMode::CullClockwise,
|
|
||||||
// ..Default::default()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn texture_sampler<'a, T>(texture: &'a T, settings: &GameSettings) -> Sampler<'a, T> {
|
let texture_sampler = texture_sampler(&texture.0, &settings);
|
||||||
// Sampler(texture, SamplerBehavior {
|
|
||||||
// minify_filter: MinifySamplerFilter::LinearMipmapLinear,
|
|
||||||
// magnify_filter: MagnifySamplerFilter::Nearest,
|
|
||||||
// max_anisotropy: settings.max_anisotropy.unwrap_or_default(),
|
|
||||||
// wrap_function: (SamplerWrapFunction::Clamp, SamplerWrapFunction::Clamp, SamplerWrapFunction::Clamp),
|
|
||||||
// depth_texture_comparison: None,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn draw_world(
|
for position in trans_queue.0.drain(..).rev() {
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
let world_position = position.as_vec3() * CHUNK_SIZE as f32;
|
||||||
// chunks: UniqueView<ChunkStorage>,
|
let mesh_idx = chunks.chunks[&position].mesh_index.expect("No mesh index");
|
||||||
// meshes: NonSendSync<UniqueView<ChunkMeshStorage>>,
|
let mesh = meshes.get(mesh_idx).expect("Mesh index pointing to nothing");
|
||||||
// program: NonSendSync<UniqueView<ChunkShaderPrefab>>,
|
target.0.draw(
|
||||||
// texture: NonSendSync<UniqueView<BlockTexturesPrefab>>,
|
&mesh.trans_vertex_buffer,
|
||||||
// transform: View<Transform>,
|
&mesh.trans_index_buffer,
|
||||||
// camera: View<Camera>,
|
&program.0,
|
||||||
// settings: UniqueView<GameSettings>,
|
&uniform! {
|
||||||
// mut trans_queue: UniqueViewMut<TransChunkQueue>,
|
position_offset: world_position.to_array(),
|
||||||
// ) {
|
view: view,
|
||||||
// // let (camera, transform) = (&camera, &transform).iter().next().expect("No cameras in the scene");
|
perspective: perspective,
|
||||||
// // let camera_position = transform.0.to_scale_rotation_translation().2;
|
tex: texture_sampler,
|
||||||
|
discard_alpha: false,
|
||||||
|
},
|
||||||
|
&draw_parameters
|
||||||
|
).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// let camera = camera.iter().next().expect("No cameras in the scene");
|
pub fn draw_current_chunk_border(
|
||||||
// let view = camera.view_matrix.to_cols_array_2d();
|
mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
||||||
// let perspective = camera.perspective_matrix.to_cols_array_2d();
|
player: View<MainPlayer>,
|
||||||
|
transforms: View<Transform, track::All>,
|
||||||
// let draw_parameters = draw_params(&settings);
|
buffers: NonSendSync<UniqueView<CubePrimitive>>,
|
||||||
// let texture_sampler = texture_sampler(&texture.0, &settings);
|
program: NonSendSync<UniqueView<ColoredShaderPrefab>>,
|
||||||
|
camera: View<Camera>,
|
||||||
// for (&position, chunk) in &chunks.chunks {
|
settings: UniqueView<GameSettings>,
|
||||||
// if let Some(key) = chunk.mesh_index {
|
) {
|
||||||
// let mesh = meshes.get(key).expect("Mesh index pointing to nothing");
|
if cfg!(target_os = "android") {
|
||||||
// let world_position = position.as_vec3() * CHUNK_SIZE as f32;
|
return
|
||||||
|
}
|
||||||
// //Skip mesh if its empty
|
if !settings.debug_draw_current_chunk_border {
|
||||||
// if mesh.index_buffer.len() == 0 && mesh.trans_index_buffer.len() == 0 {
|
return
|
||||||
// continue
|
}
|
||||||
// }
|
let camera = camera.iter().next().expect("No cameras in the scene");
|
||||||
|
let view = camera.view_matrix.to_cols_array_2d();
|
||||||
// //Frustum culling
|
let perspective = camera.perspective_matrix.to_cols_array_2d();
|
||||||
// {
|
let (_, &player_transform) = (&player, &transforms).iter().next().expect("No player");
|
||||||
// let minp = world_position;
|
let (_, _, player_position) = player_transform.0.to_scale_rotation_translation();
|
||||||
// let maxp = world_position + Vec3::splat(CHUNK_SIZE as f32);
|
let player_in_chunk = ivec3(
|
||||||
// if !camera.frustum.is_box_visible(minp, maxp) {
|
(player_position.x as i32).div_euclid(CHUNK_SIZE as i32),
|
||||||
// continue
|
(player_position.y as i32).div_euclid(CHUNK_SIZE as i32),
|
||||||
// }
|
(player_position.z as i32).div_euclid(CHUNK_SIZE as i32),
|
||||||
// }
|
);
|
||||||
|
let world_position = player_in_chunk.as_vec3() * CHUNK_SIZE as f32;
|
||||||
// //Draw chunk mesh
|
target.0.draw(
|
||||||
// if mesh.index_buffer.len() > 0 {
|
&buffers.0,
|
||||||
// target.0.draw(
|
&buffers.1,
|
||||||
// &mesh.vertex_buffer,
|
&program.0,
|
||||||
// &mesh.index_buffer,
|
&uniform! {
|
||||||
// &program.0,
|
model: Mat4::from_scale_rotation_translation(
|
||||||
// &uniform! {
|
Vec3::splat(CHUNK_SIZE as f32),
|
||||||
// position_offset: world_position.to_array(),
|
Quat::default(),
|
||||||
// view: view,
|
world_position
|
||||||
// perspective: perspective,
|
).to_cols_array_2d(),
|
||||||
// tex: texture_sampler,
|
color: [0.25f32; 4],
|
||||||
// discard_alpha: true,
|
view: view,
|
||||||
// },
|
perspective: perspective,
|
||||||
// &draw_parameters
|
},
|
||||||
// ).unwrap();
|
&DrawParameters {
|
||||||
// }
|
depth: Depth {
|
||||||
|
test: DepthTest::IfLess,
|
||||||
// if mesh.trans_index_buffer.len() > 0 {
|
..Default::default()
|
||||||
// trans_queue.0.push(position);
|
},
|
||||||
// }
|
blend: Blend::alpha_blending(),
|
||||||
// }
|
..Default::default()
|
||||||
// }
|
}
|
||||||
|
).unwrap();
|
||||||
// // const HALF_CHUNK_SIZE: IVec3 = IVec3::splat((CHUNK_SIZE >> 1) as i32);
|
target.0.draw(
|
||||||
// // trans_queue.0.sort_by_cached_key(|&pos| -(
|
&buffers.0,
|
||||||
// // (pos + HALF_CHUNK_SIZE).distance_squared(camera_position.as_ivec3())
|
&buffers.1,
|
||||||
// // ));
|
&program.0,
|
||||||
// }
|
&uniform! {
|
||||||
|
model: Mat4::from_scale_rotation_translation(
|
||||||
// pub fn draw_world_trans(
|
Vec3::splat(CHUNK_SIZE as f32),
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
Quat::default(),
|
||||||
// chunks: UniqueView<ChunkStorage>,
|
world_position
|
||||||
// meshes: NonSendSync<UniqueView<ChunkMeshStorage>>,
|
).to_cols_array_2d(),
|
||||||
// program: NonSendSync<UniqueView<ChunkShaderPrefab>>,
|
color: [0.0f32; 4],
|
||||||
// texture: NonSendSync<UniqueView<BlockTexturesPrefab>>,
|
view: view,
|
||||||
// camera: View<Camera>,
|
perspective: perspective,
|
||||||
// settings: UniqueView<GameSettings>,
|
},
|
||||||
// mut trans_queue: UniqueViewMut<TransChunkQueue>,
|
&DrawParameters {
|
||||||
// ) {
|
polygon_mode: PolygonMode::Point,
|
||||||
// let camera = camera.iter().next().expect("No cameras in the scene");
|
line_width: Some(2.),
|
||||||
// let view = camera.view_matrix.to_cols_array_2d();
|
point_size: Some(5.),
|
||||||
// let perspective = camera.perspective_matrix.to_cols_array_2d();
|
..Default::default()
|
||||||
|
}
|
||||||
// let mut draw_parameters = draw_params(&settings);
|
).unwrap();
|
||||||
// draw_parameters.blend = Blend::alpha_blending();
|
}
|
||||||
// draw_parameters.backface_culling = BackfaceCullingMode::CullingDisabled;
|
|
||||||
// draw_parameters.smooth = Some(Smooth::Fastest);
|
|
||||||
|
|
||||||
// let texture_sampler = texture_sampler(&texture.0, &settings);
|
|
||||||
|
|
||||||
// for position in trans_queue.0.drain(..).rev() {
|
|
||||||
// let world_position = position.as_vec3() * CHUNK_SIZE as f32;
|
|
||||||
// let mesh_idx = chunks.chunks[&position].mesh_index.expect("No mesh index");
|
|
||||||
// let mesh = meshes.get(mesh_idx).expect("Mesh index pointing to nothing");
|
|
||||||
// target.0.draw(
|
|
||||||
// &mesh.trans_vertex_buffer,
|
|
||||||
// &mesh.trans_index_buffer,
|
|
||||||
// &program.0,
|
|
||||||
// &uniform! {
|
|
||||||
// position_offset: world_position.to_array(),
|
|
||||||
// view: view,
|
|
||||||
// perspective: perspective,
|
|
||||||
// tex: texture_sampler,
|
|
||||||
// discard_alpha: false,
|
|
||||||
// },
|
|
||||||
// &draw_parameters
|
|
||||||
// ).unwrap();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub fn draw_current_chunk_border(
|
|
||||||
// mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
|
|
||||||
// player: View<MainPlayer>,
|
|
||||||
// transforms: View<Transform, track::All>,
|
|
||||||
// buffers: NonSendSync<UniqueView<CubePrimitive>>,
|
|
||||||
// program: NonSendSync<UniqueView<ColoredShaderPrefab>>,
|
|
||||||
// camera: View<Camera>,
|
|
||||||
// settings: UniqueView<GameSettings>,
|
|
||||||
// ) {
|
|
||||||
// if cfg!(target_os = "android") {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// if !settings.debug_draw_current_chunk_border {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// let camera = camera.iter().next().expect("No cameras in the scene");
|
|
||||||
// let view = camera.view_matrix.to_cols_array_2d();
|
|
||||||
// let perspective = camera.perspective_matrix.to_cols_array_2d();
|
|
||||||
// let (_, &player_transform) = (&player, &transforms).iter().next().expect("No player");
|
|
||||||
// let (_, _, player_position) = player_transform.0.to_scale_rotation_translation();
|
|
||||||
// let player_in_chunk = ivec3(
|
|
||||||
// (player_position.x as i32).div_euclid(CHUNK_SIZE as i32),
|
|
||||||
// (player_position.y as i32).div_euclid(CHUNK_SIZE as i32),
|
|
||||||
// (player_position.z as i32).div_euclid(CHUNK_SIZE as i32),
|
|
||||||
// );
|
|
||||||
// let world_position = player_in_chunk.as_vec3() * CHUNK_SIZE as f32;
|
|
||||||
// target.0.draw(
|
|
||||||
// &buffers.0,
|
|
||||||
// &buffers.1,
|
|
||||||
// &program.0,
|
|
||||||
// &uniform! {
|
|
||||||
// model: Mat4::from_scale_rotation_translation(
|
|
||||||
// Vec3::splat(CHUNK_SIZE as f32),
|
|
||||||
// Quat::default(),
|
|
||||||
// world_position
|
|
||||||
// ).to_cols_array_2d(),
|
|
||||||
// color: [0.25f32; 4],
|
|
||||||
// view: view,
|
|
||||||
// perspective: perspective,
|
|
||||||
// },
|
|
||||||
// &DrawParameters {
|
|
||||||
// depth: Depth {
|
|
||||||
// test: DepthTest::IfLess,
|
|
||||||
// ..Default::default()
|
|
||||||
// },
|
|
||||||
// blend: Blend::alpha_blending(),
|
|
||||||
// ..Default::default()
|
|
||||||
// }
|
|
||||||
// ).unwrap();
|
|
||||||
// target.0.draw(
|
|
||||||
// &buffers.0,
|
|
||||||
// &buffers.1,
|
|
||||||
// &program.0,
|
|
||||||
// &uniform! {
|
|
||||||
// model: Mat4::from_scale_rotation_translation(
|
|
||||||
// Vec3::splat(CHUNK_SIZE as f32),
|
|
||||||
// Quat::default(),
|
|
||||||
// world_position
|
|
||||||
// ).to_cols_array_2d(),
|
|
||||||
// color: [0.0f32; 4],
|
|
||||||
// view: view,
|
|
||||||
// perspective: perspective,
|
|
||||||
// },
|
|
||||||
// &DrawParameters {
|
|
||||||
// polygon_mode: PolygonMode::Point,
|
|
||||||
// line_width: Some(2.),
|
|
||||||
// point_size: Some(5.),
|
|
||||||
// ..Default::default()
|
|
||||||
// }
|
|
||||||
// ).unwrap();
|
|
||||||
// }
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use hui::{
|
||||||
UiElementExt,
|
UiElementExt,
|
||||||
},
|
},
|
||||||
layout::{Alignment, Direction},
|
layout::{Alignment, Direction},
|
||||||
rect_frame, size,
|
frame_rect, size,
|
||||||
};
|
};
|
||||||
use shipyard::{UniqueView, UniqueViewMut, Workload, NonSendSync, IntoWorkload};
|
use shipyard::{UniqueView, UniqueViewMut, Workload, NonSendSync, IntoWorkload};
|
||||||
use winit::keyboard::KeyCode;
|
use winit::keyboard::KeyCode;
|
||||||
|
@ -28,7 +28,7 @@ pub fn loading_screen_base(bg_alpha: f32, xui: impl FnOnce(&mut ElementList)) ->
|
||||||
.with_children(|ui| {
|
.with_children(|ui| {
|
||||||
Container::default()
|
Container::default()
|
||||||
.with_size(size!(400, auto))
|
.with_size(size!(400, auto))
|
||||||
.with_background(rect_frame! {
|
.with_background(frame_rect! {
|
||||||
color: (0.2, 0.2, 0.2),
|
color: (0.2, 0.2, 0.2),
|
||||||
corner_radius: 8.
|
corner_radius: 8.
|
||||||
})
|
})
|
||||||
|
@ -63,11 +63,11 @@ fn render_loading_ui(
|
||||||
ProgressBar::default()
|
ProgressBar::default()
|
||||||
.with_value(value)
|
.with_value(value)
|
||||||
.with_size(size!(100%, 15))
|
.with_size(size!(100%, 15))
|
||||||
.with_background(rect_frame! {
|
.with_background(frame_rect! {
|
||||||
color: (0.1, 0.1, 0.1),
|
color: (0.1, 0.1, 0.1),
|
||||||
corner_radius: 2.
|
corner_radius: 2.
|
||||||
})
|
})
|
||||||
.with_foreground(rect_frame! {
|
.with_foreground(frame_rect! {
|
||||||
color: (0.4, 0.4, 1.0),
|
color: (0.4, 0.4, 1.0),
|
||||||
corner_radius: 2.
|
corner_radius: 2.
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,7 @@ use hui::{
|
||||||
element::{br::Break, container::Container, slider::Slider, text::Text, UiElementExt},
|
element::{br::Break, container::Container, slider::Slider, text::Text, UiElementExt},
|
||||||
layout::{Alignment, Direction},
|
layout::{Alignment, Direction},
|
||||||
signal::Signal,
|
signal::Signal,
|
||||||
rect_frame, size,
|
frame_rect, size,
|
||||||
};
|
};
|
||||||
use shipyard::{NonSendSync, UniqueView, UniqueViewMut};
|
use shipyard::{NonSendSync, UniqueView, UniqueViewMut};
|
||||||
use winit::keyboard::KeyCode;
|
use winit::keyboard::KeyCode;
|
||||||
|
@ -34,7 +34,7 @@ pub fn render_settings_ui(
|
||||||
.with_align(Alignment::Center)
|
.with_align(Alignment::Center)
|
||||||
.with_children(|ui| {
|
.with_children(|ui| {
|
||||||
Container::default()
|
Container::default()
|
||||||
.with_background(rect_frame! {
|
.with_background(frame_rect! {
|
||||||
color: (0.2, 0.2, 0.2),
|
color: (0.2, 0.2, 0.2),
|
||||||
corner_radius: 8.
|
corner_radius: 8.
|
||||||
})
|
})
|
||||||
|
|
|
@ -102,7 +102,6 @@ impl ChunkMeshStorage {
|
||||||
pub fn init_game_world(
|
pub fn init_game_world(
|
||||||
storages: AllStoragesView,
|
storages: AllStoragesView,
|
||||||
) {
|
) {
|
||||||
log::info!("init_game_world called");
|
|
||||||
storages.add_unique_non_send_sync(ChunkMeshStorage::new());
|
storages.add_unique_non_send_sync(ChunkMeshStorage::new());
|
||||||
storages.add_unique(ChunkStorage::new());
|
storages.add_unique(ChunkStorage::new());
|
||||||
storages.add_unique(ChunkTaskManager::new());
|
storages.add_unique(ChunkTaskManager::new());
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use glam::IVec3;
|
use glam::IVec3;
|
||||||
use atomic::Atomic;
|
use atomic::Atomic;
|
||||||
|
use glium::{VertexBuffer, IndexBuffer};
|
||||||
use kubi_shared::worldgen::AbortState;
|
use kubi_shared::worldgen::AbortState;
|
||||||
use crate::rendering::{world::ChunkVertex, BufferPair};
|
use crate::rendering::world::ChunkVertex;
|
||||||
|
|
||||||
pub use kubi_shared::chunk::{CHUNK_SIZE, BlockData};
|
pub use kubi_shared::chunk::{CHUNK_SIZE, BlockData};
|
||||||
|
|
||||||
|
@ -17,8 +18,10 @@ impl ChunkData {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ChunkMesh {
|
pub struct ChunkMesh {
|
||||||
pub main: BufferPair,
|
pub vertex_buffer: VertexBuffer<ChunkVertex>,
|
||||||
pub trans: BufferPair,
|
pub index_buffer: IndexBuffer<u32>,
|
||||||
|
pub trans_vertex_buffer: VertexBuffer<ChunkVertex>,
|
||||||
|
pub trans_index_buffer: IndexBuffer<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use atomic::{Atomic, Ordering};
|
use atomic::{Atomic, Ordering};
|
||||||
use glam::{IVec3, ivec3};
|
use glam::{IVec3, ivec3};
|
||||||
|
use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType};
|
||||||
use kubi_shared::{networking::{channels::Channel, messages::ClientToServerMessage}, worldgen::AbortState};
|
use kubi_shared::{networking::{channels::Channel, messages::ClientToServerMessage}, worldgen::AbortState};
|
||||||
use shipyard::{View, UniqueView, UniqueViewMut, IntoIter, Workload, IntoWorkload, NonSendSync, track};
|
use shipyard::{View, UniqueView, UniqueViewMut, IntoIter, Workload, IntoWorkload, NonSendSync, track};
|
||||||
use uflow::SendMode;
|
use uflow::SendMode;
|
||||||
use wgpu::util::DeviceExt;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
networking::UdpClient,
|
|
||||||
player::MainPlayer,
|
player::MainPlayer,
|
||||||
rendering::{world::ChunkVertex, BufferPair, Renderer},
|
|
||||||
settings::GameSettings,
|
|
||||||
state::GameState,
|
|
||||||
transform::Transform,
|
transform::Transform,
|
||||||
|
settings::GameSettings,
|
||||||
|
rendering::Renderer,
|
||||||
|
state::GameState,
|
||||||
|
networking::UdpClient,
|
||||||
};
|
};
|
||||||
use super::{
|
use super::{
|
||||||
ChunkStorage, ChunkMeshStorage,
|
ChunkStorage, ChunkMeshStorage,
|
||||||
|
@ -327,47 +327,12 @@ fn process_completed_tasks(
|
||||||
|
|
||||||
//apply the mesh
|
//apply the mesh
|
||||||
//TODO: Skip if mesh is empty? (i.e. set to None)
|
//TODO: Skip if mesh is empty? (i.e. set to None)
|
||||||
//TODO
|
|
||||||
|
|
||||||
let vtx_buffer = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
|
||||||
label: Some("chunk_vertex_buffer"),
|
|
||||||
contents: bytemuck::cast_slice(&vertices),
|
|
||||||
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::VERTEX,
|
|
||||||
});
|
|
||||||
|
|
||||||
let idx_buffer = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
|
||||||
label: Some("chunk_vertex_buffer"),
|
|
||||||
contents: bytemuck::cast_slice(&indices),
|
|
||||||
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::INDEX,
|
|
||||||
});
|
|
||||||
|
|
||||||
let vtx_buffer_trans = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
|
||||||
label: Some("chunk_trans_vertex_buffer"),
|
|
||||||
contents: bytemuck::cast_slice(&trans_vertices),
|
|
||||||
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::VERTEX,
|
|
||||||
});
|
|
||||||
|
|
||||||
let idx_buffer_trans = renderer.device().create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
|
||||||
label: Some("chunk_trans_index_buffer"),
|
|
||||||
contents: bytemuck::cast_slice(&trans_indices),
|
|
||||||
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::INDEX,
|
|
||||||
});
|
|
||||||
|
|
||||||
let main_buffer_pair = BufferPair {
|
|
||||||
vertex: vtx_buffer,
|
|
||||||
index: idx_buffer,
|
|
||||||
};
|
|
||||||
|
|
||||||
let trans_buffer_pair = BufferPair {
|
|
||||||
vertex: vtx_buffer_trans,
|
|
||||||
index: idx_buffer_trans,
|
|
||||||
};
|
|
||||||
|
|
||||||
let mesh = ChunkMesh {
|
let mesh = ChunkMesh {
|
||||||
main: main_buffer_pair,
|
vertex_buffer: VertexBuffer::immutable(&renderer.display, &vertices).unwrap(),
|
||||||
trans: trans_buffer_pair,
|
index_buffer: IndexBuffer::immutable(&renderer.display, PrimitiveType::TrianglesList, &indices).unwrap(),
|
||||||
|
trans_vertex_buffer: VertexBuffer::immutable(&renderer.display, &trans_vertices).unwrap(),
|
||||||
|
trans_index_buffer: IndexBuffer::immutable(&renderer.display, PrimitiveType::TrianglesList, &trans_indices).unwrap(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(index) = chunk.mesh_index {
|
if let Some(index) = chunk.mesh_index {
|
||||||
meshes.update(index, mesh).expect("Mesh update failed");
|
meshes.update(index, mesh).expect("Mesh update failed");
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue