]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/clipping.cpp
Wrap Limits into a DeviceInfo struct
[libs/gl.git] / source / core / clipping.cpp
index 644a2434c6b783bda0f806012f23e841e9acd5b8..30d1f7c2db7dfeff09701f422baf9af2cc02526e 100644 (file)
@@ -1,50 +1,29 @@
 #include <msp/core/algorithm.h>
-#include <msp/gl/extensions/msp_clipping.h>
 #include "clipping.h"
 #include "clipplane.h"
 #include "deviceinfo.h"
 #include "error.h"
-#include "matrix.h"
-#include "misc.h"
 
 using namespace std;
 
 namespace Msp {
 namespace GL {
 
-unsigned Clipping::get_n_attach_points()
-{
-       return Limits::get_global().max_clip_planes;
-}
-
 void Clipping::attach(const ClipPlane &p)
 {
        if(find_member(planes, &p, &AttachedPlane::plane)!=planes.end())
                return;
-       if(planes.size()>=Limits::get_global().max_clip_planes)
+       if(planes.size()>=DeviceInfo::get_global().limits.max_clip_planes)
                throw invalid_operation("Clipping::attach");
 
        planes.push_back(&p);
-       if(current()==this)
-               glEnable(GL_CLIP_PLANE0+planes.size()-1);
 }
 
 void Clipping::detach(const ClipPlane &p)
 {
-       vector<AttachedPlane>::iterator i = find_member(planes, &p, &AttachedPlane::plane);
+       auto i = find_member(planes, &p, &AttachedPlane::plane);
        if(i!=planes.end())
-       {
                planes.erase(i);
-               if(current()==this)
-                       disable(GL_CLIP_PLANE0+planes.size());
-
-       }
-}
-
-void Clipping::detach(unsigned i)
-{
-       if(i<planes.size())
-               detach(*planes[i].plane);
 }
 
 const ProgramData &Clipping::get_shader_data() const
@@ -59,33 +38,5 @@ const ProgramData &Clipping::get_shader_data() const
        return shdata;
 }
 
-void Clipping::bind() const
-{
-       static Require _req(MSP_clipping);
-
-       const Clipping *old = current();
-       if(!set_current(this))
-               return;
-
-       for(unsigned i=0; i<planes.size(); ++i)
-               enable(GL_CLIP_PLANE0+i);
-
-       if(old)
-       {
-               for(unsigned i=planes.size(); i<old->planes.size(); ++i)
-                       disable(GL_CLIP_PLANE0+i);
-       }
-}
-
-void Clipping::unbind()
-{
-       const Clipping *old = current();
-       if(!set_current(0))
-               return;
-
-       for(unsigned i=0; i<old->planes.size(); ++i)
-               disable(GL_CLIP_PLANE0+i);
-}
-
 } // namespace GL
 } // namespace Msp