From ee503ba89f048159873706d99ccc1c380d9f129d Mon Sep 17 00:00:00 2001
From: Erik Hofman <erik@ehofman.com>
Date: Thu, 25 Mar 2021 11:13:38 +0100
Subject: [PATCH] Add a property /sim/rendering/desert which can be used by the
 meterials definiton to alter the amount of dessertness based on latitude.
 It's op to the material definition what to do with it, if at all. This is not
 a prediction that there is actually desert at that latitude.

---
 src/Environment/climate.cxx | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/Environment/climate.cxx b/src/Environment/climate.cxx
index 1694966d3..ac8586495 100644
--- a/src/Environment/climate.cxx
+++ b/src/Environment/climate.cxx
@@ -934,6 +934,11 @@ void FGClimate::set_environment()
             fgSetDouble("/environment/season", 0.0);
         }
     }
+
+    // for material animation
+    double latitude_deg = _positionLatitudeNode->getDoubleValue();
+    double desert_pct = std::min( fabs(latitude_deg-23.5)/23.5, 1.0);
+    fgSetDouble("/sim/rendering/desert", 0.1-0.2*desert_pct);
 }
 
 void FGClimate::setEnvironmentUpdate(bool value)