18 #ifndef INCLUDED_TEXTUREMANAGER 19 #define INCLUDED_TEXTUREMANAGER 96 std::unique_ptr<Renderer::Backend::ITexture> backendTexture);
173 friend struct TextureCacheCmp;
188 : m_Path(path), m_FormatOverride(formatOverride)
197 m_AddressModeU = m_AddressModeV = addressMode;
207 m_AddressModeU = addressModeU;
208 m_AddressModeV = addressModeV;
244 bool m_AnisotropicFilterEnabled =
false;
247 bool m_IgnoreQuality =
false;
265 size_t GetWidth()
const;
270 size_t GetHeight()
const;
275 bool HasAlpha()
const;
282 u32 GetBaseColor()
const;
287 size_t GetUploadedSize()
const;
296 void UploadBackendTextureIfNeeded(
315 bool IsLoaded()
const {
return m_State == LOADED; }
333 friend struct TextureCacheCmp;
339 std::unique_ptr<Renderer::Backend::ITexture> texture,
343 void ResetBackendTexture(
344 std::unique_ptr<Renderer::Backend::ITexture> backendTexture,
354 size_t m_UploadedSize = 0;
376 #endif // INCLUDED_TEXTUREMANAGER std::unique_ptr< Tex > m_TextureData
Definition: TextureManager.h:353
const CTexturePtr & GetAlphaGradientTexture()
Returns a white RGBA texture with alpha gradient.
Definition: TextureManager.cpp:1074
const CTexturePtr & GetErrorTexture()
Returns a magenta texture.
Definition: TextureManager.cpp:1059
Definition: TextureManager.h:364
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:1095
Definition: TextureManager.h:359
void SetAnisotropicFilter(const bool enabled)
The value of max anisotropy is set by options.
Definition: TextureManager.h:215
CTexturePtr CreateTexture(const CTextureProperties &props)
Create a texture with the given properties.
Definition: TextureManager.cpp:1043
CTexturePtr WrapBackendTexture(std::unique_ptr< Renderer::Backend::ITexture > backendTexture)
Wraps a backend texture.
Definition: TextureManager.cpp:1048
Definition: TextureManager.cpp:351
Definition: ITexture.h:33
bool TextureExists(const VfsPath &path) const
Returns true if the given texture exists.
Definition: TextureManager.cpp:1054
Represents the filename and GL parameters of a texture, for passing to CTextureManager::CreateTexture...
Definition: TextureManager.h:170
const CTextureProperties m_Properties
Definition: TextureManager.h:347
NONCOPYABLE(CTextureManager)
std::weak_ptr< CTexture > m_Self
Definition: TextureManager.h:373
std::unique_ptr< Renderer::Backend::ITexture > m_BackendTexture
Definition: TextureManager.h:349
Definition: TextureManager.cpp:309
bool IsLoaded() const
Returns whether the texture data is currently loaded.
Definition: TextureManager.h:315
CTextureManagerImpl * m_TextureManager
Definition: TextureManager.h:369
std::shared_ptr< IVFS > PIVFS
Definition: vfs.h:220
Definition: TextureManager.cpp:332
void OnQualityChanged()
Should be called on any quality or anisotropic change.
Definition: TextureManager.cpp:1105
~CTextureManager()
Definition: TextureManager.cpp:1038
Definition: TextureManager.h:365
Texture manager with asynchronous loading and automatic DDS conversion/compression.
Definition: TextureManager.h:72
Format
Definition: Format.h:27
VfsPath m_Path
Definition: TextureManager.h:238
bool MakeProgress()
Work on asynchronous texture loading operations, if any.
Definition: TextureManager.cpp:1084
uint32_t u32
Definition: types.h:39
const CTexturePtr & GetBlackTextureCube()
Returns a single color RGBA texture cube with CColor(0.0f, 0.0f, 0.0f, 1.0f).
Definition: TextureManager.cpp:1079
Definition: TextureManager.cpp:108
void SetIgnoreQuality(bool ignore)
Definition: TextureManager.h:234
AddressMode
Definition: Sampler.h:41
u32 m_BaseColor
Definition: TextureManager.h:352
size_t GetBytesUploaded() const
Returns total number of bytes uploaded for all current texture.
Definition: TextureManager.cpp:1100
Represents a texture object.
Definition: TextureManager.h:256
CTextureProperties(const VfsPath &path)
Use the given texture name, and default GL parameters.
Definition: TextureManager.h:181
Definition: TextureManager.h:363
CTextureManagerImpl * m
Definition: TextureManager.h:163
Definition: TextureManager.h:361
Definition: TextureManager.h:360
const CTexturePtr & GetWhiteTexture()
Returns a single color RGBA texture with CColor(1.0f, 1.0f, 1.0f, 1.0f).
Definition: TextureManager.cpp:1064
Definition: TextureManager.h:362
unsigned int uint32_t
Definition: wposix_types.h:53
Definition: vfs_util.cpp:39
bool IsUploaded() const
Returns whether the texture data is currently uploaded.
Definition: TextureManager.h:320
Definition: IDeviceCommandContext.h:40
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:203
std::shared_ptr< CTexture > CTexturePtr
Definition: Texture.h:22
bool MakeUploadProgress(Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
Work on asynchronous texture uploading operations, if any.
Definition: TextureManager.cpp:1089
CTextureManager(PIVFS vfs, bool highQuality, Renderer::Backend::IDevice *device)
Construct texture manager.
Definition: TextureManager.cpp:1033
void SetAddressMode(const Renderer::Backend::Sampler::AddressMode addressMode)
Set sampler address mode.
Definition: TextureManager.h:195
CTextureProperties(const VfsPath &path, const Renderer::Backend::Format formatOverride)
Definition: TextureManager.h:186
const CTexturePtr & GetTransparentTexture()
Returns a single color RGBA texture with CColor(0.0f, 0.0f, 0.0f, 0.0f).
Definition: TextureManager.cpp:1069