2010-01-30 07:26:05 +03:00
|
|
|
#ifndef POLYSET_H_
|
|
|
|
#define POLYSET_H_
|
|
|
|
|
2013-03-28 01:50:25 +04:00
|
|
|
#include "Geometry.h"
|
2011-10-01 03:36:30 +04:00
|
|
|
#include "system-gl.h"
|
2010-01-30 07:26:05 +03:00
|
|
|
#include "grid.h"
|
2011-10-01 03:36:30 +04:00
|
|
|
#include "linalg.h"
|
2013-10-31 08:45:00 +04:00
|
|
|
#include "renderer.h"
|
2011-08-05 04:11:20 +04:00
|
|
|
#include <vector>
|
2012-02-14 04:43:38 +04:00
|
|
|
#include <string>
|
2010-01-30 07:26:05 +03:00
|
|
|
|
2013-03-28 01:50:25 +04:00
|
|
|
class PolySet : public Geometry
|
2010-01-30 07:26:05 +03:00
|
|
|
{
|
|
|
|
public:
|
2011-08-05 04:11:20 +04:00
|
|
|
typedef std::vector<Vector3d> Polygon;
|
|
|
|
std::vector<Polygon> polygons;
|
|
|
|
std::vector<Polygon> borders;
|
2010-01-30 07:26:05 +03:00
|
|
|
Grid3d<void*> grid;
|
|
|
|
|
|
|
|
bool is2d;
|
|
|
|
int convexity;
|
|
|
|
|
|
|
|
PolySet();
|
2013-10-31 08:45:00 +04:00
|
|
|
virtual ~PolySet();
|
2010-01-30 07:26:05 +03:00
|
|
|
|
2013-03-28 01:50:25 +04:00
|
|
|
virtual size_t memsize() const;
|
|
|
|
virtual BoundingBox getBoundingBox() const;
|
|
|
|
virtual std::string dump() const;
|
2013-10-31 08:45:00 +04:00
|
|
|
virtual unsigned int getDimension() const { return this->is2d ? 2 : 3; }
|
|
|
|
virtual unsigned int getConvexity() const {return this->convexity; }
|
2013-03-28 01:50:25 +04:00
|
|
|
|
2011-09-02 00:42:46 +04:00
|
|
|
bool empty() const { return polygons.size() == 0; }
|
2010-01-30 07:26:05 +03:00
|
|
|
void append_poly();
|
2011-08-05 04:11:20 +04:00
|
|
|
void append_vertex(double x, double y, double z = 0.0);
|
|
|
|
void insert_vertex(double x, double y, double z = 0.0);
|
2013-10-31 08:45:00 +04:00
|
|
|
void render_surface(Renderer::csgmode_e csgmode, const Transform3d &m, GLint *shaderinfo = NULL) const;
|
|
|
|
void render_edges(Renderer::csgmode_e csgmode) const;
|
2010-01-30 07:26:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|