From 990a7e21dd8fcd4644a9157c9624966d94848f7e Mon Sep 17 00:00:00 2001
From: aap <aap@papnet.eu>
Date: Tue, 7 Jul 2020 10:09:38 +0200
Subject: [PATCH] fixed d3d fog bug

---
 src/d3d/d3ddevice.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/d3d/d3ddevice.cpp b/src/d3d/d3ddevice.cpp
index 8fde625..2481b1c 100644
--- a/src/d3d/d3ddevice.cpp
+++ b/src/d3d/d3ddevice.cpp
@@ -791,6 +791,8 @@ beginUpdate(Camera *cam)
 	d3dShaderState.fogData.start = cam->fogPlane;
 	d3dShaderState.fogData.end = cam->farPlane;
 	d3dShaderState.fogData.range = 1.0f/(cam->fogPlane - cam->farPlane);
+	// TODO: not quite sure this is the right place to do this...
+	d3dShaderState.fogData.disable = rwStateCache.fogenable ? 0.0f : 1.0f;
 	d3dShaderState.fogDisable.start = 0.0f;
 	d3dShaderState.fogDisable.end = 0.0f;
 	d3dShaderState.fogDisable.range = 0.0f;