AsciiRenderer.hpp
Go to the documentation of this file.
1 #ifndef LVR2_ASCII_RENDERER_HPP
2 #define LVR2_ASCII_RENDERER_HPP
3 
5 #include "Braille.hpp"
6 #include "BitField.hpp"
7 #include <ncursesw/ncurses.h>
8 #include <unordered_map>
9 #include "lvr2/io/MeshBuffer.hpp"
11 
12 #include "CursesHelper.hpp"
13 
14 #include <embree3/rtcore.h>
15 #include <memory>
16 
17 namespace lvr2 {
18 
19 
20 void AsciiRendererErrorFunc(void* userPtr, enum RTCError error, const char* str);
21 
23 public:
26  const unsigned int& num_grays = 200
27  );
29 
30  void set(const unsigned int& i, const unsigned int& j);
31  void clear(const unsigned int& i, const unsigned int& j);
32  void clear();
33 
34 
35 
36  void render();
37  void processKey(int key);
38 
39  unsigned int width();
40  unsigned int height();
41 
42 protected:
43 
44  void raycast();
45 
46 private:
47 
48 
49  void initBuffers();
50  void destroyBuffers();
51  void initEmbree(MeshBufferPtr mesh);
52  void destroyEmbree();
53  RTCScene initializeScene(
54  RTCDevice device,
55  const MeshBufferPtr mesh);
56  RTCDevice initializeDevice();
57 
58  void consolePrintMessage(std::string message);
60 
61  void printControls();
62 
63  std::vector<std::string> m_messages;
64 
65  unsigned int m_ascii_width;
66  unsigned int m_ascii_height;
67  unsigned int m_num_grays;
68 
69  WINDOW* m_window;
70 
72 
73  float** m_colors;
74 
75  RTCDevice m_device;
76  RTCScene m_scene;
77  RTCIntersectContext m_context;
78 
79  // Camera
80  Eigen::Affine3d m_camera;
81 
82  // Dynamic cam intrinsics
83  // Button and Keyboard
84 
85  bool m_track_mouse = false;
86  double m_mouse_x;
87  double m_mouse_y;
88 
89  // show controls
90  bool m_show_controls = false;
91 
92  // controls params
93  double m_vrot = 0.005;
94  double m_vtrans = 0.5;
95  double m_sidereduce = 0.8;
96  double m_boost = 3.0;
97 
98  double m_avg_fps = 20;
99  double m_fps_alpha = 0.8;
100 
101 };
102 
103 using AsciiRendererPtr = std::shared_ptr<AsciiRenderer>;
104 
105 } // namespace lvr2
106 
107 
108 
109 #endif // LVR2_ASCII_RENDERER_HPP
HalfEdgeMesh< Vec > mesh
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
RTCDevice initializeDevice()
AsciiRenderer(MeshBufferPtr mesh, const unsigned int &num_grays=200)
unsigned int height()
unsigned int m_ascii_width
void AsciiRendererErrorFunc(void *userPtr, enum RTCError error, const char *str)
void consolePrintMessage(std::string message)
RTCIntersectContext m_context
unsigned int m_num_grays
unsigned int m_ascii_height
void initEmbree(MeshBufferPtr mesh)
void processKey(int key)
Eigen::Affine3d m_camera
KF_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func="")
Error handler. All GPU functions from this subsystem call the function to report an error...
RTCScene initializeScene(RTCDevice device, const MeshBufferPtr mesh)
std::shared_ptr< AsciiRenderer > AsciiRendererPtr
unsigned int width()
std::vector< std::string > m_messages
BrailleChar ** m_chars


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06