36 #include <GLFW/glfw3.h> 41 #include <unordered_map> 42 #include <unordered_set> 57 namespace visualization {
66 bool is_mouse_left_button_down =
false;
67 bool is_mouse_middle_button_down =
false;
68 bool is_control_key_down =
false;
69 bool is_shift_key_down =
false;
70 bool is_alt_key_down =
false;
71 bool is_super_key_down =
false;
72 double mouse_position_x = 0.0;
73 double mouse_position_y = 0.0;
94 bool CreateVisualizerWindow(
const std::string &window_name =
"Open3D",
95 const int width = 640,
99 const bool visible =
true);
104 void DestroyVisualizerWindow();
111 void RegisterAnimationCallback(
112 std::function<
bool(
Visualizer *)> callback_func);
149 virtual bool AddGeometry(
150 std::shared_ptr<const geometry::Geometry> geometry_ptr,
151 bool reset_bounding_box =
true);
162 virtual bool RemoveGeometry(
163 std::shared_ptr<const geometry::Geometry> geometry_ptr,
164 bool reset_bounding_box =
true);
169 virtual bool ClearGeometries();
177 virtual bool UpdateGeometry(
178 std::shared_ptr<const geometry::Geometry> geometry_ptr =
nullptr);
179 virtual bool HasGeometry()
const;
182 virtual void UpdateRender();
185 virtual void SetFullScreen(
bool fullscreen);
186 virtual void ToggleFullScreen();
187 virtual bool IsFullScreen();
189 virtual void PrintVisualizerHelp();
190 virtual void UpdateWindowTitle();
191 virtual void BuildUtilities();
200 std::shared_ptr<geometry::Image> CaptureScreenFloatBuffer(
201 bool do_render =
true);
206 void CaptureScreenImage(
const std::string &filename =
"",
207 bool do_render =
true);
211 std::shared_ptr<geometry::Image> CaptureDepthFloatBuffer(
212 bool do_render =
true);
218 void CaptureDepthImage(
const std::string &filename =
"",
219 bool do_render =
true,
220 double depth_scale = 1000.0);
227 void CaptureDepthPointCloud(
const std::string &filename =
"",
228 bool do_render =
true,
229 bool convert_to_world_coordinate =
false);
230 void CaptureRenderOption(
const std::string &filename =
"");
232 void ResetViewPoint(
bool reset_bounding_box =
false);
238 virtual bool InitOpenGL();
241 virtual bool InitViewControl();
244 virtual bool InitRenderOption();
249 virtual void Render(
bool render_screen =
false);
251 void CopyViewStatusToClipboard();
253 void CopyViewStatusFromClipboard();
256 virtual void WindowRefreshCallback(GLFWwindow *window);
257 virtual void WindowResizeCallback(GLFWwindow *window,
int w,
int h);
258 virtual void MouseMoveCallback(GLFWwindow *window,
double x,
double y);
259 virtual void MouseScrollCallback(GLFWwindow *window,
double x,
double y);
260 virtual void MouseButtonCallback(GLFWwindow *window,
264 virtual void KeyPressCallback(
265 GLFWwindow *window,
int key,
int scancode,
int action,
int mods);
267 virtual void WindowCloseCallback(GLFWwindow *window);
271 GLFWwindow *window_ = NULL;
272 std::string window_name_ =
"Open3D";
273 Eigen::Vector2i saved_window_size_ = Eigen::Vector2i::Zero();
274 Eigen::Vector2i saved_window_pos_ = Eigen::Vector2i::Zero();
275 std::function<bool(Visualizer *)> animation_callback_func_ =
nullptr;
280 std::function<bool(Visualizer *)> animation_callback_func_in_loop_ =
285 bool is_redraw_required_ =
true;
286 bool is_initialized_ =
false;
302 std::unordered_set<std::shared_ptr<const geometry::Geometry>>
306 std::unordered_set<std::shared_ptr<glsl::GeometryRenderer>>
316 std::unordered_map<std::shared_ptr<glsl::GeometryRenderer>,
RenderOption>
321 std::shared_ptr<glsl::CoordinateFrameRenderer>
328 double pixel_to_screen_coordinate_ = 1.0;
std::vector< std::shared_ptr< const geometry::Geometry > > utility_ptrs_
Definition: Visualizer.h:310
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
Definition: Visualizer.h:313
std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > geometry_renderer_ptrs_
Definition: Visualizer.h:307
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
Definition: Visualizer.h:196
View controller for visualizer.
Definition: ViewControl.h:41
std::shared_ptr< glsl::CoordinateFrameRenderer > coordinate_frame_mesh_renderer_ptr_
Definition: Visualizer.h:322
std::unique_ptr< RenderOption > render_option_ptr_
Definition: Visualizer.h:299
unsigned int render_rgb_tex_
Definition: Visualizer.h:292
std::shared_ptr< geometry::TriangleMesh > coordinate_frame_mesh_ptr_
Definition: Visualizer.h:320
unsigned int render_fbo_
Definition: Visualizer.h:291
ViewControl & GetViewControl()
Function to retrieve the associated ViewControl.
Definition: Visualizer.h:194
Defines rendering options for visualizer.
Definition: RenderOption.h:39
std::unique_ptr< ViewControl > view_control_ptr_
Definition: Visualizer.h:296
GLuint vao_id_
Definition: Visualizer.h:287
std::unordered_set< std::shared_ptr< const geometry::Geometry > > geometry_ptrs_
Definition: Visualizer.h:303
const std::string & GetWindowName() const
Definition: Visualizer.h:234
Definition: PinholeCameraIntrinsic.cpp:35
The main Visualizer class.
Definition: Visualizer.h:62
MouseControl mouse_control_
Definition: Visualizer.h:284
Definition: Visualizer.h:64
int height
Definition: FilePCD.cpp:72
unsigned int render_depth_stencil_rbo_
Definition: Visualizer.h:293
std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOption > utility_renderer_opts_
Definition: Visualizer.h:317
int width
Definition: FilePCD.cpp:71