17 #include <GLFW/glfw3.h>
22 #include <unordered_map>
23 #include <unordered_set>
25 #include "visualization/shader/GeometryRenderer.h"
38 namespace visualization {
78 const int width = 640,
82 const bool visible =
true);
95 std::function<
bool(
Visualizer *)> callback_func);
132 virtual bool AddGeometry(std::shared_ptr<const ccHObject> geometry_ptr,
133 bool reset_bounding_box =
true);
144 virtual bool RemoveGeometry(std::shared_ptr<const ccHObject> geometry_ptr,
145 bool reset_bounding_box =
true);
159 std::shared_ptr<const ccHObject> geometry_ptr =
nullptr);
182 bool do_render =
true);
188 bool do_render =
true);
193 bool do_render =
true);
200 bool do_render =
true,
201 double depth_scale = 1000.0);
209 bool do_render =
true,
210 bool convert_to_world_coordinate =
false);
230 virtual void Render(
bool render_screen =
false);
246 GLFWwindow *window,
int key,
int scancode,
int action,
int mods);
290 std::unordered_set<std::shared_ptr<glsl::GeometryRenderer>>
300 std::unordered_map<std::shared_ptr<glsl::GeometryRenderer>,
RenderOption>
305 std::shared_ptr<glsl::CoordinateFrameRenderer>
312 double pixel_to_screen_coordinate_ = 1.0;
Hierarchical CLOUDVIEWER Object.
Defines rendering options for visualizer.
View controller for visualizer.
The main Visualizer class.
virtual bool UpdateGeometry(std::shared_ptr< const ccHObject > geometry_ptr=nullptr)
Function to update geometry.
virtual bool InitRenderOption()
Function to initialize RenderOption.
virtual bool IsFullScreen()
virtual void KeyPressCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
std::function< bool(Visualizer *)> animation_callback_func_
MouseControl mouse_control_
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
bool WaitEvents()
Function to process the event queue and return if the window is closed.
std::shared_ptr< geometry::Image > CaptureDepthFloatBuffer(bool do_render=true)
virtual bool InitViewControl()
Function to initialize ViewControl.
void CaptureDepthPointCloud(const std::string &filename="", bool do_render=true, bool convert_to_world_coordinate=false)
Function to capture and save local point cloud.
virtual bool HasGeometry() const
virtual void WindowRefreshCallback(GLFWwindow *window)
const std::string & GetWindowName() const
virtual bool InitOpenGL()
Function to initialize OpenGL.
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
std::shared_ptr< ccMesh > coordinate_frame_mesh_ptr_
void CaptureScreenImage(const std::string &filename="", bool do_render=true)
Function to capture and save a screen image.
virtual bool RemoveGeometry(std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true)
Function to remove geometry from the scene.
virtual void UpdateRender()
Function to inform render needed to be updated.
virtual void MouseScrollCallback(GLFWwindow *window, double x, double y)
Eigen::Vector2i saved_window_pos_
std::unordered_set< std::shared_ptr< const ccHObject > > geometry_ptrs_
std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOption > utility_renderer_opts_
virtual void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
std::unique_ptr< RenderOption > render_option_ptr_
virtual void MouseMoveCallback(GLFWwindow *window, double x, double y)
void ResetViewPoint(bool reset_bounding_box=false)
Function to reset view point.
virtual bool AddGeometry(std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true)
Function to add geometry to the scene and create corresponding shaders.
GLuint render_depth_stencil_rbo_
Visualizer(const Visualizer &)=delete
void DestroyVisualizerWindow()
Function to destroy a window.
Visualizer(Visualizer &&)=delete
void Run()
Function to activate the window.
virtual void SetFullScreen(bool fullscreen)
Functions to change between fullscreen and windowed modes.
void Close()
Function to to notify the window to be closed.
std::function< bool(Visualizer *)> animation_callback_func_in_loop_
void RegisterAnimationCallback(std::function< bool(Visualizer *)> callback_func)
Function to register a callback function for animation.
bool CreateVisualizerWindow(const std::string &window_name="CloudViewer", 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.
virtual void UpdateWindowTitle()
virtual void BuildUtilities()
std::shared_ptr< GLFWContext > glfw_context_
Shared GLFW context.
std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > geometry_renderer_ptrs_
virtual void ToggleFullScreen()
std::shared_ptr< geometry::Image > CaptureScreenFloatBuffer(bool do_render=true)
Function to capture screen and store RGB in a float buffer.
virtual void Render(bool render_screen=false)
std::unique_ptr< ViewControl > view_control_ptr_
ViewControl & GetViewControl()
Function to retrieve the associated ViewControl.
void CaptureRenderOption(const std::string &filename="")
virtual void WindowResizeCallback(GLFWwindow *window, int w, int h)
virtual void PrintVisualizerHelp()
void CopyViewStatusFromClipboard()
std::vector< std::shared_ptr< const ccHObject > > utility_ptrs_
Visualizer & operator=(const Visualizer &)=delete
virtual bool ClearGeometries()
void CopyViewStatusToClipboard()
void CaptureDepthImage(const std::string &filename="", bool do_render=true, double depth_scale=1000.0)
virtual void WindowCloseCallback(GLFWwindow *window)
Function to notify the window to be closed.
Eigen::Vector2i saved_window_size_
std::shared_ptr< glsl::CoordinateFrameRenderer > coordinate_frame_mesh_renderer_ptr_
Generic file read and write utility for python interface.
Eigen::Matrix< Index, 2, 1 > Vector2i
bool is_mouse_middle_button_down
bool is_mouse_left_button_down