Open3D (C++ API)  0.12.0
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 
41 
42 namespace open3d {
43 namespace visualization {
44 
45 namespace glsl {
46 
48 public:
49  virtual ~GeometryRenderer() {}
50 
51 public:
52  virtual bool Render(const RenderOption &option,
53  const ViewControl &view) = 0;
54 
61  virtual bool AddGeometry(
62  std::shared_ptr<const geometry::Geometry> geometry_ptr) = 0;
63 
66  virtual bool UpdateGeometry() = 0;
67 
68  bool HasGeometry() const { return bool(geometry_ptr_); }
69  std::shared_ptr<const geometry::Geometry> GetGeometry() const {
70  return geometry_ptr_;
71  }
72 
74  std::shared_ptr<const geometry::Geometry> geometry_ptr) const {
75  return geometry_ptr_ == geometry_ptr;
76  }
77 
78  bool IsVisible() const { return is_visible_; }
79  void SetVisible(bool visible) { is_visible_ = visible; };
80 
81 protected:
82  std::shared_ptr<const geometry::Geometry> geometry_ptr_;
83  bool is_visible_ = true;
84 };
85 
87 public:
88  ~PointCloudRenderer() override {}
89 
90 public:
91  bool Render(const RenderOption &option, const ViewControl &view) override;
92  bool AddGeometry(
93  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
94  bool UpdateGeometry() override;
95 
96 protected:
101 };
102 
104 public:
106 
107 public:
108  bool Render(const RenderOption &option, const ViewControl &view) override;
109  bool AddGeometry(
110  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
111  bool UpdateGeometry() override;
112 
113 protected:
115 };
116 
118 public:
119  ~LineSetRenderer() override {}
120 
121 public:
122  bool Render(const RenderOption &option, const ViewControl &view) override;
123  bool AddGeometry(
124  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
125  bool UpdateGeometry() override;
126 
127 protected:
129 };
130 
132 public:
133  ~TetraMeshRenderer() override {}
134 
135 public:
136  bool Render(const RenderOption &option, const ViewControl &view) override;
137  bool AddGeometry(
138  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
139  bool UpdateGeometry() override;
140 
141 protected:
143 };
144 
146 public:
148 
149 public:
150  bool Render(const RenderOption &option, const ViewControl &view) override;
151  bool AddGeometry(
152  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
153  bool UpdateGeometry() override;
154 
155 protected:
157 };
158 
160 public:
162 
163 public:
164  bool Render(const RenderOption &option, const ViewControl &view) override;
165  bool AddGeometry(
166  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
167  bool UpdateGeometry() override;
168 
169 protected:
172 };
173 
175 public:
176  ~TriangleMeshRenderer() override {}
177 
178 public:
179  bool Render(const RenderOption &option, const ViewControl &view) override;
180  bool AddGeometry(
181  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
182  bool UpdateGeometry() override;
183 
184 protected:
191 };
192 
194 public:
195  ~VoxelGridRenderer() override {}
196 
197 public:
198  bool Render(const RenderOption &option, const ViewControl &view) override;
199  bool AddGeometry(
200  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
201  bool UpdateGeometry() override;
202 
203 protected:
206 };
207 
209 public:
210  ~OctreeRenderer() override {}
211 
212 public:
213  bool Render(const RenderOption &option, const ViewControl &view) override;
214  bool AddGeometry(
215  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
216  bool UpdateGeometry() override;
217 
218 protected:
221 };
222 
224 public:
225  ~ImageRenderer() override {}
226 
227 public:
228  bool Render(const RenderOption &option, const ViewControl &view) override;
229  bool AddGeometry(
230  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
231  bool UpdateGeometry() override;
232 
233 protected:
235 };
236 
238 public:
239  ~RGBDImageRenderer() override {}
240 
241 public:
242  bool Render(const RenderOption &option, const ViewControl &view) override;
243  bool AddGeometry(
244  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
245  bool UpdateGeometry() override;
246 
247 protected:
249 };
250 
252 public:
254 
255 public:
256  bool Render(const RenderOption &option, const ViewControl &view) override;
257  bool AddGeometry(
258  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
259  bool UpdateGeometry() override;
260 
261 protected:
263 };
264 
266 public:
268 
269 public:
270  bool Render(const RenderOption &option, const ViewControl &view) override;
271  bool AddGeometry(
272  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
273  bool UpdateGeometry() override;
274 
275 protected:
278 };
279 
281 public:
283 
284 public:
285  bool Render(const RenderOption &option, const ViewControl &view) override;
286  bool AddGeometry(
287  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
288  bool UpdateGeometry() override;
289 
290 protected:
292 };
293 
294 } // namespace glsl
295 
296 } // namespace visualization
297 } // namespace open3d
~RGBDImageRenderer() override
Definition: GeometryRenderer.h:239
Definition: GeometryRenderer.h:131
PickingShaderForPointCloud picking_shader_
Definition: GeometryRenderer.h:114
Definition: GeometryRenderer.h:223
SimpleBlackShaderForPointCloudNormal simpleblack_normal_shader_
Definition: GeometryRenderer.h:100
SimpleShaderForOctreeLine simple_shader_for_octree_line_
Definition: GeometryRenderer.h:219
~CoordinateFrameRenderer() override
Definition: GeometryRenderer.h:253
TextureSimpleShaderForTriangleMesh texture_simple_mesh_shader_
Definition: GeometryRenderer.h:186
~SelectionPolygonRenderer() override
Definition: GeometryRenderer.h:267
NormalShaderForTriangleMesh normal_mesh_shader_
Definition: GeometryRenderer.h:189
Definition: GeometryRenderer.h:47
SimpleShaderForOctreeFace simple_shader_for_octree_face_
Definition: GeometryRenderer.h:220
Definition: GeometryRenderer.h:237
PhongShaderForTriangleMesh phong_shader_
Definition: GeometryRenderer.h:262
virtual bool Render(const RenderOption &option, const ViewControl &view)=0
SimpleShaderForTetraMesh simple_tetramesh_shader_
Definition: GeometryRenderer.h:142
ImageMaskShaderForImage image_mask_shader_
Definition: GeometryRenderer.h:277
Definition: GeometryRenderer.h:86
RGBDImageShaderForImage rgbd_image_shader_
Definition: GeometryRenderer.h:248
SimpleShaderForLineSet simple_lineset_shader_
Definition: GeometryRenderer.h:128
std::shared_ptr< const geometry::Geometry > GetGeometry() const
Definition: GeometryRenderer.h:69
~PointCloudPickerRenderer() override
Definition: GeometryRenderer.h:282
View controller for visualizer.
Definition: ViewControl.h:41
SimpleShaderForVoxelGridFace simple_shader_for_voxel_grid_face_
Definition: GeometryRenderer.h:205
~PointCloudRenderer() override
Definition: GeometryRenderer.h:88
SimpleShaderForAxisAlignedBoundingBox simple_axis_aligned_bounding_box_shader_
Definition: GeometryRenderer.h:171
Definition: GeometryRenderer.h:174
Definition: GeometryRenderer.h:193
virtual bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr)=0
~TetraMeshRenderer() override
Definition: GeometryRenderer.h:133
PhongShaderForTriangleMesh phong_shader_
Definition: GeometryRenderer.h:291
~ImageRenderer() override
Definition: GeometryRenderer.h:225
Simple2DShaderForSelectionPolygon simple2d_shader_
Definition: GeometryRenderer.h:276
PhongShaderForPointCloud phong_point_shader_
Definition: GeometryRenderer.h:98
~LineSetRenderer() override
Definition: GeometryRenderer.h:119
bool HasGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) const
Definition: GeometryRenderer.h:73
Defines rendering options for visualizer.
Definition: RenderOption.h:39
PhongShaderForTriangleMesh phong_mesh_shader_
Definition: GeometryRenderer.h:187
NormalShaderForPointCloud normal_point_shader_
Definition: GeometryRenderer.h:99
bool HasGeometry() const
Definition: GeometryRenderer.h:68
~OrientedBoundingBoxRenderer() override
Definition: GeometryRenderer.h:147
~AxisAlignedBoundingBoxRenderer() override
Definition: GeometryRenderer.h:161
SimpleShaderForVoxelGridLine simple_shader_for_voxel_grid_line_
Definition: GeometryRenderer.h:204
bool IsVisible() const
Definition: GeometryRenderer.h:78
SimpleShaderForTriangleMesh simple_mesh_shader_
Definition: GeometryRenderer.h:185
Definition: PinholeCameraIntrinsic.cpp:35
Definition: GeometryRenderer.h:117
virtual ~GeometryRenderer()
Definition: GeometryRenderer.h:49
SimpleBlackShaderForTriangleMeshWireFrame simpleblack_wireframe_shader_
Definition: GeometryRenderer.h:190
SimpleShaderForOrientedBoundingBox simple_oriented_bounding_box_shader_
Definition: GeometryRenderer.h:156
std::shared_ptr< const geometry::Geometry > geometry_ptr_
Definition: GeometryRenderer.h:79
SimpleShaderForPointCloud simple_point_shader_
Definition: GeometryRenderer.h:97
void SetVisible(bool visible)
Definition: GeometryRenderer.h:79
~PointCloudPickingRenderer() override
Definition: GeometryRenderer.h:105
bool is_visible_
Definition: GeometryRenderer.h:83
~OctreeRenderer() override
Definition: GeometryRenderer.h:210
~TriangleMeshRenderer() override
Definition: GeometryRenderer.h:176
Definition: GeometryRenderer.h:208
ImageShaderForImage image_shader_
Definition: GeometryRenderer.h:234
TexturePhongShaderForTriangleMesh texture_phong_mesh_shader_
Definition: GeometryRenderer.h:188
~VoxelGridRenderer() override
Definition: GeometryRenderer.h:195