添加 camera 的subsystem 进行管理
This commit is contained in:
parent
d10f4763e7
commit
f682b3b460
@ -22,7 +22,7 @@ public:
|
|||||||
// ===== 多视图参数 =====
|
// ===== 多视图参数 =====
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
||||||
int32 ViewCount = 9;
|
int32 ViewCount = 1;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView")
|
||||||
float Baseline = 5.0f; // cm
|
float Baseline = 5.0f; // cm
|
||||||
@ -57,13 +57,17 @@ protected:
|
|||||||
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void BuildViewCaptures();
|
void BuildViewCaptures();
|
||||||
void UpdateViewTransforms();
|
void UpdateViewTransforms();
|
||||||
void CaptureViews();
|
void CaptureViews();
|
||||||
void GenerateAtlas();
|
void GenerateAtlas();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
UPROPERTY(Transient)
|
UPROPERTY(Transient)
|
||||||
TArray<class USceneCaptureComponent2D*> ViewCaptures;
|
TArray<class USceneCaptureComponent2D*> ViewCaptures;
|
||||||
|
|
||||||
|
|||||||
31
Plugins/CameraCapture/Source/CameraCaptureSubSystem.h
Normal file
31
Plugins/CameraCapture/Source/CameraCaptureSubSystem.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2026 (c) Jupiter. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Subsystems/WorldSubsystem.h"
|
||||||
|
#include "CameraCaptureSubSystem.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ACameraCaptureActor;
|
||||||
|
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class CAMERACAPTURE_API UCameraCaptureSubSystem : public UWorldSubsystem
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
||||||
|
virtual void Deinitialize() override;
|
||||||
|
virtual void OnWorldBeginPlay(UWorld& InWorld) override;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
TArray<TWeakObjectPtr<ACameraCaptureActor>> AllCaptureCameras;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
33
Plugins/CameraCapture/Source/CameraCaptureSubsystem.cpp
Normal file
33
Plugins/CameraCapture/Source/CameraCaptureSubsystem.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright 2026 (c) Jupiter. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "CameraCaptureSubSystem.h"
|
||||||
|
#include "CameraCaptureActor.h"
|
||||||
|
|
||||||
|
#include "EngineUtils.h"
|
||||||
|
|
||||||
|
void UCameraCaptureSubSystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||||
|
{
|
||||||
|
Super::Initialize(Collection);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void UCameraCaptureSubSystem::Deinitialize()
|
||||||
|
{
|
||||||
|
Super::Deinitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UCameraCaptureSubSystem::OnWorldBeginPlay(UWorld& InWorld)
|
||||||
|
{
|
||||||
|
Super::OnWorldBeginPlay(InWorld);
|
||||||
|
|
||||||
|
for (TActorIterator<ACameraCaptureActor> It(GetWorld()); It; ++It)
|
||||||
|
{
|
||||||
|
|
||||||
|
ACameraCaptureActor* CameraCaptureActor = Cast<ACameraCaptureActor>(*It);
|
||||||
|
if (CameraCaptureActor)
|
||||||
|
{
|
||||||
|
AllCaptureCameras.Emplace(CameraCaptureActor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user