This commit is contained in:
tamasmeszaros 2022-04-07 12:11:37 +02:00
parent b5bf529551
commit e405b0ef4a
2 changed files with 3 additions and 7 deletions

View File

@ -43,15 +43,13 @@ public:
: its{m}, voxel_scale{voxel_sc} {}; : its{m}, voxel_scale{voxel_sc} {};
}; };
// TODO: Do I need to call initialize? Seems to work without it as well but the
// docs say it should be called ones. It does a mutex lock-unlock sequence all
// even if was called previously.
openvdb::FloatGrid::Ptr mesh_to_grid(const indexed_triangle_set & mesh, openvdb::FloatGrid::Ptr mesh_to_grid(const indexed_triangle_set & mesh,
const openvdb::math::Transform &tr, const openvdb::math::Transform &tr,
float voxel_scale, float voxel_scale,
float exteriorBandWidth, float exteriorBandWidth,
float interiorBandWidth) float interiorBandWidth)
{ {
// Might not be needed but this is now proven to be working
openvdb::initialize(); openvdb::initialize();
std::vector<indexed_triangle_set> meshparts = its_split(mesh); std::vector<indexed_triangle_set> meshparts = its_split(mesh);
@ -70,9 +68,7 @@ openvdb::FloatGrid::Ptr mesh_to_grid(const indexed_triangle_set & mesh,
else if (subgrid) grid = std::move(subgrid); else if (subgrid) grid = std::move(subgrid);
} }
if (grid && meshparts.size() >= 1) { if(meshparts.empty()) {
// grid = openvdb::tools::levelSetRebuild(*grid, 0.);
} else if(meshparts.empty()) {
// Splitting failed, fall back to hollow the original mesh // Splitting failed, fall back to hollow the original mesh
grid = openvdb::tools::meshToVolume<openvdb::FloatGrid>( grid = openvdb::tools::meshToVolume<openvdb::FloatGrid>(
TriangleMeshDataAdapter{mesh}, tr); TriangleMeshDataAdapter{mesh}, tr);

View File

@ -502,7 +502,7 @@ void remove_inside_triangles(TriangleMesh &mesh, const Interior &interior,
if (f.parent != NEW_FACE) // Top parent needs to be removed as well if (f.parent != NEW_FACE) // Top parent needs to be removed as well
mesh_mods.to_remove[f.parent] = true; mesh_mods.to_remove[f.parent] = true;
// If the outside part is between the interior end the exterior // If the outside part is between the interior and the exterior
// (inside the wall being invisible), no further division is needed. // (inside the wall being invisible), no further division is needed.
if ((R + D) < interior.thickness) if ((R + D) < interior.thickness)
return false; return false;