here we go again

This commit is contained in:
mcrcortex
2025-12-18 14:23:16 +10:00
parent bca46143fb
commit d30ea7ecc7
6 changed files with 14 additions and 16 deletions

View File

@@ -29,7 +29,6 @@ public class VoxyConfig {
public int sectionRenderDistance = 16;
public int serviceThreads = (int) Math.max(CpuLayout.getCoreCount()/1.5, 1);
public float subDivisionSize = 64;
public boolean useRenderFog = false;
public boolean useEnvironmentalFog = true;
public boolean dontUseSodiumBuilderThreads = false;

View File

@@ -119,12 +119,6 @@ public class VoxyConfigMenu implements ConfigEntryPoint {
Component.translatable("voxy.config.general.environmental_fog"),
()->CFG.useEnvironmentalFog, v->CFG.useEnvironmentalFog=v)
.setPostChangeFlags(OptionFlag.REQUIRES_RENDERER_RELOAD.getId().toString())
), new Group(
new BoolOption(
"voxy:render_distance_fog",
Component.translatable("voxy.config.general.vanilla_fog"),
()->CFG.useRenderFog, v->CFG.useRenderFog=v)
.setPostChangeFlags(OptionFlag.REQUIRES_RENDERER_RELOAD.getId().toString())
), new Group(
new BoolOption(
"voxy:render_debug",

View File

@@ -109,7 +109,8 @@ public class NormalRenderPipeline extends AbstractRenderPipeline {
float end = viewport.fogParameters.environmentalEnd();
if (Math.abs(end-start)>1) {
float invEndFogDelta = 1f / (end - start);
float endDistance = Minecraft.getInstance().gameRenderer.getRenderDistance()*(float)Math.sqrt(3);
float endDistance = Math.max(Minecraft.getInstance().gameRenderer.getRenderDistance(), 20*16);//TODO: make this constant a config option
endDistance *= (float)Math.sqrt(3);
float startDelta = -start * invEndFogDelta;
glUniform4f(4, invEndFogDelta, startDelta, Math.clamp(endDistance*invEndFogDelta+startDelta, 0, 1),0);//
glUniform4f(5, viewport.fogParameters.red(), viewport.fogParameters.green(), viewport.fogParameters.blue(), viewport.fogParameters.alpha());

View File

@@ -22,15 +22,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
public class MixinFogRenderer {
@Inject(method = "setupFog", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;getDevice()Lcom/mojang/blaze3d/systems/GpuDevice;", remap = false))
private void voxy$modifyFog(Camera camera, int rdInt, DeltaTracker tracker, float pTick, ClientLevel lvl, CallbackInfoReturnable<Vector4f> cir, @Local(type=FogData.class) FogData data) {
if (!(VoxyConfig.CONFIG.useRenderFog||VoxyConfig.CONFIG.useEnvironmentalFog)) {
if (!VoxyConfig.CONFIG.useEnvironmentalFog) {
return;
}
var vrs = IGetVoxyRenderSystem.getNullable();
if (vrs == null) return;
data.renderDistanceStart = 999999999;
data.renderDistanceEnd = 999999999;
/*
if (!VoxyConfig.CONFIG.useRenderFog) {
data.renderDistanceStart = 999999999;
data.renderDistanceEnd = 999999999;
}
}*/
if (!VoxyConfig.CONFIG.useEnvironmentalFog) {
data.environmentalStart = 99999999;
data.environmentalEnd = 99999999;

View File

@@ -15,7 +15,7 @@ ivec3 unpackPos(ivec2 pos) {
}
bool shouldRender(ivec3 icorner) {
vec3 corner = vec3(mix(mix(ivec3(0), icorner-MIN, greaterThan(icorner-MIN, ivec3(0))), icorner+MAX, lessThan(icorner+MAX, ivec3(0))))-negInnerSec.xyz;
vec3 corner = vec3(mix(mix(ivec3(0), icorner-1, greaterThan(icorner-1, ivec3(0))), icorner+17, lessThan(icorner+17, ivec3(0))))-negInnerSec.xyz;
bool visible = (corner.x*corner.x + corner.z*corner.z) < (negInnerSec.w*negInnerSec.w);
visible = visible && abs(corner.y) < negInnerSec.w;
return visible;