Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/3dview/linemesh.cpp
Show All 15 Lines | 1 | /* Atelier KDE Printer Host for 3D Printing | |||
---|---|---|---|---|---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | GNU General Public License for more details. | 17 | GNU General Public License for more details. | ||
18 | 18 | | |||
19 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include <QGeometryRenderer> | 23 | #include <QGeometryRenderer> | ||
24 | #include <QVector3D> | | |||
25 | #include <QVector4D> | 24 | #include <QVector4D> | ||
26 | #include "gcodeto4d.h" | 25 | #include "gcodeto4d.h" | ||
27 | #include "linemesh.h" | 26 | #include "linemesh.h" | ||
28 | #include "linemeshgeometry.h" | 27 | #include "linemeshgeometry.h" | ||
29 | 28 | | |||
30 | LineMesh::LineMesh(Qt3DCore::QNode *parent) : | 29 | LineMesh::LineMesh(Qt3DCore::QNode *parent) : | ||
31 | Qt3DRender::QGeometryRenderer(parent) | 30 | Qt3DRender::QGeometryRenderer(parent) | ||
32 | , _lineMeshGeo(nullptr) | 31 | , _lineMeshGeo(nullptr) | ||
Show All 30 Lines | 60 | std::transform(pos.cbegin(), pos.cend(), | |||
63 | [](const QVector4D & x) { | 62 | [](const QVector4D & x) { | ||
64 | return x.toVector3D(); | 63 | return x.toVector3D(); | ||
65 | }); | 64 | }); | ||
66 | 65 | | |||
67 | _lineMeshGeo = new LineMeshGeometry(vertices, this); | 66 | _lineMeshGeo = new LineMeshGeometry(vertices, this); | ||
68 | setVertexCount(_lineMeshGeo->vertexCount()); | 67 | setVertexCount(_lineMeshGeo->vertexCount()); | ||
69 | setGeometry(_lineMeshGeo); | 68 | setGeometry(_lineMeshGeo); | ||
70 | emit finished(); | 69 | emit finished(); | ||
70 | emit centerChanged(center()); | ||||
71 | } | ||||
72 | | ||||
73 | QVector3D LineMesh::center() | ||||
74 | { | ||||
75 | return _lineMeshGeo ? _lineMeshGeo->center() : QVector3D(); | ||||
71 | } | 76 | } |