]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove default sampler from Texture
authorMikko Rasa <tdb@tdb.fi>
Thu, 12 Aug 2021 09:35:16 +0000 (12:35 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 12 Aug 2021 19:32:18 +0000 (22:32 +0300)
It was a bad idea and would not translate well to Vulkan.

12 files changed:
blender/io_mspgl/export_material.py
blender/io_mspgl/material.py
blender/io_mspgl/properties.py
source/core/sampler.cpp
source/core/sampler.h
source/core/texture.cpp
source/core/texture.h
source/core/texture2d.cpp
source/render/rendertarget.cpp
source/render/rendertarget.h
source/resources/resources.cpp
source/resources/resources.h

index 2d85b10f3c7c4b26aa9e45803b0ca2af7d9134eb..8a87011a25d93d1c54bb376c05ba02473488ab3e 100644 (file)
@@ -90,11 +90,10 @@ class MaterialExporter:
                        if st:
                                mat_res.statements.append(st)
                textures = [p.texture for p in material.properties if p.texture]
                        if st:
                                mat_res.statements.append(st)
                textures = [p.texture for p in material.properties if p.texture]
-               if textures and not all(t.default_filter for t in textures):
+               if textures:
                        from .export_texture import SamplerExporter
                        from .export_texture import SamplerExporter
-                       sampler_tex = next(t for t in textures if not t.default_filter)
                        sampler_export = SamplerExporter()
                        sampler_export = SamplerExporter()
-                       mat_res.statements.append(mat_res.create_reference_statement("sampler", resources[sampler_export.get_sampler_name(sampler_tex)]))
+                       mat_res.statements.append(mat_res.create_reference_statement("sampler", resources[sampler_export.get_sampler_name(textures[0])]))
 
                return mat_res
 
 
                return mat_res
 
@@ -103,11 +102,7 @@ class MaterialExporter:
                if prop.texture:
                        tex_res = resources[prop.texture.image.name+".tex2d"]
                        from .util import basename
                if prop.texture:
                        tex_res = resources[prop.texture.image.name+".tex2d"]
                        from .util import basename
-                       fn = basename(prop.texture.image.filepath)
-                       if prop.texture.default_filter and fn:
-                               return Statement(prop.tex_keyword, fn)
-                       else:
-                               return mat_res.create_reference_statement(prop.tex_keyword, tex_res)
+                       return mat_res.create_reference_statement(prop.tex_keyword, tex_res)
                elif not prop.keyword:
                        return
                elif type(prop.value)==tuple:
                elif not prop.keyword:
                        return
                elif type(prop.value)==tuple:
index 7299e636ea7a6e2682dd52dd4051e64df72b505b..1d6a06a0b0730974365d21e65a3f19760b566bea 100644 (file)
@@ -140,7 +140,7 @@ class Material:
                sampler_settings = None
                for p in self.properties:
                        if p.texture:
                sampler_settings = None
                for p in self.properties:
                        if p.texture:
-                               settings = (p.texture.default_filter, p.texture.interpolation, p.texture.use_mipmap, p.texture.max_anisotropy)
+                               settings = (p.texture.interpolation, p.texture.use_mipmap, p.texture.max_anisotropy)
                                if sampler_settings is None:
                                        sampler_settings = settings
                                elif settings!=sampler_settings:
                                if sampler_settings is None:
                                        sampler_settings = settings
                                elif settings!=sampler_settings:
index 236e79f30118fa80b377f5580caac99adb3f2e69..744630f70ca8dd505073beb2ed86e735ba808cf9 100644 (file)
@@ -131,10 +131,8 @@ class MspGLTextureNodeProperties(bpy.types.Panel):
                if not node:
                        return
 
                if not node:
                        return
 
-               self.layout.prop(node, "default_filter")
-               if not node.default_filter:
-                       self.layout.prop(node, "use_mipmap")
-                       self.layout.prop(node, "max_anisotropy")
+               self.layout.prop(node, "use_mipmap")
+               self.layout.prop(node, "max_anisotropy")
 
 class MspGLLightProperties(bpy.types.Panel):
        bl_idname = "LIGHT_PT_mspgl_properties"
 
 class MspGLLightProperties(bpy.types.Panel):
        bl_idname = "LIGHT_PT_mspgl_properties"
@@ -239,7 +237,6 @@ def register_properties():
        bpy.types.Material.uniforms = bpy.props.CollectionProperty(type=MspGLUniform, name="Uniform", description="Uniform variables to add to the technique")
        bpy.types.Material.active_uniform_index = bpy.props.IntProperty("Active uniform index")
 
        bpy.types.Material.uniforms = bpy.props.CollectionProperty(type=MspGLUniform, name="Uniform", description="Uniform variables to add to the technique")
        bpy.types.Material.active_uniform_index = bpy.props.IntProperty("Active uniform index")
 
-       bpy.types.ShaderNodeTexImage.default_filter = bpy.props.BoolProperty(name="Default filter", description="Let the loading program determine filtering options")
        bpy.types.ShaderNodeTexImage.use_mipmap = bpy.props.BoolProperty(name="Use mipmaps", description="Use mipmaps (automatically generated) for the texture", default=True)
        bpy.types.ShaderNodeTexImage.max_anisotropy = bpy.props.FloatProperty(name="Maximum anisotropy", description="Maximum anisotropy to use in texture filtering", min=1, max=16, default=1)
 
        bpy.types.ShaderNodeTexImage.use_mipmap = bpy.props.BoolProperty(name="Use mipmaps", description="Use mipmaps (automatically generated) for the texture", default=True)
        bpy.types.ShaderNodeTexImage.max_anisotropy = bpy.props.FloatProperty(name="Maximum anisotropy", description="Maximum anisotropy to use in texture filtering", min=1, max=16, default=1)
 
index 93b3b5c9f702e69e091ffbd480c438d7fe8f695c..bb37b0747e7d12c732ac4e57234c6b8bc3836344 100644 (file)
@@ -16,10 +16,17 @@ namespace Msp {
 namespace GL {
 
 Sampler::Sampler():
 namespace GL {
 
 Sampler::Sampler():
-       owner(0)
+       min_filter(NEAREST_MIPMAP_LINEAR),
+       mag_filter(LINEAR),
+       max_anisotropy(1.0f),
+       wrap_s(REPEAT),
+       wrap_t(REPEAT),
+       wrap_r(REPEAT),
+       border_color(Color(0.0f, 0.0f, 0.0f, 0.0f)),
+       compare(false),
+       cmp_func(LEQUAL),
+       dirty_params(0)
 {
 {
-       init();
-
        Require _req(ARB_sampler_objects);
        if(ARB_direct_state_access)
                glCreateSamplers(1, &id);
        Require _req(ARB_sampler_objects);
        if(ARB_direct_state_access)
                glCreateSamplers(1, &id);
@@ -27,105 +34,30 @@ Sampler::Sampler():
                glGenSamplers(1, &id);
 }
 
                glGenSamplers(1, &id);
 }
 
-Sampler::Sampler(const Texture &tex):
-       id(0),
-       owner(&tex)
-{
-       if(this!=&tex.get_default_sampler())
-               throw invalid_argument("Sampler::Sampler");
-
-       init();
-}
-
-void Sampler::init()
-{
-       min_filter = NEAREST_MIPMAP_LINEAR;
-       mag_filter = LINEAR;
-       max_anisotropy = 1.0f;
-       wrap_s = REPEAT;
-       wrap_t = REPEAT;
-       wrap_r = REPEAT;
-       border_color = Color(0.0f, 0.0f, 0.0f, 0.0f);
-       compare = false;
-       cmp_func = LEQUAL;
-       dirty_params = 0;
-}
-
 void Sampler::update_parameter(int mask) const
 {
 void Sampler::update_parameter(int mask) const
 {
-       if(owner)
-       {
-               if(!owner->get_id())
-               {
-                       dirty_params |= mask;
-                       return;
-               }
-
-               if(!ARB_direct_state_access && TexUnit::current().get_texture()!=owner)
-               {
-                       TexUnit *unit = TexUnit::find_unit(owner);
-                       if(!unit)
-                       {
-                               dirty_params |= mask;
-                               return;
-                       }
-
-                       unit->bind();
-               }
-       }
-
        if(mask&MIN_FILTER)
        if(mask&MIN_FILTER)
-               set_parameter_i(GL_TEXTURE_MIN_FILTER, min_filter);
+               glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, min_filter);
        if(mask&MAG_FILTER)
        if(mask&MAG_FILTER)
-               set_parameter_i(GL_TEXTURE_MAG_FILTER, mag_filter);
+               glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, mag_filter);
        if(mask&MAX_ANISOTROPY)
        if(mask&MAX_ANISOTROPY)
-               set_parameter_f(GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy);
+               glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy);
        if(mask&WRAP_S)
        if(mask&WRAP_S)
-               set_parameter_i(GL_TEXTURE_WRAP_S, wrap_s);
+               glSamplerParameteri(id, GL_TEXTURE_WRAP_S, wrap_s);
        if(mask&WRAP_T)
        if(mask&WRAP_T)
-               set_parameter_i(GL_TEXTURE_WRAP_T, wrap_t);
+               glSamplerParameteri(id, GL_TEXTURE_WRAP_T, wrap_t);
        if(mask&WRAP_R)
        if(mask&WRAP_R)
-               set_parameter_i(GL_TEXTURE_WRAP_R, wrap_r);
+               glSamplerParameteri(id, GL_TEXTURE_WRAP_R, wrap_r);
        if(mask&BORDER_COLOR)
        if(mask&BORDER_COLOR)
-               set_parameter_fv(GL_TEXTURE_BORDER_COLOR, &border_color.r);
+               glSamplerParameterfv(id, GL_TEXTURE_BORDER_COLOR, &border_color.r);
        if(mask&COMPARE)
        {
        if(mask&COMPARE)
        {
-               set_parameter_i(GL_TEXTURE_COMPARE_MODE, (compare ? GL_COMPARE_R_TO_TEXTURE : GL_NONE));
+               glSamplerParameteri(id, GL_TEXTURE_COMPARE_MODE, (compare ? GL_COMPARE_R_TO_TEXTURE : GL_NONE));
                if(compare)
                if(compare)
-                       set_parameter_i(GL_TEXTURE_COMPARE_FUNC, cmp_func);
+                       glSamplerParameteri(id, GL_TEXTURE_COMPARE_FUNC, cmp_func);
        }
 }
 
        }
 }
 
-void Sampler::set_parameter_i(unsigned param, int value) const
-{
-       if(id)
-               glSamplerParameteri(id, param, value);
-       else if(ARB_direct_state_access)
-               glTextureParameteri(owner->get_id(), param, value);
-       else
-               glTexParameteri(owner->get_target(), param, value);
-}
-
-void Sampler::set_parameter_f(unsigned param, float value) const
-{
-       if(id)
-               glSamplerParameterf(id, param, value);
-       else if(ARB_direct_state_access)
-               glTextureParameterf(owner->get_id(), param, value);
-       else
-               glTexParameterf(owner->get_target(), param, value);
-}
-
-void Sampler::set_parameter_fv(unsigned param, const float *value) const
-{
-       if(id)
-               glSamplerParameterfv(id, param, value);
-       else if(ARB_direct_state_access)
-               glTextureParameterfv(owner->get_id(), param, value);
-       else
-               glTexParameterfv(owner->get_target(), param, value);
-}
-
 void Sampler::set_min_filter(TextureFilter f)
 {
        min_filter = f;
 void Sampler::set_min_filter(TextureFilter f)
 {
        min_filter = f;
@@ -199,20 +131,16 @@ void Sampler::set_compare(Predicate f)
        static Require _req(ARB_shadow);
        compare = true;
        cmp_func = f;
        static Require _req(ARB_shadow);
        compare = true;
        cmp_func = f;
-       update_parameter(COMPARE);
+       dirty_params |= COMPARE;
 }
 
 void Sampler::bind_to(unsigned i) const
 {
        TexUnit &unit = TexUnit::get_unit(i);
 }
 
 void Sampler::bind_to(unsigned i) const
 {
        TexUnit &unit = TexUnit::get_unit(i);
-       if(owner && owner!=unit.get_texture())
-               throw invalid_operation("Sampler::bind_to");
 
 
-       const Sampler *cur = unit.get_sampler();
        if(unit.set_sampler(this))
        {
        if(unit.set_sampler(this))
        {
-               if(!owner || (cur && cur->id))
-                       glBindSampler(i, id);
+               glBindSampler(i, id);
 
                if(dirty_params)
                {
 
                if(dirty_params)
                {
@@ -230,32 +158,10 @@ const Sampler *Sampler::current(unsigned i)
 void Sampler::unbind_from(unsigned i)
 {
        TexUnit &unit = TexUnit::get_unit(i);
 void Sampler::unbind_from(unsigned i)
 {
        TexUnit &unit = TexUnit::get_unit(i);
-       const Sampler *cur = unit.get_sampler();
-       if(unit.set_sampler(0) && cur->id)
+       if(unit.set_sampler(0))
                glBindSampler(i, 0);
 }
 
                glBindSampler(i, 0);
 }
 
-void Sampler::unload()
-{
-       if(owner && !owner->get_id())
-       {
-               if(min_filter!=NEAREST_MIPMAP_LINEAR)
-                       dirty_params |= MIN_FILTER;
-               if(mag_filter!=LINEAR)
-                       dirty_params |= MAG_FILTER;
-               if(max_anisotropy!=1.0f)
-                       dirty_params |= MAX_ANISOTROPY;
-               if(wrap_s!=REPEAT)
-                       dirty_params |= WRAP_S;
-               if(wrap_t!=REPEAT)
-                       dirty_params |= WRAP_T;
-               if(wrap_r!=REPEAT)
-                       dirty_params |= WRAP_R;
-               if(compare || cmp_func!=LEQUAL)
-                       dirty_params |= COMPARE;
-       }
-}
-
 void Sampler::set_debug_name(const string &name)
 {
 #ifdef DEBUG
 void Sampler::set_debug_name(const string &name)
 {
 #ifdef DEBUG
index f68f1a16183545c315a224017bd7b1ddd292adae..bb02269f8c0ec9bcfd4408b3e48fa49702b90e06 100644 (file)
@@ -99,7 +99,6 @@ private:
        };
 
        unsigned id;
        };
 
        unsigned id;
-       const Texture *owner;
        TextureFilter min_filter;
        TextureFilter mag_filter;
        float max_anisotropy;
        TextureFilter min_filter;
        TextureFilter mag_filter;
        float max_anisotropy;
@@ -113,10 +112,8 @@ private:
 
 public:
        Sampler();
 
 public:
        Sampler();
-       Sampler(const Texture &);
-private:
-       void init();
 
 
+private:
        void update_parameter(int) const;
        void set_parameter_i(unsigned, int) const;
        void set_parameter_f(unsigned, float) const;
        void update_parameter(int) const;
        void set_parameter_i(unsigned, int) const;
        void set_parameter_f(unsigned, float) const;
@@ -165,8 +162,6 @@ public:
        static void unbind() { unbind_from(0); }
        static void unbind_from(unsigned);
 
        static void unbind() { unbind_from(0); }
        static void unbind_from(unsigned);
 
-       void unload();
-
        void set_debug_name(const std::string &);
 };
 
        void set_debug_name(const std::string &);
 };
 
index 967a7fe31562d8509619b3bef3d060c3bd75d714..ea503ed1f9d4414f28f200c89be286fdc49f6190 100644 (file)
@@ -30,8 +30,7 @@ Texture::Texture(GLenum t, ResourceManager *m):
        storage_fmt(RGB8),
        swizzle(NO_SWIZZLE),
        use_srgb_format(false),
        storage_fmt(RGB8),
        swizzle(NO_SWIZZLE),
        use_srgb_format(false),
-       auto_gen_mipmap(false),
-       default_sampler(*this)
+       auto_gen_mipmap(false)
 {
        if(m)
                set_manager(m);
 {
        if(m)
                set_manager(m);
@@ -128,46 +127,6 @@ void Texture::set_parameter_i(GLenum param, int value) const
                glTexParameteri(target, param, value);
 }
 
                glTexParameteri(target, param, value);
 }
 
-void Texture::set_min_filter(TextureFilter f)
-{
-       default_sampler.set_min_filter(f);
-}
-
-void Texture::set_mag_filter(TextureFilter f)
-{
-       default_sampler.set_mag_filter(f);
-}
-
-void Texture::set_filter(TextureFilter f)
-{
-       default_sampler.set_filter(f);
-}
-
-void Texture::set_max_anisotropy(float a)
-{
-       default_sampler.set_max_anisotropy(a);
-}
-
-void Texture::set_wrap(TextureWrap w)
-{
-       default_sampler.set_wrap(w);
-}
-
-void Texture::set_wrap_s(TextureWrap w)
-{
-       default_sampler.set_wrap_s(w);
-}
-
-void Texture::set_wrap_t(TextureWrap w)
-{
-       default_sampler.set_wrap_t(w);
-}
-
-void Texture::set_wrap_r(TextureWrap w)
-{
-       default_sampler.set_wrap_r(w);
-}
-
 bool Texture::can_generate_mipmap()
 {
        return EXT_framebuffer_object;
 bool Texture::can_generate_mipmap()
 {
        return EXT_framebuffer_object;
@@ -195,19 +154,6 @@ void Texture::set_auto_generate_mipmap(bool gm)
        auto_gen_mipmap = gm;
 }
 
        auto_gen_mipmap = gm;
 }
 
-void Texture::set_compare_enabled(bool c)
-{
-       if(c)
-               default_sampler.set_compare(default_sampler.get_compare_function());
-       else
-               default_sampler.disable_compare();
-}
-
-void Texture::set_compare_func(Predicate f)
-{
-       default_sampler.set_compare(f);
-}
-
 void Texture::load_image(const string &fn, bool)
 {
        load_image(fn, 0U);
 void Texture::load_image(const string &fn, bool)
 {
        load_image(fn, 0U);
@@ -240,7 +186,6 @@ void Texture::bind_to(unsigned i) const
        }
 
        TexUnit &unit = TexUnit::get_unit(i);
        }
 
        TexUnit &unit = TexUnit::get_unit(i);
-       const Texture *cur = unit.get_texture();
        if(unit.set_texture(this))
        {
                if(manager)
        if(unit.set_texture(this))
        {
                if(manager)
@@ -253,9 +198,6 @@ void Texture::bind_to(unsigned i) const
                        unit.bind();
                        glBindTexture(target, id);
                }
                        unit.bind();
                        glBindTexture(target, id);
                }
-
-               if(!unit.get_sampler() || unit.get_sampler()==&cur->default_sampler)
-                       default_sampler.bind_to(i);
        }
 }
 
        }
 }
 
@@ -277,9 +219,6 @@ void Texture::unbind_from(unsigned i)
                        unit.bind();
                        glBindTexture(cur->target, 0);
                }
                        unit.bind();
                        glBindTexture(cur->target, 0);
                }
-
-               if(unit.get_sampler()==&cur->default_sampler)
-                       Sampler::unbind_from(i);
        }
 }
 
        }
 }
 
@@ -313,27 +252,11 @@ void Texture::Loader::init()
 
        add("external_image", &Loader::external_image);
        add("external_image_srgb", &Loader::external_image_srgb);
 
        add("external_image", &Loader::external_image);
        add("external_image_srgb", &Loader::external_image_srgb);
-       add("filter", &Loader::filter);
        add("generate_mipmap", &Loader::generate_mipmap);
        add("image_data", &Loader::image_data);
        add("generate_mipmap", &Loader::generate_mipmap);
        add("image_data", &Loader::image_data);
-       add("mag_filter", &Loader::mag_filter);
-       add("max_anisotropy", &Loader::max_anisotropy);
-       add("min_filter", &Loader::min_filter);
        add("mipmap_levels", &Loader::mipmap_levels);
        add("mipmap_levels", &Loader::mipmap_levels);
-       add("sampler",    &Loader::sampler);
-       add("wrap",       &Loader::wrap);
-       add("wrap_r",     &Loader::wrap_r);
-       add("wrap_s",     &Loader::wrap_s);
-       add("wrap_t",     &Loader::wrap_t);
-}
-
-unsigned Texture::Loader::get_levels() const
-{
-       return (is_mipmapped(obj.default_sampler.get_min_filter()) ? levels : 1);
 }
 
 }
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 void Texture::Loader::load_external_image(Graphics::Image &img, const string &fn)
 {
        RefPtr<IO::Seekable> io = get_collection().open_raw(fn);
 void Texture::Loader::load_external_image(Graphics::Image &img, const string &fn)
 {
        RefPtr<IO::Seekable> io = get_collection().open_raw(fn);
@@ -362,15 +285,10 @@ void Texture::Loader::external_image_common(const string &fn)
        {
                Graphics::Image img;
                load_external_image(img, fn);
        {
                Graphics::Image img;
                load_external_image(img, fn);
-               obj.image(img, get_levels());
+               obj.image(img, levels);
        }
 }
 
        }
 }
 
-void Texture::Loader::filter(TextureFilter f)
-{
-       obj.set_filter(f);
-}
-
 void Texture::Loader::generate_mipmap(bool gm)
 {
        obj.set_auto_generate_mipmap(gm);
 void Texture::Loader::generate_mipmap(bool gm)
 {
        obj.set_auto_generate_mipmap(gm);
@@ -389,22 +307,7 @@ void Texture::Loader::image_data(const string &data)
        IO::Memory mem(data.data(), data.size());
        img.load_io(mem);
 
        IO::Memory mem(data.data(), data.size());
        img.load_io(mem);
 
-       obj.image(img, get_levels());
-}
-
-void Texture::Loader::mag_filter(TextureFilter f)
-{
-       obj.set_mag_filter(f);
-}
-
-void Texture::Loader::max_anisotropy(float a)
-{
-       obj.set_max_anisotropy(a);
-}
-
-void Texture::Loader::min_filter(TextureFilter f)
-{
-       obj.set_min_filter(f);
+       obj.image(img, levels);
 }
 
 void Texture::Loader::mipmap_levels(unsigned l)
 }
 
 void Texture::Loader::mipmap_levels(unsigned l)
@@ -412,31 +315,5 @@ void Texture::Loader::mipmap_levels(unsigned l)
        levels = l;
 }
 
        levels = l;
 }
 
-void Texture::Loader::sampler()
-{
-       load_sub(obj.default_sampler);
-}
-
-void Texture::Loader::wrap(TextureWrap w)
-{
-       obj.set_wrap(w);
-}
-
-void Texture::Loader::wrap_r(TextureWrap w)
-{
-       obj.set_wrap_r(w);
-}
-
-void Texture::Loader::wrap_s(TextureWrap w)
-{
-       obj.set_wrap_s(w);
-}
-
-void Texture::Loader::wrap_t(TextureWrap w)
-{
-       obj.set_wrap_t(w);
-}
-#pragma GCC diagnostic pop
-
 } // namespace GL
 } // namespace Msp
 } // namespace GL
 } // namespace Msp
index 4fa20c76483490c724b4f8b6eb72d6d05cd25707..7fb41a622b7b3c7609baea465480603d9b1555f5 100644 (file)
@@ -37,7 +37,6 @@ protected:
        private:
                void init();
 
        private:
                void init();
 
-               unsigned get_levels() const;
        protected:
                void load_external_image(Graphics::Image &, const std::string &);
 
        protected:
                void load_external_image(Graphics::Image &, const std::string &);
 
@@ -45,18 +44,9 @@ protected:
                void external_image(const std::string &);
                void external_image_srgb(const std::string &);
                void external_image_common(const std::string &);
                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 &);
                void generate_mipmap(bool);
                void image_data(const std::string &);
-               void mag_filter(TextureFilter);
-               void max_anisotropy(float);
-               void min_filter(TextureFilter);
                void mipmap_levels(unsigned);
                void mipmap_levels(unsigned);
-               void sampler();
-               void wrap(TextureWrap);
-               void wrap_r(TextureWrap);
-               void wrap_s(TextureWrap);
-               void wrap_t(TextureWrap);
        };
 
        enum ParameterMask
        };
 
        enum ParameterMask
@@ -79,7 +69,6 @@ protected:
        FormatSwizzle swizzle;
        bool use_srgb_format;
        bool auto_gen_mipmap;
        FormatSwizzle swizzle;
        bool use_srgb_format;
        bool auto_gen_mipmap;
-       Sampler default_sampler;
        std::string debug_name;
 
        static int swizzle_orders[];
        std::string debug_name;
 
        static int swizzle_orders[];
@@ -97,27 +86,6 @@ protected:
        void set_parameter_i(GLenum, int) const;
 
 public:
        void set_parameter_i(GLenum, int) const;
 
 public:
-       Sampler &get_default_sampler() { return default_sampler; }
-       const Sampler &get_default_sampler() const { return default_sampler; }
-
-       DEPRECATED void set_min_filter(TextureFilter);
-       DEPRECATED void set_mag_filter(TextureFilter);
-
-       /** Sets filter for both minification and magnification.  Since mipmapping
-       is not applicable to magnification, LINEAR is used instead. */
-       DEPRECATED void set_filter(TextureFilter);
-
-       DEPRECATED void set_mipmap_levels(unsigned) { }
-
-       DEPRECATED void set_max_anisotropy(float);
-
-       /** Sets the wrapping mode for all coordinates. */
-       DEPRECATED void set_wrap(TextureWrap);
-
-       DEPRECATED void set_wrap_s(TextureWrap);
-       DEPRECATED void set_wrap_t(TextureWrap);
-       DEPRECATED void set_wrap_r(TextureWrap);
-
        static bool can_generate_mipmap();
 
        void generate_mipmap();
        static bool can_generate_mipmap();
 
        void generate_mipmap();
@@ -129,15 +97,6 @@ public:
        /// Deprecated.  Use set_auto_generate_mipmap instead.
        DEPRECATED void set_generate_mipmap(bool g) { set_auto_generate_mipmap(g); }
 
        /// Deprecated.  Use set_auto_generate_mipmap instead.
        DEPRECATED void set_generate_mipmap(bool g) { set_auto_generate_mipmap(g); }
 
-       /** Sets depth texture comparison.  Has no effect on other formats.  When
-       comparison is enabled, the third component of the texture coordinate is
-       compared against the texel value, and the result is returned as the texture
-       sample. */
-       DEPRECATED void set_compare_enabled(bool);
-
-       /** Sets the function to use for depth comparison. */
-       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 &, unsigned = 0);
 
        /// Loads a Graphics::Image from a file and uploads it to the texture.
        virtual void load_image(const std::string &, unsigned = 0);
 
index c0a96a4e7e2d43e10e14b58f268d8952fe0ac90c..1e9ec90344e242608caa55501268a08775a54aa2 100644 (file)
@@ -206,7 +206,6 @@ void Texture2D::unload()
        glDeleteTextures(1, &id);
        id = 0;
        allocated = 0;
        glDeleteTextures(1, &id);
        id = 0;
        allocated = 0;
-       default_sampler.unload();
 }
 
 
 }
 
 
index 7b603252b6e1c97f0b80ad953734147e6c8efcc2..7bdac6703e3554e60162a90839139c1f4efba4f3 100644 (file)
@@ -148,9 +148,6 @@ void RenderTarget::init(unsigned w, unsigned h, unsigned s, const RenderTargetFo
                {
                        tgt.texture = new Texture2D;
                        tgt.texture->storage(pf, width, height, 1);
                {
                        tgt.texture = new Texture2D;
                        tgt.texture->storage(pf, width, height, 1);
-                       Sampler &sampler = tgt.texture->get_default_sampler();
-                       sampler.set_filter(NEAREST);
-                       sampler.set_wrap(CLAMP_TO_EDGE);
                        fbo.attach(att, *tgt.texture);
                }
                buffers.push_back(tgt);
                        fbo.attach(att, *tgt.texture);
                }
                buffers.push_back(tgt);
@@ -170,15 +167,6 @@ RenderTarget::~RenderTarget()
        }
 }
 
        }
 }
 
-void RenderTarget::set_texture_filter(TextureFilter filt)
-{
-       if(!samples)
-       {
-               for(vector<TargetBuffer>::iterator i=buffers.begin(); i!=buffers.end(); ++i)
-                       i->texture->get_default_sampler().set_filter(filt);
-       }
-}
-
 const Texture2D &RenderTarget::get_target_texture(unsigned i) const
 {
        if(i>=buffers.size())
 const Texture2D &RenderTarget::get_target_texture(unsigned i) const
 {
        if(i>=buffers.size())
index cb6d6b97280d85c1ca2f252c6ed65b5ca2917377..6577cdcfb5dfa78ceb69b7842beb08ab9de3dbc8 100644 (file)
@@ -77,7 +77,6 @@ public:
        unsigned get_height() const { return height; }
        const RenderTargetFormat &get_format() const { return format; }
        Framebuffer &get_framebuffer() { return fbo; }
        unsigned get_height() const { return height; }
        const RenderTargetFormat &get_format() const { return format; }
        Framebuffer &get_framebuffer() { return fbo; }
-       void set_texture_filter(TextureFilter);
        const Texture2D &get_target_texture(unsigned) const;
        const Texture2D &get_target_texture(RenderOutput) const;
        void blit_from(const RenderTarget &);
        const Texture2D &get_target_texture(unsigned) const;
        const Texture2D &get_target_texture(RenderOutput) const;
        void blit_from(const RenderTarget &);
index 682acde23d6603604f411193e7407d9cb09d530b..8a7780cd4016521c2b0cb39428270ad0f50c1609 100644 (file)
@@ -37,8 +37,6 @@ void init_builtin_data(DataFile::BuiltinSource &);
 Resources *Resources::global_resources = 0;
 
 Resources::Resources(bool set_as_global):
 Resources *Resources::global_resources = 0;
 
 Resources::Resources(bool set_as_global):
-       default_tex_filter(Texture::can_generate_mipmap() ? LINEAR_MIPMAP_LINEAR : LINEAR),
-       default_tex_anisotropy(1.0f),
        srgb_conversion(false),
        resource_manager(0)
 {
        srgb_conversion(false),
        resource_manager(0)
 {
@@ -113,16 +111,6 @@ const DataFile::CollectionSource &Resources::get_builtins()
        return builtins;
 }
 
        return builtins;
 }
 
-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;
 void Resources::set_srgb_conversion(bool c)
 {
        srgb_conversion = c;
@@ -199,16 +187,6 @@ Texture2D *Resources::create_texture2d(const string &name)
                                image.load_io(*io);
 
                        tex = new Texture2D(resource_manager);
                                image.load_io(*io);
 
                        tex = new Texture2D(resource_manager);
-                       Sampler &samp = tex->get_default_sampler();
-                       if(is_mipmapped(default_tex_filter))
-                       {
-                               tex->set_auto_generate_mipmap(true);
-                               samp.set_mag_filter(LINEAR);
-                       }
-                       else
-                               samp.set_mag_filter(default_tex_filter);
-                       samp.set_min_filter(default_tex_filter);
-                       samp.set_max_anisotropy(default_tex_anisotropy);
 
                        if(resource_manager)
                                resource_manager->set_resource_location(*tex, *this, name);
 
                        if(resource_manager)
                                resource_manager->set_resource_location(*tex, *this, name);
index 82d2f4c6798e4a9019380894b314aa56ad9aed57..37de5d8cfc80482badc99343ff617dd21d0ff692 100644 (file)
@@ -32,8 +32,6 @@ public:
        };
 
 private:
        };
 
 private:
-       TextureFilter default_tex_filter;
-       float default_tex_anisotropy;
        bool srgb_conversion;
        ResourceManager *resource_manager;
 
        bool srgb_conversion;
        ResourceManager *resource_manager;
 
@@ -46,9 +44,6 @@ public:
        static Resources &get_global();
        static const DataFile::CollectionSource &get_builtins();
 
        static Resources &get_global();
        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. */
        DEPRECATED void set_srgb_conversion(bool);
        /** Enables or disables sRGB conversion.  If enabled, textures and material
        colors are converted from sRGB to linear color space when loaded. */
        DEPRECATED void set_srgb_conversion(bool);