NNEngine
UTextureProcessComponentBase Class Reference
Inheritance diagram for UTextureProcessComponentBase:
Collaboration diagram for UTextureProcessComponentBase:

Public Attributes

int destinationWidth
 
int destinationHeight
 

Protected Member Functions

virtual void BeginPlay () override
 
void calcAspectRatio (UTexture *inputTexture, FVector2D &uvScalingFactor)
 
UTextureRenderTarget2D * resize (UTexture *inputTexture, FVector2D &uvScalingFactor, const bool doFlipImage=false, const EImageRotation doRotateImage=EImageRotation::None)
 
UTextureRenderTarget2D * renderAffineTransformedFrame (UTexture *inputTexture, const FAffineMat2D &inverseNormalizedAffineMat, const bool doFlipImage, const EImageRotation doRotateImage)
 

Protected Attributes

UMaterialInstanceDynamic * materialAffineWarp_external
 
UMaterialInstanceDynamic * materialAffineWarp_color
 
UTextureRenderTarget2D * renderTargetAffineWarp
 
ETextureRenderTargetFormat renderTargetFormat = ETextureRenderTargetFormat::RTF_RGBA8_SRGB
 

Detailed Description

Base class for the compnents to precess UTexture

Member Function Documentation

◆ calcAspectRatio()

void UTextureProcessComponentBase::calcAspectRatio ( UTexture *  inputTexture,
FVector2D &  uvScalingFactor 
)
protected

Calculate the aspect ratio of the image.

Parameters
inputTextureInput image
uvScalingFactorThe scaling factor of the UV of the image to keep the aspect ratio of the image. X = 1 and Y > 1 for a landscape image. X > 1 and Y = 1 for a portrait image.

◆ renderAffineTransformedFrame()

UTextureRenderTarget2D * UTextureProcessComponentBase::renderAffineTransformedFrame ( UTexture *  inputTexture,
const FAffineMat2D inverseNormalizedAffineMat,
const bool  doFlipImage,
const EImageRotation  doRotateImage 
)
protected

Execute the affine transform, implemented by BP

Parameters
inputTextureOriginal image
inverseNormalizedAffineMatThe matrix of inverse of the affine transform. The scales of original and destination images must be normalized to (1, 1).
doFlipImageWhether to flip the image during resizing.
doRotateImageWhether to rotate the image during resizing.
Returns
The image after affine transform

◆ resize()

UTextureRenderTarget2D * UTextureProcessComponentBase::resize ( UTexture *  inputTexture,
FVector2D &  uvScalingFactor,
const bool  doFlipImage = false,
const EImageRotation  doRotateImage = EImageRotation::None 
)
protected

Resize the image to (destinationHeight x destinationWidth) while maintaining the aspect ratio.

Parameters
inputTextureOriginal image
uvScalingFactorThe scaling factor of the UV of the image to keep the aspect ratio of the image. X = 1 and Y > 1 for a landscape image. X > 1 and Y = 1 for a portrait image.
doFlipImageWhether to flip the image during resizing.
doRotateImageWhether to rotate the image during resizing.

Member Data Documentation

◆ destinationHeight

int UTextureProcessComponentBase::destinationHeight

The height of the image after processing

◆ destinationWidth

int UTextureProcessComponentBase::destinationWidth

The width of the image after processing