Add OpenVDBUtils into libslic3r, hollwing tests in libslic3r_test

This commit is contained in:
tamasmeszaros 2019-11-01 15:31:26 +01:00
parent 9dafc324f0
commit a8a5a884f9
8 changed files with 24 additions and 21 deletions

View File

@ -9,6 +9,11 @@ if (MINGW)
add_compile_options(-Wa,-mbig-obj)
endif ()
set(OpenVDBUtils_SOURCES "")
if (TARGET OpenVDB::openvdb)
set(OpenVDBUtils_SOURCES OpenVDBUtils.cpp OpenVDBUtils.hpp)
endif()
add_library(libslic3r STATIC
pchheader.cpp
pchheader.hpp
@ -174,6 +179,7 @@ add_library(libslic3r STATIC
MinAreaBoundingBox.cpp
miniz_extension.hpp
miniz_extension.cpp
${OpenVDBUtils_SOURCES}
SLA/SLACommon.hpp
SLA/SLABoilerPlate.hpp
SLA/SLAPad.hpp
@ -222,10 +228,13 @@ target_link_libraries(libslic3r
qhull
semver
TBB::tbb
# OpenVDB::openvdb
${CMAKE_DL_LIBS}
)
if (TARGET OpenVDB::openvdb)
target_link_libraries(libslic3r OpenVDB::openvdb)
endif()
if(WIN32)
target_link_libraries(libslic3r Psapi.lib)
endif()

View File

@ -1,6 +1,5 @@
#define NOMINMAX
#include "openvdb_utils.hpp"
#include "OpenVDBUtils.hpp"
#include <openvdb/tools/MeshToVolume.h>
#include <openvdb/tools/VolumeToMesh.h>
@ -55,7 +54,7 @@ openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh & mesh,
const openvdb::math::Transform &tr)
{
return openvdb::tools::meshToVolume<openvdb::FloatGrid>(
TriangleMeshDataAdapter{mesh}, tr);
TriangleMeshDataAdapter{mesh}, tr);
}
openvdb::FloatGrid::Ptr meshToVolume(const sla::Contour3D & mesh,
@ -78,7 +77,7 @@ sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
std::vector<openvdb::Vec3s> points;
std::vector<openvdb::Vec3I> triangles;
std::vector<openvdb::Vec4I> quads;
openvdb::tools::volumeToMesh(grid, points, triangles, quads, isovalue,
adaptivity, relaxDisorientedTriangles);

View File

@ -1,5 +1,5 @@
#ifndef OPENVDB_UTILS_HPP
#define OPENVDB_UTILS_HPP
#ifndef OPENVDBUTILS_HPP
#define OPENVDBUTILS_HPP
#include <libslic3r/TriangleMesh.hpp>
#include <libslic3r/SLA/SLABoilerPlate.hpp>
@ -20,4 +20,4 @@ sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
} // namespace Slic3r
#endif // OPENVDB_UTILS_HPP
#endif // OPENVDBUTILS_HPP

View File

@ -27,5 +27,4 @@ add_subdirectory(libslic3r)
add_subdirectory(timeutils)
add_subdirectory(fff_print)
add_subdirectory(sla_print)
add_subdirectory(hollowing)
add_subdirectory(example)
# add_subdirectory(example)

View File

@ -1,9 +0,0 @@
if(TARGET OpenVDB::openvdb)
add_executable(hollowing_tests hollowing_test_main.cpp hollowing_tests.cpp openvdb_utils.cpp openvdb_utils.hpp)
#find_package(GTest REQUIRED)
#target_link_libraries(hollowing_tests libslic3r OpenVDB::openvdb GTest::GTest GTest::Main)
#target_compile_definitions(hollowing_tests PRIVATE TEST_DATA_DIR=R"\(${TEST_DATA_DIR}\)")
target_link_libraries(hollowing_tests test_common libslic3r OpenVDB::openvdb)
endif()

View File

@ -1 +0,0 @@
#include <catch_main.hpp>

View File

@ -1,4 +1,5 @@
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
add_executable(${_TEST_NAME}_tests
${_TEST_NAME}_tests.cpp
test_3mf.cpp
@ -7,6 +8,11 @@ add_executable(${_TEST_NAME}_tests
test_polygon.cpp
test_stl.cpp
)
if (TARGET OpenVDB::openvdb)
target_sources(${_TEST_NAME}_tests PRIVATE test_hollowing.cpp)
endif()
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")

View File

@ -2,7 +2,7 @@
#include <fstream>
#include <catch2/catch.hpp>
#include "openvdb_utils.hpp"
#include "libslic3r/OpenVDBUtils.hpp"
#include "libslic3r/Format/OBJ.hpp"
#if defined(WIN32) || defined(_WIN32)