Open3D (C++ API)  0.18.0+0cf605f
RenderOption.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 
10 #include <Eigen/Core>
11 
13 
14 namespace open3d {
15 namespace visualization {
16 
21 public:
22  // Global options
24  Nearest = 0,
25  Linear = 1,
26  };
27 
28  enum class DepthFunc {
29  Never = 0,
30  Less = 1,
31  Equal = 2,
32  LEqual = 3,
33  Greater = 4,
34  NotEqual = 5,
35  GEqual = 6,
36  Always = 7
37  };
38 
42  enum class PointColorOption {
43  Default = 0,
44  Color = 1,
45  XCoordinate = 2,
46  YCoordinate = 3,
47  ZCoordinate = 4,
48  Normal = 9,
49  };
50 
51  const double POINT_SIZE_MAX = 25.0;
52  const double POINT_SIZE_MIN = 1.0;
53  const double POINT_SIZE_STEP = 1.0;
54  const double POINT_SIZE_DEFAULT = 5.0;
55  const double LINE_WIDTH_MAX = 10.0;
56  const double LINE_WIDTH_MIN = 1.0;
57  const double LINE_WIDTH_STEP = 1.0;
58  const double LINE_WIDTH_DEFAULT = 1.0;
59 
63  enum class MeshShadeOption {
64  FlatShade = 0,
65  SmoothShade = 1,
66  };
67 
71  enum class MeshColorOption {
72  Default = 0,
73  Color = 1,
74  XCoordinate = 2,
75  YCoordinate = 3,
76  ZCoordinate = 4,
77  Normal = 9,
78  };
79 
80  // Image options
81  enum class ImageStretchOption {
82  OriginalSize = 0,
83  StretchKeepRatio = 1,
85  };
86 
87 public:
90  // VS2013 does not fully support C++11
91  // Array initialization has to be done in constructors.
92  light_position_relative_[0] = Eigen::Vector3d(0, 0, 2);
93  light_position_relative_[1] = Eigen::Vector3d(0, 0, 2);
94  light_position_relative_[2] = Eigen::Vector3d(0, 0, -2);
95  light_position_relative_[3] = Eigen::Vector3d(0, 0, -2);
96  light_color_[0] = Eigen::Vector3d::Ones();
97  light_color_[1] = Eigen::Vector3d::Ones();
98  light_color_[2] = Eigen::Vector3d::Ones();
99  light_color_[3] = Eigen::Vector3d::Ones();
100  light_diffuse_power_[0] = 0.66;
101  light_diffuse_power_[1] = 0.66;
102  light_diffuse_power_[2] = 0.66;
103  light_diffuse_power_[3] = 0.66;
104  light_specular_power_[0] = 0.2;
105  light_specular_power_[1] = 0.2;
106  light_specular_power_[2] = 0.2;
107  light_specular_power_[3] = 0.2;
108  light_specular_shininess_[0] = 100.0;
109  light_specular_shininess_[1] = 100.0;
110  light_specular_shininess_[2] = 100.0;
111  light_specular_shininess_[3] = 100.0;
112  }
113  ~RenderOption() override {}
114 
115 public:
116  bool ConvertToJsonValue(Json::Value &value) const override;
117  bool ConvertFromJsonValue(const Json::Value &value) override;
118 
119 public:
124  } else {
126  }
127  }
128  void ChangePointSize(double change);
129  void SetPointSize(double size);
130  void ChangeLineWidth(double change);
135  } else {
137  }
138  }
141  }
144  }
148  } else if (image_stretch_option_ ==
151  } else {
153  }
154  }
155 
156  int GetGLDepthFunc() const;
157 
158 public:
159  // global options
161  Eigen::Vector3d background_color_ = Eigen::Vector3d::Ones();
165 
166  // Phong lighting options
168  bool light_on_ = true;
169  Eigen::Vector3d light_position_relative_[4];
170  Eigen::Vector3d light_color_[4];
171  Eigen::Vector3d light_ambient_color_ = Eigen::Vector3d::Zero();
175 
176  // PointCloud options
182  bool point_show_normal_ = false;
183 
184  // TriangleMesh options
190  bool mesh_show_back_face_ = false;
191 
192  bool mesh_show_wireframe_ = false;
193  Eigen::Vector3d default_mesh_color_ = Eigen::Vector3d(0.7, 0.7, 0.7);
194 
195  // LineSet options
198 
199  // Image options
202  int image_max_depth_ = 3000;
203 
204  // Coordinate frame
207 };
208 
209 } // namespace visualization
210 } // namespace open3d
Definition: IJsonConvertible.h:40
Defines rendering options for visualizer.
Definition: RenderOption.h:20
PointColorOption point_color_option_
Point color option for PointCloud.
Definition: RenderOption.h:180
void ChangeLineWidth(double change)
Definition: RenderOption.cpp:240
double line_width_
Line width for LineSet.
Definition: RenderOption.h:197
const double LINE_WIDTH_STEP
Definition: RenderOption.h:57
void ToggleImageStretchOption()
Definition: RenderOption.h:145
MeshColorOption mesh_color_option_
Color option for TriangleMesh.
Definition: RenderOption.h:188
RenderOption()
Default Constructor.
Definition: RenderOption.h:89
int GetGLDepthFunc() const
Definition: RenderOption.cpp:246
void ToggleLightOn()
Definition: RenderOption.h:120
double point_size_
Point size for PointCloud.
Definition: RenderOption.h:178
void ChangePointSize(double change)
Definition: RenderOption.cpp:230
ImageStretchOption image_stretch_option_
Definition: RenderOption.h:200
~RenderOption() override
Definition: RenderOption.h:113
ImageStretchOption
Definition: RenderOption.h:81
void ToggleMeshShowWireframe()
Definition: RenderOption.h:142
TextureInterpolationOption
Definition: RenderOption.h:23
bool ConvertToJsonValue(Json::Value &value) const override
Definition: RenderOption.cpp:20
double light_specular_shininess_[4]
Definition: RenderOption.h:174
DepthFunc depthFunc_
Definition: RenderOption.h:164
const double LINE_WIDTH_MAX
Definition: RenderOption.h:55
double light_specular_power_[4]
Definition: RenderOption.h:173
MeshColorOption
Enum class for color for TriangleMesh.
Definition: RenderOption.h:71
void ToggleMeshShowBackFace()
Definition: RenderOption.h:139
DepthFunc
Definition: RenderOption.h:28
const double POINT_SIZE_MIN
Definition: RenderOption.h:52
bool light_on_
Whether to turn on Phong lighting.
Definition: RenderOption.h:168
const double POINT_SIZE_MAX
Definition: RenderOption.h:51
void SetPointSize(double size)
Definition: RenderOption.cpp:236
bool point_show_normal_
Whether to show normal for PointCloud.
Definition: RenderOption.h:182
Eigen::Vector3d light_position_relative_[4]
Definition: RenderOption.h:169
const double LINE_WIDTH_MIN
Definition: RenderOption.h:56
void ToggleShadingOption()
Definition: RenderOption.h:132
const double POINT_SIZE_STEP
Definition: RenderOption.h:53
bool show_coordinate_frame_
Whether to show coordinate frame.
Definition: RenderOption.h:206
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: RenderOption.cpp:99
TextureInterpolationOption interpolation_option_
Definition: RenderOption.h:162
Eigen::Vector3d light_color_[4]
Definition: RenderOption.h:170
Eigen::Vector3d default_mesh_color_
Definition: RenderOption.h:193
const double POINT_SIZE_DEFAULT
Definition: RenderOption.h:54
MeshShadeOption
Enum class for mesh shading for TriangleMesh.
Definition: RenderOption.h:63
void ToggleInterpolationOption()
Definition: RenderOption.h:121
Eigen::Vector3d background_color_
Background RGB color.
Definition: RenderOption.h:161
MeshShadeOption mesh_shade_option_
Mesh shading option for TriangleMesh.
Definition: RenderOption.h:186
bool mesh_show_back_face_
Whether to show back faces for TriangleMesh.
Definition: RenderOption.h:190
const double LINE_WIDTH_DEFAULT
Definition: RenderOption.h:58
double light_diffuse_power_[4]
Definition: RenderOption.h:172
Eigen::Vector3d light_ambient_color_
Definition: RenderOption.h:171
int image_max_depth_
Definition: RenderOption.h:202
void TogglePointShowNormal()
Definition: RenderOption.h:131
PointColorOption
Enum class for point color for PointCloud.
Definition: RenderOption.h:42
bool mesh_show_wireframe_
Definition: RenderOption.h:192
int size
Definition: FilePCD.cpp:40
Definition: PinholeCameraIntrinsic.cpp:16