Prechádzať zdrojové kódy

- added void* pointer each c-style callback
- fixed compilation error in the viewer
- fixed compilation errors MIQ example


Former-commit-id: efa2dd7beeaaf22399cd2b3391828660e1331cc2

Daniele Panozzo 11 rokov pred
rodič
commit
acc421bed3

+ 10 - 2
include/igl/viewer/Viewer.cpp

@@ -706,6 +706,14 @@ namespace igl
     callback_key_down     = 0;
     callback_key_up       = 0;
 
+    callback_pre_draw_data = 0;
+    callback_post_draw     = 0;
+    callback_mouse_down    = 0;
+    callback_mouse_up      = 0;
+    callback_mouse_move    = 0;
+    callback_mouse_scroll  = 0;
+    callback_key_down      = 0;
+    callback_key_up        = 0;
   }
 
   void Viewer::init_plugins()
@@ -2160,7 +2168,7 @@ namespace igl
     using namespace std;
 
     Eigen::MatrixXd V_temp;
-    
+
     // If V only has two columns, pad with a column of zeros
     if (V.cols() == 2)
     {
@@ -2201,7 +2209,7 @@ namespace igl
   void Viewer::set_vertices(const Eigen::MatrixXd& V)
   {
     data.V = V;
-    assert(F.empty() || F.maxCoeff() < V.rows());
+    assert(data.F.size() == 0 || data.F.maxCoeff() < data.V.rows());
     data.dirty |= DIRTY_POSITION;
   }
 

+ 11 - 0
include/igl/viewer/Viewer.h

@@ -432,6 +432,17 @@ namespace igl
     bool (*callback_key_down)(Viewer& viewer, unsigned char key, int modifiers);
     bool (*callback_key_up)(Viewer& viewer, unsigned char key, int modifiers);
 
+    // Pointers to per-callback data
+    void* callback_pre_draw_data;
+    void* callback_post_draw_data;
+    void* callback_mouse_down_data;
+    void* callback_mouse_up_data;
+    void* callback_mouse_move_data;
+    void* callback_mouse_scroll_data;
+    void* callback_key_down_data;
+    void* callback_key_up_data;
+
+
     /********* AntTweakBar callbacks *********/
     static void TW_CALL snap_to_canonical_quaternion_cb(void *clientData);
     static void TW_CALL save_scene_cb(void *clientData);

+ 10 - 10
tutorial/505_MIQ/main.cpp

@@ -98,16 +98,16 @@ int main(int argc, char *argv[])
   double quadIter = 0;
   double stiffness = 5.0;
   bool directRound = 1;
-  igl::mixed_integer_quadrangulate(V,
-                                 F,
-                                 polyVF[0],
-                                 polyVF[1],
-                                 UV,
-                                 FUV,
-                                 gradientSize,
-                                 stiffness,
-                                 directRound,
-                                 quadIter);
+  igl::miq(V,
+           F,
+           polyVF[0],
+           polyVF[1],
+           UV,
+           FUV,
+           gradientSize,
+           stiffness,
+           directRound,
+           quadIter);
 
 
   // Face barycenters