Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/AssetUtils/Texture2DUtil.h
michael balzer a49c74b915 MeshModelingToolset: Move ModelingOperators and ModelingOperatorsEditorOnly modules out of experimental plugin
#jira UETOOL-3823
#rb lonnie.li
#preflight 617b1aea5794a500014f544a

#ROBOMERGE-AUTHOR: michael.balzer
#ROBOMERGE-SOURCE: CL 17972239 in //UE5/Release-5.0/... via CL 17972248
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v885-17909292)
#ROBOMERGE[STARSHIP]: UE5-Main

[CL 17972256 by michael balzer in ue5-release-engine-test branch]
2021-10-28 19:47:45 -04:00

81 lines
2.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "VectorTypes.h"
#include "Image/ImageDimensions.h"
#include "Image/ImageBuilder.h"
#include "Engine/Texture2D.h"
#include "Math/Color.h"
namespace UE
{
namespace AssetUtils
{
using namespace UE::Geometry;
/**
* Extract the Dimensions and image pixels from an input TextureMap
* By default, the "Source" texture data is read. This is only available in-Editor. At runtime, only "Platform" data is available.
* @param TextureMap the texture map to read
* @param DestImageOut the result of the texture read
* @param bPreferPlatformData if true, platform data will be returned even in-Editor.
* @return true on success
*/
MODELINGCOMPONENTS_API bool ReadTexture(
UTexture2D* TextureMap,
TImageBuilder<FVector4f>& DestImageOut,
const bool bPreferPlatformData = false);
/**
* Convert input UTexture2D to single-channel. Assumption is it has more than one channel. Red channel is used.
* @return true on success
*/
MODELINGCOMPONENTS_API bool ConvertToSingleChannel(UTexture2D* TextureMap);
/**
* Issue requests to the render thread to force virtual textures to load for the given screen dimensions.
* @param bWaitForPrefetchToComplete if true, FlushRenderingCommands() is called to wait for the textures to finish loading
* @return true on success
*/
MODELINGCOMPONENTS_API bool ForceVirtualTexturePrefetch(FImageDimensions ScreenSpaceDimensions, bool bWaitForPrefetchToComplete = true);
/**
* Save image stored in Pixels, of given Dimensions to <Project>/Intermediate/DebugSubFolder/FilenameBase_<FileCounter>.bmp
* If UseFileCounter is not specified, an internal static counter that is incremented each call is used.
*/
MODELINGCOMPONENTS_API bool SaveDebugImage(
const TArray<FColor>& Pixels,
FImageDimensions Dimensions,
FString DebugSubfolder,
FString FilenameBase,
int32 UseFileCounter = -1);
/**
* Save image stored in Pixels, of given Dimensions to <Project>/Intermediate/DebugSubFolder/FilenameBase_<FileCounter>.bmp
* If UseFileCounter is not specified, an internal static counter that is incremented each call is used.
*/
MODELINGCOMPONENTS_API bool SaveDebugImage(
const TArray<FLinearColor>& Pixels,
FImageDimensions Dimensions,
bool bConvertToSRGB,
FString DebugSubfolder,
FString FilenameBase,
int32 UseFileCounter = -1);
/**
* Save Image to <Project>/Intermediate/DebugSubFolder/FilenameBase_<FileCounter>.bmp
* If UseFileCounter is not specified, an internal static counter that is incremented each call is used.
*/
MODELINGCOMPONENTS_API bool SaveDebugImage(
const FImageAdapter& Image,
bool bConvertToSRGB,
FString DebugSubfolder,
FString FilenameBase,
int32 UseFileCounter = -1);
}
}