29 namespace visualization {
33 const std::vector<std::shared_ptr<const ccHObject>> &geometry_ptrs,
34 const std::string &window_name ,
39 bool point_show_normal ,
40 bool mesh_show_wireframe ,
41 bool mesh_show_back_face ,
42 Eigen::Vector3d *lookat ,
44 Eigen::Vector3d *front ,
55 for (
const auto &geometry_ptr : geometry_ptrs) {
59 "[DrawGeometries] Possibly due to bad geometry or wrong "
66 if (lookat !=
nullptr) {
70 view_control.
SetUp(*up);
72 if (front !=
nullptr) {
75 if (zoom !=
nullptr) {
85 const std::vector<std::shared_ptr<const ccHObject>> &geometry_ptrs,
86 const std::string &window_name ,
91 const std::string &json_filename ) {
96 "[DrawGeometriesWithCustomAnimation] Failed creating OpenGL "
100 for (
const auto &geometry_ptr : geometry_ptrs) {
103 "[DrawGeometriesWithCustomAnimation] Failed adding "
106 "[DrawGeometriesWithCustomAnimation] Possibly due to bad "
107 "geometry or wrong geometry type.");
113 if (!json_filename.empty()) {
114 if (!view_control.LoadTrajectoryFromJsonFile(json_filename)) {
116 "[DrawGeometriesWithCustomAnimation] Failed loading json "
119 "[DrawGeometriesWithCustomAnimation] Possibly due to bad "
120 "file or file does not contain trajectory.");
131 const std::vector<std::shared_ptr<const ccHObject>> &geometry_ptrs,
132 std::function<
bool(
Visualizer *)> callback_func,
133 const std::string &window_name ,
142 "[DrawGeometriesWithAnimationCallback] Failed creating OpenGL "
146 for (
const auto &geometry_ptr : geometry_ptrs) {
149 "[DrawGeometriesWithAnimationCallback] Failed adding "
152 "[DrawGeometriesWithAnimationCallback] Possibly due to bad "
153 "geometry or wrong geometry type.");
164 const std::vector<std::shared_ptr<const ccHObject>> &geometry_ptrs,
165 const std::map<
int, std::function<
bool(
Visualizer *)>> &key_to_callback,
166 const std::string &window_name ,
175 "[DrawGeometriesWithKeyCallbacks] Failed creating OpenGL "
179 for (
const auto &geometry_ptr : geometry_ptrs) {
182 "[DrawGeometriesWithKeyCallbacks] Failed adding "
185 "[DrawGeometriesWithKeyCallbacks] Possibly due to bad "
186 "geometry or wrong geometry type.");
190 for (
auto key_func_pair : key_to_callback) {
192 key_func_pair.second);
200 const std::vector<std::shared_ptr<const ccHObject>> &geometry_ptrs,
201 const std::string &window_name ,
210 "[DrawGeometriesWithEditing] Failed creating OpenGL window.");
213 for (
const auto &geometry_ptr : geometry_ptrs) {
216 "[DrawGeometriesWithEditing] Failed adding geometry.");
218 "[DrawGeometriesWithEditing] Possibly due to bad geometry "
219 "or wrong geometry type.");
229 const std::vector<std::shared_ptr<const ccHObject>> &geometry_ptrs,
230 const std::string &window_name ,
239 "[DrawGeometriesWithVertexSelection] Failed creating OpenGL "
243 for (
const auto &geometry_ptr : geometry_ptrs) {
246 "[DrawGeometriesWithVertexSelection] Failed adding "
249 "[DrawGeometriesWithVertexSelection] Possibly due to bad "
250 "geometry or wrong geometry type.");
bool mesh_show_back_face_
Whether to show back faces for TriangleMesh.
bool point_show_normal_
Whether to show normal for PointCloud.
bool mesh_show_wireframe_
View controller for visualizer.
void SetFront(const Eigen::Vector3d &front)
void SetUp(const Eigen::Vector3d &up)
void SetLookat(const Eigen::Vector3d &lookat)
void SetZoom(const double zoom)
void UpdateWindowTitle() override
Visualizer with editing capabilities.
bool AddGeometry(std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true) override
Function to add geometry to the scene and create corresponding shaders.
Visualizer with custom key callack capabilities.
void RegisterKeyCallback(int key, std::function< bool(Visualizer *)> callback)
bool AddGeometry(std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true) override
Function to add geometry to the scene and create corresponding shaders.
The main Visualizer class.
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
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.
void DestroyVisualizerWindow()
Function to destroy a window.
void Run()
Function to activate the window.
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.
ViewControl & GetViewControl()
Function to retrieve the associated ViewControl.
bool DrawGeometriesWithVertexSelection(const std::vector< std::shared_ptr< const ccHObject >> &geometry_ptrs, const std::string &window_name, int width, int height, int left, int top)
bool DrawGeometriesWithKeyCallbacks(const std::vector< std::shared_ptr< const ccHObject >> &geometry_ptrs, const std::map< int, std::function< bool(Visualizer *)>> &key_to_callback, const std::string &window_name, int width, int height, int left, int top)
Function to draw a list of geometry.
bool DrawGeometriesWithCustomAnimation(const std::vector< std::shared_ptr< const ccHObject >> &geometry_ptrs, const std::string &window_name, int width, int height, int left, int top, const std::string &json_filename)
Function to draw a list of geometry objects with a GUI that supports animation.
bool DrawGeometriesWithEditing(const std::vector< std::shared_ptr< const ccHObject >> &geometry_ptrs, const std::string &window_name, int width, int height, int left, int top)
Function to draw a list of geometry.
bool DrawGeometries(const std::vector< std::shared_ptr< const ccHObject >> &geometry_ptrs, const std::string &window_name, int width, int height, int left, int top, bool point_show_normal, bool mesh_show_wireframe, bool mesh_show_back_face, Eigen::Vector3d *lookat, Eigen::Vector3d *up, Eigen::Vector3d *front, double *zoom)
Function to draw a list of geometry objects.
bool DrawGeometriesWithAnimationCallback(const std::vector< std::shared_ptr< const ccHObject >> &geometry_ptrs, std::function< bool(Visualizer *)> callback_func, const std::string &window_name, int width, int height, int left, int top)
Function to draw a list of geometry objects with a customized animation callback function.
Generic file read and write utility for python interface.