Merge branch 'tm_openvdb_integration' into lm_tm_hollowing

This commit is contained in:
tamasmeszaros 2019-11-05 14:48:44 +01:00
commit 4d8631fef6
14 changed files with 66 additions and 93 deletions

View file

@ -184,7 +184,6 @@ add_library(libslic3r STATIC
${OpenVDBUtils_SOURCES}
SLA/SLACommon.hpp
SLA/SLACommon.cpp
SLA/SLABoilerPlate.hpp
SLA/SLAPad.hpp
SLA/SLAPad.cpp
SLA/SLASupportTreeBuilder.hpp

View file

@ -51,10 +51,10 @@ void Contour3DDataAdapter::getIndexSpacePoint(size_t n,
}
openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh &mesh,
const openvdb::math::Transform &tr,
float exteriorBandWidth,
float interiorBandWidth,
int flags,
const openvdb::math::Transform &tr)
int flags)
{
openvdb::initialize();
return openvdb::tools::meshToVolume<openvdb::FloatGrid>(
@ -67,10 +67,10 @@ openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh &mesh,
// even if was called previously.
openvdb::FloatGrid::Ptr meshToVolume(const sla::Contour3D & mesh,
const openvdb::math::Transform &tr,
float exteriorBandWidth,
float interiorBandWidth,
int flags,
const openvdb::math::Transform &tr)
int flags)
{
openvdb::initialize();
return openvdb::tools::meshToVolume<openvdb::FloatGrid>(

View file

@ -2,22 +2,22 @@
#define OPENVDBUTILS_HPP
#include <libslic3r/TriangleMesh.hpp>
#include <libslic3r/SLA/SLABoilerPlate.hpp>
#include <libslic3r/SLA/SLACommon.hpp>
#include <openvdb/openvdb.h>
namespace Slic3r {
openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh &mesh,
openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh & mesh,
const openvdb::math::Transform &tr = {},
float exteriorBandWidth = 3.0f,
float interiorBandWidth = 3.0f,
int flags = 0,
const openvdb::math::Transform &tr = {});
int flags = 0);
openvdb::FloatGrid::Ptr meshToVolume(const sla::Contour3D &mesh,
openvdb::FloatGrid::Ptr meshToVolume(const sla::Contour3D & mesh,
const openvdb::math::Transform &tr = {},
float exteriorBandWidth = 3.0f,
float interiorBandWidth = 3.0f,
int flags = 0,
const openvdb::math::Transform &tr = {});
int flags = 0);
sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
double isovalue = 0.0,

View file

@ -1,23 +0,0 @@
#ifndef SLABOILERPLATE_HPP
#define SLABOILERPLATE_HPP
#include <iostream>
#include <functional>
#include <numeric>
#include <libslic3r/ExPolygon.hpp>
#include <libslic3r/TriangleMesh.hpp>
#include "SLACommon.hpp"
#include "SLASpatIndex.hpp"
namespace Slic3r {
typedef Eigen::Matrix<int, 4, 1, Eigen::DontAlign> Vec4i;
namespace sla {
}
}
#endif // SLABOILERPLATE_HPP

View file

@ -1,7 +1,7 @@
#ifndef SLABOOSTADAPTER_HPP
#define SLABOOSTADAPTER_HPP
#include "SLA/SLABoilerPlate.hpp"
#include "SLA/SLACommon.hpp"
#include <boost/geometry.hpp>
namespace boost {

View file

@ -3,6 +3,8 @@
#include <memory>
#include <vector>
#include <numeric>
#include <functional>
#include <Eigen/Geometry>
#include "SLASpatIndex.hpp"

View file

@ -1,5 +1,5 @@
#include "SLAPad.hpp"
#include "SLABoilerPlate.hpp"
#include "SLACommon.hpp"
#include "SLASpatIndex.hpp"
#include "ConcaveHull.hpp"

View file

@ -2,7 +2,7 @@
#include <exception>
#include <libnest2d/optimizers/nlopt/genetic.hpp>
#include "SLABoilerPlate.hpp"
#include "SLACommon.hpp"
#include "SLARotfinder.hpp"
#include "SLASupportTree.hpp"
#include "Model.hpp"

View file

@ -5,7 +5,7 @@
#include <numeric>
#include "SLASupportTree.hpp"
#include "SLABoilerPlate.hpp"
#include "SLACommon.hpp"
#include "SLASpatIndex.hpp"
#include "SLASupportTreeBuilder.hpp"

View file

@ -2,7 +2,7 @@
#define SUPPORTTREEBUILDER_HPP
#include "SLAConcurrency.hpp"
#include "SLABoilerPlate.hpp"
#include "SLACommon.hpp"
#include "SLASupportTree.hpp"
#include "SLAPad.hpp"
#include <libslic3r/MTUtils.hpp>

View file

@ -1,6 +1,6 @@
#include <cmath>
#include "SLA/SLASupportTree.hpp"
#include "SLA/SLABoilerPlate.hpp"
#include "SLA/SLACommon.hpp"
#include "SLA/SLASpatIndex.hpp"
// Workaround: IGL signed_distance.h will define PI in the igl namespace.

View file

@ -52,7 +52,9 @@ namespace {
// should add up to 100 (%)
const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS =
{
30, // slaposObjectSlice,
5, // slaposHollowing,
20, // slaposObjectSlice,
5, // slaposDrillHolesIfHollowed
20, // slaposSupportPoints,
10, // slaposSupportTree,
10, // slaposPad,
@ -63,14 +65,17 @@ const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS =
std::string OBJ_STEP_LABELS(size_t idx)
{
switch (idx) {
case slaposObjectSlice: return L("Slicing model");
case slaposSupportPoints: return L("Generating support points");
case slaposSupportTree: return L("Generating support tree");
case slaposPad: return L("Generating pad");
case slaposSliceSupports: return L("Slicing supports");
case slaposHollowing: return L("Hollowing out the model");
case slaposObjectSlice: return L("Slicing model");
case slaposDrillHolesIfHollowed: return L("Drilling holes into hollowed model.");
case slaposSupportPoints: return L("Generating support points");
case slaposSupportTree: return L("Generating support tree");
case slaposPad: return L("Generating pad");
case slaposSliceSupports: return L("Slicing supports");
default:;
}
assert(false); return "Out of bounds!";
assert(false);
return "Out of bounds!";
};
// Should also add up to 100 (%)
@ -1460,7 +1465,7 @@ void SLAPrint::process()
slaposFn pobj_program[] =
{
slice_model, support_points, support_tree, generate_pad, slice_supports
[](SLAPrintObject&){}, slice_model, [](SLAPrintObject&){}, support_points, support_tree, generate_pad, slice_supports
};
// We want to first process all objects...
@ -1760,8 +1765,14 @@ bool SLAPrintObject::invalidate_step(SLAPrintObjectStep step)
{
bool invalidated = Inherited::invalidate_step(step);
// propagate to dependent steps
if (step == slaposObjectSlice) {
if (step == slaposHollowing) {
invalidated |= this->invalidate_all_steps();
} else if (step == slaposObjectSlice) {
invalidated |= this->invalidate_steps({ slaposDrillHolesIfHollowed, slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
} else if (step == slaposDrillHolesIfHollowed) {
invalidated |= this->invalidate_steps({ slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
} else if (step == slaposSupportPoints) {
invalidated |= this->invalidate_steps({ slaposSupportTree, slaposPad, slaposSliceSupports });
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);

View file

@ -18,7 +18,9 @@ enum SLAPrintStep : unsigned int {
};
enum SLAPrintObjectStep : unsigned int {
slaposHollowing,
slaposObjectSlice,
slaposDrillHolesIfHollowed,
slaposSupportPoints,
slaposSupportTree,
slaposPad,