Merge branch 'DefaultMeshTypes' into 'master'
Default mesh types See merge request OpenMesh/OpenMesh!228
This commit is contained in:
@@ -119,6 +119,8 @@ unittests.exe --gtest_output=xml
|
||||
|
||||
unittests_customvec.exe --gtest_output=xml
|
||||
|
||||
unittests_doublevec.exe --gtest_output=xml
|
||||
|
||||
cd ..
|
||||
|
||||
cd ..
|
||||
@@ -147,6 +149,8 @@ unittests.exe --gtest_output=xml
|
||||
|
||||
unittests_customvec.exe --gtest_output=xml
|
||||
|
||||
unittests_doublevec.exe --gtest_output=xml
|
||||
|
||||
IF %errorlevel% NEQ 0 exit /b %errorlevel%
|
||||
|
||||
cd ..
|
||||
|
||||
@@ -87,6 +87,8 @@ make $MAKE_OPTIONS
|
||||
#build the unit tests
|
||||
make $MAKE_OPTIONS unittests
|
||||
|
||||
cd Unittests
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
@@ -94,8 +96,6 @@ echo "Running unittests Release version with vectorchecks enabled"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
cd Unittests
|
||||
|
||||
#execute tests
|
||||
./unittests --gtest_color=yes --gtest_output=xml
|
||||
|
||||
@@ -106,8 +106,19 @@ echo "Running unittests Release version with custom vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo "Running unittests Release version with double vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_doublevec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
@@ -133,6 +144,8 @@ make $MAKE_OPTIONS
|
||||
#build the unit tests
|
||||
make $MAKE_OPTIONS unittests
|
||||
|
||||
cd Unittests
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
@@ -140,9 +153,6 @@ echo "Running unittests Debug version with vectorchecks enabled"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
|
||||
cd Unittests
|
||||
|
||||
#execute tests
|
||||
./unittests --gtest_color=yes --gtest_output=xml
|
||||
|
||||
@@ -153,7 +163,18 @@ echo "Running unittests Debug version with custom vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo "Running unittests Debug version with double vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_doublevec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
31
CI/ci-mac.sh
31
CI/ci-mac.sh
@@ -69,6 +69,8 @@ make
|
||||
#build the unit tests
|
||||
make unittests
|
||||
|
||||
cd Unittests
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
@@ -76,8 +78,6 @@ echo "Running unittests Release version with vectorchecks enabled"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
cd Unittests
|
||||
|
||||
#execute tests
|
||||
./unittests --gtest_color=yes --gtest_output=xml
|
||||
|
||||
@@ -88,8 +88,19 @@ echo "Running unittests Release version with minimal vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo "Running unittests Release version with double vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_doublevec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
@@ -115,6 +126,8 @@ make
|
||||
#build the unit tests
|
||||
make unittests
|
||||
|
||||
cd Unittests
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
@@ -122,9 +135,6 @@ echo "Running unittests Debug version with vectorchecks enabled"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
|
||||
cd Unittests
|
||||
|
||||
#execute tests
|
||||
./unittests --gtest_color=yes --gtest_output=xml
|
||||
|
||||
@@ -135,8 +145,19 @@ echo "Running unittests Debug version with minimal vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
echo -e "${OUTPUT}"
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo "Running unittests Debug version with double vector type"
|
||||
echo "======================================================================"
|
||||
echo -e "${NC}"
|
||||
|
||||
#execute tests
|
||||
./unittests_doublevec --gtest_color=yes --gtest_output=xml
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
<b>Core</b>
|
||||
<ul>
|
||||
<li>Property System: Get rid of the OM_FORCE_STATIC_CAST defines. We use the type ids to check if the cast is valid or not. This will add more type safety. </li>
|
||||
<li>Default Traits: Added DefaultTraitsDouble as a version of the default traits that uses double precision for positions and normals as well as float for colors. </li>
|
||||
<li>Default Mesh Types: Added typdefs for a Triangle Mesh and a PolyMesh which use DefaultTraitsDouble and can be used as default mesh type be the user. </li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
66
src/OpenMesh/Core/Mesh/DefaultPolyMesh.hh
Normal file
66
src/OpenMesh/Core/Mesh/DefaultPolyMesh.hh
Normal file
@@ -0,0 +1,66 @@
|
||||
/* ========================================================================= *
|
||||
* *
|
||||
* OpenMesh *
|
||||
* Copyright (c) 2001-2019, RWTH-Aachen University *
|
||||
* Department of Computer Graphics and Multimedia *
|
||||
* All rights reserved. *
|
||||
* www.openmesh.org *
|
||||
* *
|
||||
*---------------------------------------------------------------------------*
|
||||
* This file is part of OpenMesh. *
|
||||
*---------------------------------------------------------------------------*
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions *
|
||||
* are met: *
|
||||
* *
|
||||
* 1. Redistributions of source code must retain the above copyright notice, *
|
||||
* this list of conditions and the following disclaimer. *
|
||||
* *
|
||||
* 2. Redistributions in binary form must reproduce the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer in the *
|
||||
* documentation and/or other materials provided with the distribution. *
|
||||
* *
|
||||
* 3. Neither the name of the copyright holder nor the names of its *
|
||||
* contributors may be used to endorse or promote products derived from *
|
||||
* this software without specific prior written permission. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
* *
|
||||
* ========================================================================= */
|
||||
|
||||
|
||||
#ifndef OPENMESH_DEFAULTPOLYMESH_HH
|
||||
#define OPENMESH_DEFAULTPOLYMESH_HH
|
||||
|
||||
|
||||
//== INCLUDES =================================================================
|
||||
|
||||
#include <OpenMesh/Core/Mesh/Traits.hh>
|
||||
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
|
||||
|
||||
//== NAMESPACES ===============================================================
|
||||
|
||||
namespace OpenMesh {
|
||||
|
||||
//== TYPEDEFS =================================================================
|
||||
|
||||
typedef PolyMesh_ArrayKernelT<DefaultTraitsDouble> PolyMesh;
|
||||
|
||||
//=============================================================================
|
||||
} // namespace OpenMesh
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
#endif // OPENMESH_DEFAULTPOLYMESH_HH defined
|
||||
//=============================================================================
|
||||
66
src/OpenMesh/Core/Mesh/DefaultTriMesh.hh
Normal file
66
src/OpenMesh/Core/Mesh/DefaultTriMesh.hh
Normal file
@@ -0,0 +1,66 @@
|
||||
/* ========================================================================= *
|
||||
* *
|
||||
* OpenMesh *
|
||||
* Copyright (c) 2001-2019, RWTH-Aachen University *
|
||||
* Department of Computer Graphics and Multimedia *
|
||||
* All rights reserved. *
|
||||
* www.openmesh.org *
|
||||
* *
|
||||
*---------------------------------------------------------------------------*
|
||||
* This file is part of OpenMesh. *
|
||||
*---------------------------------------------------------------------------*
|
||||
* *
|
||||
* Redistribution and use in source and binary forms, with or without *
|
||||
* modification, are permitted provided that the following conditions *
|
||||
* are met: *
|
||||
* *
|
||||
* 1. Redistributions of source code must retain the above copyright notice, *
|
||||
* this list of conditions and the following disclaimer. *
|
||||
* *
|
||||
* 2. Redistributions in binary form must reproduce the above copyright *
|
||||
* notice, this list of conditions and the following disclaimer in the *
|
||||
* documentation and/or other materials provided with the distribution. *
|
||||
* *
|
||||
* 3. Neither the name of the copyright holder nor the names of its *
|
||||
* contributors may be used to endorse or promote products derived from *
|
||||
* this software without specific prior written permission. *
|
||||
* *
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
||||
* *
|
||||
* ========================================================================= */
|
||||
|
||||
|
||||
#ifndef OPENMESH_DEFAULTTRIMESH_HH
|
||||
#define OPENMESH_DEFAULTTRIMESH_HH
|
||||
|
||||
|
||||
//== INCLUDES =================================================================
|
||||
|
||||
#include <OpenMesh/Core/Mesh/Traits.hh>
|
||||
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
||||
|
||||
//== NAMESPACES ===============================================================
|
||||
|
||||
namespace OpenMesh {
|
||||
|
||||
//== TYPEDEFS =================================================================
|
||||
|
||||
typedef TriMesh_ArrayKernelT<DefaultTraitsDouble> TriMesh;
|
||||
|
||||
//=============================================================================
|
||||
} // namespace OpenMesh
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
#endif // OPENMESH_DEFAULTTRIMESH_HH defined
|
||||
//=============================================================================
|
||||
@@ -152,6 +152,24 @@ struct DefaultTraits
|
||||
FaceAttributes(0);
|
||||
};
|
||||
|
||||
/** \class DefaultTraitsDouble Traits.hh <OpenMesh/Mesh/Traits.hh>
|
||||
|
||||
Version of Default Traits that uses double precision for points and
|
||||
normals as well as floating point vectors for colors
|
||||
|
||||
\see The Mesh docu section on \ref mesh_type.
|
||||
\see Traits.hh for a list of macros for traits classes.
|
||||
*/
|
||||
struct DefaultTraitsDouble : public DefaultTraits
|
||||
{
|
||||
/// Use double precision points
|
||||
typedef OpenMesh::Vec3d Point;
|
||||
/// Use double precision Normals
|
||||
typedef OpenMesh::Vec3d Normal;
|
||||
/// Use RGBA Color
|
||||
typedef OpenMesh::Vec4f Color;
|
||||
};
|
||||
|
||||
|
||||
//== CLASS DEFINITION =========================================================
|
||||
|
||||
|
||||
@@ -41,20 +41,25 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
# Create unittest executable
|
||||
acg_add_executable(unittests ${UNITTEST_SRC})
|
||||
acg_add_executable(unittests_customvec ${UNITTEST_SRC})
|
||||
acg_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
|
||||
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 )
|
||||
|
||||
# Set output directory to ${BINARY_DIR}/Unittests
|
||||
set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests")
|
||||
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(TOUPPER ${CONFIG} UPCONFIG)
|
||||
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
|
||||
set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
|
||||
set_target_properties(unittests_doublevec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
|
||||
endforeach()
|
||||
|
||||
|
||||
@@ -62,6 +67,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
# Link against all necessary libraries
|
||||
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
|
||||
target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
|
||||
target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
|
||||
|
||||
|
||||
|
||||
@@ -73,6 +79,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
endif()
|
||||
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
||||
target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
||||
target_link_libraries(unittests_doublevec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -81,10 +88,12 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
# Set compiler flags
|
||||
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
|
||||
set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
|
||||
set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
|
||||
else()
|
||||
# Set compiler flags
|
||||
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" )
|
||||
set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "" )
|
||||
set_target_properties(unittests_doublevec PROPERTIES COMPILE_FLAGS "" )
|
||||
endif()
|
||||
|
||||
if ( OPENMESH_BUILD_SHARED )
|
||||
@@ -103,14 +112,21 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
"$<TARGET_FILE:${TAR}>"
|
||||
"${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>"
|
||||
COMMENT "Copying OpenMesh targets to unittests directory")
|
||||
add_custom_command(TARGET unittests_doublevec POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"$<TARGET_FILE:${TAR}>"
|
||||
"${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>"
|
||||
COMMENT "Copying OpenMesh targets to unittests directory")
|
||||
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/)
|
||||
|
||||
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")
|
||||
add_test(NAME AllTestsIn_OpenMesh_tests_with_double_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_doublevec")
|
||||
|
||||
else(GTEST_FOUND)
|
||||
message(STATUS "Google testing framework was not found, unittests disabled.")
|
||||
|
||||
Reference in New Issue
Block a user