Helios++
Helios software for LiDAR simulations
VHStaticObjectAdapter.h
1 #ifdef PCL_BINDING
2 
3 #pragma once
4 
5 #include <assetloading/ScenePart.h>
6 
7 #include <pcl/common/common_headers.h>
8 #include <pcl/PolygonMesh.h>
9 
10 #include <vector>
11 #include <string>
12 
13 namespace visualhelios{
14 
15 using std::vector;
16 using std::string;
17 
26 protected:
27  // *** ATTRIBUTES *** //
28  // ******************** //
41  vector<pcl::Vertices> vertices;
47 
48 public:
49  // *** CONSTRUCTION / DESTRUCTION *** //
50  // ************************************ //
57  renderingNormals(true)
58  {}
59  virtual ~VHStaticObjectAdapter() = default;
60 
61 
62  // *** BUILDING *** //
63  // ****************** //
71  virtual void buildPolymesh();
83  virtual void constructPolymesh() = 0;
97  virtual void vertexToMesh(Vertex const & vertex) = 0;
98 
99  // *** UTILS *** //
100  // *************** //
109  virtual void addTriangleToPolymesh(Primitive *primitive, int &offset);
118  virtual void addVoxelToPolymesh(Primitive *primitive, int &offset);
119 
120  // *** GETTERS and SETTERS *** //
121  // ***************************** //
131  inline ScenePart & getStaticObj() {return staticObj;}
137  inline vector<pcl::Vertices> const & getVertices() const
138  {return vertices;}
143  inline string const & getId() const {return staticObj.mId;}
150  inline bool isRenderingNormals() const {return renderingNormals;}
157  inline void setRenderingNormals(bool const renderingNormals)
158  {this->renderingNormals = renderingNormals;}
159 
160 };
161 }
162 
163 
164 #endif
Abstract class defining the common behavior for all primitives.
Definition: Primitive.h:24
Class representing a scene part.
Definition: ScenePart.h:20
std::string mId
Identifier for the scene part.
Definition: ScenePart.h:91
Class representing a vertex.
Definition: Vertex.h:14
Abstract class defining core mechanisms to adapt static objects to the visual Helios context based on...
Definition: VHStaticObjectAdapter.h:25
vector< pcl::Vertices > vertices
Static object vertices connection specification through ordered indices for visualization purposes.
Definition: VHStaticObjectAdapter.h:41
virtual void vertexToMesh(Vertex const &vertex)=0
Add a vertex to the polymesh.
ScenePart & getStaticObj()
Obtain the static object.
Definition: VHStaticObjectAdapter.h:131
virtual void buildPolymesh()
Build the polygon mesh from static object primitives. This implies building corresponding vertices ve...
Definition: VHStaticObjectAdapter.cpp:13
void setRenderingNormals(bool const renderingNormals)
Enable or disable normals rendering for the static object.
Definition: VHStaticObjectAdapter.h:157
string const & getId() const
Obtain the ID of the static object.
Definition: VHStaticObjectAdapter.h:143
VHStaticObjectAdapter(ScenePart &staticObj)
Constructor for the visual Helios static object adapter.
Definition: VHStaticObjectAdapter.h:55
vector< pcl::Vertices > const & getVertices() const
Obtain the ordered vertices indices representing the static object.
Definition: VHStaticObjectAdapter.h:137
bool isRenderingNormals() const
Check whether the static object normals must be rendered or not.
Definition: VHStaticObjectAdapter.h:150
virtual void addTriangleToPolymesh(Primitive *primitive, int &offset)
Function to add triangle primitives to the polymesh during building time.
Definition: VHStaticObjectAdapter.cpp:51
virtual void addVoxelToPolymesh(Primitive *primitive, int &offset)
Function to add voxel primitives to the polymesh during building time.
Definition: VHStaticObjectAdapter.cpp:64
bool renderingNormals
Specify if the static object normals must be rendered (true) or not (false)
Definition: VHStaticObjectAdapter.h:46
virtual void constructPolymesh()=0
Instantiate the polymesh object.
ScenePart & staticObj
The adapted static object.
Definition: VHStaticObjectAdapter.h:33