Tabs substituted by spaces
This commit is contained in:
parent
63147bb780
commit
5f0685c902
|
@ -19,163 +19,160 @@
|
|||
FString UMapGeneratorWidget::GenerateMapFiles(const FMapGeneratorMetaInfo& MetaInfo)
|
||||
{
|
||||
|
||||
FString ErrorMsg = "";
|
||||
FString ErrorMsg = "";
|
||||
|
||||
// 1. Creating Levels
|
||||
CreateMainLargeMap(MetaInfo);
|
||||
CreateTilesMaps(MetaInfo);
|
||||
// bool bLoaded = LoadWorld(WorldAssetData);
|
||||
// GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow,
|
||||
// bLoaded ? "Loaded CORRECT" : "NOT loaded");
|
||||
// 1. Creating Levels
|
||||
CreateMainLargeMap(MetaInfo);
|
||||
CreateTilesMaps(MetaInfo);
|
||||
// bool bLoaded = LoadWorld(WorldAssetData);
|
||||
// GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow,
|
||||
// bLoaded ? "Loaded CORRECT" : "NOT loaded");
|
||||
|
||||
// 2. Applying heightmap
|
||||
// UWorld* World = CastChecked<UWorld>(WorldAssetData.GetAsset());
|
||||
// ALandscape* landscape =
|
||||
// (ALandscape*) UGameplayStatics::GetActorOfClass(World, ALandscape::StaticClass());
|
||||
// GEngine->AddOnScreenDebugMessage(
|
||||
// -1, 15.0f, FColor::Green, landscape!=nullptr ? "L TRUE" : "L FALSE");
|
||||
// AssignLandscapeHeightMap(landscape);
|
||||
// 2. Applying heightmap
|
||||
// UWorld* World = CastChecked<UWorld>(WorldAssetData.GetAsset());
|
||||
// ALandscape* landscape =
|
||||
// (ALandscape*) UGameplayStatics::GetActorOfClass(World, ALandscape::StaticClass());
|
||||
// GEngine->AddOnScreenDebugMessage(
|
||||
// -1, 15.0f, FColor::Green, landscape!=nullptr ? "L TRUE" : "L FALSE");
|
||||
// AssignLandscapeHeightMap(landscape);
|
||||
|
||||
// 3. Saving World
|
||||
// bool bSaved = SaveWorld(WorldAssetData, MetaInfo.DestinationPath, MetaInfo.MapName);
|
||||
// 3. Saving World
|
||||
// bool bSaved = SaveWorld(WorldAssetData, MetaInfo.DestinationPath, MetaInfo.MapName);
|
||||
|
||||
return ErrorMsg;
|
||||
return ErrorMsg;
|
||||
}
|
||||
|
||||
bool UMapGeneratorWidget::LoadBaseTileWorld(FAssetData& WorldAssetData)
|
||||
{
|
||||
const FString BaseMapPath= TEXT("/CarlaTools/MapGenerator/BaseMap/Tiles");
|
||||
return LoadWorld(WorldAssetData, BaseMapPath);
|
||||
const FString BaseMapPath= TEXT("/CarlaTools/MapGenerator/BaseMap/Tiles");
|
||||
return LoadWorld(WorldAssetData, BaseMapPath);
|
||||
}
|
||||
|
||||
bool UMapGeneratorWidget::LoadBaseLargeMapWorld(FAssetData& WorldAssetData)
|
||||
{
|
||||
const FString BaseMapPath= TEXT("/CarlaTools/MapGenerator/BaseMap/MainLargeMap");
|
||||
return LoadWorld(WorldAssetData, BaseMapPath);
|
||||
const FString BaseMapPath= TEXT("/CarlaTools/MapGenerator/BaseMap/MainLargeMap");
|
||||
return LoadWorld(WorldAssetData, BaseMapPath);
|
||||
}
|
||||
|
||||
bool UMapGeneratorWidget::LoadWorld(FAssetData& WorldAssetData, const FString& BaseMapPath)
|
||||
{
|
||||
TArray<FAssetData> AssetDatas;
|
||||
UObjectLibrary *MapObjectLibrary;
|
||||
TArray<FAssetData> AssetDatas;
|
||||
UObjectLibrary *MapObjectLibrary;
|
||||
|
||||
// Loading Map from folder using object library
|
||||
MapObjectLibrary = UObjectLibrary::CreateLibrary(UWorld::StaticClass(), false, GIsEditor);
|
||||
MapObjectLibrary->AddToRoot();
|
||||
MapObjectLibrary->LoadAssetDataFromPath(*BaseMapPath);
|
||||
MapObjectLibrary->LoadAssetsFromAssetData();
|
||||
MapObjectLibrary->GetAssetDataList(AssetDatas);
|
||||
if (AssetDatas.Num() > 0)
|
||||
{
|
||||
// Extract first asset found in folder path (i.e. the BaseMap)
|
||||
WorldAssetData = AssetDatas.Pop();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
// Loading Map from folder using object library
|
||||
MapObjectLibrary = UObjectLibrary::CreateLibrary(UWorld::StaticClass(), false, GIsEditor);
|
||||
MapObjectLibrary->AddToRoot();
|
||||
MapObjectLibrary->LoadAssetDataFromPath(*BaseMapPath);
|
||||
MapObjectLibrary->LoadAssetsFromAssetData();
|
||||
MapObjectLibrary->GetAssetDataList(AssetDatas);
|
||||
if (AssetDatas.Num() > 0)
|
||||
{
|
||||
// Extract first asset found in folder path (i.e. the BaseMap)
|
||||
WorldAssetData = AssetDatas.Pop();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UMapGeneratorWidget::SaveWorld(
|
||||
FAssetData& WorldToBeSaved,
|
||||
const FString& DestinationPath,
|
||||
const FString& WorldName
|
||||
)
|
||||
FAssetData& WorldToBeSaved,
|
||||
const FString& DestinationPath,
|
||||
const FString& WorldName
|
||||
)
|
||||
{
|
||||
UWorld* World;
|
||||
UObjectRedirector *BaseMapRedirector =
|
||||
Cast<UObjectRedirector>(WorldToBeSaved.GetAsset());
|
||||
if(BaseMapRedirector != nullptr)
|
||||
World = CastChecked<UWorld>(BaseMapRedirector->DestinationObject);
|
||||
else
|
||||
World = CastChecked<UWorld>(WorldToBeSaved.GetAsset());
|
||||
UWorld* World;
|
||||
UObjectRedirector *BaseMapRedirector =
|
||||
Cast<UObjectRedirector>(WorldToBeSaved.GetAsset());
|
||||
if(BaseMapRedirector != nullptr)
|
||||
World = CastChecked<UWorld>(BaseMapRedirector->DestinationObject);
|
||||
else
|
||||
World = CastChecked<UWorld>(WorldToBeSaved.GetAsset());
|
||||
|
||||
// Create Package
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Preparing Package");
|
||||
UPackage *Package = WorldToBeSaved.GetPackage();
|
||||
Package->SetFolderName("MapGeneratorPackage");
|
||||
Package->FullyLoad();
|
||||
Package->MarkPackageDirty();
|
||||
FAssetRegistryModule::AssetCreated(World);
|
||||
|
||||
// Rename new World
|
||||
World->Rename(*WorldName, World->GetOuter());
|
||||
const FString PackagePath = DestinationPath + "/" + WorldName;
|
||||
FAssetRegistryModule::AssetRenamed(World, *PackagePath);
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, World->GetMapName());
|
||||
World->MarkPackageDirty();
|
||||
World->GetOuter()->MarkPackageDirty();
|
||||
// Create Package
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Preparing Package");
|
||||
UPackage *Package = WorldToBeSaved.GetPackage();
|
||||
Package->SetFolderName("MapGeneratorPackage");
|
||||
Package->FullyLoad();
|
||||
Package->MarkPackageDirty();
|
||||
FAssetRegistryModule::AssetCreated(World);
|
||||
|
||||
// Rename new World
|
||||
World->Rename(*WorldName, World->GetOuter());
|
||||
const FString PackagePath = DestinationPath + "/" + WorldName;
|
||||
FAssetRegistryModule::AssetRenamed(World, *PackagePath);
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, World->GetMapName());
|
||||
World->MarkPackageDirty();
|
||||
World->GetOuter()->MarkPackageDirty();
|
||||
|
||||
// Saving Package
|
||||
const FString PackageFileName = FPackageName::LongPackageNameToFilename(
|
||||
PackagePath,
|
||||
FPackageName::GetMapPackageExtension()
|
||||
);
|
||||
if(FPaths::FileExists(*PackageFileName))
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Package already Exists");
|
||||
return false;
|
||||
}
|
||||
return UPackage::SavePackage(
|
||||
Package, World, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone,
|
||||
*PackageFileName, GError, nullptr, true, true, SAVE_NoError
|
||||
);
|
||||
// Saving Package
|
||||
const FString PackageFileName = FPackageName::LongPackageNameToFilename(
|
||||
PackagePath,
|
||||
FPackageName::GetMapPackageExtension()
|
||||
);
|
||||
if(FPaths::FileExists(*PackageFileName))
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Package already Exists");
|
||||
return false;
|
||||
}
|
||||
return UPackage::SavePackage(
|
||||
Package, World, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone,
|
||||
*PackageFileName, GError, nullptr, true, true, SAVE_NoError
|
||||
);
|
||||
}
|
||||
|
||||
bool UMapGeneratorWidget::CreateMainLargeMap(const FMapGeneratorMetaInfo& MetaInfo)
|
||||
{
|
||||
FAssetData WorldAssetData;
|
||||
bool bLoaded = LoadBaseLargeMapWorld(WorldAssetData);
|
||||
bool bSaved = SaveWorld(WorldAssetData, MetaInfo.DestinationPath, MetaInfo.MapName);
|
||||
FAssetData WorldAssetData;
|
||||
bool bLoaded = LoadBaseLargeMapWorld(WorldAssetData);
|
||||
bool bSaved = SaveWorld(WorldAssetData, MetaInfo.DestinationPath, MetaInfo.MapName);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UMapGeneratorWidget::CreateTilesMaps(const FMapGeneratorMetaInfo& MetaInfo)
|
||||
{
|
||||
FAssetData WorldAssetData;
|
||||
FAssetData WorldAssetData;
|
||||
|
||||
for(int i = 0; i < MetaInfo.SizeX; i++)
|
||||
for(int i = 0; i < MetaInfo.SizeX; i++)
|
||||
{
|
||||
for(int j = 0; j < MetaInfo.SizeY; j++)
|
||||
{
|
||||
for(int j = 0; j < MetaInfo.SizeY; j++)
|
||||
{
|
||||
bool bLoaded = LoadBaseTileWorld(WorldAssetData);
|
||||
bool bLoaded = LoadBaseTileWorld(WorldAssetData);
|
||||
|
||||
FMapGeneratorTileMetaInfo MetaTileInfo;
|
||||
MetaTileInfo.IndexX = i;
|
||||
MetaTileInfo.IndexY = j;
|
||||
ApplyHeightMapToLandscape(WorldAssetData,MetaTileInfo);
|
||||
FMapGeneratorTileMetaInfo MetaTileInfo;
|
||||
MetaTileInfo.IndexX = i;
|
||||
MetaTileInfo.IndexY = j;
|
||||
ApplyHeightMapToLandscape(WorldAssetData,MetaTileInfo);
|
||||
|
||||
const FString MapName =
|
||||
MetaInfo.MapName + "_Tile_" + FString::FromInt(i) + "_" + FString::FromInt(j);
|
||||
bool bSaved = SaveWorld(WorldAssetData, MetaInfo.DestinationPath, MapName);
|
||||
}
|
||||
const FString MapName =
|
||||
MetaInfo.MapName + "_Tile_" + FString::FromInt(i) + "_" + FString::FromInt(j);
|
||||
bool bSaved = SaveWorld(WorldAssetData, MetaInfo.DestinationPath, MapName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UMapGeneratorWidget::ApplyHeightMapToLandscape(
|
||||
FAssetData& WorldAssetData,
|
||||
FMapGeneratorTileMetaInfo tileMetaInfo
|
||||
)
|
||||
FAssetData& WorldAssetData,
|
||||
FMapGeneratorTileMetaInfo TileMetaInfo
|
||||
)
|
||||
{
|
||||
UWorld* World;
|
||||
UObjectRedirector* BaseMapRedirector =
|
||||
Cast<UObjectRedirector>(WorldAssetData.GetAsset());
|
||||
if(BaseMapRedirector != nullptr)
|
||||
{
|
||||
World = CastChecked<UWorld>(BaseMapRedirector->DestinationObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
World = CastChecked<UWorld>(WorldAssetData.GetAsset());
|
||||
}
|
||||
ALandscape* landscape = (ALandscape*) UGameplayStatics::GetActorOfClass(
|
||||
World,
|
||||
ALandscape::StaticClass()
|
||||
);
|
||||
AssignLandscapeHeightMap(landscape, tileMetaInfo);
|
||||
return true;
|
||||
UWorld* World;
|
||||
UObjectRedirector* BaseMapRedirector =
|
||||
Cast<UObjectRedirector>(WorldAssetData.GetAsset());
|
||||
if(BaseMapRedirector != nullptr)
|
||||
{
|
||||
World = CastChecked<UWorld>(BaseMapRedirector->DestinationObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
World = CastChecked<UWorld>(WorldAssetData.GetAsset());
|
||||
}
|
||||
ALandscape* landscape = (ALandscape*) UGameplayStatics::GetActorOfClass(
|
||||
World,
|
||||
ALandscape::StaticClass()
|
||||
);
|
||||
AssignLandscapeHeightMap(landscape, TileMetaInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// #endif
|
|
@ -20,280 +20,280 @@
|
|||
// Sets default values
|
||||
UProceduralWaterManager::UProceduralWaterManager()
|
||||
{
|
||||
// Pass
|
||||
// Pass
|
||||
}
|
||||
|
||||
FString UProceduralWaterManager::StartWaterGeneration(const FProceduralRiversMetaInfo MetaInfo)
|
||||
{
|
||||
FString ErrorMsg="";
|
||||
FString ErrorMsg="";
|
||||
|
||||
if(MetaInfo.WaterGenerationType == EWaterGenerationType::RIVERS)
|
||||
{
|
||||
if(RiverBlueprintClass)
|
||||
ErrorMsg = RiverGeneration(MetaInfo);
|
||||
else
|
||||
ErrorMsg = "ERROR: River class not assigned";
|
||||
}
|
||||
else if(MetaInfo.WaterGenerationType == EWaterGenerationType::LAKE)
|
||||
{
|
||||
ErrorMsg = LakeGeneration(MetaInfo);
|
||||
}
|
||||
else
|
||||
ErrorMsg = "Error in Water Generation Type";
|
||||
if(MetaInfo.WaterGenerationType == EWaterGenerationType::RIVERS)
|
||||
{
|
||||
if(RiverBlueprintClass)
|
||||
ErrorMsg = RiverGeneration(MetaInfo);
|
||||
else
|
||||
ErrorMsg = "ERROR: River class not assigned";
|
||||
}
|
||||
else if(MetaInfo.WaterGenerationType == EWaterGenerationType::LAKE)
|
||||
{
|
||||
ErrorMsg = LakeGeneration(MetaInfo);
|
||||
}
|
||||
else
|
||||
ErrorMsg = "Error in Water Generation Type";
|
||||
|
||||
return ErrorMsg;
|
||||
return ErrorMsg;
|
||||
}
|
||||
|
||||
FString UProceduralWaterManager::RiverGeneration(const FProceduralRiversMetaInfo MetaInfo)
|
||||
{
|
||||
FString ErrorMsg;
|
||||
FString ErrorMsg;
|
||||
|
||||
const FString WaterInfoPath = MetaInfo.WaterInfoPath;
|
||||
if(!FPlatformFileManager::Get().GetPlatformFile().FileExists(*WaterInfoPath))
|
||||
{
|
||||
ErrorMsg = "File Not Found!! :(";
|
||||
return ErrorMsg;
|
||||
}
|
||||
const FString WaterInfoPath = MetaInfo.WaterInfoPath;
|
||||
if(!FPlatformFileManager::Get().GetPlatformFile().FileExists(*WaterInfoPath))
|
||||
{
|
||||
ErrorMsg = "File Not Found!! :(";
|
||||
return ErrorMsg;
|
||||
}
|
||||
|
||||
TArray<FString> File;
|
||||
FFileHelper::LoadFileToStringArray(File, *WaterInfoPath);
|
||||
TArray<FString> File;
|
||||
FFileHelper::LoadFileToStringArray(File, *WaterInfoPath);
|
||||
|
||||
float InputKeyCount = 0.0f;
|
||||
int IterationNumber = 0;
|
||||
float InputKeyCount = 0.0f;
|
||||
int IterationNumber = 0;
|
||||
|
||||
AActor* RiverActor = nullptr;
|
||||
AActor* RiverActor = nullptr;
|
||||
|
||||
FString StrX, StrY;
|
||||
FVector PreviusPosition(NAN, NAN, NAN);
|
||||
FString StrX, StrY;
|
||||
FVector PreviusPosition(NAN, NAN, NAN);
|
||||
|
||||
float ScaleFactor = MetaInfo.CustomScaleFactor;
|
||||
float ScaleFactor = MetaInfo.CustomScaleFactor;
|
||||
|
||||
if(File.Num() == 0)
|
||||
return "Error processing file. Check file path and it content.";
|
||||
if(File.Num() == 0)
|
||||
return "Error processing file. Check file path and it content.";
|
||||
|
||||
for(FString Line : File)
|
||||
{
|
||||
if(Line == "# _")
|
||||
{
|
||||
// Important IF to add last point for every spline
|
||||
// Uses data from previus iteration
|
||||
if(IterationNumber != 0 && IterationNumber != -1)
|
||||
{
|
||||
// Add Last point to river spline
|
||||
FSplinePoint Location(InputKeyCount, PreviusPosition);
|
||||
if(RiverActor != nullptr)
|
||||
AddRiverPointFromCode(RiverActor, Location); // Last Point
|
||||
CheckAndReverseWaterFlow(RiverActor);
|
||||
}
|
||||
for(FString Line : File)
|
||||
{
|
||||
if(Line == "# _")
|
||||
{
|
||||
// Important IF to add last point for every spline
|
||||
// Uses data from previus iteration
|
||||
if(IterationNumber != 0 && IterationNumber != -1)
|
||||
{
|
||||
// Add Last point to river spline
|
||||
FSplinePoint Location(InputKeyCount, PreviusPosition);
|
||||
if(RiverActor != nullptr)
|
||||
AddRiverPointFromCode(RiverActor, Location); // Last Point
|
||||
CheckAndReverseWaterFlow(RiverActor);
|
||||
}
|
||||
|
||||
RiverActor = SpawnRiverBlueprintActor();
|
||||
InputKeyCount = 0.0f;
|
||||
IterationNumber = -1; // Wildcard value used for headers
|
||||
}
|
||||
else if (Line == "# _L")
|
||||
{
|
||||
return "This is a LAKE file. Check the water type and the file content.";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!Line.Split(TEXT(" "), &StrY, &StrX))
|
||||
{
|
||||
return "ERROR: Coordinated cannot be proccess... Check file format";
|
||||
}
|
||||
|
||||
float PositionX = ScaleFactor*FCString::Atof(*StrX);
|
||||
float PositionY = ScaleFactor*FCString::Atof(*StrY);
|
||||
float PositionZ;
|
||||
RiverActor = SpawnRiverBlueprintActor();
|
||||
InputKeyCount = 0.0f;
|
||||
IterationNumber = -1; // Wildcard value used for headers
|
||||
}
|
||||
else if (Line == "# _L")
|
||||
{
|
||||
return "This is a LAKE file. Check the water type and the file content.";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!Line.Split(TEXT(" "), &StrY, &StrX))
|
||||
{
|
||||
return "ERROR: Coordinated cannot be proccess... Check file format";
|
||||
}
|
||||
|
||||
float PositionX = ScaleFactor*FCString::Atof(*StrX);
|
||||
float PositionY = ScaleFactor*FCString::Atof(*StrY);
|
||||
float PositionZ;
|
||||
|
||||
if(MetaInfo.CustomHeight > -100000000.0f)
|
||||
PositionZ = MetaInfo.CustomHeight;
|
||||
else
|
||||
PositionZ = GetLandscapeSurfaceHeight(PositionX, PositionY, false);
|
||||
if(MetaInfo.CustomHeight > -100000000.0f)
|
||||
PositionZ = MetaInfo.CustomHeight;
|
||||
else
|
||||
PositionZ = GetLandscapeSurfaceHeight(PositionX, PositionY, false);
|
||||
|
||||
FVector Position(PositionX, PositionY, PositionZ);
|
||||
|
||||
FVector Position(PositionX, PositionY, PositionZ);
|
||||
|
||||
|
||||
Position += MetaInfo.CustomLocationOffset;
|
||||
Position += MetaInfo.CustomLocationOffset;
|
||||
|
||||
if((IterationNumber % MetaInfo.CustomSampling) == 0){
|
||||
FSplinePoint NewPoint(InputKeyCount, Position);
|
||||
float Width = (MetaInfo.CustomRiverWidth > 0.0f) ?
|
||||
MetaInfo.CustomRiverWidth : 2.5f;
|
||||
NewPoint.Scale = FVector(1.0f, Width, 1.0f);
|
||||
if(RiverActor != nullptr)
|
||||
AddRiverPointFromCode(RiverActor, NewPoint);
|
||||
InputKeyCount += 1.0f;
|
||||
}
|
||||
PreviusPosition = Position;
|
||||
}
|
||||
IterationNumber++;
|
||||
}
|
||||
if((IterationNumber % MetaInfo.CustomSampling) == 0){
|
||||
FSplinePoint NewPoint(InputKeyCount, Position);
|
||||
float Width = (MetaInfo.CustomRiverWidth > 0.0f) ?
|
||||
MetaInfo.CustomRiverWidth : 2.5f;
|
||||
NewPoint.Scale = FVector(1.0f, Width, 1.0f);
|
||||
if(RiverActor != nullptr)
|
||||
AddRiverPointFromCode(RiverActor, NewPoint);
|
||||
InputKeyCount += 1.0f;
|
||||
}
|
||||
PreviusPosition = Position;
|
||||
}
|
||||
IterationNumber++;
|
||||
}
|
||||
|
||||
// Last river created must be destroyed as it is a wildcard
|
||||
if(RiverActor != nullptr)
|
||||
RiverActor->Destroy();
|
||||
// Last river created must be destroyed as it is a wildcard
|
||||
if(RiverActor != nullptr)
|
||||
RiverActor->Destroy();
|
||||
|
||||
return "Successfully processed";
|
||||
return "Successfully processed";
|
||||
}
|
||||
|
||||
FString UProceduralWaterManager::LakeGeneration(const FProceduralRiversMetaInfo MetaInfo)
|
||||
{
|
||||
const FString WaterInfoPath = MetaInfo.WaterInfoPath;
|
||||
if(!FPlatformFileManager::Get().GetPlatformFile().FileExists(*WaterInfoPath))
|
||||
{
|
||||
return "File Not Found!! :(";
|
||||
}
|
||||
const FString WaterInfoPath = MetaInfo.WaterInfoPath;
|
||||
if(!FPlatformFileManager::Get().GetPlatformFile().FileExists(*WaterInfoPath))
|
||||
{
|
||||
return "File Not Found!! :(";
|
||||
}
|
||||
|
||||
TArray<FString> File;
|
||||
FFileHelper::LoadFileToStringArray(File, *WaterInfoPath);
|
||||
TArray<FString> File;
|
||||
FFileHelper::LoadFileToStringArray(File, *WaterInfoPath);
|
||||
|
||||
if(File.Num() == 0)
|
||||
return "Error processing file. Check file path and it content.";
|
||||
if(File.Num() == 0)
|
||||
return "Error processing file. Check file path and it content.";
|
||||
|
||||
AActor* LakeActor = nullptr;
|
||||
AActor* LakeActor = nullptr;
|
||||
|
||||
for(FString Line : File)
|
||||
{
|
||||
if(Line == "# _L")
|
||||
{
|
||||
LakeActor = SpawnLakeBlueprintActor();
|
||||
}
|
||||
else if(Line == "# _")
|
||||
{
|
||||
return "This is a RIVER file. Check the water type and the file content.";
|
||||
}
|
||||
else
|
||||
{
|
||||
TArray<FString> LineArray;
|
||||
for(FString Line : File)
|
||||
{
|
||||
if(Line == "# _L")
|
||||
{
|
||||
LakeActor = SpawnLakeBlueprintActor();
|
||||
}
|
||||
else if(Line == "# _")
|
||||
{
|
||||
return "This is a RIVER file. Check the water type and the file content.";
|
||||
}
|
||||
else
|
||||
{
|
||||
TArray<FString> LineArray;
|
||||
|
||||
Line.ParseIntoArray(LineArray, TEXT(" "));
|
||||
Line.ParseIntoArray(LineArray, TEXT(" "));
|
||||
|
||||
float CenterX = FCString::Atof(*LineArray[0]);
|
||||
float CenterY = FCString::Atof(*LineArray[1]);
|
||||
float SizeX = FCString::Atof(*LineArray[2]);
|
||||
float SizeY = FCString::Atof(*LineArray[3]);
|
||||
float Angle = FCString::Atof(*LineArray[4]);
|
||||
float CenterX = FCString::Atof(*LineArray[0]);
|
||||
float CenterY = FCString::Atof(*LineArray[1]);
|
||||
float SizeX = FCString::Atof(*LineArray[2]);
|
||||
float SizeY = FCString::Atof(*LineArray[3]);
|
||||
float Angle = FCString::Atof(*LineArray[4]);
|
||||
|
||||
float CenterZ;
|
||||
float CenterZ;
|
||||
|
||||
if(MetaInfo.CustomHeight > -100000000.0f)
|
||||
CenterZ = MetaInfo.CustomHeight;
|
||||
else
|
||||
CenterZ = GetLandscapeSurfaceHeight(CenterX, CenterY, false);
|
||||
if(MetaInfo.CustomHeight > -100000000.0f)
|
||||
CenterZ = MetaInfo.CustomHeight;
|
||||
else
|
||||
CenterZ = GetLandscapeSurfaceHeight(CenterX, CenterY, false);
|
||||
|
||||
FVector Location(
|
||||
MetaInfo.CustomScaleFactor*CenterX,
|
||||
MetaInfo.CustomScaleFactor*CenterY,
|
||||
CenterZ
|
||||
);
|
||||
FVector Location(
|
||||
MetaInfo.CustomScaleFactor*CenterX,
|
||||
MetaInfo.CustomScaleFactor*CenterY,
|
||||
CenterZ
|
||||
);
|
||||
|
||||
Location += MetaInfo.CustomLocationOffset;
|
||||
Location += MetaInfo.CustomLocationOffset;
|
||||
|
||||
FRotator Rotation(0.0f, Angle, 0.0f);
|
||||
FRotator Rotation(0.0f, Angle, 0.0f);
|
||||
|
||||
FVector Scale(
|
||||
MetaInfo.CustomRiverWidth * SizeX,
|
||||
MetaInfo.CustomRiverWidth * SizeY,
|
||||
1.0f
|
||||
);
|
||||
FVector Scale(
|
||||
MetaInfo.CustomRiverWidth * SizeX,
|
||||
MetaInfo.CustomRiverWidth * SizeY,
|
||||
1.0f
|
||||
);
|
||||
|
||||
LakeActor->SetActorScale3D(Scale);
|
||||
LakeActor->SetActorLocationAndRotation(
|
||||
Location,
|
||||
Rotation,
|
||||
false,
|
||||
0,
|
||||
ETeleportType::None
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
LakeActor->SetActorScale3D(Scale);
|
||||
LakeActor->SetActorLocationAndRotation(
|
||||
Location,
|
||||
Rotation,
|
||||
false,
|
||||
0,
|
||||
ETeleportType::None
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Last river created must be destroyed as it is a wildcard
|
||||
if(LakeActor != nullptr)
|
||||
LakeActor->Destroy();
|
||||
// Last river created must be destroyed as it is a wildcard
|
||||
if(LakeActor != nullptr)
|
||||
LakeActor->Destroy();
|
||||
|
||||
return "Successfully processed";
|
||||
return "Successfully processed";
|
||||
}
|
||||
|
||||
AActor* UProceduralWaterManager::SpawnRiverBlueprintActor()
|
||||
{
|
||||
|
||||
FVector Location(0, 0, 0);
|
||||
FRotator Rotation(0,0,0);
|
||||
FActorSpawnParameters SpawnInfo;
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
AActor* RiverActor = World->SpawnActor<AActor>(
|
||||
RiverBlueprintClass,
|
||||
Location,
|
||||
Rotation,
|
||||
SpawnInfo
|
||||
);
|
||||
|
||||
FVector Location(0, 0, 0);
|
||||
FRotator Rotation(0,0,0);
|
||||
FActorSpawnParameters SpawnInfo;
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
AActor* RiverActor = World->SpawnActor<AActor>(
|
||||
RiverBlueprintClass,
|
||||
Location,
|
||||
Rotation,
|
||||
SpawnInfo
|
||||
);
|
||||
|
||||
return RiverActor;
|
||||
return RiverActor;
|
||||
}
|
||||
|
||||
AActor* UProceduralWaterManager::SpawnLakeBlueprintActor()
|
||||
{
|
||||
|
||||
FVector Location(0, 0, 0);
|
||||
FRotator Rotation(0,0,0);
|
||||
FActorSpawnParameters SpawnInfo;
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
AActor* LakeActor = World->SpawnActor<AActor>(
|
||||
LakeBlueprintClass,
|
||||
Location,
|
||||
Rotation,
|
||||
SpawnInfo
|
||||
);
|
||||
|
||||
FVector Location(0, 0, 0);
|
||||
FRotator Rotation(0,0,0);
|
||||
FActorSpawnParameters SpawnInfo;
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
AActor* LakeActor = World->SpawnActor<AActor>(
|
||||
LakeBlueprintClass,
|
||||
Location,
|
||||
Rotation,
|
||||
SpawnInfo
|
||||
);
|
||||
|
||||
return LakeActor;
|
||||
return LakeActor;
|
||||
}
|
||||
|
||||
float UProceduralWaterManager::GetLandscapeSurfaceHeight(float x, float y, bool bDrawDebugLines)
|
||||
{
|
||||
UWorld* World = GetWorld();
|
||||
UWorld* World = GetWorld();
|
||||
|
||||
if(World)
|
||||
{
|
||||
FVector RayStartingPoint(x, y, 999999);
|
||||
FVector RayEndPoint(x, y, 0);
|
||||
if(World)
|
||||
{
|
||||
FVector RayStartingPoint(x, y, 999999);
|
||||
FVector RayEndPoint(x, y, 0);
|
||||
|
||||
// Raytrace
|
||||
FHitResult HitResult;
|
||||
World->LineTraceSingleByObjectType(
|
||||
OUT HitResult,
|
||||
RayStartingPoint,
|
||||
RayEndPoint,
|
||||
FCollisionObjectQueryParams(ECollisionChannel::ECC_WorldStatic),
|
||||
FCollisionQueryParams()
|
||||
);
|
||||
// Raytrace
|
||||
FHitResult HitResult;
|
||||
World->LineTraceSingleByObjectType(
|
||||
OUT HitResult,
|
||||
RayStartingPoint,
|
||||
RayEndPoint,
|
||||
FCollisionObjectQueryParams(ECollisionChannel::ECC_WorldStatic),
|
||||
FCollisionQueryParams()
|
||||
);
|
||||
|
||||
// Draw debug line.
|
||||
if (bDrawDebugLines)
|
||||
{
|
||||
FColor LineColor;
|
||||
// Draw debug line.
|
||||
if (bDrawDebugLines)
|
||||
{
|
||||
FColor LineColor;
|
||||
|
||||
if (HitResult.GetActor()) LineColor = FColor::Red;
|
||||
else LineColor = FColor::Green;
|
||||
if (HitResult.GetActor()) LineColor = FColor::Red;
|
||||
else LineColor = FColor::Green;
|
||||
|
||||
DrawDebugLine(
|
||||
World,
|
||||
RayStartingPoint,
|
||||
RayEndPoint,
|
||||
LineColor,
|
||||
true,
|
||||
5.f,
|
||||
0.f,
|
||||
10.f
|
||||
);
|
||||
}
|
||||
DrawDebugLine(
|
||||
World,
|
||||
RayStartingPoint,
|
||||
RayEndPoint,
|
||||
LineColor,
|
||||
true,
|
||||
5.f,
|
||||
0.f,
|
||||
10.f
|
||||
);
|
||||
}
|
||||
|
||||
// Return Z Location.
|
||||
if (HitResult.GetActor()) return HitResult.ImpactPoint.Z;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
// Return Z Location.
|
||||
if (HitResult.GetActor()) return HitResult.ImpactPoint.Z;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
|
|
@ -17,34 +17,34 @@
|
|||
USTRUCT(BlueprintType)
|
||||
struct CARLATOOLS_API FMapGeneratorMetaInfo
|
||||
{
|
||||
GENERATED_USTRUCT_BODY();
|
||||
GENERATED_USTRUCT_BODY();
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString DestinationPath;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString DestinationPath;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString MapName;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString MapName;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeX;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeX;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeY;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeY;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct CARLATOOLS_API FMapGeneratorTileMetaInfo
|
||||
{
|
||||
GENERATED_USTRUCT_BODY();
|
||||
GENERATED_USTRUCT_BODY();
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool bIsTiled = true;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
bool bIsTiled = true;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int IndexX;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int IndexX;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int IndexY;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int IndexY;
|
||||
};
|
||||
|
||||
/// Class UMapGeneratorWidget extends the functionality of UEditorUtilityWidget
|
||||
|
@ -53,66 +53,66 @@ struct CARLATOOLS_API FMapGeneratorTileMetaInfo
|
|||
UCLASS(BlueprintType)
|
||||
class CARLATOOLS_API UMapGeneratorWidget : public UEditorUtilityWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
GENERATED_BODY()
|
||||
|
||||
|
||||
private:
|
||||
// UPROPERTY()
|
||||
// UObjectLibrary *MapObjectLibrary;
|
||||
// UPROPERTY()
|
||||
// UObjectLibrary *MapObjectLibrary;
|
||||
|
||||
public:
|
||||
/// This function invokes a blueprint event defined in widget blueprint
|
||||
/// event graph, which sets a heightmap to the @a Landscape using
|
||||
/// ALandscapeProxy::LandscapeImportHeightMapFromRenderTarget(...)
|
||||
/// function, which is not exposed to be used in C++ code, only blueprints
|
||||
/// @a metaTileInfo contains some useful info to execute this function
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void AssignLandscapeHeightMap(ALandscape* Landscape, FMapGeneratorTileMetaInfo TileMetaInfo);
|
||||
/// This function invokes a blueprint event defined in widget blueprint
|
||||
/// event graph, which sets a heightmap to the @a Landscape using
|
||||
/// ALandscapeProxy::LandscapeImportHeightMapFromRenderTarget(...)
|
||||
/// function, which is not exposed to be used in C++ code, only blueprints
|
||||
/// @a metaTileInfo contains some useful info to execute this function
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void AssignLandscapeHeightMap(ALandscape* Landscape, FMapGeneratorTileMetaInfo TileMetaInfo);
|
||||
|
||||
/// Function called by Widget Blueprint which generates all tiles of map
|
||||
/// @a mapName, and saves them in @a destinationPath
|
||||
/// Returns a void string is success and an error message if the process failed
|
||||
UFUNCTION(Category="Map Generator",BlueprintCallable)
|
||||
FString GenerateMapFiles(const FMapGeneratorMetaInfo& MetaInfo);
|
||||
/// Function called by Widget Blueprint which generates all tiles of map
|
||||
/// @a mapName, and saves them in @a destinationPath
|
||||
/// Returns a void string is success and an error message if the process failed
|
||||
UFUNCTION(Category="Map Generator",BlueprintCallable)
|
||||
FString GenerateMapFiles(const FMapGeneratorMetaInfo& MetaInfo);
|
||||
|
||||
private:
|
||||
/// Loads the base tile map and stores it in @a WorldAssetData
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool LoadBaseTileWorld(FAssetData& WorldAssetData);
|
||||
private:
|
||||
/// Loads the base tile map and stores it in @a WorldAssetData
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool LoadBaseTileWorld(FAssetData& WorldAssetData);
|
||||
|
||||
/// Loads the base large map and stores it in @a WorldAssetData
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool LoadBaseLargeMapWorld(FAssetData& WorldAssetData);
|
||||
/// Loads the base large map and stores it in @a WorldAssetData
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool LoadBaseLargeMapWorld(FAssetData& WorldAssetData);
|
||||
|
||||
/// Loads the base template UWorld object from @a BaseMapPath and returns
|
||||
/// it in @a WorldAssetData
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool LoadWorld(FAssetData& WorldAssetData, const FString& BaseMapPath);
|
||||
/// Loads the base template UWorld object from @a BaseMapPath and returns
|
||||
/// it in @a WorldAssetData
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool LoadWorld(FAssetData& WorldAssetData, const FString& BaseMapPath);
|
||||
|
||||
/// Saves a world contained in @a WorldToBeSaved, in the path defined in @a DestinationPath
|
||||
/// named as @a WorldName, as a package .umap
|
||||
UFUNCTION()
|
||||
bool SaveWorld(FAssetData& WorldToBeSaved, const FString& DestinationPath, const FString& WorldName);
|
||||
/// Saves a world contained in @a WorldToBeSaved, in the path defined in @a DestinationPath
|
||||
/// named as @a WorldName, as a package .umap
|
||||
UFUNCTION()
|
||||
bool SaveWorld(FAssetData& WorldToBeSaved, const FString& DestinationPath, const FString& WorldName);
|
||||
|
||||
/// Takes the name of the map from @a MetaInfo and created the main map
|
||||
/// including all the actors needed by large map system
|
||||
UFUNCTION()
|
||||
bool CreateMainLargeMap(const FMapGeneratorMetaInfo& MetaInfo);
|
||||
/// Takes the name of the map from @a MetaInfo and created the main map
|
||||
/// including all the actors needed by large map system
|
||||
UFUNCTION()
|
||||
bool CreateMainLargeMap(const FMapGeneratorMetaInfo& MetaInfo);
|
||||
|
||||
/// Takes @a MetaInfo as input and generates all tiles based on the
|
||||
/// dimensions specified for the map
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool CreateTilesMaps(const FMapGeneratorMetaInfo& MetaInfo);
|
||||
/// Takes @a MetaInfo as input and generates all tiles based on the
|
||||
/// dimensions specified for the map
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool CreateTilesMaps(const FMapGeneratorMetaInfo& MetaInfo);
|
||||
|
||||
/// Gets the Landscape from the input world @a WorldAssetData and
|
||||
/// applies the heightmap to it. The tile index is indexX and indexY in
|
||||
/// @a TileMetaInfo argument
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool ApplyHeightMapToLandscape(FAssetData& WorldAssetData, FMapGeneratorTileMetaInfo TileMetaInfo);
|
||||
/// Gets the Landscape from the input world @a WorldAssetData and
|
||||
/// applies the heightmap to it. The tile index is indexX and indexY in
|
||||
/// @a TileMetaInfo argument
|
||||
/// The funtions return true is success, otherwise false
|
||||
UFUNCTION()
|
||||
bool ApplyHeightMapToLandscape(FAssetData& WorldAssetData, FMapGeneratorTileMetaInfo TileMetaInfo);
|
||||
};
|
||||
// #endif
|
||||
// #endif
|
||||
|
|
|
@ -17,103 +17,103 @@
|
|||
UENUM(BlueprintType)
|
||||
enum EWaterGenerationType
|
||||
{
|
||||
RIVERS = 0,
|
||||
LAKE = 1
|
||||
RIVERS = 0,
|
||||
LAKE = 1
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct CARLATOOLS_API FProceduralRiversMetaInfo
|
||||
{
|
||||
GENERATED_USTRUCT_BODY();
|
||||
GENERATED_USTRUCT_BODY();
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TEnumAsByte<EWaterGenerationType> WaterGenerationType;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TEnumAsByte<EWaterGenerationType> WaterGenerationType;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString WaterInfoPath;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FString WaterInfoPath;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int CustomSampling;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int CustomSampling;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float CustomScaleFactor;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float CustomScaleFactor;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float CustomRiverWidth;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float CustomRiverWidth;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FVector CustomLocationOffset;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FVector CustomLocationOffset;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float CustomHeight;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
float CustomHeight;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeOfLandscape;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeOfLandscape;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeOfTexture;
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
int SizeOfTexture;
|
||||
};
|
||||
|
||||
UCLASS(BlueprintType)
|
||||
class CARLATOOLS_API UProceduralWaterManager : public UEditorUtilityWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
UProceduralWaterManager();
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
UProceduralWaterManager();
|
||||
|
||||
public:
|
||||
/// River blueprint class, set by the user using the widget interface
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TSubclassOf<class AActor> RiverBlueprintClass;
|
||||
public:
|
||||
/// River blueprint class, set by the user using the widget interface
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TSubclassOf<class AActor> RiverBlueprintClass;
|
||||
|
||||
/// Lake blueprint class, set by the user using the widget interface
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TSubclassOf<class AActor> LakeBlueprintClass;
|
||||
/// Lake blueprint class, set by the user using the widget interface
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TSubclassOf<class AActor> LakeBlueprintClass;
|
||||
|
||||
/// Main function to be called from the widget to start all the generation process
|
||||
/// @a MetaInfo is the input data for this process
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FString StartWaterGeneration(const FProceduralRiversMetaInfo MetaInfo);
|
||||
/// Main function to be called from the widget to start all the generation process
|
||||
/// @a MetaInfo is the input data for this process
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FString StartWaterGeneration(const FProceduralRiversMetaInfo MetaInfo);
|
||||
|
||||
/// Add river @a riverActor spline point @a splinePoint to SplinePoint
|
||||
/// collection to be added in later processes to the spline component.
|
||||
/// This is implemented in blueprint code.
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void AddRiverPointFromCode(AActor* RiverActor, FSplinePoint SplinePoint);
|
||||
/// Add river @a riverActor spline point @a splinePoint to SplinePoint
|
||||
/// collection to be added in later processes to the spline component.
|
||||
/// This is implemented in blueprint code.
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void AddRiverPointFromCode(AActor* RiverActor, FSplinePoint SplinePoint);
|
||||
|
||||
/// It checks which is the direction the flow of the river depending on the
|
||||
/// altitude of the start and the end of the river @a riverActor
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void CheckAndReverseWaterFlow(AActor* RiverActor);
|
||||
/// It checks which is the direction the flow of the river depending on the
|
||||
/// altitude of the start and the end of the river @a riverActor
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void CheckAndReverseWaterFlow(AActor* RiverActor);
|
||||
|
||||
private:
|
||||
|
||||
/// It is responsible of the rivers generation, parsing the file,
|
||||
/// intantiating the actors and setting its splline points
|
||||
UFUNCTION()
|
||||
FString RiverGeneration(const FProceduralRiversMetaInfo MetaInfo);
|
||||
|
||||
/// It is responsible of the rivers generation, parsing the file,
|
||||
/// intantiating the actors and setting its splline points
|
||||
UFUNCTION()
|
||||
FString RiverGeneration(const FProceduralRiversMetaInfo MetaInfo);
|
||||
|
||||
/// It is responsible of the lakes generation, pasing the file,
|
||||
/// instantiating the actors and setting its properties
|
||||
UFUNCTION()
|
||||
FString LakeGeneration(const FProceduralRiversMetaInfo MetaInfo);
|
||||
/// It is responsible of the lakes generation, pasing the file,
|
||||
/// instantiating the actors and setting its properties
|
||||
UFUNCTION()
|
||||
FString LakeGeneration(const FProceduralRiversMetaInfo MetaInfo);
|
||||
|
||||
/// Instantiate a new actor of type RiverBlueprintClass
|
||||
/// Returns the the actor created
|
||||
UFUNCTION()
|
||||
AActor* SpawnRiverBlueprintActor();
|
||||
/// Instantiate a new actor of type RiverBlueprintClass
|
||||
/// Returns the the actor created
|
||||
UFUNCTION()
|
||||
AActor* SpawnRiverBlueprintActor();
|
||||
|
||||
/// Instantiate a new actor of type LakeBlueprintClass
|
||||
/// Returns the the actor created
|
||||
UFUNCTION()
|
||||
AActor* SpawnLakeBlueprintActor();
|
||||
/// Instantiate a new actor of type LakeBlueprintClass
|
||||
/// Returns the the actor created
|
||||
UFUNCTION()
|
||||
AActor* SpawnLakeBlueprintActor();
|
||||
|
||||
/// Calculates the height of the landscape in an specific 2D coordinate ( @a x, @a y)
|
||||
/// throwing rays and detecting the hit point. @a bDrawDebugLines allows to visualize
|
||||
/// the rays in the viewport, only for debug purposes.
|
||||
/// Return the Z value
|
||||
UFUNCTION()
|
||||
float GetLandscapeSurfaceHeight(float x, float y, bool bDrawDebugLines = false);
|
||||
/// Calculates the height of the landscape in an specific 2D coordinate ( @a x, @a y)
|
||||
/// throwing rays and detecting the hit point. @a bDrawDebugLines allows to visualize
|
||||
/// the rays in the viewport, only for debug purposes.
|
||||
/// Return the Z value
|
||||
UFUNCTION()
|
||||
float GetLandscapeSurfaceHeight(float x, float y, bool bDrawDebugLines = false);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue