File size: 3,230 Bytes
7fd553e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/Actor.h"
#include "PocketCapture.generated.h"
#define UE_API POCKETWORLDS_API
enum ESceneCaptureSource : int;
class UMaterialInterface;
class UPocketCaptureSubsystem;
class UPrimitiveComponent;
class USceneCaptureComponent2D;
class UTextureRenderTarget2D;
class UWorld;
struct FFrame;
UCLASS(MinimalAPI, Abstract, Within=PocketCaptureSubsystem, BlueprintType, Blueprintable)
class UPocketCapture : public UObject
{
GENERATED_BODY()
public:
UE_API UPocketCapture();
UE_API virtual void Initialize(UWorld* InWorld, int32 RendererIndex);
UE_API virtual void Deinitialize();
UE_API virtual void BeginDestroy() override;
UFUNCTION(BlueprintCallable)
UE_API void SetRenderTargetSize(int32 Width, int32 Height);
UFUNCTION(BlueprintCallable)
UE_API UTextureRenderTarget2D* GetOrCreateDiffuseRenderTarget();
UFUNCTION(BlueprintCallable)
UE_API UTextureRenderTarget2D* GetOrCreateAlphaMaskRenderTarget();
UFUNCTION(BlueprintCallable)
UE_API UTextureRenderTarget2D* GetOrCreateEffectsRenderTarget();
UFUNCTION(BlueprintCallable)
UE_API void SetCaptureTarget(AActor* InCaptureTarget);
UFUNCTION(BlueprintCallable)
UE_API void SetAlphaMaskedActors(const TArray<AActor*>& InCaptureTarget);
UFUNCTION(BlueprintCallable)
UE_API void CaptureDiffuse();
UFUNCTION(BlueprintCallable)
UE_API void CaptureAlphaMask();
UFUNCTION(BlueprintCallable)
UE_API void CaptureEffects();
UFUNCTION(BlueprintCallable)
UE_API virtual void ReleaseResources();
UFUNCTION(BlueprintCallable)
UE_API virtual void ReclaimResources();
UFUNCTION(BlueprintCallable)
UE_API int32 GetRendererIndex() const;
protected:
AActor* GetCaptureTarget() const { return CaptureTargetPtr.Get(); }
virtual void OnCaptureTargetChanged(AActor* InCaptureTarget) {}
UE_API bool CaptureScene(UTextureRenderTarget2D* InRenderTarget, const TArray<AActor*>& InCaptureActors, ESceneCaptureSource CaptureSource, UMaterialInterface* OverrideMaterial);
protected:
UE_API TArray<UPrimitiveComponent*> GatherPrimitivesForCapture(const TArray<AActor*>& InCaptureActors) const;
UE_API UPocketCaptureSubsystem* GetThumbnailSystem() const;
protected:
UPROPERTY(EditDefaultsOnly)
TObjectPtr<UMaterialInterface> AlphaMaskMaterial;
UPROPERTY(EditDefaultsOnly)
TObjectPtr<UMaterialInterface> EffectMaskMaterial;
protected:
UPROPERTY(Transient)
TObjectPtr<UWorld> PrivateWorld;
UPROPERTY(Transient)
int32 RendererIndex = INDEX_NONE;
UPROPERTY(VisibleAnywhere)
int32 SurfaceWidth = 1;
UPROPERTY(VisibleAnywhere)
int32 SurfaceHeight = 1;
UPROPERTY(VisibleAnywhere)
TObjectPtr<UTextureRenderTarget2D> DiffuseRT;
UPROPERTY(VisibleAnywhere)
TObjectPtr<UTextureRenderTarget2D> AlphaMaskRT;
UPROPERTY(VisibleAnywhere)
TObjectPtr<UTextureRenderTarget2D> EffectsRT;
UPROPERTY(VisibleAnywhere)
TObjectPtr<USceneCaptureComponent2D> CaptureComponent;
UPROPERTY(VisibleAnywhere)
TWeakObjectPtr<AActor> CaptureTargetPtr;
UPROPERTY(VisibleAnywhere)
TArray<TWeakObjectPtr<AActor>> AlphaMaskActorPtrs;
};
#undef UE_API
|