rodecomp/Source/Render/Textures/TextureCache.h
ragnarok-clanker a47d20f8be Reconstruct readable C++ and organize cohesive source subsystems
Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.

Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
2026-10-25 07:42:41 +00:00

47 lines
1.4 KiB
C++

#ifndef RAGNAROK_SOURCE_RENDER_TEXTURES_TEXTURECACHE_H
#define RAGNAROK_SOURCE_RENDER_TEXTURES_TEXTURECACHE_H
#include "Resource/EZeffectResource.h"
#include <map>
class ResourceMgr;
class CRenderSystemBase;
class TextureSources {
public:
virtual const char* Resolve(const char* name) = 0;
virtual bool MovieSize(const char* name, int& width, int& height) = 0;
virtual void CleanupTextures() = 0;
protected:
~TextureSources() = default;
};
struct TextureNameLess {
bool operator()(const char* left, const char* right) const;
};
class TextureCache : public EffectTextures {
public:
TextureCache(ResourceMgr& resources, CRenderSystemBase*& system, TextureSources& sources, const int& reduction, const unsigned& reuseDelay);
~TextureCache();
CTexture* Load(const char* name, int option, bool fullSize, bool dynamic, bool renderTarget) override;
CTexture* Default() override;
CTexture* Create(const char* name, int option, bool fullSize, bool dynamic, bool renderTarget);
CTexture* Upload(int width, int height, const std::uint32_t* pixels, int format, int option, bool fullSize, bool dynamic, bool renderTarget);
void Remove(CTexture* texture);
void Clear();
void ClearUnused();
private:
ResourceMgr& m_resources;
CRenderSystemBase*& m_system;
TextureSources& m_sources;
const int& m_reduction;
const unsigned& m_reuseDelay;
std::map<const char*, CTexture*, TextureNameLess> m_textures;
};
#endif