+++ /dev/null
-#include <stdexcept>
-#include "clipunit.h"
-#include "gl.h"
-#include "misc.h"
-
-using namespace std;
-
-namespace Msp {
-namespace GL {
-
-vector<ClipUnit> ClipUnit::units;
-
-ClipUnit::ClipUnit():
- index(0),
- plane(0)
-{ }
-
-bool ClipUnit::set_plane(const ClipPlane *p)
-{
- bool result = (p!=plane);
- plane = p;
- return result;
-}
-
-unsigned ClipUnit::get_n_units()
-{
- static int count = get_i(GL_MAX_CLIP_PLANES);
- return count;
-}
-
-ClipUnit &ClipUnit::get_unit(unsigned i)
-{
- if(i>=get_n_units())
- throw out_of_range("ClipUnit::get_unit");
-
- if(units.size()<=i)
- {
- unsigned j = units.size();
- units.resize(i+1, ClipUnit());
- for(; j<units.size(); ++j)
- units[j].index = j;
- }
-
- return units[i];
-}
-
-ClipUnit *ClipUnit::find_unit(const ClipPlane *p)
-{
- for(vector<ClipUnit>::iterator i=units.begin(); i!=units.end(); ++i)
- if(i->plane==p)
- return &*i;
- return 0;
-}
-
-} // namespace GL
-} // namespace Msp