diff --git a/Cargo.lock b/Cargo.lock index f553502..9bd77a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,6 +180,27 @@ dependencies = [ "thiserror", ] +[[package]] +name = "android-activity" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046" +dependencies = [ + "android-properties", + "bitflags 2.6.0", + "cc", + "cesu8", + "jni", + "jni-sys", + "libc", + "log", + "ndk 0.9.0", + "ndk-context", + "ndk-sys 0.6.0+11769913", + "num_enum 0.7.3", + "thiserror", +] + [[package]] name = "android-properties" version = "0.2.2" @@ -440,6 +461,15 @@ dependencies = [ "objc2 0.4.1", ] +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.2", +] + [[package]] name = "bork" version = "0.2.1" @@ -680,6 +710,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "cgl" version = "0.3.2" @@ -740,6 +776,7 @@ dependencies = [ "gl", "glib-build-tools", "glib-macros 0.19.9", + "glium", "glow", "glue", "gtk4", @@ -1186,6 +1223,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "dpi" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" + [[package]] name = "earcutr" version = "0.4.3" @@ -1769,8 +1812,8 @@ dependencies = [ "geo-macros", "glow", "glsl", - "glutin", - "glutin-winit", + "glutin 0.31.3", + "glutin-winit 0.4.2", "image 0.25.2", "include_dir", "log", @@ -1784,7 +1827,7 @@ dependencies = [ "paste 1.0.15", "pathfinder_geometry", "radarg_core", - "raw-window-handle", + "raw-window-handle 0.5.2", "regex", "relm4", "rust-embed", @@ -1998,6 +2041,23 @@ dependencies = [ "system-deps 7.0.2", ] +[[package]] +name = "glium" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a3028d1f135b5395e6e4336916b424bc5dd2b38c6e378ce2704e4b8f4a617ed" +dependencies = [ + "backtrace", + "fnv", + "gl_generator 0.14.0", + "glutin 0.32.1", + "glutin-winit 0.5.0", + "memoffset 0.9.1", + "raw-window-handle 0.6.2", + "smallvec", + "winit 0.30.5", +] + [[package]] name = "glow" version = "0.13.1" @@ -2036,35 +2096,72 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18fcd4ae4e86d991ad1300b8f57166e5be0c95ef1f63f3f5b827f8a164548746" dependencies = [ "bitflags 2.6.0", - "cfg_aliases", + "cfg_aliases 0.1.1", "cgl", "core-foundation", "dispatch", - "glutin_egl_sys", - "glutin_glx_sys", - "glutin_wgl_sys", + "glutin_egl_sys 0.6.0", + "glutin_glx_sys 0.5.0", + "glutin_wgl_sys 0.5.0", "icrate", "libloading 0.8.5", "objc2 0.4.1", "once_cell", - "raw-window-handle", + "raw-window-handle 0.5.2", "wayland-sys 0.31.4", "windows-sys 0.48.0", "x11-dl", ] +[[package]] +name = "glutin" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec69412a0bf07ea7607e638b415447857a808846c2b685a43c8aa18bc6d5e499" +dependencies = [ + "bitflags 2.6.0", + "cfg_aliases 0.2.1", + "cgl", + "core-foundation", + "dispatch", + "glutin_egl_sys 0.7.0", + "glutin_glx_sys 0.6.0", + "glutin_wgl_sys 0.6.0", + "libloading 0.8.5", + "objc2 0.5.2", + "objc2-app-kit", + "objc2-foundation", + "once_cell", + "raw-window-handle 0.6.2", + "wayland-sys 0.31.4", + "windows-sys 0.52.0", + "x11-dl", +] + [[package]] name = "glutin-winit" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebcdfba24f73b8412c5181e56f092b5eff16671c514ce896b258a0a64bd7735" dependencies = [ - "cfg_aliases", - "glutin", - "raw-window-handle", + "cfg_aliases 0.1.1", + "glutin 0.31.3", + "raw-window-handle 0.5.2", "winit 0.29.15", ] +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases 0.2.1", + "glutin 0.32.1", + "raw-window-handle 0.6.2", + "winit 0.30.5", +] + [[package]] name = "glutin_egl_sys" version = "0.6.0" @@ -2075,6 +2172,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "glutin_egl_sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae99fff4d2850dbe6fb8c1fa8e4fead5525bab715beaacfccf3fb994e01c827" +dependencies = [ + "gl_generator 0.14.0", + "windows-sys 0.52.0", +] + [[package]] name = "glutin_glx_sys" version = "0.5.0" @@ -2085,6 +2192,16 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "glutin_glx_sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2b2d3918e76e18e08796b55eb64e8fe6ec67d5a6b2e2a7e2edce224ad24c63" +dependencies = [ + "gl_generator 0.14.0", + "x11-dl", +] + [[package]] name = "glutin_wgl_sys" version = "0.5.0" @@ -2094,6 +2211,15 @@ dependencies = [ "gl_generator 0.14.0", ] +[[package]] +name = "glutin_wgl_sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a4e1951bbd9434a81aa496fe59ccc2235af3820d27b85f9314e279609211e2c" +dependencies = [ + "gl_generator 0.14.0", +] + [[package]] name = "gobject-sys" version = "0.17.10" @@ -3129,7 +3255,7 @@ dependencies = [ "jni-sys", "ndk-sys 0.4.1+23.1.7779620", "num_enum 0.5.11", - "raw-window-handle", + "raw-window-handle 0.5.2", "thiserror", ] @@ -3144,7 +3270,22 @@ dependencies = [ "log", "ndk-sys 0.5.0+25.2.9519653", "num_enum 0.7.3", - "raw-window-handle", + "raw-window-handle 0.5.2", + "thiserror", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.6.0", + "jni-sys", + "log", + "ndk-sys 0.6.0+11769913", + "num_enum 0.7.3", + "raw-window-handle 0.6.2", "thiserror", ] @@ -3172,6 +3313,15 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -3504,6 +3654,92 @@ dependencies = [ "objc2-encode 3.0.0", ] +[[package]] +name = "objc2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys 0.3.5", + "objc2-encode 4.0.3", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "libc", + "objc2 0.5.2", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-contacts", + "objc2-foundation", +] + [[package]] name = "objc2-encode" version = "2.0.0-pre.2" @@ -3519,6 +3755,117 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" +[[package]] +name = "objc2-encode" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.2", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-app-kit", + "objc2-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.2", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.6.0", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation", +] + [[package]] name = "objc_exception" version = "0.1.2" @@ -3791,6 +4138,26 @@ dependencies = [ "sha2", ] +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2 1.0.86", + "quote 1.0.37", + "syn 2.0.75", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -4163,6 +4530,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + [[package]] name = "rawpointer" version = "0.2.1" @@ -4561,7 +4934,20 @@ dependencies = [ "log", "memmap2 0.5.10", "smithay-client-toolkit 0.16.1", - "tiny-skia", + "tiny-skia 0.8.4", +] + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2 0.9.4", + "smithay-client-toolkit 0.19.2", + "tiny-skia 0.11.4", ] [[package]] @@ -4964,7 +5350,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2e4280229411d6eb8a8f873152dece1904df2682003bdc748adc181e003568" dependencies = [ "bitflags 1.3.2", - "cfg_aliases", + "cfg_aliases 0.1.1", "cgl", "cocoa", "core-foundation", @@ -4978,7 +5364,7 @@ dependencies = [ "mach", "metal", "objc", - "raw-window-handle", + "raw-window-handle 0.5.2", "servo-display-link", "wayland-sys 0.30.1", "winapi", @@ -5174,7 +5560,21 @@ dependencies = [ "bytemuck", "cfg-if", "png", - "tiny-skia-path", + "tiny-skia-path 0.8.4", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path 0.11.4", ] [[package]] @@ -5188,6 +5588,17 @@ dependencies = [ "strict-num", ] +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + [[package]] name = "tinyfiledialogs" version = "3.9.1" @@ -5614,7 +6025,7 @@ dependencies = [ "parking_lot", "proc-macro2 1.0.86", "quote 1.0.37", - "raw-window-handle", + "raw-window-handle 0.5.2", "regex", "serde", "serde_json", @@ -5864,6 +6275,19 @@ dependencies = [ "wayland-scanner 0.31.4", ] +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f79f2d57c7fcc6ab4d602adba364bf59a5c24de57bd194486bf9b8360e06bfc4" +dependencies = [ + "bitflags 2.6.0", + "wayland-backend", + "wayland-client 0.31.5", + "wayland-protocols 0.32.3", + "wayland-scanner 0.31.4", +] + [[package]] name = "wayland-protocols-wlr" version = "0.2.0" @@ -5967,6 +6391,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "weezl" version = "0.1.8" @@ -6245,7 +6679,7 @@ checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" dependencies = [ "android-activity 0.4.3", "bitflags 1.3.2", - "cfg_aliases", + "cfg_aliases 0.1.1", "core-foundation", "core-graphics 0.22.3", "dispatch", @@ -6258,9 +6692,9 @@ dependencies = [ "once_cell", "orbclient", "percent-encoding", - "raw-window-handle", + "raw-window-handle 0.5.2", "redox_syscall 0.3.5", - "sctk-adwaita", + "sctk-adwaita 0.5.4", "smithay-client-toolkit 0.16.1", "wasm-bindgen", "wayland-client 0.29.5", @@ -6284,7 +6718,7 @@ dependencies = [ "bitflags 2.6.0", "bytemuck", "calloop 0.12.4", - "cfg_aliases", + "cfg_aliases 0.1.1", "core-foundation", "core-graphics 0.23.2", "cursor-icon", @@ -6299,7 +6733,7 @@ dependencies = [ "once_cell", "orbclient", "percent-encoding", - "raw-window-handle", + "raw-window-handle 0.5.2", "redox_syscall 0.3.5", "rustix", "smithay-client-toolkit 0.18.1", @@ -6310,15 +6744,67 @@ dependencies = [ "wayland-backend", "wayland-client 0.31.5", "wayland-protocols 0.31.2", - "wayland-protocols-plasma", + "wayland-protocols-plasma 0.2.0", "web-sys", - "web-time", + "web-time 0.2.4", "windows-sys 0.48.0", "x11-dl", "x11rb", "xkbcommon-dl", ] +[[package]] +name = "winit" +version = "0.30.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67" +dependencies = [ + "ahash", + "android-activity 0.6.0", + "atomic-waker", + "bitflags 2.6.0", + "block2 0.5.1", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases 0.2.1", + "concurrent-queue", + "core-foundation", + "core-graphics 0.23.2", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2 0.9.4", + "ndk 0.9.0", + "objc2 0.5.2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle 0.6.2", + "redox_syscall 0.4.1", + "rustix", + "sctk-adwaita 0.10.1", + "smithay-client-toolkit 0.19.2", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client 0.31.5", + "wayland-protocols 0.32.3", + "wayland-protocols-plasma 0.3.3", + "web-sys", + "web-time 1.1.0", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + [[package]] name = "winnow" version = "0.5.40" diff --git a/config.toml b/config.toml index 115b3b5..973fffb 100644 --- a/config.toml +++ b/config.toml @@ -1,6 +1,6 @@ [common] background = "Terrain" -path = "/Users/tsuki/projects/radar-gb/resources/alts.png" +path = "resources/alts.png" [[cmap]] type = "DBZ" diff --git a/gi/src/graphics/colormap/linear.rs b/gi/src/graphics/colormap/linear.rs index 1caaa9b..d69e4a5 100644 --- a/gi/src/graphics/colormap/linear.rs +++ b/gi/src/graphics/colormap/linear.rs @@ -55,7 +55,7 @@ impl ColorMap for LinearColormap { program: &crate::components::Program, ) -> crate::errors::Result<()> { use bytemuck::cast_slice; - #[cfg(target_os = "macos")] + // #[cfg(target_os = "macos")] unsafe { if self.color_changed { let texture = gl.create_texture().unwrap(); @@ -93,16 +93,16 @@ impl ColorMap for LinearColormap { ); } - #[cfg(not(target_os = "macos"))] - unsafe { - let texture = gl.create_named_texture(glow::TEXTURE_1D).unwrap(); - gl.texture_parameter_i32(texture, glow::TEXTURE_MIN_FILTER, glow::NEAREST as i32); - gl.texture_parameter_i32(texture, glow::TEXTURE_MAG_FILTER, glow::NEAREST as i32); + // #[cfg(not(target_os = "macos"))] + // unsafe { + // let texture = gl.create_named_texture(glow::TEXTURE_1D).unwrap(); + // gl.texture_parameter_i32(texture, glow::TEXTURE_MIN_FILTER, glow::NEAREST as i32); + // gl.texture_parameter_i32(texture, glow::TEXTURE_MAG_FILTER, glow::NEAREST as i32); - // gl.tex_storage_1d(texture, 0, glow::RGBA, self.colors.len() as i32) + // // gl.tex_storage_1d(texture, 0, glow::RGBA, self.colors.len() as i32) - todo!("implement this"); - } + // // todo!("implement this"); + // } Ok(()) } diff --git a/gi/src/graphics/geoquadmesh.rs b/gi/src/graphics/geoquadmesh.rs index 42b90f3..7296c35 100644 --- a/gi/src/graphics/geoquadmesh.rs +++ b/gi/src/graphics/geoquadmesh.rs @@ -376,7 +376,7 @@ impl AttaWithBuffer for GeoQuadMesh { } } - #[cfg(target_os = "macos")] + // #[cfg(target_os = "macos")] fn init( &self, gl: &glow::Context, @@ -433,64 +433,64 @@ impl AttaWithBuffer for GeoQuadMesh { } } - #[cfg(not(target_os = "macos"))] - fn init( - &self, - gl: &glow::Context, - ) -> ( - glow::NativeVertexArray, - glow::NativeBuffer, - Option, - Option, - ) { - unsafe { - let vao = gl.create_vertex_array().unwrap(); - let vbo = gl.create_buffer().unwrap(); + // #[cfg(not(target_os = "macos"))] + // fn init( + // &self, + // gl: &glow::Context, + // ) -> ( + // glow::NativeVertexArray, + // glow::NativeBuffer, + // Option, + // Option, + // ) { + // unsafe { + // let vao = gl.create_vertex_array().unwrap(); + // let vbo = gl.create_buffer().unwrap(); - gl.vertex_array_vertex_buffer(vao, 0, Some(vbo), 0, 24); + // gl.vertex_array_vertex_buffer(vao, 0, Some(vbo), 0, 24); - gl.enable_vertex_array_attrib(vao, 0); - gl.vertex_array_attrib_format_i32(vao, 0, 3, glow::FLOAT, 0); - gl.enable_vertex_array_attrib(vao, 1); - gl.vertex_array_attrib_format_i32(vao, 1, 3, glow::FLOAT, 12); + // gl.enable_vertex_array_attrib(vao, 0); + // gl.vertex_array_attrib_format_i32(vao, 0, 3, glow::FLOAT, 0); + // gl.enable_vertex_array_attrib(vao, 1); + // gl.vertex_array_attrib_format_i32(vao, 1, 3, glow::FLOAT, 12); - gl.vertex_array_attrib_binding_f32(vao, 0, 0); - gl.vertex_array_attrib_binding_f32(vao, 1, 0); + // gl.vertex_array_attrib_binding_f32(vao, 0, 0); + // gl.vertex_array_attrib_binding_f32(vao, 1, 0); - // Create Texture - let texture = gl.create_texture().unwrap(); - gl.bind_texture(glow::TEXTURE_3D, Some(texture)); + // // Create Texture + // let texture = gl.create_texture().unwrap(); + // gl.bind_texture(glow::TEXTURE_3D, Some(texture)); - gl.tex_parameter_i32( - glow::TEXTURE_3D, - glow::TEXTURE_MIN_FILTER, - glow::NEAREST as i32, - ); - gl.tex_parameter_i32( - glow::TEXTURE_3D, - glow::TEXTURE_MAG_FILTER, - glow::NEAREST as i32, - ); - gl.tex_parameter_i32( - glow::TEXTURE_3D, - glow::TEXTURE_WRAP_S, - glow::CLAMP_TO_EDGE as i32, - ); - gl.tex_parameter_i32( - glow::TEXTURE_3D, - glow::TEXTURE_WRAP_T, - glow::CLAMP_TO_EDGE as i32, - ); - gl.tex_parameter_i32( - glow::TEXTURE_3D, - glow::TEXTURE_WRAP_R, - glow::CLAMP_TO_EDGE as i32, - ); + // gl.tex_parameter_i32( + // glow::TEXTURE_3D, + // glow::TEXTURE_MIN_FILTER, + // glow::NEAREST as i32, + // ); + // gl.tex_parameter_i32( + // glow::TEXTURE_3D, + // glow::TEXTURE_MAG_FILTER, + // glow::NEAREST as i32, + // ); + // gl.tex_parameter_i32( + // glow::TEXTURE_3D, + // glow::TEXTURE_WRAP_S, + // glow::CLAMP_TO_EDGE as i32, + // ); + // gl.tex_parameter_i32( + // glow::TEXTURE_3D, + // glow::TEXTURE_WRAP_T, + // glow::CLAMP_TO_EDGE as i32, + // ); + // gl.tex_parameter_i32( + // glow::TEXTURE_3D, + // glow::TEXTURE_WRAP_R, + // glow::CLAMP_TO_EDGE as i32, + // ); - (vao, vbo, None, Some(texture)) - } - } + // (vao, vbo, None, Some(texture)) + // } + // } } fn mercator_project(loc: [f32; 2]) -> [f32; 2] { diff --git a/gi/src/pg/modules/geoquadmesh.rs b/gi/src/pg/modules/geoquadmesh.rs index de93bd5..252e2f2 100644 --- a/gi/src/pg/modules/geoquadmesh.rs +++ b/gi/src/pg/modules/geoquadmesh.rs @@ -143,7 +143,7 @@ impl<'b, 'a: 'b> Module for GeoQuadMeshModule<'b, 'a> { quad_attach.bind_self(&self.gl, self.geo_quad_mesh_program.program_ref()); // Bind the texture - #[cfg(target_os = "macos")] + // #[cfg(target_os = "macos")] self.bind_attach_tex(quad_attach)?; // Draw the quad diff --git a/gi/src/pg/modules/mod.rs b/gi/src/pg/modules/mod.rs index d530aee..53e660f 100644 --- a/gi/src/pg/modules/mod.rs +++ b/gi/src/pg/modules/mod.rs @@ -78,7 +78,7 @@ impl Attach { } pub fn bind_self(&self, gl: &glow::Context, program: &Program) { - #[cfg(target_os = "macos")] + // #[cfg(target_os = "macos")] { self.vao.bind(gl, glow::VERTEX_ARRAY); self.vbo.bind(gl, glow::ARRAY_BUFFER); @@ -86,10 +86,10 @@ impl Attach { ebo.bind(gl, glow::ELEMENT_ARRAY_BUFFER); } } - #[cfg(not(target_os = "macos"))] - unsafe { - gl.bind_vertex_array(Some(self.vao.native())); - } + // #[cfg(not(target_os = "macos"))] + // unsafe { + // gl.bind_vertex_array(Some(self.vao.native())); + // } } fn unbind_self(&self) { @@ -109,7 +109,7 @@ impl Attach { usage: u32, ) { use bytemuck::cast_slice; - #[cfg(target_os = "macos")] + // #[cfg(target_os = "macos")] { self.vbo.bind(gl, glow::ARRAY_BUFFER); unsafe { @@ -127,19 +127,19 @@ impl Attach { self.vbo.unbind(glow::ARRAY_BUFFER); } - #[cfg(not(target_os = "macos"))] - { - unsafe { - gl.named_buffer_data_u8_slice(self.vbo.native(), cast_slice(&vbo), usage); - if let Some(ebo) = ebo { - gl.named_buffer_data_u8_slice( - self.ebo.as_ref().unwrap().native(), - cast_slice(ebo), - usage, - ); - } - } - } + // #[cfg(not(target_os = "macos"))] + // { + // unsafe { + // gl.named_buffer_data_u8_slice(self.vbo.native(), cast_slice(&vbo), usage); + // if let Some(ebo) = ebo { + // gl.named_buffer_data_u8_slice( + // self.ebo.as_ref().unwrap().native(), + // cast_slice(ebo), + // usage, + // ); + // } + // } + // } self.len = len; } diff --git a/radar-g/Cargo.toml b/radar-g/Cargo.toml index 0c7799b..5c9e583 100644 --- a/radar-g/Cargo.toml +++ b/radar-g/Cargo.toml @@ -71,6 +71,7 @@ url = "2.5.0" quick_cache = "0.4.1" fns = "0.0.7" enum_dispatch = "0.3.12" +glium = "0.35.0" [build-dependencies] diff --git a/radar-g/src/widgets/render/imp.rs b/radar-g/src/widgets/render/imp.rs index 0d14eae..618ba1a 100644 --- a/radar-g/src/widgets/render/imp.rs +++ b/radar-g/src/widgets/render/imp.rs @@ -1,5 +1,4 @@ use crate::SETTING; - use super::exterior::ExteriorWidget; use super::interior::InteriorWidget; use super::{Layer, WindowCoord}; @@ -125,6 +124,14 @@ impl ObjectImpl for Render { impl WidgetImpl for Render { fn realize(&self) { self.parent_realize(); + let widget = self.obj(); + + let context = unsafe { + glium::backend::Context::new(widget.clone(),true, Default::default()) + }.unwrap(); + + + } fn unrealize(&self) { @@ -244,7 +251,7 @@ impl Render { let init_module = gi.program().terrain().load_data(&(), &SETTING).unwrap(); // let init_module = gi.program().earth().load_data(&(), &SETTING).unwrap(); // Init Modules - gi.set_init_modules(init_module); + // gi.set_init_modules(init_module); // Set Modules self.viewport.replace(Some(viewport)); diff --git a/radar-g/src/widgets/render/mod.rs b/radar-g/src/widgets/render/mod.rs index e552f1e..690e52e 100644 --- a/radar-g/src/widgets/render/mod.rs +++ b/radar-g/src/widgets/render/mod.rs @@ -198,3 +198,39 @@ impl Render { self.queue_render(); } } + + +unsafe impl glium::backend::Backend for Render { + fn swap_buffers(&self) -> Result<(), glium::SwapBuffersError> { + // We're supposed to draw (and hence swap buffers) only inside the `render()` + // vfunc or signal, which means that GLArea will handle buffer swaps for + // us. + Ok(()) + } + + unsafe fn get_proc_address(&self, symbol: &str) -> *const std::ffi::c_void { + epoxy::get_proc_addr(symbol) + } + + fn get_framebuffer_dimensions(&self) -> (u32, u32) { + let scale = self.scale_factor(); + let width = self.width(); + let height = self.height(); + ((width * scale) as u32, (height * scale) as u32) + } + + fn is_current(&self) -> bool { + match self.context() { + Some(context) => gtk::gdk::GLContext::current() == Some(context), + None => false, + } + } + + unsafe fn make_current(&self) { + GLAreaExt::make_current(self); + } + + fn resize(&self, size: (u32, u32)) { + self.set_size_request(size.0 as i32, size.1 as i32); + } +}