From 74760df216d5374edbd1429c751b5457dfc94c85 Mon Sep 17 00:00:00 2001 From: sakikomikado Date: Wed, 28 Jan 2026 22:30:21 +0900 Subject: [PATCH 1/5] add verbose flag --- Cargo.toml | 1 + src/common.rs | 11 -------- src/lib.rs | 19 -------------- src/simplification/collapse.rs | 8 ++++-- src/simplification/dedup.rs | 5 +++- src/simplification/mod.rs | 2 +- src/simplification/re_swap.rs | 4 ++- src/tests.rs | 48 +++++++++++++++++----------------- 8 files changed, 39 insertions(+), 59 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 425f1f1..ac65921 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ bevy_panorbit_camera = { version = "0.26.0", optional = true } [features] default = [] +verbose = [] f32 = [] rayon = ["dep:rayon"] diff --git a/src/common.rs b/src/common.rs index e96b96b..fa81227 100644 --- a/src/common.rs +++ b/src/common.rs @@ -56,7 +56,6 @@ pub fn next_of(hid: usize) -> usize { let mut i = hid + 1; if i.is_multiple_of(3 #[derive(Clone, Debug, Copy)] pub struct Tref { - pub oid: usize, // original instance id, pub mid: usize, // mesh id pub fid: usize, // face id pub pid: i32, // planer id @@ -65,7 +64,6 @@ pub struct Tref { impl Default for Tref { fn default() -> Self { Self { - oid: usize::MAX, mid: usize::MAX, fid: usize::MAX, pid: -1 @@ -132,12 +130,3 @@ pub fn compute_orthogonal(n: Vec3) -> Vec3 { else { Vec3::new(0., 1., 0.) }; n.cross(b).normalize() } - -/* -enum CsgNodeType { Union, Intersection, Difference, Leaf } -trait CsgNode { fn ToLeafNode () { } } -struct CsgOpNode { } -struct CsgLeafNode { } -impl CsgNode for CsgOpNode { fn ToLeafNode () { } } -impl CsgNode for CsgLeafNode { } -*/ diff --git a/src/lib.rs b/src/lib.rs index 81af9c8..01502c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,25 +75,6 @@ pub fn compute_boolean( ) } -//pub fn compute_boolean_from_raw_data( -// pos0: &[Real], -// idx0: &[usize], -// pos1: &[Real], -// idx1: &[usize], -// op_type: usize -//) -> Result{ -// let mp = Manifold::new(&pos0, &idx0)?; -// let mq = Manifold::new(&pos1, &idx1)?; -// let op = match op_type { -// 0 => OpType::Add, -// 1 => OpType::Subtract, -// 2 => OpType::Intersect, -// _ => return Err("Invalid op_type".into()) -// }; -// compute_boolean(&mp, &mq, op) -//} - - diff --git a/src/simplification/collapse.rs b/src/simplification/collapse.rs index efcaaef..c2f3d02 100644 --- a/src/simplification/collapse.rs +++ b/src/simplification/collapse.rs @@ -148,7 +148,9 @@ pub fn collapse_collinear_edges( for hid in rec { if collapse_edge(hs, ps, ns, rs, hid, ep, &mut vec![]) { _flag += 1; } } - // if _flag > 0 { println!("{} collinear edge collapsed", _flag);} + + #[cfg(feature = "verbose")] + if _flag > 0 { println!("{} collinear edge collapsed", _flag);} } pub fn collapse_short_edges( @@ -168,6 +170,8 @@ pub fn collapse_short_edges( if collapse_edge(hs, ps, ns, rs, hid, ep, &mut vec![]) { flag += 1; } } if flag == 0 { break; } - //else { println!("{} short edges collapsed", flag);} + + #[cfg(feature = "verbose")] + println!("{} short edges collapsed", flag); } } \ No newline at end of file diff --git a/src/simplification/dedup.rs b/src/simplification/dedup.rs index 40a08b4..c0ffec7 100644 --- a/src/simplification/dedup.rs +++ b/src/simplification/dedup.rs @@ -158,7 +158,10 @@ pub fn dedupe_edges( dedupe_edge(ps, hs, ns, rs, hid); flag += 1; } + if flag == 0 { break; } - //else { println!("{} dedup", flag); } + + #[cfg(feature = "verbose")] + println!("{} dedup", flag); } } diff --git a/src/simplification/mod.rs b/src/simplification/mod.rs index 6602ae1..c49a2e8 100644 --- a/src/simplification/mod.rs +++ b/src/simplification/mod.rs @@ -7,7 +7,7 @@ pub mod collapse; use crate::{Real, Half, Tref, next_of, Vec2, Vec3}; use collapse::{collapse_edge, collapse_short_edges, collapse_collinear_edges}; use dedup::dedupe_edges; -use crate::simplification::re_swap::swap_degenerates; +use re_swap::swap_degenerates; pub fn simplify_topology( hs: &mut Vec, diff --git a/src/simplification/re_swap.rs b/src/simplification/re_swap.rs index 55b285e..7b090e6 100644 --- a/src/simplification/re_swap.rs +++ b/src/simplification/re_swap.rs @@ -160,6 +160,8 @@ pub fn swap_degenerates( recursive_edge_swap(hs, ps, ns, ts, last, &mut tag, &mut visit, &mut stack, &mut buff, tol); } } - //if _flag > 0 { println!("{} edge swapped", _flag);} + + #[cfg(feature = "verbose")] + if _flag > 0 { println!("{} edge swapped", _flag);} } diff --git a/src/tests.rs b/src/tests.rs index e4b7327..9c2b6cb 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -263,30 +263,30 @@ mod test_simplification { ]; let mut refs = vec![ - Tref{oid: 0, mid: 1, fid: 0, pid: 3}, - Tref{oid: 0, mid: 1, fid: 0, pid: 5}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 2}, - Tref{oid: 0, mid: 1, fid: 0, pid: 1}, - Tref{oid: 0, mid: 1, fid: 0, pid: 0}, - Tref{oid: 0, mid: 1, fid: 0, pid: 4}, - Tref{oid: 0, mid: 1, fid: 0, pid: 3}, - Tref{oid: 0, mid: 1, fid: 0, pid: 1}, - Tref{oid: 0, mid: 1, fid: 0, pid: 5}, - Tref{oid: 0, mid: 1, fid: 0, pid: 0}, - Tref{oid: 0, mid: 1, fid: 0, pid: 4}, - Tref{oid: 0, mid: 2, fid: 0, pid: 0}, - Tref{oid: 0, mid: 2, fid: 0, pid: 0}, - Tref{oid: 0, mid: 2, fid: 0, pid: 3}, - Tref{oid: 0, mid: 2, fid: 0, pid: 2}, - Tref{oid: 0, mid: 2, fid: 0, pid: 2}, + Tref{mid: 1, fid: 0, pid: 3, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 5, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 1, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 0, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 4, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 3, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 1, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 5, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 0, ..Tref::default()}, + Tref{mid: 1, fid: 0, pid: 4, ..Tref::default()}, + Tref{mid: 2, fid: 0, pid: 0, ..Tref::default()}, + Tref{mid: 2, fid: 0, pid: 0, ..Tref::default()}, + Tref{mid: 2, fid: 0, pid: 3, ..Tref::default()}, + Tref{mid: 2, fid: 0, pid: 2, ..Tref::default()}, + Tref{mid: 2, fid: 0, pid: 2, ..Tref::default()}, ]; collapse_collinear_edges( From 16a6627fcf2b53feced2947f7eaa8c0db827b989 Mon Sep 17 00:00:00 2001 From: sakikomikado Date: Thu, 29 Jan 2026 22:21:48 +0900 Subject: [PATCH 2/5] function on the 2-mfd wip --- Cargo.lock | 1526 ++++++++++++++++++++++---------- Cargo.toml | 4 +- examples/menger_sponge.rs | 6 +- examples/multiple_models.rs | 4 +- src/boolean03/kernel03.rs | 7 +- src/boolean03/kernel12.rs | 7 +- src/boolean03/mod.rs | 8 +- src/boolean45/mod.rs | 13 +- src/compose/cone.rs | 7 +- src/compose/cube.rs | 3 +- src/compose/cylinder.rs | 7 +- src/compose/mod.rs | 13 +- src/compose/sphere.rs | 11 +- src/compose/torus.rs | 4 +- src/lib.rs | 21 +- src/manifold/mod.rs | 58 +- src/simplification/collapse.rs | 7 +- src/tests.rs | 6 +- src/triangulation/mod.rs | 14 +- 19 files changed, 1171 insertions(+), 555 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97a17a8..c158d17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,28 +2,43 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + [[package]] name = "accesskit" -version = "0.18.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "becf0eb5215b6ecb0a739c31c21bd83c4f326524c9b46b7e882d77559b60a529" +checksum = "cf203f9d3bd8f29f98833d1fbef628df18f759248a547e7e01cfbf63cda36a99" [[package]] name = "accesskit_consumer" -version = "0.27.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0bf66a7bf0b7ea4fd7742d50b64782a88f99217cf246b3f93b4162528dde520" +checksum = "db81010a6895d8707f9072e6ce98070579b43b717193d2614014abd5cb17dd43" dependencies = [ "accesskit", "hashbrown 0.15.3", - "immutable-chunkmap", ] [[package]] name = "accesskit_macos" -version = "0.19.0" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e230718177753b4e4ad9e1d9f6cfc2f4921212d4c1c480b253f526babb258d" +checksum = "a0089e5c0ac0ca281e13ea374773898d9354cc28d15af9f0f7394d44a495b575" dependencies = [ "accesskit", "accesskit_consumer", @@ -35,24 +50,23 @@ dependencies = [ [[package]] name = "accesskit_windows" -version = "0.25.0" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65178f3df98a51e4238e584fcb255cb1a4f9111820848eeddd37663be40a625f" +checksum = "d2d63dd5041e49c363d83f5419a896ecb074d309c414036f616dc0b04faca971" dependencies = [ "accesskit", "accesskit_consumer", "hashbrown 0.15.3", - "paste", "static_assertions", - "windows 0.58.0", - "windows-core 0.58.0", + "windows 0.61.3", + "windows-core 0.61.2", ] [[package]] name = "accesskit_winit" -version = "0.25.0" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d941bb8c414caba6e206de669c7dc0dbeb305640ea890772ee422a40e6b89f" +checksum = "c8cfabe59d0eaca7412bfb1f70198dd31e3b0496fee7e15b066f9c36a1a140a0" dependencies = [ "accesskit", "accesskit_macos", @@ -74,7 +88,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.3.3", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -294,12 +308,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -308,18 +316,18 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bevy" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8369c16b7c017437021341521f8b4a0d98e1c70113fb358c3258ae7d661d79" +checksum = "ec689b5a79452b6f777b889bbff22d3216b82a8d2ab7814d4a0eb571e9938d97" dependencies = [ "bevy_internal", ] [[package]] name = "bevy_a11y" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3561712cf49074d89e9989bfc2e6c6add5d33288f689db9a0c333300d2d004" +checksum = "ef69b6d2dec07cbf407c63f6987e1746e4b735a9beea51f4bfc25ad49e344f75" dependencies = [ "accesskit", "bevy_app", @@ -328,29 +336,37 @@ dependencies = [ "bevy_reflect", ] +[[package]] +name = "bevy_android" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "008133458cfe0d43a8870bfc4c5a729467cc5d9246611462add38bcf45ed896f" +dependencies = [ + "android-activity", +] + [[package]] name = "bevy_animation" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49796627726d0b9a722ad9a0127719e7c1868f474d6575ec0f411e8299c4d7bb" +checksum = "13c852457843456c695ed22562969c83c3823454c3c40d359f92415371208ee7" dependencies = [ + "bevy_animation_macros", "bevy_app", "bevy_asset", "bevy_color", "bevy_derive", "bevy_ecs", - "bevy_log", "bevy_math", "bevy_mesh", "bevy_platform", "bevy_reflect", - "bevy_render", "bevy_time", "bevy_transform", "bevy_utils", "blake3", "derive_more", - "downcast-rs", + "downcast-rs 2.0.1", "either", "petgraph", "ron", @@ -362,11 +378,44 @@ dependencies = [ "uuid", ] +[[package]] +name = "bevy_animation_macros" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac120bfd5a74e05f96013817d28318dc716afaa68864af069c7ffc3ccaf9d153" +dependencies = [ + "bevy_macro_utils", + "quote", + "syn", +] + +[[package]] +name = "bevy_anti_alias" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418087f7c36a62c9886b55be6278e7b3d21c9943b107953aa2068000956a736" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_camera", + "bevy_core_pipeline", + "bevy_derive", + "bevy_diagnostic", + "bevy_ecs", + "bevy_image", + "bevy_math", + "bevy_reflect", + "bevy_render", + "bevy_shader", + "bevy_utils", + "tracing", +] + [[package]] name = "bevy_app" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4491cc4c718ae76b4c6883df58b94cc88b32dcd894ea8d5b603c7c7da72ca967" +checksum = "2271a0123a7cc355c3fe98754360c75aa84b29f2a6b1a9f8c00aac427570d174" dependencies = [ "bevy_derive", "bevy_ecs", @@ -377,7 +426,7 @@ dependencies = [ "cfg-if", "console_error_panic_hook", "ctrlc", - "downcast-rs", + "downcast-rs 2.0.1", "log", "thiserror 2.0.12", "variadics_please", @@ -387,33 +436,35 @@ dependencies = [ [[package]] name = "bevy_asset" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56111d9b88d8649f331a667d9d72163fb26bd09518ca16476d238653823db1e" +checksum = "b1f7361669d1426a3359cb92f890ef9c62bd6e6b67f0190d2c5279d25ce24168" dependencies = [ "async-broadcast", + "async-channel", "async-fs", "async-lock", "atomicow", + "bevy_android", "bevy_app", "bevy_asset_macros", + "bevy_diagnostic", "bevy_ecs", "bevy_platform", "bevy_reflect", "bevy_tasks", "bevy_utils", - "bevy_window", "bitflags 2.9.1", "blake3", "crossbeam-channel", "derive_more", "disqualified", - "downcast-rs", + "downcast-rs 2.0.1", "either", "futures-io", "futures-lite", + "futures-util", "js-sys", - "parking_lot", "ron", "serde", "stackfuture", @@ -427,9 +478,9 @@ dependencies = [ [[package]] name = "bevy_asset_macros" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4cca3e67c0ec760d8889d42293d987ce5da92eaf9c592bf5d503728a63b276d" +checksum = "288e1edf17069afe2e02a0c0e7e5936b3d22a67c7d2dc9201a27e4451875f909" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -439,27 +490,53 @@ dependencies = [ [[package]] name = "bevy_audio" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b4f6f2a5c6c0e7c6825e791d2a061c76c2d6784f114c8f24382163fabbfaaa" +checksum = "e3cbecfc6c5d3860f224f56d3152b14aa313168d35c16e847f5a0202a992c3af" dependencies = [ "bevy_app", "bevy_asset", - "bevy_derive", "bevy_ecs", "bevy_math", "bevy_reflect", "bevy_transform", + "coreaudio-sys", "cpal", "rodio", "tracing", ] +[[package]] +name = "bevy_camera" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c7e1f2a5da1755cd58e45c762f4ea2d72cef6c480f9c8ddbadbd2a4380c616" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_color", + "bevy_derive", + "bevy_ecs", + "bevy_image", + "bevy_math", + "bevy_mesh", + "bevy_reflect", + "bevy_transform", + "bevy_utils", + "bevy_window", + "derive_more", + "downcast-rs 2.0.1", + "serde", + "smallvec", + "thiserror 2.0.12", + "wgpu-types", +] + [[package]] name = "bevy_color" -version = "0.16.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c101cbe1e26b8d701eb77263b14346e2e0cbbd2a6e254b9b1aead814e5ca8d3" +checksum = "74727302424d7ffc23528a974dbb44a34708662926e1a3bfc5040493f858886e" dependencies = [ "bevy_math", "bevy_reflect", @@ -473,12 +550,13 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed46363cad80dc00f08254c3015232bd6f640738403961c6d63e7ecfc61625" +checksum = "a9e6bf0ba878bb5dd00ad4d70875b08eb11367829668c70d95785f5483ddb1cb" dependencies = [ "bevy_app", "bevy_asset", + "bevy_camera", "bevy_color", "bevy_derive", "bevy_diagnostic", @@ -488,14 +566,13 @@ dependencies = [ "bevy_platform", "bevy_reflect", "bevy_render", + "bevy_shader", "bevy_transform", "bevy_utils", "bevy_window", "bitflags 2.9.1", - "bytemuck", "nonmax", "radsort", - "serde", "smallvec", "thiserror 2.0.12", "tracing", @@ -503,27 +580,56 @@ dependencies = [ [[package]] name = "bevy_derive" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b837bf6c51806b10ebfa9edf1844ad80a3a0760d6c5fac4e90761df91a8901a" +checksum = "70b6a05c31f54c83d681f1b8699bbaf581f06b25a40c9a6bb815625f731f5ba9" dependencies = [ "bevy_macro_utils", "quote", "syn", ] +[[package]] +name = "bevy_dev_tools" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3183daa165acce210c50c170c47433c90b1d55932ead9734ebca14b7cd242c4" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_camera", + "bevy_color", + "bevy_diagnostic", + "bevy_ecs", + "bevy_image", + "bevy_input", + "bevy_math", + "bevy_picking", + "bevy_reflect", + "bevy_render", + "bevy_shader", + "bevy_state", + "bevy_text", + "bevy_time", + "bevy_transform", + "bevy_ui", + "bevy_ui_render", + "bevy_window", + "tracing", +] + [[package]] name = "bevy_diagnostic" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48797366f312a8f31e237d08ce3ee70162591282d2bfe7c5ad8be196fb263e55" +checksum = "aca4caa8a9014a435dca382b1bdebaee4363e9be69882c598fc4ff4d7cd56e6a" dependencies = [ + "atomic-waker", "bevy_app", "bevy_ecs", "bevy_platform", "bevy_tasks", "bevy_time", - "bevy_utils", "const-fnv1a-hash", "log", "serde", @@ -532,9 +638,9 @@ dependencies = [ [[package]] name = "bevy_ecs" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2bf6521aae57a0ec3487c4bfb59e36c4a378e834b626a4bea6a885af2fdfe7" +checksum = "24637a7c8643cab493f4085cda6bde4895f0e0816699c59006f18819da2ca0b8" dependencies = [ "arrayvec", "bevy_ecs_macros", @@ -547,12 +653,12 @@ dependencies = [ "bumpalo", "concurrent-queue", "derive_more", - "disqualified", "fixedbitset", "indexmap", "log", "nonmax", "serde", + "slotmap", "smallvec", "thiserror 2.0.12", "variadics_please", @@ -560,9 +666,9 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38748d6f3339175c582d751f410fb60a93baf2286c3deb7efebb0878dce7f413" +checksum = "6eb14c18ca71e11c69fbae873c2db129064efac6d52e48d0127d37bfba1acfa8" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -572,9 +678,9 @@ dependencies = [ [[package]] name = "bevy_encase_derive" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8148f4edee470a2ea5cad010184c492a4c94c36d7a7158ea28e134ea87f274ab" +checksum = "0f89146a8fcbfe47310fc929ee762dd3b08d4de3e3371c601529cfa8eeb861de" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -582,16 +688,15 @@ dependencies = [ [[package]] name = "bevy_gilrs" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97efef87c631949e67d06bb5d7dfd2a5f936b3b379afb6b1485b08edbb219b87" +checksum = "6c76417261ff3cd7ecda532b58514224aee06e76fbd87636c3a80695be7c8192" dependencies = [ "bevy_app", "bevy_ecs", "bevy_input", "bevy_platform", "bevy_time", - "bevy_utils", "gilrs", "thiserror 2.0.12", "tracing", @@ -599,55 +704,76 @@ dependencies = [ [[package]] name = "bevy_gizmos" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7823154a9682128c261d8bddb3a4d7192a188490075c527af04520c2f0f8aad6" +checksum = "bc78a5699580c2dce078f4c099028d26525a5a38e8eb587a31854c660a3c5ff7" dependencies = [ "bevy_app", "bevy_asset", + "bevy_camera", "bevy_color", - "bevy_core_pipeline", "bevy_ecs", "bevy_gizmos_macros", - "bevy_image", + "bevy_light", "bevy_math", - "bevy_pbr", "bevy_reflect", - "bevy_render", - "bevy_sprite", "bevy_time", "bevy_transform", "bevy_utils", - "bytemuck", - "tracing", ] [[package]] name = "bevy_gizmos_macros" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f378f3b513218ddc78254bbe76536d9de59c1429ebd0c14f5d8f2a25812131ad" +checksum = "60bb92e0ef80ff7c59429133244765515db3d313fae77ee67ffe94dab5b2725d" dependencies = [ "bevy_macro_utils", - "proc-macro2", "quote", "syn", ] +[[package]] +name = "bevy_gizmos_render" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fde3172a31f81033b4f497dd9df84476f527fadb00936ede380fb646c402eb" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_camera", + "bevy_core_pipeline", + "bevy_ecs", + "bevy_gizmos", + "bevy_image", + "bevy_math", + "bevy_mesh", + "bevy_pbr", + "bevy_render", + "bevy_shader", + "bevy_sprite_render", + "bevy_transform", + "bevy_utils", + "bytemuck", + "tracing", +] + [[package]] name = "bevy_gltf" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a080237c0b8842ccc15a06d3379302c68580eeea4497b1c7387e470eda1f07" +checksum = "08372f222676dba313061fc71128209b82f9711e7c5cba222b5c34bf1c5c70fe" dependencies = [ - "base64 0.22.1", + "async-lock", + "base64", "bevy_animation", "bevy_app", "bevy_asset", + "bevy_camera", "bevy_color", - "bevy_core_pipeline", "bevy_ecs", "bevy_image", + "bevy_light", "bevy_math", "bevy_mesh", "bevy_pbr", @@ -657,7 +783,6 @@ dependencies = [ "bevy_scene", "bevy_tasks", "bevy_transform", - "bevy_utils", "fixedbitset", "gltf", "itertools 0.14.0", @@ -671,13 +796,14 @@ dependencies = [ [[package]] name = "bevy_image" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e6e900cfecadbc3149953169e36b9e26f922ed8b002d62339d8a9dc6129328" +checksum = "809101ebe678a76c4c5ba3ecad255cde9be3ae0af591cf0143ba2c157afb55e9" dependencies = [ "bevy_app", "bevy_asset", "bevy_color", + "bevy_ecs", "bevy_math", "bevy_platform", "bevy_reflect", @@ -699,16 +825,15 @@ dependencies = [ [[package]] name = "bevy_input" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d6b6516433f6f7d680f648d04eb1866bb3927a1782d52f74831b62042f3cd1" +checksum = "9c2853993baf27b963a417d3603a73e02e39c5041913cd1ba7211b0a3037b191" dependencies = [ "bevy_app", "bevy_ecs", "bevy_math", "bevy_platform", "bevy_reflect", - "bevy_utils", "derive_more", "log", "smol_str", @@ -717,14 +842,15 @@ dependencies = [ [[package]] name = "bevy_input_focus" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2d079fda74d1416e0a57dac29ea2b79ff77f420cd6b87f833d3aa29a46bc4d" +checksum = "05fc0fae5e4e081180f7f7bf8023a2b97dad13dcb5fa79eba50cda5bb95699a9" dependencies = [ "bevy_app", "bevy_ecs", "bevy_input", "bevy_math", + "bevy_picking", "bevy_reflect", "bevy_window", "log", @@ -733,56 +859,89 @@ dependencies = [ [[package]] name = "bevy_internal" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "857da8785678fde537d02944cd20dec9cafb7d4c447efe15f898dc60e733cacd" +checksum = "57463815630ea71221c0b8e7bff72d816a3071a89507c45f9e2686fbb5e1956b" dependencies = [ "bevy_a11y", + "bevy_android", "bevy_animation", + "bevy_anti_alias", "bevy_app", "bevy_asset", "bevy_audio", + "bevy_camera", "bevy_color", "bevy_core_pipeline", "bevy_derive", + "bevy_dev_tools", "bevy_diagnostic", "bevy_ecs", "bevy_gilrs", "bevy_gizmos", + "bevy_gizmos_render", "bevy_gltf", "bevy_image", "bevy_input", "bevy_input_focus", + "bevy_light", "bevy_log", "bevy_math", + "bevy_mesh", "bevy_pbr", "bevy_picking", "bevy_platform", + "bevy_post_process", "bevy_ptr", "bevy_reflect", "bevy_render", "bevy_scene", + "bevy_shader", "bevy_sprite", + "bevy_sprite_render", "bevy_state", "bevy_tasks", "bevy_text", "bevy_time", "bevy_transform", "bevy_ui", + "bevy_ui_render", "bevy_utils", "bevy_window", "bevy_winit", ] +[[package]] +name = "bevy_light" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f9968b8f8a6a766a88b66144474c39d1415edc277d042fec1526eae85e1f8b4" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_camera", + "bevy_color", + "bevy_ecs", + "bevy_image", + "bevy_math", + "bevy_mesh", + "bevy_platform", + "bevy_reflect", + "bevy_transform", + "bevy_utils", + "tracing", +] + [[package]] name = "bevy_log" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a61ee8aef17a974f5ca481dcedf0c2bd52670e231d4c4bc9ddef58328865f9" +checksum = "406304a9b867a2de98c3edf0cc9e5a608fad1a1ddc567e15e72c186a8273ef51" dependencies = [ "android_log-sys", "bevy_app", "bevy_ecs", + "bevy_platform", "bevy_utils", "tracing", "tracing-log", @@ -793,43 +952,43 @@ dependencies = [ [[package]] name = "bevy_macro_utils" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052eeebcb8e7e072beea5031b227d9a290f8a7fbbb947573ab6ec81df0fb94be" +checksum = "0b7272fca0bf30d8ca2571a803598856104b63e5c596d52850f811ed37c5e1e3" dependencies = [ - "parking_lot", "proc-macro2", "quote", "syn", - "toml_edit", + "toml_edit 0.23.10+spec-1.0.0", ] [[package]] name = "bevy_math" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68553e0090fe9c3ba066c65629f636bd58e4ebd9444fdba097b91af6cd3e243f" +checksum = "6a815c514b8a6f7b11508cdc8b3a4bf0761e96a14227af40aa93cb1160989ce0" dependencies = [ "approx", + "arrayvec", "bevy_reflect", "derive_more", - "glam 0.29.3", + "glam", "itertools 0.14.0", "libm", "rand", "rand_distr", "serde", - "smallvec", "thiserror 2.0.12", "variadics_please", ] [[package]] name = "bevy_mesh" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b10399c7027001edbc0406d7d0198596b1f07206c1aae715274106ba5bdcac40" +checksum = "aacf09d0ffd1a15baf8d201c4a34b918912a506395c2817aa55ab3d3776c09f2" dependencies = [ + "bevy_app", "bevy_asset", "bevy_derive", "bevy_ecs", @@ -839,11 +998,10 @@ dependencies = [ "bevy_platform", "bevy_reflect", "bevy_transform", - "bevy_utils", "bitflags 2.9.1", "bytemuck", + "derive_more", "hexasphere", - "serde", "thiserror 2.0.12", "tracing", "wgpu-types", @@ -851,50 +1009,50 @@ dependencies = [ [[package]] name = "bevy_mikktspace" -version = "0.16.1" +version = "0.17.0-dev" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb60c753b968a2de0fd279b76a3d19517695e771edb4c23575c7f92156315de" -dependencies = [ - "glam 0.29.3", -] +checksum = "7ef8e4b7e61dfe7719bb03c884dc270cd46a82efb40f93e9933b990c5c190c59" [[package]] name = "bevy_panorbit_camera" -version = "0.26.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6e15e297754d0bcb7665620c390c4f05665d4ac4ac91b4b5d3c66b9fe1f0e6" +checksum = "ec2a3ef5147368953aecb485e6362ea0e23acbd3e4adb02e47058a8c16e9bfe5" dependencies = [ "bevy", ] [[package]] name = "bevy_pbr" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5e0b4eb871f364a0d217f70f6c41d7fdc6f9f931fa1abbf222180c03d0ae410" +checksum = "69cc361c65035f7e531b592d99bce95b6ab3f643cae2abe97dfa7681363159a6" dependencies = [ "bevy_app", "bevy_asset", + "bevy_camera", "bevy_color", "bevy_core_pipeline", "bevy_derive", "bevy_diagnostic", "bevy_ecs", "bevy_image", + "bevy_light", + "bevy_log", "bevy_math", + "bevy_mesh", "bevy_platform", "bevy_reflect", "bevy_render", + "bevy_shader", "bevy_transform", "bevy_utils", - "bevy_window", "bitflags 2.9.1", "bytemuck", "derive_more", "fixedbitset", "nonmax", "offset-allocator", - "radsort", "smallvec", "static_assertions", "thiserror 2.0.12", @@ -903,12 +1061,13 @@ dependencies = [ [[package]] name = "bevy_picking" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ed04757938655ed8094ea1efb533f99063a8b22abffc22010c694d291522850" +checksum = "e4d10bb2a776087e1d8a9b87e8deb091d25bcedbe6160c613df2dc5fe069c3c5" dependencies = [ "bevy_app", "bevy_asset", + "bevy_camera", "bevy_derive", "bevy_ecs", "bevy_input", @@ -916,10 +1075,8 @@ dependencies = [ "bevy_mesh", "bevy_platform", "bevy_reflect", - "bevy_render", "bevy_time", "bevy_transform", - "bevy_utils", "bevy_window", "crossbeam-channel", "tracing", @@ -928,33 +1085,65 @@ dependencies = [ [[package]] name = "bevy_platform" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7573dc824a1b08b4c93fdbe421c53e1e8188e9ca1dd74a414455fe571facb47" +checksum = "9b29ea749a8e85f98186ab662f607b885b97c804bb14cdb0cdf838164496d474" dependencies = [ - "cfg-if", "critical-section", - "foldhash", - "getrandom 0.2.16", - "hashbrown 0.15.3", + "foldhash 0.2.0", + "futures-channel", + "hashbrown 0.16.1", + "js-sys", "portable-atomic", "portable-atomic-util", "serde", "spin", + "wasm-bindgen", + "wasm-bindgen-futures", "web-time", ] +[[package]] +name = "bevy_post_process" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e1116cbc35637f267a29c7d2fe376e020f2b4402d6b525d328bae9c10460c7" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_camera", + "bevy_color", + "bevy_core_pipeline", + "bevy_derive", + "bevy_ecs", + "bevy_image", + "bevy_math", + "bevy_platform", + "bevy_reflect", + "bevy_render", + "bevy_shader", + "bevy_transform", + "bevy_utils", + "bevy_window", + "bitflags 2.9.1", + "nonmax", + "radsort", + "smallvec", + "thiserror 2.0.12", + "tracing", +] + [[package]] name = "bevy_ptr" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7370d0e46b60e071917711d0860721f5347bc958bf325975ae6913a5dfcf01" +checksum = "4f98cbc6d34bbdb58240b72ed1731931b4991a893b3a3238bb7c42ae054aa676" [[package]] name = "bevy_reflect" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daeb91a63a1a4df00aa58da8cc4ddbd4b9f16ab8bb647c5553eb156ce36fa8c2" +checksum = "2b2a977e2b8dba65b6e9c11039c5f9ef108be428f036b3d1cac13ad86ec59f9c" dependencies = [ "assert_type_match", "bevy_platform", @@ -963,10 +1152,12 @@ dependencies = [ "bevy_utils", "derive_more", "disqualified", - "downcast-rs", + "downcast-rs 2.0.1", "erased-serde", - "foldhash", - "glam 0.29.3", + "foldhash 0.2.0", + "glam", + "indexmap", + "inventory", "petgraph", "serde", "smallvec", @@ -979,11 +1170,12 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ddadc55fe16b45faaa54ab2f9cb00548013c74812e8b018aa172387103cce6" +checksum = "067af30072b1611fda1a577f1cb678b8ea2c9226133068be808dd49aac30cef0" dependencies = [ "bevy_macro_utils", + "indexmap", "proc-macro2", "quote", "syn", @@ -992,13 +1184,14 @@ dependencies = [ [[package]] name = "bevy_render" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef91fed1f09405769214b99ebe4390d69c1af5cdd27967deae9135c550eb1667" +checksum = "d6b2c9a276646bde8ba58a7e15711b459fb4a5cdf46c47059b7a310f97a70d9c" dependencies = [ "async-channel", "bevy_app", "bevy_asset", + "bevy_camera", "bevy_color", "bevy_derive", "bevy_diagnostic", @@ -1010,6 +1203,7 @@ dependencies = [ "bevy_platform", "bevy_reflect", "bevy_render_macros", + "bevy_shader", "bevy_tasks", "bevy_time", "bevy_transform", @@ -1017,22 +1211,18 @@ dependencies = [ "bevy_window", "bitflags 2.9.1", "bytemuck", - "codespan-reporting", "derive_more", - "downcast-rs", + "downcast-rs 2.0.1", "encase", "fixedbitset", - "futures-lite", + "glam", "image", "indexmap", "js-sys", - "ktx2", "naga", - "naga_oil", "nonmax", "offset-allocator", "send_wrapper", - "serde", "smallvec", "thiserror 2.0.12", "tracing", @@ -1044,9 +1234,9 @@ dependencies = [ [[package]] name = "bevy_render_macros" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abd42cf6c875bcf38da859f8e731e119a6aff190d41dd0a1b6000ad57cf2ed3d" +checksum = "03e16b8cac95b87021399ed19f6ab79c0b1e03101a448e3a0240934f78f66a56" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -1056,60 +1246,105 @@ dependencies = [ [[package]] name = "bevy_scene" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c52ca165200995fe8afd2a1a6c03e4ffee49198a1d4653d32240ea7f217d4ab" +checksum = "0046bb071ee358619f2fa9409ccced47375502b098b4107ec3385f3a1acf6600" dependencies = [ "bevy_app", "bevy_asset", + "bevy_camera", "bevy_derive", "bevy_ecs", "bevy_platform", "bevy_reflect", - "bevy_render", "bevy_transform", "bevy_utils", "derive_more", + "ron", "serde", "thiserror 2.0.12", "uuid", ] +[[package]] +name = "bevy_shader" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a14cb0991b2482a66b94728cbcf7482d1b74364be017197396435d3d542b8d3" +dependencies = [ + "bevy_asset", + "bevy_platform", + "bevy_reflect", + "naga", + "naga_oil", + "serde", + "thiserror 2.0.12", + "tracing", + "wgpu-types", +] + [[package]] name = "bevy_sprite" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ccae7bab2cb956fb0434004c359e432a3a1a074a6ef4eb471f1fb099f0b620b" +checksum = "b2b3921ce1a8ce801c29d9552cbc204548bfeb16b9b829045c9e82b5917d99cc" dependencies = [ "bevy_app", "bevy_asset", + "bevy_camera", "bevy_color", - "bevy_core_pipeline", "bevy_derive", "bevy_ecs", "bevy_image", "bevy_math", + "bevy_mesh", "bevy_picking", + "bevy_reflect", + "bevy_text", + "bevy_transform", + "bevy_window", + "radsort", + "tracing", + "wgpu-types", +] + +[[package]] +name = "bevy_sprite_render" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed40642fa0e1330df65b6a1bf0b14aa32fcd9d7f3306e08e0784c10362bd6265" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_camera", + "bevy_color", + "bevy_core_pipeline", + "bevy_derive", + "bevy_ecs", + "bevy_image", + "bevy_math", + "bevy_mesh", "bevy_platform", "bevy_reflect", "bevy_render", + "bevy_shader", + "bevy_sprite", + "bevy_text", "bevy_transform", "bevy_utils", - "bevy_window", "bitflags 2.9.1", "bytemuck", "derive_more", "fixedbitset", "nonmax", - "radsort", "tracing", ] [[package]] name = "bevy_state" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "155d3cd97b900539008cdcaa702f88b724d94b08977b8e591a32536ce66faa8c" +checksum = "9453325ca0c185a043f4515158daa15a8ab19139a60fd1edaf87fbe896cb7f83" dependencies = [ "bevy_app", "bevy_ecs", @@ -1123,43 +1358,39 @@ dependencies = [ [[package]] name = "bevy_state_macros" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2481c1304fd2a1851a0d4cb63a1ce6421ae40f3f0117cbc9882963ee4c9bb609" +checksum = "d733081e57e49b3c43bdf3766d1de74c7df32e0f4db20c20437c85b1d18908de" dependencies = [ "bevy_macro_utils", - "proc-macro2", "quote", "syn", ] [[package]] name = "bevy_tasks" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b674242641cab680688fc3b850243b351c1af49d4f3417a576debd6cca8dcf5" +checksum = "990ffedd374dd2c4fe8f0fd4bcefd5617d1ee59164b6c3fcc356a69b48e26e8e" dependencies = [ "async-channel", "async-executor", "async-task", "atomic-waker", "bevy_platform", - "cfg-if", "concurrent-queue", "crossbeam-queue", "derive_more", - "futures-channel", "futures-lite", "heapless", "pin-project", - "wasm-bindgen-futures", ] [[package]] name = "bevy_text" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d76c85366159f5f54110f33321c76d8429cfd8f39638f26793a305dae568b60" +checksum = "ecbb6eeaa9a63d1f8aae8c0d79f8d5e14c584a962a4ef9f69115fd7d10941101" dependencies = [ "bevy_app", "bevy_asset", @@ -1171,25 +1402,21 @@ dependencies = [ "bevy_math", "bevy_platform", "bevy_reflect", - "bevy_render", - "bevy_sprite", - "bevy_transform", "bevy_utils", - "bevy_window", "cosmic-text", "serde", "smallvec", "sys-locale", "thiserror 2.0.12", "tracing", - "unicode-bidi", + "wgpu-types", ] [[package]] name = "bevy_time" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc98eb356c75be04fbbc77bb3d8ffa24c8bacd99f76111cee23d444be6ac8c9c" +checksum = "e4c68b78e7ca1cc10c811cd1ded8350f53f2be11eb46946879a74c684026bff7" dependencies = [ "bevy_app", "bevy_ecs", @@ -1202,9 +1429,9 @@ dependencies = [ [[package]] name = "bevy_transform" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df218e440bb9a19058e1b80a68a031c887bcf7bd3a145b55f361359a2fa3100d" +checksum = "b30e3957de42c2f7d88dfe8428e739b74deab8932d2a8bbb9d4eefbd64b6aa34" dependencies = [ "bevy_app", "bevy_ecs", @@ -1220,79 +1447,110 @@ dependencies = [ [[package]] name = "bevy_ui" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a4d2ba51865bc3039af29a26b4f52c48b54cc758369f52004caf4b6f03770" +checksum = "889c6892e9c5c308ab225a1322d07fb2358ccf39493526cda4d5f083d717773d" dependencies = [ "accesskit", "bevy_a11y", "bevy_app", "bevy_asset", + "bevy_camera", + "bevy_color", + "bevy_derive", + "bevy_ecs", + "bevy_image", + "bevy_input", + "bevy_input_focus", + "bevy_math", + "bevy_picking", + "bevy_platform", + "bevy_reflect", + "bevy_sprite", + "bevy_text", + "bevy_transform", + "bevy_utils", + "bevy_window", + "derive_more", + "smallvec", + "taffy", + "thiserror 2.0.12", + "tracing", + "uuid", +] + +[[package]] +name = "bevy_ui_render" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b649395e32a4761d4f17aeff37170a4421c94a14c505645397b8ee8510eb19e9" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_camera", "bevy_color", "bevy_core_pipeline", "bevy_derive", "bevy_ecs", "bevy_image", - "bevy_input", "bevy_math", - "bevy_picking", + "bevy_mesh", "bevy_platform", "bevy_reflect", "bevy_render", + "bevy_shader", "bevy_sprite", + "bevy_sprite_render", "bevy_text", "bevy_transform", + "bevy_ui", "bevy_utils", - "bevy_window", "bytemuck", "derive_more", - "nonmax", - "smallvec", - "taffy", - "thiserror 2.0.12", "tracing", ] [[package]] name = "bevy_utils" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f7a8905a125d2017e8561beefb7f2f5e67e93ff6324f072ad87c5fd6ec3b99" +checksum = "e258c44d869f9c41ac0f88a16815c67f2569eb9fff4716828a40273d127b6f84" dependencies = [ "bevy_platform", + "disqualified", "thread_local", ] [[package]] name = "bevy_window" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7e8ad0c17c3cc23ff5566ae2905c255e6986037fb041f74c446216f5c38431" +checksum = "869a56f1da2544641734018e1f1caa660299cd6e3af794f3fa0df72293d8eed2" dependencies = [ - "android-activity", "bevy_app", + "bevy_asset", "bevy_ecs", + "bevy_image", "bevy_input", "bevy_math", "bevy_platform", "bevy_reflect", - "bevy_utils", "log", "raw-window-handle", "serde", - "smol_str", ] [[package]] name = "bevy_winit" -version = "0.16.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a5e7f00c6b3b6823df5ec2a5e9067273607208919bc8c211773ebb9643c87f0" +checksum = "8142a3749fc491eeae481c30bb3830cf5a71d2fa3dba4d450a42792f6d39eb2d" dependencies = [ "accesskit", "accesskit_winit", "approx", "bevy_a11y", + "bevy_android", "bevy_app", "bevy_asset", "bevy_derive", @@ -1305,12 +1563,10 @@ dependencies = [ "bevy_platform", "bevy_reflect", "bevy_tasks", - "bevy_utils", "bevy_window", "bytemuck", "cfg-if", - "crossbeam-channel", - "raw-window-handle", + "js-sys", "tracing", "wasm-bindgen", "web-sys", @@ -1318,26 +1574,6 @@ dependencies = [ "winit", ] -[[package]] -name = "bindgen" -version = "0.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" -dependencies = [ - "bitflags 2.9.1", - "cexpr", - "clang-sys", - "itertools 0.13.0", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash 1.1.0", - "shlex", - "syn", -] - [[package]] name = "bindgen" version = "0.72.0" @@ -1356,30 +1592,15 @@ dependencies = [ "syn", ] -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec 0.6.3", -] - [[package]] name = "bit-set" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ - "bit-vec 0.8.0", + "bit-vec", ] -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bit-vec" version = "0.8.0" @@ -1398,6 +1619,7 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" dependencies = [ + "bytemuck", "serde", ] @@ -1448,7 +1670,7 @@ version = "0.1.7" dependencies = [ "bevy", "bevy_panorbit_camera", - "glam 0.30.9", + "glam", "rayon", "tobj", ] @@ -1511,6 +1733,18 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + [[package]] name = "cc" version = "1.2.26" @@ -1562,10 +1796,11 @@ dependencies = [ [[package]] name = "codespan-reporting" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" dependencies = [ + "serde", "termcolor", "unicode-width", ] @@ -1633,6 +1868,15 @@ dependencies = [ "const_soft_float", ] +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -1667,7 +1911,7 @@ checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", - "core-graphics-types", + "core-graphics-types 0.1.3", "foreign-types", "libc", ] @@ -1683,6 +1927,26 @@ dependencies = [ "libc", ] +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.9.1", + "core-foundation 0.10.1", + "libc", +] + +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + [[package]] name = "coreaudio-rs" version = "0.11.3" @@ -1700,26 +1964,27 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ceec7a6067e62d6f931a2baf6f3a751f4a892595bcec1461a3c94ef9949864b6" dependencies = [ - "bindgen 0.72.0", + "bindgen", ] [[package]] name = "cosmic-text" -version = "0.13.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e418dd4f5128c3e93eab12246391c54a20c496811131f85754dc8152ee207892" +checksum = "c4cadaea21e24c49c0c82116f2b465ae6a49d63c90e428b0f8d9ae1f638ac91f" dependencies = [ "bitflags 2.9.1", "fontdb", + "harfrust", + "linebender_resource_handle", "log", "rangemap", "rustc-hash 1.1.0", - "rustybuzz", "self_cell", + "skrifa 0.39.0", "smol_str", "swash", "sys-locale", - "ttf-parser 0.21.1", "unicode-bidi", "unicode-linebreak", "unicode-script", @@ -1843,21 +2108,23 @@ checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "derive_more" -version = "1.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "1.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ + "convert_case", "proc-macro2", "quote", + "rustc_version", "syn", "unicode-xid", ] @@ -1892,6 +2159,12 @@ dependencies = [ "litrs", ] +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + [[package]] name = "downcast-rs" version = "2.0.1" @@ -1912,30 +2185,29 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "encase" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0a05902cf601ed11d564128448097b98ebe3c6574bd7b6a653a3d56d54aa020" +checksum = "6e3e0ff2ee0b7aa97428308dd9e1e42369cb22f5fb8dc1c55546637443a60f1e" dependencies = [ "const_panic", "encase_derive", - "glam 0.29.3", - "thiserror 1.0.69", + "thiserror 2.0.12", ] [[package]] name = "encase_derive" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "181d475b694e2dd56ae919ce7699d344d1fd259292d590c723a50d1189a2ea85" +checksum = "a4d90c5d7d527c6cb8a3b114efd26a6304d9ab772656e73d8f4e32b1f3d601a2" dependencies = [ "encase_derive_impl", ] [[package]] name = "encase_derive_impl" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f97b51c5cc57ef7c5f7a0c57c250251c49ee4c28f819f87ac32f4aceabc36792" +checksum = "c8bad72d8308f7a382de2391ec978ddd736e0103846b965d7e2a63a75768af30" dependencies = [ "proc-macro2", "quote", @@ -2041,6 +2313,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "font-types" version = "0.9.0" @@ -2050,6 +2328,15 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "font-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39a654f404bbcbd48ea58c617c2993ee91d1cb63727a37bf2323a4edeed1b8c5" +dependencies = [ + "bytemuck", +] + [[package]] name = "fontconfig-parser" version = "0.5.8" @@ -2061,16 +2348,16 @@ dependencies = [ [[package]] name = "fontdb" -version = "0.16.2" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0299020c3ef3f60f526a4f64ab4a3d4ce116b1acbf24cdd22da0068e5d81dc3" +checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" dependencies = [ "fontconfig-parser", "log", "memmap2", "slotmap", "tinyvec", - "ttf-parser 0.20.0", + "ttf-parser", ] [[package]] @@ -2135,26 +2422,44 @@ dependencies = [ ] [[package]] -name = "gethostname" -version = "0.4.3" +name = "futures-macro" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ - "libc", - "windows-targets 0.48.5", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "getrandom" -version = "0.2.16" +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" dependencies = [ - "cfg-if", - "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", - "wasm-bindgen", + "windows-targets 0.48.5", ] [[package]] @@ -2166,7 +2471,7 @@ dependencies = [ "cfg-if", "libc", "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasi", ] [[package]] @@ -2216,22 +2521,17 @@ dependencies = [ [[package]] name = "glam" -version = "0.29.3" +version = "0.30.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8babf46d4c1c9d92deac9f7be466f76dfc4482b6452fc5024b5e8daf6ffeb3ee" +checksum = "bd47b05dddf0005d850e5644cae7f2b14ac3df487979dbfff3b56f20b1a6ae46" dependencies = [ "bytemuck", + "encase", "libm", "rand", - "serde", + "serde_core", ] -[[package]] -name = "glam" -version = "0.30.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd47b05dddf0005d850e5644cae7f2b14ac3df487979dbfff3b56f20b1a6ae46" - [[package]] name = "glob" version = "0.3.2" @@ -2348,9 +2648,9 @@ dependencies = [ [[package]] name = "grid" -version = "0.15.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36119f3a540b086b4e436bb2b588cf98a68863470e0e880f4d0842f112a3183a" +checksum = "f9e2d4c0a8296178d8802098410ca05d86b17a10bb5ab559b3fb404c1f948220" [[package]] name = "guillotiere" @@ -2370,6 +2670,20 @@ checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" dependencies = [ "cfg-if", "crunchy", + "num-traits", +] + +[[package]] +name = "harfrust" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0caaee032384c10dd597af4579c67dee16650d862a9ccbe1233ff1a379abc07" +dependencies = [ + "bitflags 2.9.1", + "bytemuck", + "core_maths", + "read-fonts 0.36.0", + "smallvec", ] [[package]] @@ -2387,34 +2701,32 @@ version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" dependencies = [ - "equivalent", - "foldhash", - "serde", + "foldhash 0.1.5", ] [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "equivalent", + "foldhash 0.2.0", + "serde", + "serde_core", +] [[package]] name = "heapless" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed" dependencies = [ "hash32", "portable-atomic", "stable_deref_trait", ] -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - [[package]] name = "hermit-abi" version = "0.5.2" @@ -2423,12 +2735,12 @@ checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hexasphere" -version = "15.1.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c9e718d32b6e6b2b32354e1b0367025efdd0b11d6a740b905ddf5db1074679" +checksum = "29a164ceff4500f2a72b1d21beaa8aa8ad83aec2b641844c659b190cb3ea2e0b" dependencies = [ "constgebra", - "glam 0.29.3", + "glam", "tinyvec", ] @@ -2450,15 +2762,6 @@ dependencies = [ "png", ] -[[package]] -name = "immutable-chunkmap" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3e98b1520e49e252237edc238a39869da9f3241f2ec19dc788c1d24694d1e4" -dependencies = [ - "arrayvec", -] - [[package]] name = "indexmap" version = "2.11.4" @@ -2466,7 +2769,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", - "hashbrown 0.16.0", + "hashbrown 0.15.3", "serde", "serde_core", ] @@ -2497,6 +2800,15 @@ dependencies = [ "libc", ] +[[package]] +name = "inventory" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +dependencies = [ + "rustversion", +] + [[package]] name = "io-kit-sys" version = "0.4.1" @@ -2559,15 +2871,15 @@ version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ - "getrandom 0.3.3", + "getrandom", "libc", ] [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ "once_cell", "wasm-bindgen", @@ -2592,11 +2904,11 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" [[package]] name = "ktx2" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d65e08a9ec02e409d27a0139eaa6b9756b4d81fe7cde71f6941a83730ce838" +checksum = "ff7f53bdf698e7aa7ec916411bbdc8078135da11b66db5182675b2227f6c0d07" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.9.1", ] [[package]] @@ -2659,6 +2971,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + [[package]] name = "linux-raw-sys" version = "0.4.15" @@ -2737,13 +3055,13 @@ dependencies = [ [[package]] name = "metal" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" +checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" dependencies = [ "bitflags 2.9.1", "block", - "core-graphics-types", + "core-graphics-types 0.2.0", "foreign-types", "log", "objc", @@ -2768,43 +3086,44 @@ dependencies = [ [[package]] name = "naga" -version = "24.0.0" +version = "27.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e" +checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" dependencies = [ "arrayvec", - "bit-set 0.8.0", + "bit-set", "bitflags 2.9.1", + "cfg-if", "cfg_aliases", "codespan-reporting", + "half", + "hashbrown 0.16.1", "hexf-parse", "indexmap", + "libm", "log", + "num-traits", + "once_cell", "pp-rs", "rustc-hash 1.1.0", "spirv", - "strum", - "termcolor", "thiserror 2.0.12", - "unicode-xid", + "unicode-ident", ] [[package]] name = "naga_oil" -version = "0.17.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2464f7395decfd16bb4c33fb0cb3b2c645cc60d051bc7fb652d3720bfb20f18" +checksum = "310c347db1b30e69581f3b84dc9a5c311ed583f67851b39b77953cb7a066c97f" dependencies = [ - "bit-set 0.5.3", "codespan-reporting", "data-encoding", "indexmap", "naga", - "once_cell", "regex", - "regex-syntax", "rustc-hash 1.1.0", - "thiserror 1.0.69", + "thiserror 2.0.12", "tracing", "unicode-ident", ] @@ -3091,6 +3410,16 @@ dependencies = [ "objc2", ] +[[package]] +name = "objc2-io-kit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a" +dependencies = [ + "libc", + "objc2-core-foundation", +] + [[package]] name = "objc2-link-presentation" version = "0.2.2" @@ -3249,6 +3578,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + [[package]] name = "parking" version = "2.2.1" @@ -3292,11 +3630,12 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.7.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" dependencies = [ "fixedbitset", + "hashbrown 0.15.3", "indexmap", "serde", "serde_derive", @@ -3328,6 +3667,12 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "piper" version = "0.2.4" @@ -3412,23 +3757,13 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" -[[package]] -name = "prettyplease" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55" -dependencies = [ - "proc-macro2", - "syn", -] - [[package]] name = "proc-macro-crate" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ - "toml_edit", + "toml_edit 0.22.27", ] [[package]] @@ -3446,6 +3781,15 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" +[[package]] +name = "quick-xml" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.40" @@ -3469,20 +3813,19 @@ checksum = "019b4b213425016d7d84a153c4c73afb0946fbb4840e4eece7ba8848b9d6da22" [[package]] name = "rand" -version = "0.8.5" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "libc", "rand_chacha", "rand_core", ] [[package]] name = "rand_chacha" -version = "0.3.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", "rand_core", @@ -3490,18 +3833,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom 0.2.16", + "getrandom", ] [[package]] name = "rand_distr" -version = "0.4.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" dependencies = [ "num-traits", "rand", @@ -3552,7 +3895,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04ca636dac446b5664bd16c069c00a9621806895b8bb02c2dc68542b23b8f25d" dependencies = [ "bytemuck", - "font-types", + "font-types 0.9.0", +] + +[[package]] +name = "read-fonts" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eaa2941a4c05443ee3a7b26ab076a553c343ad5995230cc2b1d3e993bdc6345" +dependencies = [ + "bytemuck", + "core_maths", + "font-types 0.10.1", ] [[package]] @@ -3626,14 +3980,16 @@ dependencies = [ [[package]] name = "ron" -version = "0.8.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" +checksum = "fd490c5b18261893f14449cbd28cb9c0b637aebf161cd77900bfdedaff21ec32" dependencies = [ - "base64 0.21.7", "bitflags 2.9.1", + "once_cell", "serde", "serde_derive", + "typeid", + "unicode-ident", ] [[package]] @@ -3654,6 +4010,15 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.44" @@ -3686,23 +4051,6 @@ version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" -[[package]] -name = "rustybuzz" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb9cf8877777222e4a3bc7eb247e398b56baba500c38c1c46842431adc8b55c" -dependencies = [ - "bitflags 2.9.1", - "bytemuck", - "libm", - "smallvec", - "ttf-parser 0.21.1", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-properties", - "unicode-script", -] - [[package]] name = "ruzstd" version = "0.8.1" @@ -3727,18 +4075,43 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[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", + "smithay-client-toolkit", + "tiny-skia", +] + [[package]] name = "self_cell" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749" +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + [[package]] name = "send_wrapper" version = "0.6.0" @@ -3815,7 +4188,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbeb4ca4399663735553a09dd17ce7e49a0a0203f03b706b39628c4d913a8607" dependencies = [ "bytemuck", - "read-fonts", + "read-fonts 0.29.3", +] + +[[package]] +name = "skrifa" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9eb0b904a04d09bd68c65d946617b8ff733009999050f3b851c32fb3cfb60e" +dependencies = [ + "bytemuck", + "read-fonts 0.36.0", ] [[package]] @@ -3842,6 +4225,31 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.9.1", + "calloop", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + [[package]] name = "smol_str" version = "0.2.2" @@ -3853,9 +4261,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.9.8" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" dependencies = [ "portable-atomic", ] @@ -3888,26 +4296,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" +name = "strict-num" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn", -] +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" [[package]] name = "svg_fmt" @@ -3921,16 +4313,16 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f745de914febc7c9ab4388dfaf94bbc87e69f57bb41133a9b0c84d4be49856f3" dependencies = [ - "skrifa", + "skrifa 0.31.3", "yazi", "zeno", ] [[package]] name = "syn" -version = "2.0.101" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -3948,22 +4340,23 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.34.2" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b93974b3d3aeaa036504b8eefd4c039dced109171c1ae973f1dc63b2c7e4b2" +checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f" dependencies = [ "libc", "memchr", "ntapi", "objc2-core-foundation", - "windows 0.54.0", + "objc2-io-kit", + "windows 0.61.3", ] [[package]] name = "taffy" -version = "0.7.7" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4f4d046dd956a47a7e1a2947083d7ac3e6aa3cfaaead36173ceaa5ab11878c" +checksum = "41ba83ebaf2954d31d05d67340fd46cebe99da2b7133b0dd68d70c65473a437b" dependencies = [ "arrayvec", "grid", @@ -4029,6 +4422,31 @@ dependencies = [ "cfg-if", ] +[[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", +] + +[[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 = "tinyvec" version = "1.9.0" @@ -4059,6 +4477,15 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" version = "0.22.27" @@ -4066,7 +4493,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ "indexmap", - "toml_datetime", + "toml_datetime 0.6.11", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.23.10+spec-1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +dependencies = [ + "indexmap", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +dependencies = [ "winnow", ] @@ -4115,15 +4563,12 @@ dependencies = [ [[package]] name = "tracing-oslog" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528bdd1f0e27b5dd9a4ededf154e824b0532731e4af73bb531de46276e0aab1e" +checksum = "d76902d2a8d5f9f55a81155c08971734071968c90f2d9bfe645fe700579b2950" dependencies = [ - "bindgen 0.70.1", "cc", "cfg-if", - "once_cell", - "parking_lot", "tracing-core", "tracing-subscriber", ] @@ -4159,15 +4604,12 @@ dependencies = [ [[package]] name = "ttf-parser" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" - -[[package]] -name = "ttf-parser" -version = "0.21.1" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +dependencies = [ + "core_maths", +] [[package]] name = "twox-hash" @@ -4187,18 +4629,6 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" -[[package]] -name = "unicode-bidi-mirroring" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" - -[[package]] -name = "unicode-ccc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656" - [[package]] name = "unicode-ident" version = "1.0.18" @@ -4211,12 +4641,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-properties" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" - [[package]] name = "unicode-script" version = "0.5.7" @@ -4247,7 +4671,7 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" dependencies = [ - "getrandom 0.3.3", + "getrandom", "js-sys", "serde", "wasm-bindgen", @@ -4292,12 +4716,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -4309,37 +4727,25 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.50" +version = "0.4.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" dependencies = [ "cfg-if", + "futures-util", "js-sys", "once_cell", "wasm-bindgen", @@ -4348,9 +4754,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4358,31 +4764,139 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ + "bumpalo", "proc-macro2", "quote", "syn", - "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" dependencies = [ "unicode-ident", ] +[[package]] +name = "wayland-backend" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee64194ccd96bf648f42a65a7e589547096dfa702f7cadef84347b66ad164f9" +dependencies = [ + "cc", + "downcast-rs 1.2.1", + "rustix 1.0.7", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e6faa537fbb6c186cb9f1d41f2f811a4120d1b57ec61f50da451a0c5122bec" +dependencies = [ + "bitflags 2.9.1", + "rustix 1.0.7", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.9.1", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5864c4b5b6064b06b1e8b74ead4a98a6c45a285fe7a0e784d24735f011fdb078" +dependencies = [ + "rustix 1.0.7", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baeda9ffbcfc8cd6ddaade385eaf2393bd2115a69523c735f12242353c3df4f3" +dependencies = [ + "bitflags 2.9.1", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa98634619300a535a9a97f338aed9a5ff1e01a461943e8346ff4ae26007306b" +dependencies = [ + "bitflags 2.9.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9597cdf02cf0c34cd5823786dce6b5ae8598f05c2daf5621b6e178d4f7345f3" +dependencies = [ + "bitflags 2.9.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5423e94b6a63e68e439803a3e153a9252d5ead12fd853334e2ad33997e3889e3" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6dbfc3ac5ef974c92a2235805cc0114033018ae1290a72e474aa8b28cbbdfd" +dependencies = [ + "dlib", + "log", + "pkg-config", +] + [[package]] name = "web-sys" -version = "0.3.77" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" dependencies = [ "js-sys", "wasm-bindgen", @@ -4400,24 +4914,25 @@ dependencies = [ [[package]] name = "wgpu" -version = "24.0.5" +version = "27.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b0b3436f0729f6cdf2e6e9201f3d39dc95813fad61d826c1ed07918b4539353" +checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" dependencies = [ "arrayvec", "bitflags 2.9.1", + "cfg-if", "cfg_aliases", "document-features", + "hashbrown 0.16.1", "js-sys", "log", "naga", - "parking_lot", + "portable-atomic", "profiling", "raw-window-handle", "smallvec", "static_assertions", "wasm-bindgen", - "wasm-bindgen-futures", "web-sys", "wgpu-core", "wgpu-hal", @@ -4426,49 +4941,85 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "24.0.5" +version = "27.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f0aa306497a238d169b9dc70659105b4a096859a34894544ca81719242e1499" +checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" dependencies = [ "arrayvec", - "bit-vec 0.8.0", + "bit-set", + "bit-vec", "bitflags 2.9.1", + "bytemuck", "cfg_aliases", "document-features", + "hashbrown 0.16.1", "indexmap", "log", "naga", "once_cell", "parking_lot", + "portable-atomic", "profiling", "raw-window-handle", "rustc-hash 1.1.0", "smallvec", "thiserror 2.0.12", + "wgpu-core-deps-apple", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows-linux-android", "wgpu-hal", "wgpu-types", ] +[[package]] +name = "wgpu-core-deps-apple" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b1027dcf3b027a877e44819df7ceb0e2e98578830f8cd34cd6c3c7c2a7a50b7" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" +dependencies = [ + "wgpu-hal", +] + [[package]] name = "wgpu-hal" -version = "24.0.4" +version = "27.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f112f464674ca69f3533248508ee30cb84c67cf06c25ff6800685f5e0294e259" +checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" dependencies = [ "android_system_properties", "arrayvec", "ash", - "bit-set 0.8.0", + "bit-set", "bitflags 2.9.1", "block", "bytemuck", + "cfg-if", "cfg_aliases", - "core-graphics-types", + "core-graphics-types 0.2.0", "glow", "glutin_wgl_sys", "gpu-alloc", "gpu-allocator", "gpu-descriptor", + "hashbrown 0.16.1", "js-sys", "khronos-egl", "libc", @@ -4476,16 +5027,17 @@ dependencies = [ "log", "metal", "naga", - "ndk-sys 0.5.0+25.2.9519653", + "ndk-sys 0.6.0+11769913", "objc", "once_cell", "ordered-float", "parking_lot", + "portable-atomic", + "portable-atomic-util", "profiling", "range-alloc", "raw-window-handle", "renderdoc-sys", - "rustc-hash 1.1.0", "smallvec", "thiserror 2.0.12", "wasm-bindgen", @@ -4497,14 +5049,16 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "24.0.0" +version = "27.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c" +checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" dependencies = [ "bitflags 2.9.1", + "bytemuck", "js-sys", "log", "serde", + "thiserror 2.0.12", "web-sys", ] @@ -5018,6 +5572,7 @@ version = "0.30.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732" dependencies = [ + "ahash", "android-activity", "atomic-waker", "bitflags 2.9.1", @@ -5032,6 +5587,7 @@ dependencies = [ "dpi", "js-sys", "libc", + "memmap2", "ndk 0.9.0", "objc2", "objc2-app-kit", @@ -5043,11 +5599,17 @@ dependencies = [ "raw-window-handle", "redox_syscall 0.4.1", "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit", "smol_str", "tracing", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", "web-sys", "web-time", "windows-sys 0.52.0", @@ -5106,6 +5668,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" +[[package]] +name = "xcursor" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b" + [[package]] name = "xkbcommon-dl" version = "0.4.2" diff --git a/Cargo.toml b/Cargo.toml index ac65921..fda96e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ glam = "0.30.9" rayon = { version = "1.11.0", optional = true } tobj = {version = "4.0.3", optional = true} -bevy = { version = "0.16.1", optional = true } -bevy_panorbit_camera = { version = "0.26.0", optional = true } +bevy = { version = "0.18.0", optional = true } +bevy_panorbit_camera = { version = "0.34.0", optional = true } [features] default = [] diff --git a/examples/menger_sponge.rs b/examples/menger_sponge.rs index c91ca77..e08ad3b 100644 --- a/examples/menger_sponge.rs +++ b/examples/menger_sponge.rs @@ -6,7 +6,7 @@ use std::time::Instant; use bevy::prelude::*; use bevy::pbr::wireframe::{WireframePlugin, Wireframe, WireframeColor}; use bevy::asset::RenderAssetUsages; -use bevy::render::mesh::PrimitiveTopology; +use bevy::mesh::PrimitiveTopology; use bevy::color::palettes::css::*; use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin}; use boolmesh::prelude::*; @@ -34,7 +34,7 @@ fn setup( ) { let now = Instant::now(); - let num = 4; + let num = 3; let res = menger_sponge(num); println!(">>>>>>>>>>>>>> Compute a menger sponge of level {}, elapsed time: {:?}", num, now.elapsed()); @@ -70,7 +70,7 @@ fn setup( )); } -pub fn menger_sponge(n: usize) -> Manifold { +pub fn menger_sponge(n: usize) -> Manifold<()> { let res = generate_cube().unwrap(); let mut holes = vec![]; fractal(&res, &mut holes, 0., 0., 1., 1, n); diff --git a/examples/multiple_models.rs b/examples/multiple_models.rs index c95b2e2..fe65ebe 100644 --- a/examples/multiple_models.rs +++ b/examples/multiple_models.rs @@ -6,7 +6,7 @@ use bevy::prelude::*; use bevy::pbr::wireframe::{WireframePlugin, Wireframe, WireframeColor}; use bevy::color::palettes::css::*; use bevy::asset::RenderAssetUsages; -use bevy::render::mesh::PrimitiveTopology; +use bevy::mesh::PrimitiveTopology; use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin}; #[derive(Component)] @@ -36,7 +36,7 @@ fn setup( let (m0, _) = tobj::load_obj(obj_path_1, &tobj::LoadOptions { ..Default::default() }).expect("Failed to load the first obj file"); let (m1, _) = tobj::load_obj(obj_path_2, &tobj::LoadOptions { ..Default::default() }).expect("Failed to load the second obj file"); - let mut mfs = vec![]; + let mut mfs: Vec> = vec![]; for m in vec![&m0[0].mesh, &m1[0].mesh] { mfs.push(Manifold::new( &m.positions.iter().map(|&v| v as f64).collect::>(), diff --git a/src/boolean03/kernel03.rs b/src/boolean03/kernel03.rs index 23c5977..52ea9e2 100644 --- a/src/boolean03/kernel03.rs +++ b/src/boolean03/kernel03.rs @@ -1,13 +1,14 @@ //--- Copyright (C) 2025 Saki Komikado , //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. +use std::fmt::Debug; use super::kernel02::Kernel02; use crate::bounds::{BPos, Query}; use crate::{Real, Vec2, Manifold}; -pub fn winding03( - mp: &Manifold, - mq: &Manifold, +pub fn winding03( + mp: &Manifold, + mq: &Manifold, expand: Real, fwd: bool ) -> Vec { diff --git a/src/boolean03/kernel12.rs b/src/boolean03/kernel12.rs index 0d6ea0a..783decb 100644 --- a/src/boolean03/kernel12.rs +++ b/src/boolean03/kernel12.rs @@ -1,6 +1,7 @@ //--- Copyright (C) 2025 Saki Komikado , //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. +use std::fmt::Debug; use crate::{Manifold, Half, Real, Vec3}; use crate::bounds::{BBox, Query}; use super::kernel01::intersect; @@ -72,9 +73,9 @@ impl<'a> Kernel12<'a> { } } -pub fn intersect12 ( - mp: &Manifold, - mq: &Manifold, +pub fn intersect12 ( + mp: &Manifold, + mq: &Manifold, p1q2: &mut Vec<[usize; 2]>, expand: Real, fwd: bool diff --git a/src/boolean03/mod.rs b/src/boolean03/mod.rs index daf0e03..d340437 100644 --- a/src/boolean03/mod.rs +++ b/src/boolean03/mod.rs @@ -6,6 +6,8 @@ pub mod kernel02; pub mod kernel11; pub mod kernel12; pub mod kernel03; + +use std::fmt::Debug; use crate::boolean03::kernel03::winding03; use crate::boolean03::kernel12::intersect12; use crate::common::{OpType, Vec3}; @@ -22,9 +24,9 @@ pub struct Boolean03 { pub v21: Vec, } -pub fn boolean03( - mp: &Manifold, - mq: &Manifold, +pub fn boolean03( + mp: &Manifold, + mq: &Manifold, op: &OpType, ) -> Boolean03 { let e = if op == &OpType::Add { 1. } else { -1. }; diff --git a/src/boolean45/mod.rs b/src/boolean45/mod.rs index 291837e..4fccf26 100644 --- a/src/boolean45/mod.rs +++ b/src/boolean45/mod.rs @@ -3,6 +3,7 @@ use std::mem; use std::collections::HashMap; +use std::fmt::Debug; use crate::{Manifold, Real, Vec3, Half, Tref, face_of}; use crate::boolean03::Boolean03; use crate::bounds::BBox; @@ -40,9 +41,9 @@ fn exclusive_scan(input: &[i32], output: &mut [i32], offset: i32) { } } -fn size_output( - mp: &Manifold, - mq: &Manifold, +fn size_output( + mp: &Manifold, + mq: &Manifold, i03: &[i32], i30: &[i32], i12: &[i32], @@ -325,9 +326,9 @@ pub struct Boolean45 { pub nv_from_q: usize, } -pub fn boolean45( - mp: &Manifold, - mq: &Manifold, +pub fn boolean45( + mp: &Manifold, + mq: &Manifold, b03: &Boolean03, op: &OpType ) -> Boolean45 { diff --git a/src/compose/cone.rs b/src/compose/cone.rs index eedddd9..521060d 100644 --- a/src/compose/cone.rs +++ b/src/compose/cone.rs @@ -2,15 +2,16 @@ //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. use std::f64::consts::PI; +use std::fmt::Debug; use crate::{Manifold, Vec3, Real, compute_orthogonal}; use crate::common::Vec3u; -pub fn generate_cone( +pub fn generate_cone( apex: Vec3, center: Vec3, radius: Real, divide: usize, -) -> Result { +) -> Result, String> { let d = (PI * 2. / divide as f64) as Real; let n = (center - apex).normalize(); let b1 = compute_orthogonal(n); @@ -29,5 +30,5 @@ pub fn generate_cone( ps.push(apex); ps.push(center); - Manifold::new_impl(ps, ts, None, None) + Manifold::new_impl(ps, ts, vec![], None, None) } \ No newline at end of file diff --git a/src/compose/cube.rs b/src/compose/cube.rs index 88bee39..c7a1fb6 100644 --- a/src/compose/cube.rs +++ b/src/compose/cube.rs @@ -1,9 +1,10 @@ //--- Copyright (C) 2025 Saki Komikado , //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. +use std::fmt::Debug; use crate::manifold::Manifold; -pub fn generate_cube() -> Result { +pub fn generate_cube() -> Result, String> { let ps = [ -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, diff --git a/src/compose/cylinder.rs b/src/compose/cylinder.rs index 2af6f72..450714c 100644 --- a/src/compose/cylinder.rs +++ b/src/compose/cylinder.rs @@ -2,14 +2,15 @@ //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. use std::f64::consts::PI; +use std::fmt::Debug; use crate::{Manifold, Vec3, Vec3u, Real}; -pub fn generate_cylinder( +pub fn generate_cylinder( r: f64, // radius h: f64, // height d0: usize, // sectors d1: usize, // stacks -) -> Result { +) -> Result, String> { if d0 < 3 || d1 < 1 { return Err("sectors must be >= 3 and stacks must be >= 1".into()); } let mut ps = vec![]; let mut ts = vec![]; @@ -45,5 +46,5 @@ pub fn generate_cylinder( } } - Manifold::new_impl(ps, ts, None, None) + Manifold::new_impl(ps, ts, vec![], None, None) } \ No newline at end of file diff --git a/src/compose/mod.rs b/src/compose/mod.rs index f76049a..b931cad 100644 --- a/src/compose/mod.rs +++ b/src/compose/mod.rs @@ -8,6 +8,7 @@ pub mod sphere; pub mod torus; pub mod cylinder; +use std::fmt::Debug; pub use cone::*; pub use cube::*; pub use sphere::*; @@ -19,7 +20,7 @@ use crate::common::{compute_aa_proj, get_aa_proj_matrix, Vec3u}; use crate::triangulation::ear_clip::EarClip; use crate::triangulation::Pt; -pub fn extrude(pts: &[Vec3], offset: Vec3) -> Result { +pub fn extrude(pts: &[Vec3], offset: Vec3) -> Result, String> { let n = Vec3::new(0., 0., 1.); let proj = get_aa_proj_matrix(&n); let poly = pts.iter().enumerate().map(|(i, p)| Pt {pos: compute_aa_proj(&proj, p), idx: i}).collect::>(); @@ -37,10 +38,10 @@ pub fn extrude(pts: &[Vec3], offset: Vec3) -> Result { oft_ts.push(Vec3u::new(i, j, i + n)); oft_ts.push(Vec3u::new(i + n, j, j + n)); } - Manifold::new_impl(oft_ps, oft_ts, None, None) + Manifold::new_impl(oft_ps, oft_ts, vec![], None, None) } -pub fn compose(ms: &Vec) -> Result { +pub fn compose(ms: &Vec>) -> Result, String> { let mut ps = vec![]; let mut ts = vec![]; let mut offset = 0; @@ -56,9 +57,9 @@ pub fn compose(ms: &Vec) -> Result { Manifold::new(&ps, &ts) } -pub fn fractal( - hole : &Manifold, - holes: &mut Vec, +pub fn fractal( + hole : &Manifold, + holes: &mut Vec>, x: f64, y: f64, w: f64, diff --git a/src/compose/sphere.rs b/src/compose/sphere.rs index e8c1919..98f4272 100644 --- a/src/compose/sphere.rs +++ b/src/compose/sphere.rs @@ -3,12 +3,13 @@ use std::collections::HashMap; use std::f64::consts::PI; +use std::fmt::Debug; use crate::{Manifold, Vec3, Vec3u, Real}; -pub fn generate_uv_sphere( +pub fn generate_uv_sphere( d0: usize, // sectors d1: usize, // stacks -) -> Result { +) -> Result, String> { if d0 < 3 || d1 < 2 { return Err("sectors must be >= 3 and stacks must be >= 2".into()); } let mut ps = vec![]; @@ -42,10 +43,10 @@ pub fn generate_uv_sphere( } } - Manifold::new_impl(ps, ts, None, None) + Manifold::new_impl(ps, ts, vec![], None, None) } -pub fn generate_icosphere(subdivisions: u32) -> Result { +pub fn generate_icosphere(subdivisions: u32) -> Result, String> { let phi = ((1. + 5.0f32.sqrt()) / 2.) as Real; let mut ps = vec![ @@ -120,5 +121,5 @@ pub fn generate_icosphere(subdivisions: u32) -> Result { ts = ts_; } - Manifold::new_impl(ps, ts, None, None) + Manifold::new_impl(ps, ts, vec![], None, None) } \ No newline at end of file diff --git a/src/compose/torus.rs b/src/compose/torus.rs index 3c9df5d..a7621d8 100644 --- a/src/compose/torus.rs +++ b/src/compose/torus.rs @@ -9,7 +9,7 @@ pub fn generate_torus( r1: f64, // minor radius d0: usize, // rings d1: usize, // sectors -) -> Result { +) -> Result, String> { let mut ps = Vec::with_capacity(d0 * d1); let mut ts = Vec::with_capacity(d0 * d1 * 6); @@ -41,5 +41,5 @@ pub fn generate_torus( } } - Manifold::new_impl(ps, ts, None, None) + Manifold::new_impl(ps, ts, vec![], None, None) } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 01502c9..683944c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ mod boolean45; mod compose; mod tests; +use std::fmt::Debug; use crate::boolean03::boolean03; use crate::boolean45::boolean45; use crate::simplification::simplify_topology; @@ -40,11 +41,11 @@ pub mod prelude { }; } -pub fn compute_boolean( - mp: &Manifold, - mq: &Manifold, +pub fn compute_boolean( + mp: &Manifold, + mq: &Manifold, op: OpType, -) -> Result { +) -> Result, String> { let eps = mp.eps.max(mq.eps); let tol = mp.tol.max(mq.tol); @@ -64,12 +65,22 @@ pub fn compute_boolean( cleanup_unused_verts( &mut b45.ps, - &mut trg.hs + &mut trg.hs, + &mut trg.rs ); + let mut inh = vec![]; + if !mp.inh.is_empty() && !mq.inh.is_empty() { + for r in trg.rs.iter() { + if r.mid == 0 { inh.push(mp.inh[r.fid].clone()) } + else { inh.push(mq.inh[r.fid].clone()) } + } + } + Manifold::new_impl( b45.ps, trg.hs.chunks(3).map(|hs| Vec3u::new(hs[0].tail, hs[1].tail, hs[2].tail)).collect(), + inh, Some(eps), Some(tol) ) diff --git a/src/manifold/mod.rs b/src/manifold/mod.rs index 43490d6..e977a41 100644 --- a/src/manifold/mod.rs +++ b/src/manifold/mod.rs @@ -6,14 +6,17 @@ pub mod bounds; pub mod collider; use std::cmp::Ordering; +use std::fmt::Debug; use bounds::BBox; -use crate::collider::{morton_code, MortonCollider, K_NO_CODE}; -use crate::{Real, Half, Vec3, Vec3u, K_PRECISION, next_of, Mat3}; -use super::hmesh::Hmesh; +use hmesh::Hmesh; +use collider::{morton_code, MortonCollider, K_NO_CODE}; +use crate::{Tref, Half, Real, Vec3, Vec2u, Vec3u, K_PRECISION, next_of, Mat3}; #[cfg(feature = "rayon")] use rayon::prelude::*; + + #[derive(Clone, Debug)] -pub struct Manifold { +pub struct Manifold { pub ps: Vec, // positions pub hs: Vec, // halfedges pub nv: usize, // number of vertices @@ -21,32 +24,34 @@ pub struct Manifold { pub nh: usize, // number of halfedges pub eps: Real, // epsilon pub tol: Real, // tolerance + pub inh: Vec, // pub bounding_box: BBox, // pub face_normals: Vec, // pub vert_normals: Vec, // - pub original_idx: Vec, // pub collider: MortonCollider, // pub coplanar: Vec, // indices of coplanar faces } -impl Manifold { +impl Manifold { pub fn new(pos: &[f64], idx: &[usize]) -> Result { Self::new_impl( pos.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect(), idx.chunks(3).map(|i| Vec3u::new(i[0], i[1], i[2])).collect(), - None, None + vec![], None, None ) } pub fn new_impl( ps : Vec, idx: Vec, + inh: Vec, eps: Option, tol: Option, ) -> Result { let bb = BBox::new(None, &ps); let (mut f_bb, mut f_mt) = compute_face_morton(&ps, &idx, &bb); - let hm = sort_faces(&ps, &idx, &mut f_bb, &mut f_mt)?; + let mut inh_ = inh.clone(); + let hm = sort_faces(&ps, &idx, &mut inh_, &mut f_bb, &mut f_mt)?; let hs = hm.half.iter().map(|&i| Half::new(hm.tail[i], hm.head[i], hm.twin[i])).collect::>(); let mut e = K_PRECISION * bb.scale(); @@ -65,7 +70,7 @@ impl Manifold { bounding_box: bb, vert_normals: hm.vns, face_normals: hm.fns, - original_idx: vec![], + inh: inh_, eps, tol, collider, @@ -109,19 +114,32 @@ impl Manifold { pub fn translate(&mut self, x: f64, y: f64, z: f64) { let t = Vec3::new(x as Real, y as Real, z as Real); let p = self.ps.iter().map(|p| *p + t).collect(); - *self = Manifold::new_impl(p, self.get_indices(), None, None).unwrap(); + *self = Manifold::new_impl(p, self.get_indices(), self.inh.clone(), None, None).unwrap(); } pub fn rotate(&mut self, x: f64, y: f64, z: f64) { let r = Mat3::from_euler(glam::EulerRot::XYZ, x as Real, y as Real, z as Real); let p = self.ps.iter().map(|p| r * *p).collect(); - *self = Manifold::new_impl(p, self.get_indices(), None, None).unwrap(); + *self = Manifold::new_impl(p, self.get_indices(), self.inh.clone(), None, None).unwrap(); } pub fn scale(&mut self, x: f64, y: f64, z: f64) { let p = self.ps.iter().map(|p| Vec3::new(p.x * x as Real, p.y * y as Real, p.z * z as Real)).collect(); - *self = Manifold::new_impl(p, self.get_indices(), None, None).unwrap(); + *self = Manifold::new_impl(p, self.get_indices(), self.inh.clone(), None, None).unwrap(); + } + + pub fn set_inheritances( + &mut self, + val: Vec + ) { + *self = Manifold::new_impl( + self.ps.clone(), + self.get_indices(), + val, + None, None + ).unwrap(); } + } fn compute_face_morton( @@ -164,9 +182,10 @@ fn compute_face_morton( (bbs, mts) } -fn sort_faces( +fn sort_faces( pos: &[Vec3], idx: &[Vec3u], + inh: &mut Vec, face_bboxes: &mut Vec, face_morton: &mut Vec ) -> Result { @@ -174,7 +193,7 @@ fn sort_faces( map.sort_by_key(|&i| face_morton[i]); *face_bboxes = map.iter().map(|&i| face_bboxes[i].clone()).collect::>(); *face_morton = map.iter().map(|&i| face_morton[i]).collect::>(); - + if !inh.is_empty() { *inh = map.iter().map(|&i| inh[i].clone()).collect(); } Hmesh::new(pos, &map.iter().map(|&i| idx[i]).collect::>()) } @@ -232,7 +251,8 @@ fn compute_coplanar_idx( pub fn cleanup_unused_verts( ps: &mut Vec, - hs: &mut Vec + hs: &mut Vec, + rs: &mut Vec, ) { let bb = BBox::new(None, ps); let mt = ps.iter().map(|p| morton_code(p, &bb)).collect::>(); @@ -257,7 +277,15 @@ pub fn cleanup_unused_verts( new2old.truncate(nv); + let mut rs_ = vec![]; + for i in 0..hs.len() / 3 { + let j = i * 3; + if hs[j].pair().is_none() { continue; } + rs_.push(rs[i].clone()); + } + *ps = new2old.iter().map(|&i| ps[i]).collect(); *hs = hs.iter().filter(|h| h.pair().is_some()).cloned().collect(); + *rs = rs_; } diff --git a/src/simplification/collapse.rs b/src/simplification/collapse.rs index c2f3d02..08d6ed7 100644 --- a/src/simplification/collapse.rs +++ b/src/simplification/collapse.rs @@ -85,10 +85,9 @@ pub fn collapse_edge( let tr2 = tr0; tr0 = &rs[hid / 3]; if !r_curr.same_face(tr0) { return false; } - if tr0.mid != tr2.mid || - tr0.fid != tr2.fid || - n_pair.dot(*n_curr) < -0.5 { - // Restrict collapse to co-linear edges when the edge separates faces or the edge is sharp. + if tr0.mid != tr2.mid || n_pair.dot(*n_curr) < -0.5 { + // Originally it was "tr0.mid != tr2.mid || tr0.fid != tr2.fid ||...", but seems ok to ignore. + // Restrict collapse to co-linear edges when the edge separates some faces or the edge is sharp. // This ensures large shifts are not introduced parallel to the tangent plane. if ccw(&p_prev, &pos_delt, &pos_keep) != 0 { return false; } } diff --git a/src/tests.rs b/src/tests.rs index 9c2b6cb..9762343 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -10,21 +10,21 @@ mod test_intersection { use crate::{OpType, Vec3}; use crate::Manifold; - pub fn gen_tet_a() -> Manifold { + pub fn gen_tet_a() -> Manifold<()> { Manifold::new( &vec![-0.866025, -1., 0.5, 0., -1., -1., 0.866025, -1., 0.5, 0., 1., 0.], &vec![0, 3, 1, 1, 2, 0, 1, 3, 2, 2, 3, 0], ).unwrap() } - pub fn gen_tet_b() -> Manifold { + pub fn gen_tet_b() -> Manifold<()> { Manifold::new( &vec![-1., -0.866025, 0.5, -1., 0., -1., -1., 0.866025, 0.5, 1., 0., 0.], &vec![1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2], ).unwrap() } - pub fn gen_tet_c() -> Manifold { + pub fn gen_tet_c() -> Manifold<()> { Manifold::new( &vec![-2., -0.866025, 0.5, -2., -0., -1., -2., 0.866025, 0.5, 0., 0., 0.], &vec![1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2], diff --git a/src/triangulation/mod.rs b/src/triangulation/mod.rs index fc013fb..9d142bb 100644 --- a/src/triangulation/mod.rs +++ b/src/triangulation/mod.rs @@ -6,6 +6,7 @@ pub mod flat_tree; pub mod tri_halfs; use std::collections::{BTreeMap, VecDeque}; +use std::fmt::Debug; use crate::boolean45::Boolean45; use crate::{Manifold, Vec2, Vec3, Vec3u, Half, Tref, get_aa_proj_matrix, compute_aa_proj, is_ccw_3d, Real}; use crate::triangulation::ear_clip::EarClip; @@ -19,9 +20,9 @@ pub struct Triangulation { pub ns: Vec, } -pub fn triangulate( - mp: &Manifold, - mq: &Manifold, +pub fn triangulate( + mp: &Manifold, + mq: &Manifold, b45: &Boolean45, eps: Real, ) -> Result { @@ -197,15 +198,14 @@ pub struct Pt { pub idx: usize } -fn update_reference( - mp: &Manifold, - mq: &Manifold, +fn update_reference( + mp: &Manifold, + mq: &Manifold, rs: &mut[Tref], ) { for r in rs.iter_mut() { let fid = r.fid; let pq = r.mid == 0; - r.fid = 0; // see the original code and it's always -1 r.pid = if pq { mp.coplanar[fid] } else { mq.coplanar[fid] }; } } From 6c5485a290d80fb22596468719f1f5e50958ceec Mon Sep 17 00:00:00 2001 From: sakikomikado Date: Fri, 30 Jan 2026 00:21:47 +0900 Subject: [PATCH 3/5] function on the 2-mfd wip --- examples/primitives_demo.rs | 60 ++++++++++++++++++++++++++++++------- src/boolean03/kernel03.rs | 9 +++--- src/boolean03/kernel12.rs | 9 +++--- src/boolean03/mod.rs | 10 +++---- src/boolean45/mod.rs | 15 +++++----- src/compose/cone.rs | 7 ++--- src/compose/cube.rs | 5 ++-- src/compose/cylinder.rs | 7 ++--- src/compose/mod.rs | 13 ++++---- src/compose/sphere.rs | 9 +++--- src/compose/torus.rs | 6 ++-- src/lib.rs | 26 ++++++++-------- src/manifold/mod.rs | 24 +++++---------- src/triangulation/mod.rs | 15 +++++----- 14 files changed, 117 insertions(+), 98 deletions(-) diff --git a/examples/primitives_demo.rs b/examples/primitives_demo.rs index 0a4952c..96008ec 100644 --- a/examples/primitives_demo.rs +++ b/examples/primitives_demo.rs @@ -4,7 +4,7 @@ use bevy::prelude::*; use bevy::pbr::wireframe::{WireframePlugin, Wireframe, WireframeColor}; use bevy::asset::RenderAssetUsages; -use bevy::render::mesh::PrimitiveTopology; +use bevy::mesh::PrimitiveTopology; use bevy::color::palettes::css::*; use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin}; use boolmesh::prelude::*; @@ -30,38 +30,76 @@ fn setup( mut mats: ResMut>, mut meshes: ResMut> ) { + let mut mfd0 = generate_cube().unwrap(); + let mut mfd1 = generate_cylinder(0.4, 1., 50, 10).unwrap(); + let mut mfd2 = generate_cube().unwrap(); + let idcs1 = mfd1.get_indices(); - let mut mfd0 = generate_cylinder(1., 1., 30, 10).unwrap(); - let mut mfd1 = generate_uv_sphere(30, 30).unwrap(); - let mut mfd2 = generate_torus(1., 0.1, 30, 30).unwrap(); - mfd1.translate(0., 0.5, 0.); - let res = compute_boolean(&mfd0, &mfd1, OpType::Add).unwrap(); + mfd0.set_inheritances((0..mfd0.nf).map(|i| boolmesh::Vec2::new(1., i as f64)).collect::>()); + mfd1.set_inheritances((0..mfd1.nf).map(|i| { + let idcs = idcs1[i]; + let p0 = mfd1.ps[idcs[0]]; + let p1 = mfd1.ps[idcs[1]]; + let p2 = mfd1.ps[idcs[2]]; + boolmesh::Vec2::new(2., (p0 + p1 + p2).y as f64 / 3. + 0.5) + }).collect::>()); + + mfd2.set_inheritances((0..mfd2.nf).map(|i| boolmesh::Vec2::new(3., i as f64)).collect::>()); + mfd1.translate(0.5, 0., 0.25); + mfd2.translate(-0.5, 0.5, 0.5); + + let mut map1 = vec![]; + for i in 0..mfd1.nf { + let idcs = idcs1[i]; + let p0 = mfd1.ps[idcs[0]]; + let p1 = mfd1.ps[idcs[1]]; + let p2 = mfd1.ps[idcs[2]]; + map1.push((p0 + p1 + p2).y / 3. + 0.5); + } + + let res = compute_boolean(&mfd0, &mfd1, OpType::Subtract).unwrap(); let res = compute_boolean(&res, &mfd2, OpType::Subtract).unwrap(); cmds.spawn((DirectionalLight::default(), Transform::from_xyz(30., 40., 30.))); + cmds.spawn((PointLight { shadows_enabled: false, ..default() }, + Transform::from_xyz(4.0, 5.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y), + )); + cmds.spawn((Transform::from_translation(Vec3::new(0., 0., 2.)), PanOrbitCamera::default(),)); let mut m = Mesh::new(PrimitiveTopology::TriangleList, RenderAssetUsages::default()); + let mut pos = vec![]; + let mut col = vec![]; let mut vns = vec![]; for (fid, hs) in res.hs.chunks(3).enumerate() { - let p0 = res.ps[hs[0].tail]; - let p1 = res.ps[hs[1].tail]; - let p2 = res.ps[hs[2].tail]; - let n = res.face_normals[fid]; + let p0 = res.ps[hs[0].tail]; + let p1 = res.ps[hs[1].tail]; + let p2 = res.ps[hs[2].tail]; + let n = res.face_normals[fid]; + let inh = res.inh[fid]; + let mut c = [0., 0., 0., 1.]; + if inh.x as usize == 1 { c[0] = 1.; } + if inh.x as usize == 2 { c[1] = inh.y as f32; } + if inh.x as usize == 3 { c[2] = 1.; } + pos.push([p0.x as f32, p0.y as f32, p0.z as f32]); pos.push([p1.x as f32, p1.y as f32, p1.z as f32]); pos.push([p2.x as f32, p2.y as f32, p2.z as f32]); + col.push(c); + col.push(c); + col.push(c); vns.push([n.x as f32, n.y as f32, n.z as f32]); vns.push([n.x as f32, n.y as f32, n.z as f32]); vns.push([n.x as f32, n.y as f32, n.z as f32]); } m.insert_attribute(Mesh::ATTRIBUTE_POSITION, pos); m.insert_attribute(Mesh::ATTRIBUTE_NORMAL, vns); + m.insert_attribute(Mesh::ATTRIBUTE_COLOR, col); cmds.spawn(( Mesh3d(meshes.add(m).clone()), - MeshMaterial3d(mats.add(StandardMaterial { base_color: GRAY.into(), ..default() })), + MeshMaterial3d(mats.add(StandardMaterial { unlit: true, base_color: GRAY.into(), ..default() })), Transform::default(), Wireframe, WireframeColor { color: Srgba::rgb(0.3, 0.3, 0.3).into() }, diff --git a/src/boolean03/kernel03.rs b/src/boolean03/kernel03.rs index 52ea9e2..0846047 100644 --- a/src/boolean03/kernel03.rs +++ b/src/boolean03/kernel03.rs @@ -1,14 +1,13 @@ //--- Copyright (C) 2025 Saki Komikado , //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. -use std::fmt::Debug; use super::kernel02::Kernel02; use crate::bounds::{BPos, Query}; -use crate::{Real, Vec2, Manifold}; +use crate::{Data, Real, Vec2, Manifold}; -pub fn winding03( - mp: &Manifold, - mq: &Manifold, +pub fn winding03( + mp: &Manifold, + mq: &Manifold, expand: Real, fwd: bool ) -> Vec { diff --git a/src/boolean03/kernel12.rs b/src/boolean03/kernel12.rs index 783decb..658c481 100644 --- a/src/boolean03/kernel12.rs +++ b/src/boolean03/kernel12.rs @@ -1,8 +1,7 @@ //--- Copyright (C) 2025 Saki Komikado , //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. -use std::fmt::Debug; -use crate::{Manifold, Half, Real, Vec3}; +use crate::{Data, Manifold, Half, Real, Vec3}; use crate::bounds::{BBox, Query}; use super::kernel01::intersect; use super::kernel02::Kernel02; @@ -73,9 +72,9 @@ impl<'a> Kernel12<'a> { } } -pub fn intersect12 ( - mp: &Manifold, - mq: &Manifold, +pub fn intersect12 ( + mp: &Manifold, + mq: &Manifold, p1q2: &mut Vec<[usize; 2]>, expand: Real, fwd: bool diff --git a/src/boolean03/mod.rs b/src/boolean03/mod.rs index d340437..204286b 100644 --- a/src/boolean03/mod.rs +++ b/src/boolean03/mod.rs @@ -7,11 +7,9 @@ pub mod kernel11; pub mod kernel12; pub mod kernel03; -use std::fmt::Debug; use crate::boolean03::kernel03::winding03; use crate::boolean03::kernel12::intersect12; -use crate::common::{OpType, Vec3}; -use crate::manifold::Manifold; +use crate::{Data, Manifold, OpType, Vec3}; pub struct Boolean03 { pub p1q2: Vec<[usize; 2]>, @@ -24,9 +22,9 @@ pub struct Boolean03 { pub v21: Vec, } -pub fn boolean03( - mp: &Manifold, - mq: &Manifold, +pub fn boolean03( + mp: &Manifold, + mq: &Manifold, op: &OpType, ) -> Boolean03 { let e = if op == &OpType::Add { 1. } else { -1. }; diff --git a/src/boolean45/mod.rs b/src/boolean45/mod.rs index 4fccf26..66a9a9c 100644 --- a/src/boolean45/mod.rs +++ b/src/boolean45/mod.rs @@ -3,8 +3,7 @@ use std::mem; use std::collections::HashMap; -use std::fmt::Debug; -use crate::{Manifold, Real, Vec3, Half, Tref, face_of}; +use crate::{Data, Manifold, Real, Vec3, Half, Tref, face_of}; use crate::boolean03::Boolean03; use crate::bounds::BBox; use crate::OpType; @@ -41,9 +40,9 @@ fn exclusive_scan(input: &[i32], output: &mut [i32], offset: i32) { } } -fn size_output( - mp: &Manifold, - mq: &Manifold, +fn size_output( + mp: &Manifold, + mq: &Manifold, i03: &[i32], i30: &[i32], i12: &[i32], @@ -326,9 +325,9 @@ pub struct Boolean45 { pub nv_from_q: usize, } -pub fn boolean45( - mp: &Manifold, - mq: &Manifold, +pub fn boolean45( + mp: &Manifold, + mq: &Manifold, b03: &Boolean03, op: &OpType ) -> Boolean45 { diff --git a/src/compose/cone.rs b/src/compose/cone.rs index 521060d..541843f 100644 --- a/src/compose/cone.rs +++ b/src/compose/cone.rs @@ -2,16 +2,15 @@ //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. use std::f64::consts::PI; -use std::fmt::Debug; -use crate::{Manifold, Vec3, Real, compute_orthogonal}; +use crate::{Manifold, Vec3, Real, compute_orthogonal, Data}; use crate::common::Vec3u; -pub fn generate_cone( +pub fn generate_cone( apex: Vec3, center: Vec3, radius: Real, divide: usize, -) -> Result, String> { +) -> Result, String> { let d = (PI * 2. / divide as f64) as Real; let n = (center - apex).normalize(); let b1 = compute_orthogonal(n); diff --git a/src/compose/cube.rs b/src/compose/cube.rs index c7a1fb6..417af20 100644 --- a/src/compose/cube.rs +++ b/src/compose/cube.rs @@ -1,10 +1,9 @@ //--- Copyright (C) 2025 Saki Komikado , //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. -use std::fmt::Debug; -use crate::manifold::Manifold; +use crate::{Data, Manifold}; -pub fn generate_cube() -> Result, String> { +pub fn generate_cube() -> Result, String> { let ps = [ -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, diff --git a/src/compose/cylinder.rs b/src/compose/cylinder.rs index 450714c..70fbbcc 100644 --- a/src/compose/cylinder.rs +++ b/src/compose/cylinder.rs @@ -2,15 +2,14 @@ //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. use std::f64::consts::PI; -use std::fmt::Debug; -use crate::{Manifold, Vec3, Vec3u, Real}; +use crate::{Data, Manifold, Vec3, Vec3u, Real}; -pub fn generate_cylinder( +pub fn generate_cylinder( r: f64, // radius h: f64, // height d0: usize, // sectors d1: usize, // stacks -) -> Result, String> { +) -> Result, String> { if d0 < 3 || d1 < 1 { return Err("sectors must be >= 3 and stacks must be >= 1".into()); } let mut ps = vec![]; let mut ts = vec![]; diff --git a/src/compose/mod.rs b/src/compose/mod.rs index b931cad..4aca1a6 100644 --- a/src/compose/mod.rs +++ b/src/compose/mod.rs @@ -8,19 +8,18 @@ pub mod sphere; pub mod torus; pub mod cylinder; -use std::fmt::Debug; pub use cone::*; pub use cube::*; pub use sphere::*; pub use torus::*; pub use cylinder::*; -use crate::{Manifold, Vec3, K_PRECISION}; +use crate::{Data, Manifold, Vec3, K_PRECISION}; use crate::common::{compute_aa_proj, get_aa_proj_matrix, Vec3u}; use crate::triangulation::ear_clip::EarClip; use crate::triangulation::Pt; -pub fn extrude(pts: &[Vec3], offset: Vec3) -> Result, String> { +pub fn extrude(pts: &[Vec3], offset: Vec3) -> Result, String> { let n = Vec3::new(0., 0., 1.); let proj = get_aa_proj_matrix(&n); let poly = pts.iter().enumerate().map(|(i, p)| Pt {pos: compute_aa_proj(&proj, p), idx: i}).collect::>(); @@ -41,7 +40,7 @@ pub fn extrude(pts: &[Vec3], offset: Manifold::new_impl(oft_ps, oft_ts, vec![], None, None) } -pub fn compose(ms: &Vec>) -> Result, String> { +pub fn compose(ms: &Vec>) -> Result, String> { let mut ps = vec![]; let mut ts = vec![]; let mut offset = 0; @@ -57,9 +56,9 @@ pub fn compose(ms: &Vec> Manifold::new(&ps, &ts) } -pub fn fractal( - hole : &Manifold, - holes: &mut Vec>, +pub fn fractal( + hole : &Manifold<()>, + holes: &mut Vec>, x: f64, y: f64, w: f64, diff --git a/src/compose/sphere.rs b/src/compose/sphere.rs index 98f4272..22a2069 100644 --- a/src/compose/sphere.rs +++ b/src/compose/sphere.rs @@ -3,13 +3,12 @@ use std::collections::HashMap; use std::f64::consts::PI; -use std::fmt::Debug; -use crate::{Manifold, Vec3, Vec3u, Real}; +use crate::{Data, Manifold, Vec3, Vec3u, Real}; -pub fn generate_uv_sphere( +pub fn generate_uv_sphere( d0: usize, // sectors d1: usize, // stacks -) -> Result, String> { +) -> Result, String> { if d0 < 3 || d1 < 2 { return Err("sectors must be >= 3 and stacks must be >= 2".into()); } let mut ps = vec![]; @@ -46,7 +45,7 @@ pub fn generate_uv_sphere( Manifold::new_impl(ps, ts, vec![], None, None) } -pub fn generate_icosphere(subdivisions: u32) -> Result, String> { +pub fn generate_icosphere(subdivisions: u32) -> Result, String> { let phi = ((1. + 5.0f32.sqrt()) / 2.) as Real; let mut ps = vec![ diff --git a/src/compose/torus.rs b/src/compose/torus.rs index a7621d8..0e4b655 100644 --- a/src/compose/torus.rs +++ b/src/compose/torus.rs @@ -2,14 +2,14 @@ //--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. use std::f64::consts::PI; -use crate::{Manifold, Vec3, Vec3u, Real}; +use crate::{Data, Manifold, Vec3, Vec3u, Real}; -pub fn generate_torus( +pub fn generate_torus( r0: f64, // major radius r1: f64, // minor radius d0: usize, // rings d1: usize, // sectors -) -> Result, String> { +) -> Result, String> { let mut ps = Vec::with_capacity(d0 * d1); let mut ts = Vec::with_capacity(d0 * d1 * 6); diff --git a/src/lib.rs b/src/lib.rs index 683944c..e89d42f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,6 @@ mod boolean45; mod compose; mod tests; -use std::fmt::Debug; use crate::boolean03::boolean03; use crate::boolean45::boolean45; use crate::simplification::simplify_topology; @@ -24,6 +23,9 @@ use crate::manifold::*; pub use crate::common::{Real, Vec2, Vec3, Vec4, Mat3, K_PRECISION}; +pub trait Data: Clone + Send + Sync + std::fmt::Debug + PartialEq {} +impl Data for T where T: Clone + Send + Sync + std::fmt::Debug + PartialEq {} + pub mod prelude { pub use crate::common::OpType; pub use crate::manifold::Manifold; @@ -41,11 +43,11 @@ pub mod prelude { }; } -pub fn compute_boolean( - mp: &Manifold, - mq: &Manifold, +pub fn compute_boolean( + mp: &Manifold, + mq: &Manifold, op: OpType, -) -> Result, String> { +) -> Result, String> { let eps = mp.eps.max(mq.eps); let tol = mp.tol.max(mq.tol); @@ -70,6 +72,12 @@ pub fn compute_boolean( ); let mut inh = vec![]; + let mut idx = vec![]; + + for h in trg.hs.chunks(3) { + idx.push(Vec3u::new(h[0].tail, h[1].tail, h[2].tail)); + } + if !mp.inh.is_empty() && !mq.inh.is_empty() { for r in trg.rs.iter() { if r.mid == 0 { inh.push(mp.inh[r.fid].clone()) } @@ -77,13 +85,7 @@ pub fn compute_boolean( } } - Manifold::new_impl( - b45.ps, - trg.hs.chunks(3).map(|hs| Vec3u::new(hs[0].tail, hs[1].tail, hs[2].tail)).collect(), - inh, - Some(eps), - Some(tol) - ) + Manifold::new_impl(b45.ps, idx, inh, Some(eps), Some(tol)) } diff --git a/src/manifold/mod.rs b/src/manifold/mod.rs index e977a41..3a33fe9 100644 --- a/src/manifold/mod.rs +++ b/src/manifold/mod.rs @@ -10,7 +10,7 @@ use std::fmt::Debug; use bounds::BBox; use hmesh::Hmesh; use collider::{morton_code, MortonCollider, K_NO_CODE}; -use crate::{Tref, Half, Real, Vec3, Vec2u, Vec3u, K_PRECISION, next_of, Mat3}; +use crate::{Data, Mat3, Tref, Half, Real, Vec3, Vec3u, K_PRECISION, next_of}; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -32,7 +32,7 @@ pub struct Manifold { pub coplanar: Vec, // indices of coplanar faces } -impl Manifold { +impl Manifold { pub fn new(pos: &[f64], idx: &[usize]) -> Result { Self::new_impl( pos.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect(), @@ -44,7 +44,7 @@ impl Manifold { pub fn new_impl( ps : Vec, idx: Vec, - inh: Vec, + inh: Vec, eps: Option, tol: Option, ) -> Result { @@ -128,10 +128,7 @@ impl Manifold { *self = Manifold::new_impl(p, self.get_indices(), self.inh.clone(), None, None).unwrap(); } - pub fn set_inheritances( - &mut self, - val: Vec - ) { + pub fn set_inheritances(&mut self, val: Vec) { *self = Manifold::new_impl( self.ps.clone(), self.get_indices(), @@ -182,10 +179,10 @@ fn compute_face_morton( (bbs, mts) } -fn sort_faces( +fn sort_faces( pos: &[Vec3], idx: &[Vec3u], - inh: &mut Vec, + inh: &mut Vec, face_bboxes: &mut Vec, face_morton: &mut Vec ) -> Result { @@ -277,15 +274,8 @@ pub fn cleanup_unused_verts( new2old.truncate(nv); - let mut rs_ = vec![]; - for i in 0..hs.len() / 3 { - let j = i * 3; - if hs[j].pair().is_none() { continue; } - rs_.push(rs[i].clone()); - } - *ps = new2old.iter().map(|&i| ps[i]).collect(); + *rs = hs.chunks(3).enumerate().filter_map(|(i, t)| t[0].pair().map(|_| rs[i].clone())).collect(); *hs = hs.iter().filter(|h| h.pair().is_some()).cloned().collect(); - *rs = rs_; } diff --git a/src/triangulation/mod.rs b/src/triangulation/mod.rs index 9d142bb..2fa056a 100644 --- a/src/triangulation/mod.rs +++ b/src/triangulation/mod.rs @@ -6,9 +6,8 @@ pub mod flat_tree; pub mod tri_halfs; use std::collections::{BTreeMap, VecDeque}; -use std::fmt::Debug; use crate::boolean45::Boolean45; -use crate::{Manifold, Vec2, Vec3, Vec3u, Half, Tref, get_aa_proj_matrix, compute_aa_proj, is_ccw_3d, Real}; +use crate::{Data, Real, Manifold, Vec2, Vec3, Vec3u, Half, Tref, get_aa_proj_matrix, compute_aa_proj, is_ccw_3d}; use crate::triangulation::ear_clip::EarClip; use crate::triangulation::tri_halfs::tri_halfs_single; #[cfg(feature = "rayon")] use rayon::prelude::*; @@ -20,9 +19,9 @@ pub struct Triangulation { pub ns: Vec, } -pub fn triangulate( - mp: &Manifold, - mq: &Manifold, +pub fn triangulate( + mp: &Manifold, + mq: &Manifold, b45: &Boolean45, eps: Real, ) -> Result { @@ -198,9 +197,9 @@ pub struct Pt { pub idx: usize } -fn update_reference( - mp: &Manifold, - mq: &Manifold, +fn update_reference( + mp: &Manifold, + mq: &Manifold, rs: &mut[Tref], ) { for r in rs.iter_mut() { From b71da03d192d92191567f8989fcb67f88fa3642a Mon Sep 17 00:00:00 2001 From: sakikomikado Date: Fri, 30 Jan 2026 18:06:27 +0900 Subject: [PATCH 4/5] function on 2-mfd --- examples/menger_sponge.rs | 26 +++++---- examples/multiple_models.rs | 2 +- examples/primitives_demo.rs | 25 +++------ src/compose/cube.rs | 6 +- src/lib.rs | 10 ++-- src/manifold/mod.rs | 107 +++++++++++++++++++++--------------- src/tests.rs | 12 ++-- 7 files changed, 101 insertions(+), 87 deletions(-) diff --git a/examples/menger_sponge.rs b/examples/menger_sponge.rs index e08ad3b..3f9db54 100644 --- a/examples/menger_sponge.rs +++ b/examples/menger_sponge.rs @@ -77,20 +77,22 @@ pub fn menger_sponge(n: usize) -> Manifold<()> { let holes_z = compose(&holes).unwrap(); let rot = |rx: f64, ry: f64, rz: f64| { - let ts = holes_z.hs.iter().map(|h| h.tail).collect::>(); let mut ps = holes_z.ps.clone(); - let x = rx as boolmesh::Real; - let y = ry as boolmesh::Real; - let z = rz as boolmesh::Real; - let r = boolmesh::Mat3::from_euler(glam::EulerRot::XYZ, x, y, z); - for p in ps.iter_mut() { *p = r * *p; } - let mut flat = vec![]; - for p in ps { - flat.push(if (p.x - 0.5).abs() < 1e-4 { 0.5 } else if (p.x + 0.5).abs() < 1e-4 { -0.5 } else { p.x as f64}); - flat.push(if (p.y - 0.5).abs() < 1e-4 { 0.5 } else if (p.y + 0.5).abs() < 1e-4 { -0.5 } else { p.y as f64}); - flat.push(if (p.z - 0.5).abs() < 1e-4 { 0.5 } else if (p.z + 0.5).abs() < 1e-4 { -0.5 } else { p.z as f64}); + let r = boolmesh::Mat3::from_euler( + glam::EulerRot::XYZ, + rx as boolmesh::Real, + ry as boolmesh::Real, + rz as boolmesh::Real + ); + for p in ps.iter_mut() { + let mut v = r * *p; + v.x = if (v.x - 0.5).abs() < 1e-4 { 0.5 } else if (v.x + 0.5).abs() < 1e-4 { -0.5 } else { v.x }; + v.y = if (v.y - 0.5).abs() < 1e-4 { 0.5 } else if (v.y + 0.5).abs() < 1e-4 { -0.5 } else { v.y }; + v.z = if (v.z - 0.5).abs() < 1e-4 { 0.5 } else if (v.z + 0.5).abs() < 1e-4 { -0.5 } else { v.z }; + *p = v; + } - Manifold::new(&flat, &ts).unwrap() + Manifold::new(ps, &holes_z.hs.iter().map(|h| h.tail).collect::>()).unwrap() }; let holes_x = rot(PI / 2., 0., 0.); diff --git a/examples/multiple_models.rs b/examples/multiple_models.rs index fe65ebe..6f28560 100644 --- a/examples/multiple_models.rs +++ b/examples/multiple_models.rs @@ -39,7 +39,7 @@ fn setup( let mut mfs: Vec> = vec![]; for m in vec![&m0[0].mesh, &m1[0].mesh] { mfs.push(Manifold::new( - &m.positions.iter().map(|&v| v as f64).collect::>(), + &m.positions, &m.indices.iter().map(|&v| v as usize).collect::>(), ).unwrap()); } diff --git a/examples/primitives_demo.rs b/examples/primitives_demo.rs index 96008ec..8cb0f5b 100644 --- a/examples/primitives_demo.rs +++ b/examples/primitives_demo.rs @@ -33,30 +33,21 @@ fn setup( let mut mfd0 = generate_cube().unwrap(); let mut mfd1 = generate_cylinder(0.4, 1., 50, 10).unwrap(); let mut mfd2 = generate_cube().unwrap(); - let idcs1 = mfd1.get_indices(); + let idcs1 = mfd1.hs.chunks(3).map(|cs| [cs[0].tail, cs[1].tail, cs[2].tail]).collect::>(); - mfd0.set_inheritances((0..mfd0.nf).map(|i| boolmesh::Vec2::new(1., i as f64)).collect::>()); + mfd0.set_inheritances((0..mfd0.nf).map(|i| Vec2::new(1., i as f32)).collect::>()); mfd1.set_inheritances((0..mfd1.nf).map(|i| { let idcs = idcs1[i]; let p0 = mfd1.ps[idcs[0]]; let p1 = mfd1.ps[idcs[1]]; let p2 = mfd1.ps[idcs[2]]; - boolmesh::Vec2::new(2., (p0 + p1 + p2).y as f64 / 3. + 0.5) + Vec2::new(2., (p0 + p1 + p2).y as f32 / 3. + 0.5) }).collect::>()); - mfd2.set_inheritances((0..mfd2.nf).map(|i| boolmesh::Vec2::new(3., i as f64)).collect::>()); + mfd2.set_inheritances((0..mfd2.nf).map(|i| Vec2::new(3., i as f32)).collect::>()); mfd1.translate(0.5, 0., 0.25); mfd2.translate(-0.5, 0.5, 0.5); - let mut map1 = vec![]; - for i in 0..mfd1.nf { - let idcs = idcs1[i]; - let p0 = mfd1.ps[idcs[0]]; - let p1 = mfd1.ps[idcs[1]]; - let p2 = mfd1.ps[idcs[2]]; - map1.push((p0 + p1 + p2).y / 3. + 0.5); - } - let res = compute_boolean(&mfd0, &mfd1, OpType::Subtract).unwrap(); let res = compute_boolean(&res, &mfd2, OpType::Subtract).unwrap(); @@ -77,11 +68,11 @@ fn setup( let p1 = res.ps[hs[1].tail]; let p2 = res.ps[hs[2].tail]; let n = res.face_normals[fid]; - let inh = res.inh[fid]; + let var = res.var[fid]; let mut c = [0., 0., 0., 1.]; - if inh.x as usize == 1 { c[0] = 1.; } - if inh.x as usize == 2 { c[1] = inh.y as f32; } - if inh.x as usize == 3 { c[2] = 1.; } + if var.x as usize == 1 { c[0] = 1.; } + if var.x as usize == 2 { c[1] = var.y as f32; } + if var.x as usize == 3 { c[2] = 1.; } pos.push([p0.x as f32, p0.y as f32, p0.z as f32]); pos.push([p1.x as f32, p1.y as f32, p1.z as f32]); diff --git a/src/compose/cube.rs b/src/compose/cube.rs index 417af20..145f62f 100644 --- a/src/compose/cube.rs +++ b/src/compose/cube.rs @@ -4,7 +4,7 @@ use crate::{Data, Manifold}; pub fn generate_cube() -> Result, String> { - let ps = [ + let ps: [f64; 24] = [ -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, @@ -15,7 +15,7 @@ pub fn generate_cube() -> Result, String> { 0.5, 0.5, 0.5 ]; - let ts = [ + let ts: [usize; 36] = [ 1, 0, 4, 2, 4, 0, 1, 3, 0, 3, 1, 5, 3, 2, 0, 3, 7, 2, @@ -23,5 +23,5 @@ pub fn generate_cube() -> Result, String> { 6, 4, 2, 7, 6, 2, 7, 3, 5, 7, 5, 6 ]; - Manifold::new(&ps, &ts) + Manifold::new(&ps[..], &ts[..]) } diff --git a/src/lib.rs b/src/lib.rs index e89d42f..86ff6af 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,21 +71,21 @@ pub fn compute_boolean( &mut trg.rs ); - let mut inh = vec![]; + let mut var = vec![]; let mut idx = vec![]; for h in trg.hs.chunks(3) { idx.push(Vec3u::new(h[0].tail, h[1].tail, h[2].tail)); } - if !mp.inh.is_empty() && !mq.inh.is_empty() { + if !mp.var.is_empty() && !mq.var.is_empty() { for r in trg.rs.iter() { - if r.mid == 0 { inh.push(mp.inh[r.fid].clone()) } - else { inh.push(mq.inh[r.fid].clone()) } + if r.mid == 0 { var.push(mp.var[r.fid].clone()) } + else { var.push(mq.var[r.fid].clone()) } } } - Manifold::new_impl(b45.ps, idx, inh, Some(eps), Some(tol)) + Manifold::new_impl(b45.ps, idx, var, Some(eps), Some(tol)) } diff --git a/src/manifold/mod.rs b/src/manifold/mod.rs index 3a33fe9..b74a2d1 100644 --- a/src/manifold/mod.rs +++ b/src/manifold/mod.rs @@ -13,10 +13,8 @@ use collider::{morton_code, MortonCollider, K_NO_CODE}; use crate::{Data, Mat3, Tref, Half, Real, Vec3, Vec3u, K_PRECISION, next_of}; #[cfg(feature = "rayon")] use rayon::prelude::*; - - #[derive(Clone, Debug)] -pub struct Manifold { +pub struct Manifold { pub ps: Vec, // positions pub hs: Vec, // halfedges pub nv: usize, // number of vertices @@ -24,7 +22,7 @@ pub struct Manifold { pub nh: usize, // number of halfedges pub eps: Real, // epsilon pub tol: Real, // tolerance - pub inh: Vec, // + pub var: Vec, // variable on the mfd pub bounding_box: BBox, // pub face_normals: Vec, // pub vert_normals: Vec, // @@ -33,25 +31,22 @@ pub struct Manifold { } impl Manifold { - pub fn new(pos: &[f64], idx: &[usize]) -> Result { - Self::new_impl( - pos.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect(), - idx.chunks(3).map(|i| Vec3u::new(i[0], i[1], i[2])).collect(), - vec![], None, None - ) + pub fn new(ps: P, ts: I) -> Result { + Self::new_impl(ps, ts, vec![], None, None) } - pub fn new_impl( - ps : Vec, - idx: Vec, - inh: Vec, + pub fn new_impl( + ps: P, + ts: I, + mut var: Vec, eps: Option, tol: Option, ) -> Result { + let ps = ps.into_vec3f(); + let ts = ts.into_vec3u(); let bb = BBox::new(None, &ps); - let (mut f_bb, mut f_mt) = compute_face_morton(&ps, &idx, &bb); - let mut inh_ = inh.clone(); - let hm = sort_faces(&ps, &idx, &mut inh_, &mut f_bb, &mut f_mt)?; + let (mut f_bb, mut f_mt) = compute_face_morton(&ps, &ts, &bb); + let hm = sort_faces(&ps, &ts, &mut var, &mut f_bb, &mut f_mt)?; let hs = hm.half.iter().map(|&i| Half::new(hm.tail[i], hm.head[i], hm.twin[i])).collect::>(); let mut e = K_PRECISION * bb.scale(); @@ -70,7 +65,7 @@ impl Manifold { bounding_box: bb, vert_normals: hm.vns, face_normals: hm.fns, - inh: inh_, + var, eps, tol, collider, @@ -81,18 +76,14 @@ impl Manifold { Ok(mfd) } - pub fn get_indices(&self) -> Vec { - self.hs.chunks(3).map(|cs| Vec3u::new(cs[0].tail, cs[1].tail, cs[2].tail)).collect() - } - - pub fn set_epsilon(&mut self, min_epsilon: Real, use_single: bool) { - let scl = self.bounding_box.scale(); - let mut e = min_epsilon.max(K_PRECISION * scl); - e = if e.is_finite() { e } else { -1. }; - let t = if use_single { e.max(Real::EPSILON * scl) } else { e }; - self.eps = e; - self.tol = self.tol.max(t); - } + //fn set_epsilon(&mut self, min_epsilon: Real, use_single: bool) { + // let scl = self.bounding_box.scale(); + // let mut e = min_epsilon.max(K_PRECISION * scl); + // e = if e.is_finite() { e } else { -1. }; + // let t = if use_single { e.max(Real::EPSILON * scl) } else { e }; + // self.eps = e; + // self.tol = self.tol.max(t); + //} pub fn is_manifold(&self) -> bool { self.hs.iter().enumerate().all(|(i, h)| { @@ -113,30 +104,30 @@ impl Manifold { pub fn translate(&mut self, x: f64, y: f64, z: f64) { let t = Vec3::new(x as Real, y as Real, z as Real); - let p = self.ps.iter().map(|p| *p + t).collect(); - *self = Manifold::new_impl(p, self.get_indices(), self.inh.clone(), None, None).unwrap(); + let p = self.ps.iter().map(|p| *p + t).collect::>(); + let i = self.hs.iter().map(|h| h.tail).collect::>(); + *self = Manifold::new_impl(p, &i, self.var.clone(), None, None).unwrap(); } pub fn rotate(&mut self, x: f64, y: f64, z: f64) { let r = Mat3::from_euler(glam::EulerRot::XYZ, x as Real, y as Real, z as Real); - let p = self.ps.iter().map(|p| r * *p).collect(); - *self = Manifold::new_impl(p, self.get_indices(), self.inh.clone(), None, None).unwrap(); + let p = self.ps.iter().map(|p| r * *p).collect::>(); + let i = self.hs.iter().map(|h| h.tail).collect::>(); + *self = Manifold::new_impl(p, &i, self.var.clone(), None, None).unwrap(); } pub fn scale(&mut self, x: f64, y: f64, z: f64) { - let p = self.ps.iter().map(|p| Vec3::new(p.x * x as Real, p.y * y as Real, p.z * z as Real)).collect(); - *self = Manifold::new_impl(p, self.get_indices(), self.inh.clone(), None, None).unwrap(); + let p = self.ps.iter().map(|p| Vec3::new(p.x * x as Real, p.y * y as Real, p.z * z as Real)).collect::>(); + let i = self.hs.iter().map(|h| h.tail).collect::>(); + *self = Manifold::new_impl(p, &i, self.var.clone(), None, None).unwrap(); } pub fn set_inheritances(&mut self, val: Vec) { *self = Manifold::new_impl( self.ps.clone(), - self.get_indices(), - val, - None, None - ).unwrap(); + &self.hs.iter().map(|h| h.tail).collect::>(), + val, None, None).unwrap(); } - } fn compute_face_morton( @@ -182,7 +173,7 @@ fn compute_face_morton( fn sort_faces( pos: &[Vec3], idx: &[Vec3u], - inh: &mut Vec, + var: &mut Vec, face_bboxes: &mut Vec, face_morton: &mut Vec ) -> Result { @@ -190,7 +181,7 @@ fn sort_faces( map.sort_by_key(|&i| face_morton[i]); *face_bboxes = map.iter().map(|&i| face_bboxes[i].clone()).collect::>(); *face_morton = map.iter().map(|&i| face_morton[i]).collect::>(); - if !inh.is_empty() { *inh = map.iter().map(|&i| inh[i].clone()).collect(); } + if !var.is_empty() { *var = map.iter().map(|&i| var[i].clone()).collect(); } Hmesh::new(pos, &map.iter().map(|&i| idx[i]).collect::>()) } @@ -279,3 +270,33 @@ pub fn cleanup_unused_verts( *hs = hs.iter().filter(|h| h.pair().is_some()).cloned().collect(); } + +pub trait IntoVec3f { fn into_vec3f(self) -> Vec; } +pub trait IntoVec3u { fn into_vec3u(self) -> Vec; } + +impl IntoVec3f for &[f32] { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &[f64] { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &[[f32; 3]] { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &[[f64; 3]] { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &Vec<[f32; 3]> { fn into_vec3f(self) -> Vec { self.into_iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &Vec<[f64; 3]> { fn into_vec3f(self) -> Vec { self.into_iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &Vec { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &Vec { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &[Vec3] { fn into_vec3f(self) -> Vec { self.to_vec() } } +impl IntoVec3f for Vec { fn into_vec3f(self) -> Vec { self }} + +impl IntoVec3u for &[u32] { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &[u64] { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &[usize] { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0], p[1], p[2])).collect() }} +impl IntoVec3u for &[[u32; 3]] { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &[[u64; 3]] { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &[[usize; 3]] { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } +impl IntoVec3u for &Vec<[u32; 3]> { fn into_vec3u(self) -> Vec { self.into_iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &Vec<[u64; 3]> { fn into_vec3u(self) -> Vec { self.into_iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &Vec<[usize; 3]> { fn into_vec3u(self) -> Vec { self.into_iter().map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } +impl IntoVec3u for &Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() } } +impl IntoVec3u for &Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() } } +impl IntoVec3u for &Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } +impl IntoVec3u for &[Vec3u] { fn into_vec3u(self) -> Vec { self.to_vec() } } +impl IntoVec3u for Vec { fn into_vec3u(self) -> Vec { self } } + diff --git a/src/tests.rs b/src/tests.rs index 9762343..390ec2d 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -12,22 +12,22 @@ mod test_intersection { pub fn gen_tet_a() -> Manifold<()> { Manifold::new( - &vec![-0.866025, -1., 0.5, 0., -1., -1., 0.866025, -1., 0.5, 0., 1., 0.], - &vec![0, 3, 1, 1, 2, 0, 1, 3, 2, 2, 3, 0], + [-0.866025, -1., 0.5, 0., -1., -1., 0.866025, -1., 0.5, 0., 1., 0.].as_ref(), + [0, 3, 1, 1, 2, 0, 1, 3, 2, 2, 3, 0u32].as_ref(), ).unwrap() } pub fn gen_tet_b() -> Manifold<()> { Manifold::new( - &vec![-1., -0.866025, 0.5, -1., 0., -1., -1., 0.866025, 0.5, 1., 0., 0.], - &vec![1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2], + [-1., -0.866025, 0.5, -1., 0., -1., -1., 0.866025, 0.5, 1., 0., 0.].as_ref(), + [1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2u32].as_ref(), ).unwrap() } pub fn gen_tet_c() -> Manifold<()> { Manifold::new( - &vec![-2., -0.866025, 0.5, -2., -0., -1., -2., 0.866025, 0.5, 0., 0., 0.], - &vec![1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2], + [-2., -0.866025, 0.5, -2., -0., -1., -2., 0.866025, 0.5, 0., 0., 0.].as_ref(), + [1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2u32].as_ref(), ).unwrap() } From 24e040f3b4383b53643d9b26b3b767b8330dd0f7 Mon Sep 17 00:00:00 2001 From: sakikomikado Date: Sat, 31 Jan 2026 13:25:20 +0900 Subject: [PATCH 5/5] function on 2-mfd wip --- examples/menger_sponge.rs | 4 +- examples/multiple_models.rs | 3 +- examples/primitives_demo.rs | 8 +- src/cleanup.rs | 40 +++++++++ src/compose/cone.rs | 2 +- src/compose/cube.rs | 2 +- src/compose/cylinder.rs | 2 +- src/compose/mod.rs | 4 +- src/compose/sphere.rs | 4 +- src/compose/torus.rs | 2 +- src/lib.rs | 30 ++++--- src/manifold/mod.rs | 173 +++++++++++++++++------------------- src/tests.rs | 3 + 13 files changed, 156 insertions(+), 121 deletions(-) create mode 100644 src/cleanup.rs diff --git a/examples/menger_sponge.rs b/examples/menger_sponge.rs index 3f9db54..d2fc757 100644 --- a/examples/menger_sponge.rs +++ b/examples/menger_sponge.rs @@ -34,7 +34,7 @@ fn setup( ) { let now = Instant::now(); - let num = 3; + let num = 4; let res = menger_sponge(num); println!(">>>>>>>>>>>>>> Compute a menger sponge of level {}, elapsed time: {:?}", num, now.elapsed()); @@ -92,7 +92,7 @@ pub fn menger_sponge(n: usize) -> Manifold<()> { *p = v; } - Manifold::new(ps, &holes_z.hs.iter().map(|h| h.tail).collect::>()).unwrap() + Manifold::new(ps, holes_z.hs.iter().map(|h| h.tail).collect::>(), None, None, None).unwrap() }; let holes_x = rot(PI / 2., 0., 0.); diff --git a/examples/multiple_models.rs b/examples/multiple_models.rs index 6f28560..b14b64b 100644 --- a/examples/multiple_models.rs +++ b/examples/multiple_models.rs @@ -40,7 +40,8 @@ fn setup( for m in vec![&m0[0].mesh, &m1[0].mesh] { mfs.push(Manifold::new( &m.positions, - &m.indices.iter().map(|&v| v as usize).collect::>(), + &m.indices, + None, None, None ).unwrap()); } mfs.push(compute_boolean(&mfs[0], &mfs[1], OpType::Subtract).unwrap()); diff --git a/examples/primitives_demo.rs b/examples/primitives_demo.rs index 8cb0f5b..d81ae02 100644 --- a/examples/primitives_demo.rs +++ b/examples/primitives_demo.rs @@ -35,8 +35,8 @@ fn setup( let mut mfd2 = generate_cube().unwrap(); let idcs1 = mfd1.hs.chunks(3).map(|cs| [cs[0].tail, cs[1].tail, cs[2].tail]).collect::>(); - mfd0.set_inheritances((0..mfd0.nf).map(|i| Vec2::new(1., i as f32)).collect::>()); - mfd1.set_inheritances((0..mfd1.nf).map(|i| { + mfd0.set_variable((0..mfd0.nf).map(|i| Vec2::new(1., i as f32)).collect::>()); + mfd1.set_variable((0..mfd1.nf).map(|i| { let idcs = idcs1[i]; let p0 = mfd1.ps[idcs[0]]; let p1 = mfd1.ps[idcs[1]]; @@ -44,7 +44,7 @@ fn setup( Vec2::new(2., (p0 + p1 + p2).y as f32 / 3. + 0.5) }).collect::>()); - mfd2.set_inheritances((0..mfd2.nf).map(|i| Vec2::new(3., i as f32)).collect::>()); + mfd2.set_variable((0..mfd2.nf).map(|i| Vec2::new(3., i as f32)).collect::>()); mfd1.translate(0.5, 0., 0.25); mfd2.translate(-0.5, 0.5, 0.5); @@ -68,7 +68,7 @@ fn setup( let p1 = res.ps[hs[1].tail]; let p2 = res.ps[hs[2].tail]; let n = res.face_normals[fid]; - let var = res.var[fid]; + let var = res.variable.as_ref().unwrap()[fid]; let mut c = [0., 0., 0., 1.]; if var.x as usize == 1 { c[0] = 1.; } if var.x as usize == 2 { c[1] = var.y as f32; } diff --git a/src/cleanup.rs b/src/cleanup.rs new file mode 100644 index 0000000..1006235 --- /dev/null +++ b/src/cleanup.rs @@ -0,0 +1,40 @@ +//--- Copyright (C) 2025 Saki Komikado , +//--- This Source Code Form is subject to the terms of the Mozilla Public License v.2.0. + +use crate::common::{Half, Tref}; +use crate::manifold::bounds::BBox; +use crate::manifold::collider::{morton_code, K_NO_CODE}; +use crate::Vec3; + +pub fn cleanup_unused_verts( + ps: &mut Vec, + hs: &mut Vec, + rs: &mut Vec, +) { + let bb = BBox::new(None, ps); + let mt = ps.iter().map(|p| morton_code(p, &bb)).collect::>(); + + let mut new2old = (0..ps.len()).collect::>(); + let mut old2new = vec![0; ps.len()]; + new2old.sort_by_key(|&i| mt[i]); + for (new, &old) in new2old.iter().enumerate() { old2new[old] = new; } + + // reindex verts + for h in hs.iter_mut() { + if h.pair().is_none() { continue; } + h.tail = old2new[h.tail]; + h.head = old2new[h.head]; + } + + // truncate pos container + let nv = new2old + .iter() + .position(|&v| mt[v] >= K_NO_CODE) + .unwrap_or(new2old.len()); + + new2old.truncate(nv); + + *ps = new2old.iter().map(|&i| ps[i]).collect(); + *rs = hs.chunks(3).enumerate().filter_map(|(i, t)| t[0].pair().map(|_| rs[i].clone())).collect(); + *hs = hs.iter().filter(|h| h.pair().is_some()).cloned().collect(); +} diff --git a/src/compose/cone.rs b/src/compose/cone.rs index 541843f..c312122 100644 --- a/src/compose/cone.rs +++ b/src/compose/cone.rs @@ -29,5 +29,5 @@ pub fn generate_cone( ps.push(apex); ps.push(center); - Manifold::new_impl(ps, ts, vec![], None, None) + Manifold::new(ps, ts, None, None, None) } \ No newline at end of file diff --git a/src/compose/cube.rs b/src/compose/cube.rs index 145f62f..8f1c115 100644 --- a/src/compose/cube.rs +++ b/src/compose/cube.rs @@ -23,5 +23,5 @@ pub fn generate_cube() -> Result, String> { 6, 4, 2, 7, 6, 2, 7, 3, 5, 7, 5, 6 ]; - Manifold::new(&ps[..], &ts[..]) + Manifold::new(&ps[..], &ts[..], None, None, None) } diff --git a/src/compose/cylinder.rs b/src/compose/cylinder.rs index 70fbbcc..5f03152 100644 --- a/src/compose/cylinder.rs +++ b/src/compose/cylinder.rs @@ -45,5 +45,5 @@ pub fn generate_cylinder( } } - Manifold::new_impl(ps, ts, vec![], None, None) + Manifold::new(ps, ts, None, None, None) } \ No newline at end of file diff --git a/src/compose/mod.rs b/src/compose/mod.rs index 4aca1a6..02a3cfd 100644 --- a/src/compose/mod.rs +++ b/src/compose/mod.rs @@ -37,7 +37,7 @@ pub fn extrude(pts: &[Vec3], offset: Vec3) -> Result, Strin oft_ts.push(Vec3u::new(i, j, i + n)); oft_ts.push(Vec3u::new(i + n, j, j + n)); } - Manifold::new_impl(oft_ps, oft_ts, vec![], None, None) + Manifold::new(oft_ps, oft_ts, None, None, None) } pub fn compose(ms: &Vec>) -> Result, String> { @@ -53,7 +53,7 @@ pub fn compose(ms: &Vec>) -> Result, String> { } offset += m.nv; } - Manifold::new(&ps, &ts) + Manifold::new(&ps, &ts, None, None, None) } pub fn fractal( diff --git a/src/compose/sphere.rs b/src/compose/sphere.rs index 22a2069..7f2a257 100644 --- a/src/compose/sphere.rs +++ b/src/compose/sphere.rs @@ -42,7 +42,7 @@ pub fn generate_uv_sphere( } } - Manifold::new_impl(ps, ts, vec![], None, None) + Manifold::new(ps, ts, None, None, None) } pub fn generate_icosphere(subdivisions: u32) -> Result, String> { @@ -120,5 +120,5 @@ pub fn generate_icosphere(subdivisions: u32) -> Result, String> { ts = ts_; } - Manifold::new_impl(ps, ts, vec![], None, None) + Manifold::new(ps, ts, None, None, None) } \ No newline at end of file diff --git a/src/compose/torus.rs b/src/compose/torus.rs index 0e4b655..2326be8 100644 --- a/src/compose/torus.rs +++ b/src/compose/torus.rs @@ -41,5 +41,5 @@ pub fn generate_torus( } } - Manifold::new_impl(ps, ts, vec![], None, None) + Manifold::new(ps, ts, None, None, None) } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 86ff6af..d8ad28e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,12 +13,13 @@ mod boolean03; mod boolean45; mod compose; mod tests; - +mod cleanup; use crate::boolean03::boolean03; use crate::boolean45::boolean45; use crate::simplification::simplify_topology; use crate::triangulation::triangulate; use crate::common::*; +use crate::cleanup::*; use crate::manifold::*; pub use crate::common::{Real, Vec2, Vec3, Vec4, Mat3, K_PRECISION}; @@ -71,21 +72,22 @@ pub fn compute_boolean( &mut trg.rs ); - let mut var = vec![]; - let mut idx = vec![]; - - for h in trg.hs.chunks(3) { - idx.push(Vec3u::new(h[0].tail, h[1].tail, h[2].tail)); - } - - if !mp.var.is_empty() && !mq.var.is_empty() { - for r in trg.rs.iter() { - if r.mid == 0 { var.push(mp.var[r.fid].clone()) } - else { var.push(mq.var[r.fid].clone()) } - } + let mut var = None; + if let (Some(vp), Some(vq)) = (&mp.variable, &mq.variable) { + var = Some( + trg.rs.iter().map(|r| { + if r.mid == 0 { vp[r.fid].clone() } + else { vq[r.fid].clone() } + }).collect()); } - Manifold::new_impl(b45.ps, idx, var, Some(eps), Some(tol)) + Manifold::new( + b45.ps, + trg.hs.iter().map(|h| h.tail).collect::>(), + var, + Some(eps), + Some(tol) + ) } diff --git a/src/manifold/mod.rs b/src/manifold/mod.rs index b74a2d1..1196c51 100644 --- a/src/manifold/mod.rs +++ b/src/manifold/mod.rs @@ -9,8 +9,8 @@ use std::cmp::Ordering; use std::fmt::Debug; use bounds::BBox; use hmesh::Hmesh; -use collider::{morton_code, MortonCollider, K_NO_CODE}; -use crate::{Data, Mat3, Tref, Half, Real, Vec3, Vec3u, K_PRECISION, next_of}; +use collider::{morton_code, MortonCollider}; +use crate::{Data, Mat3, Half, Real, Vec3, Vec3u, K_PRECISION, next_of}; #[cfg(feature = "rayon")] use rayon::prelude::*; #[derive(Clone, Debug)] @@ -22,57 +22,54 @@ pub struct Manifold { pub nh: usize, // number of halfedges pub eps: Real, // epsilon pub tol: Real, // tolerance - pub var: Vec, // variable on the mfd pub bounding_box: BBox, // pub face_normals: Vec, // pub vert_normals: Vec, // + pub variable: Option>, // variable on the mfd pub collider: MortonCollider, // pub coplanar: Vec, // indices of coplanar faces } impl Manifold { - pub fn new(ps: P, ts: I) -> Result { - Self::new_impl(ps, ts, vec![], None, None) - } - - pub fn new_impl( - ps: P, - ts: I, - mut var: Vec, + pub fn new( + pos: P, + idx: I, + var: Option>, eps: Option, tol: Option, ) -> Result { - let ps = ps.into_vec3f(); - let ts = ts.into_vec3u(); + let ps = pos.into_vec3f(); + let ts = idx.into_vec3u(); let bb = BBox::new(None, &ps); - let (mut f_bb, mut f_mt) = compute_face_morton(&ps, &ts, &bb); - let hm = sort_faces(&ps, &ts, &mut var, &mut f_bb, &mut f_mt)?; + let mut var = var; + let mut mrt = compute_face_morton(&ps, &ts, &bb); + let hm = sort_faces(&ps, &ts, &mut var, &mut mrt.0, &mut mrt.1)?; let hs = hm.half.iter().map(|&i| Half::new(hm.tail[i], hm.head[i], hm.twin[i])).collect::>(); let mut e = K_PRECISION * bb.scale(); e = if e.is_finite() { e } else { -1. }; let eps = if let Some(e_) = eps { e_ } else { e }; let tol = if let Some(t_) = tol { t_ } else { e }; - let collider = MortonCollider::new(&f_bb, &f_mt); + let collider = MortonCollider::new(&mrt.0, &mrt.1); let coplanar = compute_coplanar_idx(&ps, &hm.fns, &hs, eps); let mfd = Manifold { + ps, + hs, + eps, + tol, nv: hm.nv, nf: hm.nf, nh: hm.nh, - ps, - hs, bounding_box: bb, vert_normals: hm.vns, face_normals: hm.fns, - var, - eps, - tol, + variable: var, collider, coplanar, }; - if !mfd.is_manifold() { return Err("The input mesh is not manifold".into()); } + if !is_manifold(&mfd) { return Err("The input mesh is not manifold".into()); } Ok(mfd) } @@ -85,48 +82,41 @@ impl Manifold { // self.tol = self.tol.max(t); //} - pub fn is_manifold(&self) -> bool { - self.hs.iter().enumerate().all(|(i, h)| { - if h.tail().is_none() || h.head().is_none() { return true; } - match h.pair() { - None => { false }, - Some(pair) => { - let mut good = true; - good &= self.hs[pair].pair() == Some(i); - good &= h.tail != h.head; - good &= h.tail == self.hs[pair].head; - good &= h.head == self.hs[pair].tail; - good - } - } - }) - } - pub fn translate(&mut self, x: f64, y: f64, z: f64) { let t = Vec3::new(x as Real, y as Real, z as Real); - let p = self.ps.iter().map(|p| *p + t).collect::>(); - let i = self.hs.iter().map(|h| h.tail).collect::>(); - *self = Manifold::new_impl(p, &i, self.var.clone(), None, None).unwrap(); + *self = Manifold::new( + self.ps.iter().map(|p| *p + t).collect::>(), + self.hs.iter().map(|h| h.tail).collect::>(), + self.variable.clone(), + None, + None + ).unwrap(); } pub fn rotate(&mut self, x: f64, y: f64, z: f64) { let r = Mat3::from_euler(glam::EulerRot::XYZ, x as Real, y as Real, z as Real); - let p = self.ps.iter().map(|p| r * *p).collect::>(); - let i = self.hs.iter().map(|h| h.tail).collect::>(); - *self = Manifold::new_impl(p, &i, self.var.clone(), None, None).unwrap(); + *self = Manifold::new( + self.ps.iter().map(|p| r * *p).collect::>(), + self.hs.iter().map(|h| h.tail).collect::>(), + self.variable.clone(), + None, + None + ).unwrap(); } pub fn scale(&mut self, x: f64, y: f64, z: f64) { - let p = self.ps.iter().map(|p| Vec3::new(p.x * x as Real, p.y * y as Real, p.z * z as Real)).collect::>(); - let i = self.hs.iter().map(|h| h.tail).collect::>(); - *self = Manifold::new_impl(p, &i, self.var.clone(), None, None).unwrap(); + let s = Vec3::new(x as Real, y as Real, z as Real); + *self = Manifold::new( + self.ps.iter().map(|p| p * s).collect::>(), + self.hs.iter().map(|h| h.tail).collect::>(), + self.variable.clone(), + None, + None + ).unwrap(); } - pub fn set_inheritances(&mut self, val: Vec) { - *self = Manifold::new_impl( - self.ps.clone(), - &self.hs.iter().map(|h| h.tail).collect::>(), - val, None, None).unwrap(); + pub fn set_variable(&mut self, var: Vec) { + self.variable = Some(var); } } @@ -166,22 +156,26 @@ fn compute_face_morton( } } - (bbs, mts) } fn sort_faces( pos: &[Vec3], idx: &[Vec3u], - var: &mut Vec, + var: &mut Option>, face_bboxes: &mut Vec, face_morton: &mut Vec ) -> Result { let mut map = (0..face_morton.len()).collect::>(); map.sort_by_key(|&i| face_morton[i]); + *face_bboxes = map.iter().map(|&i| face_bboxes[i].clone()).collect::>(); *face_morton = map.iter().map(|&i| face_morton[i]).collect::>(); - if !var.is_empty() { *var = map.iter().map(|&i| var[i].clone()).collect(); } + + if let Some(v) = var { + *v = map.iter().map(|&i| v[i].clone()).collect(); + } + Hmesh::new(pos, &map.iter().map(|&i| idx[i]).collect::>()) } @@ -237,40 +231,25 @@ fn compute_coplanar_idx( res } -pub fn cleanup_unused_verts( - ps: &mut Vec, - hs: &mut Vec, - rs: &mut Vec, -) { - let bb = BBox::new(None, ps); - let mt = ps.iter().map(|p| morton_code(p, &bb)).collect::>(); - - let mut new2old = (0..ps.len()).collect::>(); - let mut old2new = vec![0; ps.len()]; - new2old.sort_by_key(|&i| mt[i]); - for (new, &old) in new2old.iter().enumerate() { old2new[old] = new; } - - // reindex verts - for h in hs.iter_mut() { - if h.pair().is_none() { continue; } - h.tail = old2new[h.tail]; - h.head = old2new[h.head]; - } - - // truncate pos container - let nv = new2old - .iter() - .position(|&v| mt[v] >= K_NO_CODE) - .unwrap_or(new2old.len()); - - new2old.truncate(nv); - - *ps = new2old.iter().map(|&i| ps[i]).collect(); - *rs = hs.chunks(3).enumerate().filter_map(|(i, t)| t[0].pair().map(|_| rs[i].clone())).collect(); - *hs = hs.iter().filter(|h| h.pair().is_some()).cloned().collect(); +fn is_manifold(mfd: &Manifold) -> bool { + mfd.hs.iter().enumerate().all(|(i, h)| { + if h.tail().is_none() || h.head().is_none() { return true; } + match h.pair() { + None => { false }, + Some(pair) => { + let mut good = true; + good &= mfd.hs[pair].pair() == Some(i); + good &= h.tail != h.head; + good &= h.tail == mfd.hs[pair].head; + good &= h.head == mfd.hs[pair].tail; + good + } + } + }) } + pub trait IntoVec3f { fn into_vec3f(self) -> Vec; } pub trait IntoVec3u { fn into_vec3u(self) -> Vec; } @@ -278,11 +257,15 @@ impl IntoVec3f for &[f32] { fn into_vec3f(self) -> Vec { self.chu impl IntoVec3f for &[f64] { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} impl IntoVec3f for &[[f32; 3]] { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} impl IntoVec3f for &[[f64; 3]] { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} -impl IntoVec3f for &Vec<[f32; 3]> { fn into_vec3f(self) -> Vec { self.into_iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} -impl IntoVec3f for &Vec<[f64; 3]> { fn into_vec3f(self) -> Vec { self.into_iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &Vec<[f32; 3]> { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for &Vec<[f64; 3]> { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} impl IntoVec3f for &Vec { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} impl IntoVec3f for &Vec { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} impl IntoVec3f for &[Vec3] { fn into_vec3f(self) -> Vec { self.to_vec() } } +impl IntoVec3f for Vec<[f32; 3]> { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for Vec<[f64; 3]> { fn into_vec3f(self) -> Vec { self.iter().map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for Vec { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} +impl IntoVec3f for Vec { fn into_vec3f(self) -> Vec { self.chunks(3).map(|p| Vec3::new(p[0] as Real, p[1] as Real, p[2] as Real)).collect() }} impl IntoVec3f for Vec { fn into_vec3f(self) -> Vec { self }} impl IntoVec3u for &[u32] { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} @@ -291,12 +274,18 @@ impl IntoVec3u for &[usize] { fn into_vec3u(self) -> Vec { self.c impl IntoVec3u for &[[u32; 3]] { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} impl IntoVec3u for &[[u64; 3]] { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} impl IntoVec3u for &[[usize; 3]] { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } -impl IntoVec3u for &Vec<[u32; 3]> { fn into_vec3u(self) -> Vec { self.into_iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} -impl IntoVec3u for &Vec<[u64; 3]> { fn into_vec3u(self) -> Vec { self.into_iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} -impl IntoVec3u for &Vec<[usize; 3]> { fn into_vec3u(self) -> Vec { self.into_iter().map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } +impl IntoVec3u for &Vec<[u32; 3]> { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &Vec<[u64; 3]> { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for &Vec<[usize; 3]> { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } impl IntoVec3u for &Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() } } impl IntoVec3u for &Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() } } impl IntoVec3u for &Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } impl IntoVec3u for &[Vec3u] { fn into_vec3u(self) -> Vec { self.to_vec() } } +impl IntoVec3u for Vec<[u32; 3]> { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for Vec<[u64; 3]> { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() }} +impl IntoVec3u for Vec<[usize; 3]> { fn into_vec3u(self) -> Vec { self.iter().map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } +impl IntoVec3u for Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() } } +impl IntoVec3u for Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0] as usize, p[1] as usize, p[2] as usize)).collect() } } +impl IntoVec3u for Vec { fn into_vec3u(self) -> Vec { self.chunks(3).map(|p| Vec3u::new(p[0], p[1], p[2])).collect() } } impl IntoVec3u for Vec { fn into_vec3u(self) -> Vec { self } } diff --git a/src/tests.rs b/src/tests.rs index 390ec2d..6251cce 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -14,6 +14,7 @@ mod test_intersection { Manifold::new( [-0.866025, -1., 0.5, 0., -1., -1., 0.866025, -1., 0.5, 0., 1., 0.].as_ref(), [0, 3, 1, 1, 2, 0, 1, 3, 2, 2, 3, 0u32].as_ref(), + None, None, None, ).unwrap() } @@ -21,6 +22,7 @@ mod test_intersection { Manifold::new( [-1., -0.866025, 0.5, -1., 0., -1., -1., 0.866025, 0.5, 1., 0., 0.].as_ref(), [1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2u32].as_ref(), + None, None, None, ).unwrap() } @@ -28,6 +30,7 @@ mod test_intersection { Manifold::new( [-2., -0.866025, 0.5, -2., -0., -1., -2., 0.866025, 0.5, 0., 0., 0.].as_ref(), [1, 3, 0, 1, 0, 2, 2, 3, 1, 0, 3, 2u32].as_ref(), + None, None, None, ).unwrap() }