CARLA
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
AProceduralBuilding Class Reference

#include <ProceduralBuilding.h>

+ Inheritance diagram for AProceduralBuilding:
+ Collaboration diagram for AProceduralBuilding:

Public Member Functions

 AProceduralBuilding ()
 
void ConvertOldBP_ToNativeCodeObject (AActor *BP_Building)
 
UHierarchicalInstancedStaticMeshComponent * GetHISMComp (const UStaticMesh *SM)
 
void HideAllChildren ()
 
void SetBaseMeshes (const TArray< UStaticMesh *> &InBaseMeshes, const TArray< TSubclassOf< AActor >> &InBaseBPs, const TArray< UStaticMesh *> &InCornerBaseMeshes, const TArray< TSubclassOf< AActor >> &InCornerBaseBPs, const TArray< UStaticMesh *> &InDoorMeshes, const TArray< TSubclassOf< AActor >> &InDoorBPs)
 
void SetBaseParameters (const TSet< int > &InDoorsIndexPosition, const TArray< bool > &InUseWallMesh, int InNumFloors, int InLengthX, int InLengthY, bool InCorners, bool InUseFullBlocks)
 
void SetBodyMeshes (const TArray< UStaticMesh *> &InBodyMeshes, const TArray< TSubclassOf< AActor >> &InBodyBPs, const TArray< UStaticMesh *> &InCornerBodyMeshes, const TArray< TSubclassOf< AActor >> &InCornerBodyBPs, const TArray< UStaticMesh *> &InWallMeshes, const TArray< TSubclassOf< AActor >> &InWallBPs)
 
void SetTopMeshes (const TArray< UStaticMesh *> &InTopMeshes, const TArray< TSubclassOf< AActor >> &InTopBPs, const TArray< UStaticMesh *> &InCornerTopMeshes, const TArray< TSubclassOf< AActor >> &InCornerTopBPs, const TArray< UStaticMesh *> &InRoofMeshes, const TArray< TSubclassOf< AActor >> &InRoofBPs)
 
void SetVisibilityParameters (const TArray< bool > &InSideVisibility, const TArray< bool > &InCornerVisibility, bool InRoofVisibility)
 

Protected Member Functions

void CreateBuilding ()
 
void FixMobility ()
 
void Reset ()
 

Protected Attributes

TArray< TSubclassOf< AActor > > BaseBPs
 
TArray< UStaticMesh * > BaseMeshes
 Meshes. More...
 
TArray< TSubclassOf< AActor > > BodyBPs
 
TArray< UStaticMesh * > BodyMeshes
 Meshes | Body. More...
 
TArray< UChildActorComponent * > ChildActorComps
 
TArray< TSubclassOf< AActor > > CornerBaseBPs
 
TArray< UStaticMesh * > CornerBaseMeshes
 
TArray< TSubclassOf< AActor > > CornerBodyBPs
 
TArray< UStaticMesh * > CornerBodyMeshes
 
bool Corners = false
 
TArray< TSubclassOf< AActor > > CornerTopBPs
 
TArray< UStaticMesh * > CornerTopMeshes
 
TArray< bool > CornerVisibility
 
TArray< TSubclassOf< AActor > > DoorBPs
 
TArray< UStaticMesh * > DoorMeshes
 
TSet< int > DoorsIndexPosition
 Base Parameters. More...
 
TMap< FString, UHierarchicalInstancedStaticMeshComponent * > HISMComps
 
int LengthX = 0
 
int LengthY = 0
 
int NumFloors = 0
 
TArray< TSubclassOf< AActor > > RoofBPs
 
TArray< UStaticMesh * > RoofMeshes
 
bool RoofVisibility = true
 
UStaticMeshComponent * RootSMComp = nullptr
 
TArray< bool > SideVisibility
 Base Parameters | Visibility. More...
 
TArray< TSubclassOf< AActor > > TopBPs
 
TArray< UStaticMesh * > TopMeshes
 Meshes | Top. More...
 
bool UseFullBlocks = false
 
TArray< bool > UseWallMesh
 
TArray< TSubclassOf< AActor > > WallBPs
 
TArray< UStaticMesh * > WallMeshes
 

Private Member Functions

float AddChunck (const UStaticMesh *SelectedMesh, const TSubclassOf< AActor > SelectedBP, bool Visible, FBox &OutSelectedMeshBounds)
 
void AddMeshToBuilding (const UStaticMesh *SM)
 
TSet< int > CalculateDoorsIndexInSide (int StartIndex, int Length)
 
void CalculateSidesLength ()
 
void CalculateSideVisibilities (int SideIndex, bool &MainVisibility, bool &CornerVisbility)
 
void ChooseGeometryToSpawn (const TArray< UStaticMesh *> &InMeshes, const TArray< TSubclassOf< AActor >> &InMainBPs, UStaticMesh **OutMesh, TSubclassOf< AActor > *OutBP)
 
void CreateFloor (const FloorMeshCollection &MeshCollection, bool IncludeDoors, bool IncludeWalls)
 
void CreateRoof ()
 
float CreateSide (const FloorMeshCollection &MeshCollection, const TSet< int > &AuxiliarPositions, int SideLength, bool MainVisibility, bool CornerVisbility)
 
TSet< int > GenerateWallsIndexPositions (int Length)
 
FVector GetMeshSize (const UStaticMesh *SM)
 
void Init ()
 
void UpdateTransformPositionToNextChunk (const FVector &Box)
 
void UpdateTransformPositionToNextSide (const FBox &Box)
 

Private Attributes

FTransform CurrentTransform = FTransform::Identity
 
FBox LastSelectedMeshBounds
 
TArray< int > SidesLength
 

Detailed Description

Definition at line 26 of file ProceduralBuilding.h.

Constructor & Destructor Documentation

◆ AProceduralBuilding()

AProceduralBuilding::AProceduralBuilding ( )

Definition at line 8 of file ProceduralBuilding.cpp.

References CornerVisibility, RootSMComp, SideVisibility, and UseWallMesh.

Member Function Documentation

◆ AddChunck()

float AProceduralBuilding::AddChunck ( const UStaticMesh *  SelectedMesh,
const TSubclassOf< AActor SelectedBP,
bool  Visible,
FBox &  OutSelectedMeshBounds 
)
private

Definition at line 506 of file ProceduralBuilding.cpp.

References AddMeshToBuilding(), ChildActorComps, CurrentTransform, GetMeshSize(), and UpdateTransformPositionToNextChunk().

Referenced by CreateRoof(), and CreateSide().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddMeshToBuilding()

void AProceduralBuilding::AddMeshToBuilding ( const UStaticMesh *  SM)
private

Definition at line 584 of file ProceduralBuilding.cpp.

References CurrentTransform, and GetHISMComp().

Referenced by AddChunck().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateDoorsIndexInSide()

TSet< int > AProceduralBuilding::CalculateDoorsIndexInSide ( int  StartIndex,
int  Length 
)
private

Definition at line 452 of file ProceduralBuilding.cpp.

References DoorsIndexPosition.

Referenced by CreateFloor().

+ Here is the caller graph for this function:

◆ CalculateSidesLength()

void AProceduralBuilding::CalculateSidesLength ( )
private

Definition at line 432 of file ProceduralBuilding.cpp.

References LengthX, LengthY, SidesLength, and UseFullBlocks.

Referenced by Init().

+ Here is the caller graph for this function:

◆ CalculateSideVisibilities()

void AProceduralBuilding::CalculateSideVisibilities ( int  SideIndex,
bool &  MainVisibility,
bool &  CornerVisbility 
)
private

Definition at line 478 of file ProceduralBuilding.cpp.

References CornerVisibility, SideVisibility, and UseFullBlocks.

Referenced by CreateFloor().

+ Here is the caller graph for this function:

◆ ChooseGeometryToSpawn()

void AProceduralBuilding::ChooseGeometryToSpawn ( const TArray< UStaticMesh *> &  InMeshes,
const TArray< TSubclassOf< AActor >> &  InMainBPs,
UStaticMesh **  OutMesh = nullptr,
TSubclassOf< AActor > *  OutBP = nullptr 
)
private

Definition at line 484 of file ProceduralBuilding.cpp.

Referenced by CreateRoof(), and CreateSide().

+ Here is the caller graph for this function:

◆ ConvertOldBP_ToNativeCodeObject()

void AProceduralBuilding::ConvertOldBP_ToNativeCodeObject ( AActor BP_Building)

Definition at line 57 of file ProceduralBuilding.cpp.

References ChildActorComps, and GetHISMComp().

+ Here is the call graph for this function:

◆ CreateBuilding()

void AProceduralBuilding::CreateBuilding ( )
protected

Definition at line 212 of file ProceduralBuilding.cpp.

References BaseBPs, BaseMeshes, BodyBPs, BodyMeshes, CornerBaseBPs, CornerBaseMeshes, CornerBodyBPs, CornerBodyMeshes, CornerTopBPs, CornerTopMeshes, CreateFloor(), CreateRoof(), DoorBPs, DoorMeshes, Init(), NumFloors, TopBPs, TopMeshes, WallBPs, and WallMeshes.

+ Here is the call graph for this function:

◆ CreateFloor()

void AProceduralBuilding::CreateFloor ( const FloorMeshCollection MeshCollection,
bool  IncludeDoors,
bool  IncludeWalls 
)
private

Definition at line 280 of file ProceduralBuilding.cpp.

References CalculateDoorsIndexInSide(), CalculateSideVisibilities(), CreateSide(), CurrentTransform, GenerateWallsIndexPositions(), SidesLength, UseFullBlocks, and UseWallMesh.

Referenced by CreateBuilding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateRoof()

void AProceduralBuilding::CreateRoof ( )
private

Definition at line 329 of file ProceduralBuilding.cpp.

References AddChunck(), ChooseGeometryToSpawn(), CurrentTransform, LastSelectedMeshBounds, LengthX, LengthY, RoofBPs, RoofMeshes, RoofVisibility, and UpdateTransformPositionToNextSide().

Referenced by CreateBuilding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateSide()

float AProceduralBuilding::CreateSide ( const FloorMeshCollection MeshCollection,
const TSet< int > &  AuxiliarPositions,
int  SideLength,
bool  MainVisibility,
bool  CornerVisbility 
)
private

Main part

Corner part

Definition at line 366 of file ProceduralBuilding.cpp.

References AddChunck(), FloorMeshCollection::AuxiliarBPs, FloorMeshCollection::AuxiliarMeshes, ChooseGeometryToSpawn(), FloorMeshCollection::CornerBPs, FloorMeshCollection::CornerMeshes, Corners, LastSelectedMeshBounds, FloorMeshCollection::MainBPs, FloorMeshCollection::MainMeshes, and UpdateTransformPositionToNextSide().

Referenced by CreateFloor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FixMobility()

void AProceduralBuilding::FixMobility ( )
protected

Definition at line 49 of file ProceduralBuilding.cpp.

References ChildActorComps.

◆ GenerateWallsIndexPositions()

TSet< int > AProceduralBuilding::GenerateWallsIndexPositions ( int  Length)
private

Definition at line 468 of file ProceduralBuilding.cpp.

Referenced by CreateFloor().

+ Here is the caller graph for this function:

◆ GetHISMComp()

UHierarchicalInstancedStaticMeshComponent * AProceduralBuilding::GetHISMComp ( const UStaticMesh *  SM)

Definition at line 22 of file ProceduralBuilding.cpp.

References HISMComps.

Referenced by AddMeshToBuilding(), and ConvertOldBP_ToNativeCodeObject().

+ Here is the caller graph for this function:

◆ GetMeshSize()

FVector AProceduralBuilding::GetMeshSize ( const UStaticMesh *  SM)
private

Definition at line 591 of file ProceduralBuilding.cpp.

Referenced by AddChunck().

+ Here is the caller graph for this function:

◆ HideAllChildren()

void AProceduralBuilding::HideAllChildren ( )

Definition at line 122 of file ProceduralBuilding.cpp.

References ChildActorComps.

◆ Init()

void AProceduralBuilding::Init ( )
private

Definition at line 273 of file ProceduralBuilding.cpp.

References CalculateSidesLength(), and Reset().

Referenced by CreateBuilding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Reset()

void AProceduralBuilding::Reset ( )
protected

Definition at line 241 of file ProceduralBuilding.cpp.

References ChildActorComps, CurrentTransform, HISMComps, and SidesLength.

Referenced by Init().

+ Here is the caller graph for this function:

◆ SetBaseMeshes()

void AProceduralBuilding::SetBaseMeshes ( const TArray< UStaticMesh *> &  InBaseMeshes,
const TArray< TSubclassOf< AActor >> &  InBaseBPs,
const TArray< UStaticMesh *> &  InCornerBaseMeshes,
const TArray< TSubclassOf< AActor >> &  InCornerBaseBPs,
const TArray< UStaticMesh *> &  InDoorMeshes,
const TArray< TSubclassOf< AActor >> &  InDoorBPs 
)

◆ SetBaseParameters()

void AProceduralBuilding::SetBaseParameters ( const TSet< int > &  InDoorsIndexPosition,
const TArray< bool > &  InUseWallMesh,
int  InNumFloors,
int  InLengthX,
int  InLengthY,
bool  InCorners,
bool  InUseFullBlocks 
)

◆ SetBodyMeshes()

void AProceduralBuilding::SetBodyMeshes ( const TArray< UStaticMesh *> &  InBodyMeshes,
const TArray< TSubclassOf< AActor >> &  InBodyBPs,
const TArray< UStaticMesh *> &  InCornerBodyMeshes,
const TArray< TSubclassOf< AActor >> &  InCornerBodyBPs,
const TArray< UStaticMesh *> &  InWallMeshes,
const TArray< TSubclassOf< AActor >> &  InWallBPs 
)

◆ SetTopMeshes()

void AProceduralBuilding::SetTopMeshes ( const TArray< UStaticMesh *> &  InTopMeshes,
const TArray< TSubclassOf< AActor >> &  InTopBPs,
const TArray< UStaticMesh *> &  InCornerTopMeshes,
const TArray< TSubclassOf< AActor >> &  InCornerTopBPs,
const TArray< UStaticMesh *> &  InRoofMeshes,
const TArray< TSubclassOf< AActor >> &  InRoofBPs 
)

Definition at line 196 of file ProceduralBuilding.cpp.

References CornerTopBPs, CornerTopMeshes, RoofBPs, RoofMeshes, TopBPs, and TopMeshes.

◆ SetVisibilityParameters()

void AProceduralBuilding::SetVisibilityParameters ( const TArray< bool > &  InSideVisibility,
const TArray< bool > &  InCornerVisibility,
bool  InRoofVisibility 
)

Definition at line 154 of file ProceduralBuilding.cpp.

References CornerVisibility, RoofVisibility, and SideVisibility.

◆ UpdateTransformPositionToNextChunk()

void AProceduralBuilding::UpdateTransformPositionToNextChunk ( const FVector &  Box)
private

Definition at line 597 of file ProceduralBuilding.cpp.

References CurrentTransform, and UseFullBlocks.

Referenced by AddChunck().

+ Here is the caller graph for this function:

◆ UpdateTransformPositionToNextSide()

void AProceduralBuilding::UpdateTransformPositionToNextSide ( const FBox &  Box)
private

Definition at line 611 of file ProceduralBuilding.cpp.

References CurrentTransform, and UseFullBlocks.

Referenced by CreateRoof(), and CreateSide().

+ Here is the caller graph for this function:

Member Data Documentation

◆ BaseBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::BaseBPs
protected

Definition at line 175 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBaseMeshes().

◆ BaseMeshes

TArray<UStaticMesh*> AProceduralBuilding::BaseMeshes
protected

Meshes.

Meshes | Base

Definition at line 171 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBaseMeshes().

◆ BodyBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::BodyBPs
protected

Definition at line 203 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBodyMeshes().

◆ BodyMeshes

TArray<UStaticMesh*> AProceduralBuilding::BodyMeshes
protected

Meshes | Body.

Definition at line 199 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBodyMeshes().

◆ ChildActorComps

TArray<UChildActorComponent*> AProceduralBuilding::ChildActorComps
protected

◆ CornerBaseBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::CornerBaseBPs
protected

Definition at line 191 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBaseMeshes().

◆ CornerBaseMeshes

TArray<UStaticMesh*> AProceduralBuilding::CornerBaseMeshes
protected

Definition at line 187 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBaseMeshes().

◆ CornerBodyBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::CornerBodyBPs
protected

Definition at line 219 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBodyMeshes().

◆ CornerBodyMeshes

TArray<UStaticMesh*> AProceduralBuilding::CornerBodyMeshes
protected

Definition at line 215 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBodyMeshes().

◆ Corners

bool AProceduralBuilding::Corners = false
protected

Definition at line 138 of file ProceduralBuilding.h.

Referenced by CreateSide(), and SetBaseParameters().

◆ CornerTopBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::CornerTopBPs
protected

Definition at line 239 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetTopMeshes().

◆ CornerTopMeshes

TArray<UStaticMesh*> AProceduralBuilding::CornerTopMeshes
protected

Definition at line 235 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetTopMeshes().

◆ CornerVisibility

TArray<bool> AProceduralBuilding::CornerVisibility
protected

◆ CurrentTransform

FTransform AProceduralBuilding::CurrentTransform = FTransform::Identity
private

◆ DoorBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::DoorBPs
protected

Definition at line 183 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBaseMeshes().

◆ DoorMeshes

TArray<UStaticMesh*> AProceduralBuilding::DoorMeshes
protected

Definition at line 179 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBaseMeshes().

◆ DoorsIndexPosition

TSet<int> AProceduralBuilding::DoorsIndexPosition
protected

Base Parameters.

Definition at line 118 of file ProceduralBuilding.h.

Referenced by CalculateDoorsIndexInSide(), and SetBaseParameters().

◆ HISMComps

TMap<FString, UHierarchicalInstancedStaticMeshComponent*> AProceduralBuilding::HISMComps
protected

Definition at line 103 of file ProceduralBuilding.h.

Referenced by GetHISMComp(), and Reset().

◆ LastSelectedMeshBounds

FBox AProceduralBuilding::LastSelectedMeshBounds
private

Definition at line 308 of file ProceduralBuilding.h.

Referenced by CreateRoof(), and CreateSide().

◆ LengthX

int AProceduralBuilding::LengthX = 0
protected

Definition at line 130 of file ProceduralBuilding.h.

Referenced by CalculateSidesLength(), CreateRoof(), and SetBaseParameters().

◆ LengthY

int AProceduralBuilding::LengthY = 0
protected

Definition at line 134 of file ProceduralBuilding.h.

Referenced by CalculateSidesLength(), CreateRoof(), and SetBaseParameters().

◆ NumFloors

int AProceduralBuilding::NumFloors = 0
protected

Definition at line 126 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBaseParameters().

◆ RoofBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::RoofBPs
protected

Definition at line 247 of file ProceduralBuilding.h.

Referenced by CreateRoof(), and SetTopMeshes().

◆ RoofMeshes

TArray<UStaticMesh*> AProceduralBuilding::RoofMeshes
protected

Definition at line 243 of file ProceduralBuilding.h.

Referenced by CreateRoof(), and SetTopMeshes().

◆ RoofVisibility

bool AProceduralBuilding::RoofVisibility = true
protected

Definition at line 158 of file ProceduralBuilding.h.

Referenced by CreateRoof(), and SetVisibilityParameters().

◆ RootSMComp

UStaticMeshComponent* AProceduralBuilding::RootSMComp = nullptr
protected

Definition at line 110 of file ProceduralBuilding.h.

Referenced by AProceduralBuilding().

◆ SidesLength

TArray<int> AProceduralBuilding::SidesLength
private

Definition at line 303 of file ProceduralBuilding.h.

Referenced by CalculateSidesLength(), CreateFloor(), and Reset().

◆ SideVisibility

TArray<bool> AProceduralBuilding::SideVisibility
protected

Base Parameters | Visibility.

Definition at line 150 of file ProceduralBuilding.h.

Referenced by AProceduralBuilding(), CalculateSideVisibilities(), and SetVisibilityParameters().

◆ TopBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::TopBPs
protected

Definition at line 231 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetTopMeshes().

◆ TopMeshes

TArray<UStaticMesh*> AProceduralBuilding::TopMeshes
protected

Meshes | Top.

Definition at line 227 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetTopMeshes().

◆ UseFullBlocks

bool AProceduralBuilding::UseFullBlocks = false
protected

◆ UseWallMesh

TArray<bool> AProceduralBuilding::UseWallMesh
protected

Definition at line 122 of file ProceduralBuilding.h.

Referenced by AProceduralBuilding(), CreateFloor(), and SetBaseParameters().

◆ WallBPs

TArray<TSubclassOf<AActor> > AProceduralBuilding::WallBPs
protected

Definition at line 211 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBodyMeshes().

◆ WallMeshes

TArray<UStaticMesh*> AProceduralBuilding::WallMeshes
protected

Definition at line 207 of file ProceduralBuilding.h.

Referenced by CreateBuilding(), and SetBodyMeshes().


The documentation for this class was generated from the following files: