diff --git a/common/src/main/java/com/seibel/lod/common/Config.java b/common/src/main/java/com/seibel/lod/common/Config.java index 1460b58e9..7ee333aa9 100644 --- a/common/src/main/java/com/seibel/lod/common/Config.java +++ b/common/src/main/java/com/seibel/lod/common/Config.java @@ -29,6 +29,7 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.I import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.IAdvancedFog.IHeightFog; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IMultiplayer; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced; /** @@ -283,6 +284,11 @@ public class Config @ConfigAnnotations.Entry public static boolean enableCaveCulling = IAdvancedGraphics.ENABLE_CAVE_CULLING_DEFAULT; + @ConfigAnnotations.FileComment + public static String _caveCullingHeight = IAdvancedGraphics.CAVE_CULLING_HEIGHT_DESC; + @ConfigAnnotations.Entry(minValue = -4096, maxValue = 4096) + public static int caveCullingHeight = IAdvancedGraphics.CAVE_CULLING_HEIGHT_MIN_DEFAULT_MAX.defaultValue; + /* @ConfigAnnotations.FileComment public static String _backsideCullingRange = IAdvancedGraphics.VANILLA_CULLING_RANGE_DESC; @@ -355,8 +361,13 @@ public class Config @ConfigAnnotations.ScreenEntry public static Buffers buffers; - - + + @ConfigAnnotations.FileComment + public static String _lodOnlyMode = IAdvanced.LOD_ONLY_MODE_DESC; + @ConfigAnnotations.Entry + public static boolean lodOnlyMode = IAdvanced.LOD_ONLY_MODE_DEFAULT; + + public static class Threading { @ConfigAnnotations.FileComment diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java b/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java index 4855732ca..bbba2eb72 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/config/LodConfigWrapperSingleton.java @@ -530,6 +530,18 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.enableCaveCulling"); } + + @Override + public int getCaveCullingHeight() { + return Config.Client.Graphics.AdvancedGraphics.caveCullingHeight; + } + + @Override + public void setCaveCullingHeight(int newCaveCullingHeight) { + ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.caveCullingHeight").value = newCaveCullingHeight; + ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.caveCullingHeight"); + + } } } @@ -679,8 +691,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { return buffers; } - - + + public Advanced() { threading = new Threading(); @@ -804,6 +816,18 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton ConfigGui.editSingleOption.saveOption("client.advanced.buffers.newBufferRebuildTimes"); } } + + @Override + public boolean getLodOnlyMode() { + return Config.Client.Advanced.lodOnlyMode; + } + + @Override + public void setLodOnlyMode(boolean newLodOnlyMode) { + ConfigGui.editSingleOption.getEntry("client.advanced.buffers.lodOnlyMode").value = newLodOnlyMode; + ConfigGui.editSingleOption.saveOption("client.advanced.buffers.lodOnlyMode"); + + } } } } diff --git a/core b/core index 4a2a6fb4b..95c5854d8 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 4a2a6fb4bd8770c19473a9089f097cff8fddf390 +Subproject commit 95c5854d8fc5bbab0eef4d5da827fa8ccbff376d diff --git a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java index 5af847ea4..5a370eed4 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/mixins/MixinWorldRenderer.java @@ -21,6 +21,7 @@ package com.seibel.lod.fabric.mixins; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; +import com.seibel.lod.common.Config; import com.seibel.lod.common.wrappers.McObjectConverter; import com.seibel.lod.core.api.ClientApi; import com.seibel.lod.core.objects.math.Mat4f; @@ -61,6 +62,7 @@ public class MixinWorldRenderer previousPartialTicks = tickDelta; } + /* Inject rendering at renderSky // HEAD or RETURN @Inject(at = @At("RETURN"), method = "renderSky", @@ -73,10 +75,9 @@ public class MixinWorldRenderer ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); - } - - /* + }*/ + // Inject rendering at first call to renderChunkLayer // HEAD or RETURN @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", @@ -91,6 +92,8 @@ public class MixinWorldRenderer ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } - //callback.cancel(); - }*/ + if (Config.Client.Advanced.lodOnlyMode) { + callback.cancel(); + } + } } diff --git a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java index 9a3947d32..cad7b44e8 100644 --- a/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java +++ b/forge/src/main/java/com/seibel/lod/forge/mixins/MixinWorldRenderer.java @@ -21,6 +21,7 @@ package com.seibel.lod.forge.mixins; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; +import com.seibel.lod.common.Config; import com.seibel.lod.common.wrappers.McObjectConverter; import com.seibel.lod.core.api.ClientApi; import com.seibel.lod.core.objects.math.Mat4f; @@ -61,7 +62,9 @@ public class MixinWorldRenderer } // HEAD or RETURN - @Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V") + @Inject(at = @At("HEAD"), + method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", + cancellable = true) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) { // only render before solid blocks @@ -72,5 +75,8 @@ public class MixinWorldRenderer ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); } + if (Config.Client.Advanced.lodOnlyMode) { + callback.cancel(); + } } }