Open3D (C++ API)
GeometryRenderer.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
38 
39 namespace open3d {
40 namespace visualization {
41 
42 namespace glsl {
43 
45 public:
46  virtual ~GeometryRenderer() {}
47 
48 public:
49  virtual bool Render(const RenderOption &option,
50  const ViewControl &view) = 0;
51 
58  virtual bool AddGeometry(
59  std::shared_ptr<const geometry::Geometry> geometry_ptr) = 0;
60 
63  virtual bool UpdateGeometry() = 0;
64 
65  bool HasGeometry() const { return bool(geometry_ptr_); }
66  std::shared_ptr<const geometry::Geometry> GetGeometry() const {
67  return geometry_ptr_;
68  }
69 
70  bool IsVisible() const { return is_visible_; }
71  void SetVisible(bool visible) { is_visible_ = visible; };
72 
73 protected:
74  std::shared_ptr<const geometry::Geometry> geometry_ptr_;
75  bool is_visible_ = true;
76 };
77 
79 public:
80  ~PointCloudRenderer() override {}
81 
82 public:
83  bool Render(const RenderOption &option, const ViewControl &view) override;
84  bool AddGeometry(
85  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
86  bool UpdateGeometry() override;
87 
88 protected:
93 };
94 
96 public:
98 
99 public:
100  bool Render(const RenderOption &option, const ViewControl &view) override;
101  bool AddGeometry(
102  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
103  bool UpdateGeometry() override;
104 
105 protected:
107 };
108 
110 public:
111  ~LineSetRenderer() override {}
112 
113 public:
114  bool Render(const RenderOption &option, const ViewControl &view) override;
115  bool AddGeometry(
116  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
117  bool UpdateGeometry() override;
118 
119 protected:
121 };
122 
124 public:
125  ~TriangleMeshRenderer() override {}
126 
127 public:
128  bool Render(const RenderOption &option, const ViewControl &view) override;
129  bool AddGeometry(
130  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
131  bool UpdateGeometry() override;
132 
133 protected:
138 };
139 
141 public:
142  ~VoxelGridRenderer() override {}
143 
144 public:
145  bool Render(const RenderOption &option, const ViewControl &view) override;
146  bool AddGeometry(
147  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
148  bool UpdateGeometry() override;
149 
150 protected:
153 };
154 
156 public:
157  ~OctreeRenderer() override {}
158 
159 public:
160  bool Render(const RenderOption &option, const ViewControl &view) override;
161  bool AddGeometry(
162  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
163  bool UpdateGeometry() override;
164 
165 protected:
168 };
169 
171 public:
172  ~ImageRenderer() override {}
173 
174 public:
175  bool Render(const RenderOption &option, const ViewControl &view) override;
176  bool AddGeometry(
177  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
178  bool UpdateGeometry() override;
179 
180 protected:
182 };
183 
185 public:
187 
188 public:
189  bool Render(const RenderOption &option, const ViewControl &view) override;
190  bool AddGeometry(
191  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
192  bool UpdateGeometry() override;
193 
194 protected:
196 };
197 
199 public:
201 
202 public:
203  bool Render(const RenderOption &option, const ViewControl &view) override;
204  bool AddGeometry(
205  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
206  bool UpdateGeometry() override;
207 
208 protected:
211 };
212 
214 public:
216 
217 public:
218  bool Render(const RenderOption &option, const ViewControl &view) override;
219  bool AddGeometry(
220  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
221  bool UpdateGeometry() override;
222 
223 protected:
225 };
226 
227 } // namespace glsl
228 
229 } // namespace visualization
230 } // namespace open3d
PickingShaderForPointCloud picking_shader_
Definition: GeometryRenderer.h:106
Definition: GeometryRenderer.h:170
SimpleBlackShaderForPointCloudNormal simpleblack_normal_shader_
Definition: GeometryRenderer.h:92
SimpleShaderForOctreeLine simple_shader_for_octree_line_
Definition: GeometryRenderer.h:166
~CoordinateFrameRenderer() override
Definition: GeometryRenderer.h:186
~SelectionPolygonRenderer() override
Definition: GeometryRenderer.h:200
NormalShaderForTriangleMesh normal_mesh_shader_
Definition: GeometryRenderer.h:136
Definition: GeometryRenderer.h:44
SimpleShaderForOctreeFace simple_shader_for_octree_face_
Definition: GeometryRenderer.h:167
PhongShaderForTriangleMesh phong_shader_
Definition: GeometryRenderer.h:195
virtual bool Render(const RenderOption &option, const ViewControl &view)=0
ImageMaskShaderForImage image_mask_shader_
Definition: GeometryRenderer.h:210
Definition: GeometryRenderer.h:78
SimpleShaderForLineSet simple_lineset_shader_
Definition: GeometryRenderer.h:120
std::shared_ptr< const geometry::Geometry > GetGeometry() const
Definition: GeometryRenderer.h:66
~PointCloudPickerRenderer() override
Definition: GeometryRenderer.h:215
Definition: ViewControl.h:38
SimpleShaderForVoxelGridFace simple_shader_for_voxel_grid_face_
Definition: GeometryRenderer.h:152
~PointCloudRenderer() override
Definition: GeometryRenderer.h:80
Definition: GeometryRenderer.h:123
Definition: GeometryRenderer.h:140
virtual bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr)=0
PhongShaderForTriangleMesh phong_shader_
Definition: GeometryRenderer.h:224
~ImageRenderer() override
Definition: GeometryRenderer.h:172
Simple2DShaderForSelectionPolygon simple2d_shader_
Definition: GeometryRenderer.h:209
PhongShaderForPointCloud phong_point_shader_
Definition: GeometryRenderer.h:90
~LineSetRenderer() override
Definition: GeometryRenderer.h:111
Definition: RenderOption.h:36
PhongShaderForTriangleMesh phong_mesh_shader_
Definition: GeometryRenderer.h:135
NormalShaderForPointCloud normal_point_shader_
Definition: GeometryRenderer.h:91
bool HasGeometry() const
Definition: GeometryRenderer.h:65
SimpleShaderForVoxelGridLine simple_shader_for_voxel_grid_line_
Definition: GeometryRenderer.h:151
bool IsVisible() const
Definition: GeometryRenderer.h:70
SimpleShaderForTriangleMesh simple_mesh_shader_
Definition: GeometryRenderer.h:134
Definition: PinholeCameraIntrinsic.cpp:34
Definition: GeometryRenderer.h:109
virtual ~GeometryRenderer()
Definition: GeometryRenderer.h:46
SimpleBlackShaderForTriangleMeshWireFrame simpleblack_wireframe_shader_
Definition: GeometryRenderer.h:137
std::shared_ptr< const geometry::Geometry > geometry_ptr_
Definition: GeometryRenderer.h:71
SimpleShaderForPointCloud simple_point_shader_
Definition: GeometryRenderer.h:89
void SetVisible(bool visible)
Definition: GeometryRenderer.h:71
~PointCloudPickingRenderer() override
Definition: GeometryRenderer.h:97
bool is_visible_
Definition: GeometryRenderer.h:75
~OctreeRenderer() override
Definition: GeometryRenderer.h:157
~TriangleMeshRenderer() override
Definition: GeometryRenderer.h:125
Definition: GeometryRenderer.h:155
ImageShaderForImage image_shader_
Definition: GeometryRenderer.h:181
~VoxelGridRenderer() override
Definition: GeometryRenderer.h:142