CARLA
Weather.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "GameFramework/Actor.h"
11 
12 #include "Weather.generated.h"
13 
14 class ASensor;
16 
17 UCLASS(Abstract)
18 class CARLA_API AWeather : public AActor
19 {
20  GENERATED_BODY()
21 
22 public:
23 
24  AWeather(const FObjectInitializer& ObjectInitializer);
25 
26  /// Update the weather parameters and notifies it to the blueprint's event
27  UFUNCTION(BlueprintCallable)
28  void ApplyWeather(const FWeatherParameters &WeatherParameters);
29 
30  /// Notifing the weather to the blueprint's event
31  void NotifyWeather(ASensor* Sensor = nullptr);
32 
33  /// Update the weather parameters without notifing it to the blueprint's event
34  UFUNCTION(BlueprintCallable)
35  void SetWeather(const FWeatherParameters &WeatherParameters);
36 
37  /// Returns the current WeatherParameters
38  UFUNCTION(BlueprintCallable)
39  const FWeatherParameters &GetCurrentWeather() const
40  {
41  return Weather;
42  }
43 
44  /// Returns whether the day night cycle is active (automatic on/off switch when changin to night mode)
45  UFUNCTION(BlueprintCallable)
46  const bool &GetDayNightCycle() const
47  {
48  return DayNightCycle;
49  }
50 
51  /// Update the day night cycle
52  void SetDayNightCycle(const bool &active);
53 
54 protected:
55 
56  UFUNCTION(BlueprintImplementableEvent)
57  void RefreshWeather(const FWeatherParameters &WeatherParameters);
58 
59 private:
60 
61  void CheckWeatherPostProcessEffects();
62 
63  UPROPERTY(VisibleAnywhere)
65 
66  UMaterial* PrecipitationPostProcessMaterial;
67 
68  UMaterial* DustStormPostProcessMaterial;
69 
70  TMap<UMaterial*, float> ActiveBlendables;
71 
72  UPROPERTY(EditAnywhere, Category = "Weather")
73  bool DayNightCycle = true;
74 };
A sensor that captures images from the scene.