Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NearZ scale slider. #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/me/cortex/voxy/client/config/VoxyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class VoxyConfig {
public int ingestThreads = 2;
public int savingThreads = 4;
public int renderThreads = 5;
public int nearZScale = 1;
public boolean useMeshShaderIfPossible = true;
public String defaultSaveConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ private static void addGeneralCategory(ConfigBuilder builder, VoxyConfig config)
.setDefaultValue(DEFAULT.useMeshShaderIfPossible)
.build());

category.addEntry(entryBuilder.startIntField(Text.translatable("voxy.config.general.nearz"), config.nearZScale)
.setTooltip(Text.translatable("voxy.config.general.nearz.tooltip"))
.setSaveConsumer(val -> config.nearZScale = val)
.setDefaultValue(DEFAULT.nearZScale)
.build());

//category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.compression"), config.savingCompressionLevel, 1, 21)
// .setTooltip(Text.translatable("voxy.config.general.compression.tooltip"))
// .setSaveConsumer(val -> config.savingCompressionLevel = val)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/cortex/voxy/client/core/VoxelCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private static Matrix4f makeProjectionMatrix(float near, float far) {
private static Matrix4f computeProjectionMat() {
return new Matrix4f(RenderSystem.getProjectionMatrix()).mulLocal(
makeProjectionMatrix(0.05f, MinecraftClient.getInstance().gameRenderer.getFarPlaneDistance()).invert()
).mulLocal(makeProjectionMatrix(16, 16*3000));
).mulLocal(makeProjectionMatrix(16*VoxyConfig.CONFIG.nearZScale, 16*3000));
}

public void renderOpaque(MatrixStack matrices, double cameraX, double cameraY, double cameraZ) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/voxy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"voxy.config.general.renderDistance.tooltip": "The render distance in chunks (set to -1 to disable chunk unloading)",
"voxy.config.general.nvmesh": "Use nvidia mesh shaders",
"voxy.config.general.nvmesh.tooltip": "Use nvidia mesh shaders if possible to render LoDs",
"voxy.config.general.nearz": "Near Z scale",
"voxy.config.general.nearz.tooltip": "Scale the Near Z clipping plane",

"voxy.config.threads.ingest": "Ingest",
"voxy.config.threads.ingest.tooltip": "How many threads voxy will use for ingesting new chunks",
Expand Down