1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! imath-traits provides a set of traits which constrain the types used in Rust translations of
//! C++ APIs that rely on `Imath`, or `Imath-alike` types.
//!
//! This is solely about memory layout and being able to convert the implementing types back and
//! forward into slices and pointers to be able to be used in the FFI call, thus the traits contain
//! no methods other than for converting back and forth between slices and raw pointers.
//!
//! To use, simply add the feature for the math crate you need to the dependency
//! of any crate that uses imath-traits (these will be called `imath_<crate>`, and types will just work with any function
//! from that crate that expects a Vec2<T>, Vec3<T>, Vec4<T>, Bound2<T> or Bound3<T>:
//!
//! ```toml
//! openexr = { version = "0.10-3.0.1", features=["imath_cgmath"] }
//! ```
//!
//! Currently, we support glam, nalgebra and nalgebra_glm. If you need another math
//! crate, implement support for it and submit a PR, or request it. Note that the
//! crate must support 2-, 3- and 4-dimensional vectors of i32, f32 and f64.
//!

pub use half::f16;

pub mod vec;
pub use vec::*;

pub mod bound;
pub use bound::*;

pub mod matrix;
pub use matrix::*;

pub mod zero;
pub use zero::Zero;

#[cfg(feature = "cgmath")]
pub mod impl_cgmath;
#[cfg(feature = "cgmath")]
pub use impl_cgmath::{Box2, Box2d, Box2f, Box2i, Box3, Box3d, Box3f, Box3i};

#[cfg(feature = "glam")]
pub mod impl_glam;
#[cfg(feature = "glam")]
pub use impl_glam::{Box2d, Box2f, Box2i, Box3d, Box3f, Box3i};

#[cfg(feature = "nalgebra")]
pub mod impl_nalgebra;
#[cfg(feature = "nalgebra")]
pub use impl_nalgebra::{Box2d, Box2f, Box2i, Box3d, Box3f, Box3i};

#[cfg(feature = "nalgebra-glm")]
pub mod impl_nalgebra_glm;
#[cfg(feature = "nalgebra_glm")]
pub use impl_nalgebra_glm::{Box2d, Box2f, Box2i, Box3d, Box3f, Box3i};

#[cfg(not(any(
    feature = "cgmath",
    feature = "glam",
    feature = "nalgebra",
    feature = "nalgebra-glm"
)))]
pub mod impl_array;
#[cfg(not(any(
    feature = "cgmath",
    feature = "glam",
    feature = "nalgebra",
    feature = "nalgebra-glm"
)))]
pub use impl_array::{Box2d, Box2f, Box2i, Box3d, Box3f, Box3i};

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}