]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/clipping.h
Use persistent uniform blocks for Camera, Lighting and Clipping
[libs/gl.git] / source / core / clipping.h
index 319a8d98ff765a9cfb4e1c7b3fd57ba825b60b75..d74763ab7c697f9cade4e94ab4b15bdb518e0a10 100644 (file)
@@ -4,18 +4,27 @@
 #include <vector>
 #include <msp/core/attributes.h>
 #include "bindable.h"
+#include "programdata.h"
 
 namespace Msp {
 namespace GL {
 
 class ClipPlane;
 class Matrix;
-class ProgramData;
 
 class Clipping: public Bindable<Clipping>
 {
 private:
-       std::vector<const ClipPlane *> planes;
+       struct AttachedPlane
+       {
+               const ClipPlane *plane;
+               mutable unsigned generation;
+
+               AttachedPlane(const ClipPlane *p): plane(p), generation(0) { }
+       };
+
+       std::vector<AttachedPlane> planes;
+       mutable ProgramData shdata;
 
 public:
        static unsigned get_n_attach_points();
@@ -26,7 +35,7 @@ public:
        DEPRECATED void attach(unsigned, const ClipPlane &p) { attach(p); }
        DEPRECATED void detach(unsigned);
 
-       void update_shader_data(ProgramData &, const Matrix &) const;
+       const ProgramData &get_shader_data() const;
 
        void bind() const;