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

Merge remote-tracking branch 'upstream/master' into docs

Former-commit-id: 5bd163236c172c3d8116bbdc1086a94f83d3f072
Jérémie Dumas 7 жил өмнө
parent
commit
5b06362185

+ 2 - 0
include/igl/opengl/ViewerData.h

@@ -102,6 +102,8 @@ public:
   //   E  #E by 2 list of edge indices into P
   //   C  #E|1 by 3 color(s)
   IGL_INLINE void set_edges (const Eigen::MatrixXd& P, const Eigen::MatrixXi& E, const Eigen::MatrixXd& C);
+  // Alec: This is very confusing. Why does add_edges have a different API from
+  // set_edges? 
   IGL_INLINE void add_edges (const Eigen::MatrixXd& P1, const Eigen::MatrixXd& P2, const Eigen::MatrixXd& C);
   IGL_INLINE void add_label (const Eigen::VectorXd& P,  const std::string& str);
 

+ 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.

+ 4 - 2
include/igl/writeOFF.cpp

@@ -61,13 +61,15 @@ IGL_INLINE bool igl::writeOFF(
 
   //Check if RGB values are in the range [0..1] or [0..255]
   int rgbScale = (C.maxCoeff() <= 1.0)?255:1;
-  Eigen::MatrixXd RGB = rgbScale * C;
+  // Use RGB_Array instead of RGB because of clash with mingw macro 
+  // (https://github.com/libigl/libigl/pull/679)
+  Eigen::MatrixXd RGB_Array = rgbScale * C;
 
   s<< "COFF\n"<<V.rows()<<" "<<F.rows()<<" 0\n";
   for (unsigned i=0; i< V.rows(); i++)
   {
     s <<V.row(i).format(IOFormat(FullPrecision,DontAlignCols," "," ","","",""," "));
-    s << unsigned(RGB(i,0)) << " " << unsigned(RGB(i,1)) << " " << unsigned(RGB(i,2)) << " 255\n";
+    s << unsigned(RGB_Array(i,0)) << " " << unsigned(RGB_Array(i,1)) << " " << unsigned(RGB_Array(i,2)) << " 255\n";
   }
 
   s<<(F.array()).format(IOFormat(FullPrecision,DontAlignCols," ","\n","3 ","","","\n"));

+ 15 - 45
optional/CMakeLists.txt

@@ -1,52 +1,22 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.1)
 project(libigl)
 
-set (CMAKE_MODULE_PATH
-#${CMAKE_MODULE_PATH}
-"${PROJECT_SOURCE_DIR}/../shared/cmake")
+set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../shared/cmake")
+# These ensure that lib*.a are placed in the directory where `cmake
+# ../optional/` was issued.
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
 
-### Compilation flags: adapt to your needs ###
-if(MSVC)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj /w") ### Enable parallel compilation
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
-else()
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") #### Libigl requires a modern C++ compiler that supports c++11
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../" )
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage")
-endif()
-
-
-option(LIBIGL_USE_STATIC_LIBRARY "Use LibIGL as static library" ON)
-
-
-option(LIBIGL_WITH_ANTTWEAKBAR      "Use AntTweakBar"    ON)
+### conditionally compile certain modules depending on libraries found on the system
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../shared/cmake)
 find_package(CGAL QUIET COMPONENTS Core)
-option(LIBIGL_WITH_CGAL             "Use CGAL"           "${CGAL_FOUND}")
-option(LIBIGL_WITH_COMISO           "Use CoMiso"         ON)
-### Cork is off by default since it fails to build out-of-the-box on windows
-option(LIBIGL_WITH_CORK             "Use Cork"           OFF)
-option(LIBIGL_WITH_EMBREE           "Use Embree"         ON)
-option(LIBIGL_WITH_LIM              "Use LIM"            ON)
 find_package(MATLAB QUIET)
-option(LIBIGL_WITH_MATLAB           "Use Matlab"         "${MATLAB_FOUND}")
-find_package(MOSEK  QUIET)
-option(LIBIGL_WITH_MOSEK            "Use MOSEK"          "${MOSEK_FOUND}")
-option(LIBIGL_WITH_OPENGL           "Use OpenGL"         ON)
-option(LIBIGL_WITH_OPENGL_GLFW      "Use GLFW"           ON)
-option(LIBIGL_WITH_PNG              "Use PNG"            ON)
-option(LIBIGL_WITH_TETGEN           "Use Tetgen"         ON)
-option(LIBIGL_WITH_TRIANGLE         "Use Triangle"       ON)
-option(LIBIGL_WITH_VIEWER           "Use OpenGL viewer"  ON)
-option(LIBIGL_WITH_XML              "Use XML"            ON)
+find_package(MOSEK)
+
+### libIGL options: choose between header only and compiled static library
+option(LIBIGL_USE_STATIC_LIBRARY "Use LibIGL as static library" ON)
 
-if(LIBIGL_WITH_CGAL) # Do not remove or move this block, cgal strange build system fails without it
-  find_package(CGAL REQUIRED COMPONENTS Core)
-  set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "CGAL's CMAKE Setup is super annoying ")
-  include(${CGAL_USE_FILE})
-endif()
+### Adding libIGL: choose the path to your local copy libIGL
+include(libigl)
 
-# libigl*.a libraries should be built directly into libigl/lib/
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
-add_subdirectory("${PROJECT_SOURCE_DIR}/../shared/cmake" "libigl")