1 #include "triangle.h" |
1 #include "triangle.h" |
2 |
2 |
3 linetypes::Triangle::Triangle( |
3 ldraw::Triangle::Triangle( |
4 const glm::vec3& point_1, |
4 const glm::vec3& point_1, |
5 const glm::vec3& point_2, |
5 const glm::vec3& point_2, |
6 const glm::vec3& point_3, |
6 const glm::vec3& point_3, |
7 Color color_index) : |
7 Color color_index) : |
8 ColoredObject{color_index}, |
8 ColoredObject{color_index}, |
9 points{point_1, point_2, point_3} |
9 points{point_1, point_2, point_3} |
10 { |
10 { |
11 } |
11 } |
12 |
12 |
13 linetypes::Triangle::Triangle(const QVector<glm::vec3>& vertices, const Color color) : |
13 ldraw::Triangle::Triangle(const QVector<glm::vec3>& vertices, const Color color) : |
14 ColoredObject{color}, |
14 ColoredObject{color}, |
15 points{vertices[0], vertices[1], vertices[2]} |
15 points{vertices[0], vertices[1], vertices[2]} |
16 { |
16 { |
17 } |
17 } |
18 |
18 |
19 QVariant linetypes::Triangle::getProperty(const Property id) const |
19 QVariant ldraw::Triangle::getProperty(const Property id) const |
20 { |
20 { |
21 switch (id) |
21 switch (id) |
22 { |
22 { |
23 case Property::Point1: |
23 case Property::Point1: |
24 return QVariant::fromValue(points[0]); |
24 return QVariant::fromValue(points[0]); |
48 default: |
48 default: |
49 return ColoredObject::setProperty(id, value); |
49 return ColoredObject::setProperty(id, value); |
50 } |
50 } |
51 } |
51 } |
52 |
52 |
53 QString linetypes::Triangle::textRepresentation() const |
53 QString ldraw::Triangle::textRepresentation() const |
54 { |
54 { |
55 return utility::format("%1 %2 %3", |
55 return utility::format("%1 %2 %3", |
56 utility::vertexToStringParens(points[0]), |
56 utility::vertexToStringParens(points[0]), |
57 utility::vertexToStringParens(points[1]), |
57 utility::vertexToStringParens(points[1]), |
58 utility::vertexToStringParens(points[2])); |
58 utility::vertexToStringParens(points[2])); |
59 } |
59 } |
60 |
60 |
61 void linetypes::Triangle::getPolygons( |
61 void ldraw::Triangle::getPolygons( |
62 std::vector<gl::Polygon>& polygons, |
62 std::vector<gl::Polygon>& polygons, |
63 GetPolygonsContext* context) const |
63 GetPolygonsContext* context) const |
64 { |
64 { |
65 Q_UNUSED(context) |
65 Q_UNUSED(context) |
66 polygons.push_back(gl::triangle( |
66 polygons.push_back(gl::triangle( |