diff --git a/PythonAPI/examples/dynamic_weather.py b/PythonAPI/examples/dynamic_weather.py index 01012f9b2..fd831ae59 100755 --- a/PythonAPI/examples/dynamic_weather.py +++ b/PythonAPI/examples/dynamic_weather.py @@ -46,10 +46,10 @@ class Sun(object): self._t %= 2.0 * math.pi self.azimuth += 0.25 * delta_seconds self.azimuth %= 360.0 - self.altitude = 35.0 * (math.sin(self._t) + 1.0) + self.altitude = (70 * math.sin(self._t)) - 20 def __str__(self): - return 'Sun(%.2f, %.2f)' % (self.azimuth, self.altitude) + return 'Sun(alt: %.2f, azm: %.2f)' % (self.altitude, self.azimuth) class Storm(object): @@ -58,8 +58,10 @@ class Storm(object): self._increasing = True self.clouds = 0.0 self.rain = 0.0 + self.wetness = 0.0 self.puddles = 0.0 self.wind = 0.0 + self.fog = 0.0 def tick(self, delta_seconds): delta = (1.3 if self._increasing else -1.3) * delta_seconds @@ -67,8 +69,10 @@ class Storm(object): self.clouds = clamp(self._t + 40.0, 0.0, 90.0) self.rain = clamp(self._t, 0.0, 80.0) delay = -10.0 if self._increasing else 90.0 - self.puddles = clamp(self._t + delay, 0.0, 75.0) - self.wind = clamp(self._t - delay, 0.0, 80.0) + self.puddles = clamp(self._t + delay, 0.0, 85.0) + self.wetness = clamp(self._t * 5, 0.0, 100.0) + self.wind = 5.0 if self.clouds <= 20 else 90 if self.clouds >= 70 else 40 + self.fog = clamp(self._t - 10, 0.0, 30.0) if self._t == -250.0: self._increasing = True if self._t == 100.0: @@ -91,6 +95,8 @@ class Weather(object): self.weather.precipitation = self._storm.rain self.weather.precipitation_deposits = self._storm.puddles self.weather.wind_intensity = self._storm.wind + self.weather.fog_density = self._storm.fog + self.weather.wetness = self._storm.wetness self.weather.sun_azimuth_angle = self._sun.azimuth self.weather.sun_altitude_angle = self._sun.altitude diff --git a/PythonAPI/util/weather.py b/PythonAPI/util/weather.py index 55fad63f3..2a796e726 100755 --- a/PythonAPI/util/weather.py +++ b/PythonAPI/util/weather.py @@ -49,6 +49,9 @@ def apply_weather_presets(args, weather): weather.precipitation = WEATHER_PRESETS[args.weather][1] weather.precipitation_deposits = WEATHER_PRESETS[args.weather][2] weather.wind_intensity = WEATHER_PRESETS[args.weather][3] + weather.fog_density = WEATHER_PRESETS[args.weather][4] + weather.fog_distance = WEATHER_PRESETS[args.weather][5] + weather.wetness = WEATHER_PRESETS[args.weather][6] else: print("[ERROR]: Command [--weather | -w] '" + args.weather + "' not known") sys.exit(1)