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();
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
lvr2::AsciiRenderer::m_ascii_height
unsigned int m_ascii_height
Definition: AsciiRenderer.hpp:66
lvr2::AsciiRenderer::m_chars
BrailleChar ** m_chars
Definition: AsciiRenderer.hpp:71
lvr2::AsciiRenderer::~AsciiRenderer
~AsciiRenderer()
Definition: AsciiRenderer.cpp:34
lvr2::AsciiRenderer::set
void set(const unsigned int &i, const unsigned int &j)
Definition: AsciiRenderer.cpp:163
lvr2::AsciiRenderer::initEmbree
void initEmbree(MeshBufferPtr mesh)
Definition: AsciiRenderer.cpp:90
lvr2::AsciiRenderer::m_colors
float ** m_colors
Definition: AsciiRenderer.hpp:73
lvr2::AsciiRenderer::m_mouse_x
double m_mouse_x
Definition: AsciiRenderer.hpp:86
lvr2::AsciiRenderer::m_boost
double m_boost
Definition: AsciiRenderer.hpp:96
lvr2::AsciiRenderer::m_show_controls
bool m_show_controls
Definition: AsciiRenderer.hpp:90
CursesHelper.hpp
lvr2::AsciiRenderer::m_camera
Eigen::Affine3d m_camera
Definition: AsciiRenderer.hpp:80
lvr2::AsciiRenderer::destroyBuffers
void destroyBuffers()
Definition: AsciiRenderer.cpp:69
lvr2::AsciiRenderer::destroyEmbree
void destroyEmbree()
Definition: AsciiRenderer.cpp:157
lvr2::AsciiRenderer::m_avg_fps
double m_avg_fps
Definition: AsciiRenderer.hpp:98
lvr2::AsciiRenderer::consolePrintMessage
void consolePrintMessage(std::string message)
Definition: AsciiRenderer.cpp:407
lvr2::AsciiRenderer::initializeDevice
RTCDevice initializeDevice()
Definition: AsciiRenderer.cpp:97
lvr2::AsciiRenderer::clear
void clear()
Definition: AsciiRenderer.cpp:185
lvr2::AsciiRenderer::m_vtrans
double m_vtrans
Definition: AsciiRenderer.hpp:94
lvr2::AsciiRenderer::m_num_grays
unsigned int m_num_grays
Definition: AsciiRenderer.hpp:67
lvr2::AsciiRenderer::raycast
void raycast()
Definition: AsciiRenderer.cpp:197
Braille.hpp
lvr2::AsciiRenderer::initBuffers
void initBuffers()
Definition: AsciiRenderer.cpp:41
lvr2::AsciiRenderer::consoleReleaseMessages
void consoleReleaseMessages()
Definition: AsciiRenderer.cpp:412
lvr2::AsciiRenderer::height
unsigned int height()
Definition: AsciiRenderer.cpp:450
lvr2::AsciiRenderer::m_window
WINDOW * m_window
Definition: AsciiRenderer.hpp:69
lvr2::AsciiRenderer::m_fps_alpha
double m_fps_alpha
Definition: AsciiRenderer.hpp:99
lvr2::AsciiRenderer
Definition: AsciiRenderer.hpp:22
lvr2::AsciiRenderer::m_device
RTCDevice m_device
Definition: AsciiRenderer.hpp:75
lvr2::AsciiRenderer::m_context
RTCIntersectContext m_context
Definition: AsciiRenderer.hpp:77
MatrixTypes.hpp
lvr2::AsciiRenderer::initializeScene
RTCScene initializeScene(RTCDevice device, const MeshBufferPtr mesh)
Definition: AsciiRenderer.cpp:110
lvr2::AsciiRenderer::width
unsigned int width()
Definition: AsciiRenderer.cpp:445
MeshBuffer.hpp
lvr2::AsciiRenderer::AsciiRenderer
AsciiRenderer(MeshBufferPtr mesh, const unsigned int &num_grays=200)
Definition: AsciiRenderer.cpp:13
lvr2::AsciiRenderer::m_messages
std::vector< std::string > m_messages
Definition: AsciiRenderer.hpp:63
BitField.hpp
lvr2::AsciiRenderer::m_mouse_y
double m_mouse_y
Definition: AsciiRenderer.hpp:87
lvr2::BrailleChar
Definition: Braille.hpp:317
lvr2::AsciiRendererErrorFunc
void AsciiRendererErrorFunc(void *userPtr, enum RTCError error, const char *str)
Definition: AsciiRenderer.cpp:8
lvr2::AsciiRenderer::processKey
void processKey(int key)
Definition: AsciiRenderer.cpp:268
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::AsciiRenderer::m_track_mouse
bool m_track_mouse
Definition: AsciiRenderer.hpp:85
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
kfusion::cuda::error
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....
Definition: device_memory.cpp:7
lvr2::AsciiRendererPtr
std::shared_ptr< AsciiRenderer > AsciiRendererPtr
Definition: AsciiRenderer.hpp:103
lvr2::AsciiRenderer::m_scene
RTCScene m_scene
Definition: AsciiRenderer.hpp:76
lvr2::AsciiRenderer::printControls
void printControls()
Definition: AsciiRenderer.cpp:426
lvr2::AsciiRenderer::m_vrot
double m_vrot
Definition: AsciiRenderer.hpp:93
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26
lvr2::AsciiRenderer::m_ascii_width
unsigned int m_ascii_width
Definition: AsciiRenderer.hpp:65
lvr2::AsciiRenderer::render
void render()
Definition: AsciiRenderer.cpp:369
lvr2::AsciiRenderer::m_sidereduce
double m_sidereduce
Definition: AsciiRenderer.hpp:95


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 Wed Mar 2 2022 00:37:22