This commit is contained in:
mcrcortex
2025-08-10 09:44:20 +10:00
parent 2956872970
commit 11f7041df0
9 changed files with 30 additions and 5 deletions

View File

@@ -79,4 +79,8 @@ public class VoxyConfig implements OptionStorage<VoxyConfig> {
public VoxyConfig getData() {
return this;
}
public boolean isRenderingEnabled() {
return VoxyCommon.isAvailable() && this.enabled && this.enableRendering;
}
}

View File

@@ -62,6 +62,7 @@ public class GlViewCapture {
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 3, buffer, offset, (this.width*3L)*(this.height*2L)*4L*2);//its 2*4 because colour + depth stencil
glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT|GL_TEXTURE_UPDATE_BARRIER_BIT|GL_PIXEL_BUFFER_BARRIER_BIT|GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);//Am not sure if barriers are right
glDispatchCompute(3, 2, 1);
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 3, 0, 0, 4);//WHY DOES THIS FIX FUCKING BINDING ISSUES HERE WHEN DOING THIS IN THE RENDER SYSTEM DOESNT
}
public void clear() {

View File

@@ -242,6 +242,7 @@ public class ModelTextureBakery {
}
glBindVertexArray(0);
} else {//Is fluid, slow path :(
if (!(state.getBlock() instanceof FluidBlock)) throw new IllegalStateException();
var mat = new Matrix4f();
@@ -300,6 +301,7 @@ public class ModelTextureBakery {
}
//"Restore" gl state
glViewport(viewdat[0], viewdat[1], viewdat[2], viewdat[3]);
glDisable(GL_STENCIL_TEST);

View File

@@ -8,7 +8,7 @@ public class MDICViewport extends Viewport<MDICViewport> {
public final GlBuffer drawCountCallBuffer = new GlBuffer(1024).zero();
public final GlBuffer drawCallBuffer = new GlBuffer(5*4*(400_000+100_000+100_000)).zero();//400k draw calls
public final GlBuffer positionScratchBuffer = new GlBuffer(8*400000).zero();//400k positions
public final GlBuffer indirectLookupBuffer = new GlBuffer(HierarchicalOcclusionTraverser.MAX_QUEUE_SIZE *4+4);
public final GlBuffer indirectLookupBuffer = new GlBuffer(HierarchicalOcclusionTraverser.MAX_QUEUE_SIZE *4+4);//In theory, this could be global/not unique to the viewport
public final GlBuffer visibilityBuffer;
public MDICViewport(int maxSectionCount) {

View File

@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ClientPlayNetworkHandler.class)
public class MixinClientLoginNetworkHandler {
@Inject(method = "onGameJoin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;<init>(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ClientPlayNetworkHandler;)V", shift = At.Shift.BY, by = 2))
@Inject(method = "onGameJoin", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/GameJoinS2CPacket;commonPlayerSpawnInfo()Lnet/minecraft/network/packet/s2c/play/CommonPlayerSpawnInfo;"))
private void voxy$init(GameJoinS2CPacket packet, CallbackInfo ci) {
if (VoxyCommon.isAvailable()) {
VoxyClientInstance.isInGame = true;

View File

@@ -61,7 +61,7 @@ public abstract class MixinWorldRenderer implements IGetVoxyRenderSystem {
@Override
public void createRenderer() {
if (this.renderer != null) throw new IllegalStateException("Cannot have multiple renderers");
if ((!VoxyConfig.CONFIG.enableRendering)||(!VoxyConfig.CONFIG.enabled)) {
if (!VoxyConfig.CONFIG.isRenderingEnabled()) {
Logger.info("Not creating renderer due to disabled");
return;
}

View File

@@ -96,9 +96,11 @@ public class VoxelIngestService {
boolean gotLighting = false;
int i = chunk.getBottomSectionCoord() - 1;
boolean allEmpty = true;
for (var section : chunk.getSectionArray()) {
i++;
if (section == null || !shouldIngestSection(section, chunk.getPos().x, i, chunk.getPos().z)) continue;
allEmpty&=section.isEmpty();
//if (section.isEmpty()) continue;
var pos = ChunkSectionPos.from(chunk.getPos(), i);
if (lightingProvider.getStatus(LightType.SKY, pos) != LightStorage.Status.LIGHT_AND_DATA && lightingProvider.getStatus(LightType.BLOCK, pos) != LightStorage.Status.LIGHT_AND_DATA)
@@ -106,6 +108,22 @@ public class VoxelIngestService {
gotLighting = true;
}
if (allEmpty&&!gotLighting) {
//Special case all empty chunk columns, we need to clear it out
i = chunk.getBottomSectionCoord() - 1;
for (var section : chunk.getSectionArray()) {
i++;
if (section == null || !shouldIngestSection(section, chunk.getPos().x, i, chunk.getPos().z)) continue;
this.ingestQueue.add(new IngestSection(chunk.getPos().x, i, chunk.getPos().z, engine, section, null, null));
try {
this.threads.execute();
} catch (Exception e) {
Logger.error("Executing had an error: assume shutting down, aborting",e);
break;
}
}
}
if (!gotLighting) {
return;
}

View File

@@ -26,7 +26,7 @@ float projDepth(vec3 pos) {
void main() {
float depth = texture(depthTex, UV.xy).r;
if (depth == 0.0f) {
if (depth == 0.0f || depth == 1.0) {
discard;
}

View File

@@ -2,6 +2,6 @@
out vec2 UV;
void main() {
gl_Position = vec4(vec2(gl_VertexID&1, (gl_VertexID>>1)&1) * 4 - 1, 1f, 1);
gl_Position = vec4(vec2(gl_VertexID&1, (gl_VertexID>>1)&1) * 4 - 1, 1.0f, 1);
UV = gl_Position.xy*0.5+0.5;
}