X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fclipping.cpp;h=d23ecffc0c2549c5eb2d3fe837213a63e99b337e;hb=e9a898f;hp=18b706e78b1b34e9205879acd51cf83d10ad9cbb;hpb=a275d25eccad43716c5dcf91f8bc4af2a53c0445;p=libs%2Fgl.git diff --git a/source/core/clipping.cpp b/source/core/clipping.cpp index 18b706e7..d23ecffc 100644 --- a/source/core/clipping.cpp +++ b/source/core/clipping.cpp @@ -1,10 +1,8 @@ #include -#include #include "clipping.h" #include "clipplane.h" +#include "deviceinfo.h" #include "error.h" -#include "matrix.h" -#include "misc.h" using namespace std; @@ -13,33 +11,24 @@ namespace GL { unsigned Clipping::get_n_attach_points() { - static Require _req(MSP_clipping); - static int count = get_i(GL_MAX_CLIP_PLANES); - return count; + 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()>=get_n_attach_points()) + if(planes.size()>=Limits::get_global().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) @@ -60,33 +49,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; 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