Open3D (C++ API)  0.18.0
GeometryRenderer.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
22 
23 namespace open3d {
24 namespace visualization {
25 
26 namespace glsl {
27 
29 public:
30  virtual ~GeometryRenderer() {}
31 
32 public:
33  virtual bool Render(const RenderOption &option,
34  const ViewControl &view) = 0;
35 
42  virtual bool AddGeometry(
43  std::shared_ptr<const geometry::Geometry> geometry_ptr) = 0;
44 
47  virtual bool UpdateGeometry() = 0;
48 
49  bool HasGeometry() const { return bool(geometry_ptr_); }
50  std::shared_ptr<const geometry::Geometry> GetGeometry() const {
51  return geometry_ptr_;
52  }
53 
55  std::shared_ptr<const geometry::Geometry> geometry_ptr) const {
56  return geometry_ptr_ == geometry_ptr;
57  }
58 
59  bool IsVisible() const { return is_visible_; }
60  void SetVisible(bool visible) { is_visible_ = visible; };
61 
62 protected:
63  std::shared_ptr<const geometry::Geometry> geometry_ptr_;
64  bool is_visible_ = true;
65 };
66 
68 public:
69  ~PointCloudRenderer() override {}
70 
71 public:
72  bool Render(const RenderOption &option, const ViewControl &view) override;
73  bool AddGeometry(
74  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
75  bool UpdateGeometry() override;
76 
77 protected:
82 };
83 
85 public:
87 
88 public:
89  bool Render(const RenderOption &option, const ViewControl &view) override;
90  bool AddGeometry(
91  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
92  bool UpdateGeometry() override;
93 
94 protected:
96 };
97 
99 public:
100  ~LineSetRenderer() override {}
101 
102 public:
103  bool Render(const RenderOption &option, const ViewControl &view) override;
104  bool AddGeometry(
105  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
106  bool UpdateGeometry() override;
107 
108 protected:
110 };
111 
113 public:
114  ~TetraMeshRenderer() override {}
115 
116 public:
117  bool Render(const RenderOption &option, const ViewControl &view) override;
118  bool AddGeometry(
119  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
120  bool UpdateGeometry() override;
121 
122 protected:
124 };
125 
127 public:
129 
130 public:
131  bool Render(const RenderOption &option, const ViewControl &view) override;
132  bool AddGeometry(
133  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
134  bool UpdateGeometry() override;
135 
136 protected:
138 };
139 
141 public:
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  ~TriangleMeshRenderer() 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:
172 };
173 
175 public:
176  ~VoxelGridRenderer() 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:
187 };
188 
190 public:
191  ~OctreeRenderer() override {}
192 
193 public:
194  bool Render(const RenderOption &option, const ViewControl &view) override;
195  bool AddGeometry(
196  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
197  bool UpdateGeometry() override;
198 
199 protected:
202 };
203 
205 public:
206  ~ImageRenderer() override {}
207 
208 public:
209  bool Render(const RenderOption &option, const ViewControl &view) override;
210  bool AddGeometry(
211  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
212  bool UpdateGeometry() override;
213 
214 protected:
216 };
217 
219 public:
220  ~RGBDImageRenderer() override {}
221 
222 public:
223  bool Render(const RenderOption &option, const ViewControl &view) override;
224  bool AddGeometry(
225  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
226  bool UpdateGeometry() override;
227 
228 protected:
230 };
231 
233 public:
235 
236 public:
237  bool Render(const RenderOption &option, const ViewControl &view) override;
238  bool AddGeometry(
239  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
240  bool UpdateGeometry() override;
241 
242 protected:
244 };
245 
247 public:
249 
250 public:
251  bool Render(const RenderOption &option, const ViewControl &view) override;
252  bool AddGeometry(
253  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
254  bool UpdateGeometry() override;
255 
256 protected:
259 };
260 
262 public:
264 
265 public:
266  bool Render(const RenderOption &option, const ViewControl &view) override;
267  bool AddGeometry(
268  std::shared_ptr<const geometry::Geometry> geometry_ptr) override;
269  bool UpdateGeometry() override;
270 
271 protected:
273 };
274 
275 } // namespace glsl
276 
277 } // namespace visualization
278 } // namespace open3d
Defines rendering options for visualizer.
Definition: RenderOption.h:20
View controller for visualizer.
Definition: ViewControl.h:23
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:208
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:215
~AxisAlignedBoundingBoxRenderer() override
Definition: GeometryRenderer.h:142
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:225
SimpleShaderForAxisAlignedBoundingBox simple_axis_aligned_bounding_box_shader_
Definition: GeometryRenderer.h:152
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:344
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:324
~CoordinateFrameRenderer() override
Definition: GeometryRenderer.h:234
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:332
PhongShaderForTriangleMesh phong_shader_
Definition: GeometryRenderer.h:243
Definition: GeometryRenderer.h:28
virtual bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr)=0
void SetVisible(bool visible)
Definition: GeometryRenderer.h:60
bool is_visible_
Definition: GeometryRenderer.h:64
std::shared_ptr< const geometry::Geometry > geometry_ptr_
Definition: GeometryRenderer.h:60
virtual ~GeometryRenderer()
Definition: GeometryRenderer.h:30
std::shared_ptr< const geometry::Geometry > GetGeometry() const
Definition: GeometryRenderer.h:50
bool HasGeometry() const
Definition: GeometryRenderer.h:49
virtual bool Render(const RenderOption &option, const ViewControl &view)=0
bool HasGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) const
Definition: GeometryRenderer.h:54
bool IsVisible() const
Definition: GeometryRenderer.h:59
Definition: GeometryRenderer.h:204
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:298
ImageShaderForImage image_shader_
Definition: GeometryRenderer.h:215
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:288
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:282
~ImageRenderer() override
Definition: GeometryRenderer.h:206
Definition: GeometryRenderer.h:98
SimpleShaderForLineSet simple_lineset_shader_
Definition: GeometryRenderer.h:109
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:144
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:150
~LineSetRenderer() override
Definition: GeometryRenderer.h:100
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:160
Definition: GeometryRenderer.h:189
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:138
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:113
SimpleShaderForOctreeLine simple_shader_for_octree_line_
Definition: GeometryRenderer.h:200
~OctreeRenderer() override
Definition: GeometryRenderer.h:191
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:128
SimpleShaderForOctreeFace simple_shader_for_octree_face_
Definition: GeometryRenderer.h:201
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:203
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:186
~OrientedBoundingBoxRenderer() override
Definition: GeometryRenderer.h:128
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:193
SimpleShaderForOrientedBoundingBox simple_oriented_bounding_box_shader_
Definition: GeometryRenderer.h:137
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:376
~PointCloudPickerRenderer() override
Definition: GeometryRenderer.h:263
PhongShaderForTriangleMesh phong_shader_
Definition: GeometryRenderer.h:272
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:424
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:414
PickingShaderForPointCloud picking_shader_
Definition: GeometryRenderer.h:95
~PointCloudPickingRenderer() override
Definition: GeometryRenderer.h:86
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:63
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:80
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:70
Definition: GeometryRenderer.h:67
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:23
PhongShaderForPointCloud phong_point_shader_
Definition: GeometryRenderer.h:79
SimpleBlackShaderForPointCloudNormal simpleblack_normal_shader_
Definition: GeometryRenderer.h:81
~PointCloudRenderer() override
Definition: GeometryRenderer.h:69
NormalShaderForPointCloud normal_point_shader_
Definition: GeometryRenderer.h:80
SimpleShaderForPointCloud simple_point_shader_
Definition: GeometryRenderer.h:78
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:45
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:55
Definition: GeometryRenderer.h:218
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:319
RGBDImageShaderForImage rgbd_image_shader_
Definition: GeometryRenderer.h:229
~RGBDImageRenderer() override
Definition: GeometryRenderer.h:220
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:303
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:309
ImageMaskShaderForImage image_mask_shader_
Definition: GeometryRenderer.h:258
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:370
~SelectionPolygonRenderer() override
Definition: GeometryRenderer.h:248
Simple2DShaderForSelectionPolygon simple2d_shader_
Definition: GeometryRenderer.h:257
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:360
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:349
Definition: GeometryRenderer.h:112
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:171
~TetraMeshRenderer() override
Definition: GeometryRenderer.h:114
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:181
SimpleShaderForTetraMesh simple_tetramesh_shader_
Definition: GeometryRenderer.h:123
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:165
Definition: GeometryRenderer.h:155
SimpleShaderForTriangleMesh simple_mesh_shader_
Definition: GeometryRenderer.h:166
TexturePhongShaderForTriangleMesh texture_phong_mesh_shader_
Definition: GeometryRenderer.h:169
~TriangleMeshRenderer() override
Definition: GeometryRenderer.h:157
TextureSimpleShaderForTriangleMesh texture_simple_mesh_shader_
Definition: GeometryRenderer.h:167
NormalShaderForTriangleMesh normal_mesh_shader_
Definition: GeometryRenderer.h:170
PhongShaderForTriangleMesh phong_mesh_shader_
Definition: GeometryRenderer.h:168
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:260
SimpleBlackShaderForTriangleMeshWireFrame simpleblack_wireframe_shader_
Definition: GeometryRenderer.h:171
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:230
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:272
Definition: GeometryRenderer.h:174
SimpleShaderForVoxelGridFace simple_shader_for_voxel_grid_face_
Definition: GeometryRenderer.h:186
~VoxelGridRenderer() override
Definition: GeometryRenderer.h:176
bool Render(const RenderOption &option, const ViewControl &view) override
Definition: GeometryRenderer.cpp:85
bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr) override
Definition: GeometryRenderer.cpp:97
SimpleShaderForVoxelGridLine simple_shader_for_voxel_grid_line_
Definition: GeometryRenderer.h:185
bool UpdateGeometry() override
Definition: GeometryRenderer.cpp:107
Definition: PinholeCameraIntrinsic.cpp:16