70 virtual bool hasMatrix() const; // Does this object have a matrix and position? (see LDMatrixObject) |
70 virtual bool hasMatrix() const; // Does this object have a matrix and position? (see LDMatrixObject) |
71 virtual bool isColored() const; |
71 virtual bool isColored() const; |
72 bool isHidden() const; |
72 bool isHidden() const; |
73 virtual bool isRasterizable() const { return false; } // Can this object be rasterized? |
73 virtual bool isRasterizable() const { return false; } // Can this object be rasterized? |
74 virtual bool isScemantic() const; // Does this object have meaning in the part model? |
74 virtual bool isScemantic() const; // Does this object have meaning in the part model? |
75 void move (const QVector3D vector); |
75 void move (const QVector3D& vector); |
76 virtual int numVertices() const; |
76 virtual int numVertices() const; |
77 virtual int numPolygonVertices() const; |
77 virtual int numPolygonVertices() const; |
78 virtual QString objectListText() const; |
78 virtual QString objectListText() const; |
79 QColor randomColor() const; |
79 QColor randomColor() const; |
80 virtual void rasterize(DocumentManager*, Winding, Model&, bool, bool) {} |
80 virtual void rasterize(DocumentManager*, Winding, Model&, bool, bool) {} |
115 */ |
115 */ |
116 class LDMatrixObject : public LDObject |
116 class LDMatrixObject : public LDObject |
117 { |
117 { |
118 public: |
118 public: |
119 LDMatrixObject() = default; |
119 LDMatrixObject() = default; |
120 LDMatrixObject(const Matrix& transformationMatrix, const Vertex& pos); |
120 LDMatrixObject(const QMatrix4x4& matrix); |
121 |
121 |
122 bool hasMatrix() const override { return true; } |
122 bool hasMatrix() const override { return true; } |
123 const Vertex& position() const; |
123 Vertex position() const; |
124 void setCoordinate (const Axis ax, double value); |
124 void setTransformationMatrix(const QMatrix4x4& newMatrix); |
125 void setPosition (const Vertex& a); |
125 const QMatrix4x4& transformationMatrix() const; |
126 void setTransformationMatrix (const Matrix& value); |
126 void translate(const QVector3D& offset); |
127 const Matrix& transformationMatrix() const; |
|
128 void serialize(class Serializer& serializer) override; |
127 void serialize(class Serializer& serializer) override; |
129 |
128 |
130 protected: |
129 protected: |
131 bool shouldInvert(Winding winding, DocumentManager* context); |
130 bool shouldInvert(Winding winding, DocumentManager* context); |
132 |
131 |
133 private: |
132 private: |
134 Vertex m_position; |
133 QMatrix4x4 m_transformationMatrix; |
135 Matrix m_transformationMatrix = Matrix::identity; |
|
136 }; |
134 }; |
137 |
135 |
138 /* |
136 /* |
139 * Represents a line in the LDraw file that could not be properly parsed. |
137 * Represents a line in the LDraw file that could not be properly parsed. |
140 */ |
138 */ |
169 { |
167 { |
170 public: |
168 public: |
171 static const LDObjectType SubclassType = LDObjectType::SubfileReference; |
169 static const LDObjectType SubclassType = LDObjectType::SubfileReference; |
172 |
170 |
173 LDSubfileReference() = default; |
171 LDSubfileReference() = default; |
174 LDSubfileReference(QString referenceName, const Matrix& transformationMatrix, const Vertex& position); |
172 LDSubfileReference(QString referenceName, const QMatrix4x4& matrix = {}); |
175 |
173 |
176 virtual LDObjectType type() const override |
174 virtual LDObjectType type() const override |
177 { |
175 { |
178 return SubclassType; |
176 return SubclassType; |
179 } |
177 } |