More config options
This commit is contained in:
@@ -21,6 +21,8 @@ public class ZenithConfig {
|
|||||||
|
|
||||||
public boolean enabled = true;
|
public boolean enabled = true;
|
||||||
public int qualityScale = 20;
|
public int qualityScale = 20;
|
||||||
|
public int maxSections = 200_000;
|
||||||
|
public int geometryBufferSize = (1<<30)/8;
|
||||||
public int ingestThreads = 2;
|
public int ingestThreads = 2;
|
||||||
public int savingThreads = 10;
|
public int savingThreads = 10;
|
||||||
public int renderThreads = 5;
|
public int renderThreads = 5;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ZenithConfigScreenFactory implements ModMenuApi {
|
|||||||
private static Screen buildConfigScreen(Screen parent, ZenithConfig config) {
|
private static Screen buildConfigScreen(Screen parent, ZenithConfig config) {
|
||||||
ConfigBuilder builder = ConfigBuilder.create()
|
ConfigBuilder builder = ConfigBuilder.create()
|
||||||
.setParentScreen(parent)
|
.setParentScreen(parent)
|
||||||
.setTitle(Text.translatable("title.zenith.config"));
|
.setTitle(Text.translatable("zenith.config.title"));
|
||||||
|
|
||||||
|
|
||||||
addGeneralCategory(builder, config);
|
addGeneralCategory(builder, config);
|
||||||
@@ -61,6 +61,18 @@ public class ZenithConfigScreenFactory implements ModMenuApi {
|
|||||||
.setDefaultValue(DEFAULT.qualityScale)
|
.setDefaultValue(DEFAULT.qualityScale)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
category.addEntry(entryBuilder.startIntSlider(Text.translatable("zenith.config.general.geometryBuffer"), config.geometryBufferSize, (1<<27)/8, ((1<<31)-1)/8)
|
||||||
|
.setTooltip(Text.translatable("zenith.config.general.geometryBuffer.tooltip"))
|
||||||
|
.setSaveConsumer(val -> config.geometryBufferSize = val)
|
||||||
|
.setDefaultValue(DEFAULT.geometryBufferSize)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
category.addEntry(entryBuilder.startIntSlider(Text.translatable("zenith.config.general.maxSections"), config.maxSections, 100_000, 400_000)
|
||||||
|
.setTooltip(Text.translatable("zenith.config.general.maxSections.tooltip"))
|
||||||
|
.setSaveConsumer(val -> config.maxSections = val)
|
||||||
|
.setDefaultValue(DEFAULT.maxSections)
|
||||||
|
.build());
|
||||||
|
|
||||||
category.addEntry(entryBuilder.startIntSlider(Text.translatable("zenith.config.general.compression"), config.savingCompressionLevel, 1, 21)
|
category.addEntry(entryBuilder.startIntSlider(Text.translatable("zenith.config.general.compression"), config.savingCompressionLevel, 1, 21)
|
||||||
.setTooltip(Text.translatable("zenith.config.general.compression.tooltip"))
|
.setTooltip(Text.translatable("zenith.config.general.compression.tooltip"))
|
||||||
.setSaveConsumer(val -> config.savingCompressionLevel = val)
|
.setSaveConsumer(val -> config.savingCompressionLevel = val)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.cortex.zenith.client.core;
|
package me.cortex.zenith.client.core;
|
||||||
|
|
||||||
|
import me.cortex.zenith.client.Zenith;
|
||||||
import me.cortex.zenith.client.config.ZenithConfig;
|
import me.cortex.zenith.client.config.ZenithConfig;
|
||||||
import me.cortex.zenith.client.core.rendering.*;
|
import me.cortex.zenith.client.core.rendering.*;
|
||||||
import me.cortex.zenith.client.core.rendering.building.RenderGenerationService;
|
import me.cortex.zenith.client.core.rendering.building.RenderGenerationService;
|
||||||
@@ -65,7 +66,7 @@ public class VoxelCore {
|
|||||||
|
|
||||||
//Trigger the shared index buffer loading
|
//Trigger the shared index buffer loading
|
||||||
SharedIndexBuffer.INSTANCE.id();
|
SharedIndexBuffer.INSTANCE.id();
|
||||||
this.renderer = new Gl46FarWorldRenderer();
|
this.renderer = new Gl46FarWorldRenderer(ZenithConfig.CONFIG.geometryBufferSize, ZenithConfig.CONFIG.maxSections);
|
||||||
System.out.println("Renderer initialized");
|
System.out.println("Renderer initialized");
|
||||||
this.world = new WorldEngine(new FragmentedStorageBackendAdaptor(new File(ZenithConfig.CONFIG.storagePath)), ZenithConfig.CONFIG.ingestThreads, ZenithConfig.CONFIG.savingThreads, ZenithConfig.CONFIG.savingCompressionLevel, 5);//"storagefile.db"//"ethoslab.db"
|
this.world = new WorldEngine(new FragmentedStorageBackendAdaptor(new File(ZenithConfig.CONFIG.storagePath)), ZenithConfig.CONFIG.ingestThreads, ZenithConfig.CONFIG.savingThreads, ZenithConfig.CONFIG.savingCompressionLevel, 5);//"storagefile.db"//"ethoslab.db"
|
||||||
System.out.println("World engine");
|
System.out.println("World engine");
|
||||||
|
|||||||
@@ -50,13 +50,13 @@ public abstract class AbstractFarWorldRenderer {
|
|||||||
|
|
||||||
protected FrustumIntersection frustum;
|
protected FrustumIntersection frustum;
|
||||||
|
|
||||||
public AbstractFarWorldRenderer() {
|
public AbstractFarWorldRenderer(int geometrySize, int maxSections) {
|
||||||
this.uniformBuffer = new GlBuffer(1024, 0);
|
this.uniformBuffer = new GlBuffer(1024, 0);
|
||||||
//TODO: make these both dynamically sized
|
//TODO: make these both dynamically sized
|
||||||
this.stateDataBuffer = new GlBuffer((1<<16)*28, 0);//Capacity for 1<<16 entries
|
this.stateDataBuffer = new GlBuffer((1<<16)*28, 0);//Capacity for 1<<16 entries
|
||||||
this.biomeDataBuffer = new GlBuffer(512*4*2, 0);//capacity for 1<<9 entries
|
this.biomeDataBuffer = new GlBuffer(512*4*2, 0);//capacity for 1<<9 entries
|
||||||
this.lightDataBuffer = new GlBuffer(256*4, 0);//256 of uint
|
this.lightDataBuffer = new GlBuffer(256*4, 0);//256 of uint
|
||||||
this.geometry = new GeometryManager();
|
this.geometry = new GeometryManager(geometrySize*8L, maxSections);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void setupVao();
|
protected abstract void setupVao();
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ public class GeometryManager {
|
|||||||
private final BufferArena geometryBuffer;
|
private final BufferArena geometryBuffer;
|
||||||
|
|
||||||
|
|
||||||
public GeometryManager() {
|
public GeometryManager(long geometryBufferSize, int maxSections) {
|
||||||
this.sectionMetaBuffer = new GlBuffer(1L << 23, 0);
|
this.sectionMetaBuffer = new GlBuffer(((long) maxSections) * SECTION_METADATA_SIZE, 0);
|
||||||
this.geometryBuffer = new BufferArena((1L << 30) - 1024, 8);
|
this.geometryBuffer = new BufferArena(geometryBufferSize, 8);
|
||||||
this.pos2id.defaultReturnValue(-1);
|
this.pos2id.defaultReturnValue(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ import static org.lwjgl.opengl.ARBMultiDrawIndirect.glMultiDrawElementsIndirect;
|
|||||||
import static org.lwjgl.opengl.GL11.GL_TRIANGLES;
|
import static org.lwjgl.opengl.GL11.GL_TRIANGLES;
|
||||||
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_SHORT;
|
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_SHORT;
|
||||||
import static org.lwjgl.opengl.GL30.glBindVertexArray;
|
import static org.lwjgl.opengl.GL30.glBindVertexArray;
|
||||||
|
import static org.lwjgl.opengl.GL30C.GL_R8UI;
|
||||||
|
import static org.lwjgl.opengl.GL30C.GL_RED_INTEGER;
|
||||||
import static org.lwjgl.opengl.GL40C.GL_DRAW_INDIRECT_BUFFER;
|
import static org.lwjgl.opengl.GL40C.GL_DRAW_INDIRECT_BUFFER;
|
||||||
import static org.lwjgl.opengl.GL42.*;
|
import static org.lwjgl.opengl.GL42.*;
|
||||||
import static org.lwjgl.opengl.GL42.GL_FRAMEBUFFER_BARRIER_BIT;
|
import static org.lwjgl.opengl.GL42.GL_FRAMEBUFFER_BARRIER_BIT;
|
||||||
import static org.lwjgl.opengl.GL43.*;
|
import static org.lwjgl.opengl.GL43.*;
|
||||||
import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_BUFFER;
|
import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_BUFFER;
|
||||||
|
import static org.lwjgl.opengl.GL45C.glClearNamedBufferData;
|
||||||
import static org.lwjgl.opengl.NVRepresentativeFragmentTest.GL_REPRESENTATIVE_FRAGMENT_TEST_NV;
|
import static org.lwjgl.opengl.NVRepresentativeFragmentTest.GL_REPRESENTATIVE_FRAGMENT_TEST_NV;
|
||||||
|
|
||||||
public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
|
public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
|
||||||
@@ -42,11 +45,15 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
|
|||||||
.add(ShaderType.FRAGMENT, "zenith:lod/gl46/cull/raster.frag")
|
.add(ShaderType.FRAGMENT, "zenith:lod/gl46/cull/raster.frag")
|
||||||
.compile();
|
.compile();
|
||||||
|
|
||||||
private final GlBuffer glCommandBuffer = new GlBuffer(200_000*5*4, 0);
|
private final GlBuffer glCommandBuffer;
|
||||||
private final GlBuffer glVisibilityBuffer = new GlBuffer(200_000*4, 0);
|
private final GlBuffer glVisibilityBuffer;
|
||||||
|
|
||||||
public Gl46FarWorldRenderer() {
|
public Gl46FarWorldRenderer(int geometryBuffer, int maxSections) {
|
||||||
super();
|
super(geometryBuffer, maxSections);
|
||||||
|
glCommandBuffer = new GlBuffer(maxSections*5L*4, 0);
|
||||||
|
glVisibilityBuffer = new GlBuffer(maxSections*4L, 0);
|
||||||
|
glClearNamedBufferData(glCommandBuffer.id, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, new int[1]);
|
||||||
|
glClearNamedBufferData(glVisibilityBuffer.id, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, new int[1]);
|
||||||
setupVao();
|
setupVao();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ public class NvFarWorldRenderer extends AbstractFarWorldRenderer {
|
|||||||
.add(ShaderType.MESH, "voxelmon:lod/nvmesh/primary.mesh")
|
.add(ShaderType.MESH, "voxelmon:lod/nvmesh/primary.mesh")
|
||||||
.add(ShaderType.FRAGMENT, "voxelmon:lod/nvmesh/primary.frag")
|
.add(ShaderType.FRAGMENT, "voxelmon:lod/nvmesh/primary.frag")
|
||||||
.compile();
|
.compile();
|
||||||
|
|
||||||
|
public NvFarWorldRenderer(int geometrySize, int maxSections) {
|
||||||
|
super(geometrySize, maxSections);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupVao() {
|
protected void setupVao() {
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ public class WorldImporter {
|
|||||||
biomes,
|
biomes,
|
||||||
(bx, by, bz, state) -> {
|
(bx, by, bz, state) -> {
|
||||||
int block = 0;
|
int block = 0;
|
||||||
int sky = 0;
|
int sky = 15;//since sky is inverted
|
||||||
if (blockLight != null) {
|
if (blockLight != null) {
|
||||||
block = blockLight.get(bx, by, bz);
|
block = blockLight.get(bx, by, bz);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user