diff --git a/Plugins/CameraCapture/Source/CameraCaptureActor.cpp b/Plugins/CameraCapture/Source/CameraCaptureActor.cpp index 33aa258..77b08ca 100644 --- a/Plugins/CameraCapture/Source/CameraCaptureActor.cpp +++ b/Plugins/CameraCapture/Source/CameraCaptureActor.cpp @@ -78,7 +78,7 @@ void ACameraCaptureActor::BuildViewCaptures() USceneCaptureComponent2D* Capture = NewObject(this); Capture->SetupAttachment(GetRootComponent()); - Capture->RegisterComponent(); + Capture->RegisterComponent(); Capture->TextureTarget = RT; Capture->CaptureSource = ESceneCaptureSource::SCS_FinalColorLDR; diff --git a/Plugins/CameraCapture/Source/CameraCaptureActor.h b/Plugins/CameraCapture/Source/CameraCaptureActor.h index 218f921..781a9a4 100644 --- a/Plugins/CameraCapture/Source/CameraCaptureActor.h +++ b/Plugins/CameraCapture/Source/CameraCaptureActor.h @@ -22,7 +22,7 @@ public: // ===== 多视图参数 ===== UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView") - int32 ViewCount = 9; + int32 ViewCount = 1; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MultiView") float Baseline = 5.0f; // cm @@ -45,7 +45,7 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Atlas") int32 AtlasGridX = 3; - + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Atlas") int32 AtlasGridY = 3; @@ -57,13 +57,17 @@ protected: virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; #endif + + private: + void BuildViewCaptures(); void UpdateViewTransforms(); void CaptureViews(); void GenerateAtlas(); private: + UPROPERTY(Transient) TArray ViewCaptures; diff --git a/Plugins/CameraCapture/Source/CameraCaptureSubSystem.h b/Plugins/CameraCapture/Source/CameraCaptureSubSystem.h new file mode 100644 index 0000000..053bbc6 --- /dev/null +++ b/Plugins/CameraCapture/Source/CameraCaptureSubSystem.h @@ -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> AllCaptureCameras; + + +}; diff --git a/Plugins/CameraCapture/Source/CameraCaptureSubsystem.cpp b/Plugins/CameraCapture/Source/CameraCaptureSubsystem.cpp new file mode 100644 index 0000000..1dfc81e --- /dev/null +++ b/Plugins/CameraCapture/Source/CameraCaptureSubsystem.cpp @@ -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 It(GetWorld()); It; ++It) + { + + ACameraCaptureActor* CameraCaptureActor = Cast(*It); + if (CameraCaptureActor) + { + AllCaptureCameras.Emplace(CameraCaptureActor); + } + } + +}