#pragma once #include #include "Texture.h" #include "Sampler.h" namespace charcoal { class TextureFactory { private: TextureFactory() {} virtual ~TextureFactory() {} public: template static Texture* gen_texture( Texture::Format data_format, Texture::Type data_type, unsigned long width, unsigned long height, const std::vector& data, Texture::InternalFormat internal_format, unsigned short mipmap_level = 0, Texture::Target texture_target = Texture::Target::TEXTURE_2D ) { m_textures.emplace_back(data_format, data_type, width, height, data, internal_format, mipmap_level, texture_target); return &m_textures.back(); } static Sampler* gen_sampler( Sampler::Wrap wrap_s, Sampler::Wrap wrap_t, Sampler::MagFilter magnification_filter, Sampler::MinFilter minification_filter ) { m_samplers.emplace_back(wrap_s, wrap_t, magnification_filter, minification_filter); return &m_samplers.back(); } private: static std::vector m_textures; static std::vector m_samplers; }; std::vector TextureFactory::m_textures; std::vector TextureFactory::m_samplers; }