X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftexture.h;h=c4e72031ebb174e372877dfd14972449e80d9178;hp=adcfa76b7245276078af013622f343dca8ac65f0;hb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;hpb=73eec11d44a24bac121f1b0d85f20d58005f3545 diff --git a/source/texture.h b/source/texture.h index adcfa76b..c4e72031 100644 --- a/source/texture.h +++ b/source/texture.h @@ -30,7 +30,6 @@ protected: { protected: unsigned levels; - bool srgb; public: Loader(Texture &); @@ -39,8 +38,13 @@ protected: void init(); unsigned get_levels() const; + protected: + void load_external_image(Graphics::Image &, const std::string &); + private: void external_image(const std::string &); + void external_image_srgb(const std::string &); + void external_image_common(const std::string &); void filter(TextureFilter); void generate_mipmap(bool); void image_data(const std::string &); @@ -64,13 +68,16 @@ protected: { NO_SWIZZLE, R_TO_LUMINANCE, - RG_TO_LUMINANCE_ALPHA + RG_TO_LUMINANCE_ALPHA, + RGB_TO_BGR }; unsigned id; GLenum target; - PixelFormat ifmt; + PixelFormat format; + PixelFormat storage_fmt; FormatSwizzle swizzle; + bool use_srgb_format; bool auto_gen_mipmap; Sampler default_sampler; @@ -83,9 +90,7 @@ public: ~Texture(); protected: - static DataType get_alloc_type(PixelFormat); - void set_internal_format(PixelFormat); - PixelFormat get_upload_format(PixelFormat) const; + void set_format(PixelFormat); void apply_swizzle(); void set_parameter_i(GLenum, int) const; @@ -132,19 +137,16 @@ public: DEPRECATED void set_compare_func(Predicate); /// Loads a Graphics::Image from a file and uploads it to the texture. - virtual void load_image(const std::string &, bool srgb = false); + virtual void load_image(const std::string &, unsigned = 0); - virtual void load_image(const std::string &, unsigned, bool srgb = false); + DEPRECATED void load_image(const std::string &, bool srgb); /** Uploads an image to the texture. If storage has not been defined, it will be set to match the image. Otherwise the image must be compatible - with the defined storage. Semantics depend on the type of texture. - - If srgb is true and storage is determined by this call, then an sRGB pixel - format will be used. */ - virtual void image(const Graphics::Image &, bool srgb = false); + with the defined storage. Semantics depend on the type of texture. */ + virtual void image(const Graphics::Image &, unsigned = 0) = 0; - virtual void image(const Graphics::Image &, unsigned, bool srgb = false) = 0; + DEPRECATED void image(const Graphics::Image &, bool srgb); GLenum get_target() const { return target; } unsigned get_id() const { return id; }