diff --git a/tutorial/106_ViewerMenu/CMakeLists.txt b/tutorial/106_ViewerMenu/CMakeLists.txt new file mode 100644 index 000000000..4c33aebcf --- /dev/null +++ b/tutorial/106_ViewerMenu/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.6) +project(106_ViewerMenu) + +include("../CMakeLists.shared") + +set(SOURCES +${PROJECT_SOURCE_DIR}/main.cpp +) + +add_executable(${PROJECT_NAME}_bin ${SOURCES} ${SHARED_SOURCES}) +target_link_libraries(${PROJECT_NAME}_bin ${SHARED_LIBRARIES}) diff --git a/tutorial/106_ViewerMenu/main.cpp b/tutorial/106_ViewerMenu/main.cpp new file mode 100755 index 000000000..d9988a3f6 --- /dev/null +++ b/tutorial/106_ViewerMenu/main.cpp @@ -0,0 +1,52 @@ +#include +#include + +Eigen::MatrixXd V; +Eigen::MatrixXi F; + +bool boolVariable = true; +float floatVariable = 0.1f; + +int main(int argc, char *argv[]) +{ + // Load a mesh in OFF format + igl::readOFF("../shared/bunny.off", V, F); + + // Init the viewer + igl::viewer::Viewer viewer; + + // Extend viewer menu + viewer.callback_init = [&](igl::viewer::Viewer& viewer) + { + // Add new group + viewer.ngui->addNewGroup("New Group"); + + // Expose variable directly ... + viewer.ngui->addVariable(floatVariable,"float"); + + // ... or using a custom callback + viewer.ngui->addVariable([&](bool val) { + boolVariable = val; // set + },[&]() { + return boolVariable; // get + },"bool",true); + + // Add a button + viewer.ngui->addButton("Print Hello",[](){ cout << "Hello\n"; }); + + // Add an additional bar + viewer.ngui->addNewWindow(Eigen::Vector2i(220,10),"New Window"); + + // Expose the same variable directly ... + viewer.ngui->addVariable(floatVariable,"float"); + + // Generate menu + viewer.ngui->layout(); + + return false; + }; + + // Plot the mesh + viewer.data.set_mesh(V, F); + viewer.launch(); +} diff --git a/tutorial/609_Boolean/CMakeLists.txt b/tutorial/609_Boolean/CMakeLists.txt index d949a20fd..0ead203eb 100644 --- a/tutorial/609_Boolean/CMakeLists.txt +++ b/tutorial/609_Boolean/CMakeLists.txt @@ -8,6 +8,14 @@ include(${CGAL_USE_FILE}) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") remove_cxx_flag("-stdlib=libc++") endif() +IF(MSVC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") ### Enable parallel compilation for Visual Studio + SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} ) + SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} ) +ELSE(MSVC) + 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 "../" ) +ENDIF(MSVC) # This is absolutely necessary for Exact Construction diff --git a/tutorial/CMakeLists.txt b/tutorial/CMakeLists.txt index 2636264ef..1155f752a 100644 --- a/tutorial/CMakeLists.txt +++ b/tutorial/CMakeLists.txt @@ -63,6 +63,7 @@ add_subdirectory("102_DrawMesh") add_subdirectory("103_Events") add_subdirectory("104_Colors") add_subdirectory("105_Overlays") +add_subdirectory("106_ViewerMenu") # Chapter 2 add_subdirectory("201_Normals") diff --git a/tutorial/images/106_ViewerMenu.png.REMOVED.git-id b/tutorial/images/106_ViewerMenu.png.REMOVED.git-id new file mode 100644 index 000000000..0dae68b4c --- /dev/null +++ b/tutorial/images/106_ViewerMenu.png.REMOVED.git-id @@ -0,0 +1 @@ +af40ffb84d7d8aaa7b021b8c676d5458918fef7e \ No newline at end of file diff --git a/tutorial/tutorial.html.REMOVED.git-id b/tutorial/tutorial.html.REMOVED.git-id index 30d2d1616..92d463766 100644 --- a/tutorial/tutorial.html.REMOVED.git-id +++ b/tutorial/tutorial.html.REMOVED.git-id @@ -1 +1 @@ -4740225fd545742c28070009471cda0f8eb405cb \ No newline at end of file +3609f034c7e4370e8056f8ff09102498767d4eba \ No newline at end of file diff --git a/tutorial/tutorial.md.REMOVED.git-id b/tutorial/tutorial.md.REMOVED.git-id index 7d943c632..ebe05dd3c 100644 --- a/tutorial/tutorial.md.REMOVED.git-id +++ b/tutorial/tutorial.md.REMOVED.git-id @@ -1 +1 @@ -7b3d693075fe8cbb53b362415dbb393d7e72b3de \ No newline at end of file +328d256a34556697a10edf5a15290e499bf4e861 \ No newline at end of file