#pragma once #include "ResourceManager.h" #include #include #include "../platform.h" #include GLHEADER class TextureResource : public IReloadable { public: static std::shared_ptr get(const std::string& path, bool tile = false); virtual ~TextureResource(); void unload(std::shared_ptr& rm) override; void reload(std::shared_ptr& rm) override; bool isTiled() const; Eigen::Vector2i getSize() const; void bind() const; void initFromMemory(const char* image, size_t length); private: TextureResource(const std::string& path, bool tile); void initFromPath(); void initFromResource(const ResourceData data); void deinit(); Eigen::Vector2i mTextureSize; GLuint mTextureID; const std::string mPath; const bool mTile; typedef std::pair TextureKeyType; static std::map< TextureKeyType, std::weak_ptr > sTextureMap; };