Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
igl::opengl::glfw::Viewer Class Reference

#include <src/libigl/igl/opengl/glfw/Viewer.h>

+ Collaboration diagram for igl::opengl::glfw::Viewer:

Public Types

enum class  MouseButton { Left , Middle , Right }
 
enum class  MouseMode {
  None , Rotation , Zoom , Pan ,
  Translation
}
 

Public Member Functions

IGL_INLINE int launch (bool resizable=true, bool fullscreen=false)
 
IGL_INLINE int launch_init (bool resizable=true, bool fullscreen=false)
 
IGL_INLINE bool launch_rendering (bool loop=true)
 
IGL_INLINE void launch_shut ()
 
IGL_INLINE void init ()
 
IGL_INLINE void init_plugins ()
 
IGL_INLINE void shutdown_plugins ()
 
 Viewer ()
 
 ~Viewer ()
 
IGL_INLINE bool load_mesh_from_file (const std::string &mesh_file_name)
 
IGL_INLINE bool save_mesh_to_file (const std::string &mesh_file_name)
 
IGL_INLINE bool key_pressed (unsigned int unicode_key, int modifier)
 
IGL_INLINE bool key_down (int key, int modifier)
 
IGL_INLINE bool key_up (int key, int modifier)
 
IGL_INLINE bool mouse_down (MouseButton button, int modifier)
 
IGL_INLINE bool mouse_up (MouseButton button, int modifier)
 
IGL_INLINE bool mouse_move (int mouse_x, int mouse_y)
 
IGL_INLINE bool mouse_scroll (float delta_y)
 
IGL_INLINE bool load_scene ()
 
IGL_INLINE bool load_scene (std::string fname)
 
IGL_INLINE bool save_scene ()
 
IGL_INLINE bool save_scene (std::string fname)
 
IGL_INLINE void draw ()
 
IGL_INLINE void resize (int w, int h)
 
IGL_INLINE void post_resize (int w, int h)
 
IGL_INLINE void snap_to_canonical_quaternion ()
 
IGL_INLINE void open_dialog_load_mesh ()
 
IGL_INLINE void open_dialog_save_mesh ()
 
IGL_INLINE ViewerDatadata ()
 
IGL_INLINE int append_mesh ()
 
IGL_INLINE bool erase_mesh (const size_t index)
 
IGL_INLINE size_t mesh_index (const int id) const
 

Public Attributes

enum igl::opengl::glfw::Viewer::MouseMode mouse_mode
 
std::vector< ViewerDatadata_list
 
size_t selected_data_index
 
int next_data_id
 
GLFWwindow * window
 
ViewerCore core
 
std::vector< ViewerPlugin * > plugins
 
Eigen::Quaternionf down_rotation
 
int current_mouse_x
 
int current_mouse_y
 
int down_mouse_x
 
int down_mouse_y
 
float down_mouse_z
 
Eigen::Vector3f down_translation
 
bool down
 
bool hack_never_moved
 
float scroll_position
 
std::function< bool(Viewer &viewer)> callback_init
 
std::function< bool(Viewer &viewer)> callback_pre_draw
 
std::function< bool(Viewer &viewer)> callback_post_draw
 
std::function< bool(Viewer &viewer, int button, int modifier)> callback_mouse_down
 
std::function< bool(Viewer &viewer, int button, int modifier)> callback_mouse_up
 
std::function< bool(Viewer &viewer, int mouse_x, int mouse_y)> callback_mouse_move
 
std::function< bool(Viewer &viewer, float delta_y)> callback_mouse_scroll
 
std::function< bool(Viewer &viewer, unsigned int key, int modifiers)> callback_key_pressed
 
std::function< bool(Viewer &viewer, unsigned int key, int modifiers)> callback_key_down
 
std::function< bool(Viewer &viewer, unsigned int key, int modifiers)> callback_key_up
 
voidcallback_init_data
 
voidcallback_pre_draw_data
 
voidcallback_post_draw_data
 
voidcallback_mouse_down_data
 
voidcallback_mouse_up_data
 
voidcallback_mouse_move_data
 
voidcallback_mouse_scroll_data
 
voidcallback_key_pressed_data
 
voidcallback_key_down_data
 
voidcallback_key_up_data
 

Detailed Description

Member Enumeration Documentation

◆ MouseButton

◆ MouseMode

Constructor & Destructor Documentation

◆ Viewer()

IGL_INLINE igl::opengl::glfw::Viewer::Viewer ( )
286 :
287 data_list(1),
289 next_data_id(1)
290 {
291 window = nullptr;
292 data_list.front().id = 0;
293
294 // Temporary variables initialization
295 down = false;
296 hack_never_moved = true;
297 scroll_position = 0.0f;
298
299 // Per face
300 data().set_face_based(false);
301
302 // C-style callbacks
303 callback_init = nullptr;
304 callback_pre_draw = nullptr;
305 callback_post_draw = nullptr;
306 callback_mouse_down = nullptr;
307 callback_mouse_up = nullptr;
308 callback_mouse_move = nullptr;
309 callback_mouse_scroll = nullptr;
310 callback_key_down = nullptr;
311 callback_key_up = nullptr;
312
313 callback_init_data = nullptr;
314 callback_pre_draw_data = nullptr;
315 callback_post_draw_data = nullptr;
316 callback_mouse_down_data = nullptr;
317 callback_mouse_up_data = nullptr;
318 callback_mouse_move_data = nullptr;
320 callback_key_down_data = nullptr;
321 callback_key_up_data = nullptr;
322
323#ifndef IGL_VIEWER_VIEWER_QUIET
324 const std::string usage(R"(igl::opengl::glfw::Viewer usage:
325 [drag] Rotate scene
326 A,a Toggle animation (tight draw loop)
327 F,f Toggle face based
328 I,i Toggle invert normals
329 L,l Toggle wireframe
330 O,o Toggle orthographic/perspective projection
331 T,t Toggle filled faces
332 Z Snap to canonical view
333 [,] Toggle between rotation control types (trackball, two-axis
334 valuator with fixed up, 2D mode with no rotation))
335 <,> Toggle between models
336 ; Toggle vertex labels
337 : Toggle face labels)"
338);
339 std::cout<<usage<<std::endl;
340#endif
341 }
IGL_INLINE void set_face_based(bool newvalue)
Definition ViewerData.cpp:38
std::function< bool(Viewer &viewer)> callback_init
Definition Viewer.h:143
void * callback_mouse_scroll_data
Definition Viewer.h:161
std::function< bool(Viewer &viewer, int button, int modifier)> callback_mouse_up
Definition Viewer.h:147
void * callback_init_data
Definition Viewer.h:155
int next_data_id
Definition Viewer.h:122
size_t selected_data_index
Definition Viewer.h:121
std::function< bool(Viewer &viewer, float delta_y)> callback_mouse_scroll
Definition Viewer.h:149
std::function< bool(Viewer &viewer)> callback_pre_draw
Definition Viewer.h:144
bool down
Definition Viewer.h:136
bool hack_never_moved
Definition Viewer.h:137
std::function< bool(Viewer &viewer, unsigned int key, int modifiers)> callback_key_down
Definition Viewer.h:152
std::function< bool(Viewer &viewer, int mouse_x, int mouse_y)> callback_mouse_move
Definition Viewer.h:148
std::function< bool(Viewer &viewer)> callback_post_draw
Definition Viewer.h:145
void * callback_pre_draw_data
Definition Viewer.h:156
void * callback_post_draw_data
Definition Viewer.h:157
GLFWwindow * window
Definition Viewer.h:123
std::function< bool(Viewer &viewer, unsigned int key, int modifiers)> callback_key_up
Definition Viewer.h:153
void * callback_key_down_data
Definition Viewer.h:163
void * callback_mouse_move_data
Definition Viewer.h:160
void * callback_mouse_down_data
Definition Viewer.h:158
void * callback_mouse_up_data
Definition Viewer.h:159
float scroll_position
Definition Viewer.h:139
std::function< bool(Viewer &viewer, int button, int modifier)> callback_mouse_down
Definition Viewer.h:146
void * callback_key_up_data
Definition Viewer.h:164
IGL_INLINE ViewerData & data()
Definition Viewer.cpp:901
std::vector< ViewerData > data_list
Definition Viewer.h:119
static void usage(void)
Definition main.c:208

References callback_init, callback_init_data, callback_key_down, callback_key_down_data, callback_key_up, callback_key_up_data, callback_mouse_down, callback_mouse_down_data, callback_mouse_move, callback_mouse_move_data, callback_mouse_scroll, callback_mouse_scroll_data, callback_mouse_up, callback_mouse_up_data, callback_post_draw, callback_post_draw_data, callback_pre_draw, callback_pre_draw_data, data(), data_list, down, hack_never_moved, scroll_position, igl::opengl::ViewerData::set_face_based(), usage(), and window.

+ Here is the call graph for this function:

◆ ~Viewer()

IGL_INLINE igl::opengl::glfw::Viewer::~Viewer ( )
344 {
345 }

Member Function Documentation

◆ append_mesh()

IGL_INLINE int igl::opengl::glfw::Viewer::append_mesh ( )
911 {
912 assert(data_list.size() >= 1);
913
914 data_list.emplace_back();
916 data_list.back().id = next_data_id++;
917 return data_list.back().id;
918 }

References data_list, next_data_id, and selected_data_index.

Referenced by load_mesh_from_file().

+ Here is the caller graph for this function:

◆ data()

IGL_INLINE ViewerData & igl::opengl::glfw::Viewer::data ( )
902 {
903 assert(!data_list.empty() && "data_list should never be empty");
904 assert(
906 "selected_data_index should be in bounds");
908 }

References data_list, and selected_data_index.

Referenced by Viewer(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), key_pressed(), launch_init(), launch_shut(), load_mesh_from_file(), load_scene(), mouse_down(), save_mesh_to_file(), and save_scene().

+ Here is the caller graph for this function:

◆ draw()

IGL_INLINE void igl::opengl::glfw::Viewer::draw ( )
805 {
806 using namespace std;
807 using namespace Eigen;
808
809 int width, height;
810 glfwGetFramebufferSize(window, &width, &height);
811
812 int width_window, height_window;
813 glfwGetWindowSize(window, &width_window, &height_window);
814
815 auto highdpi_tmp = width/width_window;
816
817 if(fabs(highdpi_tmp-highdpi)>1e-8)
818 {
819 post_resize(width, height);
820 highdpi=highdpi_tmp;
821 }
822
825 {
826 if (callback_pre_draw(*this))
827 {
828 return;
829 }
830 }
831 for (unsigned int i = 0; i<plugins.size(); ++i)
832 {
833 if (plugins[i]->pre_draw())
834 {
835 return;
836 }
837 }
838 for(int i = 0;i<data_list.size();i++)
839 {
840 core.draw(data_list[i]);
841 }
843 {
844 if (callback_post_draw(*this))
845 {
846 return;
847 }
848 }
849 for (unsigned int i = 0; i<plugins.size(); ++i)
850 {
851 if (plugins[i]->post_draw())
852 {
853 break;
854 }
855 }
856 }
static double highdpi
Definition Viewer.cpp:49
IGL_INLINE void clear_framebuffers()
Definition ViewerCore.cpp:88
IGL_INLINE void draw(ViewerData &data, bool update_matrices=true)
Definition ViewerCore.cpp:97
ViewerCore core
Definition Viewer.h:125
std::vector< ViewerPlugin * > plugins
Definition Viewer.h:127
IGL_INLINE void post_resize(int w, int h)
Definition Viewer.cpp:866
Definition LDLT.h:16
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:539
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:540
STL namespace.

References callback_post_draw, callback_pre_draw, igl::opengl::ViewerCore::clear_framebuffers(), core, data_list, igl::opengl::ViewerCore::draw(), highdpi, plugins, post_resize(), and window.

Referenced by launch_rendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ erase_mesh()

IGL_INLINE bool igl::opengl::glfw::Viewer::erase_mesh ( const size_t  index)
921 {
922 assert((index >= 0 && index < data_list.size()) && "index should be in bounds");
923 assert(data_list.size() >= 1);
924 if(data_list.size() == 1)
925 {
926 // Cannot remove last mesh
927 return false;
928 }
929 data_list[index].meshgl.free();
930 data_list.erase(data_list.begin() + index);
932 {
934 }
935 return true;
936 }

References data_list, and selected_data_index.

◆ init()

IGL_INLINE void igl::opengl::glfw::Viewer::init ( )
259 {
260 core.init();
261
262 if (callback_init)
263 if (callback_init(*this))
264 return;
265
266 init_plugins();
267 }
IGL_INLINE void init()
Definition ViewerCore.cpp:385
IGL_INLINE void init_plugins()
Definition Viewer.cpp:269

References callback_init, core, igl::opengl::ViewerCore::init(), and init_plugins().

Referenced by launch_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_plugins()

IGL_INLINE void igl::opengl::glfw::Viewer::init_plugins ( )
270 {
271 // Init all plugins
272 for (unsigned int i = 0; i<plugins.size(); ++i)
273 {
274 plugins[i]->init(this);
275 }
276 }

References plugins.

Referenced by init().

+ Here is the caller graph for this function:

◆ key_down()

IGL_INLINE bool igl::opengl::glfw::Viewer::key_down ( int  key,
int  modifier 
)
565 {
567 if (callback_key_down(*this,key,modifiers))
568 return true;
569 for (unsigned int i = 0; i<plugins.size(); ++i)
570 if (plugins[i]->key_down(key, modifiers))
571 return true;
572 return false;
573 }
IGL_INLINE bool key_down(int key, int modifier)
Definition Viewer.cpp:564

References callback_key_down, key_down(), and plugins.

Referenced by glfw_key_callback(), and key_down().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key_pressed()

IGL_INLINE bool igl::opengl::glfw::Viewer::key_pressed ( unsigned int  unicode_key,
int  modifier 
)
479 {
481 if (callback_key_pressed(*this,unicode_key,modifiers))
482 return true;
483
484 for (unsigned int i = 0; i<plugins.size(); ++i)
485 {
486 if (plugins[i]->key_pressed(unicode_key, modifiers))
487 {
488 return true;
489 }
490 }
491
492 switch(unicode_key)
493 {
494 case 'A':
495 case 'a':
496 {
498 return true;
499 }
500 case 'F':
501 case 'f':
502 {
503 data().set_face_based(!data().face_based);
504 return true;
505 }
506 case 'I':
507 case 'i':
508 {
511 return true;
512 }
513 case 'L':
514 case 'l':
515 {
517 return true;
518 }
519 case 'O':
520 case 'o':
521 {
523 return true;
524 }
525 case 'T':
526 case 't':
527 {
529 return true;
530 }
531 case 'Z':
532 {
534 return true;
535 }
536 case '[':
537 case ']':
538 {
541 else
543
544 return true;
545 }
546 case '<':
547 case '>':
548 {
550 (selected_data_index + data_list.size() + (unicode_key=='>'?1:-1))%data_list.size();
551 return true;
552 }
553 case ';':
555 return true;
556 case ':':
558 return true;
559 default: break;//do nothing
560 }
561 return false;
562 }
@ DIRTY_NORMAL
Definition MeshGL.h:33
IGL_INLINE void set_rotation_type(const RotationType &value)
Definition ViewerCore.cpp:336
bool is_animating
Definition ViewerCore.h:122
bool orthographic
Definition ViewerCore.h:109
@ ROTATION_TYPE_TRACKBALL
Definition ViewerCore.h:87
@ ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP
Definition ViewerCore.h:88
RotationType rotation_type
Definition ViewerCore.h:103
bool invert_normals
Definition ViewerData.h:187
uint32_t dirty
Definition ViewerData.h:174
bool show_faceid
Definition ViewerData.h:186
bool show_vertid
Definition ViewerData.h:185
bool show_lines
Definition ViewerData.h:184
bool show_faces
Definition ViewerData.h:183
std::function< bool(Viewer &viewer, unsigned int key, int modifiers)> callback_key_pressed
Definition Viewer.h:150
IGL_INLINE bool key_pressed(unsigned int unicode_key, int modifier)
Definition Viewer.cpp:478
IGL_INLINE void snap_to_canonical_quaternion()
Definition Viewer.cpp:875

References callback_key_pressed, core, data(), data_list, igl::opengl::ViewerData::dirty, igl::opengl::MeshGL::DIRTY_NORMAL, igl::opengl::ViewerData::invert_normals, igl::opengl::ViewerCore::is_animating, key_pressed(), igl::opengl::ViewerCore::orthographic, plugins, igl::opengl::ViewerCore::rotation_type, igl::opengl::ViewerCore::ROTATION_TYPE_TRACKBALL, igl::opengl::ViewerCore::ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP, selected_data_index, igl::opengl::ViewerData::set_face_based(), igl::opengl::ViewerCore::set_rotation_type(), igl::opengl::ViewerData::show_faceid, igl::opengl::ViewerData::show_faces, igl::opengl::ViewerData::show_lines, igl::opengl::ViewerData::show_vertid, and snap_to_canonical_quaternion().

Referenced by glfw_char_mods_callback(), and key_pressed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key_up()

IGL_INLINE bool igl::opengl::glfw::Viewer::key_up ( int  key,
int  modifier 
)
576 {
577 if (callback_key_up)
578 if (callback_key_up(*this,key,modifiers))
579 return true;
580
581 for (unsigned int i = 0; i<plugins.size(); ++i)
582 if (plugins[i]->key_up(key, modifiers))
583 return true;
584
585 return false;
586 }
IGL_INLINE bool key_up(int key, int modifier)
Definition Viewer.cpp:575

References callback_key_up, key_up(), and plugins.

Referenced by glfw_key_callback(), and key_up().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launch()

IGL_INLINE int igl::opengl::glfw::Viewer::launch ( bool  resizable = true,
bool  fullscreen = false 
)
127 {
128 // TODO return values are being ignored...
129 launch_init(resizable,fullscreen);
130 launch_rendering(true);
131 launch_shut();
132 return EXIT_SUCCESS;
133 }
IGL_INLINE int launch_init(bool resizable=true, bool fullscreen=false)
Definition Viewer.cpp:135
IGL_INLINE void launch_shut()
Definition Viewer.cpp:245
IGL_INLINE bool launch_rendering(bool loop=true)
Definition Viewer.cpp:212

References launch_init(), launch_rendering(), and launch_shut().

+ Here is the call graph for this function:

◆ launch_init()

IGL_INLINE int igl::opengl::glfw::Viewer::launch_init ( bool  resizable = true,
bool  fullscreen = false 
)
136 {
137 glfwSetErrorCallback(glfw_error_callback);
138 if (!glfwInit())
139 {
140 return EXIT_FAILURE;
141 }
142 glfwWindowHint(GLFW_SAMPLES, 8);
143 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
144 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
145 #ifdef __APPLE__
146 glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
147 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
148 #endif
149 if(fullscreen)
150 {
151 GLFWmonitor *monitor = glfwGetPrimaryMonitor();
152 const GLFWvidmode *mode = glfwGetVideoMode(monitor);
153 window = glfwCreateWindow(mode->width,mode->height,"libigl viewer",monitor,nullptr);
154 }
155 else
156 {
157 if (core.viewport.tail<2>().any()) {
158 window = glfwCreateWindow(core.viewport(2),core.viewport(3),"libigl viewer",nullptr,nullptr);
159 } else {
160 window = glfwCreateWindow(1280,800,"libigl viewer",nullptr,nullptr);
161 }
162 }
163 if (!window)
164 {
165 glfwTerminate();
166 return EXIT_FAILURE;
167 }
168 glfwMakeContextCurrent(window);
169 // Load OpenGL and its extensions
170 if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
171 {
172 printf("Failed to load OpenGL and its extensions\n");
173 return(-1);
174 }
175 #if defined(DEBUG) || defined(_DEBUG)
176 printf("OpenGL Version %d.%d loaded\n", GLVersion.major, GLVersion.minor);
177 int major, minor, rev;
178 major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
179 minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);
180 rev = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION);
181 printf("OpenGL version received: %d.%d.%d\n", major, minor, rev);
182 printf("Supported OpenGL is %s\n", (const char*)glGetString(GL_VERSION));
183 printf("Supported GLSL is %s\n", (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
184 #endif
185 glfwSetInputMode(window,GLFW_CURSOR,GLFW_CURSOR_NORMAL);
186 // Initialize FormScreen
187 __viewer = this;
188 // Register callbacks
189 glfwSetKeyCallback(window, glfw_key_callback);
190 glfwSetCursorPosCallback(window,glfw_mouse_move);
191 glfwSetWindowSizeCallback(window,glfw_window_size);
192 glfwSetMouseButtonCallback(window,glfw_mouse_press);
193 glfwSetScrollCallback(window,glfw_mouse_scroll);
194 glfwSetCharModsCallback(window,glfw_char_mods_callback);
195 glfwSetDropCallback(window,glfw_drop_callback);
196 // Handle retina displays (windows and mac)
197 int width, height;
198 glfwGetFramebufferSize(window, &width, &height);
199 int width_window, height_window;
200 glfwGetWindowSize(window, &width_window, &height_window);
201 highdpi = width/width_window;
202 glfw_window_size(window,width_window,height_window);
203 //opengl.init();
205 // Initialize IGL viewer
206 init();
207 return EXIT_SUCCESS;
208 }
static void glfw_error_callback(int error, const char *description)
Definition Viewer.cpp:71
static void glfw_char_mods_callback(GLFWwindow *window, unsigned int codepoint, int modifier)
Definition Viewer.cpp:76
static igl::opengl::glfw::Viewer * __viewer
Definition Viewer.cpp:48
static void glfw_mouse_press(GLFWwindow *window, int button, int action, int modifier)
Definition Viewer.cpp:53
static void glfw_mouse_scroll(GLFWwindow *window, double x, double y)
Definition Viewer.cpp:106
static void glfw_mouse_move(GLFWwindow *window, double x, double y)
Definition Viewer.cpp:101
static void glfw_drop_callback(GLFWwindow *window, int count, const char **filenames)
Definition Viewer.cpp:115
static void glfw_window_size(GLFWwindow *window, int width, int height)
Definition Viewer.cpp:92
static void glfw_key_callback(GLFWwindow *window, int key, int scancode, int action, int modifier)
Definition Viewer.cpp:81
IGL_INLINE void align_camera_center(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F)
Definition ViewerCore.cpp:22
Eigen::Vector4f viewport
Definition ViewerCore.h:129
IGL_INLINE void init()
Definition Viewer.cpp:258
#define GL_TRUE
Definition glu-libtess.h:70
IGL_INLINE void mode(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &X, const int d, Eigen::Matrix< T, Eigen::Dynamic, 1 > &M)
Definition mode.cpp:14

References __viewer, igl::opengl::ViewerCore::align_camera_center(), core, data(), GL_TRUE, glfw_char_mods_callback(), glfw_drop_callback(), glfw_error_callback(), glfw_key_callback(), glfw_mouse_move(), glfw_mouse_press(), glfw_mouse_scroll(), glfw_window_size(), highdpi, init(), igl::mode(), igl::opengl::ViewerCore::viewport, and window.

Referenced by launch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launch_rendering()

IGL_INLINE bool igl::opengl::glfw::Viewer::launch_rendering ( bool  loop = true)
213 {
214 // glfwMakeContextCurrent(window);
215 // Rendering loop
216 const int num_extra_frames = 5;
217 int frame_counter = 0;
218 while (!glfwWindowShouldClose(window))
219 {
220 double tic = get_seconds();
221 draw();
222 glfwSwapBuffers(window);
223 if(core.is_animating || frame_counter++ < num_extra_frames)
224 {
225 glfwPollEvents();
226 // In microseconds
227 double duration = 1000000.*(get_seconds()-tic);
228 const double min_duration = 1000000./core.animation_max_fps;
229 if(duration<min_duration)
230 {
231 std::this_thread::sleep_for(std::chrono::microseconds((int)(min_duration-duration)));
232 }
233 }
234 else
235 {
236 glfwWaitEvents();
237 frame_counter = 0;
238 }
239 if (!loop)
240 return !glfwWindowShouldClose(window);
241 }
242 return EXIT_SUCCESS;
243 }
double animation_max_fps
Definition ViewerCore.h:123
IGL_INLINE void draw()
Definition Viewer.cpp:804
IGL_INLINE double get_seconds()
Definition get_seconds.cpp:10
IGL_INLINE void loop(const int n_verts, const Eigen::PlainObjectBase< DerivedF > &F, Eigen::SparseMatrix< SType > &S, Eigen::PlainObjectBase< DerivedNF > &NF)
Definition loop.cpp:21

References igl::opengl::ViewerCore::animation_max_fps, core, draw(), igl::get_seconds(), igl::opengl::ViewerCore::is_animating, igl::loop(), and window.

Referenced by launch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launch_shut()

IGL_INLINE void igl::opengl::glfw::Viewer::launch_shut ( )
246 {
247 for(auto & data : data_list)
248 {
249 data.meshgl.free();
250 }
251 core.shut();
253 glfwDestroyWindow(window);
254 glfwTerminate();
255 return;
256 }
IGL_INLINE void free()
Definition MeshGL.cpp:200
IGL_INLINE void shut()
Definition ViewerCore.cpp:389
igl::opengl::MeshGL meshgl
Definition ViewerData.h:201
IGL_INLINE void shutdown_plugins()
Definition Viewer.cpp:278

References core, data(), data_list, igl::opengl::MeshGL::free(), igl::opengl::ViewerData::meshgl, igl::opengl::ViewerCore::shut(), shutdown_plugins(), and window.

Referenced by launch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_mesh_from_file()

IGL_INLINE bool igl::opengl::glfw::Viewer::load_mesh_from_file ( const std::string &  mesh_file_name)
349 {
350
351 // first try to load it with a plugin
352 for (unsigned int i = 0; i<plugins.size(); ++i)
353 {
354 if (plugins[i]->load(mesh_file_name_string))
355 {
356 return true;
357 }
358 }
359
360 // Create new data slot and set to selected
361 if(!(data().F.rows() == 0 && data().V.rows() == 0))
362 {
363 append_mesh();
364 }
365 data().clear();
366
367 size_t last_dot = mesh_file_name_string.rfind('.');
368 if (last_dot == std::string::npos)
369 {
370 std::cerr<<"Error: No file extension found in "<<
371 mesh_file_name_string<<std::endl;
372 return false;
373 }
374
375 std::string extension = mesh_file_name_string.substr(last_dot+1);
376
377 if (extension == "off" || extension =="OFF")
378 {
379 Eigen::MatrixXd V;
380 Eigen::MatrixXi F;
381 if (!igl::readOFF(mesh_file_name_string, V, F))
382 return false;
383 data().set_mesh(V,F);
384 }
385 else if (extension == "obj" || extension =="OBJ")
386 {
387 Eigen::MatrixXd corner_normals;
388 Eigen::MatrixXi fNormIndices;
389
390 Eigen::MatrixXd UV_V;
391 Eigen::MatrixXi UV_F;
392 Eigen::MatrixXd V;
393 Eigen::MatrixXi F;
394
395 if (!(
397 mesh_file_name_string,
398 V, UV_V, corner_normals, F, UV_F, fNormIndices)))
399 {
400 return false;
401 }
402
403 data().set_mesh(V,F);
404 data().set_uv(UV_V,UV_F);
405
406 }
407 else
408 {
409 // unrecognized file type
410 printf("Error: %s is not a recognized file type.\n",extension.c_str());
411 return false;
412 }
413
415 data().uniform_colors(Eigen::Vector3d(51.0/255.0,43.0/255.0,33.3/255.0),
416 Eigen::Vector3d(255.0/255.0,228.0/255.0,58.0/255.0),
417 Eigen::Vector3d(255.0/255.0,235.0/255.0,80.0/255.0));
418
419 // Alec: why?
420 if (data().V_uv.rows() == 0)
421 {
422 data().grid_texture();
423 }
424
426
427 for (unsigned int i = 0; i<plugins.size(); ++i)
428 if (plugins[i]->post_load())
429 return true;
430
431 return true;
432 }
void load(Archive &archive, wxString &d)
Definition GLGizmoEmboss.cpp:1559
IGL_INLINE void set_uv(const Eigen::MatrixXd &UV)
Definition ViewerData.cpp:195
IGL_INLINE void compute_normals()
Definition ViewerData.cpp:367
IGL_INLINE void set_mesh(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F)
Definition ViewerData.cpp:48
IGL_INLINE void grid_texture()
Definition ViewerData.cpp:419
IGL_INLINE void clear()
Definition ViewerData.cpp:340
IGL_INLINE void uniform_colors(const Eigen::Vector3d &diffuse, const Eigen::Vector3d &ambient, const Eigen::Vector3d &specular)
Definition ViewerData.cpp:374
IGL_INLINE int append_mesh()
Definition Viewer.cpp:910
@ F
Definition libslic3r.h:102
IGL_INLINE bool readOFF(const std::string off_file_name, std::vector< std::vector< Scalar > > &V, std::vector< std::vector< Index > > &F, std::vector< std::vector< Scalar > > &N, std::vector< std::vector< Scalar > > &C)
Definition readOFF.cpp:12
IGL_INLINE bool readOBJ(const std::string obj_file_name, std::vector< std::vector< Scalar > > &V, std::vector< std::vector< Scalar > > &TC, std::vector< std::vector< Scalar > > &N, std::vector< std::vector< Index > > &F, std::vector< std::vector< Index > > &FTC, std::vector< std::vector< Index > > &FN)
Definition readOBJ.cpp:21

References igl::opengl::ViewerCore::align_camera_center(), append_mesh(), igl::opengl::ViewerData::clear(), igl::opengl::ViewerData::compute_normals(), core, data(), igl::opengl::ViewerData::grid_texture(), load(), plugins, igl::readOBJ(), igl::readOFF(), igl::opengl::ViewerData::set_mesh(), igl::opengl::ViewerData::set_uv(), and igl::opengl::ViewerData::uniform_colors().

Referenced by open_dialog_load_mesh().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_scene() [1/2]

IGL_INLINE bool igl::opengl::glfw::Viewer::load_scene ( )
774 {
775 std::string fname = igl::file_dialog_open();
776 if(fname.length() == 0)
777 return false;
778 return load_scene(fname);
779 }
IGL_INLINE bool load_scene()
Definition Viewer.cpp:773
IGL_INLINE std::string file_dialog_open()
Definition file_dialog_open.cpp:20

References igl::file_dialog_open(), and load_scene().

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), and load_scene().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_scene() [2/2]

IGL_INLINE bool igl::opengl::glfw::Viewer::load_scene ( std::string  fname)
782 {
783 igl::deserialize(core,"Core",fname.c_str());
784 igl::deserialize(data(),"Data",fname.c_str());
785 return true;
786 }
bool deserialize(T &obj, const std::string &filename)
Definition serialize.h:484

References core, data(), and igl::deserialize().

+ Here is the call graph for this function:

◆ mesh_index()

IGL_INLINE size_t igl::opengl::glfw::Viewer::mesh_index ( const int  id) const
938 {
939 for (size_t i = 0; i < data_list.size(); ++i)
940 {
941 if (data_list[i].id == id)
942 return i;
943 }
944 return 0;
945 }

References data_list.

◆ mouse_down()

IGL_INLINE bool igl::opengl::glfw::Viewer::mouse_down ( MouseButton  button,
int  modifier 
)
589 {
590 // Remember mouse location at down even if used by callback/plugin
593
595 if (callback_mouse_down(*this,static_cast<int>(button),modifier))
596 return true;
597
598 for (unsigned int i = 0; i<plugins.size(); ++i)
599 if(plugins[i]->mouse_down(static_cast<int>(button),modifier))
600 return true;
601
602 down = true;
603
605
606
607 // Initialization code for the trackball
608 Eigen::RowVector3d center;
609 if (data().V.rows() == 0)
610 {
611 center << 0,0,0;
612 }else
613 {
614 center = data().V.colwise().sum()/data().V.rows();
615 }
616
617 Eigen::Vector3f coord =
619 Eigen::Vector3f(center(0),center(1),center(2)),
620 core.view,
621 core.proj,
622 core.viewport);
623 down_mouse_z = coord[2];
625
627
628 switch (button)
629 {
633 } else {
635 }
636 break;
637
640 break;
641
642 default:
644 break;
645 }
646
647 return true;
648 }
Eigen::Matrix4f proj
Definition ViewerCore.h:133
Eigen::Quaternionf trackball_angle
Definition ViewerCore.h:104
Eigen::Matrix4f view
Definition ViewerCore.h:132
@ ROTATION_TYPE_NO_ROTATION
Definition ViewerCore.h:89
Eigen::Vector3f camera_translation
Definition ViewerCore.h:111
Eigen::MatrixXd V
Definition ViewerData.h:128
IGL_INLINE bool mouse_down(MouseButton button, int modifier)
Definition Viewer.cpp:588
int current_mouse_x
Definition Viewer.h:130
Eigen::Vector3f down_translation
Definition Viewer.h:135
float down_mouse_z
Definition Viewer.h:134
Eigen::Quaternionf down_rotation
Definition Viewer.h:129
int down_mouse_x
Definition Viewer.h:132
int current_mouse_y
Definition Viewer.h:131
int down_mouse_y
Definition Viewer.h:133
IGL_INLINE Eigen::Matrix< Scalar, 3, 1 > project(const Eigen::Matrix< Scalar, 3, 1 > &obj, const Eigen::Matrix< Scalar, 4, 4 > &model, const Eigen::Matrix< Scalar, 4, 4 > &proj, const Eigen::Matrix< Scalar, 4, 1 > &viewport)

References callback_mouse_down, igl::opengl::ViewerCore::camera_translation, core, current_mouse_x, current_mouse_y, data(), down, down_mouse_x, down_mouse_y, down_mouse_z, down_rotation, down_translation, Left, mouse_down(), mouse_mode, None, plugins, igl::opengl::ViewerCore::proj, igl::project(), Right, Rotation, igl::opengl::ViewerCore::rotation_type, igl::opengl::ViewerCore::ROTATION_TYPE_NO_ROTATION, igl::opengl::ViewerCore::trackball_angle, Translation, igl::opengl::ViewerData::V, igl::opengl::ViewerCore::view, and igl::opengl::ViewerCore::viewport.

Referenced by glfw_mouse_press(), and mouse_down().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mouse_move()

IGL_INLINE bool igl::opengl::glfw::Viewer::mouse_move ( int  mouse_x,
int  mouse_y 
)
668 {
670 {
671 down_mouse_x = mouse_x;
672 down_mouse_y = mouse_y;
673 hack_never_moved = false;
674 }
675 current_mouse_x = mouse_x;
676 current_mouse_y = mouse_y;
677
679 if (callback_mouse_move(*this,mouse_x,mouse_y))
680 return true;
681
682 for (unsigned int i = 0; i<plugins.size(); ++i)
683 if (plugins[i]->mouse_move(mouse_x, mouse_y))
684 return true;
685
686 if (down)
687 {
688 switch (mouse_mode)
689 {
691 {
692 switch(core.rotation_type)
693 {
694 default:
695 assert(false && "Unknown rotation type");
697 break;
700 core.viewport(2),
701 core.viewport(3),
702 2.0f,
706 mouse_x,
707 mouse_y,
709 break;
713 2.0,
715 down_mouse_x, down_mouse_y, mouse_x, mouse_y,
717 break;
718 }
719 //Eigen::Vector4f snapq = core.trackball_angle;
720
721 break;
722 }
723
725 {
726 //translation
727 Eigen::Vector3f pos1 = igl::unproject(Eigen::Vector3f(mouse_x, core.viewport[3] - mouse_y, down_mouse_z), core.view, core.proj, core.viewport);
728 Eigen::Vector3f pos0 = igl::unproject(Eigen::Vector3f(down_mouse_x, core.viewport[3] - down_mouse_y, down_mouse_z), core.view, core.proj, core.viewport);
729
730 Eigen::Vector3f diff = pos1 - pos0;
731 core.camera_translation = down_translation + Eigen::Vector3f(diff[0],diff[1],diff[2]);
732
733 break;
734 }
735 case MouseMode::Zoom:
736 {
737 float delta = 0.001f * (mouse_x - down_mouse_x + mouse_y - down_mouse_y);
738 core.camera_zoom *= 1 + delta;
739 down_mouse_x = mouse_x;
740 down_mouse_y = mouse_y;
741 break;
742 }
743
744 default:
745 break;
746 }
747 }
748 return true;
749 }
float camera_zoom
Definition ViewerCore.h:108
IGL_INLINE bool mouse_move(int mouse_x, int mouse_y)
Definition Viewer.cpp:667
Slic3r::Polygons diff(const Slic3r::Polygon &subject, const Slic3r::Polygon &clip, ApplySafetyOffset do_safety_offset)
Definition ClipperUtils.cpp:672
IGL_INLINE void two_axis_valuator_fixed_up(const int w, const int h, const double speed, const Eigen::Quaternion< Scalardown_quat > &down_quat, const int down_x, const int down_y, const int mouse_x, const int mouse_y, Eigen::Quaternion< Scalarquat > &quat)
Definition two_axis_valuator_fixed_up.cpp:12
IGL_INLINE void unproject(const Eigen::MatrixBase< Derivedwin > &win, const Eigen::MatrixBase< Derivedmodel > &model, const Eigen::MatrixBase< Derivedproj > &proj, const Eigen::MatrixBase< Derivedviewport > &viewport, Eigen::PlainObjectBase< Derivedscene > &scene)
Definition unproject.cpp:19
IGL_INLINE void trackball(const double w, const double h, const Q_type speed_factor, const double down_mouse_x, const double down_mouse_y, const double mouse_x, const double mouse_y, Q_type *quat)
Definition trackball.cpp:43

References callback_mouse_move, igl::opengl::ViewerCore::camera_translation, igl::opengl::ViewerCore::camera_zoom, core, current_mouse_x, current_mouse_y, down, down_mouse_x, down_mouse_y, down_mouse_z, down_rotation, down_translation, hack_never_moved, mouse_mode, mouse_move(), plugins, igl::opengl::ViewerCore::proj, Rotation, igl::opengl::ViewerCore::rotation_type, igl::opengl::ViewerCore::ROTATION_TYPE_NO_ROTATION, igl::opengl::ViewerCore::ROTATION_TYPE_TRACKBALL, igl::opengl::ViewerCore::ROTATION_TYPE_TWO_AXIS_VALUATOR_FIXED_UP, igl::trackball(), igl::opengl::ViewerCore::trackball_angle, Translation, igl::two_axis_valuator_fixed_up(), igl::unproject(), igl::opengl::ViewerCore::view, igl::opengl::ViewerCore::viewport, and Zoom.

Referenced by glfw_mouse_move(), and mouse_move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mouse_scroll()

IGL_INLINE bool igl::opengl::glfw::Viewer::mouse_scroll ( float  delta_y)
752 {
753 scroll_position += delta_y;
754
756 if (callback_mouse_scroll(*this,delta_y))
757 return true;
758
759 for (unsigned int i = 0; i<plugins.size(); ++i)
760 if (plugins[i]->mouse_scroll(delta_y))
761 return true;
762
763 // Only zoom if there's actually a change
764 if(delta_y != 0)
765 {
766 float mult = (1.0+((delta_y>0)?1.:-1.)*0.05);
767 const float min_zoom = 0.1f;
768 core.camera_zoom = (core.camera_zoom * mult > min_zoom ? core.camera_zoom * mult : min_zoom);
769 }
770 return true;
771 }
IGL_INLINE bool mouse_scroll(float delta_y)
Definition Viewer.cpp:751

References callback_mouse_scroll, igl::opengl::ViewerCore::camera_zoom, core, mouse_scroll(), plugins, and scroll_position.

Referenced by glfw_mouse_scroll(), and mouse_scroll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mouse_up()

IGL_INLINE bool igl::opengl::glfw::Viewer::mouse_up ( MouseButton  button,
int  modifier 
)
651 {
652 down = false;
653
655 if (callback_mouse_up(*this,static_cast<int>(button),modifier))
656 return true;
657
658 for (unsigned int i = 0; i<plugins.size(); ++i)
659 if(plugins[i]->mouse_up(static_cast<int>(button),modifier))
660 return true;
661
663
664 return true;
665 }
IGL_INLINE bool mouse_up(MouseButton button, int modifier)
Definition Viewer.cpp:650

References callback_mouse_up, down, mouse_mode, mouse_up(), None, and plugins.

Referenced by glfw_mouse_press(), and mouse_up().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ open_dialog_load_mesh()

IGL_INLINE void igl::opengl::glfw::Viewer::open_dialog_load_mesh ( )
882 {
883 std::string fname = igl::file_dialog_open();
884
885 if (fname.length() == 0)
886 return;
887
888 this->load_mesh_from_file(fname.c_str());
889 }
IGL_INLINE bool load_mesh_from_file(const std::string &mesh_file_name)
Definition Viewer.cpp:347

References igl::file_dialog_open(), and load_mesh_from_file().

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ open_dialog_save_mesh()

IGL_INLINE void igl::opengl::glfw::Viewer::open_dialog_save_mesh ( )
892 {
893 std::string fname = igl::file_dialog_save();
894
895 if(fname.length() == 0)
896 return;
897
898 this->save_mesh_to_file(fname.c_str());
899 }
IGL_INLINE bool save_mesh_to_file(const std::string &mesh_file_name)
Definition Viewer.cpp:434
IGL_INLINE std::string file_dialog_save()
Definition file_dialog_save.cpp:17

References igl::file_dialog_save(), and save_mesh_to_file().

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ post_resize()

IGL_INLINE void igl::opengl::glfw::Viewer::post_resize ( int  w,
int  h 
)
867 {
868 core.viewport = Eigen::Vector4f(0,0,w,h);
869 for (unsigned int i = 0; i<plugins.size(); ++i)
870 {
871 plugins[i]->post_resize(w, h);
872 }
873 }

References core, plugins, and igl::opengl::ViewerCore::viewport.

Referenced by draw(), glfw_window_size(), and resize().

+ Here is the caller graph for this function:

◆ resize()

IGL_INLINE void igl::opengl::glfw::Viewer::resize ( int  w,
int  h 
)
859 {
860 if (window) {
861 glfwSetWindowSize(window, w/highdpi, h/highdpi);
862 }
863 post_resize(w, h);
864 }

References highdpi, post_resize(), and window.

+ Here is the call graph for this function:

◆ save_mesh_to_file()

IGL_INLINE bool igl::opengl::glfw::Viewer::save_mesh_to_file ( const std::string &  mesh_file_name)
436 {
437 // first try to load it with a plugin
438 for (unsigned int i = 0; i<plugins.size(); ++i)
439 if (plugins[i]->save(mesh_file_name_string))
440 return true;
441
442 size_t last_dot = mesh_file_name_string.rfind('.');
443 if (last_dot == std::string::npos)
444 {
445 // No file type determined
446 std::cerr<<"Error: No file extension found in "<<
447 mesh_file_name_string<<std::endl;
448 return false;
449 }
450 std::string extension = mesh_file_name_string.substr(last_dot+1);
451 if (extension == "off" || extension =="OFF")
452 {
453 return igl::writeOFF(
454 mesh_file_name_string,data().V,data().F);
455 }
456 else if (extension == "obj" || extension =="OBJ")
457 {
458 Eigen::MatrixXd corner_normals;
459 Eigen::MatrixXi fNormIndices;
460
461 Eigen::MatrixXd UV_V;
462 Eigen::MatrixXi UV_F;
463
464 return igl::writeOBJ(mesh_file_name_string,
465 data().V,
466 data().F,
467 corner_normals, fNormIndices, UV_V, UV_F);
468 }
469 else
470 {
471 // unrecognized file type
472 printf("Error: %s is not a recognized file type.\n",extension.c_str());
473 return false;
474 }
475 return true;
476 }
void save(Archive &archive, wxString const &d)
Definition GLGizmoEmboss.cpp:1557
IGL_INLINE bool writeOBJ(const std::string str, const Eigen::MatrixBase< DerivedV > &V, const Eigen::MatrixBase< DerivedF > &F, const Eigen::MatrixBase< DerivedCN > &CN, const Eigen::MatrixBase< DerivedFN > &FN, const Eigen::MatrixBase< DerivedTC > &TC, const Eigen::MatrixBase< DerivedFTC > &FTC)
Definition writeOBJ.cpp:24
IGL_INLINE bool writeOFF(const std::string str, const Eigen::PlainObjectBase< DerivedV > &V, const Eigen::PlainObjectBase< DerivedF > &F, const Eigen::PlainObjectBase< DerivedC > &C)
Definition writeOFF.cpp:38

References data(), plugins, save(), igl::writeOBJ(), and igl::writeOFF().

Referenced by open_dialog_save_mesh().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save_scene() [1/2]

IGL_INLINE bool igl::opengl::glfw::Viewer::save_scene ( )
789 {
790 std::string fname = igl::file_dialog_save();
791 if (fname.length() == 0)
792 return false;
793 return save_scene(fname);
794 }
IGL_INLINE bool save_scene()
Definition Viewer.cpp:788

References igl::file_dialog_save(), and save_scene().

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), and save_scene().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save_scene() [2/2]

IGL_INLINE bool igl::opengl::glfw::Viewer::save_scene ( std::string  fname)
797 {
798 igl::serialize(core,"Core",fname.c_str(),true);
799 igl::serialize(data(),"Data",fname.c_str());
800
801 return true;
802 }
bool serialize(const T &obj, const std::string &filename)
Definition serialize.h:414

References core, data(), and igl::serialize().

+ Here is the call graph for this function:

◆ shutdown_plugins()

IGL_INLINE void igl::opengl::glfw::Viewer::shutdown_plugins ( )
279 {
280 for (unsigned int i = 0; i<plugins.size(); ++i)
281 {
282 plugins[i]->shutdown();
283 }
284 }

References plugins.

Referenced by launch_shut().

+ Here is the caller graph for this function:

◆ snap_to_canonical_quaternion()

IGL_INLINE void igl::opengl::glfw::Viewer::snap_to_canonical_quaternion ( )
876 {
879 }
The quaternion class used to represent 3D orientations and rotations.
Definition Quaternion.h:233
IGL_INLINE bool snap_to_canonical_view_quat(const Q_type *q, const Q_type threshold, Q_type *s)
Definition snap_to_canonical_view_quat.cpp:24

References core, igl::snap_to_canonical_view_quat(), and igl::opengl::ViewerCore::trackball_angle.

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), and key_pressed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ callback_init

std::function<bool(Viewer& viewer)> igl::opengl::glfw::Viewer::callback_init

Referenced by Viewer(), and init().

◆ callback_init_data

void* igl::opengl::glfw::Viewer::callback_init_data

Referenced by Viewer().

◆ callback_key_down

std::function<bool(Viewer& viewer, unsigned int key, int modifiers)> igl::opengl::glfw::Viewer::callback_key_down

Referenced by Viewer(), and key_down().

◆ callback_key_down_data

void* igl::opengl::glfw::Viewer::callback_key_down_data

Referenced by Viewer().

◆ callback_key_pressed

std::function<bool(Viewer& viewer, unsigned int key, int modifiers)> igl::opengl::glfw::Viewer::callback_key_pressed

Referenced by key_pressed().

◆ callback_key_pressed_data

void* igl::opengl::glfw::Viewer::callback_key_pressed_data

◆ callback_key_up

std::function<bool(Viewer& viewer, unsigned int key, int modifiers)> igl::opengl::glfw::Viewer::callback_key_up

Referenced by Viewer(), and key_up().

◆ callback_key_up_data

void* igl::opengl::glfw::Viewer::callback_key_up_data

Referenced by Viewer().

◆ callback_mouse_down

std::function<bool(Viewer& viewer, int button, int modifier)> igl::opengl::glfw::Viewer::callback_mouse_down

Referenced by Viewer(), and mouse_down().

◆ callback_mouse_down_data

void* igl::opengl::glfw::Viewer::callback_mouse_down_data

Referenced by Viewer().

◆ callback_mouse_move

std::function<bool(Viewer& viewer, int mouse_x, int mouse_y)> igl::opengl::glfw::Viewer::callback_mouse_move

Referenced by Viewer(), and mouse_move().

◆ callback_mouse_move_data

void* igl::opengl::glfw::Viewer::callback_mouse_move_data

Referenced by Viewer().

◆ callback_mouse_scroll

std::function<bool(Viewer& viewer, float delta_y)> igl::opengl::glfw::Viewer::callback_mouse_scroll

Referenced by Viewer(), and mouse_scroll().

◆ callback_mouse_scroll_data

void* igl::opengl::glfw::Viewer::callback_mouse_scroll_data

Referenced by Viewer().

◆ callback_mouse_up

std::function<bool(Viewer& viewer, int button, int modifier)> igl::opengl::glfw::Viewer::callback_mouse_up

Referenced by Viewer(), and mouse_up().

◆ callback_mouse_up_data

void* igl::opengl::glfw::Viewer::callback_mouse_up_data

Referenced by Viewer().

◆ callback_post_draw

std::function<bool(Viewer& viewer)> igl::opengl::glfw::Viewer::callback_post_draw

Referenced by Viewer(), and draw().

◆ callback_post_draw_data

void* igl::opengl::glfw::Viewer::callback_post_draw_data

Referenced by Viewer().

◆ callback_pre_draw

std::function<bool(Viewer& viewer)> igl::opengl::glfw::Viewer::callback_pre_draw

Referenced by Viewer(), and draw().

◆ callback_pre_draw_data

void* igl::opengl::glfw::Viewer::callback_pre_draw_data

Referenced by Viewer().

◆ core

◆ current_mouse_x

int igl::opengl::glfw::Viewer::current_mouse_x

Referenced by mouse_down(), and mouse_move().

◆ current_mouse_y

int igl::opengl::glfw::Viewer::current_mouse_y

Referenced by mouse_down(), and mouse_move().

◆ data_list

◆ down

bool igl::opengl::glfw::Viewer::down

◆ down_mouse_x

int igl::opengl::glfw::Viewer::down_mouse_x

Referenced by mouse_down(), and mouse_move().

◆ down_mouse_y

int igl::opengl::glfw::Viewer::down_mouse_y

Referenced by mouse_down(), and mouse_move().

◆ down_mouse_z

float igl::opengl::glfw::Viewer::down_mouse_z

Referenced by mouse_down(), and mouse_move().

◆ down_rotation

Eigen::Quaternionf igl::opengl::glfw::Viewer::down_rotation

Referenced by mouse_down(), and mouse_move().

◆ down_translation

Eigen::Vector3f igl::opengl::glfw::Viewer::down_translation

Referenced by mouse_down(), and mouse_move().

◆ hack_never_moved

bool igl::opengl::glfw::Viewer::hack_never_moved

Referenced by Viewer(), and mouse_move().

◆ mouse_mode

enum igl::opengl::glfw::Viewer::MouseMode igl::opengl::glfw::Viewer::mouse_mode

Referenced by mouse_down(), mouse_move(), and mouse_up().

◆ next_data_id

int igl::opengl::glfw::Viewer::next_data_id

Referenced by append_mesh().

◆ plugins

◆ scroll_position

float igl::opengl::glfw::Viewer::scroll_position

Referenced by Viewer(), and mouse_scroll().

◆ selected_data_index

size_t igl::opengl::glfw::Viewer::selected_data_index

◆ window


The documentation for this class was generated from the following files: