X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fclipping.cpp;h=30d1f7c2db7dfeff09701f422baf9af2cc02526e;hb=271760e6099bf5f4ad90894697dab911c236a0a3;hp=18b706e78b1b34e9205879acd51cf83d10ad9cbb;hpb=a275d25eccad43716c5dcf91f8bc4af2a53c0445;p=libs%2Fgl.git diff --git a/source/core/clipping.cpp b/source/core/clipping.cpp index 18b706e7..30d1f7c2 100644 --- a/source/core/clipping.cpp +++ b/source/core/clipping.cpp @@ -1,51 +1,29 @@ #include -#include #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() -{ - static Require _req(MSP_clipping); - static int count = get_i(GL_MAX_CLIP_PLANES); - return count; -} - void Clipping::attach(const ClipPlane &p) { if(find_member(planes, &p, &AttachedPlane::plane)!=planes.end()) return; - if(planes.size()>=get_n_attach_points()) + 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::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(iplanes.size(); ++i) - disable(GL_CLIP_PLANE0+i); - } -} - -void Clipping::unbind() -{ - const Clipping *old = current(); - if(!set_current(0)) - return; - - for(unsigned i=0; iplanes.size(); ++i) - disable(GL_CLIP_PLANE0+i); -} - } // namespace GL } // namespace Msp