75 lines
2.0 KiB
C++
75 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Camera/CameraActor.h"
|
|
#include "CameraCaptureActor.generated.h"
|
|
|
|
UENUM(BlueprintType)
|
|
enum class EViewDistribution : uint8
|
|
{
|
|
LinearHorizontal UMETA(DisplayName = "Linear Horizontal"),
|
|
Circular UMETA(DisplayName = "Circular")
|
|
};
|
|
|
|
UCLASS()
|
|
class CAMERACAPTURE_API ACameraCaptureActor : public ACameraActor
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
ACameraCaptureActor();
|
|
|
|
// ===== 多视图参数 =====
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
|
int32 ViewCount = 9;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
|
float Baseline = 5.0f; // cm
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
|
EViewDistribution Distribution = EViewDistribution::LinearHorizontal;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
|
int32 ViewWidth = 1024;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
|
int32 ViewHeight = 1024;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
|
bool bCaptureEveryFrame = true;
|
|
|
|
// Atlas
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Atlas")
|
|
bool bGenerateAtlas = true;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Atlas")
|
|
int32 AtlasGridX = 3;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Atlas")
|
|
int32 AtlasGridY = 3;
|
|
|
|
protected:
|
|
virtual void BeginPlay() override;
|
|
virtual void Tick(float DeltaSeconds) override;
|
|
|
|
#if WITH_EDITOR
|
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
|
#endif
|
|
|
|
private:
|
|
void BuildViewCaptures();
|
|
void UpdateViewTransforms();
|
|
void CaptureViews();
|
|
void GenerateAtlas();
|
|
|
|
private:
|
|
UPROPERTY(Transient)
|
|
TArray<class USceneCaptureComponent2D*> ViewCaptures;
|
|
|
|
UPROPERTY(Transient)
|
|
TArray<class UTextureRenderTarget2D*> ViewRTs;
|
|
|
|
UPROPERTY(Transient)
|
|
class UTextureRenderTarget2D* AtlasRT;
|
|
}; |