Setup for rasterized occlusion culling

This commit is contained in:
mcrcortex
2023-11-14 09:31:33 +10:00
parent 046a419e4f
commit 92e31986b1
10 changed files with 103 additions and 44 deletions

View File

@@ -57,7 +57,7 @@ public class VoxelCore {
//Trigger the shared index buffer loading
SharedIndexBuffer.INSTANCE.id();
this.renderer = new Gl46FarWorldRenderer();
this.world = new WorldEngine(new File("ethoslab.db"), 16, 5);//"hc9.db"//"storagefile.db"
this.world = new WorldEngine(new File("storagefile.db"), 5, 5);//"storagefile.db"//"ethoslab.db"
this.renderTracker = new RenderTracker(this.world, this.renderer);
this.renderGen = new RenderGenerationService(this.world, this.renderTracker,4);

View File

@@ -40,6 +40,13 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
.add(ShaderType.FRAGMENT, "voxelmon:lod/gl46/quads.frag")
.compile();
//TODO: Note the cull shader needs a different element array since its rastering cubes not quads
private final Shader cullShader = Shader.make()
.add(ShaderType.VERTEX, "voxelmon:lod/gl46/cull/raster.vert")
.add(ShaderType.FRAGMENT, "voxelmon:lod/gl46/cull/raster.frag")
.compile();
private final GlBuffer glCommandBuffer = new GlBuffer(100_000*5*4, 0);
public Gl46FarWorldRenderer() {
@@ -111,6 +118,7 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
super.shutdown();
this.commandGen.free();
this.lodShader.free();
this.cullShader.free();
}
@Override

View File

@@ -14,6 +14,6 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
public class MixinClientChunkManager {
@Inject(method = "unload", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientChunkManager$ClientChunkMap;compareAndSet(ILnet/minecraft/world/chunk/WorldChunk;Lnet/minecraft/world/chunk/WorldChunk;)Lnet/minecraft/world/chunk/WorldChunk;", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD)
private void injectUnload(ChunkPos pos, CallbackInfo ci, int index, WorldChunk worldChunk) {
//VoxelCore.INSTANCE.enqueueIngest(worldChunk);
VoxelCore.INSTANCE.enqueueIngest(worldChunk);
}
}