]> git.tdb.fi Git - libs/gl.git/blob - source/core/clipping.h
d74763ab7c697f9cade4e94ab4b15bdb518e0a10
[libs/gl.git] / source / core / clipping.h
1 #ifndef MSP_GL_CLIPPING_H_
2 #define MSP_GL_CLIPPING_H_
3
4 #include <vector>
5 #include <msp/core/attributes.h>
6 #include "bindable.h"
7 #include "programdata.h"
8
9 namespace Msp {
10 namespace GL {
11
12 class ClipPlane;
13 class Matrix;
14
15 class Clipping: public Bindable<Clipping>
16 {
17 private:
18         struct AttachedPlane
19         {
20                 const ClipPlane *plane;
21                 mutable unsigned generation;
22
23                 AttachedPlane(const ClipPlane *p): plane(p), generation(0) { }
24         };
25
26         std::vector<AttachedPlane> planes;
27         mutable ProgramData shdata;
28
29 public:
30         static unsigned get_n_attach_points();
31
32         void attach(const ClipPlane &);
33         void detach(const ClipPlane &);
34
35         DEPRECATED void attach(unsigned, const ClipPlane &p) { attach(p); }
36         DEPRECATED void detach(unsigned);
37
38         const ProgramData &get_shader_data() const;
39
40         void bind() const;
41
42         static void unbind();
43 };
44
45 } // namespace GL
46 } // namespace Msp
47
48 #endif