306 void LDObject::move(const QVector3D& vector) |
306 void LDObject::move(const QVector3D& vector) |
307 { |
307 { |
308 if (hasMatrix()) |
308 if (hasMatrix()) |
309 { |
309 { |
310 LDMatrixObject* mo = static_cast<LDMatrixObject*> (this); |
310 LDMatrixObject* mo = static_cast<LDMatrixObject*> (this); |
311 mo->translate(vector); |
311 QMatrix4x4 matrix = mo->transformationMatrix(); |
|
312 matrix(0, 3) += vector.x(); |
|
313 matrix(1, 3) += vector.y(); |
|
314 matrix(2, 3) += vector.z(); |
|
315 mo->setTransformationMatrix(matrix); |
312 } |
316 } |
313 else |
317 else |
314 { |
318 { |
315 for (int i = 0; i < numVertices(); ++i) |
319 for (int i = 0; i < numVertices(); ++i) |
316 setVertex (i, vertex (i) + vector); |
320 setVertex (i, vertex (i) + vector); |