From 4d4f28f4d0e93541e92277f44451aacdc23b8227 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Tue, 18 Aug 2026 00:21:44 -0700 Subject: MVP of marching squares --- src/sim/cell_sim/chunk.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/sim/cell_sim/chunk.rs') 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 + } + } +} -- cgit v1.3.1