13 #include "NVSceneCapturerUtils.h"
14 #include "NVTextureReader.generated.h"
16 DECLARE_LOG_CATEGORY_EXTERN(LogNVTextureReader, Log, All)
26 virtual ~FNVTextureReader();
27 FNVTextureReader& operator=(
const FNVTextureReader& OtherReader);
43 virtual bool ReadPixelsData(OnFinishedReadingPixelsDataCallback Callback,
bool bIgnoreAlpha =
false);
55 void SetSourceTexture(FTexture2DRHIRef NewSourceTexture,
56 const FIntRect& NewSourceRect = FIntRect(),
57 EPixelFormat NewReadbackPixelFormat = EPixelFormat::PF_Unknown,
58 const FIntPoint& NewReadbackSize = FIntPoint::ZeroValue);
69 bool ReadPixelsData(OnFinishedReadingPixelsDataCallback Callback,
70 const FTexture2DRHIRef& NewSourceTexture,
71 const FIntRect& NewSourceRect = FIntRect(),
72 EPixelFormat NewReadbackPixelFormat = EPixelFormat::PF_Unknown,
73 const FIntPoint& NewReadbackSize = FIntPoint::ZeroValue,
74 bool bIgnoreAlpha =
false);
79 const FTexture2DRHIRef& NewSourceTexture,
80 const FIntRect& NewSourceRect = FIntRect(),
81 EPixelFormat NewReadbackPixelFormat = EPixelFormat::PF_Unknown,
82 const FIntPoint& NewReadbackSize = FIntPoint::ZeroValue);
91 static bool ReadPixelsRaw(
const FTexture2DRHIRef& SourceTexture,
92 const FIntRect& SourceRect,
93 EPixelFormat TargetPixelFormat,
94 const FIntPoint& TargetSize,
96 OnFinishedReadingRawPixelsCallback Callback);
98 static FNVTexturePixelData BuildPixelData(uint8* PixelsData, EPixelFormat PixelFormat,
const FIntPoint& ImageSize,
const FIntPoint& TargetSize);
99 static void BuildPixelData(
FNVTexturePixelData& OutPixelsData, uint8* PixelsData, EPixelFormat PixelFormat,
const FIntPoint& ImageSize,
const FIntPoint& TargetSize);
110 static void CopyTexture2d(
class IRendererModule* RendererModule, FRHICommandListImmediate& RHICmdList,
const FTexture2DRHIRef& SourceTexture,
const FIntRect& SourceRect,
111 FTexture2DRHIRef& TargetTexture,
const FIntRect& TargetRect,
bool bOverwriteAlpha =
true);
114 FTexture2DRHIRef SourceTexture;
116 EPixelFormat ReadbackPixelFormat;
117 FIntPoint ReadbackSize;
120 class UTextureRenderTarget2D;
130 const UTextureRenderTarget2D* GetTextureRenderTarget()
const
132 return SourceRenderTarget;
134 void SetTextureRenderTarget(UTextureRenderTarget2D* NewRenderTarget);
137 virtual bool ReadPixelsData(OnFinishedReadingPixelsDataCallback Callback,
bool bIgnoreAlpha =
false)
final;
140 void UpdateTextureFromRenderTarget();
144 UTextureRenderTarget2D* SourceRenderTarget;
TFunction< void(const FNVTexturePixelData &)> OnFinishedReadingPixelsDataCallback
Callback function get called after finish reading pixels data FNVTexturePixelData - The struct contai...
TFunction< void(uint8 *, EPixelFormat, FIntPoint)> OnFinishedReadingRawPixelsCallback
Callback function get called after finish reading pixels data uint8* - pointer to pixel array buffer ...