18#ifndef INCLUDED_TEXTUREMANAGER
19#define INCLUDED_TEXTUREMANAGER
102 std::unique_ptr<Renderer::Backend::ITexture> backendTexture);
353 std::unique_ptr<Renderer::Backend::ITexture> texture,
358 std::unique_ptr<Renderer::Backend::ITexture> backendTexture,
Definition: TextureManager.cpp:131
Definition: TextureManager.cpp:376
Texture manager with asynchronous loading and automatic DDS conversion/compression.
Definition: TextureManager.h:79
const CTexturePtr & GetErrorTexture()
Returns a magenta texture.
Definition: TextureManager.cpp:1079
const CTexturePtr & GetWhiteTexture()
Returns a single color RGBA texture with CColor(1.0f, 1.0f, 1.0f, 1.0f).
Definition: TextureManager.cpp:1084
CTextureManagerImpl * m
Definition: TextureManager.h:174
const CTexturePtr & GetTransparentTexture()
Returns a single color RGBA texture with CColor(0.0f, 0.0f, 0.0f, 0.0f).
Definition: TextureManager.cpp:1089
NONCOPYABLE(CTextureManager)
bool GenerateCachedTexture(const VfsPath &path, VfsPath &outputPath)
Synchronously converts and compresses and saves the texture, and returns the output path (minus a "ca...
Definition: TextureManager.cpp:1115
CTexturePtr CreateTexture(const CTextureProperties &props)
Create a texture with the given properties.
Definition: TextureManager.cpp:1063
CTexturePtr WrapBackendTexture(std::unique_ptr< Renderer::Backend::ITexture > backendTexture)
Wraps a backend texture.
Definition: TextureManager.cpp:1068
bool TextureExists(const VfsPath &path) const
Returns true if the given texture exists.
Definition: TextureManager.cpp:1074
void OnQualityChanged()
Should be called on any quality or anisotropic change.
Definition: TextureManager.cpp:1130
CTextureManager(PIVFS vfs, bool highQuality, Renderer::Backend::IDevice *device)
Construct texture manager.
Definition: TextureManager.cpp:1053
bool MakeProgress()
Work on asynchronous texture loading operations, if any.
Definition: TextureManager.cpp:1104
const CTexturePtr & GetBlackTextureCube()
Returns a single color RGBA texture cube with CColor(0.0f, 0.0f, 0.0f, 1.0f).
Definition: TextureManager.cpp:1099
size_t GetBytesUploaded() const
Returns total number of bytes uploaded for all current texture.
Definition: TextureManager.cpp:1125
bool MakeUploadProgress(Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
Work on asynchronous texture uploading operations, if any.
Definition: TextureManager.cpp:1109
~CTextureManager()
Definition: TextureManager.cpp:1058
const CTexturePtr & GetAlphaGradientTexture()
Returns a white RGBA texture with alpha gradient.
Definition: TextureManager.cpp:1094
VfsPath GetCachedPath(const VfsPath &path) const
Definition: TextureManager.cpp:1120
Represents the filename and GL parameters of a texture, for passing to CTextureManager::CreateTexture...
Definition: TextureManager.h:182
friend struct TextureCacheCmp
Definition: TextureManager.h:184
Renderer::Backend::Format m_FormatOverride
Definition: TextureManager.h:258
bool m_AnisotropicFilterEnabled
Definition: TextureManager.h:257
VfsPath m_Path
Definition: TextureManager.h:251
CTextureProperties(const VfsPath &path)
Use the given texture name, and default GL parameters.
Definition: TextureManager.h:192
CTextureProperties(const VfsPath &path, const Renderer::Backend::Format formatOverride)
Definition: TextureManager.h:197
void SetSRGB(const bool sRGB)
Definition: TextureManager.h:247
Renderer::Backend::Sampler::AddressMode m_AddressModeU
Definition: TextureManager.h:253
void SetIgnoreQuality(bool ignore)
Definition: TextureManager.h:245
void SetAddressMode(const Renderer::Backend::Sampler::AddressMode addressMode)
Set sampler address mode.
Definition: TextureManager.h:206
bool m_SRGB
Definition: TextureManager.h:261
Renderer::Backend::Sampler::AddressMode m_AddressModeV
Definition: TextureManager.h:255
bool m_IgnoreQuality
Definition: TextureManager.h:260
void SetAnisotropicFilter(const bool enabled)
The value of max anisotropy is set by options.
Definition: TextureManager.h:226
void SetAddressMode(const Renderer::Backend::Sampler::AddressMode addressModeU, const Renderer::Backend::Sampler::AddressMode addressModeV)
Set sampler address mode separately for different coordinates.
Definition: TextureManager.h:214
Represents a texture object.
Definition: TextureManager.h:271
friend struct TextureCacheCmp
Definition: TextureManager.h:347
Renderer::Backend::ITexture * m_FallbackBackendTexture
Definition: TextureManager.h:365
bool IsUploaded() const
Returns whether the texture data is currently uploaded.
Definition: TextureManager.h:334
std::uint32_t GetBaseColor() const
Returns the ARGB value of the lowest mipmap level (i.e.
Definition: TextureManager.cpp:1041
size_t GetHeight() const
Returns the height (in pixels) of the current texture.
Definition: TextureManager.cpp:1025
Renderer::Backend::ITexture * GetBackendTexture()
Returns a backend texture if successfully uploaded, else fallback.
Definition: TextureManager.cpp:973
CTexture(std::unique_ptr< Renderer::Backend::ITexture > texture, Renderer::Backend::ITexture *fallback, const CTextureProperties &props, CTextureManagerImpl *textureManager)
Definition: TextureManager.cpp:930
CTextureManagerImpl * m_TextureManager
Definition: TextureManager.h:383
bool HasAlpha() const
Returns whether the current texture has an alpha channel.
Definition: TextureManager.cpp:1030
const CTextureProperties m_Properties
Definition: TextureManager.h:361
uint32_t m_BaseLevelOffset
Definition: TextureManager.h:369
void ResetBackendTexture(std::unique_ptr< Renderer::Backend::ITexture > backendTexture, Renderer::Backend::ITexture *fallbackBackendTexture)
Definition: TextureManager.cpp:1012
std::unique_ptr< Tex > m_TextureData
Definition: TextureManager.h:367
void UploadBackendTextureIfNeeded(Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
Uploads a texture data to a backend texture if successfully loaded.
Definition: TextureManager.cpp:942
std::unique_ptr< Renderer::Backend::ITexture > m_BackendTexture
Definition: TextureManager.h:363
size_t GetWidth() const
Returns the width (in pixels) of the current texture.
Definition: TextureManager.cpp:1020
size_t GetUploadedSize() const
Returns total number of bytes uploaded for this texture.
Definition: TextureManager.cpp:1046
bool TryLoad()
Attempt to load the texture data quickly, as with GetUploadedBackendTextureIfNeeded().
Definition: TextureManager.cpp:983
std::weak_ptr< CTexture > m_Self
Definition: TextureManager.h:387
enum CTexture::@12 m_State
std::uint32_t m_BaseColor
Definition: TextureManager.h:366
bool IsLoaded() const
Returns whether the texture data is currently loaded.
Definition: TextureManager.h:329
@ HIGH_NEEDS_CONVERTING
Definition: TextureManager.h:377
@ UNLOADED
Definition: TextureManager.h:373
@ PREFETCH_IS_CONVERTING
Definition: TextureManager.h:376
@ PREFETCH_NEEDS_LOADING
Definition: TextureManager.h:374
@ PREFETCH_NEEDS_CONVERTING
Definition: TextureManager.h:375
@ HIGH_IS_CONVERTING
Definition: TextureManager.h:378
@ LOADED
Definition: TextureManager.h:379
@ UPLOADED
Definition: TextureManager.h:380
size_t m_UploadedSize
Definition: TextureManager.h:368
void Prefetch()
Activate the prefetching optimisation for this texture.
Definition: TextureManager.cpp:1001
Definition: IDeviceCommandContext.h:46
Definition: ITexture.h:33
Stores all data describing an image.
Definition: tex.h:214
std::shared_ptr< CTexture > CTexturePtr
Definition: Texture.h:25
AddressMode
Definition: Sampler.h:39
Definition: Canvas2D.h:30
Format
Definition: Format.h:28
Definition: vfs_util.cpp:42
Definition: TextureManager.cpp:356
Definition: TextureManager.cpp:332
std::shared_ptr< IVFS > PIVFS
Definition: vfs.h:240