-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Randall Smith
committed
Feb 8, 2017
1 parent
cb25646
commit 8826bce
Showing
5 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
*.swp | ||
*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(MeshSaliency) | ||
|
||
# Set exe path. | ||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) | ||
|
||
# Set C++ flags. | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
|
||
# Set the module path (mainly for FindXXX.cmake files) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} | ||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) | ||
|
||
# Find libigl. | ||
find_package(LIBIGL REQUIRED) | ||
include_directories(${LIBIGL_INCLUDE_DIRS}) | ||
|
||
# Set options for libigl. | ||
option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" ON) | ||
option(LIBIGL_WITH_OPENGL "Use OpenGL" ON) | ||
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON) | ||
|
||
# Compile the options we need. | ||
add_subdirectory("${LIBIGL_INCLUDE_DIR}/../shared/cmake" "libigl") | ||
|
||
# Add definitions. | ||
add_definitions(${LIBIGL_DEFINITIONS}) | ||
message(STATUS "LIBIGL_DEFINITIONS=${LIBIGL_DEFINITIONS}") | ||
|
||
# Find Eigen3. | ||
find_package(Eigen3 REQUIRED) | ||
include_directories(${EIGEN3_INCLUDE_DIRS}) | ||
message(STATUS "EIGEN3_INCLUDE_DIRS=${EIGEN3_INCLUDE_DIRS}") | ||
|
||
# Compile and link main. | ||
add_executable(main main.cc) | ||
target_link_libraries(main ${LIBIGL_LIBRARIES} | ||
${LIBIGL_VIEWER_EXTRA_LIBRARIES} | ||
${LIBIGL_OPENGL_EXTRA_LIBRARIES} | ||
${LIBIGL_OPENGL_GLFW_EXTRA_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,61 @@ | ||
# meshsaliency | ||
#Mesh Saliency | ||
|
||
## Introduction | ||
Not much to say yet! | ||
|
||
## Dependencies | ||
|
||
### Libraries | ||
* [libigl](https://github.com/libigl/) | ||
* [GLFW](http://www.glfw.org/) | ||
* [Eigen3](http://http://eigen.tuxfamily.org/) | ||
* [OpenGL](https://www.opengl.org/) | ||
|
||
### Environment Variables | ||
|
||
None required so far. | ||
|
||
### Tools | ||
|
||
* [cmake](https://cmake.org/) | ||
|
||
## Build Instructions | ||
|
||
Make sure that libigl is somewhere the `FindLIBIGL.cmake` can find it. For a | ||
list of locations check `./cmake/Modules/FindLIBIGL.cmake` and add your | ||
location to this list, if it is not already included. | ||
|
||
### OS X | ||
Make sure the [Xcode Developer Tools](https://developer.apple.com/xcode/) are | ||
installed. Using [brew](http://brew.sh/), the following will install needed | ||
dependencies for OS X: | ||
|
||
``` | ||
brew install glfw | ||
brew install eigen | ||
``` | ||
|
||
Once GLFW and Eigen3 are installed, the following will build the main program: | ||
``` | ||
mkdir build | ||
cd build | ||
cmake .. | ||
``` | ||
|
||
### Linux | ||
|
||
### Windows | ||
|
||
|
||
### Running | ||
|
||
The main program loads an [OFF](http://www.geomview.org/docs/html/OFF.html) | ||
file and runs the libigl viewer. | ||
|
||
This is done by typing in the build directory | ||
``` | ||
bin/main path/to/file/mesh.off | ||
``` | ||
and currently a window is launched. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# LIBIGL library | ||
# Once done this will define | ||
# | ||
# LIBIGL_FOUND - system has LIBIGL | ||
# LIBIGL_INCLUDE_DIR - **the** LIBIGL include directory | ||
# LIBIGL_INCLUDE_DIRS - LIBIGL include directories | ||
# LIBIGL_SOURCES - the LIBIGL source files | ||
if(NOT LIBIGL_FOUND) | ||
|
||
FIND_PATH(LIBIGL_INCLUDE_DIR igl/readOBJ.h | ||
${PROJECT_SOURCE_DIR}/../../include | ||
${PROJECT_SOURCE_DIR}/../include | ||
${PROJECT_SOURCE_DIR}/include | ||
${PROJECT_SOURCE_DIR}/../libigl/include | ||
${PROJECT_SOURCE_DIR}/../../libigl/include | ||
$ENV{LIBIGL}/include | ||
$ENV{LIBIGLROOT}/include | ||
$ENV{LIBIGL_ROOT}/include | ||
$ENV{LIBIGL_DIR}/include | ||
$ENV{LIBIGL_DIR}/inc | ||
/usr/include | ||
/usr/local/include | ||
/usr/local/igl/libigl/include | ||
/usr/local/opt/libigl/include | ||
) | ||
|
||
if(LIBIGL_INCLUDE_DIR) | ||
set(LIBIGL_FOUND TRUE) | ||
set(LIBIGL_INCLUDE_DIRS ${LIBIGL_INCLUDE_DIR} | ||
${LIBIGL_INCLUDE_DIR}/../external/Singular_Value_Decomposition) | ||
#set(LIBIGL_SOURCES | ||
# ${LIBIGL_INCLUDE_DIR}/igl/viewer/Viewer.cpp | ||
#) | ||
endif() | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <string> | ||
|
||
#include <igl/readOFF.h> | ||
#include <igl/viewer/Viewer.h> | ||
|
||
Eigen::MatrixXd V; | ||
Eigen::MatrixXi F; | ||
|
||
int main(int argc, char *argv[]) { | ||
std::string model_path(argv[1]); | ||
|
||
// Load a mesh in OFF format | ||
igl::readOFF(model_path, V, F); | ||
|
||
// Plot the mesh | ||
igl::viewer::Viewer viewer; | ||
viewer.data.set_mesh(V, F); | ||
viewer.launch(); | ||
} |