1 #include <msp/core/algorithm.h>
4 #include "deviceinfo.h"
12 unsigned Clipping::get_n_attach_points()
14 return Limits::get_global().max_clip_planes;
17 void Clipping::attach(const ClipPlane &p)
19 if(find_member(planes, &p, &AttachedPlane::plane)!=planes.end())
21 if(planes.size()>=Limits::get_global().max_clip_planes)
22 throw invalid_operation("Clipping::attach");
27 void Clipping::detach(const ClipPlane &p)
29 auto i = find_member(planes, &p, &AttachedPlane::plane);
34 void Clipping::detach(unsigned i)
37 detach(*planes[i].plane);
40 const ProgramData &Clipping::get_shader_data() const
42 for(unsigned i=0; i<planes.size(); ++i)
43 if(planes[i].plane->get_generation()!=planes[i].generation)
45 planes[i].plane->update_shader_data(shdata, i);
46 planes[i].generation = planes[i].plane->get_generation();