marching_cubes/
container.rs

1#[cfg(not(feature = "glam"))]
2use inner::*;
3
4#[cfg(feature = "glam")]
5use glam::*;
6
7pub type Vec3 = Vector3;
8pub type Vec2 = Vector2;
9
10pub fn vector3(x: f32, y: f32, z: f32) -> Vec3 {
11    #[cfg(feature = "glam")]
12    {
13        return glam::Vec3::new(x, y);
14    }
15
16    #[cfg(not(feature = "glam"))]
17    {
18        return [x, y, z];
19    }
20}
21
22pub fn vector2(x: f32, y: f32) -> Vec2 {
23    #[cfg(feature = "glam")]
24    {
25        return glam::Vec2::new(x, y);
26    }
27
28    #[cfg(not(feature = "glam"))]
29    {
30        return [x, y];
31    }
32}
33
34pub fn empty_vec3() -> Vector3 {
35    vector3(0.0, 0.0, 0.0)
36}
37
38pub fn empty_vec2() -> Vector2 {
39    vector2(0.0, 0.0)
40}
41
42#[cfg(feature = "glam")]
43pub mod glam {
44    pub type Vector3 = glam::Vec3;
45    pub type Vector2 = glam::Vec2;
46}
47
48pub mod inner {
49    pub type Vector3 = [f32; 3];
50    pub type Vector2 = [f32; 2];
51}
52
53pub trait TriangleShape {
54    fn get_points() -> (f32, f32, f32);
55}