#define MSP_GL_CLIPPING_H_
#include <vector>
-#include "bindable.h"
+#include "programdata.h"
namespace Msp {
namespace GL {
class ClipPlane;
-class Matrix;
-class ProgramData;
-class Clipping: public Bindable<Clipping>
+class Clipping
{
private:
- std::vector<const ClipPlane *> planes;
+ struct AttachedPlane
+ {
+ const ClipPlane *plane;
+ mutable unsigned generation;
-public:
- static unsigned get_n_attach_points();
+ AttachedPlane(const ClipPlane *p): plane(p), generation(0) { }
+ };
- void attach(unsigned, const ClipPlane &);
- void detach(unsigned);
+ std::vector<AttachedPlane> planes;
+ mutable ProgramData shdata;
- void update_shader_data(ProgramData &, const Matrix &) const;
+public:
+ void attach(const ClipPlane &);
+ void detach(const ClipPlane &);
- void bind() const;
+ unsigned get_n_planes() const { return planes.size(); }
- static void unbind();
+ const ProgramData &get_shader_data() const;
};
} // namespace GL