diff --git a/src/main/java/me/cortex/voxy/client/Voxy.java b/src/main/java/me/cortex/voxy/client/Voxy.java index 14f5c6a6..6ce791c9 100644 --- a/src/main/java/me/cortex/voxy/client/Voxy.java +++ b/src/main/java/me/cortex/voxy/client/Voxy.java @@ -35,4 +35,8 @@ public class Voxy implements ClientModInitializer { var selection = selector.getBestSelectionOrCreate(world); return new VoxelCore(selection); } + + public static void breakpoint() { + int breakpoint = 0; + } } diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/LightMapHelper.java b/src/main/java/me/cortex/voxy/client/core/rendering/LightMapHelper.java index 4b9e51be..5a04048a 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/LightMapHelper.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/LightMapHelper.java @@ -18,7 +18,7 @@ public class LightMapHelper { int y = ((light>>4)&0xF); int sample = lmt.getColor(x,y); sample = ((sample&0xFF0000)>>16)|(sample&0xFF00)|((sample&0xFF)<<16); - MemoryUtil.memPutInt(upload + (((x<<4)|(15-y))*4), sample|(0xFF<<28));//Skylight is inverted + MemoryUtil.memPutInt(upload + (((x<<4)|(y))*4), sample|(0xFF<<28)); } } diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java index f77f3f71..ae9201f1 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java @@ -368,7 +368,7 @@ public class RenderDataFactory { connectedSection.copyDataTo(this.connectedSectionCache); connectedSection.release(); } else { - Arrays.fill(this.connectedSectionCache, Mapper.withLight(Mapper.AIR, 15)); + Arrays.fill(this.connectedSectionCache, 0); } obtainedOppositeSection0 = true; } @@ -396,7 +396,7 @@ public class RenderDataFactory { connectedSection.copyDataTo(this.connectedSectionCache); connectedSection.release(); } else { - Arrays.fill(this.connectedSectionCache, Mapper.withLight(Mapper.AIR, 15)); + Arrays.fill(this.connectedSectionCache, 0); } obtainedOppositeSection31 = true; } diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/hierachical2/HierarchicalNodeManager.java b/src/main/java/me/cortex/voxy/client/core/rendering/hierachical2/HierarchicalNodeManager.java index 37d62c0c..1208834a 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/hierachical2/HierarchicalNodeManager.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/hierachical2/HierarchicalNodeManager.java @@ -40,8 +40,8 @@ public class HierarchicalNodeManager { } catch (InterruptedException e) { throw new RuntimeException(e); } - for(int x = -100; x<=100;x++) { - for (int z = -100; z <= 100; z++) { + for(int x = -50; x<=50;x++) { + for (int z = -50; z <= 50; z++) { for (int y = -3; y <= 3; y++) { updateFilterer.watch(0,x,y,z); updateFilterer.unwatch(0,x,y,z); diff --git a/src/main/java/me/cortex/voxy/client/importers/WorldImporter.java b/src/main/java/me/cortex/voxy/client/importers/WorldImporter.java index f21040fd..13f4ee37 100644 --- a/src/main/java/me/cortex/voxy/client/importers/WorldImporter.java +++ b/src/main/java/me/cortex/voxy/client/importers/WorldImporter.java @@ -328,7 +328,6 @@ public class WorldImporter { if (skyLight != null) { sky = skyLight.get(bx, by, bz); } - sky = 15-sky; return (byte) (sky|(block<<4)); } ); diff --git a/src/main/java/me/cortex/voxy/common/world/ActiveSectionTracker.java b/src/main/java/me/cortex/voxy/common/world/ActiveSectionTracker.java index 3b47d60e..0a47e6ee 100644 --- a/src/main/java/me/cortex/voxy/common/world/ActiveSectionTracker.java +++ b/src/main/java/me/cortex/voxy/common/world/ActiveSectionTracker.java @@ -66,7 +66,7 @@ public class ActiveSectionTracker { //TODO: REWRITE THE section tracker _again_ to not be so shit and jank, and so that Arrays.fill is not 10% of the execution time if (status == 1) { //We need to set the data to air as it is undefined state - Arrays.fill(section.data, 0);//Max skylight + Arrays.fill(section.data, 0); } section.acquire(); holder.obj = section; diff --git a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java index 1cebc696..71673598 100644 --- a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java +++ b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java @@ -1,5 +1,6 @@ package me.cortex.voxy.common.world; +import me.cortex.voxy.client.Voxy; import me.cortex.voxy.common.voxelization.VoxelizedSection; import me.cortex.voxy.common.world.other.Mapper; import me.cortex.voxy.common.world.service.SectionSavingService; @@ -131,6 +132,10 @@ public class WorldEngine { long oldId = worldSection.set(x, y, z, newId); nonAirCountDelta += Mapper.isAir(oldId)==Mapper.isAir(newId)?0:(Mapper.isAir(newId)?-1:1 ); didChange |= newId != oldId; + /* + if (oldId != newId && Mapper.isAir(oldId) && Mapper.isAir(newId)) { + Voxy.breakpoint(); + }*/ } } } diff --git a/src/main/java/me/cortex/voxy/common/world/WorldSection.java b/src/main/java/me/cortex/voxy/common/world/WorldSection.java index 615a4b66..63e6d7ca 100644 --- a/src/main/java/me/cortex/voxy/common/world/WorldSection.java +++ b/src/main/java/me/cortex/voxy/common/world/WorldSection.java @@ -29,10 +29,6 @@ public final class WorldSection { long[] data = null; - //Computed on load, updated on insertion - private final AtomicInteger nonAirCount = new AtomicInteger(0); - - private final ActiveSectionTracker tracker; public final AtomicBoolean inSaveQueue = new AtomicBoolean(); diff --git a/src/main/java/me/cortex/voxy/common/world/service/VoxelIngestService.java b/src/main/java/me/cortex/voxy/common/world/service/VoxelIngestService.java index 70514bfb..4b4d5878 100644 --- a/src/main/java/me/cortex/voxy/common/world/service/VoxelIngestService.java +++ b/src/main/java/me/cortex/voxy/common/world/service/VoxelIngestService.java @@ -1,6 +1,7 @@ package me.cortex.voxy.common.world.service; import it.unimi.dsi.fastutil.Pair; +import me.cortex.voxy.client.Voxy; import me.cortex.voxy.common.voxelization.VoxelizedSection; import me.cortex.voxy.common.voxelization.WorldConversionFactory; import me.cortex.voxy.common.world.WorldEngine; @@ -37,7 +38,7 @@ public class VoxelIngestService { for (var section : chunk.getSectionArray()) { i++; var lighting = this.captureLightMap.remove(ChunkSectionPos.from(chunk.getPos(), i).asLong()); - if (section.isEmpty()) { + if (section.isEmpty() && lighting==null) {//If the chunk section has lighting data, propagate it //TODO: add local cache so that it doesnt constantly create new sections this.world.insertUpdate(VoxelizedSection.createEmpty().setPosition(chunk.getPos().x, i, chunk.getPos().z)); } else { @@ -48,7 +49,7 @@ public class VoxelIngestService { section.getBiomeContainer(), (x, y, z, state) -> { if (lighting == null || ((lighting.first() != null && lighting.first().isUninitialized())&&(lighting.second()!=null&&lighting.second().isUninitialized()))) { - return (byte) 0x0f; + return (byte) 0; } else { //Lighting is hell int block = lighting.first()!=null?Math.min(15,lighting.first().get(x, y, z)):0; @@ -56,7 +57,6 @@ public class VoxelIngestService { if (block