]> git.tdb.fi Git - libs/gl.git/commitdiff
Add default texture anisotropy to Resources
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Jun 2018 10:39:00 +0000 (13:39 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Jun 2018 10:39:00 +0000 (13:39 +0300)
source/resources.cpp
source/resources.h

index b8eec774387ea94233c6aa0223095199042ea12e..fe59860d8cbbcd6ec9017bbdc70d162e8eff669e 100644 (file)
@@ -30,6 +30,7 @@ void init_shaderlib(DataFile::BuiltinSource &);
 
 Resources::Resources():
        default_tex_filter(Texture::can_generate_mipmap() ? LINEAR_MIPMAP_LINEAR : LINEAR),
+       default_tex_anisotropy(1.0f),
        srgb_conversion(false),
        resource_manager(0)
 {
@@ -74,6 +75,11 @@ void Resources::set_default_texture_filter(TextureFilter tf)
        default_tex_filter = tf;
 }
 
+void Resources::set_default_texture_anisotropy(float a)
+{
+       default_tex_anisotropy = a;
+}
+
 void Resources::set_srgb_conversion(bool c)
 {
        srgb_conversion = c;
@@ -121,6 +127,7 @@ Texture2D *Resources::create_texture2d(const string &name)
                else
                        tex->set_mag_filter(default_tex_filter);
                tex->set_min_filter(default_tex_filter);
+               tex->set_max_anisotropy(default_tex_anisotropy);
 
                if(resource_manager)
                        resource_manager->set_resource_location(*tex, *this, name);
index c0529b581c464602d6b5726c3e53d245d5cb2e35..238d6c544c373c4fdde4848784600a6246e8a1b1 100644 (file)
@@ -20,6 +20,7 @@ class Resources: virtual public DataFile::Collection
 {
 private:
        TextureFilter default_tex_filter;
+       float default_tex_anisotropy;
        bool srgb_conversion;
        ResourceManager *resource_manager;
 
@@ -29,6 +30,7 @@ public:
        static const DataFile::CollectionSource &get_builtins();
 
        void set_default_texture_filter(TextureFilter);
+       void set_default_texture_anisotropy(float);
 
        /** Enables or disables sRGB conversion.  If enabled, textures and material
        colors are converted from sRGB to linear color space when loaded. */