13#include <util/ue-header-guard-begin.h>
14#include "CoreMinimal.h"
15#include "Components/ActorComponent.h"
16#include "UObject/ObjectKey.h"
17#include <util/ue-header-guard-end.h>
22#include "CarlaLight.generated.h"
26#define CARLA_ENUM_FROM_RPC(e) static_cast<uint8>(carla::rpc::LightState::LightGroup:: e)
38#undef CARLA_ENUM_FROM_RPC
42UENUM(BlueprintType, Meta = (Bitflags))
52 using U = std::underlying_type_t<ECarlaLightFlags>;
53 return static_cast<ECarlaLightFlags>(
static_cast<U
>(lhs) &
static_cast<U
>(rhs));
58 using U = std::underlying_type_t<ECarlaLightFlags>;
59 return static_cast<ECarlaLightFlags>(
static_cast<U
>(lhs) |
static_cast<U
>(rhs));
64 using U = std::underlying_type_t<ECarlaLightFlags>;
65 return static_cast<ECarlaLightFlags>(
static_cast<U
>(lhs) ^
static_cast<U
>(rhs));
70 using U = std::underlying_type_t<ECarlaLightFlags>;
109UCLASS(Blueprintable, BlueprintType, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
110class CARLA_API UCarlaLight :
111 public UActorComponent
124 void OnRegister()
override;
133 void OnUnregister()
override;
135 void BeginPlay()
override;
137 void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
139 void OnComponentDestroyed(
bool bDestroyingHierarchy)
override;
141 UFUNCTION(BlueprintCallable, Category =
"Carla Light")
142 void RegisterLight();
144 UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category =
"Carla Light")
147 UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category =
"Carla Light")
148 void DayTimeChanged(
bool bIsDay);
156 void HandleDayTimeChanged(
bool bIsDay);
164 void ApplyLegacyComponentConversion();
166 UFUNCTION(BlueprintCallable, Category =
"Carla Light")
167 void SetLightIntensity(
float Intensity);
169 UFUNCTION(BlueprintPure, Category =
"Carla Light")
170 float GetLightIntensity()
const;
172 UFUNCTION(BlueprintCallable, Category =
"Carla Light")
173 void SetLightColor(FLinearColor Color);
175 UFUNCTION(BlueprintPure, Category =
"Carla Light")
176 FLinearColor GetLightColor()
const;
178 UFUNCTION(BlueprintCallable, Category =
"Carla Light")
179 void SetLightOn(
bool bOn);
181 UFUNCTION(BlueprintPure, Category =
"Carla Light")
182 bool GetLightOn()
const;
188 UFUNCTION(BlueprintCallable, Category =
"Carla Light")
189 void SetEmissiveIntensity(
float Value);
191 UFUNCTION(BlueprintPure, Category =
"Carla Light")
192 float GetEmissiveIntensity()
const;
194 UFUNCTION(BlueprintCallable, Category =
"Carla Light")
197 UFUNCTION(BlueprintPure, Category =
"Carla Light")
206 void SetLightState(
float Intensity, FLinearColor Color,
ELightType Type,
bool bOn);
208 FVector GetLocation()
const;
210 UFUNCTION(BlueprintPure, Category =
"Carla Light")
213 UFUNCTION(BlueprintCallable, Category =
"Carla Light")
214 void SetId(
int InId);
223 static void ActivateAndConfigureLightComponents(
AActor* Owner);
231 static void ScaleLightComponentIntensities(
AActor* Owner,
ELightType LightType,
232 TMap<FObjectKey, float>* Converted =
nullptr);
237 static float GetLegacyIntensityScale(
ELightType LightType);
242 static float StreetIntensityToLumens(
float Intensity);
252 void ApplyLightOnToComponents(
bool bOn);
261 void ApplyIntensityToComponents(
float Intensity);
265 void ApplyColorToComponents(FLinearColor Color);
277 void ApplyEmissiveToComponents(
float Value);
284 void ApplyEmissiveVisualState(
float Value);
294 FTimerHandle DeferredEmissiveTimerHandle;
301 void ApplyLightAssetDefault();
305 UPROPERTY(EditAnywhere, Category =
"Carla Light")
306 FLinearColor LightColor;
308 UPROPERTY(EditAnywhere, Category =
"Carla Light")
309 float LightIntensity;
311 UPROPERTY(EditAnywhere, Category =
"Carla Light")
312 float EmissiveIntensity = 0.0f;
314 UPROPERTY(EditAnywhere, Category =
"Carla Light")
317 UPROPERTY(EditAnywhere, Category =
"Carla Light")
320 UPROPERTY(EditAnywhere, Category =
"Carla Light")
325 void RecordLightChange()
const;
331 TMap<FObjectKey, float> ConvertedIntensities;
constexpr auto operator&(ECarlaLightFlags lhs, ECarlaLightFlags rhs)
constexpr auto operator~(ECarlaLightFlags lhs)
constexpr auto operator^=(ECarlaLightFlags &lhs, ECarlaLightFlags rhs)
constexpr auto operator^(ECarlaLightFlags lhs, ECarlaLightFlags rhs)
constexpr auto operator|=(ECarlaLightFlags &lhs, ECarlaLightFlags rhs)
constexpr auto operator|(ECarlaLightFlags lhs, ECarlaLightFlags rhs)
constexpr auto operator&=(ECarlaLightFlags &lhs, ECarlaLightFlags rhs)
#define CARLA_ENUM_FROM_RPC(e)