CARLA
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Traffic
DigitalTwinsTrafficLight.h
Go to the documentation of this file.
1
// Copyright (c) 2024 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 "CoreMinimal.h"
10
#include "
Traffic/TrafficLightBase.h
"
11
#include "DigitalTwinsTrafficLight.generated.h"
12
13
/**
14
* Traffic light class specifically for DigitalTwins meshes.
15
* Implements visual material updates for DigitalTwins atlas system.
16
*/
17
UCLASS()
18
class CARLA_API
ADigitalTwinsTrafficLight
: public
ATrafficLightBase
19
{
20
GENERATED_BODY()
21
22
public
:
23
ADigitalTwinsTrafficLight
(
const
FObjectInitializer &ObjectInitializer);
24
25
virtual
void
BeginPlay()
override
;
26
27
private
:
28
// Called when traffic light state changes via the LightChangeDispatcher
29
UFUNCTION()
30
void
OnLightStateChanged();
31
32
private
:
33
/// Update material parameters for DigitalTwins meshes based on traffic light state
34
void
UpdateDigitalTwinsMaterials(
ETrafficLightState
State
);
35
36
/// Scan every "led_*" material slot of this actor's meshes and sort the lamps into states.
37
/// Called lazily from UpdateDigitalTwinsMaterials, and again whenever the actor's mesh
38
/// component count changes (UMapLogicParser re-parents the baked rig's meshes onto us).
39
void
BuildLampMap();
40
41
/// Get the emissive color for a given traffic light state
42
FLinearColor GetColorForState(
ETrafficLightState
State
)
const
;
43
44
/// Every lamp this actor drives, and the state it belongs to. A rig may carry any number of
45
/// lamps per state (a mast arm repeats the three aspects on each head, a combi head adds
46
/// arrow aspects), so this is not limited to three entries.
47
TMap<UMaterialInstanceDynamic*, ETrafficLightState>
MaterialToLightType
;
48
49
/// Lamps that belong to no state -- the stateless atlas glyphs (Tram, tram lines, Circle,
50
/// Triangle) and anything unclassifiable. Baked lit at intensity 50000, so they are
51
/// switched off once and never touched again.
52
TArray<UMaterialInstanceDynamic*>
DarkMaterials
;
53
54
/// Mesh component count the lamp map was built from.
55
int32 CachedMeshComponentCount = 0;
56
};
CarlaRecorderPacketId::State
@ State
TrafficLightBase.h
ETrafficLightState
ETrafficLightState
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Traffic/TrafficLightState.h:13
ADigitalTwinsTrafficLight
Traffic light class specifically for DigitalTwins meshes.
Definition
DigitalTwinsTrafficLight.h:19
ADigitalTwinsTrafficLight::DarkMaterials
TArray< UMaterialInstanceDynamic * > DarkMaterials
Lamps that belong to no state – the stateless atlas glyphs (Tram, tram lines, Circle,...
Definition
DigitalTwinsTrafficLight.h:52
ADigitalTwinsTrafficLight::MaterialToLightType
TMap< UMaterialInstanceDynamic *, ETrafficLightState > MaterialToLightType
Every lamp this actor drives, and the state it belongs to.
Definition
DigitalTwinsTrafficLight.h:47
ATrafficLightBase
Definition
TrafficLightBase.h:21
Generated by
1.9.8