Skip to content

Commit

Permalink
Add comments and UE5.2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
shun126 committed May 13, 2023
1 parent 307ebbd commit 20a9018
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 31 deletions.
2 changes: 0 additions & 2 deletions Source/DungeonGenerator/Private/DungeonBlueprint.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/**
BluePrint 計算関数ライブラリクラス
\author Shun Moriya
\copyright 2023- Shun Moriya
All Rights Reserved.
Expand Down
2 changes: 2 additions & 0 deletions Source/DungeonGenerator/Private/DungeonGeneratorCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ All Rights Reserved.
#include "Core/Generator.h"
#include "Core/Voxel.h"
#include "Core/Math/Math.h"
#include <TextureResource.h>
#include <GameFramework/PlayerStart.h>
#include <Engine/LevelStreamingDynamic.h>
#include <Engine/StaticMeshActor.h>
#include <Engine/Texture2D.h>
#include <Kismet/GameplayStatics.h>
#include <Misc/EngineVersionComparison.h>
#include <NavMesh/NavMeshBoundsVolume.h>
Expand Down
2 changes: 0 additions & 2 deletions Source/DungeonGenerator/Private/DungeonMiniMapTexture.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/*
Minimap Texture
\author Shun Moriya
\copyright 2023- Shun Moriya
All Rights Reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/*
Minimap texture classes generated per layer
\author Shun Moriya
\copyright 2023- Shun Moriya
All Rights Reserved.
Expand Down
3 changes: 3 additions & 0 deletions Source/DungeonGenerator/Public/DungeonDoor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ All Rights Reserved.
#include <GameFramework/Actor.h>
#include "DungeonDoor.generated.h"

/*
Dungeon door actor class
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API ADungeonDoor : public AActor
{
Expand Down
4 changes: 1 addition & 3 deletions Source/DungeonGenerator/Public/DungeonGenerateActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ All Rights Reserved.
#include <memory>
#include "DungeonGenerateActor.generated.h"

// 前方宣言
class CDungeonGeneratorCore;
class UDungeonGenerateParameter;
class UDungeonMiniMapTextureLayer;
Expand All @@ -21,14 +20,13 @@ namespace dungeon
class Room;
}

// イベント宣言
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDungeonGeneratorActorSignature, const FTransform&, transform);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDungeonGeneratorDoorSignature, AActor*, doorActor, EDungeonRoomProps, props);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FDungeonGeneratorPlayerStartSignature, const FVector&, location);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FDungeonGeneratorDelegete, bool, StreamingLevel, EDungeonRoomParts, DungeonRoomParts, const FBox&, RoomRect);

/**
dungeon generation actor
Dungeon generation actor class
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API ADungeonGenerateActor : public AActor
Expand Down
2 changes: 1 addition & 1 deletion Source/DungeonGenerator/Public/DungeonGenerateParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ struct DUNGEONGENERATOR_API FDungeonRandomActorParts : public FDungeonActorParts
};

/**
Dungeon generation parameters
Dungeon generation parameter class
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API UDungeonGenerateParameter : public UObject
Expand Down
3 changes: 3 additions & 0 deletions Source/DungeonGenerator/Public/DungeonGeneratorModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ All Rights Reserved.
#include <CoreMinimal.h>
#include <Modules/ModuleManager.h>

/*
Dungeon generator module class
*/
class FDungeonGeneratorModule : public IModuleInterface
{
public:
Expand Down
3 changes: 1 addition & 2 deletions Source/DungeonGenerator/Public/DungeonLevelStreamingActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ All Rights Reserved.
class UBoxComponent;

/*
プレイヤーがOverlapVolumeに入った時に指定レベルをロードするヘルパークラス
Helper class that loads the level when the player enters the OverlapVolume
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API ADungeonLevelStreamingActor : public AActor
Expand Down
6 changes: 4 additions & 2 deletions Source/DungeonGenerator/Public/DungeonLevelStreamingDynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ All Rights Reserved.

class ULevelStreamingDynamic;

/*
Class that wraps ULevelStreamingDynamic
No extended functionality
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API UDungeonLevelStreamingDynamic : public ULevelStreamingDynamic
{
Expand All @@ -27,6 +31,4 @@ class DUNGEONGENERATOR_API UDungeonLevelStreamingDynamic : public ULevelStreamin
destructor
*/
virtual ~UDungeonLevelStreamingDynamic() = default;

//virtual bool ShouldBeAlwaysLoaded() const override { return true; }
};
2 changes: 1 addition & 1 deletion Source/DungeonGenerator/Public/DungeonMiniMapTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CDungeonGeneratorCore;
class UTexture2D;

/**
Minimap Textures
Minimap Textures class
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API UDungeonMiniMapTexture : public UObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace dungeon
}

/**
Minimap Texture Layer
Minimap texture layer class
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API UDungeonMiniMapTextureLayer : public UObject
Expand Down
17 changes: 14 additions & 3 deletions Source/DungeonGenerator/Public/DungeonRoomAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@ All Rights Reserved.
#include "DungeonRoomAsset.generated.h"

/**
Sub-level information to replace dungeon rooms
Sub-level information to replace dungeon rooms class
*/
UCLASS(Blueprintable, BlueprintType)
class DUNGEONGENERATOR_API UDungeonRoomAsset : public UObject
{
GENERATED_BODY()

public:
/*
constructor
*/
explicit UDungeonRoomAsset(const FObjectInitializer& ObjectInitializer);

/*
destructor
*/
virtual ~UDungeonRoomAsset() = default;

const TArray<const FDungeonRoomLocator>& GetDungeonRoomLocator() const;
/*
Get the dungeon room information array
\return Array of FDungeonRoomLocator
*/
const TArray<const FDungeonRoomLocator>& GetDungeonRoomLocator() const noexcept;

protected:
UPROPERTY(EditAnywhere, Category = "DungeonGenerator")
Expand All @@ -32,7 +43,7 @@ inline UDungeonRoomAsset::UDungeonRoomAsset(const FObjectInitializer& ObjectInit
{
}

inline const TArray<const FDungeonRoomLocator>& UDungeonRoomAsset::GetDungeonRoomLocator() const
inline const TArray<const FDungeonRoomLocator>& UDungeonRoomAsset::GetDungeonRoomLocator() const noexcept
{
return reinterpret_cast<const TArray<const FDungeonRoomLocator>&>(DungeonRoomLocator);
}
45 changes: 44 additions & 1 deletion Source/DungeonGenerator/Public/DungeonRoomLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,67 @@ enum class EDungeonRoomSizeCondition : uint8
};

/**
Sub-level information to replace dungeon rooms
Sub-level information to replace dungeon rooms class
*/
USTRUCT(Blueprintable, BlueprintType)
struct DUNGEONGENERATOR_API FDungeonRoomLocator
{
GENERATED_BODY()

public:
/*
Get sublevel paths
*/
const FSoftObjectPath& GetLevelPath() const noexcept;

/*
Gets the sub-level grid size
*/
FIntVector GetSize() const noexcept;

/*
Gets the grid width of the sublevel
*/
int32 GetWidth() const noexcept;

/*
Gets the grid depth of the sublevel
*/
int32 GetDepth() const noexcept;

/*
Gets the grid height of the sublevel
*/
int32 GetHeight() const noexcept;

/*
Gets the width condition for placing sublevels
*/
EDungeonRoomSizeCondition GetWidthCondition() const noexcept;

/*
Gets the depth condition for placing sublevels
*/
EDungeonRoomSizeCondition GetDepthCondition() const noexcept;

/*
Gets the height condition for placing sublevels
*/
EDungeonRoomSizeCondition GetHeightCondition() const noexcept;

/*
Get the parts of the dungeon (room roles) where the sublevels will be placed
*/
EDungeonRoomParts GetDungeonParts() const noexcept;

/*
Generates or retrieves the ceiling mesh of the grid for sublevel placement
*/
bool IsGenerateRoofMesh() const noexcept;

/*
Generates or retrieves the floor mesh of the grid for sublevel placement
*/
bool IsGenerateFloorMesh() const noexcept;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ All Rights Reserved.
#include "DungeonTransactionalHierarchicalInstancedStaticMeshComponent.generated.h"

/*
連続してAddInstanceやRemoveInstanceを行う時に、開始と終了処理をまとめるためのクラス
Class for summarizing the start and end processing when performing consecutive AddInstance and RemoveInstance.
UHierarchicalInstancedStaticMeshComponentを継承しています
Inherits from UHierarchicalInstancedStaticMeshComponent
*/
UCLASS(Blueprintable, BlueprintType, meta = (BlueprintSpawnableComponent))
class DUNGEONGENERATOR_API UDungeonTransactionalHierarchicalInstancedStaticMeshComponent : public UHierarchicalInstancedStaticMeshComponent
Expand All @@ -21,28 +21,29 @@ class DUNGEONGENERATOR_API UDungeonTransactionalHierarchicalInstancedStaticMeshC

public:
/*
大量のインスタンスを変更する場合に呼び出して下さい。
グラフィックに関する処理をEndTransactionでまとめて処理します。
\param[in] collisionEnableControl 物理コリジョンが有効の場合のみ、コリジョンの有効性を制御します
Call this when changing a large number of instances.
EndTransaction handles all processing related to graphics together.
\param[in] collisionEnableControl collision enable only if physical collision is enabled
*/
void BeginTransaction(const bool collisionEnableControl);

/*
大量のインスタンスを変更する場合に呼び出して下さい。
グラフィックに関する処理をEndTransactionでまとめて処理します。
Call this when changing a large number of instances.
Processes related to graphics are grouped together in an EndTransaction.
*/
void EndTransaction(const bool asyncBuildTree);

/*
トランザクション中?
During transaction?
*/
bool InTransaction() const;

/*
トランザクション中ではない?
Not in transaction?
*/
bool IsImmediate() const;

// overrides
#if UE_VERSION_OLDER_THAN(5, 0, 0)
virtual int32 AddInstance(const FTransform& instanceTransforms) override;
virtual TArray<int32> AddInstances(const TArray<FTransform>& instanceTransforms, bool bShouldReturnIndices) override;
Expand All @@ -57,10 +58,10 @@ class DUNGEONGENERATOR_API UDungeonTransactionalHierarchicalInstancedStaticMeshC
virtual void ClearInstances() override;

private:
// コリジョンを無効化して物理エンジンへの通知を抑制
// Disable collision to suppress notifications to the physical engine
void CheckAndDisableCollision();

// 抑制した設定を復元
// Restore suppressed settings
void CheckAndRevertCollision();

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ class DUNGEONGENERATOREDITOR_API UDungeonGenerateParameterFactory : public UFact
GENERATED_BODY()

public:
/*
constructor
*/
UDungeonGenerateParameterFactory();

/*
destructor
*/
virtual ~UDungeonGenerateParameterFactory() = default;

// UFactory overrides
Expand Down

0 comments on commit 20a9018

Please sign in to comment.