]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.h
Refactor texture external image loading into a helper function
[libs/gl.git] / source / texture.h
index ad41e573ed5d53b409f82794ae44afec96a1a23e..6ee0b8a107754e83c7bf2d49b4fe6f68f2e11db4 100644 (file)
@@ -39,7 +39,10 @@ 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 filter(TextureFilter);
                void generate_mipmap(bool);
@@ -64,15 +67,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 auto_gen_mipmap;
-       mutable int dirty_params;
        Sampler default_sampler;
 
        static int swizzle_orders[];
@@ -84,19 +88,14 @@ 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;
 
 public:
        Sampler &get_default_sampler() { return default_sampler; }
        const Sampler &get_default_sampler() const { return default_sampler; }
 
-protected:
-       void update_parameter(int) const;
-       void set_parameter_i(GLenum, int) const;
-       void set_parameter_f(GLenum, float) const;
-public:
        DEPRECATED void set_min_filter(TextureFilter);
        DEPRECATED void set_mag_filter(TextureFilter);