UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TextureSourceDataUtils.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
#pragma once
4
5
#if WITH_EDITOR
6
#include "
CoreTypes.h
"
7
#include "
Engine/TextureDefines.h
"
8
9
class
UTexture
;
10
class
ITargetPlatform
;
11
12
// Not tested against all the texture types and the api might change or be removed without deprecation
13
namespace
UE::TextureUtilitiesCommon::Experimental
14
{
15
// resize texture source to be <= TargetSourceSize x TargetSourceSize
16
// Halving (mip) steps are done
17
// (only Texture2D and TextureCube are supported at the moment)
18
// Note it does not trigger the post edit change after modifying the source texture
19
TEXTUREUTILITIESCOMMON_API
bool
DownsizeTextureSourceData
(
UTexture
*
Texture
,
int32
TargetSourceSize
,
const
ITargetPlatform
* TargetPlatform);
20
21
// Try to resize the texture source data to a power of two
22
// Note it does not trigger the post edit change after modifying the source texture
23
TEXTUREUTILITIESCOMMON_API
bool
ResizeTextureSourceDataToNearestPowerOfTwo
(
UTexture
*
Texture
);
24
25
// Try to resize the texture source data so that it is not larger than what is built for the specified platform
26
// eg. if the output build size is 1024 but the source size is 2048, the source will be reduced to 1024
27
// Texture->LODBias is changed so that the output built size stays the same
28
// (only Texture2D and TextureCube are supported at the moment)
29
// AdditionalSourceSizeLimit can be used to apply an extra size limit on the source
30
//Note: This function DOES trigger the post edit change after modifying the source texture
31
TEXTUREUTILITIESCOMMON_API
bool
DownsizeTextureSourceDataNearRenderingSize
(
UTexture
*
Texture
,
const
ITargetPlatform
* TargetPlatform,
int32
AdditionalSourceSizeLimit
= 16384);
32
33
// ChangeTextureSourceFormat calls Pre/Post edit change
34
// beware that changing format may change the interpretation of the SRGB bool in Texture
35
// ChangeTextureSourceFormat supports mips and blocks (udim) but not layers
36
TEXTUREUTILITIESCOMMON_API
bool
ChangeTextureSourceFormat
(
UTexture
*
Texture
,
ETextureSourceFormat
NewFormat
);
37
38
// Replace TextureSource with JPEG compressed data
39
// returns true if change was made
40
// calls Pre/PostEditChange :
41
// Quality == 0 for default (85)
42
TEXTUREUTILITIESCOMMON_API
bool
CompressTextureSourceWithJPEG
(
UTexture
*
Texture
,
int32
Quality = 0);
43
}
44
45
#endif
// WITH_EDITOR
CoreTypes.h
int32
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition
Platform.h:1125
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
EDatasmithElementType::Texture
@ Texture
TextureDefines.h
ETextureSourceFormat
ETextureSourceFormat
Definition
TextureDefines.h:351
UTexture
Definition
Texture.h:1219
Engine
Source
Runtime
TextureUtilitiesCommon
Public
TextureSourceDataUtils.h
Generated by
1.9.8