From ff7aecadb27f0fc27bbf26ad1972b810ed42d7b3 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:24:35 +1000 Subject: [PATCH] compute neighbor mask --- .../me/cortex/voxy/common/world/WorldUpdater.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/me/cortex/voxy/common/world/WorldUpdater.java b/src/main/java/me/cortex/voxy/common/world/WorldUpdater.java index c078999d..ddaee5c1 100644 --- a/src/main/java/me/cortex/voxy/common/world/WorldUpdater.java +++ b/src/main/java/me/cortex/voxy/common/world/WorldUpdater.java @@ -99,6 +99,20 @@ public class WorldUpdater { } if (didStateChange||(emptinessStateChange!=0)) { + //TODO: somehow foward the neighbors that are facing the updated area, this allows forwarding to the dirty consumer + // which can decide wether to dispatch mesh rebuilds to the surounding sections + //Bitmask of neighboring sections + //Note, this may be zero (this is more likely to occure at higher lod levels) if it doesnt face any neighbors + int neighbors = 0; + { + neighbors |= ((section.y^(section.y-1))>>(lvl+1))==0?0:1<<0;//Down + neighbors |= ((section.y^(section.y+1))>>(lvl+1))==0?0:1<<1;//Up + neighbors |= ((section.x^(section.x-1))>>(lvl+1))==0?0:1<<2;//-x + neighbors |= ((section.x^(section.x+1))>>(lvl+1))==0?0:1<<3;//+x + neighbors |= ((section.z^(section.z-1))>>(lvl+1))==0?0:1<<4;//-z + neighbors |= ((section.z^(section.z+1))>>(lvl+1))==0?0:1<<5;//+z + } + into.markDirty(worldSection, (didStateChange?UPDATE_TYPE_BLOCK_BIT:0)|(emptinessStateChange!=0?UPDATE_TYPE_CHILD_EXISTENCE_BIT:0)); }