Commit 4c9fb4ac authored by Edward Vigmond's avatar Edward Vigmond

Merge branch 'VBO' of https://git.opencarp.org/openCARP/meshalyzer into VBO

parents 7da80e2e aa4e9168
......@@ -6,3 +6,17 @@ project(meshalyzer
)
add_subdirectory(src)
if(APPLE)
set(MESHALYZER_EXE "meshalyzer.app/Contents/MacOS/meshalyzer")
elseif(UNIX)
set(MESHALYZER_EXE "meshalyzer")
endif()
add_custom_target(link_exe ALL
COMMAND ln -sf ${CMAKE_BINARY_DIR}/src/${MESHALYZER_EXE} ${CMAKE_CURRENT_LIST_DIR}
COMMENT "Create link to meshalyzer executable"
VERBATIM
)
add_dependencies(link_exe meshalyzer)
......@@ -167,8 +167,8 @@ The same rule regarding lines holds in the mixed element files.
A line is an entity which can be highlighted.
\begin{figure}
\centerline{ \includegraphics[width=4cm]{linejoint.png}
\includegraphics[width=4cm]{twoseg.png}}
\centerline{ \includegraphics[width=4cm]{linejoint}
\includegraphics[width=4cm]{twoSeg}}
\caption{\textbf{Left}: Joint between two segments when part of a line. \textbf{Right}: Two independent segments.}
\label{fig:joint}
\end{figure}
......@@ -774,6 +774,17 @@ Note that surface material properties may also be set, which depend on lighting.
\label{fig:lightDiag}
\end{figure}
As a general outline, the following table gives the lighting settings to achieve material effects (L=low, M=medium, H=high, V=very):
\begin{longtable}{|l|c|c|c|c|}
\hline
material & Ambient & Diffuse & Specular & Shiny \\ \hline
Glass & L & H & H & H \\
Stone & L & VH & L & VL \\
Metal & L & M & H & H \\
Plastic & VL & VL & M & L \\
Rubber & VL & M & M & VL \\
\hline
\end{longtable}
\subsubsection{Scalar Data}
......
# for MacOS
if(APPLE)
option(HAVE_RETINA "Set TRUE if the display is retina" TRUE)
if(HAVE_RETINA)
add_definitions(-DIS_RETINA=1)
add_compile_definitions(IS_RETINA=1)
endif(HAVE_RETINA)
endif(APPLE)
# for Linux
if(UNIX AND NOT APPLE)
find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)
endif(UNIX AND NOT APPLE)
find_package(Threads REQUIRED)
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenGL REQUIRED)
find_package(OpenMP)
# FLTK
find_package(FLTK REQUIRED)
include_directories(${FLTK_INCLUDE_DIR})
get_filename_component(FLTK_BIN_DIR "${FLTK_FLUID_EXECUTABLE}" PATH)
find_program(FLTK_CONFIG_SCRIPT fltk-config PATHS ${FLTK_BIN_DIR})
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
link_libraries(${X11_LIBRARIES})
find_package(ZLIB REQUIRED)
include(FindZLIB)
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
link_libraries(${ZLIB_LIBRARIES})
else (ZLIB_FOUND)
message(FATAL_ERROR "Couldn't find development files for zlib")
endif (ZLIB_FOUND)
# same FLTK linking flags as Makefile
execute_process(
COMMAND ${FLTK_CONFIG_SCRIPT} --use-images --use-glut --use-gl --ldflags
OUTPUT_VARIABLE FLTK_LD_FLAGS
)
string(STRIP ${FLTK_LD_FLAGS} FLTK_LD_FLAGS)
message(STATUS "Found FLTK linking flags: ${FLTK_LD_FLAGS}")
find_package(PNG REQUIRED)
include(FindPNG)
if (PNG_FOUND)
include_directories(${PNG_INCLUDE_DIR})
link_libraries(${PNG_LIBRARIES})
add_definitions(${PNG_DEFINITIONS})
else (PNG_FOUND)
message(FATAL_ERROR "Couldn't find development files for PNG")
endif (PNG_FOUND)
if (CYGWIN)
add_definitions(-DNOMINMAX)
endif (CYGWIN)
# No common library for pthreads yet.
find_library(PTHREAD_LIB pthread)
if (PTHREAD_LIB)
link_libraries(${PTHREAD_LIB})
else (PTHREAD_LIB)
message(FATAL_ERROR "Couldn't find pthread library")
endif (PTHREAD_LIB)
#VTK
# VTK
option(USE_VTK "Build with VTK" TRUE)
if (USE_VTK)
set(MESHALYZER_VTK_COMPONENTS
......@@ -62,41 +48,9 @@ if (USE_VTK)
list(GET VTK_INCLUDE_DIRS 0 VTK_INCLUDE_DIRS_ONLY)
message(STATUS "Found VTK only includes: ${VTK_INCLUDE_DIRS_ONLY}")
include_directories(${VTK_INCLUDE_DIRS_ONLY})
link_libraries(${VTK_LIBRARIES})
add_definitions(-DUSE_VTK)
else (VTK_FOUND)
message(FATAL_ERROR "Couldn't find VTK library")
endif (VTK_FOUND)
endif (USE_VTK)
#Check for GLUT
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS})
option(USE_GLFRAMEBUFFERS "Use the glFramebuffer* extensions to render PNG images. It should be superior to onscreen rendering, but on nvidia cards it has problems." OFF)
if (NOT USE_GLFRAMEBUFFERS)
add_definitions(-DONSCREEN_DUMP)
endif (NOT USE_GLFRAMEBUFFERS)
# ok, now adding everything else
add_definitions(
-DOBJ_CLASS
-D_REENTRANT
-DNOMINMAX
-MMD
)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
add_definitions(${OpenMP_CXX_FLAGS})
endif(OpenMP_CXX_FOUND)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# copy images to cmake build tree
set(MESHALYZER_IMAGE_FOLDER "images")
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${MESHALYZER_IMAGE_FOLDER})
......@@ -173,11 +127,44 @@ add_executable(meshalyzer
)
add_dependencies(meshalyzer create_hdf5_data_browser)
target_link_libraries(meshalyzer ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${GLEW_LIBRARIES} ${FLTK_LIBRARIES})
target_compile_options(meshalyzer PRIVATE -MMD)
target_compile_definitions(meshalyzer PRIVATE
_REENTRANT
NOMINMAX
)
target_include_directories(meshalyzer PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${FLTK_INCLUDE_DIR}>
)
target_link_libraries(meshalyzer PRIVATE
${FLTK_LD_FLAGS}
Threads::Threads
PNG::PNG
ZLIB::ZLIB
OpenGL::GL
)
if(GLUT_FOUND)
target_link_libraries(meshalyzer PRIVATE GLUT::GLUT)
endif(GLUT_FOUND)
if(GLEW_FOUND)
target_link_libraries(meshalyzer PRIVATE GLEW::GLEW)
endif(GLEW_FOUND)
if(OpenMP_CXX_FOUND)
target_link_libraries(meshalyzer ${OpenMP_CXX_LIBRARIES})
target_link_libraries(meshalyzer PRIVATE OpenMP::OpenMP_CXX)
endif(OpenMP_CXX_FOUND)
if(VTK_FOUND)
target_compile_definitions(meshalyzer PRIVATE USE_VTK)
target_include_directories(meshalyzer PRIVATE $<BUILD_INTERFACE:${VTK_INCLUDE_DIRS_ONLY}>)
target_link_libraries(meshalyzer PRIVATE ${VTK_LIBRARIES})
endif(VTK_FOUND)
set_property(TARGET meshalyzer PROPERTY CXX_STANDARD 17)
add_custom_command(TARGET meshalyzer POST_BUILD
......
......@@ -491,6 +491,7 @@ Model:: read_objects(vtkUnstructuredGrid* grid, bool no_velem )
if( no_velem ) nvol=0;
_vol.resize(nvol);
nvol = 0;
if( nsurf ) {
Surfaces *newSurf = new Surfaces(&pt);
......@@ -511,11 +512,18 @@ Model:: read_objects(vtkUnstructuredGrid* grid, bool no_velem )
const char *eletype = VTK2CARP_etype[grid->GetCellType(i)];
// convert points to int
int n[10];
#if VTK_MAJOR_VERSION <= 8
vtkIdType *nvtk, nn;
grid->GetCellPoints( i, nn, nvtk );
int n[10];
for( int j=0; j<nn; j++ )
n[j] = nvtk[j];
#else
vtkIdList nl;
grid->GetCellPoints( i, &nl );
for( int j=0; j<nl.GetNumberOfIds(); j++ )
n[j] = nl.GetId(j);
#endif
if( regdata ) reg = (int)( regdata->GetTuple1(i) );
......
......@@ -67,7 +67,6 @@ void Surfaces::determine_vert_norms( PPoint& pt )
memset( tvn, 0, pt.num()*3*sizeof(GLfloat) );
const GLfloat* n;
for ( auto ele : _ele ) {
if ( (n=ele->nrml(0)) == NULL ) continue;
const int *pnt = ele->obj();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment