Open 3D Engine Atom Gem API Reference 24.09.2
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
ImageProcessingAtom::TextureSettings Class Reference

#include <TextureSettings.h>

Public Member Functions

 AZ_TYPE_INFO (TextureSettings, "{980132FF-C450-425D-8AE0-BD96A8486177}")
 
 AZ_CLASS_ALLOCATOR (TextureSettings, AZ::SystemAllocator)
 
float ComputeMIPAlphaOffset (AZ::u32 mip) const
 
void ApplyPreset (PresetName presetName)
 
bool Equals (const TextureSettings &other, AZ::SerializeContext *serializeContext=nullptr)
 
StringOutcome ApplySettings (const TextureSettings &settings, const PlatformName &overridePlatform=PlatformName(), AZ::SerializeContext *serializeContext=nullptr)
 

Static Public Member Functions

static StringOutcome GetPlatformSpecificTextureSetting (const PlatformName &platformName, const TextureSettings &baseTextureSettings, TextureSettings &textureSettingsOut, AZ::SerializeContext *serializeContext=nullptr)
 
static void Reflect (AZ::ReflectContext *context)
 
static StringOutcome LoadTextureSetting (const AZStd::string &filepath, TextureSettings &textureSettingPtrOut, AZ::SerializeContext *serializeContext=nullptr)
 
static StringOutcome WriteTextureSetting (const AZStd::string &filepath, TextureSettings &textureSetting, AZ::SerializeContext *serializeContext=nullptr)
 
static MultiplatformTextureSettings GenerateDefaultMultiplatformTextureSettings (const AZStd::string &imageFilepath)
 
static const MultiplatformTextureSettings GetMultiplatformTextureSetting (const AZStd::string &filepath, bool &canOverridePreset, AZ::SerializeContext *serializeContext=nullptr)
 
static const MultiplatformTextureSettings GetMultiplatformTextureSetting (const TextureSettings &textureSettings, AZ::SerializeContext *serializeContext=nullptr)
 

Public Attributes

AZ::Uuid m_presetId
 
PresetName m_preset
 
unsigned int m_sizeReduceLevel
 
bool m_suppressEngineReduce
 
bool m_enableMipmap
 
bool m_maintainAlphaCoverage
 
AZStd::vector< AZ::u32 > m_mipAlphaAdjust
 
MipGenEvalType m_mipGenEval
 
MipGenType m_mipGenType
 
AZStd::set< AZStd::string > m_tags
 

Static Public Attributes

static const char * ExtensionName
 
static const size_t s_MaxMipMaps = 6
 

Detailed Description

TextureSettings is the configuration for processing one image. It contains a reference of preset and other parameters. Some parameters are come from preset but overwrite them. The texture settings may be different for each platform, so the different is saved as data patch per platform. When automatically generate a new texture settings for an image file, use BuilderSettingManager::GetSuggestedPreset function to find the best preset may fit this image, then use ApplyPreset to propagate values from preset settings to texture settings. TextureSettings is intended to be editable for user to modify its value through texture editor tool.

Member Function Documentation

◆ ApplyPreset()

void ImageProcessingAtom::TextureSettings::ApplyPreset ( PresetName presetName)

Apply value of some preset settings to this texture settings

◆ ApplySettings()

StringOutcome ImageProcessingAtom::TextureSettings::ApplySettings ( const TextureSettings & settings,
const PlatformName & overridePlatform = PlatformName(),
AZ::SerializeContext * serializeContext = nullptr )

Applies texture settings to the instance (including overrides). Common settings are applied, unless specific platform is specified.

Parameters
Referenceto the settings which will be applied.
Optional.Applies settings as a platform override if a platform is specified.
Optional.Serialize context. Will use global context if none is provided.
Returns
Status outcome result.

◆ ComputeMIPAlphaOffset()

float ImageProcessingAtom::TextureSettings::ComputeMIPAlphaOffset ( AZ::u32 mip) const

Returns an alpha offset value for certain mip. The alpha offset is interpolated from m_mipAlphaAdjust[] and used for TransferAlphaCoverage only. Check the comment of m_maintainAlphaCoverage for more detail on how it may work.

◆ Equals()

bool ImageProcessingAtom::TextureSettings::Equals ( const TextureSettings & other,
AZ::SerializeContext * serializeContext = nullptr )

Performs a comprehensive comparison between two TextureSettings instances.

Parameters
Referenceto the settings which will be compared.
Optional.Serialize context. Will use global context if none is provided.
Returns
True, is both instances are equivalent.

◆ GetMultiplatformTextureSetting() [1/2]

static const MultiplatformTextureSettings ImageProcessingAtom::TextureSettings::GetMultiplatformTextureSetting ( const AZStd::string & filepath,
bool & canOverridePreset,
AZ::SerializeContext * serializeContext = nullptr )
static

Generates a TextureSetting instance of a particular image file for each supported platform.

Parameters
filepath- A path to the texture file.
canOverridePreset- Returns whether the preset can be overriden. Will return false if the preset was selecting from a settings file created by the user.
serializeContext- Optional. Serialize context used for reflection/serialization
Returns
- The collection of TextureSetting instances. If error occurs, a default MultiplatformTextureSettings is returned (see GenerateDefaultMultiplatformTextureSettings()).

◆ GetMultiplatformTextureSetting() [2/2]

static const MultiplatformTextureSettings ImageProcessingAtom::TextureSettings::GetMultiplatformTextureSetting ( const TextureSettings & textureSettings,
AZ::SerializeContext * serializeContext = nullptr )
static

Generates a TextureSetting instance of a particular image file for each supported platform.

Parameters
textureSettings- A reference to an already-loaded texture settings.
serializeContext- Optional. Serialize context used for reflection/serialization
Returns
- The collection of TextureSetting instances. If error occurs, a default MultiplatformTextureSettings is returned (see GenerateDefaultMultiplatformTextureSettings()).

◆ GetPlatformSpecificTextureSetting()

static StringOutcome ImageProcessingAtom::TextureSettings::GetPlatformSpecificTextureSetting ( const PlatformName & platformName,
const TextureSettings & baseTextureSettings,
TextureSettings & textureSettingsOut,
AZ::SerializeContext * serializeContext = nullptr )
static

Gets platform-specific texture settings obtained from the base settings version of a pre-loaded TextureSettings instance.

Parameters
Nameof platform to get the settings from.
BaseTextureSettings which we will get overrides from.
OutputTextureSettings which will contain the result of the function.
Optional.Serialize context. Will use global context if none is provided.
Returns
Status outcome result.

◆ LoadTextureSetting()

static StringOutcome ImageProcessingAtom::TextureSettings::LoadTextureSetting ( const AZStd::string & filepath,
TextureSettings & textureSettingPtrOut,
AZ::SerializeContext * serializeContext = nullptr )
static

Loads base texture settings obtained from ".assetinfo" file

Parameters
FilePathabsolute/relative path of the ".assetinfo" file.
OutputTextureSettings which contain the result of the function, it may contains platform-specific overrides.
Optional.Serialize context. Will use global context if none is provided.
Returns
Status outcome result.

◆ WriteTextureSetting()

static StringOutcome ImageProcessingAtom::TextureSettings::WriteTextureSetting ( const AZStd::string & filepath,
TextureSettings & textureSetting,
AZ::SerializeContext * serializeContext = nullptr )
static

Writes base texture settings to a ".assetinfo" file (modern setting)

Parameters
FilePathabsolute/relative path of the ".assetinfo" file.
TextureSettingto be written on the disk, it may contains platform-specific overrides.
Optional.Serialize context. Will use global context if none is provided.
Returns
Status outcome result.

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