here we go again
This commit is contained in:
@@ -120,9 +120,11 @@ dependencies {
|
|||||||
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
//TODO: this is to eventually not need sodium installed as atm its just used for parsing shaders
|
if (true) {
|
||||||
//modImplementation "maven.modrinth:sodium:mc1.21.11-0.8.0-fabric"
|
modImplementation "maven.modrinth:sodium:mc1.21.11-0.8.1-fabric"
|
||||||
modImplementation "net.caffeinemc:sodium-fabric:0.8.1-SNAPSHOT+mc1.21.11+"
|
} else {
|
||||||
|
modImplementation "net.caffeinemc:sodium-fabric:0.8.1-SNAPSHOT+mc1.21.11+"
|
||||||
|
}
|
||||||
|
|
||||||
modImplementation("maven.modrinth:lithium:mc1.21.11-0.21.0-fabric")
|
modImplementation("maven.modrinth:lithium:mc1.21.11-0.21.0-fabric")
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class VoxyConfig {
|
|||||||
public int sectionRenderDistance = 16;
|
public int sectionRenderDistance = 16;
|
||||||
public int serviceThreads = (int) Math.max(CpuLayout.getCoreCount()/1.5, 1);
|
public int serviceThreads = (int) Math.max(CpuLayout.getCoreCount()/1.5, 1);
|
||||||
public float subDivisionSize = 64;
|
public float subDivisionSize = 64;
|
||||||
public boolean useRenderFog = false;
|
|
||||||
public boolean useEnvironmentalFog = true;
|
public boolean useEnvironmentalFog = true;
|
||||||
public boolean dontUseSodiumBuilderThreads = false;
|
public boolean dontUseSodiumBuilderThreads = false;
|
||||||
|
|
||||||
|
|||||||
@@ -119,12 +119,6 @@ public class VoxyConfigMenu implements ConfigEntryPoint {
|
|||||||
Component.translatable("voxy.config.general.environmental_fog"),
|
Component.translatable("voxy.config.general.environmental_fog"),
|
||||||
()->CFG.useEnvironmentalFog, v->CFG.useEnvironmentalFog=v)
|
()->CFG.useEnvironmentalFog, v->CFG.useEnvironmentalFog=v)
|
||||||
.setPostChangeFlags(OptionFlag.REQUIRES_RENDERER_RELOAD.getId().toString())
|
.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 Group(
|
||||||
new BoolOption(
|
new BoolOption(
|
||||||
"voxy:render_debug",
|
"voxy:render_debug",
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ public class NormalRenderPipeline extends AbstractRenderPipeline {
|
|||||||
float end = viewport.fogParameters.environmentalEnd();
|
float end = viewport.fogParameters.environmentalEnd();
|
||||||
if (Math.abs(end-start)>1) {
|
if (Math.abs(end-start)>1) {
|
||||||
float invEndFogDelta = 1f / (end - start);
|
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;
|
float startDelta = -start * invEndFogDelta;
|
||||||
glUniform4f(4, invEndFogDelta, startDelta, Math.clamp(endDistance*invEndFogDelta+startDelta, 0, 1),0);//
|
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());
|
glUniform4f(5, viewport.fogParameters.red(), viewport.fogParameters.green(), viewport.fogParameters.blue(), viewport.fogParameters.alpha());
|
||||||
|
|||||||
@@ -22,15 +22,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
public class MixinFogRenderer {
|
public class MixinFogRenderer {
|
||||||
@Inject(method = "setupFog", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;getDevice()Lcom/mojang/blaze3d/systems/GpuDevice;", remap = false))
|
@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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
var vrs = IGetVoxyRenderSystem.getNullable();
|
var vrs = IGetVoxyRenderSystem.getNullable();
|
||||||
if (vrs == null) return;
|
if (vrs == null) return;
|
||||||
|
|
||||||
|
data.renderDistanceStart = 999999999;
|
||||||
|
data.renderDistanceEnd = 999999999;
|
||||||
|
/*
|
||||||
if (!VoxyConfig.CONFIG.useRenderFog) {
|
if (!VoxyConfig.CONFIG.useRenderFog) {
|
||||||
data.renderDistanceStart = 999999999;
|
}*/
|
||||||
data.renderDistanceEnd = 999999999;
|
|
||||||
}
|
|
||||||
if (!VoxyConfig.CONFIG.useEnvironmentalFog) {
|
if (!VoxyConfig.CONFIG.useEnvironmentalFog) {
|
||||||
data.environmentalStart = 99999999;
|
data.environmentalStart = 99999999;
|
||||||
data.environmentalEnd = 99999999;
|
data.environmentalEnd = 99999999;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ ivec3 unpackPos(ivec2 pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool shouldRender(ivec3 icorner) {
|
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);
|
bool visible = (corner.x*corner.x + corner.z*corner.z) < (negInnerSec.w*negInnerSec.w);
|
||||||
visible = visible && abs(corner.y) < negInnerSec.w;
|
visible = visible && abs(corner.y) < negInnerSec.w;
|
||||||
return visible;
|
return visible;
|
||||||
|
|||||||
Reference in New Issue
Block a user