iridescence
Loading...
Searching...
No Matches
async_light_viewer_context.hpp
Go to the documentation of this file.
1#ifndef GUIK_ASYNC_LIGHT_VIEWER_CONTEXT_HPP
2#define GUIK_ASYNC_LIGHT_VIEWER_CONTEXT_HPP
3
5
6namespace guik {
7
14public:
15 AsyncLightViewerContext(); // context must be set manually
18
20 void clear();
22 void clear_text();
24 void append_text(const std::string& text);
28 void register_ui_callback(const std::string& name, const std::function<void()>& callback = 0);
31 void remove_ui_callback(const std::string& name);
32
38 void set_draw_xy_grid(bool draw_xy_grid);
41
44 void enable_partial_rendering(double clear_thresh = 1e-6);
52 void set_backface_culling_range(const Eigen::Vector2f& range);
53
58 void set_point_shape(float point_size = 1.0f, bool metric = true, bool circle = true);
59
64 void clear_drawables(const std::function<bool(const std::string&)>& fn);
66 void remove_drawable(const std::string& name);
68 void remove_drawable(const std::regex& regex);
69
71 void save_camera_settings(const std::string& path);
73 void load_camera_settings(const std::string& path);
75 void save_color_buffer(const std::string& filename);
77 void save_depth_buffer(const std::string& filename, bool real_scale = true);
78
82 void lookat(const Eigen::Vector3f& pt);
84 template <typename Vector>
85 void lookat(const Vector& pt) {
86 const auto ptf = pt.eval().template cast<float>();
87 lookat(ptf);
88 }
89
91 void lookat(const Eigen::Isometry3f& T_world_sensor);
93 void lookat(const Eigen::Isometry3d& T_world_sensor);
94
96 void use_orbit_camera_control(double distance = 80.0, double theta = 0.0, double phi = -60.0f * M_PI / 180.0f);
98 void use_orbit_camera_control_xz(double distance = 80.0, double theta = 0.0, double phi = 0.0);
100 void use_topdown_camera_control(double distance = 80.0, double theta = 0.0);
102 void use_arcball_camera_control(double distance = 80.0, double theta = 0.0, double phi = -60.0f * M_PI / 180.0f);
104 void use_fps_camera_control(double fovy_deg = 60.0);
110 const Eigen::Isometry3f& T_sensor_camera = Eigen::Translation3f(-5.0f, 0.0f, 0.1f) * Eigen::Isometry3f::Identity(),
111 double smoothing_factor_trans = 0.75,
112 double smoothing_factor_rot = 0.9);
113
115 void use_perspective_projection_control(float fovy_deg = 30.0f, float near_ = 1.0f, float far_ = 1000.0f);
117 void use_orthographic_projection_control(float width = 10.0f, float near_ = 1.0f, float far_ = 1000.0f);
118
120 void update_drawable_setting(const std::string& name, const ShaderSetting& shader_setting);
121
122 // utility methods to directly create and update drawables
123 // PointCloudBuffer
130 void update_points(const std::string& name, const float* data, int stride, int num_points, const ShaderSetting& shader_setting);
132 template <typename Scalar, int Dim>
133 void update_points(const std::string& name, const Eigen::Matrix<Scalar, Dim, 1>* points, int num_points, const ShaderSetting& shader_setting);
135 template <typename Scalar, int Dim, typename Allocator>
136 void update_points(const std::string& name, const std::vector<Eigen::Matrix<Scalar, Dim, 1>, Allocator>& points, const ShaderSetting& shader_setting);
137
139 void update_points(const std::string& name, const float* vertices, int vertex_stride, const float* colors, int color_stride, int num_points, const ShaderSetting& shader_setting);
141 template <typename ScalarV, int DimV, typename ScalarC, int DimC>
142 void update_points(
143 const std::string& name,
144 const Eigen::Matrix<ScalarV, DimV, 1>* points,
145 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
146 int num_points,
147 const ShaderSetting& shader_setting);
149 template <typename ScalarV, int DimV, typename AllocatorV, typename ScalarC, int DimC, typename AllocatorC>
150 void update_points(
151 const std::string& name,
152 const std::vector<Eigen::Matrix<ScalarV, DimV, 1>, AllocatorV>& points,
153 const std::vector<Eigen::Matrix<ScalarC, DimC, 1>, AllocatorC>& colors,
154 const ShaderSetting& shader_setting);
155
156 // NormalDistributions
164 template <typename Scalar, int Dim>
166 const std::string& name,
167 const Eigen::Matrix<Scalar, Dim, 1>* points,
168 const Eigen::Matrix<Scalar, Dim, Dim>* covs,
169 int num_points,
170 float sigma,
171 const ShaderSetting& shader_setting);
172
174 template <typename Scalar, int Dim, typename Alloc1, typename Alloc2>
176 const std::string& name,
177 const std::vector<Eigen::Matrix<Scalar, Dim, 1>, Alloc1>& points,
178 const std::vector<Eigen::Matrix<Scalar, Dim, Dim>, Alloc2>& covs,
179 float sigma,
180 const ShaderSetting& shader_setting);
181
182 // ThinLines
194 const std::string& name,
195 const float* vertices,
196 const float* colors,
197 int num_vertices,
198 const unsigned int* indices,
199 int num_indices,
200 bool line_strip,
201 float line_width,
202 const ShaderSetting& shader_setting);
203
205 const std::string& name,
206 const float* vertices,
207 const float* colors,
208 int num_vertices,
209 const unsigned int* indices,
210 int num_indices,
211 bool line_strip,
212 const ShaderSetting& shader_setting);
213
215 template <typename Scalar, int Dim>
216 void update_thin_lines(const std::string& name, const Eigen::Matrix<Scalar, Dim, 1>* points, int num_points, bool line_strip, const ShaderSetting& shader_setting);
217
219 template <typename ScalarV, int DimV, typename ScalarC, int DimC>
221 const std::string& name,
222 const Eigen::Matrix<ScalarV, DimV, 1>* points,
223 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
224 int num_points,
225 bool line_strip,
226 const ShaderSetting& shader_setting);
227
229 template <typename ScalarV, int DimV, typename ScalarC, int DimC>
231 const std::string& name,
232 const Eigen::Matrix<ScalarV, DimV, 1>* points,
233 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
234 int num_points,
235 const unsigned int* indices,
236 int num_indices,
237 bool line_strip,
238 const ShaderSetting& shader_setting);
239
241 template <typename Point, typename Alloc>
242 void update_thin_lines(const std::string& name, const std::vector<Point, Alloc>& points, bool line_strip, const ShaderSetting& shader_setting);
243
245 template <typename Point, typename Alloc>
247 const std::string& name,
248 const std::vector<Point, Alloc>& points,
249 const std::vector<unsigned int>& indices,
250 bool line_strip,
251 const ShaderSetting& shader_setting);
252
254 template <typename Point, typename AllocP, typename Color, typename AllocC>
256 const std::string& name,
257 const std::vector<Point, AllocP>& points,
258 const std::vector<Color, AllocC>& colors,
259 bool line_strip,
260 const ShaderSetting& shader_setting);
261
263 template <typename Point, typename AllocP, typename Color, typename AllocC>
265 const std::string& name,
266 const std::vector<Point, AllocP>& points,
267 const std::vector<Color, AllocC>& colors,
268 const std::vector<unsigned int>& indices,
269 bool line_strip,
270 const ShaderSetting& shader_setting);
271
273 template <typename Scalar, int Dim>
274 void
275 update_thin_lines(const std::string& name, const Eigen::Matrix<Scalar, Dim, 1>* points, int num_points, bool line_strip, float line_width, const ShaderSetting& shader_setting);
276
278 template <typename ScalarV, int DimV, typename ScalarC, int DimC>
280 const std::string& name,
281 const Eigen::Matrix<ScalarV, DimV, 1>* points,
282 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
283 int num_points,
284 bool line_strip,
285 float line_width,
286 const ShaderSetting& shader_setting);
287
289 template <typename ScalarV, int DimV, typename ScalarC, int DimC>
291 const std::string& name,
292 const Eigen::Matrix<ScalarV, DimV, 1>* points,
293 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
294 int num_points,
295 const unsigned int* indices,
296 int num_indices,
297 bool line_strip,
298 float line_width,
299 const ShaderSetting& shader_setting);
300
302 template <typename Point, typename Alloc>
303 void update_thin_lines(const std::string& name, const std::vector<Point, Alloc>& points, bool line_strip, float line_width, const ShaderSetting& shader_setting);
304
306 template <typename Point, typename Alloc>
308 const std::string& name,
309 const std::vector<Point, Alloc>& points,
310 const std::vector<unsigned int>& indices,
311 bool line_strip,
312 float line_width,
313 const ShaderSetting& shader_setting);
314
316 template <typename Point, typename AllocP, typename Color, typename AllocC>
318 const std::string& name,
319 const std::vector<Point, AllocP>& points,
320 const std::vector<Color, AllocC>& colors,
321 bool line_strip,
322 float line_width,
323 const ShaderSetting& shader_setting);
324
326 template <typename Point, typename AllocP, typename Color, typename AllocC>
328 const std::string& name,
329 const std::vector<Point, AllocP>& points,
330 const std::vector<Color, AllocC>& colors,
331 const std::vector<unsigned int>& indices,
332 bool line_strip,
333 float line_width,
334 const ShaderSetting& shader_setting);
335
336 // Primitives
338 void update_icosahedron(const std::string& name, const ShaderSetting& shader_setting);
340 void update_sphere(const std::string& name, const ShaderSetting& shader_setting);
342 void update_cube(const std::string& name, const ShaderSetting& shader_setting);
344 void update_cone(const std::string& name, const ShaderSetting& shader_setting);
346 void update_frustum(const std::string& name, const ShaderSetting& shader_setting);
348 void update_coord(const std::string& name, const ShaderSetting& shader_setting);
349
351 void update_wire_icosahedron(const std::string& name, const ShaderSetting& shader_setting);
353 void update_wire_sphere(const std::string& name, const ShaderSetting& shader_setting);
355 void update_wire_cube(const std::string& name, const ShaderSetting& shader_setting);
357 void update_wire_cone(const std::string& name, const ShaderSetting& shader_setting);
359 void update_wire_frustum(const std::string& name, const ShaderSetting& shader_setting);
360
361protected:
363};
364
365// template methods
366// PointCloud
367template <typename Scalar, int Dim>
368void AsyncLightViewerContext::update_points(const std::string& name, const Eigen::Matrix<Scalar, Dim, 1>* points, int num_points, const ShaderSetting& shader_setting) {
369 if constexpr (std::is_same<Scalar, float>::value) {
370 return update_points(name, reinterpret_cast<const float*>(points), sizeof(float) * Dim, num_points, shader_setting);
371 } else {
372 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
373 return update_points(name, points_3f.data(), num_points, shader_setting);
374 }
375}
376
377template <typename Scalar, int Dim, typename Allocator>
378void AsyncLightViewerContext::update_points(const std::string& name, const std::vector<Eigen::Matrix<Scalar, Dim, 1>, Allocator>& points, const ShaderSetting& shader_setting) {
379 return update_points(name, points.data(), points.size(), shader_setting);
380}
381
382template <typename ScalarV, int DimV, typename ScalarC, int DimC>
384 const std::string& name,
385 const Eigen::Matrix<ScalarV, DimV, 1>* points,
386 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
387 int num_points,
388 const ShaderSetting& shader_setting) {
389 if constexpr (std::is_same<ScalarV, float>::value && std::is_same<ScalarC, float>::value) {
390 return update_points(
391 name,
392 reinterpret_cast<const float*>(points),
393 sizeof(float) * DimV,
394 reinterpret_cast<const float*>(colors),
395 sizeof(float) * DimC,
396 num_points,
397 shader_setting);
398 } else {
399 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
400 const auto colors_4f = glk::convert_to_vector<float, 4, 1>(colors, num_points);
401 return update_points(name, points_3f.data(), colors_4f.data(), num_points, shader_setting);
402 }
403}
404
405template <typename ScalarV, int DimV, typename AllocatorV, typename ScalarC, int DimC, typename AllocatorC>
407 const std::string& name,
408 const std::vector<Eigen::Matrix<ScalarV, DimV, 1>, AllocatorV>& points,
409 const std::vector<Eigen::Matrix<ScalarC, DimC, 1>, AllocatorC>& colors,
410 const ShaderSetting& shader_setting) {
411 return update_points(name, points.data(), colors.data(), points.size(), shader_setting);
412}
413
414// NormalDistributions
415template <typename Scalar, int Dim, typename Alloc1, typename Alloc2>
417 const std::string& name,
418 const std::vector<Eigen::Matrix<Scalar, Dim, 1>, Alloc1>& points,
419 const std::vector<Eigen::Matrix<Scalar, Dim, Dim>, Alloc2>& covs,
420 float sigma,
421 const ShaderSetting& shader_setting) {
422 update_normal_dists(name, points.data(), covs.data(), points.size(), sigma, shader_setting);
423}
424
425// ThinLines
426template <typename Scalar, int Dim>
428 const std::string& name,
429 const Eigen::Matrix<Scalar, Dim, 1>* points,
430 int num_points,
431 bool line_strip,
432 const ShaderSetting& shader_setting) {
433 if constexpr (std::is_same<Scalar, float>::value && Dim == 3) {
434 return update_thin_lines(name, reinterpret_cast<const float*>(points), nullptr, num_points, nullptr, 0, line_strip, shader_setting);
435 } else {
436 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
437 return update_thin_lines(name, points_3f.data(), num_points, line_strip, shader_setting);
438 }
439}
440
441template <typename ScalarV, int DimV, typename ScalarC, int DimC>
443 const std::string& name,
444 const Eigen::Matrix<ScalarV, DimV, 1>* points,
445 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
446 int num_points,
447 bool line_strip,
448 const ShaderSetting& shader_setting) {
449 if constexpr (std::is_same<ScalarV, float>::value && DimV == 3 && std::is_same<ScalarC, float>::value && DimC == 4) {
450 return update_thin_lines(name, reinterpret_cast<const float*>(points), reinterpret_cast<const float*>(colors), num_points, nullptr, 0, line_strip, shader_setting);
451 } else {
452 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
453 const auto colors_4f = glk::convert_to_vector<float, 4, 1>(colors, num_points);
454 return update_thin_lines(name, points_3f.data(), colors_4f.data(), num_points, line_strip, shader_setting);
455 }
456}
457
458template <typename ScalarV, int DimV, typename ScalarC, int DimC>
460 const std::string& name,
461 const Eigen::Matrix<ScalarV, DimV, 1>* points,
462 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
463 int num_points,
464 const unsigned int* indices,
465 int num_indices,
466 bool line_strip,
467 const ShaderSetting& shader_setting) {
468 if constexpr (std::is_same<ScalarV, float>::value && DimV == 3 && std::is_same<ScalarC, float>::value && DimC == 4) {
469 return update_thin_lines(name, reinterpret_cast<const float*>(points), reinterpret_cast<const float*>(colors), num_points, indices, num_indices, line_strip, shader_setting);
470 } else {
471 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
472 const auto colors_4f = glk::convert_to_vector<float, 4, 1>(colors, num_points);
473 return update_thin_lines(name, points_3f.data(), colors_4f.data(), num_points, indices, num_indices, line_strip, shader_setting);
474 }
475}
476
477template <typename Point, typename Alloc>
478void AsyncLightViewerContext::update_thin_lines(const std::string& name, const std::vector<Point, Alloc>& points, bool line_strip, const ShaderSetting& shader_setting) {
479 return update_thin_lines(name, points.data(), points.size(), line_strip, shader_setting);
480}
481
482template <typename Point, typename Alloc>
484 const std::string& name,
485 const std::vector<Point, Alloc>& points,
486 const std::vector<unsigned int>& indices,
487 bool line_strip,
488 const ShaderSetting& shader_setting) {
489 return update_thin_lines(name, points.data(), static_cast<const Eigen::Vector4f*>(nullptr), points.size(), indices.data(), indices.size(), line_strip, shader_setting);
490}
491
492template <typename Point, typename AllocP, typename Color, typename AllocC>
494 const std::string& name,
495 const std::vector<Point, AllocP>& points,
496 const std::vector<Color, AllocC>& colors,
497 bool line_strip,
498 const ShaderSetting& shader_setting) {
499 return update_thin_lines(name, points.data(), colors.data(), points.size(), line_strip, shader_setting);
500}
501
502template <typename Point, typename AllocP, typename Color, typename AllocC>
504 const std::string& name,
505 const std::vector<Point, AllocP>& points,
506 const std::vector<Color, AllocC>& colors,
507 const std::vector<unsigned int>& indices,
508 bool line_strip,
509 const ShaderSetting& shader_setting) {
510 return update_thin_lines(name, points.data(), colors.data(), points.size(), indices.data(), indices.size(), line_strip, shader_setting);
511}
512
513// ThinLines (with line_width)
514template <typename Scalar, int Dim>
516 const std::string& name,
517 const Eigen::Matrix<Scalar, Dim, 1>* points,
518 int num_points,
519 bool line_strip,
520 float line_width,
521 const ShaderSetting& shader_setting) {
522 if constexpr (std::is_same<Scalar, float>::value && Dim == 3) {
523 return update_thin_lines(name, reinterpret_cast<const float*>(points), nullptr, num_points, nullptr, 0, line_strip, line_width, shader_setting);
524 } else {
525 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
526 return update_thin_lines(name, points_3f.data(), num_points, line_strip, line_width, shader_setting);
527 }
528}
529
530template <typename ScalarV, int DimV, typename ScalarC, int DimC>
532 const std::string& name,
533 const Eigen::Matrix<ScalarV, DimV, 1>* points,
534 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
535 int num_points,
536 bool line_strip,
537 float line_width,
538 const ShaderSetting& shader_setting) {
539 if constexpr (std::is_same<ScalarV, float>::value && DimV == 3 && std::is_same<ScalarC, float>::value && DimC == 4) {
540 return update_thin_lines(name, reinterpret_cast<const float*>(points), reinterpret_cast<const float*>(colors), num_points, nullptr, 0, line_strip, line_width, shader_setting);
541 } else {
542 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
543 const auto colors_4f = glk::convert_to_vector<float, 4, 1>(colors, num_points);
544 return update_thin_lines(name, points_3f.data(), colors_4f.data(), num_points, line_strip, line_width, shader_setting);
545 }
546}
547
548template <typename ScalarV, int DimV, typename ScalarC, int DimC>
550 const std::string& name,
551 const Eigen::Matrix<ScalarV, DimV, 1>* points,
552 const Eigen::Matrix<ScalarC, DimC, 1>* colors,
553 int num_points,
554 const unsigned int* indices,
555 int num_indices,
556 bool line_strip,
557 float line_width,
558 const ShaderSetting& shader_setting) {
559 if constexpr (std::is_same<ScalarV, float>::value && DimV == 3 && std::is_same<ScalarC, float>::value && DimC == 4) {
560 return update_thin_lines(
561 name,
562 reinterpret_cast<const float*>(points),
563 reinterpret_cast<const float*>(colors),
564 num_points,
565 indices,
566 num_indices,
567 line_strip,
568 line_width,
569 shader_setting);
570 } else {
571 const auto points_3f = glk::convert_to_vector<float, 3, 1>(points, num_points);
572 const auto colors_4f = glk::convert_to_vector<float, 4, 1>(colors, num_points);
573 return update_thin_lines(name, points_3f.data(), colors_4f.data(), num_points, indices, num_indices, line_strip, line_width, shader_setting);
574 }
575}
576
577template <typename Point, typename Alloc>
579 const std::string& name,
580 const std::vector<Point, Alloc>& points,
581 bool line_strip,
582 float line_width,
583 const ShaderSetting& shader_setting) {
584 return update_thin_lines(name, points.data(), points.size(), line_strip, line_width, shader_setting);
585}
586
587template <typename Point, typename Alloc>
589 const std::string& name,
590 const std::vector<Point, Alloc>& points,
591 const std::vector<unsigned int>& indices,
592 bool line_strip,
593 float line_width,
594 const ShaderSetting& shader_setting) {
595 return update_thin_lines(
596 name,
597 points.data(),
598 static_cast<const Eigen::Vector4f*>(nullptr),
599 points.size(),
600 indices.data(),
601 indices.size(),
602 line_strip,
603 line_width,
604 shader_setting);
605}
606
607template <typename Point, typename AllocP, typename Color, typename AllocC>
609 const std::string& name,
610 const std::vector<Point, AllocP>& points,
611 const std::vector<Color, AllocC>& colors,
612 bool line_strip,
613 float line_width,
614 const ShaderSetting& shader_setting) {
615 return update_thin_lines(name, points.data(), colors.data(), points.size(), line_strip, line_width, shader_setting);
616}
617
618template <typename Point, typename AllocP, typename Color, typename AllocC>
620 const std::string& name,
621 const std::vector<Point, AllocP>& points,
622 const std::vector<Color, AllocC>& colors,
623 const std::vector<unsigned int>& indices,
624 bool line_strip,
625 float line_width,
626 const ShaderSetting& shader_setting) {
627 return update_thin_lines(name, points.data(), colors.data(), points.size(), indices.data(), indices.size(), line_strip, line_width, shader_setting);
628}
629
630} // namespace guik
631
632#endif
AsyncLightViewerContext(LightViewerContext *context)
void clear()
Clear everything in the viewer (callbacks, filters, drawables, texts).
void set_point_shape(float point_size=1.0f, bool metric=true, bool circle=true)
Set point shape properties.
void update_wire_frustum(const std::string &name, const ShaderSetting &shader_setting)
Register or update a wireframe frustum primitive.
void update_wire_cone(const std::string &name, const ShaderSetting &shader_setting)
Register or update a wireframe cone primitive.
void load_camera_settings(const std::string &path)
Load camera settings from a file.
void reset_center()
Reset camera center to the center of the screen.
void use_orbit_camera_control(double distance=80.0, double theta=0.0, double phi=-60.0f *M_PI/180.0f)
Use orbit camera control (XY plane) useful for systems in which XYZ = front-left-up like LiDAR odomet...
void lookat(const Eigen::Vector3f &pt)
Make the camera look at a point.
void use_topdown_camera_control(double distance=80.0, double theta=0.0)
Use top-down camera control useful for 2D SLAM.
void save_camera_settings(const std::string &path)
Save camera settings to a file.
void set_backface_culling_range(const Eigen::Vector2f &range)
Set range of normal.z for backface culling.
void remove_ui_callback(const std::string &name)
Remove a UI callback function.
void use_orbit_camera_control_xz(double distance=80.0, double theta=0.0, double phi=0.0)
Use orbit camera control (XZ plane) useful for systems in which XYZ = right-down-forward like visual ...
void append_text(const std::string &text)
Append debug text to the viewer. This method is thread-safe.
void disable_xy_grid()
Disable XY grid drawing.
Definition async_light_viewer_context.hpp:34
void use_sensor_view_camera_control(const Eigen::Isometry3f &T_sensor_camera=Eigen::Translation3f(-5.0f, 0.0f, 0.1f) *Eigen::Isometry3f::Identity(), double smoothing_factor_trans=0.75, double smoothing_factor_rot=0.9)
Use TPS-like sensor-view camera control .
void use_fps_camera_control(double fovy_deg=60.0)
Use FPS game-like camera control.
void disable_partial_rendering()
Disable partial rendering.
void update_cone(const std::string &name, const ShaderSetting &shader_setting)
Register or update a cone primitive.
void use_orthographic_projection_control(float width=10.0f, float near_=1.0f, float far_=1000.0f)
Use orthographic projection control.
void update_wire_sphere(const std::string &name, const ShaderSetting &shader_setting)
Register or update a wireframe sphere primitive.
void update_points(const std::string &name, const float *data, int stride, int num_points, const ShaderSetting &shader_setting)
Register or update a point cloud buffer.
void update_drawable_setting(const std::string &name, const ShaderSetting &shader_setting)
Update a drawable's shader setting.
void update_normal_dists(const std::string &name, const Eigen::Matrix< Scalar, Dim, 1 > *points, const Eigen::Matrix< Scalar, Dim, Dim > *covs, int num_points, float sigma, const ShaderSetting &shader_setting)
Register or update a normal distribution set.
void enable_partial_rendering(double clear_thresh=1e-6)
Enable partial rendering.
void update_frustum(const std::string &name, const ShaderSetting &shader_setting)
Register or update a frustum primitive.
void update_icosahedron(const std::string &name, const ShaderSetting &shader_setting)
Register or update an icosahedron primitive.
void update_coord(const std::string &name, const ShaderSetting &shader_setting)
Register or update a coordinate axes primitive.
void update_sphere(const std::string &name, const ShaderSetting &shader_setting)
Register or update a sphere primitive.
void remove_drawable(const std::regex &regex)
Remove all drawables that match the given regex.
void save_depth_buffer(const std::string &filename, bool real_scale=true)
Save depth buffer to a file (PNG).
void use_perspective_projection_control(float fovy_deg=30.0f, float near_=1.0f, float far_=1000.0f)
Use perspective projection control.
void clear_drawables()
Clear all drawables.
void update_thin_lines(const std::string &name, const float *vertices, const float *colors, int num_vertices, const unsigned int *indices, int num_indices, bool line_strip, float line_width, const ShaderSetting &shader_setting)
Register or update a thin lines drawable.
void set_colormap(glk::COLORMAP colormap)
Set colormap used for RAINBOW and VERTEX_COLORMAP modes.
void enable_xy_grid()
Enable XY grid drawing.
Definition async_light_viewer_context.hpp:36
void update_points(const std::string &name, const float *vertices, int vertex_stride, const float *colors, int color_stride, int num_points, const ShaderSetting &shader_setting)
Register or update a point cloud buffer with colors.
void lookat(const Eigen::Isometry3f &T_world_sensor)
Make the camera look at a transform.
void update_wire_cube(const std::string &name, const ShaderSetting &shader_setting)
Register or update a wireframe cube primitive.
void remove_drawable(const std::string &name)
Remove a drawable by name.
void register_ui_callback(const std::string &name, const std::function< void()> &callback=0)
Register a UI callback function.
void lookat(const Vector &pt)
Make the camera look at a point.
Definition async_light_viewer_context.hpp:85
LightViewerContext * context
Definition async_light_viewer_context.hpp:362
void clear_text()
Clear texts.
void update_cube(const std::string &name, const ShaderSetting &shader_setting)
Register or update a cube primitive.
void set_draw_xy_grid(bool draw_xy_grid)
Set enable/disable XY grid drawing.
void lookat(const Eigen::Isometry3d &T_world_sensor)
Make the camera look at a transform.
void update_thin_lines(const std::string &name, const float *vertices, const float *colors, int num_vertices, const unsigned int *indices, int num_indices, bool line_strip, const ShaderSetting &shader_setting)
void use_arcball_camera_control(double distance=80.0, double theta=0.0, double phi=-60.0f *M_PI/180.0f)
Use arcball camera control.
void enable_backface_culling()
Enable backface culling. Fragments with back-facing normals will not be rendered.
void disable_backface_culling()
Disable backface culling.
void save_color_buffer(const std::string &filename)
Save color buffer to an image file (PNG).
void update_wire_icosahedron(const std::string &name, const ShaderSetting &shader_setting)
Register or update a wireframe icosahedron primitive.
void clear_drawables(const std::function< bool(const std::string &)> &fn)
Clear drawables that satisfy the given condition.
Viewer context.
Definition light_viewer_context.hpp:37
std::enable_if_t< std::is_same< Dst_Scalar, Src_Scalar >::value, std::vector< Eigen::Matrix< Dst_Scalar, Dst_Rows, Dst_Cols >, Allocator< Eigen::Matrix< Dst_Scalar, Dst_Rows, Dst_Cols > > > > convert_to_vector(const Eigen::Matrix< Src_Scalar, Src_Rows, Src_Cols > *points, int num_points)
Definition type_conversion.hpp:49
COLORMAP
Definition colormap.hpp:9
Definition drawable_container.hpp:9
Shader setting class that holds rendering settings.
Definition shader_setting.hpp:187