From: Mikko Rasa Date: Wed, 20 Jun 2018 10:39:00 +0000 (+0300) Subject: Add default texture anisotropy to Resources X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=207da74ff155973509f13d714bda28f9d8fc3f42;p=libs%2Fgl.git Add default texture anisotropy to Resources --- diff --git a/source/resources.cpp b/source/resources.cpp index b8eec774..fe59860d 100644 --- a/source/resources.cpp +++ b/source/resources.cpp @@ -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); diff --git a/source/resources.h b/source/resources.h index c0529b58..238d6c54 100644 --- a/source/resources.h +++ b/source/resources.h @@ -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. */