Skip to main content

mraphics_core/
lib.rs

1use std::{ops::Deref, sync::atomic::AtomicUsize};
2
3static GLOBAL_ID_POOL: AtomicUsize = AtomicUsize::new(0);
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6pub struct MraphicsID {
7    value: usize,
8}
9
10impl MraphicsID {
11    pub fn new(value: usize) -> Self {
12        Self { value }
13    }
14
15    pub fn acquire() -> Self {
16        Self::new(GLOBAL_ID_POOL.fetch_add(1, std::sync::atomic::Ordering::Relaxed))
17    }
18}
19
20impl Deref for MraphicsID {
21    type Target = usize;
22
23    fn deref(&self) -> &Self::Target {
24        &self.value
25    }
26}
27
28// Re-exports
29mod scene;
30
31pub use scene::*;
32
33mod mesh_pool;
34pub use mesh_pool::*;
35
36mod render;
37pub use render::*;
38
39mod geometry;
40pub use geometry::*;
41
42mod material;
43pub use material::*;
44
45mod math;
46pub use math::*;
47
48mod animation;
49pub use animation::*;
50
51mod traits;
52pub use traits::*;
53
54pub mod constants;