PointCloud.hpp
Go to the documentation of this file.
1 
28  /*
29  * PointCloud.hpp
30  *
31  * Created on: 20.08.2011
32  * Author: Thomas Wiemann
33  */
34 
35 #ifndef POINTCLOUD_H_
36 #define POINTCLOUD_H_
37 
39 
41 
42 #include <vector>
43 #include <string>
44 #include <fstream>
45 
46 
47 using namespace std;
48 
49 
50 namespace lvr2
51 {
52 
53 enum
54 {
55  RenderPoints = 0x01,
56  RenderNormals = 0x02,
57 };
58 
59 class PointCloud : public Renderable{
60 public:
62  PointCloud();
63  PointCloud(ModelPtr loader, string name = "<unamed cloud>");
64  PointCloud(PointBufferPtr buffer, string name = "<unamed cloud>");
65 
66  virtual ~PointCloud();
67  virtual inline void render();
68 
69  vector<uColorVertex> getPoints(){return m_points;};
70  void setPoints(){};
71 
72  void addPoint(float x, float y, float z, unsigned char r, unsigned char g, unsigned char b)
73  {
74  m_boundingBox->expand(Vec(x, y, z));
75  m_points.push_back(uColorVertex(x, y, z, r, g, b));
76  };
77 
78  void addPoint(const uColorVertex& v)
79  {
80  m_boundingBox->expand(Vec(v.x, v.y, v.z));
81  m_points.push_back(v);
82  };
83 
84  void clear(){
85  delete m_boundingBox;
86  m_boundingBox = new BoundingBox<Vec>;
87  m_points.clear();
88  };
89 
90  void updateBuffer(PointBufferPtr buffer);
91 
92  void updateDisplayLists();
93 //private:
94  vector<uColorVertex> m_points;
95 
96  void setRenderMode(int mode) {m_renderMode = mode;}
97 
98 
99 private:
100  int getFieldsPerLine(string filename);
101  void init(PointBufferPtr buffer);
102 
106  size_t m_numNormals;
107 
108 };
109 
110 inline void PointCloud::render()
111 {
112  //cout << name << " : Active: " << " " << active << " selected : " << selected << endl;
113  if(m_listIndex != -1 && m_active)
114  {
115  // Increase point size if normal rendering is enabled
116  if(m_renderMode & RenderNormals)
117  {
118  glPointSize(5.0);
119  }
120  else
121  {
122  glPointSize(m_pointSize);
123  }
124  glDisable(GL_LIGHTING);
125  glPushMatrix();
126  glMultMatrixf(m_transformation.getData());
127 
128  // Render points
129  if(m_selected)
130  {
131  glCallList(m_activeListIndex);
132  }
133  else
134  {
135  glCallList(m_listIndex);
136  }
137 
138  // Render normals
139  if(m_renderMode & RenderNormals)
140  {
141  glCallList(m_normalListIndex);
142  }
143  glPointSize(1.0);
144  glEnable(GL_LIGHTING);
145  glPopMatrix();
146  }
147 }
148 
149 } // namespace lvr2
150 
151 #endif /* POINTCLOUD_H_ */
lvr2::floatArr
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
lvr2::RenderNormals
@ RenderNormals
Definition: PointCloud.hpp:56
lvr2::PointCloud::m_renderMode
int m_renderMode
Definition: PointCloud.hpp:103
lvr2::PointCloud::clear
void clear()
Definition: PointCloud.hpp:84
lvr2::PointCloud::m_numNormals
size_t m_numNormals
Definition: PointCloud.hpp:106
lvr2::Vec
BaseVector< float > Vec
Definition: TexturedMesh.hpp:44
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
lvr2::PointCloud::m_normals
floatArr m_normals
Definition: PointCloud.hpp:105
lvr2::PointCloud::setPoints
void setPoints()
Definition: PointCloud.hpp:70
render
void render()
lvr2::BaseVector::x
CoordT x
Definition: BaseVector.hpp:65
ColorVertex.hpp
lvr2::PointCloud::getPoints
vector< uColorVertex > getPoints()
Definition: PointCloud.hpp:69
lvr2::RenderPoints
@ RenderPoints
Definition: PointCloud.hpp:55
lvr2::PointCloud::addPoint
void addPoint(const uColorVertex &v)
Definition: PointCloud.hpp:78
lvr2::BaseVector::y
CoordT y
Definition: BaseVector.hpp:66
scripts.normalize_multiple.filename
filename
Definition: normalize_multiple.py:60
lvr2::Renderable
Definition: Renderable.hpp:65
Renderable.hpp
lvr2::PointCloud
Definition: PointCloud.hpp:59
lvr2::PointCloud::setRenderMode
void setRenderMode(int mode)
Definition: PointCloud.hpp:96
lvr2::BoundingBox
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
lvr2::BaseVector::z
CoordT z
Definition: BaseVector.hpp:67
std
Definition: HalfEdge.hpp:124
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::ModelPtr
std::shared_ptr< Model > ModelPtr
Definition: Model.hpp:80
lvr2::PointCloud::m_normalListIndex
GLuint m_normalListIndex
Definition: PointCloud.hpp:104
lvr2::PointCloud::m_points
vector< uColorVertex > m_points
Definition: PointCloud.hpp:94
lvr2::ColorVertex
A color vertex.
Definition: ColorVertex.hpp:50
lvr2::uColorVertex
ColorVertex< float, unsigned char > uColorVertex
Definition: ColorVertex.hpp:163
lvr2::PointCloud::addPoint
void addPoint(float x, float y, float z, unsigned char r, unsigned char g, unsigned char b)
Definition: PointCloud.hpp:72


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24