X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fsampler.h;h=c79068775b144499943196b316dc0f8f0406f75b;hb=34d956d6890ce7070741667d4864fa798883da72;hp=524a8fc5f95f01fbee29faa87a7f731c50b0e55d;hpb=97b1f1d97b685155e279d9d02d7c6343ef233ae8;p=libs%2Fgl.git diff --git a/source/core/sampler.h b/source/core/sampler.h index 524a8fc5..c7906877 100644 --- a/source/core/sampler.h +++ b/source/core/sampler.h @@ -3,8 +3,8 @@ #include #include "color.h" -#include "gl.h" #include "predicate.h" +#include "sampler_backend.h" namespace Msp { namespace GL { @@ -61,8 +61,10 @@ for magnification and NEAREST_MIPMAP_LINEAR for minification. If texture coordinates fall outside of the principal range of the texture, wrapping is applied. The default for all directions is REPEAT. */ -class Sampler +class Sampler: public SamplerBackend { + friend SamplerBackend; + public: class Loader: public DataFile::ObjectLoader { @@ -96,22 +98,17 @@ private: COMPARE = 128 }; - unsigned id; - TextureFilter min_filter; - TextureFilter mag_filter; - float max_anisotropy; - TextureWrap wrap_s; - TextureWrap wrap_t; - TextureWrap wrap_r; - Color border_color; - bool compare; - Predicate cmp_func; - mutable int dirty_params; - -public: - Sampler(); + TextureFilter min_filter = NEAREST_MIPMAP_LINEAR; + TextureFilter mag_filter = LINEAR; + float max_anisotropy = 1.0f; + TextureWrap wrap_s = REPEAT; + TextureWrap wrap_t = REPEAT; + TextureWrap wrap_r = REPEAT; + Color border_color = { 0.0f, 0.0f, 0.0f, 0.0f }; + bool compare = false; + Predicate cmp_func = LEQUAL; + mutable int dirty_params = 0; -private: void update() const; public: @@ -152,15 +149,11 @@ public: void refresh() const { if(dirty_params) update(); } - unsigned get_id() const { return id; } - - void set_debug_name(const std::string &); + using SamplerBackend::set_debug_name; }; bool is_mipmapped(TextureFilter); -GLenum get_gl_filter(TextureFilter); -GLenum get_gl_wrap(TextureWrap); void operator>>(const LexicalConverter &, TextureFilter &); void operator>>(const LexicalConverter &, TextureWrap &);