mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:36:14 +08:00
Use default bandwidth before csgUnion when hollowing
Add cca 6.5% speedup (on 12 core amd)
This commit is contained in:
parent
1b1f523e3b
commit
9e5ba20f8f
@ -49,8 +49,7 @@ 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)
|
||||||
int flags)
|
|
||||||
{
|
{
|
||||||
openvdb::initialize();
|
openvdb::initialize();
|
||||||
|
|
||||||
@ -64,8 +63,7 @@ openvdb::FloatGrid::Ptr mesh_to_grid(const indexed_triangle_set & mesh,
|
|||||||
openvdb::FloatGrid::Ptr grid;
|
openvdb::FloatGrid::Ptr grid;
|
||||||
for (auto &m : meshparts) {
|
for (auto &m : meshparts) {
|
||||||
auto subgrid = openvdb::tools::meshToVolume<openvdb::FloatGrid>(
|
auto subgrid = openvdb::tools::meshToVolume<openvdb::FloatGrid>(
|
||||||
TriangleMeshDataAdapter{m, voxel_scale}, tr, exteriorBandWidth,
|
TriangleMeshDataAdapter{m, voxel_scale}, tr);
|
||||||
interiorBandWidth, flags);
|
|
||||||
|
|
||||||
if (grid && subgrid) openvdb::tools::csgUnion(*grid, *subgrid);
|
if (grid && subgrid) openvdb::tools::csgUnion(*grid, *subgrid);
|
||||||
else if (subgrid) grid = std::move(subgrid);
|
else if (subgrid) grid = std::move(subgrid);
|
||||||
@ -78,7 +76,7 @@ openvdb::FloatGrid::Ptr mesh_to_grid(const indexed_triangle_set & mesh,
|
|||||||
// 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, exteriorBandWidth,
|
TriangleMeshDataAdapter{mesh}, tr, exteriorBandWidth,
|
||||||
interiorBandWidth, flags);
|
interiorBandWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
grid->insertMeta("voxel_scale", openvdb::FloatMetadata(voxel_scale));
|
grid->insertMeta("voxel_scale", openvdb::FloatMetadata(voxel_scale));
|
||||||
|
@ -30,8 +30,7 @@ openvdb::FloatGrid::Ptr mesh_to_grid(const indexed_triangle_set & mesh,
|
|||||||
const openvdb::math::Transform &tr = {},
|
const openvdb::math::Transform &tr = {},
|
||||||
float voxel_scale = 1.f,
|
float voxel_scale = 1.f,
|
||||||
float exteriorBandWidth = 3.0f,
|
float exteriorBandWidth = 3.0f,
|
||||||
float interiorBandWidth = 3.0f,
|
float interiorBandWidth = 3.0f);
|
||||||
int flags = 0);
|
|
||||||
|
|
||||||
indexed_triangle_set grid_to_mesh(const openvdb::FloatGrid &grid,
|
indexed_triangle_set grid_to_mesh(const openvdb::FloatGrid &grid,
|
||||||
double isovalue = 0.0,
|
double isovalue = 0.0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user