Skip to content

Commit

Permalink
Merge branch 'CaffeineMC:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
theyareonit authored Jul 24, 2024
2 parents 824c332 + fa787d0 commit ae9c0f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void onGameInit() {
Required version: 10.18.10.5161 (or newer)
You must update your graphics card driver in order to continue."""
.replace("###CURRENT_DRIVER###", NvidiaDriverVersion.parse(installedVersion).toString()),
.replace("###CURRENT_DRIVER###", installedVersion.toString()),
"https://github.com/CaffeineMC/sodium-fabric/wiki/Driver-Compatibility#windows-intel-gen7");
}
}
Expand All @@ -87,7 +87,7 @@ public static void onGameInit() {
Required version: 536.23 (or newer)
You must update your graphics card driver in order to continue."""
.replace("###CURRENT_DRIVER###", installedVersion.toString()),
.replace("###CURRENT_DRIVER###", NvidiaDriverVersion.parse(installedVersion).toString()),
"https://github.com/CaffeineMC/sodium-fabric/wiki/Driver-Compatibility#nvidia-gpus");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.joml.Matrix4f;
import org.joml.Vector3d;

import java.util.Collection;
Expand All @@ -57,6 +58,7 @@ public class SodiumWorldRenderer {
private Vector3d lastCameraPos;
private double lastCameraPitch, lastCameraYaw;
private float lastFogDistance;
private Matrix4f lastProjectionMatrix;

private boolean useEntityCulling;

Expand Down Expand Up @@ -179,20 +181,27 @@ public void setupTerrain(Camera camera,

Vec3 posRaw = camera.getPosition();
Vector3d pos = new Vector3d(posRaw.x(), posRaw.y(), posRaw.z());
Matrix4f projectionMatrix = new Matrix4f(RenderSystem.getProjectionMatrix());
float pitch = camera.getXRot();
float yaw = camera.getYRot();
float fogDistance = RenderSystem.getShaderFogEnd();

if (this.lastCameraPos == null) {
this.lastCameraPos = new Vector3d(pos);
}
if (this.lastProjectionMatrix == null) {
this.lastProjectionMatrix = new Matrix4f(projectionMatrix);
}
boolean cameraLocationChanged = !pos.equals(this.lastCameraPos);
boolean cameraAngleChanged = pitch != this.lastCameraPitch || yaw != this.lastCameraYaw || fogDistance != this.lastFogDistance;
boolean cameraProjectionChanged = !projectionMatrix.equals(this.lastProjectionMatrix);

this.lastProjectionMatrix = projectionMatrix;

this.lastCameraPitch = pitch;
this.lastCameraYaw = yaw;

if (cameraLocationChanged || cameraAngleChanged) {
if (cameraLocationChanged || cameraAngleChanged || cameraProjectionChanged) {
this.renderSectionManager.markGraphDirty();
}

Expand Down

0 comments on commit ae9c0f8

Please # to comment.