17 #include <GLFW/glfw3.h>
22 #include <unordered_map>
23 #include <unordered_set>
38 namespace visualization {
76 const int width = 640,
80 const bool visible =
true);
93 std::function<
bool(
Visualizer *)> callback_func);
131 std::shared_ptr<const geometry::Geometry> geometry_ptr,
132 bool reset_bounding_box =
true);
144 std::shared_ptr<const geometry::Geometry> geometry_ptr,
145 bool reset_bounding_box =
true);
159 std::shared_ptr<const geometry::Geometry> geometry_ptr =
nullptr);
183 bool do_render =
true);
189 bool do_render =
true);
194 bool do_render =
true);
201 bool do_render =
true,
202 double depth_scale = 1000.0);
210 bool do_render =
true,
211 bool convert_to_world_coordinate =
false);
231 virtual void Render(
bool render_screen =
false);
247 GLFWwindow *window,
int key,
int scancode,
int action,
int mods);
284 std::unordered_set<std::shared_ptr<const geometry::Geometry>>
288 std::unordered_set<std::shared_ptr<glsl::GeometryRenderer>>
298 std::unordered_map<std::shared_ptr<glsl::GeometryRenderer>,
RenderOption>
303 std::shared_ptr<glsl::CoordinateFrameRenderer>
310 double pixel_to_screen_coordinate_ = 1.0;
Defines rendering options for visualizer.
Definition: RenderOption.h:20
View controller for visualizer.
Definition: ViewControl.h:23
The main Visualizer class.
Definition: Visualizer.h:43
void CaptureRenderOption(const std::string &filename="")
Definition: VisualizerRender.cpp:496
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
Definition: Visualizer.h:178
bool CreateVisualizerWindow(const std::string &window_name="Open3D", const int width=640, const int height=480, const int left=50, const int top=50, const bool visible=true)
Function to create a window and initialize GLFW.
Definition: Visualizer.cpp:71
virtual void BuildUtilities()
Definition: Visualizer.cpp:231
std::unique_ptr< RenderOption > render_option_ptr_
Definition: Visualizer.h:281
virtual void SetFullScreen(bool fullscreen)
Functions to change between fullscreen and windowed modes.
Definition: Visualizer.cpp:443
virtual bool ClearGeometries()
Definition: Visualizer.cpp:415
bool is_initialized_
Definition: Visualizer.h:268
std::unique_ptr< ViewControl > view_control_ptr_
Definition: Visualizer.h:278
GLuint vao_id_
Definition: Visualizer.h:269
GLuint render_fbo_
Definition: Visualizer.h:273
bool PollEvents()
Definition: Visualizer.cpp:283
void CaptureDepthImage(const std::string &filename="", bool do_render=true, double depth_scale=1000.0)
Definition: VisualizerRender.cpp:331
GLuint render_depth_stencil_rbo_
Definition: Visualizer.h:275
std::vector< std::shared_ptr< const geometry::Geometry > > utility_ptrs_
Definition: Visualizer.h:292
virtual void UpdateRender()
Function to inform render needed to be updated.
Definition: Visualizer.cpp:439
std::function< bool(Visualizer *)> animation_callback_func_in_loop_
Definition: Visualizer.h:262
Eigen::Vector2i saved_window_pos_
Definition: Visualizer.h:256
void CaptureDepthPointCloud(const std::string &filename="", bool do_render=true, bool convert_to_world_coordinate=false)
Function to capture and save local point cloud.
Definition: VisualizerRender.cpp:414
virtual bool InitOpenGL()
Function to initialize OpenGL.
Definition: VisualizerRender.cpp:29
virtual bool IsFullScreen()
Definition: Visualizer.cpp:471
Visualizer(const Visualizer &)=delete
void CaptureScreenImage(const std::string &filename="", bool do_render=true)
Function to capture and save a screen image.
Definition: VisualizerRender.cpp:213
void Run()
Function to activate the window.
Definition: Visualizer.cpp:249
virtual bool UpdateGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr=nullptr)
Function to update geometry.
Definition: Visualizer.cpp:425
std::shared_ptr< glsl::CoordinateFrameRenderer > coordinate_frame_mesh_renderer_ptr_
Definition: Visualizer.h:304
virtual bool AddGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr, bool reset_bounding_box=true)
Function to add geometry to the scene and create corresponding shaders.
Definition: Visualizer.cpp:296
Visualizer(Visualizer &&)=delete
virtual void MouseMoveCallback(GLFWwindow *window, double x, double y)
Definition: VisualizerCallback.cpp:25
virtual void Render(bool render_screen=false)
Definition: VisualizerRender.cpp:69
virtual void WindowResizeCallback(GLFWwindow *window, int w, int h)
Definition: VisualizerCallback.cpp:20
ViewControl & GetViewControl()
Function to retrieve the associated ViewControl.
Definition: Visualizer.h:175
std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOption > utility_renderer_opts_
Definition: Visualizer.h:299
virtual void WindowCloseCallback(GLFWwindow *window)
Function to notify the window to be closed.
Definition: VisualizerCallback.cpp:346
std::shared_ptr< geometry::Image > CaptureDepthFloatBuffer(bool do_render=true)
Definition: VisualizerRender.cpp:267
virtual bool InitViewControl()
Function to initialize ViewControl.
Definition: Visualizer.cpp:214
bool WaitEvents()
Function to process the event queue and return if the window is closed.
Definition: Visualizer.cpp:270
virtual bool InitRenderOption()
Function to initialize RenderOption.
Definition: Visualizer.cpp:220
std::unordered_set< std::shared_ptr< const geometry::Geometry > > geometry_ptrs_
Definition: Visualizer.h:285
std::string window_name_
Definition: Visualizer.h:254
virtual void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
Definition: VisualizerCallback.cpp:68
const std::string & GetWindowName() const
Definition: Visualizer.h:216
void CopyViewStatusFromClipboard()
Definition: VisualizerRender.cpp:159
virtual ~Visualizer()
Definition: Visualizer.cpp:64
void DestroyVisualizerWindow()
Function to destroy a window.
Definition: Visualizer.cpp:203
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
Definition: Visualizer.h:295
virtual bool RemoveGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr, bool reset_bounding_box=true)
Function to remove geometry from the scene.
Definition: Visualizer.cpp:391
virtual void MouseScrollCallback(GLFWwindow *window, double x, double y)
Definition: VisualizerCallback.cpp:63
GLuint render_rgb_tex_
Definition: Visualizer.h:274
virtual void UpdateWindowTitle()
Definition: Visualizer.cpp:225
void RegisterAnimationCallback(std::function< bool(Visualizer *)> callback_func)
Function to register a callback function for animation.
Definition: Visualizer.cpp:209
std::function< bool(Visualizer *)> animation_callback_func_
Definition: Visualizer.h:257
virtual void WindowRefreshCallback(GLFWwindow *window)
Definition: VisualizerCallback.cpp:13
Eigen::Vector2i saved_window_size_
Definition: Visualizer.h:255
virtual void ToggleFullScreen()
Definition: Visualizer.cpp:463
MouseControl mouse_control_
Definition: Visualizer.h:266
GLFWwindow * window_
Definition: Visualizer.h:253
virtual void PrintVisualizerHelp()
Definition: Visualizer.cpp:475
const ViewControl & GetViewControl() const
Definition: Visualizer.h:176
void Close()
Function to to notify the window to be closed.
Definition: Visualizer.cpp:265
std::shared_ptr< geometry::TriangleMesh > coordinate_frame_mesh_ptr_
Definition: Visualizer.h:302
std::shared_ptr< geometry::Image > CaptureScreenFloatBuffer(bool do_render=true)
Function to capture screen and store RGB in a float buffer.
Definition: VisualizerRender.cpp:176
virtual bool HasGeometry() const
Definition: Visualizer.cpp:441
bool is_redraw_required_
Definition: Visualizer.h:267
Visualizer()
Definition: Visualizer.cpp:62
virtual void KeyPressCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
Definition: VisualizerCallback.cpp:102
std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > geometry_renderer_ptrs_
Definition: Visualizer.h:289
Visualizer & operator=(const Visualizer &)=delete
void CopyViewStatusToClipboard()
Definition: VisualizerRender.cpp:145
void ResetViewPoint(bool reset_bounding_box=false)
Function to reset view point.
Definition: VisualizerRender.cpp:126
Definition: PinholeCameraIntrinsic.cpp:16
Definition: Visualizer.h:45
double mouse_position_x
Definition: Visualizer.h:53
bool is_control_key_down
Definition: Visualizer.h:49
bool is_mouse_left_button_down
Definition: Visualizer.h:47
double mouse_position_y
Definition: Visualizer.h:54
bool is_mouse_middle_button_down
Definition: Visualizer.h:48
bool is_super_key_down
Definition: Visualizer.h:52
bool is_shift_key_down
Definition: Visualizer.h:50
bool is_alt_key_down
Definition: Visualizer.h:51