Open3D (C++ API)
VisualizerWithCustomAnimation.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
30 
31 namespace open3d {
32 namespace visualization {
33 
35 public:
39  delete;
41  const VisualizerWithCustomAnimation &) = delete;
42 
43 public:
44  void PrintVisualizerHelp() override;
45  void UpdateWindowTitle() override;
46  void Play(bool recording = false,
47  bool recording_depth = false,
48  bool close_window_when_animation_ends = false);
49  void RegisterRecordingImageFormat(const std::string &basedir,
50  const std::string &format,
51  const std::string &trajectory) {
52  recording_image_basedir_ = basedir;
55  }
56  void RegisterRecordingDepthFormat(const std::string &basedir,
57  const std::string &format,
58  const std::string &trajectory) {
59  recording_depth_basedir_ = basedir;
62  }
63 
64 protected:
65  bool InitViewControl() override;
66  void MouseMoveCallback(GLFWwindow *window, double x, double y) override;
67  void MouseScrollCallback(GLFWwindow *window, double x, double y) override;
68  void MouseButtonCallback(GLFWwindow *window,
69  int button,
70  int action,
71  int mods) override;
72  void KeyPressCallback(GLFWwindow *window,
73  int key,
74  int scancode,
75  int action,
76  int mods) override;
77 
78 protected:
79  std::string recording_image_basedir_ = "image/";
80  std::string recording_image_filename_format_ = "image_{:06d}.png";
81  std::string recording_image_trajectory_filename_ = "image_trajectory.json";
82  std::string recording_depth_basedir_ = "depth/";
83  std::string recording_depth_filename_format_ = "depth_{:06d}.png";
84  std::string recording_depth_trajectory_filename_ = "depth_trajectory.json";
86 };
87 
88 } // namespace visualization
89 } // namespace open3d
void RegisterRecordingDepthFormat(const std::string &basedir, const std::string &format, const std::string &trajectory)
Definition: VisualizerWithCustomAnimation.h:56
std::string recording_image_filename_format_
Definition: VisualizerWithCustomAnimation.h:80
VisualizerWithCustomAnimation & operator=(const VisualizerWithCustomAnimation &)=delete
bool InitViewControl() override
Function to initialize ViewControl.
Definition: VisualizerWithCustomAnimation.cpp:166
std::string recording_image_trajectory_filename_
Definition: VisualizerWithCustomAnimation.h:81
void Play(bool recording=false, bool recording_depth=false, bool close_window_when_animation_ends=false)
Definition: VisualizerWithCustomAnimation.cpp:85
std::string recording_depth_basedir_
Definition: VisualizerWithCustomAnimation.h:82
void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods) override
Definition: VisualizerWithCustomAnimation.cpp:301
std::string recording_depth_trajectory_filename_
Definition: VisualizerWithCustomAnimation.h:84
VisualizerWithCustomAnimation()
Definition: VisualizerWithCustomAnimation.cpp:40
void MouseScrollCallback(GLFWwindow *window, double x, double y) override
Definition: VisualizerWithCustomAnimation.cpp:284
void PrintVisualizerHelp() override
Definition: VisualizerWithCustomAnimation.cpp:44
Definition: Open3DViewer.h:29
The main Visualizer class.
Definition: Visualizer.h:60
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:155
std::string recording_depth_filename_format_
Definition: VisualizerWithCustomAnimation.h:83
std::string recording_image_basedir_
Definition: VisualizerWithCustomAnimation.h:79
~VisualizerWithCustomAnimation() override
Definition: VisualizerWithCustomAnimation.cpp:42
void RegisterRecordingImageFormat(const std::string &basedir, const std::string &format, const std::string &trajectory)
Definition: VisualizerWithCustomAnimation.h:49
size_t recording_file_index_
Definition: VisualizerWithCustomAnimation.h:85
void KeyPressCallback(GLFWwindow *window, int key, int scancode, int action, int mods) override
Definition: VisualizerWithCustomAnimation.cpp:173
void MouseMoveCallback(GLFWwindow *window, double x, double y) override
Definition: VisualizerWithCustomAnimation.cpp:273
Definition: VisualizerWithCustomAnimation.h:34
void UpdateWindowTitle() override
Definition: VisualizerWithCustomAnimation.cpp:75