X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fsampler.h;h=f68f1a16183545c315a224017bd7b1ddd292adae;hb=d40673bd28c4b4524d3642b949d9d109dc6f9f24;hp=e1e9bec5d60332e5331cd6e1e52e421c5256e8e9;hpb=7aaec9a70b8d7733429bec043f8e33e02956f266;p=libs%2Fgl.git diff --git a/source/core/sampler.h b/source/core/sampler.h index e1e9bec5..f68f1a16 100644 --- a/source/core/sampler.h +++ b/source/core/sampler.h @@ -2,6 +2,7 @@ #define MSP_GL_SAMPLER_H_ #include +#include "color.h" #include "gl.h" #include "predicate.h" @@ -38,6 +39,9 @@ enum TextureWrap /// Extend the texels at the edge of the texture to infinity CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, + /// Sampling outside the texture will return border color + CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER, + /// Tile the texture, with every other repetition mirrored MIRRORED_REPEAT = GL_MIRRORED_REPEAT }; @@ -69,6 +73,8 @@ public: private: void init(); + void border_color(float, float, float, float); + void compare(Predicate); void filter(TextureFilter); void mag_filter(TextureFilter); void max_anisotropy(float); @@ -88,7 +94,8 @@ private: WRAP_S = 8, WRAP_T = 16, WRAP_R = 32, - COMPARE = 64 + BORDER_COLOR = 64, + COMPARE = 128 }; unsigned id; @@ -99,6 +106,7 @@ private: TextureWrap wrap_s; TextureWrap wrap_t; TextureWrap wrap_r; + Color border_color; bool compare; Predicate cmp_func; mutable int dirty_params; @@ -112,6 +120,7 @@ private: void update_parameter(int) const; void set_parameter_i(unsigned, int) const; void set_parameter_f(unsigned, float) const; + void set_parameter_fv(unsigned, const float *) const; public: void set_min_filter(TextureFilter); @@ -134,6 +143,9 @@ public: void set_wrap_t(TextureWrap); void set_wrap_r(TextureWrap); + void set_border_color(const Color &); + const Color &get_border_color() const { return border_color; } + /** Disables depth comparison. */ void disable_compare(); @@ -154,6 +166,8 @@ public: static void unbind_from(unsigned); void unload(); + + void set_debug_name(const std::string &); };