X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture.h;h=eb5275c6e4fd71e60b6d0af04d179a229a94a56a;hb=be962824e72a7d5e2946ad4c0e69e01c60da30e8;hp=ff56e85cb233d97ff5b822c5360255b7c9e2a8bc;hpb=a7948dfc4192efbbf2b5ca9258fd7e72b971f8ea;p=libs%2Fgl.git diff --git a/source/core/texture.h b/source/core/texture.h index ff56e85c..eb5275c6 100644 --- a/source/core/texture.h +++ b/source/core/texture.h @@ -49,10 +49,12 @@ protected: void load_external_image(Graphics::Image &, const std::string &); private: + void external_data(const std::string &); void external_image(bool, const std::string &); void generate_mipmap(bool); void image_data(const std::string &); void mipmap_levels(unsigned); + void raw_data(const std::string &); }; public: @@ -68,29 +70,28 @@ public: }; protected: - enum FormatSwizzle - { - NO_SWIZZLE, - R_TO_LUMINANCE, - RG_TO_LUMINANCE_ALPHA, - RGB_TO_BGR - }; - - PixelFormat format; - PixelFormat storage_fmt; - FormatSwizzle swizzle; - bool use_srgb_format; - bool auto_gen_mipmap; + PixelFormat format = NO_PIXELFORMAT; + PixelFormat storage_fmt = NO_PIXELFORMAT; + ComponentSwizzle swizzle = NO_SWIZZLE; + unsigned n_levels = 0; + bool use_srgb_format = false; + bool auto_gen_mipmap = false; Texture(unsigned); void set_format(PixelFormat); + static unsigned count_levels(unsigned); public: PixelFormat get_format() const { return format; } using TextureBackend::generate_mipmap; + /** Replaces contents of an entire mipmap level. Allocated storage must + exist. The image data is interpreted according to the storage format and + must have size matching the selected mipmap level. */ + virtual void image(unsigned level, const void *) = 0; + /** Loads an image into the texture from a file. */ virtual void load_image(const std::string &, unsigned = 0);