spaceform/
lib.rs

1// Warnings
2#![allow(incomplete_features)] // TODO: Remove once generic_const_exprs is complete.
3// Features
4#![feature(generic_const_exprs)]
5// Rustdoc
6#![warn(missing_docs)]
7// Clippy
8#![warn(clippy::all, clippy::nursery)]
9
10//! spaceform is a SIMD-accelerated library for 3D graphics.
11
12pub mod base;
13pub mod coordinate_system;
14pub mod direction;
15pub mod normal;
16pub mod point;
17pub mod rotation;
18pub mod transform;
19
20pub use direction::Direction;
21pub use normal::Normal;
22pub use point::Point;
23pub use rotation::{EulerAngles, Rotation, RotationOrder};
24pub use transform::Transform;
25
26/// Check if an argument is valid to pass into `shuffle`.
27pub const fn is_shuffle_arg(x: u32, y: u32, z: u32, w: u32) -> bool { x < 4 && y < 4 && z < 4 && w < 4 }
28
29/// Get the x86 shuffle mask, because of const generic limitations.
30pub const fn shuffle_mask(z: u32, y: u32, x: u32, w: u32) -> i32 { ((z << 6) | (y << 4) | (x << 2) | w) as i32 }
31
32// Rust SFINAE :)
33/// Check if a const expression is true or false.
34///
35/// Implements [`True`] if it is, [`False`] otherwise.
36pub struct Check<const V: bool>;
37/// A true expression.
38pub trait True {}
39/// A false expression.
40pub trait False {}
41
42impl True for Check<true> {}
43impl False for Check<false> {}