summaryrefslogtreecommitdiff
path: root/src/sim/cell_sim
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-08-17 18:18:25 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-08-17 18:18:25 -0700
commit54ae26e7c41f6c0a465a55c3cc5ee16ff81a1d70 (patch)
tree40aa246f01cd9f66ba581528592ea0704e90164a /src/sim/cell_sim
parent3d476186f53d695c340c51dbd3aa14ff4621c520 (diff)
refactor/UX
Diffstat (limited to 'src/sim/cell_sim')
-rw-r--r--src/sim/cell_sim/sim.rs46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/sim/cell_sim/sim.rs b/src/sim/cell_sim/sim.rs
index 0f02a23..8831bb4 100644
--- a/src/sim/cell_sim/sim.rs
+++ b/src/sim/cell_sim/sim.rs
@@ -181,52 +181,6 @@ const NEIGHBORHOOD_OFFSETS: [(i32, i32); 9] = [
(1, 1),
];
-pub fn write_rb_entity_to_world(
- world: &mut World,
- rb_sim_manager: &RbSimManager,
- rb_entity_id: u32,
- next_seqno: u64,
-) {
- if let Some(rb_entity) = rb_sim_manager.rb_entities.get(&rb_entity_id)
- && let Some((rb_x, rb_y, cos, sin)) = rb_sim_manager.get_rb_entity_transform(rb_entity_id)
- {
- let half_size = CHUNK_SIZE as f32 / 2.0;
- // half-extent of the rotated grid's axis-aligned bounding box, plus a cell of margin
- let radius = half_size * (cos.abs() + sin.abs()) + 1.0;
-
- let world_xl = (rb_x - radius).floor() as i32;
- let world_xu = (rb_x + radius).ceil() as i32;
- let world_yl = (rb_y - radius).floor() as i32;
- let world_yu = (rb_y + radius).ceil() as i32;
-
- for world_x in world_xl..=world_xu {
- for world_y in world_yl..=world_yu {
- // same as shader
- let d = (world_x as f32 + 0.5 - rb_x, world_y as f32 + 0.5 - rb_y);
- let q = (d.0.floor() + 0.5, d.1.floor() + 0.5);
- let (lx, ly) = (
- (q.0 * cos + q.1 * sin + half_size).floor() as i32,
- (-q.0 * sin + q.1 * cos + half_size).floor() as i32,
- );
-
- if lx < 0 || ly < 0 || lx >= CHUNK_SIZE || ly >= CHUNK_SIZE {
- continue;
- }
-
- let mut cell = rb_entity.get_cell_at_local_position(lx as u8, ly as u8);
- if cell.material == MaterialId::Void {
- continue;
- }
-
- cell.match_parity(next_seqno);
-
- // TODO: OPTIMIZE!!
- world.set_cell_from_game_position(world_x, world_y, cell, false);
- }
- }
- }
-}
-
pub fn sim_tick(world: &mut World, seqno: u64, use_threading: bool) {
puffin::profile_function!();