Helios++
Helios software for LiDAR simulations
VHSceneCanvas.h
1 #ifdef PCL_BINDING
2 
3 #pragma once
4 
5 #include <visualhelios/VHNormalsCanvas.h>
6 #include <visualhelios/adapters/VHDynSceneAdapter.h>
7 #include <visualhelios/adapters/VHDynObjectXYZRGBAdapter.h>
8 
9 #include <memory>
10 
11 namespace visualhelios{
12 
13 using std::shared_ptr;
14 
22 protected:
23  // *** CONSTANTS *** //
24  // ******************* //
30  static double const cosPIeighth;
37  static double const camCoef;
38 
39  // *** ATTRIBUTES *** //
40  // ******************** //
44  shared_ptr<VHDynSceneAdapter<
47 
48 public:
49  // *** CONSTRUCTION / DESTRUCTION *** //
50  // ************************************ //
56  VHSceneCanvas(ds, "Visual Helios scene canvas")
57  {}
65  DynScene &ds,
66  string const title,
67  bool const normalsKeyboardCallbackEnabled=true,
68  bool const normalsUsageTextEnabled=true,
69  bool const renderingNormals=true,
70  float const normalMagnitude=0.2
71  );
72  virtual ~VHSceneCanvas() = default;
73 
74  // *** CANVAS METHODS *** //
75  // ************************ //
79  void configure() override;
83  void start() override;
87  void update() override;
88 
89  // *** NORMALS RENDERING METHODS *** //
90  // ************************************ //
95  void renderNormals(VHStaticObjectAdapter & staticObj) override;
100  void unrenderAllNormals() override;
101 
102 protected:
103  // *** U T I L S *** //
104  // ********************* //
163  void cameraFromScene();
170  void unrenderNormals(
171  size_t const m,
172  std::function<ScenePart&(size_t const)> get
173  );
181 
182 };
183 
184 }
185 
186 #endif
Dynamic scene base implementation.
Definition: DynScene.h:29
Class representing a scene part.
Definition: ScenePart.h:20
string const title
The title of the visual Helios canvas.
Definition: VHCanvas.h:36
Class providing concrete implementation of a VHDynObjectAdapter for a simple XYZ visualization with R...
Definition: VHDynObjectXYZRGBAdapter.h:20
Class defining core mechanisms to adapt dynamic scenes to the visual Helios context based on PCL and ...
Definition: VHDynSceneAdapter.h:30
Abstract class providing some behaviors and defining the interface for all canvas which deal with nor...
Definition: VHNormalsCanvas.h:16
bool normalsKeyboardCallbackEnabled
Specify if the keyboard callback to toggle normals visualization is enabled (true) or not (false)
Definition: VHNormalsCanvas.h:24
bool renderingNormals
Specify if the normals canvas must render normals (true) or not (false)
Definition: VHNormalsCanvas.h:34
float normalMagnitude
Specify the magnitude of normal vector for visualization.
Definition: VHNormalsCanvas.h:38
bool normalsUsageTextEnabled
Specify if the normals keyboard callback usage text is enabled (true) or not (false)
Definition: VHNormalsCanvas.h:29
Visual Helios Scene Canvas is a class which supports rendering a dynamic scene.
Definition: VHSceneCanvas.h:21
void cameraFromScene()
Set the camera position from the scene.
Definition: VHSceneCanvas.cpp:173
static double const camCoef
Definition: VHSceneCanvas.h:37
void addObjectToViewer(VHStaticObjectXYZRGBAdapter &obj)
Add given object to the viewer and render its normals if scene canvas is requested to render normals.
Definition: VHSceneCanvas.cpp:202
void unrenderAllNormals() override
Remove all rendered normals.
Definition: VHSceneCanvas.cpp:152
shared_ptr< VHDynSceneAdapter< VHStaticObjectXYZRGBAdapter, VHDynObjectXYZRGBAdapter > > dynScene
The dynamic scene that must be rendered.
Definition: VHSceneCanvas.h:46
void start() override
Definition: VHSceneCanvas.cpp:53
void update() override
Definition: VHSceneCanvas.cpp:70
void unrenderNormals(size_t const m, std::function< ScenePart &(size_t const)> get)
Unrender normals for objects obtained through given get function ranging in .
Definition: VHSceneCanvas.cpp:189
void renderNormals(VHStaticObjectAdapter &staticObj) override
Render normals for each primitive of given static object.
Definition: VHSceneCanvas.cpp:112
void configure() override
Definition: VHSceneCanvas.cpp:45
static double const cosPIeighth
Definition: VHSceneCanvas.h:30
VHSceneCanvas(DynScene &ds)
Default constructor for the visual Helios scene canvas.
Definition: VHSceneCanvas.h:55
Abstract class defining core mechanisms to adapt static objects to the visual Helios context based on...
Definition: VHStaticObjectAdapter.h:25
Definition: VHStaticObjectXYZRGBAdapter.h:9