Files
julien stjean a2d30a17ac Adding an utility to resize the source data of some textures (Those that don't use layers or slices (except for the cube map)). Only tested and supported with the Texture2D and TextureCube at the moment.
Added a function to the textures to let something external use their texture mip generation to downsize a 2DImage closer to a desired target resolution.

Added an utility that try to reduce the resolution of the source data of texture closer what is needed for it's rendering/in-game resolution.

#preflight 64028efba726961ed9f43c7b
#rnx

[CL 24516727 by julien stjean in ue5-main branch]
2023-03-04 17:18:06 -05:00

22 lines
950 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#if WITH_EDITOR
#include "CoreTypes.h"
class UTexture;
class ITargetPlatform;
// Not tested against all the texture types and the api might change or be removed without deprecation
namespace UE::TextureUtilitiesCommon::Experimental
{
// Try to resize the texture source data so that it is not larger than one build for the specified platform (only Texture2D and TextureCube are supported at the moment)
// Note it does not trigger the post edit change after modifying the source texture
TEXTUREUTILITIESCOMMON_API bool DownsizeTextureSourceData(UTexture* Texture, int32 TargetSizeInGame, const ITargetPlatform* TargetPlatform);
//Note: This function does trigger the post edit change after modifying the source texture
TEXTUREUTILITIESCOMMON_API bool DownsizeTexureSourceDataNearRenderingSize(UTexture* Texture, const ITargetPlatform* TargetPlatform);
}
#endif // WITH_EDITOR