kDB: Knowledge DataBase
Loading...
Searching...
No Matches
PointCloudGeometry.h
1#pragma once
2
3#include <Qt3DCore/QGeometry>
4#include <knowCore/Forward.h>
5
6namespace knowVis
7{
8 struct PointCloud
9 {
10 QByteArray data;
11 bool hasColor = false;
12 int points = 0;
13 void resize(int _points)
14 {
15 points = _points;
16 data.resize(_points * stride());
17 }
18 int stride() const { return sizeof(float) * (hasColor ? 7 : 3); }
19 void setValue(int _index, float _x, float _y, float _z, float _r = 0.0, float _g = 0.0,
20 float _b = 0.0, float _a = 1.0)
21 {
22 float* pt = reinterpret_cast<float*>(data.data() + _index * stride());
23 pt[0] = _x;
24 pt[1] = _y;
25 pt[2] = _z;
26 if(hasColor)
27 {
28 pt[3] = _r;
29 pt[4] = _g;
30 pt[5] = _b;
31 pt[6] = _a;
32 }
33 }
34 };
35 class PointCloudGeometry : public Qt3DCore::QGeometry
36 {
37 Q_OBJECT
38 public:
39 explicit PointCloudGeometry(QNode* parent = NULL);
41 void updateVertices();
42
43 void setPointCloud(const PointCloud& _pc);
44 PointCloud pointCloud() const;
45 private:
46 void updateAttributes();
47 private:
48 struct Private;
49 Private* const d;
50 };
51} // namespace knowVis
Definition PointCloudGeometry.h:36
Definition PointCloudGeometry.cpp:12
Definition PointCloudGeometry.h:9