diff options
Diffstat (limited to 'bindgen')
-rw-r--r-- | bindgen/rust/Cargo.lock | 1043 | ||||
-rw-r--r-- | bindgen/rust/Cargo.toml | 12 | ||||
-rw-r--r-- | bindgen/rust/README.md | 3 | ||||
-rw-r--r-- | bindgen/rust/build.rs | 5 | ||||
-rw-r--r-- | bindgen/rust/examples/glfw.rs | 225 | ||||
-rw-r--r-- | bindgen/rust/examples/gui_test.rs | 418 | ||||
-rw-r--r-- | bindgen/rust/examples/main_loop.rs | 99 | ||||
-rw-r--r-- | bindgen/rust/src/egui_utils.rs | 122 | ||||
-rw-r--r-- | bindgen/rust/src/lib.rs | 4 |
9 files changed, 856 insertions, 1075 deletions
diff --git a/bindgen/rust/Cargo.lock b/bindgen/rust/Cargo.lock index 6f466c4..b610998 100644 --- a/bindgen/rust/Cargo.lock +++ b/bindgen/rust/Cargo.lock @@ -27,7 +27,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy 0.7.35", + "zerocopy", ] [[package]] @@ -40,45 +40,6 @@ dependencies = [ ] [[package]] -name = "allocator-api2" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "approx" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278" -dependencies = [ - "num-traits", -] - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "ash" -version = "0.37.3+1.3.251" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" -dependencies = [ - "libloading 0.7.4", -] - -[[package]] name = "autocfg" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -108,21 +69,6 @@ dependencies = [ ] [[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -141,38 +87,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "bytemuck" -version = "1.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.71", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] name = "cc" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -184,10 +98,8 @@ version = "0.1.0" dependencies = [ "bindgen", "egui", - "egui_overlay", - "egui_render_three_d", - "egui_render_wgpu", - "egui_window_glfw_passthrough", + "egui_glfw", + "gl", ] [[package]] @@ -206,22 +118,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - -[[package]] -name = "cgmath" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317" -dependencies = [ - "approx", - "num-traits", -] - -[[package]] name = "clang-sys" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -229,53 +125,48 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", - "libloading 0.8.5", + "libloading", ] [[package]] -name = "cmake" -version = "0.1.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" -dependencies = [ - "cc", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" +name = "cli-clipboard" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +checksum = "04087c1d4a2aa259784a563932aee09cbb0869d490775e051096174b070f3e3d" dependencies = [ - "termcolor", - "unicode-width", + "clipboard-win", + "objc", + "objc-foundation", + "objc_id", + "wl-clipboard-rs", + "x11-clipboard", ] [[package]] -name = "com" -version = "0.6.0" +name = "clipboard-win" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6" +checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" dependencies = [ - "com_macros", + "error-code", + "str-buf", + "winapi", ] [[package]] -name = "com_macros" -version = "0.6.0" +name = "cmake" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" dependencies = [ - "com_macros_support", - "proc-macro2", - "syn 1.0.109", + "cc", ] [[package]] -name = "com_macros_support" -version = "0.6.0" +name = "derive-new" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c" +checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535" dependencies = [ "proc-macro2", "quote", @@ -283,63 +174,22 @@ dependencies = [ ] [[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "d3d12" -version = "0.19.0" +name = "downcast-rs" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" -dependencies = [ - "bitflags 2.6.0", - "libloading 0.8.5", - "winapi", -] +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "ecolor" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03cfe80b1890e1a8cdbffc6044d6872e814aaf6011835a2a5e2db0e5c5c4ef4e" -dependencies = [ - "bytemuck", -] +checksum = "20930a432bbd57a6d55e07976089708d4893f3d556cf42a0d79e9e321fa73b10" [[package]] name = "egui" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180f595432a5b615fc6b74afef3955249b86cfea72607b40740a4cd60d5297d0" +checksum = "584c5d1bf9a67b25778a3323af222dbe1a1feb532190e103901187f92c7fe29a" dependencies = [ "ahash", "epaint", @@ -347,70 +197,15 @@ dependencies = [ ] [[package]] -name = "egui_overlay" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38117d60c6f04f55813294c261e1e7729290a33c1b3f182c618a115608ffcfe0" -dependencies = [ - "egui", - "egui_render_three_d", - "egui_window_glfw_passthrough", - "raw-window-handle 0.6.2", - "tracing", -] - -[[package]] -name = "egui_render_glow" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21691a0388394a02b9352fb31edc7a008645ef1af13bc6eace5da06c2f599e60" -dependencies = [ - "bytemuck", - "egui", - "getrandom", - "glow 0.12.3", - "js-sys", - "raw-window-handle 0.6.2", - "tracing", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "egui_render_three_d" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39bc7f5aab85ad422c53b2a1753a94a08bdca4b701346edc226ba015a0b2a7a8" -dependencies = [ - "egui", - "egui_render_glow", - "raw-window-handle 0.6.2", - "three-d", -] - -[[package]] -name = "egui_render_wgpu" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1618115f6f9a899be03d9b835944ebc362126f2682a17272ed2b31a2b6d0931b" -dependencies = [ - "bytemuck", - "egui", - "pollster", - "raw-window-handle 0.6.2", - "tracing", - "wgpu", -] - -[[package]] -name = "egui_window_glfw_passthrough" -version = "0.8.1" +name = "egui_glfw" +version = "0.55.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8cd7260410f069d82b31b188f66900336e054f839bbe24112dc2bb29acfc4" +checksum = "1f81f71591e1d52c677f1f671024d0a78bfe09eb164f4fb9a1caabbcfa997b61" dependencies = [ + "cli-clipboard", "egui", - "glfw-passthrough", - "tracing", + "gl", + "glfw", ] [[package]] @@ -421,22 +216,18 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "emath" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6916301ecf80448f786cdf3eb51d9dbdd831538732229d49119e2d4312eaaf09" -dependencies = [ - "bytemuck", -] +checksum = "e4c3a552cfca14630702449d35f41c84a0d15963273771c6059175a803620f3f" [[package]] name = "epaint" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b9fdf617dd7f58b0c8e6e9e4a1281f730cde0831d40547da446b2bb76a47af" +checksum = "b381f8b149657a4acf837095351839f32cd5c4aec1817fc4df84e18d76334176" dependencies = [ "ab_glyph", "ahash", - "bytemuck", "ecolor", "emath", "nohash-hasher", @@ -460,43 +251,50 @@ dependencies = [ ] [[package]] -name = "foreign-types" -version = "0.5.0" +name = "error-code" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" dependencies = [ - "foreign-types-macros", - "foreign-types-shared", + "libc", + "str-buf", ] [[package]] -name = "foreign-types-macros" -version = "0.2.3" +name = "fastrand" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.71", -] +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] -name = "foreign-types-shared" -version = "0.3.1" +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "getrandom" -version = "0.2.15" +name = "gethostname" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" dependencies = [ - "cfg-if", - "js-sys", "libc", - "wasi", - "wasm-bindgen", + "winapi", +] + +[[package]] +name = "gl" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94edab108827d67608095e269cf862e60d920f144a5026d3dbcfd8b877fb404" +dependencies = [ + "gl_generator", ] [[package]] @@ -511,13 +309,13 @@ dependencies = [ ] [[package]] -name = "glfw-passthrough" +name = "glfw" version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e0ee79341d32b6c490876d36f5e815bb10be943452cd3fff67d509d3143fb5" +checksum = "2a310dfc7966e5340f5d0e314fa7eed8888f1cd3bfcaa433d35cbd32d430e50c" dependencies = [ "bitflags 1.3.2", - "glfw-sys-passthrough", + "glfw-sys", "objc", "raw-window-handle 0.5.2", "raw-window-handle 0.6.2", @@ -525,10 +323,10 @@ dependencies = [ ] [[package]] -name = "glfw-sys-passthrough" -version = "4.0.3+3.3.5" +name = "glfw-sys" +version = "5.0.0+3.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b2db4d361b9ebe743c3a542ddef5d605269bd1f93e1090440fff075e666ddf" +checksum = "1dfc32d45fb58ff38b112696907963a7d671e9cf742b16f882062169a053cf88" dependencies = [ "cmake", ] @@ -540,132 +338,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] -name = "glow" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "glow" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "glutin_wgl_sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" -dependencies = [ - "gl_generator", -] - -[[package]] -name = "gpu-alloc" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" -dependencies = [ - "bitflags 2.6.0", - "gpu-alloc-types", -] - -[[package]] -name = "gpu-alloc-types" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "gpu-allocator" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884" -dependencies = [ - "log", - "presser", - "thiserror", - "winapi", - "windows", -] - -[[package]] -name = "gpu-descriptor" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" -dependencies = [ - "bitflags 2.6.0", - "gpu-descriptor-types", - "hashbrown", -] - -[[package]] -name = "gpu-descriptor-types" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "half" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if", - "crunchy", - "num-traits", - "zerocopy 0.6.6", -] - -[[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] - -[[package]] -name = "hassle-rs" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" -dependencies = [ - "bitflags 2.6.0", - "com", - "libc", - "libloading 0.8.5", - "thiserror", - "widestring", - "winapi", -] - -[[package]] -name = "hexf-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" [[package]] name = "home" @@ -687,15 +363,6 @@ dependencies = [ ] [[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - -[[package]] name = "itertools" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -705,32 +372,6 @@ dependencies = [ ] [[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "khronos-egl" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" -dependencies = [ - "libc", - "libloading 0.8.5", - "pkg-config", -] - -[[package]] name = "khronos_api" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -756,16 +397,6 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libloading" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" @@ -775,12 +406,6 @@ dependencies = [ ] [[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -818,18 +443,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "metal" -version = "0.27.0" +name = "memoffset" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "bitflags 2.6.0", - "block", - "core-graphics-types", - "foreign-types", - "log", - "objc", - "paste", + "autocfg", ] [[package]] @@ -839,32 +458,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] -name = "naga" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e3524642f53d9af419ab5e8dd29d3ba155708267667c2f3f06c88c9e130843" -dependencies = [ - "bit-set", - "bitflags 2.6.0", - "codespan-reporting", - "hexf-parse", - "indexmap", - "log", - "num-traits", - "rustc-hash", - "spirv", - "termcolor", - "thiserror", - "unicode-xid", -] - -[[package]] -name = "ndk-sys" -version = "0.5.0+25.2.9519653" +name = "nix" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "jni-sys", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", ] [[package]] @@ -884,32 +486,32 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.19" +name = "objc" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ - "autocfg", - "libm", + "malloc_buf", ] [[package]] -name = "objc" -version = "0.2.7" +name = "objc-foundation" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" dependencies = [ - "malloc_buf", - "objc_exception", + "block", + "objc", + "objc_id", ] [[package]] -name = "objc_exception" -version = "0.1.2" +name = "objc_id" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" dependencies = [ - "cc", + "objc", ] [[package]] @@ -919,6 +521,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] +name = "os_pipe" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29d73ba8daf8fac13b0501d1abeddcfe21ba7401ada61a819144b6c2a4f32209" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] name = "owned_ttf_parser" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -951,16 +563,14 @@ dependencies = [ ] [[package]] -name = "paste" -version = "1.0.15" +name = "petgraph" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] [[package]] name = "pkg-config" @@ -969,18 +579,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] -name = "pollster" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" - -[[package]] -name = "presser" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" - -[[package]] name = "prettyplease" version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1000,12 +598,6 @@ dependencies = [ ] [[package]] -name = "profiling" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" - -[[package]] name = "quote" version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1015,12 +607,6 @@ dependencies = [ ] [[package]] -name = "range-alloc" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" - -[[package]] name = "raw-window-handle" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1071,12 +657,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] -name = "renderdoc-sys" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" - -[[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1108,34 +688,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "slotmap" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" -dependencies = [ - "version_check", -] - -[[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] -name = "spirv" -version = "0.3.0+sdk-1.3.268.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" +name = "str-buf" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" [[package]] name = "syn" @@ -1160,12 +722,15 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.4.1" +name = "tempfile" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "winapi-util", + "cfg-if", + "fastrand", + "rustix", + "windows-sys", ] [[package]] @@ -1189,47 +754,20 @@ dependencies = [ ] [[package]] -name = "three-d" -version = "0.16.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aecff785797175a2e56dca49da9836948eee41fab48b7b01dfcb64cae256ecb" -dependencies = [ - "cgmath", - "glow 0.12.3", - "instant", - "thiserror", - "three-d-asset", -] - -[[package]] -name = "three-d-asset" -version = "0.6.0" +name = "tree_magic_mini" +version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9959d4427b63958661828008f7470d6a8d2c0945b3df0dc7377d6aca38fb694" +checksum = "469a727cac55b41448315cc10427c069c618ac59bb6a4480283fcd811749bdc2" dependencies = [ - "cgmath", - "half", - "thiserror", - "web-sys", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-core", + "fnv", + "home", + "memchr", + "nom", + "once_cell", + "petgraph", ] [[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" - -[[package]] name = "ttf-parser" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1242,210 +780,68 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] -name = "unicode-width" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "wayland-client" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ - "cfg-if", - "wasm-bindgen-macro", + "bitflags 1.3.2", + "downcast-rs", + "libc", + "nix", + "wayland-commons", + "wayland-scanner", + "wayland-sys", ] [[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" +name = "wayland-commons" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" dependencies = [ - "bumpalo", - "log", + "nix", "once_cell", - "proc-macro2", - "quote", - "syn 2.0.71", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", + "smallvec", + "wayland-sys", ] [[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" +name = "wayland-protocols" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "bitflags 1.3.2", + "wayland-client", + "wayland-commons", + "wayland-scanner", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" +name = "wayland-scanner" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", - "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 = "web-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "wgpu" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd7311dbd2abcfebaabf1841a2824ed7c8be443a0f29166e5d3c6a53a762c01" -dependencies = [ - "arrayvec", - "cfg-if", - "cfg_aliases", - "js-sys", - "log", - "naga", - "parking_lot", - "profiling", - "raw-window-handle 0.6.2", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b94525fc99ba9e5c9a9e24764f2bc29bad0911a7446c12f446a8277369bf3a" -dependencies = [ - "arrayvec", - "bit-vec", - "bitflags 2.6.0", - "cfg_aliases", - "codespan-reporting", - "indexmap", - "log", - "naga", - "once_cell", - "parking_lot", - "profiling", - "raw-window-handle 0.6.2", - "rustc-hash", - "smallvec", - "thiserror", - "web-sys", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-hal" -version = "0.19.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfabcfc55fd86611a855816326b2d54c3b2fd7972c27ce414291562650552703" -dependencies = [ - "android_system_properties", - "arrayvec", - "ash", - "bit-set", - "bitflags 2.6.0", - "block", - "cfg_aliases", - "core-graphics-types", - "d3d12", - "glow 0.13.1", - "glutin_wgl_sys", - "gpu-alloc", - "gpu-allocator", - "gpu-descriptor", - "hassle-rs", - "js-sys", - "khronos-egl", - "libc", - "libloading 0.8.5", - "log", - "metal", - "naga", - "ndk-sys", - "objc", - "once_cell", - "parking_lot", - "profiling", - "range-alloc", - "raw-window-handle 0.6.2", - "renderdoc-sys", - "rustc-hash", - "smallvec", - "thiserror", - "wasm-bindgen", - "web-sys", - "wgpu-types", - "winapi", + "xml-rs", ] [[package]] -name = "wgpu-types" -version = "0.19.2" +name = "wayland-sys" +version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b671ff9fb03f78b46ff176494ee1ebe7d603393f42664be55b64dc8d53969805" +checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" dependencies = [ - "bitflags 2.6.0", - "js-sys", - "web-sys", + "pkg-config", ] [[package]] @@ -1461,12 +857,6 @@ dependencies = [ ] [[package]] -name = "widestring" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" - -[[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1483,12 +873,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "winapi-util" -version = "0.1.8" +name = "winapi-wsapoll" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "1eafc5f679c576995526e81635d0cf9695841736712b4e892f87abbe6fed3f28" dependencies = [ - "windows-sys", + "winapi", ] [[package]] @@ -1498,25 +888,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core", - "windows-targets", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1590,39 +961,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "xml-rs" -version = "0.8.20" +name = "wl-clipboard-rs" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" +checksum = "981a303dfbb75d659f6612d05a14b2e363c103d24f676a2d44a00d18507a1ad9" +dependencies = [ + "derive-new", + "libc", + "log", + "nix", + "os_pipe", + "tempfile", + "thiserror", + "tree_magic_mini", + "wayland-client", + "wayland-protocols", +] [[package]] -name = "zerocopy" -version = "0.6.6" +name = "x11-clipboard" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6" +checksum = "980b9aa9226c3b7de8e2adb11bf20124327c054e0e5812d2aac0b5b5a87e7464" dependencies = [ - "byteorder", - "zerocopy-derive 0.6.6", + "x11rb", ] [[package]] -name = "zerocopy" -version = "0.7.35" +name = "x11rb" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" dependencies = [ - "zerocopy-derive 0.7.35", + "gethostname", + "nix", + "winapi", + "winapi-wsapoll", + "x11rb-protocol", ] [[package]] -name = "zerocopy-derive" -version = "0.6.6" +name = "x11rb-protocol" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" +checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.71", + "nix", +] + +[[package]] +name = "xml-rs" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", ] [[package]] diff --git a/bindgen/rust/Cargo.toml b/bindgen/rust/Cargo.toml index a523e3e..f09c249 100644 --- a/bindgen/rust/Cargo.toml +++ b/bindgen/rust/Cargo.toml @@ -4,11 +4,13 @@ version = "0.1.0" edition = "2021" [dependencies] -egui = "0.26" -egui_overlay = {version = "0.8.1", default-features = false, features = ["three_d"] } -egui_render_three_d = "0.8.0" -egui_render_wgpu = "0.8.0" -egui_window_glfw_passthrough = "0.8.1" +egui = "0.27.1" +egui_glfw = "0.55.1" +gl = "0.14.0" +# egui_overlay = {version = "0.8.1", default-features = false, features = ["three_d"] } +# egui_render_three_d = "0.8.0" +# egui_render_wgpu = "0.8.0" +# egui_window_glfw_passthrough = "0.8.1" [build-dependencies] bindgen = "0.69.4" diff --git a/bindgen/rust/README.md b/bindgen/rust/README.md new file mode 100644 index 0000000..f4b4a01 --- /dev/null +++ b/bindgen/rust/README.md @@ -0,0 +1,3 @@ +# Rust bindings + examples. + +**WIP**: GLFW passthrough to egui
\ No newline at end of file diff --git a/bindgen/rust/build.rs b/bindgen/rust/build.rs index 113059b..18e8ab3 100644 --- a/bindgen/rust/build.rs +++ b/bindgen/rust/build.rs @@ -3,12 +3,13 @@ use std::path::PathBuf; fn main() { // Tell cargo to look for shared libraries in the specified directory - println!("cargo:rustc-link-search=../../build/macosx/arm64/debug"); + // println!("cargo:rustc-link-search=../../build/macosx/arm64/debug"); + println!("cargo:rustc-link-search=../../build/windows/x64/debug"); // Tell cargo to tell rustc to link the system bzip2 // shared library. println!("cargo:rustc-link-lib=core_static"); - println!("cargo:rustc-link-lib=glfw"); + println!("cargo:rustc-link-lib=glfw3"); // The bindgen::Builder is the main entry point // to bindgen, and lets you build up options for diff --git a/bindgen/rust/examples/glfw.rs b/bindgen/rust/examples/glfw.rs new file mode 100644 index 0000000..ce0bc7c --- /dev/null +++ b/bindgen/rust/examples/glfw.rs @@ -0,0 +1,225 @@ +use std::ffi::CString; +use std::ptr::addr_of_mut; + +use celeritas::*; +use egui_glfw as egui_backend; +use egui_backend::egui::{vec2, Pos2, Rect}; +use egui_glfw::glfw::{Context, fail_on_errors}; + +use egui_glfw::glfw; + +const SCREEN_WIDTH: u32 = 2000; +const SCREEN_HEIGHT: u32 = 1800; + +fn main() { + unsafe { + let mut glfw = glfw::init(glfw::fail_on_errors!()).unwrap(); + glfw.window_hint(glfw::WindowHint::ContextVersion(4, 1)); + glfw.window_hint(glfw::WindowHint::OpenGlProfile( + glfw::OpenGlProfileHint::Core, + )); + glfw.window_hint(glfw::WindowHint::DoubleBuffer(true)); + glfw.window_hint(glfw::WindowHint::Resizable(false)); + + let (mut window, events) = glfw + .create_window( + SCREEN_WIDTH, + SCREEN_HEIGHT, + "Egui in GLFW!", + glfw::WindowMode::Windowed, + ) + .expect("Failed to create GLFW window."); + + window.set_all_polling(true); + window.make_current(); + // glfw.set_swap_interval(glfw::SwapInterval::None); + glfw.set_swap_interval(glfw::SwapInterval::Adaptive); + + + + gl::load_with(|symbol| window.get_proc_address(symbol) as *const _); + + let window_ptr = window.window_ptr(); + unsafe { + // Cast the window pointer to the expected type + let window_ptr = window_ptr as *mut celeritas::GLFWwindow; + Core_Bringup(window_ptr); + }; + + let mut painter = egui_backend::Painter::new(&mut window); + let egui_ctx = egui::Context::default(); + + + let (width, height) = window.get_framebuffer_size(); + let native_pixels_per_point = window.get_content_scale().0; + let native_pixels_per_point = 1.0; + // egui_ctx.set_pixels_per_point(2.0); + + let mut egui_input_state = egui_backend::EguiInputState::new(egui::RawInput { + screen_rect: Some(Rect::from_min_size( + Pos2::new(0f32, 0f32), + vec2(width as f32, height as f32) / native_pixels_per_point, + )), + ..Default::default() + }); + + egui_input_state.input.time = Some(0.01); + + // let triangle = triangle::Triangle::new(); + let slider = &mut 0.0; + + // C data + let camera_pos = Vec3 { + x: 18.9, + y: 10.6, + z: 11.6, + }; + let camera_front = Vec3 { + x: -0.6, + y: -0.2, + z: -0.7, + }; + let camera = Camera_Create( + camera_pos, + camera_front, + Vec3 { + x: 0.0, + y: 1.0, + z: 0.0, + }, + 45.0, + ); + SetCamera(camera); + + let mut cube_geo = Geo_CreateCuboid(f32x3 { + x: 2.0, + y: 2.0, + z: 2.0, + }); + let mut crate_mesh = Mesh_Create(addr_of_mut!(cube_geo), false); + let albedo_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_basecolor.jpg") + .unwrap() + .as_ptr() as *const i8, + ); + let roughness_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_roughness.jpg") + .unwrap() + .as_ptr() as *const i8, + ); + let normal_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_normal.jpg") + .unwrap() + .as_ptr() as *const i8, + ); + let ao_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_ambientOcclusion.jpg") + .unwrap() + .as_ptr() as *const i8, + ); + let name: [i8; 64] = [0; 64]; + let mut crate_mat = Material { + name: name, + kind: 0, + param_albedo: Vec3 { + x: 0.0, + y: 0.0, + z: 0.0, + }, + param_metallic: 0.0, + param_roughness: 0.0, + param_ao: 0.0, + pbr_albedo_map: albedo_map, + pbr_normal_map: normal_map, + metal_roughness_combined: true, + pbr_metallic_map: TextureHandle { raw: 99999 }, + pbr_roughness_map: roughness_map, + pbr_ao_map: ao_map, + }; + let crate_renderent = RenderEnt { + mesh: addr_of_mut!(crate_mesh), + material: addr_of_mut!(crate_mat), + affine: mat4_ident(), + casts_shadows: true, + }; + let mut render_ents: [RenderEnt; 1] = [crate_renderent]; + let mut skybox = Skybox_Default(); + + + // Main rendering loop + while !window.should_close() { + glfw.poll_events(); + + egui_ctx.begin_frame(egui_input_state.input.take()); + + unsafe { + gl::ClearColor(0.455, 0.302, 0.663, 1.0); + gl::Clear(gl::COLOR_BUFFER_BIT); + gl::Clear(gl::DEPTH_TEST); + } + + Frame_Begin(); + gl::Enable(gl::DEPTH_TEST); + gl::Enable(gl::CULL_FACE); + + Skybox_Draw(addr_of_mut!(skybox), camera); + Render_RenderEntities( + render_ents.as_mut_ptr(), + render_ents.len(), + ); + + // Frame_End(); + + // triangle.draw(); + + gl::Disable(gl::DEPTH_TEST); + gl::Disable(gl::CULL_FACE); + + egui::Window::new("Egui with GLFW").show(&egui_ctx, |ui| { + ui.label("Celeritas in-game editor"); + let btn_m = &mut ui.button("-"); + let btn_p = &mut ui.button("+"); + + ui.add(egui::Slider::new(slider, 0.0..=100.0).text("My value")); + + if btn_m.clicked() && *slider > 0.0 { + *slider -= 1.0; + } + + if btn_p.clicked() && *slider < 100.0 { + *slider += 1.0; + } + }); + + let egui::FullOutput { + platform_output, + textures_delta, + shapes, .. } = egui_ctx.end_frame(); + + //Handle cut, copy text from egui + if !platform_output.copied_text.is_empty() { + egui_backend::copy_to_clipboard(&mut egui_input_state, platform_output.copied_text); + } + + //Note: passing a bg_color to paint_jobs will clear any previously drawn stuff. + //Use this only if egui is being used for all drawing and you aren't mixing your own Open GL + //drawing calls with it. + //Since we are custom drawing an OpenGL Triangle we don't need egui to clear the background. + + let clipped_shapes = egui_ctx.tessellate(shapes, native_pixels_per_point); + painter.paint_and_update_textures(native_pixels_per_point, &clipped_shapes, &textures_delta); + + for (_, event) in glfw::flush_messages(&events) { + match event { + glfw::WindowEvent::Close => window.set_should_close(true), + _ => { + egui_backend::handle_event(event, &mut egui_input_state); + } + } + } + + window.swap_buffers(); + } + + } +} diff --git a/bindgen/rust/examples/gui_test.rs b/bindgen/rust/examples/gui_test.rs index 891b698..ddd8b86 100644 --- a/bindgen/rust/examples/gui_test.rs +++ b/bindgen/rust/examples/gui_test.rs @@ -1,135 +1,283 @@ -#![windows_subsystem = "windows"] // to turn off console. - -use celeritas::{Frame_Begin, Frame_End}; -use egui::DragValue; -use egui_overlay::EguiOverlay; -use egui_render_three_d::ThreeDBackend; -use egui_render_wgpu::WgpuBackend; - -fn main() { - // use tracing_subscriber::{fmt, prelude::*, EnvFilter}; - // if RUST_LOG is not set, we will use the following filters - // tracing_subscriber::registry() - // .with(fmt::layer()) - // .with( - // EnvFilter::try_from_default_env() - // .unwrap_or(EnvFilter::new("debug,wgpu=warn,naga=warn")), - // ) - // .init(); - - celeritas::egui_utils::start(HelloWorld { frame: 0}); -} - -pub struct HelloWorld { - pub frame: u64, -} -impl EguiOverlay for HelloWorld { - fn gui_run( - &mut self, - egui_context: &egui::Context, - _default_gfx_backend: &mut ThreeDBackend, - glfw_backend: &mut egui_window_glfw_passthrough::GlfwBackend, - ) { - // unsafe { - // Frame_Begin(); - // Frame_End(); - // } - - // just some controls to show how you can use glfw_backend - egui::Window::new("controls").show(egui_context, |ui| { - ui.set_width(300.0); - self.frame += 1; - ui.label(format!("current frame number: {}", self.frame)); - // sometimes, you want to see the borders to understand where the overlay is. - let mut borders = glfw_backend.window.is_decorated(); - if ui.checkbox(&mut borders, "window borders").changed() { - glfw_backend.window.set_decorated(borders); - } - - ui.label(format!( - "pixels_per_virtual_unit: {}", - glfw_backend.physical_pixels_per_virtual_unit - )); - ui.label(format!("window scale: {}", glfw_backend.scale)); - ui.label(format!("cursor pos x: {}", glfw_backend.cursor_pos[0])); - ui.label(format!("cursor pos y: {}", glfw_backend.cursor_pos[1])); - - ui.label(format!( - "passthrough: {}", - glfw_backend.window.is_mouse_passthrough() - )); - // how to change size. - // WARNING: don't use drag value, because window size changing while dragging ui messes things up. - let mut size = glfw_backend.window_size_logical; - let mut changed = false; - ui.horizontal(|ui| { - ui.label("width: "); - ui.add_enabled(false, DragValue::new(&mut size[0])); - if ui.button("inc").clicked() { - size[0] += 10.0; - changed = true; - } - if ui.button("dec").clicked() { - size[0] -= 10.0; - changed = true; - } - }); - ui.horizontal(|ui| { - ui.label("height: "); - ui.add_enabled(false, DragValue::new(&mut size[1])); - if ui.button("inc").clicked() { - size[1] += 10.0; - changed = true; - } - if ui.button("dec").clicked() { - size[1] -= 10.0; - changed = true; - } - }); - if changed { - glfw_backend.set_window_size(size); - } - // how to change size. - // WARNING: don't use drag value, because window size changing while dragging ui messes things up. - let mut pos = glfw_backend.window_position; - let mut changed = false; - ui.horizontal(|ui| { - ui.label("x: "); - ui.add_enabled(false, DragValue::new(&mut pos[0])); - if ui.button("inc").clicked() { - pos[0] += 10; - changed = true; - } - if ui.button("dec").clicked() { - pos[0] -= 10; - changed = true; - } - }); - ui.horizontal(|ui| { - ui.label("y: "); - ui.add_enabled(false, DragValue::new(&mut pos[1])); - if ui.button("inc").clicked() { - pos[1] += 10; - changed = true; - } - if ui.button("dec").clicked() { - pos[1] -= 10; - changed = true; - } - }); - if changed { - glfw_backend.window.set_pos(pos[0], pos[1]); - } - }); - - // here you decide if you want to be passthrough or not. - if egui_context.wants_pointer_input() || egui_context.wants_keyboard_input() { - // we need input, so we need the window to be NOT passthrough - glfw_backend.set_passthrough(false); - } else { - // we don't care about input, so the window can be passthrough now - glfw_backend.set_passthrough(true) - } - egui_context.request_repaint(); - } -}
\ No newline at end of file +// // #![windows_subsystem = "windows"] // to turn off console. + +// use std::ptr; +// use std::{ffi::CString, ptr::addr_of_mut}; + +// use celeritas::*; +// use egui::DragValue; +// use egui_overlay::{EguiOverlay, OverlayApp}; +// use egui_render_three_d::ThreeDBackend; +// use egui_window_glfw_passthrough::glfw::Context; +// use egui_window_glfw_passthrough::{GlfwBackend, GlfwConfig}; + +// fn main() { +// // use tracing_subscriber::{fmt, prelude::*, EnvFilter}; +// // if RUST_LOG is not set, we will use the following filters +// // tracing_subscriber::registry() +// // .with(fmt::layer()) +// // .with( +// // EnvFilter::try_from_default_env() +// // .unwrap_or(EnvFilter::new("debug,wgpu=warn,naga=warn")), +// // ) +// // .init(); + +// unsafe { +// // let p: *mut GLFWwindow = ptr::null_mut(); +// // Core_Bringup(p); + +// // let core = get_global_core(); +// // let glfw_window_ptr = Core_GetGlfwWindowPtr(core); + +// let mut glfw_backend = GlfwBackend::new(GlfwConfig { +// // this closure will be called before creating a window +// glfw_callback: Box::new(|gtx| { +// // some defualt hints. it is empty atm, but in future we might add some convenience hints to it. +// (egui_window_glfw_passthrough::GlfwConfig::default().glfw_callback)(gtx); +// // scale the window size based on monitor scale. as 800x600 looks too small on a 4k screen, compared to a hd screen in absolute pixel sizes. +// gtx.window_hint( +// egui_window_glfw_passthrough::glfw::WindowHint::ScaleToMonitor(true), +// ); +// }), +// opengl_window: Some(true), // macos doesn't support opengl. +// transparent_window: Some(false), +// window_title: "Celeritas egui".into(), +// ..Default::default() +// }); + +// // always on top +// // glfw_backend.window.set_floating(true); +// // disable borders/titlebar +// // glfw_backend.window.set_decorated(false); + +// let latest_size = glfw_backend.window.get_framebuffer_size(); +// let latest_size = [latest_size.0 as _, latest_size.1 as _]; + +// let default_gfx_backend = { +// ThreeDBackend::new( +// egui_render_three_d::ThreeDConfig { +// ..Default::default() +// }, +// |s| glfw_backend.get_proc_address(s), +// latest_size, +// ) +// }; + +// let glfw_window_ptr = glfw_backend.window.window_ptr(); +// unsafe { +// // Cast the window pointer to the expected type +// let window_ptr = glfw_window_ptr as *mut crate::GLFWwindow; +// Core_Bringup(window_ptr); +// }; + +// // cam pos: 18.871811 10.658584 11.643305 cam frontL -0.644326 -0.209243 -0.735569 +// let camera_pos = Vec3 { +// x: 18.9, +// y: 10.6, +// z: 11.6, +// }; +// let camera_front = Vec3 { +// x: -0.6, +// y: -0.2, +// z: -0.7, +// }; +// let camera = Camera_Create( +// camera_pos, +// camera_front, +// Vec3 { +// x: 0.0, +// y: 1.0, +// z: 0.0, +// }, +// 45.0, +// ); +// SetCamera(camera); + +// let mut cube_geo = Geo_CreateCuboid(f32x3 { +// x: 2.0, +// y: 2.0, +// z: 2.0, +// }); +// let mut crate_mesh = Mesh_Create(addr_of_mut!(cube_geo), false); +// let albedo_map = TextureLoadFromFile( +// CString::new("assets/demo/crate/Wood_Crate_001_basecolor.jpg") +// .unwrap() +// .as_ptr() as *const i8, +// ); +// let roughness_map = TextureLoadFromFile( +// CString::new("assets/demo/crate/Wood_Crate_001_roughness.jpg") +// .unwrap() +// .as_ptr() as *const i8, +// ); +// let normal_map = TextureLoadFromFile( +// CString::new("assets/demo/crate/Wood_Crate_001_normal.jpg") +// .unwrap() +// .as_ptr() as *const i8, +// ); +// let ao_map = TextureLoadFromFile( +// CString::new("assets/demo/crate/Wood_Crate_001_ambientOcclusion.jpg") +// .unwrap() +// .as_ptr() as *const i8, +// ); +// let name: [i8; 64] = [0; 64]; +// let mut crate_mat = Material { +// name: name, +// kind: 0, +// param_albedo: Vec3 { +// x: 0.0, +// y: 0.0, +// z: 0.0, +// }, +// param_metallic: 0.0, +// param_roughness: 0.0, +// param_ao: 0.0, +// pbr_albedo_map: albedo_map, +// pbr_normal_map: normal_map, +// metal_roughness_combined: true, +// pbr_metallic_map: TextureHandle { raw: 99999 }, +// pbr_roughness_map: roughness_map, +// pbr_ao_map: ao_map, +// }; +// let crate_renderent = RenderEnt { +// mesh: addr_of_mut!(crate_mesh), +// material: addr_of_mut!(crate_mat), +// affine: mat4_ident(), +// casts_shadows: true, +// }; +// let mut render_ents: [RenderEnt; 1] = [crate_renderent]; + +// let world_state = HelloWorld { +// frame: 0, +// render_entities: render_ents, +// }; + +// let overlap_app = OverlayApp { +// user_data: world_state, +// egui_context: Default::default(), +// default_gfx_backend, +// glfw_backend, +// }; + +// overlap_app.enter_event_loop(); + +// // celeritas::egui_utils::start(HelloWorld { frame: 0}); +// } +// } + +// pub struct HelloWorld { +// pub frame: u64, +// pub render_entities: [RenderEnt; 1], +// } +// impl EguiOverlay for HelloWorld { +// fn gui_run( +// &mut self, +// egui_context: &egui::Context, +// _default_gfx_backend: &mut ThreeDBackend, +// glfw_backend: &mut egui_window_glfw_passthrough::GlfwBackend, +// ) { +// unsafe { +// // Frame_Begin(); +// // Render_RenderEntities( +// // self.render_entities.as_mut_ptr(), +// // self.render_entities.len(), +// // ); +// // Frame_End(); +// } + +// // just some controls to show how you can use glfw_backend +// egui::Window::new("controls").show(egui_context, |ui| { +// ui.set_width(300.0); +// self.frame += 1; +// ui.label(format!("current frame number: {}", self.frame)); +// // sometimes, you want to see the borders to understand where the overlay is. +// let mut borders = glfw_backend.window.is_decorated(); +// if ui.checkbox(&mut borders, "window borders").changed() { +// glfw_backend.window.set_decorated(borders); +// } + +// ui.label(format!( +// "pixels_per_virtual_unit: {}", +// glfw_backend.physical_pixels_per_virtual_unit +// )); +// ui.label(format!("window scale: {}", glfw_backend.scale)); +// ui.label(format!("cursor pos x: {}", glfw_backend.cursor_pos[0])); +// ui.label(format!("cursor pos y: {}", glfw_backend.cursor_pos[1])); + +// ui.label(format!( +// "passthrough: {}", +// glfw_backend.window.is_mouse_passthrough() +// )); +// // how to change size. +// // WARNING: don't use drag value, because window size changing while dragging ui messes things up. +// let mut size = glfw_backend.window_size_logical; +// let mut changed = false; +// ui.horizontal(|ui| { +// ui.label("width: "); +// ui.add_enabled(false, DragValue::new(&mut size[0])); +// if ui.button("inc").clicked() { +// size[0] += 10.0; +// changed = true; +// } +// if ui.button("dec").clicked() { +// size[0] -= 10.0; +// changed = true; +// } +// }); +// ui.horizontal(|ui| { +// ui.label("height: "); +// ui.add_enabled(false, DragValue::new(&mut size[1])); +// if ui.button("inc").clicked() { +// size[1] += 10.0; +// changed = true; +// } +// if ui.button("dec").clicked() { +// size[1] -= 10.0; +// changed = true; +// } +// }); +// if changed { +// glfw_backend.set_window_size(size); +// } +// // how to change size. +// // WARNING: don't use drag value, because window size changing while dragging ui messes things up. +// let mut pos = glfw_backend.window_position; +// let mut changed = false; +// ui.horizontal(|ui| { +// ui.label("x: "); +// ui.add_enabled(false, DragValue::new(&mut pos[0])); +// if ui.button("inc").clicked() { +// pos[0] += 10; +// changed = true; +// } +// if ui.button("dec").clicked() { +// pos[0] -= 10; +// changed = true; +// } +// }); +// ui.horizontal(|ui| { +// ui.label("y: "); +// ui.add_enabled(false, DragValue::new(&mut pos[1])); +// if ui.button("inc").clicked() { +// pos[1] += 10; +// changed = true; +// } +// if ui.button("dec").clicked() { +// pos[1] -= 10; +// changed = true; +// } +// }); +// if changed { +// glfw_backend.window.set_pos(pos[0], pos[1]); +// } +// }); + +// // here you decide if you want to be passthrough or not. +// if egui_context.wants_pointer_input() || egui_context.wants_keyboard_input() { +// // we need input, so we need the window to be NOT passthrough +// glfw_backend.set_passthrough(false); +// } else { +// // we don't care about input, so the window can be passthrough now +// glfw_backend.set_passthrough(true) +// } +// egui_context.request_repaint(); +// } +// } diff --git a/bindgen/rust/examples/main_loop.rs b/bindgen/rust/examples/main_loop.rs index 6fce5cf..2b4919a 100644 --- a/bindgen/rust/examples/main_loop.rs +++ b/bindgen/rust/examples/main_loop.rs @@ -1,4 +1,7 @@ -use std::{ffi::{ CString}, ptr::{self, addr_of_mut}}; +use std::{ + ffi::CString, + ptr::{self, addr_of_mut}, +}; use celeritas::*; @@ -10,58 +13,64 @@ unsafe fn run_game() { let core = get_global_core(); let glfw_window_ptr = Core_GetGlfwWindowPtr(core); + // cam pos: 18.871811 10.658584 11.643305 cam frontL -0.644326 -0.209243 -0.735569 let camera_pos = Vec3 { - x: 0.0, - y: 2.0, - z: -3.0, + x: 18.9, + y: 10.6, + z: 11.6, + }; + let camera_front = Vec3 { + x: -0.6, + y: -0.2, + z: -0.7, }; let camera = Camera_Create( camera_pos, - vec3_normalise(vec3_negate(camera_pos)), - VEC3_Y, + camera_front, + Vec3 { + x: 0.0, + y: 1.0, + z: 0.0, + }, 45.0, ); SetCamera(camera); - let whatever = Vec3 { - x: 1.0, - y: 1.0, - z: 1.0, - }; - let sun = DirectionalLight { - direction: whatever, - ambient: whatever, - diffuse: whatever, - specular: whatever, - }; - SetMainLight(sun); - -// Geometry cube_geo = Geo_CreateCuboid(f32x3(2.0, 2.0, 2.0)); -// Mesh crate_mesh = Mesh_Create(&cube_geo, false); // dont free as we may use later -// TextureHandle albedo_map = TextureLoadFromFile("assets/demo/crate/Wood_Crate_001_basecolor.jpg"); -// TextureHandle roughness_map = -// TextureLoadFromFile("assets/demo/crate/Wood_Crate_001_roughness.jpg"); -// TextureHandle normal_map = TextureLoadFromFile("assets/demo/crate/Wood_Crate_001_normal.jpg"); -// TextureHandle ao_map = -// TextureLoadFromFile("assets/demo/crate/Wood_Crate_001_ambientOcclusion.jpg"); -// Material crate_mat = { .name = "Wood_Crate", -// .kind = MAT_PBR, -// .metal_roughness_combined = true, -// .pbr_albedo_map = albedo_map, -// .pbr_metallic_map = roughness_map, -// .pbr_normal_map = normal_map, -// .pbr_ao_map = ao_map }; - let mut cube_geo = Geo_CreateCuboid(f32x3 { x: 2.0, y: 2.0, z: 2.0 }); + let mut cube_geo = Geo_CreateCuboid(f32x3 { + x: 2.0, + y: 2.0, + z: 2.0, + }); let mut crate_mesh = Mesh_Create(addr_of_mut!(cube_geo), false); - let albedo_map = TextureLoadFromFile(CString::new("assets/demo/crate/Wood_Crate_001_basecolor.jpg").unwrap().as_ptr() as *const i8); - let roughness_map = TextureLoadFromFile(CString::new("assets/demo/crate/Wood_Crate_001_roughness.jpg").unwrap().as_ptr() as *const i8); - let normal_map = TextureLoadFromFile(CString::new("assets/demo/crate/Wood_Crate_001_normal.jpg").unwrap().as_ptr() as *const i8); - let ao_map = TextureLoadFromFile(CString::new("assets/demo/crate/Wood_Crate_001_ambientOcclusion.jpg").unwrap().as_ptr() as *const i8); + let albedo_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_basecolor.jpg") + .unwrap() + .as_ptr() as *const i8, + ); + let roughness_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_roughness.jpg") + .unwrap() + .as_ptr() as *const i8, + ); + let normal_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_normal.jpg") + .unwrap() + .as_ptr() as *const i8, + ); + let ao_map = TextureLoadFromFile( + CString::new("assets/demo/crate/Wood_Crate_001_ambientOcclusion.jpg") + .unwrap() + .as_ptr() as *const i8, + ); let name: [i8; 64] = [0; 64]; let mut crate_mat = Material { name: name, kind: 0, - param_albedo: VEC3_ZERO, + param_albedo: Vec3 { + x: 0.0, + y: 0.0, + z: 0.0, + }, param_metallic: 0.0, param_roughness: 0.0, param_ao: 0.0, @@ -70,7 +79,7 @@ unsafe fn run_game() { metal_roughness_combined: true, pbr_metallic_map: TextureHandle { raw: 99999 }, pbr_roughness_map: roughness_map, - pbr_ao_map: ao_map + pbr_ao_map: ao_map, }; let crate_renderent = RenderEnt { mesh: addr_of_mut!(crate_mesh), @@ -78,14 +87,8 @@ unsafe fn run_game() { affine: mat4_ident(), casts_shadows: true, }; - let mut render_entities: [RenderEnt; 1] = [crate_renderent]; - - // RenderEnt crate_renderable = { - // .mesh = &crate_mesh, .material = &crate_mat, .affine = mat4_scale(3.0), .casts_shadows = true - // }; + let mut render_entities: [RenderEnt; 1] = [crate_renderent]; - // RenderEnt entities[] = { cube_r, crate_renderable }; - // size_t entity_count = 1; // main loop while !ShouldExit() { diff --git a/bindgen/rust/src/egui_utils.rs b/bindgen/rust/src/egui_utils.rs index b29e271..5432d81 100644 --- a/bindgen/rust/src/egui_utils.rs +++ b/bindgen/rust/src/egui_utils.rs @@ -1,72 +1,72 @@ -use egui_overlay::{EguiOverlay, OverlayApp}; -use egui_render_three_d::ThreeDBackend; -use egui_window_glfw_passthrough::glfw::Context; -use egui_window_glfw_passthrough::{GlfwBackend, GlfwConfig}; +// use egui_overlay::{EguiOverlay, OverlayApp}; +// use egui_render_three_d::ThreeDBackend; +// use egui_window_glfw_passthrough::glfw::Context; +// use egui_window_glfw_passthrough::{GlfwBackend, GlfwConfig}; -use crate::Core_Bringup; +// use crate::Core_Bringup; -// struct CustomEguiOverlay { -// backend: -// } +// // struct CustomEguiOverlay { +// // backend: +// // } -fn init() { - let mut glfw_backend = GlfwBackend::new(GlfwConfig::default()); - let mut glfw_window_ptr = glfw_backend.window.window_ptr(); +// fn init() { +// let mut glfw_backend = GlfwBackend::new(GlfwConfig::default()); +// let mut glfw_window_ptr = glfw_backend.window.window_ptr(); - unsafe { - // Cast the window pointer to the expected type - let window_ptr = glfw_window_ptr as *mut crate::GLFWwindow; - Core_Bringup(window_ptr); - }; -} +// unsafe { +// // Cast the window pointer to the expected type +// let window_ptr = glfw_window_ptr as *mut crate::GLFWwindow; +// Core_Bringup(window_ptr); +// }; +// } -/// After implementing [`EguiOverlay`], just call this function with your app data -pub fn start<T: EguiOverlay + 'static>(user_data: T) { - let mut glfw_backend = GlfwBackend::new(GlfwConfig { - // this closure will be called before creating a window - glfw_callback: Box::new(|gtx| { - // some defualt hints. it is empty atm, but in future we might add some convenience hints to it. - (egui_window_glfw_passthrough::GlfwConfig::default().glfw_callback)(gtx); - // scale the window size based on monitor scale. as 800x600 looks too small on a 4k screen, compared to a hd screen in absolute pixel sizes. - gtx.window_hint(egui_window_glfw_passthrough::glfw::WindowHint::ScaleToMonitor(true)); - }), - opengl_window: Some(true), // macos doesn't support opengl. - transparent_window: Some(false), - window_title: "Celeritas egui".into(), - ..Default::default() - }); +// /// After implementing [`EguiOverlay`], just call this function with your app data +// pub fn start<T: EguiOverlay + 'static>(user_data: T) { +// let mut glfw_backend = GlfwBackend::new(GlfwConfig { +// // this closure will be called before creating a window +// glfw_callback: Box::new(|gtx| { +// // some defualt hints. it is empty atm, but in future we might add some convenience hints to it. +// (egui_window_glfw_passthrough::GlfwConfig::default().glfw_callback)(gtx); +// // scale the window size based on monitor scale. as 800x600 looks too small on a 4k screen, compared to a hd screen in absolute pixel sizes. +// gtx.window_hint(egui_window_glfw_passthrough::glfw::WindowHint::ScaleToMonitor(true)); +// }), +// opengl_window: Some(true), // macos doesn't support opengl. +// transparent_window: Some(false), +// window_title: "Celeritas egui".into(), +// ..Default::default() +// }); - // always on top - // glfw_backend.window.set_floating(true); - // disable borders/titlebar - // glfw_backend.window.set_decorated(false); +// // always on top +// // glfw_backend.window.set_floating(true); +// // disable borders/titlebar +// // glfw_backend.window.set_decorated(false); - let latest_size = glfw_backend.window.get_framebuffer_size(); - let latest_size = [latest_size.0 as _, latest_size.1 as _]; +// let latest_size = glfw_backend.window.get_framebuffer_size(); +// let latest_size = [latest_size.0 as _, latest_size.1 as _]; - let default_gfx_backend = { - ThreeDBackend::new( - egui_render_three_d::ThreeDConfig { - ..Default::default() - }, - |s| glfw_backend.get_proc_address(s), - latest_size, - ) - }; +// let default_gfx_backend = { +// ThreeDBackend::new( +// egui_render_three_d::ThreeDConfig { +// ..Default::default() +// }, +// |s| glfw_backend.get_proc_address(s), +// latest_size, +// ) +// }; - let glfw_window_ptr = glfw_backend.window.window_ptr(); - unsafe { - // Cast the window pointer to the expected type - let window_ptr = glfw_window_ptr as *mut crate::GLFWwindow; - Core_Bringup(window_ptr); - }; +// let glfw_window_ptr = glfw_backend.window.window_ptr(); +// unsafe { +// // Cast the window pointer to the expected type +// let window_ptr = glfw_window_ptr as *mut crate::GLFWwindow; +// Core_Bringup(window_ptr); +// }; - let overlap_app = OverlayApp { - user_data, - egui_context: Default::default(), - default_gfx_backend, - glfw_backend, - }; +// let overlap_app = OverlayApp { +// user_data, +// egui_context: Default::default(), +// default_gfx_backend, +// glfw_backend, +// }; - overlap_app.enter_event_loop(); -} +// overlap_app.enter_event_loop(); +// } diff --git a/bindgen/rust/src/lib.rs b/bindgen/rust/src/lib.rs index 6f110c0..1f64680 100644 --- a/bindgen/rust/src/lib.rs +++ b/bindgen/rust/src/lib.rs @@ -2,6 +2,6 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -include!(concat!(env!("OUT_DIR"), "/bindings.rs")); - pub mod egui_utils; + +include!(concat!(env!("OUT_DIR"), "/bindings.rs")); |