mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 13:19:44 +00:00
Mark chunk graph as dirty when FOV changes (#506)
This commit is contained in:
1 parent
adc575c5ab
commit
8893cf2291
3 files changed
+16
-1
No files matched your search
+6
@@ -7,6 +7,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(EntityRenderer.class)
|
||||
@@ -23,4 +24,9 @@ public abstract class MixinEntityRenderer {
|
||||
);
|
||||
}
|
||||
|
||||
@ModifyArg(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V", ordinal = 0), index = 0)
|
||||
private float captureFov(float fov) {
|
||||
RenderingState.INSTANCE.setFov(fov);
|
||||
return fov;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.gtnewhorizons.angelica.rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3d;
|
||||
import org.lwjgl.BufferUtils;
|
||||
@@ -21,6 +22,9 @@ public class RenderingState {
|
||||
private final Matrix4f projectionMatrix = new Matrix4f().identity();
|
||||
@Getter
|
||||
private final Matrix4f modelViewMatrix = new Matrix4f().identity();
|
||||
@Getter
|
||||
@Setter
|
||||
private float fov;
|
||||
|
||||
|
||||
public void setCameraPosition(double x, double y, double z) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
@@ -64,6 +65,7 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
|
||||
private int renderDistance;
|
||||
|
||||
private double lastCameraX, lastCameraY, lastCameraZ;
|
||||
private float lastFov;
|
||||
private double lastCameraPitch, lastCameraYaw;
|
||||
private float lastFogDistance;
|
||||
|
||||
@@ -213,8 +215,10 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
|
||||
|
||||
float fogDistance = FogHelper.getFogCutoff();
|
||||
|
||||
float fov = RenderingState.INSTANCE.getFov();
|
||||
|
||||
boolean dirty = pos.x != this.lastCameraX || pos.y != this.lastCameraY || pos.z != this.lastCameraZ ||
|
||||
pitch != this.lastCameraPitch || yaw != this.lastCameraYaw || fogDistance != this.lastFogDistance;
|
||||
pitch != this.lastCameraPitch || yaw != this.lastCameraYaw || fogDistance != this.lastFogDistance || fov != this.lastFov;
|
||||
|
||||
if(AngelicaConfig.enableIris) {
|
||||
iris$ensureStateSwapped();
|
||||
@@ -232,6 +236,7 @@ public class SodiumWorldRenderer implements ChunkStatusListener {
|
||||
this.lastCameraPitch = pitch;
|
||||
this.lastCameraYaw = yaw;
|
||||
this.lastFogDistance = fogDistance;
|
||||
this.lastFov = fov;
|
||||
|
||||
profiler.endStartSection("chunk_update");
|
||||
|
||||
|
||||
Reference in new issue
Block a user