Merge branch 'CustomProperties' of https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh into CustomProperties

This commit is contained in:
Alexandra Heuschling
2021-01-19 17:06:11 +01:00
40 changed files with 189 additions and 979 deletions

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
if ( NOT DEFINED BUILD_APPS )
set( BUILD_APPS true CACHE BOOL "Enable or disable building of apps" )
@@ -42,7 +42,14 @@ if ( BUILD_APPS )
# For the apps, we need qt and opengl to build them
if (NOT QT5_FOUND)
acg_qt5 ()
set(QT5_REQUIRED_PACKAGES
Qt5Core
Qt5Widgets
Qt5OpenGL
Qt5Gui
)
vci_qt5 ()
set(CMAKE_AUTOMOC ON)
endif()
if ("${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles")

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
@@ -21,9 +21,9 @@ set (sources
)
if (WIN32)
acg_add_executable (DecimaterGui WIN32 ${sources} ${headers})
vci_add_executable (DecimaterGui WIN32 ${sources} ${headers})
else ()
acg_add_executable (DecimaterGui ${sources} ${headers} )
vci_add_executable (DecimaterGui ${sources} ${headers} )
endif ()
target_link_libraries (DecimaterGui

View File

@@ -1,11 +1,11 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
acg_add_executable (commandlineDecimater ../decimater.cc)
vci_add_executable (commandlineDecimater ../decimater.cc)
target_link_libraries (commandlineDecimater
OpenMeshCore

View File

@@ -1,10 +1,10 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../..
)
acg_add_executable (Dualizer dualizer.cc)
vci_add_executable (Dualizer dualizer.cc)
target_link_libraries (Dualizer
OpenMeshCore

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../..
@@ -20,9 +20,9 @@ set( sources
)
if (WIN32)
acg_add_executable( ProgViewer WIN32 ${sources} ${headers})
vci_add_executable( ProgViewer WIN32 ${sources} ${headers})
else ()
acg_add_executable( ProgViewer ${sources} ${headers})
vci_add_executable( ProgViewer ${sources} ${headers})
endif ()
target_link_libraries ( ProgViewer

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../..
@@ -22,9 +22,9 @@ set (headers
)
if (WIN32)
acg_add_executable (QtViewer WIN32 ${sources} ${headers})
vci_add_executable (QtViewer WIN32 ${sources} ${headers})
else ()
acg_add_executable (QtViewer ${sources} ${headers})
vci_add_executable (QtViewer ${sources} ${headers})
endif ()
target_link_libraries (QtViewer

View File

@@ -1,11 +1,11 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
acg_add_executable (Smoothing smooth.cc)
vci_add_executable (Smoothing smooth.cc)
target_link_libraries (Smoothing
OpenMeshCore

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
@@ -20,9 +20,9 @@ set (sources
)
if (WIN32)
acg_add_executable (SubdividerGui WIN32 ${sources} ${headers})
vci_add_executable (SubdividerGui WIN32 ${sources} ${headers})
else ()
acg_add_executable (SubdividerGui ${sources} ${headers})
vci_add_executable (SubdividerGui ${sources} ${headers})
endif ()
target_link_libraries (SubdividerGui

View File

@@ -1,11 +1,11 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
acg_add_executable (commandlineAdaptiveSubdivider ../adaptive_subdivider.cc)
vci_add_executable (commandlineAdaptiveSubdivider ../adaptive_subdivider.cc)
target_link_libraries (commandlineAdaptiveSubdivider
OpenMeshCore

View File

@@ -1,11 +1,11 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
acg_add_executable (commandlineSubdivider ../subdivider.cc)
vci_add_executable (commandlineSubdivider ../subdivider.cc)
target_link_libraries (commandlineSubdivider
OpenMeshCore

View File

@@ -1,11 +1,11 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
acg_add_executable (Analyzer vdpmanalyzer.cc)
vci_add_executable (Analyzer vdpmanalyzer.cc)
target_link_libraries (Analyzer
OpenMeshCore

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
@@ -17,9 +17,9 @@ set (sources
if (WIN32)
acg_add_executable (Synthesizer WIN32 ${sources} ${headers})
vci_add_executable (Synthesizer WIN32 ${sources} ${headers})
else ()
acg_add_executable (Synthesizer ${sources} ${headers})
vci_add_executable (Synthesizer ${sources} ${headers})
endif ()
target_link_libraries (Synthesizer

View File

@@ -1,11 +1,11 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../../..
${CMAKE_CURRENT_SOURCE_DIR}
)
acg_add_executable (mkbalancedpm mkbalancedpm.cc)
vci_add_executable (mkbalancedpm mkbalancedpm.cc)
target_link_libraries (mkbalancedpm
OpenMeshCore

View File

@@ -1,10 +1,10 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../../..
)
acg_add_executable (mconvert mconvert.cc)
vci_add_executable (mconvert mconvert.cc)
target_link_libraries (mconvert
OpenMeshCore

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../..
@@ -21,12 +21,12 @@ set (directories
)
# collect all header and source files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
vci_append_files (headers "*.hh" ${directories})
vci_append_files (sources "*.cc" ${directories})
# Disable Library installation when not building OpenMesh on its own but as part of another project!
if ( NOT ${PROJECT_NAME} MATCHES "OpenMesh")
set(ACG_NO_LIBRARY_INSTALL true)
set(VCI_NO_LIBRARY_INSTALL true)
endif()
@@ -34,14 +34,14 @@ if (WIN32)
if ( OPENMESH_BUILD_SHARED )
add_definitions( -DOPENMESHDLL -DBUILDOPENMESHDLL)
acg_add_library (OpenMeshCore SHARED ${sources} ${headers})
vci_add_library (OpenMeshCore SHARED ${sources} ${headers})
else()
# OpenMesh has no dll exports so we have to build a static library on windows
acg_add_library (OpenMeshCore STATIC ${sources} ${headers})
vci_add_library (OpenMeshCore STATIC ${sources} ${headers})
endif()
else ()
acg_add_library (OpenMeshCore SHAREDANDSTATIC ${sources} ${headers})
vci_add_library (OpenMeshCore SHAREDANDSTATIC ${sources} ${headers})
set_target_properties (OpenMeshCore PROPERTIES VERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR}
SOVERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} )
endif ()
@@ -79,7 +79,7 @@ endif()
# Install Header Files (Apple)
if ( NOT ACG_PROJECT_MACOS_BUNDLE AND APPLE )
if ( NOT VCI_PROJECT_MACOS_BUNDLE AND APPLE )
FILE(GLOB files_install_Geometry "${CMAKE_CURRENT_SOURCE_DIR}/Geometry/*.hh" )
FILE(GLOB files_install_IO "${CMAKE_CURRENT_SOURCE_DIR}/IO/*.hh" "${CMAKE_CURRENT_SOURCE_DIR}/IO/*.inl" )
FILE(GLOB files_install_IO_importer "${CMAKE_CURRENT_SOURCE_DIR}/IO/importer/*.hh" )
@@ -140,7 +140,7 @@ target_include_directories(OpenMeshCore PUBLIC
$<INSTALL_INTERFACE:include>)
install(TARGETS OpenMeshCore EXPORT OpenMeshConfig
ARCHIVE DESTINATION ${ACG_PROJECT_LIBDIR}
LIBRARY DESTINATION ${ACG_PROJECT_LIBDIR}
RUNTIME DESTINATION ${ACG_PROJECT_BINDIR})
ARCHIVE DESTINATION ${VCI_PROJECT_LIBDIR}
LIBRARY DESTINATION ${VCI_PROJECT_LIBDIR}
RUNTIME DESTINATION ${VCI_PROJECT_BINDIR})

View File

@@ -72,7 +72,7 @@ namespace OpenMesh {
//== CLASS DEFINITION =========================================================
/** /class NormalCone NormalCone.hh <ACG/Geometry/Types/NormalCone.hh>
/** /class NormalCone NormalCone.hh <OpenMesh/Core/Geometry/NormalConeT.hh>
NormalCone that can be merged with other normal cones. Provides
the center normal and the opening angle.

View File

@@ -662,24 +662,24 @@ bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi
}
//----------------------------------------------------------------------------------------
case Chunk::Type_Texcoord:
{
assert( OMFormat::dimensions(chunk_header_) == size_t(OpenMesh::Vec2f::dim()));
//fileOptions_ += OpenMesh::IO::Options::FaceTexCoord;
if (_opt.face_has_texcoord())
case Chunk::Type_Texcoord:
{
_bi.request_face_texcoords2D();
}
OpenMesh::Vec2f v2f;
for (size_t e_idx = 0; e_idx < header_.n_edges_*2; ++e_idx)
{
bytes_ += vector_restore(_is, v2f, _swap);
assert( OMFormat::dimensions(chunk_header_) == size_t(OpenMesh::Vec2f::dim()));
//fileOptions_ += OpenMesh::IO::Options::FaceTexCoord;
if (_opt.face_has_texcoord())
_bi.set_texcoord(HalfedgeHandle(int(e_idx)), v2f);
}
break;
{
_bi.request_face_texcoords2D();
}
OpenMesh::Vec2f v2f;
for (size_t e_idx = 0; e_idx < header_.n_edges_*2; ++e_idx)
{
bytes_ += vector_restore(_is, v2f, _swap);
if (_opt.face_has_texcoord())
_bi.set_texcoord(HalfedgeHandle(int(e_idx)), v2f);
}
break;
}
//----------------------------------------------------------------------------------------
case Chunk::Type_Topology:

View File

@@ -47,12 +47,6 @@
//=============================================================================
#if defined(ACGMAKE_STATIC_BUILD)
# define OM_STATIC_BUILD 1
#endif
//=============================================================================
#if defined(_DEBUG) || defined(DEBUG)
# define OM_DEBUG
#endif

View File

@@ -593,6 +593,17 @@ class PropertyManager {
src.copy_to(src_range, dst, dst_range);
}
/**
* Mark whether this property should be stored when mesh is written
* to a file
*
* @param _persistence Property will be stored iff _persistence is true
*/
void set_persistent(bool _persistence = true)
{
mesh().property(getRawProperty()).set_persistent(_persistence);
}
private:
void deleteProperty() {
if (!retain_ && prop_.is_valid())

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
../..
@@ -19,16 +19,16 @@ set (directories
)
# collect all header and source files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
vci_append_files (headers "*.hh" ${directories})
vci_append_files (sources "*.cc" ${directories})
IF(WIN32 AND NOT MINGW)
acg_append_files (sources "*.c" ${directories})
vci_append_files (sources "*.c" ${directories})
ENDIF(WIN32 AND NOT MINGW)
# Disable Library installation when not building OpenMesh on its own but as part of another project!
if ( NOT ${PROJECT_NAME} MATCHES "OpenMesh")
set(ACG_NO_LIBRARY_INSTALL true)
set(VCI_NO_LIBRARY_INSTALL true)
endif()
@@ -36,14 +36,14 @@ if (WIN32)
if ( OPENMESH_BUILD_SHARED )
add_definitions( -DOPENMESHDLL -DBUILDOPENMESHDLL)
acg_add_library (OpenMeshTools SHARED ${sources} ${headers})
vci_add_library (OpenMeshTools SHARED ${sources} ${headers})
else()
# OpenMesh has no dll exports so we have to build a static library on windows
acg_add_library (OpenMeshTools STATIC ${sources} ${headers})
vci_add_library (OpenMeshTools STATIC ${sources} ${headers})
endif()
else ()
acg_add_library (OpenMeshTools SHAREDANDSTATIC ${sources} ${headers})
vci_add_library (OpenMeshTools SHAREDANDSTATIC ${sources} ${headers})
set_target_properties (OpenMeshTools PROPERTIES VERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR}
SOVERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} )
endif ()
@@ -74,7 +74,7 @@ endif()
# Install Header Files (Apple)
if ( NOT ACG_PROJECT_MACOS_BUNDLE AND APPLE )
if ( NOT VCI_PROJECT_MACOS_BUNDLE AND APPLE )
FILE(GLOB files_install_Decimater "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*.hh" )
FILE(GLOB files_install_Dualizer "${CMAKE_CURRENT_SOURCE_DIR}/Dualizer/*.hh" )
FILE(GLOB files_install_KERNEL_OSG "${CMAKE_CURRENT_SOURCE_DIR}/Kernel_OSG/*.hh" )
@@ -120,7 +120,7 @@ target_include_directories(OpenMeshTools PUBLIC
$<INSTALL_INTERFACE:include>)
install(TARGETS OpenMeshTools EXPORT OpenMeshConfig
ARCHIVE DESTINATION ${ACG_PROJECT_LIBDIR}
LIBRARY DESTINATION ${ACG_PROJECT_LIBDIR}
RUNTIME DESTINATION ${ACG_PROJECT_BINDIR})
ARCHIVE DESTINATION ${VCI_PROJECT_LIBDIR}
LIBRARY DESTINATION ${VCI_PROJECT_LIBDIR}
RUNTIME DESTINATION ${VCI_PROJECT_BINDIR})

View File

@@ -197,6 +197,6 @@ private:
} // END_NS_DECIMATER
} // END_NS_OPENMESH
//=============================================================================
#endif // OPENACG_MODNORMALFLIPPING_HH defined
#endif // OPENMESH_DECIMATER_MODNORMALFLIPPING_HH defined
//=============================================================================

View File

@@ -1,4 +1,4 @@
include (ACGCommon)
include (VCICommon)
include_directories (
..
@@ -17,7 +17,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
enable_testing()
find_package(EIGEN3)
find_package(Eigen3)
# Set correct include paths so that the compiler can find the headers
include_directories(${GTEST_INCLUDE_DIRS} )
@@ -27,9 +27,11 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
link_directories(${GTEST_LIBRARY_DIR} )
if (EIGEN3_FOUND)
if (TARGET Eigen3::Eigen)
add_definitions( -DENABLE_EIGEN3_TEST )
include_directories(${EIGEN3_INCLUDE_DIR})
link_libraries(Eigen3::Eigen)
else()
message(WARNING "Eigen3 not found! This will skip the Eigen3 Unittests. You can point cmake to Eigen3 by setting Eigen3_DIR to the cmake files of Eigen3")
endif()
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
@@ -39,13 +41,13 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
# Create new target named unittests_hexmeshing
FILE(GLOB UNITTEST_SRC *.cc)
# Create unittest executable
acg_add_executable(unittests ${UNITTEST_SRC})
acg_add_executable(unittests_customvec ${UNITTEST_SRC})
acg_add_executable(unittests_doublevec ${UNITTEST_SRC})
vci_add_executable(unittests ${UNITTEST_SRC})
vci_add_executable(unittests_customvec ${UNITTEST_SRC})
vci_add_executable(unittests_doublevec ${UNITTEST_SRC})
target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS)
target_compile_definitions(unittests_doublevec PRIVATE TEST_DOUBLE_TRAITS)
# For the unittest we don't want the install rpath as set by acg_add_executable
# For the unittest we don't want the install rpath as set by vci_add_executable
set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
set_target_properties ( unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
set_target_properties ( unittests_doublevec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
@@ -120,9 +122,9 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
endforeach(TAR)
endif()
acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
acg_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
acg_copy_after_build(unittests_doublevec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
vci_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
vci_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
vci_copy_after_build(unittests_doublevec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests")
add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec")

View File

@@ -1810,6 +1810,61 @@ TEST_F(OpenMeshReadWriteOM, PropertyFromString)
}
}
/*
* Try to write and load bool property
*/
TEST_F(OpenMeshReadWriteOM, WriteAndLoadBoolCheckSpaces) {
typedef OpenMesh::PolyMesh_ArrayKernelT<OpenMesh::DefaultTraitsDouble> DoublePolyMesh;
DoublePolyMesh mesh;
OpenMesh::VPropHandleT<bool> prop;
mesh.add_property(prop,"VBProp");
mesh.property(prop).set_persistent(true);
// Generate a bool property which will be packed into a space character
std::vector<OpenMesh::VertexHandle> vertices;
for (unsigned int i = 0; i < 8; ++i)
{
vertices.push_back(mesh.add_vertex(DoublePolyMesh::Point(0.0, 0.0, 0.0)));
if ( i == 5)
mesh.property(prop,vertices[i]) = true;
else
mesh.property(prop,vertices[i]) = false;
}
std::string file_name = "bool-space-test.om";
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
ASSERT_TRUE(OpenMesh::IO::write_mesh(mesh, file_name, opt)) << "Could not write file " << file_name;
// ====================================================
// Now read it back
// ====================================================
DoublePolyMesh mesh2;
OpenMesh::VPropHandleT<bool> prop2;
mesh2.add_property(prop2,"VBProp");
mesh2.property(prop2).set_persistent(true);
ASSERT_TRUE(OpenMesh::IO::read_mesh(mesh2, file_name, opt)) << "Could not read file " << file_name;
// Check if the property is still ok
for (unsigned int i = 0; i < 8; ++i)
{
if ( i == 5)
EXPECT_TRUE( mesh.property(prop,mesh2.vertex_handle((i)) ) );
else
EXPECT_FALSE(mesh.property(prop,mesh2.vertex_handle((i))));
}
}
}
OM_REGISTER_PROPERTY_TYPE(std::vector<float>)