openvdb conversion experiments.
This commit is contained in:
parent
99dd6acc79
commit
259e058491
2 changed files with 24 additions and 11 deletions
|
@ -1,8 +1,9 @@
|
|||
if(TARGET OpenVDB::openvdb)
|
||||
add_executable(hollowing_tests hollowing_tests.cpp)
|
||||
|
||||
find_package(GTest REQUIRED)
|
||||
#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 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()
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include <iostream>
|
||||
#include <gtest/gtest.h>
|
||||
#include <catch_main.hpp>
|
||||
|
||||
#include <openvdb/openvdb.h>
|
||||
#include <openvdb/tools/MeshToVolume.h>
|
||||
#include <openvdb/tools/VolumeToMesh.h>
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
#include "libslic3r/Format/OBJ.hpp"
|
||||
|
||||
|
@ -36,14 +37,25 @@ static Slic3r::TriangleMesh load_model(const std::string &obj_filename)
|
|||
return mesh;
|
||||
}
|
||||
|
||||
TEST(Hollowing, LoadObject) {
|
||||
TEST_CASE("Load object", "[Hollowing]") {
|
||||
TriangleMeshDataAdapter mesh{load_model("20mm_cube.obj")};
|
||||
auto ptr = openvdb::tools::meshToVolume<openvdb::FloatGrid>(mesh, {});
|
||||
|
||||
ASSERT_TRUE(ptr);
|
||||
REQUIRE(ptr);
|
||||
|
||||
std::vector<openvdb::Vec3s> points;
|
||||
std::vector<openvdb::Vec4I> quad_indices;
|
||||
std::vector<openvdb::Vec3I> triangle_indices;
|
||||
|
||||
openvdb::tools::volumeToMesh(*ptr, points, triangle_indices, quad_indices, 0.0, 1.0, true);
|
||||
|
||||
std::cout << "Triangle count: " << triangle_indices.size() << std::endl;
|
||||
std::cout << "Quad count: " << quad_indices.size() << std::endl;
|
||||
std::cout << "Point count: " << points.size() << " vs " << mesh.mesh.its.vertices.size() << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
//int main(int argc, char **argv)
|
||||
//{
|
||||
// ::testing::InitGoogleTest(&argc, argv);
|
||||
// return RUN_ALL_TESTS();
|
||||
//}
|
||||
|
|
Loading…
Reference in a new issue