ENABLE_COMPRESSED_TEXTURES set as default

This commit is contained in:
Enrico Turri 2019-06-24 09:54:58 +02:00
parent 301eda7369
commit 00b9a3ad32
13 changed files with 2 additions and 291 deletions

View file

@ -11,7 +11,6 @@ namespace GUI {
class GLTexture
{
#if ENABLE_COMPRESSED_TEXTURES
class Compressor
{
struct Level
@ -47,7 +46,6 @@ namespace GUI {
private:
void compress();
};
#endif // ENABLE_COMPRESSED_TEXTURES
public:
struct UV
@ -71,21 +69,14 @@ namespace GUI {
int m_width;
int m_height;
std::string m_source;
#if ENABLE_COMPRESSED_TEXTURES
Compressor m_compressor;
#endif // ENABLE_COMPRESSED_TEXTURES
public:
GLTexture();
virtual ~GLTexture();
#if ENABLE_COMPRESSED_TEXTURES
bool load_from_file(const std::string& filename, bool use_mipmaps, bool compress);
bool load_from_svg_file(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px);
#else
bool load_from_file(const std::string& filename, bool use_mipmaps);
bool load_from_svg_file(const std::string& filename, bool use_mipmaps, unsigned int max_size_px);
#endif // ENABLE_COMPRESSED_TEXTURES
// meanings of states: (std::pair<int, bool>)
// first field (int):
// 0 -> no changes
@ -94,11 +85,7 @@ namespace GUI {
// second field (bool):
// false -> no changes
// true -> add background color
#if ENABLE_COMPRESSED_TEXTURES
bool load_from_svg_files_as_sprites_array(const std::vector<std::string>& filenames, const std::vector<std::pair<int, bool>>& states, unsigned int sprite_size_px, bool compress);
#else
bool load_from_svg_files_as_sprites_array(const std::vector<std::string>& filenames, const std::vector<std::pair<int, bool>>& states, unsigned int sprite_size_px);
#endif // ENABLE_COMPRESSED_TEXTURES
void reset();
unsigned int get_id() const { return m_id; }
@ -107,32 +94,21 @@ namespace GUI {
const std::string& get_source() const { return m_source; }
#if ENABLE_COMPRESSED_TEXTURES
bool unsent_compressed_data_available() const { return m_compressor.unsent_compressed_data_available(); }
void send_compressed_data_to_gpu() { m_compressor.send_compressed_data_to_gpu(); }
bool all_compressed_data_sent_to_gpu() const { return m_compressor.all_compressed_data_sent_to_gpu(); }
#endif // ENABLE_COMPRESSED_TEXTURES
static void render_texture(unsigned int tex_id, float left, float right, float bottom, float top);
static void render_sub_texture(unsigned int tex_id, float left, float right, float bottom, float top, const Quad_UVs& uvs);
protected:
#if ENABLE_COMPRESSED_TEXTURES
unsigned int generate_mipmaps(wxImage& image, bool compress);
#else
unsigned int generate_mipmaps(wxImage& image);
#endif // ENABLE_COMPRESSED_TEXTURES
private:
#if ENABLE_COMPRESSED_TEXTURES
bool load_from_png(const std::string& filename, bool use_mipmaps, bool compress);
bool load_from_svg(const std::string& filename, bool use_mipmaps, bool compress, bool apply_anisotropy, unsigned int max_size_px);
friend class Compressor;
#else
bool load_from_png(const std::string& filename, bool use_mipmaps);
bool load_from_svg(const std::string& filename, bool use_mipmaps, unsigned int max_size_px);
#endif // ENABLE_COMPRESSED_TEXTURES
};
} // namespace GUI