1 #pragma once |
|
2 #include "modelobject.h" |
|
3 |
|
4 class LDCylinder : public LDMatrixObject |
|
5 { |
|
6 public: |
|
7 static const LDObjectType SubclassType = LDObjectType::Cylinder; |
|
8 |
|
9 LDCylinder() = default; |
|
10 LDCylinder(int segments, int divisions, const Matrix& transformationMatrix, const Vertex& position); |
|
11 |
|
12 virtual LDObjectType type() const override |
|
13 { |
|
14 return SubclassType; |
|
15 } |
|
16 |
|
17 virtual QString asText() const override; |
|
18 virtual void getVertices(DocumentManager *context, QSet<Vertex>& verts) const override; |
|
19 bool isRasterizable() const override { return true; } |
|
20 void rasterize( |
|
21 DocumentManager* context, |
|
22 Winding parentWinding, |
|
23 Model& model, |
|
24 bool deep, |
|
25 bool render |
|
26 ) override; |
|
27 QVector<LDPolygon> rasterizePolygons(DocumentManager* context, Winding parentWinding) override; |
|
28 QString objectListText() const override; |
|
29 int triangleCount(DocumentManager*) const override { return 2 * m_segments; } |
|
30 QString typeName() const override { return "cylinder"; } |
|
31 void serialize(class Serializer& serializer) override; |
|
32 |
|
33 private: |
|
34 QString buildFilename() const; |
|
35 void buildPrimitiveBody(Model& model) const; |
|
36 |
|
37 int m_segments; |
|
38 int m_divisions; |
|
39 }; |
|