Skip to content

Commit 6afb4f6

Browse files
authored
feat: implement encase traits for primitive shapes (#390)
1 parent 9db6864 commit 6afb4f6

File tree

9 files changed

+12
-0
lines changed

9 files changed

+12
-0
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [
1212
'cfg(feature, values("dim2", "dim3", "f32", "f64"))',
1313
# "wavefront" is only used for 3D crates.
1414
'cfg(feature, values("wavefront"))',
15+
# "encase" is only used in f32 crates.
16+
'cfg(feature, values("encase"))'
1517
] }
1618

1719
[workspace.lints.clippy]

crates/parry2d/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ parallel = ["rayon"]
5656
alloc = ["nalgebra/alloc", "hashbrown"]
5757
spade = ["dep:spade", "alloc"]
5858
improved_fixed_point_support = []
59+
encase = [ "dep:encase", "nalgebra/encase" ]
5960

6061
# Do not enable this feature directly. It is automatically
6162
# enabled with the "simd-stable" or "simd-nightly" feature.
@@ -93,6 +94,7 @@ thiserror = { version = "2", default-features = false }
9394
ena = { version = "0.14.3", optional = true, default-features = false }
9495
smallvec = "1"
9596
foldhash = { version = "0.2", default-features = false }
97+
encase = { version = "0.12", optional = true }
9698

9799
[dev-dependencies]
98100
simba = { version = "0.9", default-features = false }

crates/parry3d/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ wavefront = ["obj"]
5757
alloc = ["nalgebra/alloc", "hashbrown"]
5858
spade = ["dep:spade", "alloc"]
5959
improved_fixed_point_support = []
60+
encase = [ "dep:encase", "nalgebra/encase" ]
6061

6162
# Do not enable this feature directly. It is automatically
6263
# enabled with the "simd-stable" or "simd-nightly" feature.
@@ -97,6 +98,7 @@ ena = { version = "0.14.3", optional = true, default-features = false }
9798
smallvec = "1"
9899
static_assertions = "1"
99100
foldhash = { version = "0.2", default-features = false }
101+
encase = { version = "0.12", optional = true }
100102

101103
# NOTE: needed only for element_min for SIMD BVH ray-casting.
102104
# can be removed once `wide` supports it (and allows filtering-out the

src/shape/ball.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ use crate::shape::SupportMap;
3939
/// ```
4040
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
4141
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
42+
#[cfg_attr(feature = "encase", derive(encase::ShaderType))]
4243
#[cfg_attr(
4344
feature = "rkyv",
4445
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),

src/shape/capsule.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rkyv::{bytecheck, CheckBytes};
1111
#[derive(Copy, Clone, Debug)]
1212
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1313
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
14+
#[cfg_attr(feature = "encase", derive(encase::ShaderType))]
1415
#[cfg_attr(
1516
feature = "rkyv",
1617
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize, CheckBytes),

src/shape/cuboid.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ use rkyv::{bytecheck, CheckBytes};
5858
/// ```
5959
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6060
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
61+
#[cfg_attr(feature = "encase", derive(encase::ShaderType))]
6162
#[cfg_attr(
6263
feature = "rkyv",
6364
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize, CheckBytes),

src/shape/cylinder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ use rkyv::{bytecheck, CheckBytes};
6666
/// ```
6767
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6868
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
69+
#[cfg_attr(feature = "encase", derive(encase::ShaderType))]
6970
#[cfg_attr(
7071
feature = "rkyv",
7172
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize, CheckBytes),

src/shape/segment.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ use rkyv::{bytecheck, CheckBytes};
6060
/// ```
6161
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6262
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
63+
#[cfg_attr(feature = "encase", derive(encase::ShaderType))]
6364
#[cfg_attr(
6465
feature = "rkyv",
6566
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize, CheckBytes),

src/shape/triangle.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ use rkyv::{bytecheck, CheckBytes};
7474
/// ```
7575
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7676
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
77+
#[cfg_attr(feature = "encase", derive(encase::ShaderType))]
7778
#[cfg_attr(
7879
feature = "rkyv",
7980
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize, CheckBytes),

0 commit comments

Comments
 (0)