summaryrefslogtreecommitdiff
path: root/src/sim/cell_sim/chunk.rs
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-08-18 00:21:44 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-08-18 00:21:44 -0700
commit4d4f28f4d0e93541e92277f44451aacdc23b8227 (patch)
tree612b38036a4f79f1d50637a061cf2f636f5d1ded /src/sim/cell_sim/chunk.rs
parent4ad69d966f0640daae34c677eead5b689cbfac2e (diff)
MVP of marching squares
Diffstat (limited to 'src/sim/cell_sim/chunk.rs')
-rw-r--r--src/sim/cell_sim/chunk.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/sim/cell_sim/chunk.rs b/src/sim/cell_sim/chunk.rs
index 116a38a..8c3acb4 100644
--- a/src/sim/cell_sim/chunk.rs
+++ b/src/sim/cell_sim/chunk.rs
@@ -1,6 +1,9 @@
use crate::{
config::{CELLS_IN_CHUNK, CHUNK_SIZE},
- sim::cell::cell::Cell,
+ sim::{
+ cell::{cell::Cell, materials::MaterialId},
+ lib::marching_squares::Marchable,
+ },
};
pub struct Chunk {
@@ -27,3 +30,13 @@ impl Chunk {
}
}
}
+
+impl Marchable for Chunk {
+ fn occupied(&self, x: i32, y: i32) -> bool {
+ if x < 0 || x >= CHUNK_SIZE || y < 0 || y >= CHUNK_SIZE {
+ false
+ } else {
+ self.get_cell_at_local_position(x as u8, y as u8).material != MaterialId::Void
+ }
+ }
+}