From d1bfb7702d6b110c8007183b31dd91fa31ed987b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Stefa=C5=84ski?= Date: Sat, 23 May 2026 20:44:49 +0200 Subject: [PATCH] plotter WIP --- Cargo.lock | 748 +++++++++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- libsvld/src/lib.rs | 4 +- libsvld/src/motec.rs | 2 +- svldplotter/Cargo.toml | 17 + svldplotter/src/main.rs | 129 +++++++ 6 files changed, 857 insertions(+), 45 deletions(-) create mode 100644 svldplotter/Cargo.toml create mode 100644 svldplotter/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 1c06099..ce9b028 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,26 +24,69 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eca13c82f9a5cd813120b2e9b6a5d10532c6e4cd140c295cebd1f770095c8a5" +[[package]] +name = "accesskit" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5351dcebb14b579ccab05f288596b2ae097005be7ee50a7c3d4ca9d0d5a66f6a" +dependencies = [ + "uuid", +] + [[package]] name = "accesskit_atspi_common" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eb9cc46b7fb6987c4f891f0301b230b29d9e69b4854f060a0cf41fbc407ab77" dependencies = [ - "accesskit", - "accesskit_consumer", + "accesskit 0.22.0", + "accesskit_consumer 0.32.0", "atspi-common", "serde", "zvariant", ] +[[package]] +name = "accesskit_atspi_common" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e8c61bee90b42a772d39d06a740207dc71a4e780004ace1db8d99fb1baaa954" +dependencies = [ + "accesskit 0.24.0", + "accesskit_consumer 0.36.0", + "atspi-common", + "phf", + "serde", + "zvariant", +] + [[package]] name = "accesskit_consumer" version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69d880a613f29621c90e801feec40f5dd61d837d7e20bf9b67676d45e7364a36" dependencies = [ - "accesskit", + "accesskit 0.22.0", + "hashbrown 0.16.1", +] + +[[package]] +name = "accesskit_consumer" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53cf47daed85312e763fbf85ceca136e0d7abc68e0a7e12abe11f48172bc3b10" +dependencies = [ + "accesskit 0.24.0", + "hashbrown 0.16.1", +] + +[[package]] +name = "accesskit_consumer" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e0d7e25d06f4dc21d1774d67146e9e80d6789216cbd4d1e88185b0095dba60" +dependencies = [ + "accesskit 0.24.0", "hashbrown 0.16.1", ] @@ -53,8 +96,22 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b0ddfc3fe3d457d11cc1c4989105986a03583a1d54d0c25053118944b62e100" dependencies = [ - "accesskit", - "accesskit_consumer", + "accesskit 0.22.0", + "accesskit_consumer 0.32.0", + "hashbrown 0.16.1", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "accesskit_macos" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c5c87e8d94f2ec10cce590aadff24c76f576dab5502d45d0aed9fc3065d4451" +dependencies = [ + "accesskit 0.24.0", + "accesskit_consumer 0.36.0", "hashbrown 0.16.1", "objc2 0.5.2", "objc2-app-kit 0.2.2", @@ -67,8 +124,26 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5d552169ef018149966ed139bb0311c6947b3343e9140d1b9f88d69da9528fd" dependencies = [ - "accesskit", - "accesskit_atspi_common", + "accesskit 0.22.0", + "accesskit_atspi_common 0.15.0", + "async-channel", + "async-executor", + "async-task", + "atspi", + "futures-lite", + "futures-util", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_unix" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b016ca8db0ea0ea2ceff29a9d6240391492d960716aa471967c00e8cc8cb197c" +dependencies = [ + "accesskit 0.24.0", + "accesskit_atspi_common 0.18.1", "async-channel", "async-executor", "async-task", @@ -85,24 +160,52 @@ version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d277279d0a3b0c0021dd110b55aa1fe326b09ee2cbc338df28f847c7daf94e25" dependencies = [ - "accesskit", - "accesskit_consumer", + "accesskit 0.22.0", + "accesskit_consumer 0.32.0", "hashbrown 0.16.1", "static_assertions", "windows 0.61.3", "windows-core 0.61.2", ] +[[package]] +name = "accesskit_windows" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff7009f1a532e917d66970a1e80c965140c6cfbbabbdde3d64e5431e6c78e21" +dependencies = [ + "accesskit 0.24.0", + "accesskit_consumer 0.35.0", + "hashbrown 0.16.1", + "static_assertions", + "windows 0.62.2", + "windows-core 0.62.2", +] + [[package]] name = "accesskit_winit" version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db08dff285306264a1de127ea07bb9e7a1ed71bd8593c168d0731caa782516c9" dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", + "accesskit 0.22.0", + "accesskit_macos 0.23.0", + "accesskit_unix 0.18.0", + "accesskit_windows 0.30.0", + "raw-window-handle", + "winit", +] + +[[package]] +name = "accesskit_winit" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe9a94394896352cc4660ca2288bd4ef883d83238853c038b44070c8f134313" +dependencies = [ + "accesskit 0.24.0", + "accesskit_macos 0.26.1", + "accesskit_unix 0.21.1", + "accesskit_windows 0.32.1", "raw-window-handle", "winit", ] @@ -222,6 +325,26 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +[[package]] +name = "arboard" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.60.2", + "x11rb", +] + [[package]] name = "arg_enum_proc_macro" version = "0.3.4" @@ -556,7 +679,16 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ - "bit-vec", + "bit-vec 0.8.0", +] + +[[package]] +name = "bit-set" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd" +dependencies = [ + "bit-vec 0.9.1", ] [[package]] @@ -565,6 +697,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + [[package]] name = "bit_field" version = "0.10.3" @@ -888,6 +1026,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + [[package]] name = "color_quant" version = "1.1.0" @@ -1283,12 +1441,155 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edf234dd1594d6dd434a8fb8cada51ddbbc593e40e4a01556a0b31c62da2775b" +[[package]] +name = "ecolor" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55f6cc0cb3b84a21232c468db972ebcddd34decbf1ff02cdebffd807c13bbd81" +dependencies = [ + "bytemuck", + "emath", +] + +[[package]] +name = "eframe" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea3080bfd001aee2223dcb2228d9de7d31f41d7cfb99e8cd70df3ae8083a42f" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-wgpu", + "egui-winit", + "egui_glow", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "pollster", + "profiling", + "raw-window-handle", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "wgpu 29.0.3", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbe28ac1a9c0761319aafb9ad37737720cc49d99c13a4a6b990768fa01ffe67" +dependencies = [ + "accesskit 0.24.0", + "ahash", + "bitflags 2.11.1", + "emath", + "epaint", + "log", + "nohash-hasher", + "profiling", + "smallvec", + "unicode-segmentation", +] + +[[package]] +name = "egui-wgpu" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f311c0b9cdd8a38821ae6f245fbe6e1a3d7d157c77b7d22344f205b317232c8" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "epaint", + "log", + "profiling", + "thiserror 2.0.18", + "type-map", + "web-time", + "wgpu 29.0.3", + "winit", +] + +[[package]] +name = "egui-winit" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e97625c2fe0fadc8b92ec690fbf515e15e2efd67ca50e063ad3302ec8ee626" +dependencies = [ + "accesskit_winit 0.32.2", + "arboard", + "bytemuck", + "egui", + "log", + "objc2 0.6.4", + "objc2-foundation 0.3.2", + "objc2-ui-kit 0.3.2", + "profiling", + "raw-window-handle", + "smithay-clipboard", + "web-time", + "webbrowser", + "winit", +] + +[[package]] +name = "egui_glow" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6caa4eca47cc2358e2c5ae60843a94118e338f87099c6af4170e6e968e8d77cb" +dependencies = [ + "bytemuck", + "egui", + "glow 0.17.0", + "log", + "memoffset", + "profiling", + "wasm-bindgen", + "web-sys", + "winit", +] + +[[package]] +name = "egui_plot" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bd66213736bf9a9a53dc4888570b9194fc0db906507517a7fcc787e888ac47" +dependencies = [ + "ahash", + "egui", + "emath", +] + [[package]] name = "either" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" +[[package]] +name = "emath" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a74fbbf7501c430b89df62d102b6bfa02162faaf3e155512c677c9d20f5708d1" +dependencies = [ + "bytemuck", +] + [[package]] name = "encoding_rs" version = "0.8.35" @@ -1325,6 +1626,34 @@ dependencies = [ "syn", ] +[[package]] +name = "epaint" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92b452e348c2758115288802ca25f86ee286ce2cfae6643711ce116662311310" +dependencies = [ + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "font-types", + "log", + "nohash-hasher", + "parking_lot", + "profiling", + "self_cell", + "skrifa", + "smallvec", + "vello_cpu", +] + +[[package]] +name = "epaint_default_fonts" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1644e25dbe3d663fd9c2a4181772c64b23361e377e550c10422ecc3a7de1c3c2" + [[package]] name = "equator" version = "0.4.2" @@ -1433,6 +1762,15 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "fearless_simd" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb2907d1f08b2b316b9223ced5b0e89d87028ba8deae9764741dba8ff7f3903" +dependencies = [ + "bytemuck", +] + [[package]] name = "femtovg" version = "0.23.2" @@ -1451,7 +1789,7 @@ dependencies = [ "swash", "wasm-bindgen", "web-sys", - "wgpu", + "wgpu 28.0.0", ] [[package]] @@ -2051,8 +2389,8 @@ version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4df6ec88d452e3c22e418d20c96bc1ccbc9509e81e6596426d3388bf226a5f9" dependencies = [ - "accesskit", - "accesskit_winit", + "accesskit 0.22.0", + "accesskit_winit 0.30.0", "block2 0.6.2", "bytemuck", "cfg-if", @@ -2184,7 +2522,7 @@ dependencies = [ "wasm-bindgen", "web-sys", "web-time", - "wgpu", + "wgpu 28.0.0", ] [[package]] @@ -2218,7 +2556,7 @@ dependencies = [ "rgb", "wasm-bindgen", "web-sys", - "wgpu", + "wgpu 28.0.0", ] [[package]] @@ -2258,7 +2596,7 @@ dependencies = [ "spin_on", "unicode-segmentation", "vtable", - "wgpu", + "wgpu 28.0.0", "windows 0.62.2", "windows-core 0.62.2", "write-fonts", @@ -3079,11 +3417,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135" dependencies = [ "arrayvec", - "bit-set", + "bit-set 0.8.0", "bitflags 2.11.1", "cfg-if", "cfg_aliases", - "codespan-reporting", + "codespan-reporting 0.12.0", "half", "hashbrown 0.16.1", "hexf-parse", @@ -3093,7 +3431,33 @@ dependencies = [ "num-traits", "once_cell", "rustc-hash 1.1.0", - "spirv", + "spirv 0.3.0+sdk-1.3.268.0", + "thiserror 2.0.18", + "unicode-ident", +] + +[[package]] +name = "naga" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd91265cc2454558f659b3b4b9640f0ddb8cc6521277f166b8a8c181c898079" +dependencies = [ + "arrayvec", + "bit-set 0.9.1", + "bitflags 2.11.1", + "cfg-if", + "cfg_aliases", + "codespan-reporting 0.13.1", + "half", + "hashbrown 0.16.1", + "hexf-parse", + "indexmap", + "libm", + "log", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv 0.4.0+sdk-1.4.341.0", "thiserror 2.0.18", "unicode-ident", ] @@ -3161,6 +3525,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "nom" version = "7.1.3" @@ -3544,6 +3914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" dependencies = [ "bitflags 2.11.1", + "block2 0.6.2", "objc2 0.6.4", "objc2-foundation 0.3.2", ] @@ -3775,6 +4146,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + [[package]] name = "percent-encoding" version = "2.3.2" @@ -3824,6 +4208,49 @@ dependencies = [ "sha2", ] +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + [[package]] name = "pico-args" version = "0.5.0" @@ -4519,6 +4946,12 @@ dependencies = [ "tiny-skia 0.11.4", ] +[[package]] +name = "self_cell" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89" + [[package]] name = "semver" version = "1.0.28" @@ -4918,6 +5351,15 @@ dependencies = [ "bitflags 2.11.1", ] +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.11.1", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -4990,6 +5432,17 @@ dependencies = [ "slint-build", ] +[[package]] +name = "svldplotter" +version = "0.1.0" +dependencies = [ + "can-dbc", + "eframe", + "egui", + "egui_plot", + "libsvld", +] + [[package]] name = "swash" version = "0.2.7" @@ -5338,6 +5791,15 @@ dependencies = [ "core_maths", ] +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.2", +] + [[package]] name = "typed-index-collections" version = "3.5.0" @@ -5529,6 +5991,32 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vello_common" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd1a4c633ce09e7d713df1a6e036644a125e15e0c169cfb5180ddf5836ca04b" +dependencies = [ + "bytemuck", + "fearless_simd", + "hashbrown 0.16.1", + "log", + "peniko", + "skrifa", + "smallvec", +] + +[[package]] +name = "vello_cpu" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162bfe48aabf6a9fdcd401b628c7d9f260c2cbabb343c70a65feba6f7849edc" +dependencies = [ + "bytemuck", + "hashbrown 0.16.1", + "vello_common", +] + [[package]] name = "version_check" version = "0.9.5" @@ -5876,7 +6364,7 @@ dependencies = [ "hashbrown 0.16.1", "js-sys", "log", - "naga", + "naga 28.0.0", "parking_lot", "portable-atomic", "profiling", @@ -5886,9 +6374,39 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", + "wgpu-core 28.0.1", + "wgpu-hal 28.0.1", + "wgpu-types 28.0.0", +] + +[[package]] +name = "wgpu" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb3feacc458f7bee8bc1737149b42b6c731aa461039a4264a67bb6681646b250" +dependencies = [ + "arrayvec", + "bitflags 2.11.1", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "js-sys", + "log", + "naga 29.0.3", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 29.0.3", + "wgpu-hal 29.0.3", + "wgpu-types 29.0.3", ] [[package]] @@ -5898,8 +6416,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d23f4642f53f666adcfd2d3218ab174d1e6681101aef18696b90cbe64d1c10f9" dependencies = [ "arrayvec", - "bit-set", - "bit-vec", + "bit-set 0.8.0", + "bit-vec 0.8.0", "bitflags 2.11.1", "bytemuck", "cfg_aliases", @@ -5907,7 +6425,7 @@ dependencies = [ "hashbrown 0.16.1", "indexmap", "log", - "naga", + "naga 28.0.0", "once_cell", "parking_lot", "portable-atomic", @@ -5916,11 +6434,45 @@ dependencies = [ "rustc-hash 1.1.0", "smallvec", "thiserror 2.0.18", - "wgpu-core-deps-apple", - "wgpu-core-deps-emscripten", - "wgpu-core-deps-windows-linux-android", - "wgpu-hal", - "wgpu-types", + "wgpu-core-deps-apple 28.0.0", + "wgpu-core-deps-emscripten 28.0.0", + "wgpu-core-deps-windows-linux-android 28.0.0", + "wgpu-hal 28.0.1", + "wgpu-types 28.0.0", +] + +[[package]] +name = "wgpu-core" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02da3ad1b568337f25513b317870960ef87073ea0945502e44b864b67a8c77b7" +dependencies = [ + "arrayvec", + "bit-set 0.9.1", + "bit-vec 0.9.1", + "bitflags 2.11.1", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "indexmap", + "log", + "naga 29.0.3", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.18", + "wgpu-core-deps-apple 29.0.3", + "wgpu-core-deps-emscripten 29.0.3", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows-linux-android 29.0.3", + "wgpu-hal 29.0.3", + "wgpu-naga-bridge", + "wgpu-types 29.0.3", ] [[package]] @@ -5929,7 +6481,16 @@ version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87b7b696b918f337c486bf93142454080a32a37832ba8a31e4f48221890047da" dependencies = [ - "wgpu-hal", + "wgpu-hal 28.0.1", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e51b5447e144b3dbba4feb01f80f4fa21696fa0cd99afb2c3df1affd6fdb28" +dependencies = [ + "wgpu-hal 29.0.3", ] [[package]] @@ -5938,7 +6499,25 @@ version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34b251c331f84feac147de3c4aa3aa45112622a95dd7ee1b74384fa0458dbd79" dependencies = [ - "wgpu-hal", + "wgpu-hal 28.0.1", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3487cd6293a963bc5c0c0396f6a2192043c50003c07f4efdccbad3d90ec9d819" +dependencies = [ + "wgpu-hal 29.0.3", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2f2fb042f36920771deb0b966543c5751b18f3d327760ffc90f74e20b2dcd4" +dependencies = [ + "wgpu-hal 29.0.3", ] [[package]] @@ -5947,7 +6526,16 @@ version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ca976e72b2c9964eb243e281f6ce7f14a514e409920920dcda12ae40febaae" dependencies = [ - "wgpu-hal", + "wgpu-hal 28.0.1", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb01076d0aa08b0ba9bd741e178b5cc440f5abe99d9581323a4c8b5d1a1916" +dependencies = [ + "wgpu-hal 29.0.3", ] [[package]] @@ -5959,7 +6547,7 @@ dependencies = [ "android_system_properties", "arrayvec", "ash", - "bit-set", + "bit-set 0.8.0", "bitflags 2.11.1", "block", "bytemuck", @@ -5977,7 +6565,7 @@ dependencies = [ "libloading", "log", "metal 0.33.0", - "naga", + "naga 28.0.0", "ndk-sys", "objc", "once_cell", @@ -5993,11 +6581,75 @@ dependencies = [ "thiserror 2.0.18", "wasm-bindgen", "web-sys", - "wgpu-types", + "wgpu-types 28.0.0", "windows 0.62.2", "windows-core 0.62.2", ] +[[package]] +name = "wgpu-hal" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f8e1a9e7a8512f276f7c62e018c7fa8d60954303fed2e5750114332049193f" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set 0.9.1", + "bitflags 2.11.1", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow 0.17.0", + "glutin_wgl_sys", + "gpu-allocator", + "gpu-descriptor", + "hashbrown 0.16.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga 29.0.3", + "ndk-sys", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "thiserror 2.0.18", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge", + "wgpu-types 29.0.3", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-result 0.4.1", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c654c483f058800972c3645e95388a7eca31bf9fe1933bc20e036588a0be02" +dependencies = [ + "naga 29.0.3", + "wgpu-types 29.0.3", +] + [[package]] name = "wgpu-types" version = "28.0.0" @@ -6011,6 +6663,20 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wgpu-types" +version = "29.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9bcc31518a0e9735aefebedb5f7a9ef3ed1c42549c9f4c882fa9060ceaac639" +dependencies = [ + "bitflags 2.11.1", + "bytemuck", + "js-sys", + "log", + "raw-window-handle", + "web-sys", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index e8002e0..c61620e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ [workspace] resolver = "3" -members = ["libsvld", "svldcli", "svldgui"] +members = ["libsvld", "svldcli", "svldgui", "svldplotter"] [profile.release] lto = "fat" diff --git a/libsvld/src/lib.rs b/libsvld/src/lib.rs index 57bed30..98c3e56 100644 --- a/libsvld/src/lib.rs +++ b/libsvld/src/lib.rs @@ -1,6 +1,6 @@ -mod asc; +pub mod asc; pub mod can_frame; -mod motec; +pub mod motec; use std::{ fs::File, diff --git a/libsvld/src/motec.rs b/libsvld/src/motec.rs index fdd4197..a4c8e73 100644 --- a/libsvld/src/motec.rs +++ b/libsvld/src/motec.rs @@ -97,7 +97,7 @@ pub fn get_metadata_total_count( /// `bytes_le`). Mirrors `calc_bits` + `calc_signed_bits` + factor/offset in /// _ref_lib/src/process.cc. #[inline] -fn extract_signal(bytes_le: u64, sig: &Signal) -> f64 { +pub fn extract_signal(bytes_le: u64, sig: &Signal) -> f64 { let size = sig.size; let shifted = match sig.byte_order { ByteOrder::BigEndian => bytes_le.swap_bytes() >> (64 - size - sig.start_bit), diff --git a/svldplotter/Cargo.toml b/svldplotter/Cargo.toml new file mode 100644 index 0000000..3e723a5 --- /dev/null +++ b/svldplotter/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "svldplotter" +version = "0.1.0" +edition = "2024" + +[[bin]] +name = "svldplotter" +test = false +bench = false + +[dependencies] +libsvld = { path = "../libsvld" } +can-dbc = "9.1" + +eframe = "0.34" +egui = "0.34" +egui_plot = "0.35" diff --git a/svldplotter/src/main.rs b/svldplotter/src/main.rs new file mode 100644 index 0000000..dea6410 --- /dev/null +++ b/svldplotter/src/main.rs @@ -0,0 +1,129 @@ +use std::{fs, path::Path}; + +use can_dbc::Dbc; +use eframe::egui; +use egui::Vec2b; +use egui_plot::{Line, Plot, PlotPoint, PlotPoints}; +use libsvld::DecodeResult; + +fn main() { + let native_options = eframe::NativeOptions::default(); + eframe::run_native("My egui App", native_options, Box::new(|cc| Ok(Box::new(MyEguiApp::new(cc))))).unwrap(); +} + +struct MyEguiApp { + data: DecodeResult, + points: Vec, + buffer: Vec, +} + +impl MyEguiApp { + fn new(_cc: &eframe::CreationContext<'_>) -> Self { + let args: Vec::<_> = std::env::args().collect(); + + let data = + fs::read_to_string(Path::new(&args[1])).expect("Unable to read input file"); + let dbc = Dbc::try_from(data.as_str()).expect("Failed to parse dbc file"); + + let asc_path = Path::new(&args[2]); + + let data = libsvld::decode(&dbc, asc_path); + + let mut points = Vec::::new(); + let apps_sig = data + .metadata + .get(&48) + .unwrap() + .signals + .iter() + .find(|x| x.name == "AS_Torque_Vector") + .unwrap(); + for frame in data.data.get(&48).unwrap() { + let bytes = u64::from_le_bytes(frame.data); + points.push(PlotPoint { + x: frame.timestamp, + y: libsvld::motec::extract_signal(bytes, &apps_sig.signal) + }); + } + + Self { + data, + points, + buffer: Vec::new(), + } + } +} + +// Min/max bucketing: for each horizontal pixel column in [x_min, x_max], emit +// the min-y and max-y point so spikes survive decimation. Pushed in x order +// (min/max swapped if needed) to keep the line monotonically increasing in x. +fn decimate( + points: &[PlotPoint], + x_min: f64, + x_max: f64, + buckets: usize, + out: &mut Vec, +) { + out.clear(); + if points.is_empty() || buckets == 0 || !(x_max > x_min) { + return; + } + + let lo = points.partition_point(|p| p.x < x_min).saturating_sub(1); + let hi = (points.partition_point(|p| p.x <= x_max) + 1).min(points.len()); + let visible = &points[lo..hi]; + + if visible.len() <= buckets * 2 { + out.extend_from_slice(visible); + return; + } + + let bucket_w = (x_max - x_min) / buckets as f64; + let mut i = 0; + for b in 0..buckets { + let b_end = x_min + (b as f64 + 1.0) * bucket_w; + let start = i; + while i < visible.len() && visible[i].x < b_end { + i += 1; + } + if start == i { + continue; + } + let slice = &visible[start..i]; + let mut min_p = slice[0]; + let mut max_p = slice[0]; + for p in &slice[1..] { + if p.y < min_p.y { min_p = *p; } + if p.y > max_p.y { max_p = *p; } + } + if min_p.x <= max_p.x { + out.push(min_p); + out.push(max_p); + } else { + out.push(max_p); + out.push(min_p); + } + } +} + +impl eframe::App for MyEguiApp { + fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { + egui::CentralPanel::default().show_inside(ui, |ui| { + let full_min = self.points.first().map(|p| p.x).unwrap_or(0.0); + let full_max = self.points.last().map(|p| p.x).unwrap_or(1.0); + let plot = Plot::new("APPS") + .include_x(full_min) + .include_x(full_max) + .allow_zoom(Vec2b{x: true, y: false}); + plot.show(ui, |pui| { + let bounds = pui.plot_bounds(); + let x_min = bounds.min()[0]; + let x_max = bounds.max()[0]; + let px_w = pui.transform().frame().width() as usize; + decimate(&self.points, x_min, x_max, px_w.max(1), &mut self.buffer); + let ppoints = PlotPoints::Borrowed(&self.buffer); + pui.line(Line::new("AS_Torque_Vector", ppoints)); + }); + }); + } +}