#include <msp/datafile/objectloader.h>
#include "color.h"
#include "predicate.h"
+#include "sampler_backend.h"
namespace Msp {
namespace GL {
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 class PipelineState;
+ friend SamplerBackend;
public:
class Loader: public DataFile::ObjectLoader<Sampler>
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;
+ 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;
-public:
- Sampler();
-
-private:
void update() const;
public:
void refresh() const { if(dirty_params) update(); }
- void set_debug_name(const std::string &);
+ using SamplerBackend::set_debug_name;
};
bool is_mipmapped(TextureFilter);
-unsigned get_gl_filter(TextureFilter);
-unsigned get_gl_wrap(TextureWrap);
void operator>>(const LexicalConverter &, TextureFilter &);
void operator>>(const LexicalConverter &, TextureWrap &);