HIRO_DRAW
Computer Graphics Structures library
PointCloudRenderer.h
1 /*
2  Copyright (C) Skeletex Research, s.r.o. - All Rights Reserved
3  Unauthorized copying of this file, via any medium is strictly prohibited
4  Proprietary and confidential
5 */
6 #ifndef HIRO_DRAW_POINT_CLOUD_RENDERER_H
7 #define HIRO_DRAW_POINT_CLOUD_RENDERER_H
8 #include <GLW/UniformBuffer.h>
9 #include <HIRO_DRAW/ElementRenderer.h>
10 #include <HIRO_DRAW/ShaderApi.h>
11 
12 
13 
14 namespace cogs
15 {
16  class PointCloud;
17 }
18 
19 namespace hiro::draw
20 {
21 
23  struct HIRO_DRAW_API PointCloudStyle : public hiro::draw::Style
24  {
28  bool back_face_culling{ false };
30  float point_size{ 10.0f };
33 
35  bool display_normals{ false };
37  cogs::Color3f normal_color{ cogs::color::BLACK };
39  float normal_length{ 0.1f };
40 
42  bool ReadFromStream(std::istream &str) override;
44  void WriteToStream(std::ostream &str) override;
45  };
46 
47 
48 
50  class HIRO_DRAW_API PointCloudRenderer : public hiro::draw::ElementRenderer
51  {
52  public:
54  PointCloudRenderer() = default;
56  PointCloudRenderer(const cogs::PointCloud &pc);
57 
58  PointCloudRenderer(const hiro::draw::PointCloudRenderer &source) = delete;
59  PointCloudRenderer &operator=(const hiro::draw::PointCloudRenderer &source) = delete;
61  PointCloudRenderer &operator=(hiro::draw::PointCloudRenderer &&) noexcept = delete;
62  virtual ~PointCloudRenderer() = default;
63 
65  void Reset(const cogs::PointCloud &pc);
67  size_t GetPointCount() const;
69  void SetColors(const std::vector<cogs::Color3f> &colors);
70 
72  virtual bool IsCompatibileWithStyle(const hiro::draw::Style *style) override;
73 
74  protected:
76  virtual void OnRenderPoints() override;
78  virtual void OnRenderNormals() override;
79 
80  private:
82  glw::PArrayObject vao_;
84  glw::ArrayObject::BufferName color_buffer_{ glw::ArrayObject::INVALID_NAME };
85  };
86 
87 
88 
90  using PPointCloudStyle = std::shared_ptr<hiro::draw::PointCloudStyle>;
92  using PPointCloudRenderer = std::shared_ptr<hiro::draw::PointCloudRenderer>;
93 
94 }
95 
96 #endif /* !HIRO_DRAW_POINT_CLOUD_RENDERER_H */
Base class for rendering of geometry data.
Definition: ElementRenderer.h:120
Definition: MeshRenderer.h:13
Color is taken from the material.
Renderer used for rendering point clouds.
Definition: PointCloudRenderer.h:50
ColorSource
Available sources of color information.
Definition: ElementRenderer.h:19
Extensions for object visualization. Implements a higher level of OpenGL rendering.
Definition: API.h:20
Base class for setting rendering style of an arbitrary render object.
Definition: Renderer.h:27
Properties of a simple phong material.
Definition: ShaderApi.h:93
hiro::shader::Material material
Material setting for points.
Definition: PointCloudRenderer.h:26
Stylization of the rendered point cloud.
Definition: PointCloudRenderer.h:23
std::shared_ptr< hiro::draw::PointCloudRenderer > PPointCloudRenderer
Shared pointer to an object of the type PointCloudRenderer.
Definition: PointCloudRenderer.h:92
std::shared_ptr< hiro::draw::PointCloudStyle > PPointCloudStyle
Shared pointer to an object of the type PointCloudStyle.
Definition: PointCloudRenderer.h:90