X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fsampler.h;fp=source%2Fcore%2Fsampler.h;h=7cf3d83a7b0915481eef1417e2fe48c0a1e8bcee;hb=190a7e11237351f6b730c28f7b16f183e8adc69c;hp=c79068775b144499943196b316dc0f8f0406f75b;hpb=be6ffe96ecb4707599fe1a6f620c348760213d46;p=libs%2Fgl.git diff --git a/source/core/sampler.h b/source/core/sampler.h index c7906877..7cf3d83a 100644 --- a/source/core/sampler.h +++ b/source/core/sampler.h @@ -48,18 +48,12 @@ enum TextureWrap /** -Samplers are used to access texture data in shaders. To use a sampler with a -texture, bind it to the same texture unit. Each texture has a default sampler -which is used if no external sampler is bound. - -A texture is generally rendered at a size that's either smaller or larger than -its native size, so that the texture coordinates do not exactly correspond to -the texels of the texture. The kind of filtering used, if any, is determined -by the minification and magnification filter parameters. The default is LINEAR -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. +Stores settings affecting how values are obtained from textures in a shader. +Samplers are always used together with textures. + +Texture coordinates are first transformed according to the wrap mode for each +axis. One or more texel values are then read and combined according to the +filtering mode. */ class Sampler: public SamplerBackend { @@ -112,7 +106,12 @@ private: void update() const; public: + /** Sets filter to use when the texture is drawn at a size smaller than + original. */ void set_min_filter(TextureFilter); + + /** Sets filter to use when the texture is drawn at a size larger than + original. Mipmapped filters can't be used. */ void set_mag_filter(TextureFilter); /** Sets filter for both minification and magnification. If a mipmapping @@ -122,6 +121,9 @@ public: TextureFilter get_min_filter() const { return min_filter; } TextureFilter get_mag_filter() const { return mag_filter; } + /** Sets the maximum aspect ratio for anisotropic filtering. If greater + than 1, filtering will consider more than than four samples when the texture + is drawn at an oblique angle. */ void set_max_anisotropy(float); float get_max_anisotropy() const { return max_anisotropy; } @@ -132,7 +134,9 @@ public: void set_wrap_t(TextureWrap); void set_wrap_r(TextureWrap); + /** Sets the border color for CLAMP_TO_BORDER wrap mode. */ void set_border_color(const Color &); + const Color &get_border_color() const { return border_color; } /** Disables depth comparison. */ @@ -140,7 +144,7 @@ public: /** Enables depth comparison and sets the compare function. Only has an effect when used with a depth texture. When depth comparison is enabled, - the third component of the texture coordinate is compared against the texel + the last component of the texture coordinate is compared against the texel value, and the result is returned as the texture sample.*/ void set_compare(Predicate);