NVIDIA DeepLearning Dataset Synthesizer (NDDS)
 All Classes Namespaces Functions Variables Typedefs Pages
FNVTextureReader Struct Reference
+ Inheritance diagram for FNVTextureReader:

Public Types

typedef TFunction< void(const
FNVTexturePixelData &)> 
OnFinishedReadingPixelsDataCallback
 Callback function get called after finish reading pixels data FNVTexturePixelData - The struct contain the texture's pixels data. More...
 
typedef TFunction< void(uint8
*, EPixelFormat, FIntPoint)> 
OnFinishedReadingRawPixelsCallback
 Callback function get called after finish reading pixels data uint8* - pointer to pixel array buffer EPixelFormat - format of the read back pixels FIntPoint - 2d size of the pixels image. More...
 

Public Member Functions

FNVTextureReaderoperator= (const FNVTextureReader &OtherReader)
 
virtual bool ReadPixelsData (OnFinishedReadingPixelsDataCallback Callback, bool bIgnoreAlpha=false)
 Read back the pixels data from the current source texture. More...
 
virtual bool ReadPixelsData (FNVTexturePixelData &OutPixelsData)
 Read back the pixels data from the current source texture NOTE: This function is sync, the pixels data is returned right away but it may cause the game to hitches since it flush the rendering commands. More...
 

Protected Member Functions

bool ReadPixelsData (OnFinishedReadingPixelsDataCallback Callback, const FTexture2DRHIRef &NewSourceTexture, const FIntRect &NewSourceRect=FIntRect(), EPixelFormat NewReadbackPixelFormat=EPixelFormat::PF_Unknown, const FIntPoint &NewReadbackSize=FIntPoint::ZeroValue, bool bIgnoreAlpha=false)
 Read back the pixels data from the current source texture. More...
 
bool ReadPixelsData (FNVTexturePixelData &OutPixelsData, const FTexture2DRHIRef &NewSourceTexture, const FIntRect &NewSourceRect=FIntRect(), EPixelFormat NewReadbackPixelFormat=EPixelFormat::PF_Unknown, const FIntPoint &NewReadbackSize=FIntPoint::ZeroValue)
 Read back the pixels data from the current source texture NOTE: This function is sync, the pixels data is returned right away but it may cause the game to hitches since it flush the rendering commands. More...
 
void SetSourceTexture (FTexture2DRHIRef NewSourceTexture, const FIntRect &NewSourceRect=FIntRect(), EPixelFormat NewReadbackPixelFormat=EPixelFormat::PF_Unknown, const FIntPoint &NewReadbackSize=FIntPoint::ZeroValue)
 Change the information of the texture to read from. More...
 

Static Protected Member Functions

static FNVTexturePixelData BuildPixelData (uint8 *PixelsData, EPixelFormat PixelFormat, const FIntPoint &ImageSize, const FIntPoint &TargetSize)
 
static void BuildPixelData (FNVTexturePixelData &OutPixelsData, uint8 *PixelsData, EPixelFormat PixelFormat, const FIntPoint &ImageSize, const FIntPoint &TargetSize)
 
static void CopyTexture2d (class IRendererModule *RendererModule, FRHICommandListImmediate &RHICmdList, const FTexture2DRHIRef &SourceTexture, const FIntRect &SourceRect, FTexture2DRHIRef &TargetTexture, const FIntRect &TargetRect, bool bOverwriteAlpha=true)
 Copy the pixels data from a texture to another one NOTE: The function return back right away but the action is running in the GPU. More...
 
static bool ReadPixelsRaw (const FTexture2DRHIRef &SourceTexture, const FIntRect &SourceRect, EPixelFormat TargetPixelFormat, const FIntPoint &TargetSize, bool bIgnoreAlpha, OnFinishedReadingRawPixelsCallback Callback)
 Read the pixel data from a render target. More...
 

Protected Attributes

EPixelFormat ReadbackPixelFormat
 
FIntPoint ReadbackSize
 
FIntRect SourceRect
 
FTexture2DRHIRef SourceTexture
 

Detailed Description

Definition at line 20 of file NVTextureReader.h.

Member Typedef Documentation

Callback function get called after finish reading pixels data FNVTexturePixelData - The struct contain the texture's pixels data.

Definition at line 37 of file NVTextureReader.h.

typedef TFunction<void(uint8*, EPixelFormat, FIntPoint)> FNVTextureReader::OnFinishedReadingRawPixelsCallback

Callback function get called after finish reading pixels data uint8* - pointer to pixel array buffer EPixelFormat - format of the read back pixels FIntPoint - 2d size of the pixels image.

Definition at line 33 of file NVTextureReader.h.

Member Function Documentation

static void FNVTextureReader::CopyTexture2d ( class IRendererModule *  RendererModule,
FRHICommandListImmediate &  RHICmdList,
const FTexture2DRHIRef &  SourceTexture,
const FIntRect &  SourceRect,
FTexture2DRHIRef &  TargetTexture,
const FIntRect &  TargetRect,
bool  bOverwriteAlpha = true 
)
staticprotected

Copy the pixels data from a texture to another one NOTE: The function return back right away but the action is running in the GPU.

Parameters
RendererModuleReference to the Renderer module
RHICmdListThe RHI command list used to copy texture. This parameter can be used to wait for the action to be done
SourceTextureThe original texture
SourceRectThe region to copy from the SourceTexture
TargetTextureThe target texture to copy pixels to
TargetRectThe region in the TargetTexture to copy pixels to
bOverwriteAlphaIf true, overwrite the alpha of the target using the source texture's alpha
virtual bool FNVTextureReader::ReadPixelsData ( OnFinishedReadingPixelsDataCallback  Callback,
bool  bIgnoreAlpha = false 
)
virtual

Read back the pixels data from the current source texture.

Parameters
CallbackThe function to call after all the pixels data are read from the source texture
bIgnoreAlphaIf true, just set the alpha value of the readback pixels to 1, otherwise read it correctly NOTE: This function is async, the reading process will run on the rendering thread in parallel with the game thread

Reimplemented in FNVTextureRenderTargetReader.

virtual bool FNVTextureReader::ReadPixelsData ( FNVTexturePixelData OutPixelsData)
virtual

Read back the pixels data from the current source texture NOTE: This function is sync, the pixels data is returned right away but it may cause the game to hitches since it flush the rendering commands.

Reimplemented in FNVTextureRenderTargetReader.

bool FNVTextureReader::ReadPixelsData ( OnFinishedReadingPixelsDataCallback  Callback,
const FTexture2DRHIRef &  NewSourceTexture,
const FIntRect &  NewSourceRect = FIntRect(),
EPixelFormat  NewReadbackPixelFormat = EPixelFormat::PF_Unknown,
const FIntPoint &  NewReadbackSize = FIntPoint::ZeroValue,
bool  bIgnoreAlpha = false 
)
protected

Read back the pixels data from the current source texture.

Parameters
CallbackThe function to call after all the pixels data are read from the source texture
NewSourceTextureThe texture to read from
NewSourceRectThe region to read from the source texture. If the region is empty, the whole source texture will be read
NewReadbackPixelFormatThe pixel format of the read back pixels. If the pixel format is Unknown, the read back pixels will have the same format as the source texture
NewReadbackSizeThe 2d size of the read back pixels. If the size is zero, the read back size will be the same as the size of the source texture
bIgnoreAlphaIf true, just set the alpha value of the readback pixels to 1, otherwise read it correctly NOTE: This function is async, the reading process will run on the rendering thread in parallel with the game thread
bool FNVTextureReader::ReadPixelsData ( FNVTexturePixelData OutPixelsData,
const FTexture2DRHIRef &  NewSourceTexture,
const FIntRect &  NewSourceRect = FIntRect(),
EPixelFormat  NewReadbackPixelFormat = EPixelFormat::PF_Unknown,
const FIntPoint &  NewReadbackSize = FIntPoint::ZeroValue 
)
protected

Read back the pixels data from the current source texture NOTE: This function is sync, the pixels data is returned right away but it may cause the game to hitches since it flush the rendering commands.

static bool FNVTextureReader::ReadPixelsRaw ( const FTexture2DRHIRef &  SourceTexture,
const FIntRect &  SourceRect,
EPixelFormat  TargetPixelFormat,
const FIntPoint &  TargetSize,
bool  bIgnoreAlpha,
OnFinishedReadingRawPixelsCallback  Callback 
)
staticprotected

Read the pixel data from a render target.

Parameters
SourceTextureThe texture to read from
SourceRectThe area where to read from the SourceRenderTarget
TargetPixelFormatThe pixel format of the read back pixels data
TargetSizeThe size of the read back pixels area
bIgnoreAlphaIf true, just set the alpha value of the readback pixels to 1, otherwise read it correctly
CallbackFunction to call after finished reading pixels data
void FNVTextureReader::SetSourceTexture ( FTexture2DRHIRef  NewSourceTexture,
const FIntRect &  NewSourceRect = FIntRect(),
EPixelFormat  NewReadbackPixelFormat = EPixelFormat::PF_Unknown,
const FIntPoint &  NewReadbackSize = FIntPoint::ZeroValue 
)
protected

Change the information of the texture to read from.

Parameters
NewSourceTextureThe texture to read from
NewSourceRectThe region to read from the source texture. If the region is empty, the whole source texture will be read
NewReadbackPixelFormatThe pixel format of the read back pixels. If the pixel format is Unknown, the read back pixels will have the same format as the source texture
NewReadbackSizeThe 2d size of the read back pixels. If the size is zero, the read back size will be the same as the size of the source texture

The documentation for this struct was generated from the following file: