Improve terrain fog quality and refactor cloud rendering #52
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
package org.embeddedt.embeddium.impl.mixin.features.render.world.clouds;
|
||||
|
||||
//? if >=1.17 && <1.21.6 {
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import net.minecraft.client.CloudStatus;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import org.embeddedt.embeddium.impl.Celeritas;
|
||||
import org.embeddedt.embeddium.impl.render.immediate.ModernCloudRenderer;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
/**
|
||||
* Pushes the far plane out to the cloud range, as vanilla does since 1.21.6, so that clouds past the terrain
|
||||
* render distance aren't clipped.
|
||||
*/
|
||||
@Mixin(GameRenderer.class)
|
||||
public class GameRendererMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private Minecraft minecraft;
|
||||
|
||||
@ModifyReturnValue(method = "getDepthFar", at = @At("RETURN"))
|
||||
private float celeritas$extendDepthFarForClouds(float depthFar) {
|
||||
if (!Celeritas.options().performance.useFasterClouds || this.minecraft.options.getCloudsType() == CloudStatus.OFF) {
|
||||
return depthFar;
|
||||
}
|
||||
|
||||
return Math.max(depthFar, ModernCloudRenderer.getCloudRange());
|
||||
}
|
||||
}
|
||||
//?}
|
||||
+5
-1
@@ -82,6 +82,10 @@ public class ModernCloudRenderer {
|
||||
return event.getCloudRenderDistance();
|
||||
}
|
||||
|
||||
public static float getCloudRange() {
|
||||
return fireModifyCloudRenderDistanceEvent(CLOUD_RANGE_CHUNKS) * 16.0f;
|
||||
}
|
||||
|
||||
public void render(@Nullable ClientLevel world, LocalPlayer player, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, float ticks, float tickDelta, double cameraX, double cameraY, double cameraZ) {
|
||||
if (world == null) {
|
||||
return;
|
||||
@@ -94,7 +98,7 @@ public class ModernCloudRenderer {
|
||||
return;
|
||||
}
|
||||
|
||||
float range = fireModifyCloudRenderDistanceEvent(CLOUD_RANGE_CHUNKS) * 16.0f;
|
||||
float range = getCloudRange();
|
||||
float fogEnd = getFogEnd(range);
|
||||
|
||||
if (fogEnd <= 0.0f) {
|
||||
|
||||
Reference in new issue
Block a user