-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawingElements.cpp
83 lines (68 loc) · 1.92 KB
/
DrawingElements.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#define GL_SILENCE_DEPRECATION
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include "DrawingElements.h"
#include "BSpline.h"
#include "PNtriangle.h"
#include "SubdivisionCurve.h"
#include "Mesh3Triangulation.h"
SurfaceMeshDrawingElement::SurfaceMeshDrawingElement(Surface_mesh* mesh) : mesh(mesh) {}
SurfaceMeshDrawingElement::~SurfaceMeshDrawingElement()
{
delete mesh;
}
void SurfaceMeshDrawingElement::draw()
{
glLineWidth(10.0f);
glColor4f(0.5f, 0.0f, 0.0f, 0.5f);
BOOST_FOREACH(Surface_mesh::Face_index f, faces(*mesh)) {
glBegin(GL_LINE_LOOP);
CGAL::Vertex_around_face_iterator<Surface_mesh> vbegin, vend;
for (boost::tie(vbegin, vend) = vertices_around_face(mesh->halfedge(f), *mesh);
vbegin != vend;
++vbegin) {
const Point_3& p = mesh->point(*vbegin);
glVertex3f(p.x(), p.y(), p.z());
}
glEnd();
}
}
BSplineDrawingElement::BSplineDrawingElement(BSpline* bspline): bspline(bspline) {}
BSplineDrawingElement::~BSplineDrawingElement()
{
delete bspline;
}
void BSplineDrawingElement::draw()
{
bspline->drawSplineCurve();
}
PNtriangleDrawingElement::PNtriangleDrawingElement(PNtriangle* pntriangle): pntriangle(pntriangle) {}
PNtriangleDrawingElement::~PNtriangleDrawingElement()
{
delete pntriangle;
}
void PNtriangleDrawingElement::draw()
{
pntriangle->drawTriangle();
}
SubdivisionCurveDrawingElement::SubdivisionCurveDrawingElement(SubdivisionCurve* subdivisionCurve): subdivisionCurve(subdivisionCurve) {}
SubdivisionCurveDrawingElement::~SubdivisionCurveDrawingElement()
{
delete subdivisionCurve;
}
void SubdivisionCurveDrawingElement::draw()
{
subdivisionCurve->drawSubdivisionCurve();
}
Mesh3TriangulationDrawingElement::Mesh3TriangulationDrawingElement(Mesh3Triangulation* mesh3): mesh3(mesh3) {}
Mesh3TriangulationDrawingElement::~Mesh3TriangulationDrawingElement()
{
delete mesh3;
}
void Mesh3TriangulationDrawingElement::draw()
{
mesh3->draw();
}