1 #include <msp/core/algorithm.h>
4 #include "deviceinfo.h"
13 unsigned Clipping::get_n_attach_points()
15 return Limits::get_global().max_clip_planes;
18 void Clipping::attach(const ClipPlane &p)
20 if(find_member(planes, &p, &AttachedPlane::plane)!=planes.end())
22 if(planes.size()>=Limits::get_global().max_clip_planes)
23 throw invalid_operation("Clipping::attach");
28 void Clipping::detach(const ClipPlane &p)
30 vector<AttachedPlane>::iterator i = find_member(planes, &p, &AttachedPlane::plane);
35 void Clipping::detach(unsigned i)
38 detach(*planes[i].plane);
41 const ProgramData &Clipping::get_shader_data() const
43 for(unsigned i=0; i<planes.size(); ++i)
44 if(planes[i].plane->get_generation()!=planes[i].generation)
46 planes[i].plane->update_shader_data(shdata, i);
47 planes[i].generation = planes[i].plane->get_generation();