]> git.tdb.fi Git - libs/gl.git/blobdiff - source/clipping.h
Restore user clip planes in a form compatible with modern OpenGL
[libs/gl.git] / source / clipping.h
diff --git a/source/clipping.h b/source/clipping.h
new file mode 100644 (file)
index 0000000..2a4330b
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef MSP_GL_CLIPPING_H_
+#define MSP_GL_CLIPPING_H_
+
+#include <vector>
+#include "bindable.h"
+
+namespace Msp {
+namespace GL {
+
+class ClipPlane;
+class Matrix;
+class ProgramData;
+
+class Clipping: public Bindable<Clipping>
+{
+private:
+       std::vector<const ClipPlane *> planes;
+
+       static bool bound_with_legacy;
+
+public:
+       void attach(unsigned, const ClipPlane &);
+       void detach(unsigned);
+
+       void update_shader_data(ProgramData &, const Matrix &) const;
+
+       void bind(bool legacy = true) const;
+
+       static void unbind();
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif