36 #include <GLFW/glfw3.h> 39 #include <unordered_map> 40 #include <unordered_set> 55 namespace visualization {
64 bool is_mouse_left_button_down =
false;
65 bool is_mouse_middle_button_down =
false;
66 bool is_control_key_down =
false;
67 bool is_shift_key_down =
false;
68 bool is_alt_key_down =
false;
69 bool is_super_key_down =
false;
70 double mouse_position_x = 0.0;
71 double mouse_position_y = 0.0;
92 bool CreateVisualizerWindow(
const std::string &window_name =
"Open3D",
93 const int width = 640,
97 const bool visible =
true);
102 void DestroyVisualizerWindow();
109 void RegisterAnimationCallback(
110 std::function<
bool(
Visualizer *)> callback_func);
147 virtual bool AddGeometry(
148 std::shared_ptr<const geometry::Geometry> geometry_ptr,
149 bool reset_bounding_box =
true);
160 virtual bool RemoveGeometry(
161 std::shared_ptr<const geometry::Geometry> geometry_ptr,
162 bool reset_bounding_box =
true);
167 virtual bool ClearGeometries();
175 virtual bool UpdateGeometry(
176 std::shared_ptr<const geometry::Geometry> geometry_ptr =
nullptr);
177 virtual bool HasGeometry()
const;
180 virtual void UpdateRender();
182 virtual void PrintVisualizerHelp();
183 virtual void UpdateWindowTitle();
184 virtual void BuildUtilities();
193 std::shared_ptr<geometry::Image> CaptureScreenFloatBuffer(
194 bool do_render =
true);
199 void CaptureScreenImage(
const std::string &filename =
"",
200 bool do_render =
true);
204 std::shared_ptr<geometry::Image> CaptureDepthFloatBuffer(
205 bool do_render =
true);
211 void CaptureDepthImage(
const std::string &filename =
"",
212 bool do_render =
true,
213 double depth_scale = 1000.0);
220 void CaptureDepthPointCloud(
const std::string &filename =
"",
221 bool do_render =
true,
222 bool convert_to_world_coordinate =
false);
223 void CaptureRenderOption(
const std::string &filename =
"");
225 void ResetViewPoint(
bool reset_bounding_box =
false);
231 virtual bool InitOpenGL();
234 virtual bool InitViewControl();
237 virtual bool InitRenderOption();
242 virtual void Render();
244 void CopyViewStatusToClipboard();
246 void CopyViewStatusFromClipboard();
249 virtual void WindowRefreshCallback(GLFWwindow *window);
250 virtual void WindowResizeCallback(GLFWwindow *window,
int w,
int h);
251 virtual void MouseMoveCallback(GLFWwindow *window,
double x,
double y);
252 virtual void MouseScrollCallback(GLFWwindow *window,
double x,
double y);
253 virtual void MouseButtonCallback(GLFWwindow *window,
257 virtual void KeyPressCallback(
258 GLFWwindow *window,
int key,
int scancode,
int action,
int mods);
260 virtual void WindowCloseCallback(GLFWwindow *window);
264 GLFWwindow *window_ = NULL;
265 std::string window_name_ =
"Open3D";
266 std::function<bool(Visualizer *)> animation_callback_func_ =
nullptr;
271 std::function<bool(Visualizer *)> animation_callback_func_in_loop_ =
276 bool is_redraw_required_ =
true;
277 bool is_initialized_ =
false;
287 std::unordered_set<std::shared_ptr<const geometry::Geometry>>
291 std::unordered_set<std::shared_ptr<glsl::GeometryRenderer>>
301 std::unordered_map<std::shared_ptr<glsl::GeometryRenderer>,
RenderOption>
306 std::shared_ptr<glsl::CoordinateFrameRenderer>
313 double pixel_to_screen_coordinate_ = 1.0;
std::vector< std::shared_ptr< const geometry::Geometry > > utility_ptrs_
Definition: Visualizer.h:295
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
Definition: Visualizer.h:298
std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > geometry_renderer_ptrs_
Definition: Visualizer.h:292
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
Definition: Visualizer.h:189
View controller for visualizer.
Definition: ViewControl.h:41
std::shared_ptr< glsl::CoordinateFrameRenderer > coordinate_frame_mesh_renderer_ptr_
Definition: Visualizer.h:307
int Run(int argc, const char *argv[])
Definition: Open3DViewer.cpp:77
std::unique_ptr< RenderOption > render_option_ptr_
Definition: Visualizer.h:284
std::shared_ptr< geometry::TriangleMesh > coordinate_frame_mesh_ptr_
Definition: Visualizer.h:305
ViewControl & GetViewControl()
Function to retrieve the associated ViewControl.
Definition: Visualizer.h:187
Defines rendering options for visualizer.
Definition: RenderOption.h:39
std::unique_ptr< ViewControl > view_control_ptr_
Definition: Visualizer.h:281
GLuint vao_id_
Definition: Visualizer.h:278
std::unordered_set< std::shared_ptr< const geometry::Geometry > > geometry_ptrs_
Definition: Visualizer.h:288
const std::string & GetWindowName() const
Definition: Visualizer.h:227
Definition: Open3DViewer.h:29
The main Visualizer class.
Definition: Visualizer.h:60
MouseControl mouse_control_
Definition: Visualizer.h:275
Definition: Visualizer.h:62
int height
Definition: FilePCD.cpp:70
std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOption > utility_renderer_opts_
Definition: Visualizer.h:302
int width
Definition: FilePCD.cpp:69