36 #include <GLFW/glfw3.h> 40 #include <unordered_map> 41 #include <unordered_set> 56 namespace visualization {
65 bool is_mouse_left_button_down =
false;
66 bool is_mouse_middle_button_down =
false;
67 bool is_control_key_down =
false;
68 bool is_shift_key_down =
false;
69 bool is_alt_key_down =
false;
70 bool is_super_key_down =
false;
71 double mouse_position_x = 0.0;
72 double mouse_position_y = 0.0;
93 bool CreateVisualizerWindow(
const std::string &window_name =
"Open3D",
94 const int width = 640,
98 const bool visible =
true);
103 void DestroyVisualizerWindow();
110 void RegisterAnimationCallback(
111 std::function<
bool(
Visualizer *)> callback_func);
148 virtual bool AddGeometry(
149 std::shared_ptr<const geometry::Geometry> geometry_ptr,
150 bool reset_bounding_box =
true);
161 virtual bool RemoveGeometry(
162 std::shared_ptr<const geometry::Geometry> geometry_ptr,
163 bool reset_bounding_box =
true);
168 virtual bool ClearGeometries();
176 virtual bool UpdateGeometry(
177 std::shared_ptr<const geometry::Geometry> geometry_ptr =
nullptr);
178 virtual bool HasGeometry()
const;
181 virtual void UpdateRender();
183 virtual void PrintVisualizerHelp();
184 virtual void UpdateWindowTitle();
185 virtual void BuildUtilities();
194 std::shared_ptr<geometry::Image> CaptureScreenFloatBuffer(
195 bool do_render =
true);
200 void CaptureScreenImage(
const std::string &filename =
"",
201 bool do_render =
true);
205 std::shared_ptr<geometry::Image> CaptureDepthFloatBuffer(
206 bool do_render =
true);
212 void CaptureDepthImage(
const std::string &filename =
"",
213 bool do_render =
true,
214 double depth_scale = 1000.0);
221 void CaptureDepthPointCloud(
const std::string &filename =
"",
222 bool do_render =
true,
223 bool convert_to_world_coordinate =
false);
224 void CaptureRenderOption(
const std::string &filename =
"");
226 void ResetViewPoint(
bool reset_bounding_box =
false);
232 virtual bool InitOpenGL();
235 virtual bool InitViewControl();
238 virtual bool InitRenderOption();
243 virtual void Render(
bool render_screen =
false);
245 void CopyViewStatusToClipboard();
247 void CopyViewStatusFromClipboard();
250 virtual void WindowRefreshCallback(GLFWwindow *window);
251 virtual void WindowResizeCallback(GLFWwindow *window,
int w,
int h);
252 virtual void MouseMoveCallback(GLFWwindow *window,
double x,
double y);
253 virtual void MouseScrollCallback(GLFWwindow *window,
double x,
double y);
254 virtual void MouseButtonCallback(GLFWwindow *window,
258 virtual void KeyPressCallback(
259 GLFWwindow *window,
int key,
int scancode,
int action,
int mods);
261 virtual void WindowCloseCallback(GLFWwindow *window);
265 GLFWwindow *window_ = NULL;
266 std::string window_name_ =
"Open3D";
267 std::function<bool(Visualizer *)> animation_callback_func_ =
nullptr;
272 std::function<bool(Visualizer *)> animation_callback_func_in_loop_ =
277 bool is_redraw_required_ =
true;
278 bool is_initialized_ =
false;
294 std::unordered_set<std::shared_ptr<const geometry::Geometry>>
298 std::unordered_set<std::shared_ptr<glsl::GeometryRenderer>>
308 std::unordered_map<std::shared_ptr<glsl::GeometryRenderer>,
RenderOption>
313 std::shared_ptr<glsl::CoordinateFrameRenderer>
320 double pixel_to_screen_coordinate_ = 1.0;
std::vector< std::shared_ptr< const geometry::Geometry > > utility_ptrs_
Definition: Visualizer.h:302
std::vector< std::shared_ptr< glsl::GeometryRenderer > > utility_renderer_ptrs_
Definition: Visualizer.h:305
std::unordered_set< std::shared_ptr< glsl::GeometryRenderer > > geometry_renderer_ptrs_
Definition: Visualizer.h:299
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
Definition: Visualizer.h:190
View controller for visualizer.
Definition: ViewControl.h:41
std::shared_ptr< glsl::CoordinateFrameRenderer > coordinate_frame_mesh_renderer_ptr_
Definition: Visualizer.h:314
std::unique_ptr< RenderOption > render_option_ptr_
Definition: Visualizer.h:291
unsigned int render_rgb_tex_
Definition: Visualizer.h:284
std::shared_ptr< geometry::TriangleMesh > coordinate_frame_mesh_ptr_
Definition: Visualizer.h:312
unsigned int render_fbo_
Definition: Visualizer.h:283
ViewControl & GetViewControl()
Function to retrieve the associated ViewControl.
Definition: Visualizer.h:188
Defines rendering options for visualizer.
Definition: RenderOption.h:39
std::unique_ptr< ViewControl > view_control_ptr_
Definition: Visualizer.h:288
GLuint vao_id_
Definition: Visualizer.h:279
std::unordered_set< std::shared_ptr< const geometry::Geometry > > geometry_ptrs_
Definition: Visualizer.h:295
const std::string & GetWindowName() const
Definition: Visualizer.h:228
Definition: PinholeCameraIntrinsic.cpp:35
The main Visualizer class.
Definition: Visualizer.h:61
MouseControl mouse_control_
Definition: Visualizer.h:276
Definition: Visualizer.h:63
int height
Definition: FilePCD.cpp:72
unsigned int render_depth_stencil_rbo_
Definition: Visualizer.h:285
std::unordered_map< std::shared_ptr< glsl::GeometryRenderer >, RenderOption > utility_renderer_opts_
Definition: Visualizer.h:309
int width
Definition: FilePCD.cpp:71