Browse Source

Merge pull request #1646 from libigl/matcap-tutorial

tutorial entry for matcap
Alec Jacobson 5 years ago
parent
commit
dbec07d9f5

+ 1 - 1
cmake/LibiglDownloadExternal.cmake

@@ -193,6 +193,6 @@ function(igl_download_tutorial_data)
 	igl_download_project_aux(tutorial_data
 		"${LIBIGL_EXTERNAL}/../tutorial/data"
 		GIT_REPOSITORY https://github.com/libigl/libigl-tutorial-data
-		GIT_TAG        37d4e836054c9c2d2125a817c489ed8e07cd56fc
+		GIT_TAG        1f8fab844173890f1e326d93c9ca6c50dad1c6b2
 	)
 endfunction()

+ 5 - 0
tutorial/111_MatCap/CMakeLists.txt

@@ -0,0 +1,5 @@
+get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+project(${PROJECT_NAME})
+
+add_executable(${PROJECT_NAME} main.cpp)
+target_link_libraries(${PROJECT_NAME} igl::core igl::opengl igl::opengl_glfw igl::png tutorials)

+ 19 - 0
tutorial/111_MatCap/main.cpp

@@ -0,0 +1,19 @@
+#include <igl/opengl/glfw/Viewer.h>
+#include <igl/read_triangle_mesh.h>
+#include <igl/png/readPNG.h>
+
+int main(int argc, char *argv[])
+{
+  igl::opengl::glfw::Viewer v;
+  Eigen::MatrixXd V;
+  Eigen::MatrixXi F;
+  igl::read_triangle_mesh(
+    argc>1?argv[1]: TUTORIAL_SHARED_PATH "/armadillo.obj",V,F);
+  Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic> R,G,B,A;
+  igl::png::readPNG(argc>2?argv[2]: TUTORIAL_SHARED_PATH "/jade.png",R,G,B,A);
+  v.data().set_mesh(V,F);
+  v.data().set_texture(R,G,B,A);
+  v.data().use_matcap = true;
+  v.data().show_lines = false;
+  v.launch();
+}

+ 1 - 0
tutorial/CMakeLists.txt

@@ -131,6 +131,7 @@ if(TUTORIALS_CHAPTER6)
     add_subdirectory("606_AmbientOcclusion")
   endif()
   if(LIBIGL_WITH_PNG)
+    add_subdirectory("111_MatCap")
     add_subdirectory("607_ScreenCapture")
   endif()
   if(LIBIGL_WITH_CGAL)