forward neighbor edge msk

This commit is contained in:
mcrcortex
2025-10-02 18:40:47 +10:00
parent c2f6fda5c8
commit 35bd5fa414
3 changed files with 6 additions and 6 deletions

View File

@@ -760,7 +760,7 @@ public class AsyncNodeManager {
return this.workCounter.get()!=0 || RESULT_HANDLE.get(this) != null; return this.workCounter.get()!=0 || RESULT_HANDLE.get(this) != null;
} }
public void worldEvent(WorldSection section, int flags) { public void worldEvent(WorldSection section, int flags, int neighborMask) {
//If there is any change, we need to clear the geometry cache before emitting update //If there is any change, we need to clear the geometry cache before emitting update
this.geometryCache.clear(section.key); this.geometryCache.clear(section.key);

View File

@@ -19,7 +19,7 @@ public class WorldEngine {
public static final int UPDATE_TYPE_DONT_SAVE = 4; public static final int UPDATE_TYPE_DONT_SAVE = 4;
public static final int DEFAULT_UPDATE_FLAGS = UPDATE_TYPE_BLOCK_BIT | UPDATE_TYPE_CHILD_EXISTENCE_BIT; public static final int DEFAULT_UPDATE_FLAGS = UPDATE_TYPE_BLOCK_BIT | UPDATE_TYPE_CHILD_EXISTENCE_BIT;
public interface ISectionChangeCallback {void accept(WorldSection section, int updateFlags);} public interface ISectionChangeCallback {void accept(WorldSection section, int updateFlags, int neighborMsk);}
public interface ISectionSaveCallback {void save(WorldEngine engine, WorldSection section);} public interface ISectionSaveCallback {void save(WorldEngine engine, WorldSection section);}
private final TrackedObject thisTracker = TrackedObject.createTrackedObject(this); private final TrackedObject thisTracker = TrackedObject.createTrackedObject(this);
@@ -113,16 +113,16 @@ public class WorldEngine {
//Marks a section as dirty, enqueuing it for saving and or render data rebuilding //Marks a section as dirty, enqueuing it for saving and or render data rebuilding
public void markDirty(WorldSection section) { public void markDirty(WorldSection section) {
this.markDirty(section, DEFAULT_UPDATE_FLAGS); this.markDirty(section, DEFAULT_UPDATE_FLAGS, 0);
} }
public void markDirty(WorldSection section, int changeState) { public void markDirty(WorldSection section, int changeState, int neighborMsk) {
if (!this.isLive) throw new IllegalStateException("World is not live"); if (!this.isLive) throw new IllegalStateException("World is not live");
if (section.tracker != this.sectionTracker) { if (section.tracker != this.sectionTracker) {
throw new IllegalStateException("Section is not from here"); throw new IllegalStateException("Section is not from here");
} }
if (this.dirtyCallback != null) { if (this.dirtyCallback != null) {
this.dirtyCallback.accept(section, changeState); this.dirtyCallback.accept(section, changeState, neighborMsk);
} }
if ((!section.inSaveQueue)&&(changeState&UPDATE_TYPE_DONT_SAVE)==0) { if ((!section.inSaveQueue)&&(changeState&UPDATE_TYPE_DONT_SAVE)==0) {
section.markDirty(); section.markDirty();

View File

@@ -113,7 +113,7 @@ public class WorldUpdater {
neighbors |= ((section.z^(section.z+1))>>(lvl+1))==0?0:1<<5;//+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)); into.markDirty(worldSection, (didStateChange?UPDATE_TYPE_BLOCK_BIT:0)|(emptinessStateChange!=0?UPDATE_TYPE_CHILD_EXISTENCE_BIT:0), neighbors);
} }
//Need to release the section after using it //Need to release the section after using it