From 1cf71cec32973ff904e344e940f8a8149adff296 Mon Sep 17 00:00:00 2001 From: Piotr Siuszko Date: Tue, 5 Mar 2024 11:30:31 +0100 Subject: [PATCH] Update deps --- Cargo.lock | 699 +++++++++++++++++++------------------------- Cargo.toml | 12 +- examples/2d.rs | 18 +- examples/client.rs | 147 +--------- src/assets_cache.rs | 20 +- src/components.rs | 13 +- src/engine.rs | 14 +- src/framebuffer.rs | 6 +- src/lib.rs | 2 + src/map.rs | 6 +- src/model.rs | 9 +- src/sky.rs | 2 +- src/utils.rs | 8 +- 13 files changed, 346 insertions(+), 610 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5984f5..9496ce9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,25 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "ab_glyph_rasterizer" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" - -[[package]] -name = "andrew" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" -dependencies = [ - "bitflags", - "rusttype", - "walkdir", - "xdg", - "xml-rs", -] - [[package]] name = "android_glue" version = "0.2.3" @@ -55,13 +36,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] -name = "calloop" -version = "0.6.5" +name = "bumpalo" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" + +[[package]] +name = "calloop" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf2eec61efe56aa1e813f5126959296933cf0700030e4314786c48779a66ab82" dependencies = [ "log", - "nix 0.18.0", + "nix 0.22.3", ] [[package]] @@ -102,28 +89,6 @@ dependencies = [ "serde", ] -[[package]] -name = "chlorine" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75476fe966a8af7c0ceae2a3e514afa87d4451741fcdfab8bfaa07ad301842ec" - -[[package]] -name = "cocoa" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54201c07dcf3a5ca33fececb8042aed767ee4bfd5a0235a8ceabcda956044b2" -dependencies = [ - "bitflags", - "block", - "cocoa-foundation", - "core-foundation 0.9.4", - "core-graphics 0.22.3", - "foreign-types", - "libc", - "objc", -] - [[package]] name = "cocoa" version = "0.24.1" @@ -243,9 +208,9 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] name = "darling" -version = "0.10.2" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ "darling_core", "darling_macro", @@ -253,9 +218,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.10.2" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" dependencies = [ "fnv", "ident_case", @@ -267,41 +232,21 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.10.2" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", "syn 1.0.109", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "dispatch" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" -[[package]] -name = "dlib" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" -dependencies = [ - "libloading 0.6.7", -] - [[package]] name = "dlib" version = "0.5.2" @@ -319,11 +264,6 @@ dependencies = [ "gl", "glutin", "image2", - "imgui", - "imgui-inspect", - "imgui-inspect-derive", - "imgui-opengl-renderer", - "imgui-winit-support", "inline_tweak", "log", "serde", @@ -339,6 +279,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "fnv" version = "1.0.7" @@ -360,22 +306,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "gl" version = "0.14.0" @@ -398,13 +328,13 @@ dependencies = [ [[package]] name = "glutin" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ae1cbb9176b9151c4ce03f012e3cd1c6c18c4be79edeaeb3d99f5d8085c5fa3" +checksum = "00ea9dbe544bc8a657c4c4a798c2d16cd01b549820e47657297549d28371f6d2" dependencies = [ "android_glue", "cgl", - "cocoa 0.23.0", + "cocoa", "core-foundation 0.9.4", "glutin_egl_sys", "glutin_emscripten_sys", @@ -412,14 +342,14 @@ dependencies = [ "glutin_glx_sys", "glutin_wgl_sys", "lazy_static", - "libloading 0.6.7", + "libloading 0.7.4", "log", "objc", "osmesa-sys", "parking_lot", "wayland-client", "wayland-egl", - "winapi 0.3.9", + "winapi", "winit", ] @@ -430,7 +360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68900f84b471f31ea1d1355567eb865a2cf446294f06cef8d653ed7bcf5f013d" dependencies = [ "gl_generator", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -474,6 +404,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + [[package]] name = "ident_case" version = "1.0.1" @@ -489,69 +425,6 @@ dependencies = [ "num", ] -[[package]] -name = "imgui" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24cfcf6e3326886321c5d637caf1ce217006651059015fae372b1c49c0e722b2" -dependencies = [ - "bitflags", - "imgui-sys", - "parking_lot", -] - -[[package]] -name = "imgui-inspect" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806c0380e67a59bc57d603fe89632b567e3f9b41fe0d5a2d7f64fdae908d64fc" -dependencies = [ - "imgui", - "imgui-inspect-derive", -] - -[[package]] -name = "imgui-inspect-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c607b9a4c45a099edc98a0c49dd74fd1aa781a3eb27416cf55dd504f4fc3d0" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "imgui-opengl-renderer" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db78c2c7dd32060bafdb4b2595d994135b21d0d666103b9c921ef5d955212b8a" -dependencies = [ - "gl_generator", - "imgui", -] - -[[package]] -name = "imgui-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ca00be6b78bf02b57e91468cf19d08dfcc11d0fb3c2f3dc491c29404d8d330" -dependencies = [ - "cc", - "chlorine", -] - -[[package]] -name = "imgui-winit-support" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ae881a42852470216c77fba5835b9701815adac24dfaa8d4ebf3a368376756" -dependencies = [ - "imgui", - "winit", -] - [[package]] name = "indexmap" version = "1.9.3" @@ -559,7 +432,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", ] [[package]] @@ -579,15 +462,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -603,13 +480,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "js-sys" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "wasm-bindgen", ] [[package]] @@ -624,12 +500,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.153" @@ -638,12 +508,12 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" -version = "0.6.7" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if 1.0.0", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -653,7 +523,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2caa5afb8bf9f3a2652760ce7d4f62d21c4d5a423e68466fca30df82f2330164" dependencies = [ "cfg-if 1.0.0", - "windows-targets", + "windows-targets 0.52.4", ] [[package]] @@ -688,63 +558,48 @@ dependencies = [ ] [[package]] -name = "memmap2" -version = "0.1.0" +name = "memchr" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memmap2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b6c2ebff6180198788f5db08d7ce3bc1d0b617176678831a7510825973e357" dependencies = [ "libc", ] +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "mio" -version = "0.6.23" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "wasi", + "windows-sys", ] [[package]] name = "ndk" -version = "0.2.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb167c1febed0a496639034d0c76b3b74263636045db5489eee52143c246e73" +checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" dependencies = [ + "bitflags", "jni-sys", "ndk-sys", "num_enum", @@ -752,24 +607,31 @@ dependencies = [ ] [[package]] -name = "ndk-glue" -version = "0.2.1" +name = "ndk-context" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf399b8b7a39c6fb153c4ec32c72fd5fe789df24a647f229c239aa7adb15241" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-glue" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71bee8ea72d685477e28bd004cfe1bf99c754d688cd78cad139eae4089484d4" dependencies = [ "lazy_static", "libc", "log", "ndk", + "ndk-context", "ndk-macro", "ndk-sys", ] [[package]] name = "ndk-macro" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" dependencies = [ "darling", "proc-macro-crate", @@ -784,39 +646,29 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "nix" -version = "0.18.0" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" -dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", - "libc", -] - -[[package]] -name = "nix" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" +checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" dependencies = [ "bitflags", "cc", "cfg-if 1.0.0", "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "libc", + "memoffset", ] [[package]] @@ -896,19 +748,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.4.3" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ - "derivative", "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.4.3" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -940,15 +791,6 @@ dependencies = [ "shared_library", ] -[[package]] -name = "owned_ttf_parser" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e6affeb1632d6ff6a23d2cd40ffed138e82f1532571a26f527c8a284bb2fbb" -dependencies = [ - "ttf-parser", -] - [[package]] name = "parking_lot" version = "0.11.2" @@ -971,7 +813,7 @@ dependencies = [ "libc", "redox_syscall 0.2.16", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -988,11 +830,12 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "proc-macro-crate" -version = "0.1.5" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ - "toml", + "once_cell", + "toml_edit", ] [[package]] @@ -1013,16 +856,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "raw-window-handle" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" -dependencies = [ - "libc", - "raw-window-handle 0.4.3", -] - [[package]] name = "raw-window-handle" version = "0.4.3" @@ -1053,31 +886,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rusttype" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff8374aa04134254b7995b63ad3dc41c7f7236f69528b28553da7d72efaa967" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - [[package]] name = "ryu" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "scoped-tls" version = "1.0.1" @@ -1127,7 +941,7 @@ version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" dependencies = [ - "indexmap", + "indexmap 1.9.3", "ryu", "serde", "yaml-rust", @@ -1154,15 +968,6 @@ dependencies = [ "thread-id", ] -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - [[package]] name = "smallvec" version = "1.13.1" @@ -1171,18 +976,18 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smithay-client-toolkit" -version = "0.12.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" +checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" dependencies = [ - "andrew", "bitflags", "calloop", - "dlib 0.4.2", + "dlib", "lazy_static", "log", "memmap2", - "nix 0.18.0", + "nix 0.22.3", + "pkg-config", "wayland-client", "wayland-cursor", "wayland-protocols", @@ -1190,9 +995,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" @@ -1244,7 +1049,7 @@ checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" dependencies = [ "libc", "redox_syscall 0.1.57", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1254,19 +1059,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2468f55be8e59cf7219f1685cf1af4eb00ef2314823a7941a41c8d69538f881b" [[package]] -name = "toml" -version = "0.5.11" +name = "toml_datetime" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" [[package]] -name = "ttf-parser" -version = "0.15.2" +name = "toml_edit" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.2.5", + "toml_datetime", + "winnow", +] [[package]] name = "unicode-ident" @@ -1275,25 +1082,75 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] -name = "walkdir" -version = "2.5.0" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ - "same-file", - "winapi-util", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] -name = "wayland-client" -version = "0.28.6" +name = "wasm-bindgen-backend" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.52", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "wayland-client" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ "bitflags", "downcast-rs", "libc", - "nix 0.20.0", + "nix 0.24.3", "scoped-tls", "wayland-commons", "wayland-scanner", @@ -1302,11 +1159,11 @@ dependencies = [ [[package]] name = "wayland-commons" -version = "0.28.6" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" +checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" dependencies = [ - "nix 0.20.0", + "nix 0.24.3", "once_cell", "smallvec", "wayland-sys", @@ -1314,20 +1171,20 @@ dependencies = [ [[package]] name = "wayland-cursor" -version = "0.28.6" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" +checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" dependencies = [ - "nix 0.20.0", + "nix 0.24.3", "wayland-client", "xcursor", ] [[package]] name = "wayland-egl" -version = "0.28.6" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ba1ab1e18756b23982d36f08856d521d7df45015f404a2d7c4f0b2d2f66956" +checksum = "402de949f81a012926d821a2d659f930694257e76dd92b6e0042ceb27be4107d" dependencies = [ "wayland-client", "wayland-sys", @@ -1335,9 +1192,9 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.28.6" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" +checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ "bitflags", "wayland-client", @@ -1347,9 +1204,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.28.6" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" dependencies = [ "proc-macro2", "quote", @@ -1358,20 +1215,24 @@ dependencies = [ [[package]] name = "wayland-sys" -version = "0.28.6" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" +checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" dependencies = [ - "dlib 0.5.2", + "dlib", "lazy_static", "pkg-config", ] [[package]] -name = "winapi" -version = "0.2.8" +name = "web-sys" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] name = "winapi" @@ -1383,84 +1244,135 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[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]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.4" @@ -1469,12 +1381,12 @@ checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winit" -version = "0.24.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4eda6fce0eb84bd0a33e3c8794eb902e1033d0a1d5a31bc4f19b1b4bbff597" +checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" dependencies = [ "bitflags", - "cocoa 0.24.1", + "cocoa", "core-foundation 0.9.4", "core-graphics 0.22.3", "core-video-sys", @@ -1484,28 +1396,29 @@ dependencies = [ "libc", "log", "mio", - "mio-extras", "ndk", "ndk-glue", "ndk-sys", "objc", "parking_lot", "percent-encoding", - "raw-window-handle 0.3.4", + "raw-window-handle", "smithay-client-toolkit", + "wasm-bindgen", "wayland-client", - "winapi 0.3.9", + "wayland-protocols", + "web-sys", + "winapi", "x11-dl", ] [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "winnow" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "memchr", ] [[package]] @@ -1525,12 +1438,6 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911" -[[package]] -name = "xdg" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" - [[package]] name = "xml-rs" version = "0.8.19" diff --git a/Cargo.toml b/Cargo.toml index 4273c84..794e1df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,23 +6,13 @@ edition = "2018" [dependencies] gl = "0.14.0" -imgui={version="0.7.0", optional=true} -imgui-winit-support = {version="0.7.0", optional=true} -imgui-opengl-renderer = {version="0.11.0", optional = true} cgmath = {version="0.18.0", features=["serde"]} -imgui-inspect = {version="0.8.0", optional = true} -imgui-inspect-derive = {version="0.8.0", optional= true} tobj = "2.0.2" inline_tweak = "1.0.8" log = "0.4.11" simple-logging = "2.0.2" image2 = { git = "https://github.com/Leinnan/image2-rs", branch="legacy", default-features = false, features=["io"] } -glutin = "0.26.0" +glutin = "0.28.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.8" - -[features] -default = ["imgui_inspect"] -imgui_inspect = ["imgui","imgui-inspect-derive","imgui-opengl-renderer", "imgui-inspect", "imgui-winit-support"] - diff --git a/examples/2d.rs b/examples/2d.rs index 2d0474b..cb4cd9b 100644 --- a/examples/2d.rs +++ b/examples/2d.rs @@ -1,13 +1,13 @@ use doppler::assets_cache::AssetsCache; use doppler::client::Client; +use doppler::components::*; use doppler::glutin::event::{ElementState, VirtualKeyCode}; use doppler::shader::Shader; -use doppler::components::*; -pub struct Client2D{ +pub struct Client2D { delta: f32, models_2d: ModelComponent, - shader: Shader + shader: Shader, } impl Default for Client2D { @@ -18,12 +18,11 @@ impl Default for Client2D { shader: Shader::from_file( "resources/shaders/multiple_lights.vs", "resources/shaders/multiple_lights.fs", - ) + ), } } } - impl Client for Client2D { fn on_keyboard(&mut self, code: &VirtualKeyCode, state: &ElementState) { match (code, state) { @@ -55,14 +54,9 @@ impl Client for Client2D { self.delta = delta; } - fn debug_draw(&mut self, _ui: &doppler::imgui::Ui) { - } + fn on_mouse_scroll(&mut self, _yoffset: f32) {} - fn on_mouse_scroll(&mut self, _yoffset: f32) { - } - - fn on_mouse_move(&mut self, _x: f32, _y: f32) { - } + fn on_mouse_move(&mut self, _x: f32, _y: f32) {} } pub fn main() { diff --git a/examples/client.rs b/examples/client.rs index 960027d..6ba236d 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -1,21 +1,12 @@ use doppler::assets_cache::AssetsCache; use doppler::camera::*; use doppler::client::Client; -use doppler::components::Transform; use doppler::glutin::event::{ElementState, VirtualKeyCode}; -use doppler::imgui::*; -use doppler::light::*; use doppler::map::*; pub struct ExampleClient { map: Map, delta: f32, - show_object_info: bool, - show_camera_info: bool, - imgui_grabs_input: bool, - object_info_id: i32, - show_light_info: bool, - light_info_id: i32, } impl Default for ExampleClient { @@ -23,12 +14,6 @@ impl Default for ExampleClient { ExampleClient { delta: 0.0, map: Map::default(), - object_info_id: 0, - show_camera_info: false, - show_object_info: false, - show_light_info: false, - imgui_grabs_input: false, - light_info_id: 0, } } } @@ -72,140 +57,10 @@ impl Client for ExampleClient { self.delta = delta; } - fn debug_draw(&mut self, ui: &doppler::imgui::Ui) { - if let Some(menu_bar) = ui.begin_main_menu_bar() { - if let Some(menu) = ui.begin_menu(im_str!("Basic"), true) { - if MenuItem::new(im_str!("Show Object info")) - .selected(self.show_object_info) - .build(ui) - { - self.show_object_info = !self.show_object_info; - } - if MenuItem::new(im_str!("Show lights info")) - .selected(self.show_light_info) - .build(ui) - { - self.show_light_info = !self.show_light_info; - } - menu.end(ui); - } - if MenuItem::new(im_str!("Toggle Camera Info")) - .selected(self.show_camera_info) - .build(ui) - { - self.show_camera_info = !self.show_camera_info; - } - menu_bar.end(ui); - } - - { - if self.show_camera_info { - Window::new(im_str!("CameraInfo")) - .size([260.0, 430.0], Condition::Always) - .position([20.0, 40.0], Condition::Always) - .title_bar(false) - .scroll_bar(false) - .no_inputs() - .bg_alpha(0.8) - .collapsible(false) - .build(&ui, || { - ui.text(im_str!("Camera info")); - ui.separator(); - >::render( - &[&self.map.camera], - &"CameraInfo", - ui, - &imgui_inspect::InspectArgsDefault { - header: Some(false), - ..imgui_inspect::InspectArgsDefault::default() - }, - ); - }); - } - if self.show_object_info { - let mut id = self.object_info_id; - let max: i32 = self.map.models.len() as i32 - 1; - let mut show_window = self.show_object_info; - - Window::new(im_str!("Object info")) - .size([250.0, 250.0], Condition::FirstUseEver) - .opened(&mut show_window) - .build(&ui, || { - ui.input_int(im_str!("id"), &mut id).build(); - id = if id < 0 { - 0 - } else if id > max { - max - } else { - id - }; - - let mut selected_mut = vec![&mut self.map.models[id as usize].transform]; - >::render_mut( - &mut selected_mut, - "Object info", - &ui, - &imgui_inspect::InspectArgsStruct::default(), - ); - }); - self.object_info_id = id; - self.show_object_info = show_window; - } - if self.show_light_info { - let mut id = self.light_info_id; - let max: i32 = self.map.lighting_system.point_lights.len() as i32 - 1; - let mut show_window = self.show_light_info; - - Window::new(im_str!("Lights info")) - .size([250.0, 250.0], Condition::FirstUseEver) - .opened(&mut show_window) - .build(&ui, || { - { - let mut selected_mut = vec![&mut self.map.lighting_system.directional_light]; - >::render_mut( - &mut selected_mut, - "DirectionalLightInfo", - &ui, - &imgui_inspect::InspectArgsStruct::default(), - ); - } - ui.separator(); - ui.input_int(im_str!("Light ID"), &mut id) - .build(); - id = if id < 0 { 0 } else if id > max { max } else { id }; - { - let mut selected_mut = - vec![&mut self.map.lighting_system.point_lights[id as usize]]; - >::render_mut( - &mut selected_mut, - "PointLightInfo", - &ui, - &imgui_inspect::InspectArgsStruct::default(), - ); - } - }); - - self.light_info_id = id; - self.show_light_info = show_window; - } - } - self.imgui_grabs_input = ui.is_any_item_hovered() || ui.is_any_item_focused(); - } - fn on_mouse_scroll(&mut self, yoffset: f32) { - if self.imgui_grabs_input { - println!("DD"); - return; - } - self.map.camera.process_mouse_scroll(yoffset as f32); + self.map.camera.process_mouse_scroll(yoffset); } fn on_mouse_move(&mut self, x: f32, y: f32) { - if self.imgui_grabs_input { - println!("DD"); - return; - } self.map.camera.process_mouse_movement(x, y, true); } } diff --git a/src/assets_cache.rs b/src/assets_cache.rs index 58afc0e..a5e8ffa 100644 --- a/src/assets_cache.rs +++ b/src/assets_cache.rs @@ -16,15 +16,10 @@ pub struct AssetsCache { impl AssetsCache { pub fn load_2d(&mut self, path: &str) -> Model { let fullpath = Path::new(&path); - let dir = fullpath - .parent() - .unwrap() - .to_str() - .unwrap() - .to_string(); + let dir = fullpath.parent().unwrap().to_str().unwrap().to_string(); let filename = fullpath.file_name().unwrap().to_str().unwrap(); - let texture = self.get_material_texture(&dir, &filename, "texture_diffuse"); - let mut model = Model::new_2d( self); + let texture = self.get_material_texture(&dir, filename, "texture_diffuse"); + let mut model = Model::new_2d(self); for ele in &mut model.meshes { ele.textures.push(texture.clone()) } @@ -34,7 +29,7 @@ impl AssetsCache { pub fn load_all_from_file(&mut self, path: &str) { let path = std::path::Path::new(path); let meta = std::fs::metadata(path); - if !meta.is_ok() { + if meta.is_err() { error!("There is no assets file"); return; } @@ -50,7 +45,7 @@ impl AssetsCache { for line in lines { let mut splitted = line.split_whitespace(); let path = splitted.next(); - if path.is_none() || self.has_model(&path.unwrap()) { + if path.is_none() || self.has_model(path.unwrap()) { error!("Skip wrong line: {}", line); continue; } @@ -79,10 +74,7 @@ impl AssetsCache { } pub fn get_model_by_hash(&mut self, hash: &u64) -> Option { - match self.models.get(hash) { - Some(model) => Some(model.clone()), - None => None, - } + self.models.get(hash).cloned() } fn load_model_ext(&mut self, path: &str, diff_texture: Option<&str>) { diff --git a/src/components.rs b/src/components.rs index 89ce72c..cecd373 100644 --- a/src/components.rs +++ b/src/components.rs @@ -41,27 +41,20 @@ impl Transform { } } +#[derive(Default)] pub struct ModelComponent { pub model: Model, pub hash: u64, pub transform: Transform, } -impl Default for ModelComponent { - fn default() -> Self { - ModelComponent { - model: Model::default(), - hash: u64::default(), - transform: Transform::default(), - } - } -} + impl ModelComponent { pub unsafe fn draw(&self, shader: &Shader) { let matrix = self.transform.get_matrix(); shader.set_mat4(c_str!("model"), &matrix); - self.model.Draw(&shader); + self.model.Draw(shader); } } diff --git a/src/engine.rs b/src/engine.rs index fcc6c4b..964000b 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -22,6 +22,12 @@ pub struct TimeStep { frames: VecDeque, } +impl Default for TimeStep { + fn default() -> Self { + Self::new() + } +} + impl TimeStep { pub fn frames(&self) -> Vec { self.frames.clone().into() @@ -207,7 +213,7 @@ impl Engine { info!("Creating AssetCache"); let mut assets_cache = AssetsCache::default(); info!("Creating client"); - let mut client = Box::new(T::default()); + let mut client = Box::::default(); client.load_assets(&mut assets_cache); let mut first_mouse = true; let mut last_x: f32 = consts::SCR_WIDTH as f32 / 2.0; @@ -215,7 +221,7 @@ impl Engine { // timing let mut timestep = TimeStep::new(); - let mut last_frame = std::time::Instant::now(); + let _last_frame = std::time::Instant::now(); let mut screensize = self.size; info!("Assets loaded"); @@ -245,7 +251,7 @@ impl Engine { .expect("Failed to prepare frame"); gl_window.window().request_redraw(); } - Event::LoopDestroyed => return, + Event::LoopDestroyed => (), Event::WindowEvent { event, .. } => match event { WindowEvent::MouseWheel { delta, .. } => { use glutin::event::MouseScrollDelta; @@ -372,7 +378,7 @@ impl Engine { ui.text(output); }); - platform.prepare_render(&ui, &gl_window.window()); + platform.prepare_render(&ui, gl_window.window()); renderer.render(ui); } gl_window.swap_buffers().unwrap(); diff --git a/src/framebuffer.rs b/src/framebuffer.rs index c9b3db1..9058025 100644 --- a/src/framebuffer.rs +++ b/src/framebuffer.rs @@ -148,11 +148,11 @@ impl FramebufferSystem { info!("New framebuffer generated"); FramebufferSystem { - texture_color_buffer: texture_color_buffer, - shader: shader, + texture_color_buffer, + shader, vao: quad_vao, vbo: quad_vbo, - framebuffer: framebuffer, + framebuffer, } } } diff --git a/src/lib.rs b/src/lib.rs index 9821357..5bd3500 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,12 @@ pub extern crate gl; +#[cfg(feature = "imgui_inspect")] pub extern crate imgui; pub extern crate log; pub extern crate simple_logging; pub use cgmath as math; pub use glutin; +#[cfg(feature = "imgui_inspect")] pub use imgui_inspect; pub use serde; diff --git a/src/map.rs b/src/map.rs index 8bf9e78..d96008c 100644 --- a/src/map.rs +++ b/src/map.rs @@ -30,8 +30,8 @@ impl MapSave { }); } let ms = MapSave { - camera: map.camera.clone(), - objects: objects, + camera: map.camera, + objects, }; match serde_yaml::to_string(&ms) { Ok(result) => println!("{}", result), @@ -96,7 +96,7 @@ impl Default for Map { ..Camera::default() }, lighting_system: LightingSystem::default(), - sky: sky, + sky, } } } diff --git a/src/model.rs b/src/model.rs index c16d7af..c1a6a83 100644 --- a/src/model.rs +++ b/src/model.rs @@ -149,7 +149,7 @@ impl Model { } else if diffuse_path.is_some() { let path = diffuse_path.unwrap(); println!("Loading {}", path); - let dir: String = if path.contains("/") { + let dir: String = if path.contains('/') { Path::new(&path) .parent() .unwrap() @@ -159,11 +159,8 @@ impl Model { } else { self.directory.to_string() }; - let texture = cache.get_material_texture( - &dir, - &diffuse_path.unwrap(), - "texture_diffuse", - ); + let texture = + cache.get_material_texture(&dir, diffuse_path.unwrap(), "texture_diffuse"); textures.push(texture); } else { warn!("There are no materials for: {}", path.display()); diff --git a/src/sky.rs b/src/sky.rs index c87b927..7973c07 100644 --- a/src/sky.rs +++ b/src/sky.rs @@ -67,7 +67,7 @@ impl Sky { shader.setInt(c_str!("skybox"), 0); Sky { - shader: shader, + shader, texture_id: cubemap_texture, vao: skybox_vao, vbo: skybox_vbo, diff --git a/src/utils.rs b/src/utils.rs index c161637..34dc8e6 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -41,8 +41,8 @@ pub unsafe fn load_texture(path: &str, file_format: &str) -> u32 { gl::TEXTURE_2D, 0, format as i32, - dim.0 as i32, - dim.1 as i32, + dim.0, + dim.1, 0, format, gl::UNSIGNED_BYTE, @@ -69,10 +69,10 @@ pub unsafe fn load_texture_from_dir(filename: &str, directory: &str) -> u32 { } pub unsafe fn load_texture_from_fullpath(fullpath: &str) -> u32 { - let dot = fullpath.find(".").unwrap_or_default() + 1usize; + let dot = fullpath.find('.').unwrap_or_default() + 1usize; let (_, format) = fullpath.split_at(dot); - load_texture(&fullpath, format) + load_texture(fullpath, format) } /// loads a cubemap texture from 6 individual texture faces