17 #include <GLFW/glfw3.h>
22 #include <unordered_map>
23 #include <unordered_set>
38 namespace visualization {
78 const int width = 640,
82 const bool visible =
true);
95 std::function<
bool(
Visualizer *)> callback_func);
134 std::shared_ptr<const geometry::Geometry> geometry_ptr,
135 bool reset_bounding_box =
true);
148 std::shared_ptr<const geometry::Geometry> geometry_ptr,
149 bool reset_bounding_box =
true);
163 std::shared_ptr<const geometry::Geometry> geometry_ptr =
nullptr);
186 bool do_render =
true);
192 bool do_render =
true);
197 bool do_render =
true);
204 bool do_render =
true,
205 double depth_scale = 1000.0);
213 bool do_render =
true,
214 bool convert_to_world_coordinate =
false);
241 virtual void Render(
bool render_screen =
false);
259 GLFWwindow *window,
int key,
int scancode,
int action,
int mods);
300 std::unordered_set<std::shared_ptr<const geometry::Geometry>>
304 std::unordered_set<std::shared_ptr<glsl::GeometryRenderer>>
314 std::unordered_map<std::shared_ptr<glsl::GeometryRenderer>,
RenderOption>
319 std::shared_ptr<glsl::CoordinateFrameRenderer>
326 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:45
void CaptureRenderOption(const std::string &filename="")
Definition: VisualizerRender.cpp:502
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
Definition: Visualizer.h:181
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:85
virtual void BuildUtilities()
Definition: Visualizer.cpp:256
std::unique_ptr< RenderOption > render_option_ptr_
Definition: Visualizer.h:297
virtual void SetFullScreen(bool fullscreen)
Functions to change between fullscreen and windowed modes.
Definition: Visualizer.cpp:468
virtual bool ClearGeometries()
Definition: Visualizer.cpp:440
bool is_initialized_
Definition: Visualizer.h:284
std::unique_ptr< ViewControl > view_control_ptr_
Definition: Visualizer.h:294
GLuint vao_id_
Definition: Visualizer.h:285
GLuint render_fbo_
Definition: Visualizer.h:289
bool PollEvents()
Definition: Visualizer.cpp:308
std::shared_ptr< GLFWContext > glfw_context_
Shared GLFW context.
Definition: Visualizer.h:269
void CaptureDepthImage(const std::string &filename="", bool do_render=true, double depth_scale=1000.0)
Definition: VisualizerRender.cpp:337
GLuint render_depth_stencil_rbo_
Definition: Visualizer.h:291
std::vector< std::shared_ptr< const geometry::Geometry > > utility_ptrs_
Definition: Visualizer.h:308
virtual void UpdateRender()
Function to inform render needed to be updated.
Definition: Visualizer.cpp:464
std::function< bool(Visualizer *)> animation_callback_func_in_loop_
Definition: Visualizer.h:278
Eigen::Vector2i saved_window_pos_
Definition: Visualizer.h:272
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:420
virtual bool InitOpenGL()
Function to initialize OpenGL.
Definition: VisualizerRender.cpp:29
virtual bool IsFullScreen()
Definition: Visualizer.cpp:496
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:219
void Run()
Function to activate the window.
Definition: Visualizer.cpp:274
virtual bool UpdateGeometry(std::shared_ptr< const geometry::Geometry > geometry_ptr=nullptr)
Function to update geometry.
Definition: Visualizer.cpp:450
std::shared_ptr< glsl::CoordinateFrameRenderer > coordinate_frame_mesh_renderer_ptr_
Definition: Visualizer.h:320
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:321
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:179
std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOption > utility_renderer_opts_
Definition: Visualizer.h:315
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:273
virtual bool InitViewControl()
Function to initialize ViewControl.
Definition: Visualizer.cpp:239
bool WaitEvents()
Function to process the event queue and return if the window is closed.
Definition: Visualizer.cpp:295
virtual bool InitRenderOption()
Function to initialize RenderOption.
Definition: Visualizer.cpp:245
std::string GetViewStatus()
Get the current view status as a json string of ViewTrajectory.
Definition: VisualizerRender.cpp:157
std::unordered_set< std::shared_ptr< const geometry::Geometry > > geometry_ptrs_
Definition: Visualizer.h:301
std::string window_name_
Definition: Visualizer.h:266
virtual void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
Definition: VisualizerCallback.cpp:68
void SetViewStatus(const std::string &view_status_str)
Set the current view status from a json string of ViewTrajectory.
Definition: VisualizerRender.cpp:171
const std::string & GetWindowName() const
Definition: Visualizer.h:220
void CopyViewStatusFromClipboard()
Apply the view point from clipboard.
Definition: VisualizerRender.cpp:149
virtual ~Visualizer()
Definition: Visualizer.cpp:77
void DestroyVisualizerWindow()
Function to destroy a window.
Definition: Visualizer.cpp:220
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
Definition: Visualizer.h:311
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:416
virtual void MouseScrollCallback(GLFWwindow *window, double x, double y)
Definition: VisualizerCallback.cpp:63
GLuint render_rgb_tex_
Definition: Visualizer.h:290
virtual void UpdateWindowTitle()
Definition: Visualizer.cpp:250
void RegisterAnimationCallback(std::function< bool(Visualizer *)> callback_func)
Function to register a callback function for animation.
Definition: Visualizer.cpp:234
std::function< bool(Visualizer *)> animation_callback_func_
Definition: Visualizer.h:273
virtual void WindowRefreshCallback(GLFWwindow *window)
Callback functions.
Definition: VisualizerCallback.cpp:13
Eigen::Vector2i saved_window_size_
Definition: Visualizer.h:271
virtual void ToggleFullScreen()
Definition: Visualizer.cpp:488
MouseControl mouse_control_
Definition: Visualizer.h:282
GLFWwindow * window_
Definition: Visualizer.h:265
virtual void PrintVisualizerHelp()
Definition: Visualizer.cpp:500
void Close()
Function to to notify the window to be closed.
Definition: Visualizer.cpp:290
std::shared_ptr< geometry::TriangleMesh > coordinate_frame_mesh_ptr_
Definition: Visualizer.h:318
std::shared_ptr< geometry::Image > CaptureScreenFloatBuffer(bool do_render=true)
Function to capture screen and store RGB in a float buffer.
Definition: VisualizerRender.cpp:182
virtual bool HasGeometry() const
Definition: Visualizer.cpp:466
bool is_redraw_required_
Definition: Visualizer.h:283
Visualizer()
Definition: Visualizer.cpp:75
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:305
Visualizer & operator=(const Visualizer &)=delete
void CopyViewStatusToClipboard()
Copy the current view status to clipboard.
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:47
double mouse_position_x
Definition: Visualizer.h:55
bool is_control_key_down
Definition: Visualizer.h:51
bool is_mouse_left_button_down
Definition: Visualizer.h:49
double mouse_position_y
Definition: Visualizer.h:56
bool is_mouse_middle_button_down
Definition: Visualizer.h:50
bool is_super_key_down
Definition: Visualizer.h:54
bool is_shift_key_down
Definition: Visualizer.h:52
bool is_alt_key_down
Definition: Visualizer.h:53