diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-08-16 17:29:42 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-08-16 17:29:42 -0700 |
| commit | f177cc716c5f2aa5b50b14ccbb421de89e3a7854 (patch) | |
| tree | db06f9f44251d6d90e5e9709d47e6cc4397b9443 /src/sim/cell/cell.rs | |
| parent | 40e9d818195824749293dff3afcfdd5c1432adbe (diff) | |
wip
Diffstat (limited to 'src/sim/cell/cell.rs')
| -rw-r--r-- | src/sim/cell/cell.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/sim/cell/cell.rs b/src/sim/cell/cell.rs new file mode 100644 index 0000000..d35fa76 --- /dev/null +++ b/src/sim/cell/cell.rs @@ -0,0 +1,38 @@ +use crate::sim::cell::materials::MaterialId; + +#[derive(Clone, Copy)] +pub struct Cell { + pub material: MaterialId, + pub flags: u8, + pub data: u16, +} + +impl Cell { + const FLAG_PARITY: u8 = 0b0000_0001; + + #[inline] + pub fn parity(self) -> u8 { + self.flags & Self::FLAG_PARITY + } + #[inline] + pub fn flip_parity(&mut self) { + self.flags ^= Self::FLAG_PARITY; + } +} + +impl Cell { + pub fn void() -> Cell { + Cell { + material: MaterialId::Void, + flags: 0, + data: 0, + } + } + pub fn from_material(material: MaterialId) -> Cell { + Cell { + material, + flags: 0, + data: 0, + } + } +} |
