Holds the static meshes and instances necessary for building a city map. More...
#include <CityMapMeshHolder.h>
Public Member Functions | |
ACityMapMeshHolder (const FObjectInitializer &ObjectInitializer) | |
Initializes the mesh holders. More... | |
Protected Member Functions | |
void | AddInstance (ECityMapMeshTag Tag, uint32 X, uint32 Y) |
Add an instance of a mesh with a given tile location. More... | |
void | AddInstance (ECityMapMeshTag Tag, uint32 X, uint32 Y, float Angle) |
Add an instance of a mesh with a given tile location and rotation. More... | |
void | AddInstance (ECityMapMeshTag Tag, FTransform Transform) |
Add an instance of a mesh with a given transform. More... | |
float | GetMapScale () const |
UStaticMesh * | GetStaticMesh (ECityMapMeshTag Tag) |
Return the static mesh corresponding to Tag. More... | |
const UStaticMesh * | GetStaticMesh (ECityMapMeshTag Tag) const |
Return the static mesh corresponding to Tag. More... | |
ECityMapMeshTag | GetTag (const UStaticMesh &StaticMesh) const |
Return the tag corresponding to StaticMesh. More... | |
FVector | GetTileLocation (uint32 X, uint32 Y) const |
Return the 3D world location (relative to this actor) of the given 2D tile. More... | |
virtual void | OnConstruction (const FTransform &Transform) override |
Initializes the instantiators. More... | |
virtual void | PostInitializeComponents () override |
void | SetStaticMesh (ECityMapMeshTag Tag, UStaticMesh *Mesh) |
Set the static mesh associated with Tag. More... | |
Private Member Functions | |
void | DeletePieces () |
Clear all instances of the static mesh actors. More... | |
virtual void | UpdateMap () |
Here does nothing, implement in derived classes. More... | |
void | UpdateMapScale () |
Set the scale to the dimensions of the base mesh. More... | |
Private Attributes | |
float | MapScale = 1.0f |
USceneComponent * | SceneRootComponent |
TMap< ECityMapMeshTag, UStaticMesh * > | StaticMeshes |
TMap< UStaticMesh *, ECityMapMeshTag > | TagMap |
Holds the static meshes and instances necessary for building a city map.
Definition at line 20 of file CityMapMeshHolder.h.
ACityMapMeshHolder::ACityMapMeshHolder | ( | const FObjectInitializer & | ObjectInitializer | ) |
Initializes the mesh holders.
It is safe to call SetStaticMesh after this. However, instances cannot be added until OnConstruction is called.
Definition at line 26 of file CityMapMeshHolder.cpp.
References CityMapMeshTag::FromUInt(), NUMBER_OF_TAGS, SceneRootComponent, and StaticMeshes.
|
protected |
Add an instance of a mesh with a given tile location.
Tag | The mesh' tag |
X | Tile coordinate X |
Y | Tile coordinate Y |
Definition at line 120 of file CityMapMeshHolder.cpp.
References GetTileLocation().
Referenced by AddInstance(), and ACityMapGenerator::GenerateRoads().
|
protected |
Add an instance of a mesh with a given tile location and rotation.
Tag | The mesh' tag |
X | Tile coordinate X |
Y | Tile coordinate Y |
Angle | Rotation around Z axis |
Definition at line 125 of file CityMapMeshHolder.cpp.
References AddInstance(), and GetTileLocation().
|
protected |
Add an instance of a mesh with a given transform.
Tag | The mesh' tag |
Transform | Transform that will be applied to the mesh |
Definition at line 132 of file CityMapMeshHolder.cpp.
References UCarlaSettings::CARLA_ROAD_TAG, and GetStaticMesh().
|
private |
Clear all instances of the static mesh actors.
Definition at line 154 of file CityMapMeshHolder.cpp.
References UCarlaSettings::CARLA_ROAD_TAG.
Referenced by PostInitializeComponents().
|
inlineprotected |
Definition at line 49 of file CityMapMeshHolder.h.
Referenced by ACityMapGenerator::GenerateRoadMap().
|
protected |
Return the static mesh corresponding to Tag.
Definition at line 104 of file CityMapMeshHolder.cpp.
References StaticMeshes.
Referenced by AddInstance(), and UpdateMapScale().
|
protected |
Return the static mesh corresponding to Tag.
Definition at line 109 of file CityMapMeshHolder.cpp.
References StaticMeshes.
|
protected |
Return the tag corresponding to StaticMesh.
Definition at line 114 of file CityMapMeshHolder.cpp.
References TagMap.
Referenced by ACityMapGenerator::GenerateRoadMap().
|
protected |
Return the 3D world location (relative to this actor) of the given 2D tile.
Definition at line 91 of file CityMapMeshHolder.cpp.
References MapScale.
Referenced by AddInstance().
|
overrideprotectedvirtual |
Initializes the instantiators.
Definition at line 50 of file CityMapMeshHolder.cpp.
|
overrideprotectedvirtual |
Definition at line 56 of file CityMapMeshHolder.cpp.
References DeletePieces(), IsValid(), UpdateMap(), and UpdateMapScale().
|
protected |
Set the static mesh associated with Tag.
Definition at line 96 of file CityMapMeshHolder.cpp.
References StaticMeshes, and TagMap.
|
privatevirtual |
Here does nothing, implement in derived classes.
Reimplemented in ACityMapGenerator.
Definition at line 152 of file CityMapMeshHolder.cpp.
Referenced by PostInitializeComponents().
|
private |
Set the scale to the dimensions of the base mesh.
Definition at line 177 of file CityMapMeshHolder.cpp.
References CityMapMeshTag::GetBaseMeshTag(), GetStaticMesh(), MapScale, and CityMapMeshTag::ToString().
Referenced by PostInitializeComponents().
|
private |
Definition at line 110 of file CityMapMeshHolder.h.
Referenced by GetTileLocation(), and UpdateMapScale().
|
private |
Definition at line 107 of file CityMapMeshHolder.h.
Referenced by ACityMapMeshHolder().
|
private |
Definition at line 113 of file CityMapMeshHolder.h.
Referenced by ACityMapMeshHolder(), GetStaticMesh(), and SetStaticMesh().
|
private |
Definition at line 116 of file CityMapMeshHolder.h.
Referenced by GetTag(), and SetStaticMesh().