Эх сурвалжийг харах

Fix initial mesh id + make mesh_index const.

Former-commit-id: ba9ca9e2116671e583f562d0dd759a251cb92e0c
Jérémie Dumas 7 жил өмнө
parent
commit
2e43ff6150

+ 3 - 2
include/igl/opengl/glfw/Viewer.cpp

@@ -286,9 +286,10 @@ namespace glfw
   IGL_INLINE Viewer::Viewer():
     data_list(1),
     selected_data_index(0),
-    next_data_id(0)
+    next_data_id(1)
   {
     window = nullptr;
+    data_list.front().id = 0;
 
     // Temporary variables initialization
     down = false;
@@ -934,7 +935,7 @@ namespace glfw
     return true;
   }
 
-  IGL_INLINE size_t Viewer::mesh_index(const int id) {
+  IGL_INLINE size_t Viewer::mesh_index(const int id) const {
     for (size_t i = 0; i < data_list.size(); ++i)
     {
       if (data_list[i].id == id)

+ 1 - 1
include/igl/opengl/glfw/Viewer.h

@@ -111,7 +111,7 @@ namespace glfw
 
     // Retrieve mesh index from its unique identifier
     // Returns 0 if not found
-    IGL_INLINE size_t mesh_index(const int id);
+    IGL_INLINE size_t mesh_index(const int id) const;
 
     // Alec: I call this data_list instead of just data to avoid confusion with
     // old "data" variable.