Mirroring parameters prepared for UI.
Actual mirroring disabled, it will be refactored to maintain clarity of code.
This commit is contained in:
parent
b234a1b7a7
commit
baab5e49f1
5 changed files with 71 additions and 28 deletions
|
@ -2258,6 +2258,18 @@ void PrintConfigDef::init_sla_params()
|
|||
def->min = 100;
|
||||
def->set_default_value(new ConfigOptionInt(1440));
|
||||
|
||||
def = this->add("display_mirror_x", coBool);
|
||||
def->full_label = L("Display mirroring in X axis");
|
||||
def->label = L("Mirror X");
|
||||
def->tooltip = L("Enable mirroring of output images in the X axis");
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("display_mirror_y", coBool);
|
||||
def->full_label = L("Display mirroring in Y axis");
|
||||
def->label = L("Mirror Y");
|
||||
def->tooltip = L("Enable mirroring of output images in the Y axis");
|
||||
def->set_default_value(new ConfigOptionBool(true));
|
||||
|
||||
def = this->add("display_orientation", coEnum);
|
||||
def->label = L("Display orientation");
|
||||
def->tooltip = L("Set the actual LCD display orientation inside the SLA printer."
|
||||
|
|
|
@ -1083,6 +1083,8 @@ public:
|
|||
ConfigOptionInt display_pixels_x;
|
||||
ConfigOptionInt display_pixels_y;
|
||||
ConfigOptionEnum<SLADisplayOrientation> display_orientation;
|
||||
ConfigOptionBool display_mirror_x;
|
||||
ConfigOptionBool display_mirror_y;
|
||||
ConfigOptionFloats relative_correction;
|
||||
ConfigOptionFloat absolute_correction;
|
||||
ConfigOptionFloat gamma_correction;
|
||||
|
@ -1099,6 +1101,8 @@ protected:
|
|||
OPT_PTR(display_height);
|
||||
OPT_PTR(display_pixels_x);
|
||||
OPT_PTR(display_pixels_y);
|
||||
OPT_PTR(display_mirror_x);
|
||||
OPT_PTR(display_mirror_y);
|
||||
OPT_PTR(display_orientation);
|
||||
OPT_PTR(relative_correction);
|
||||
OPT_PTR(absolute_correction);
|
||||
|
|
|
@ -210,6 +210,28 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
inline FilePrinter(const SLAPrinterConfig& cfg, const SLAMaterialConfig& mcfg, double layer_height)
|
||||
{
|
||||
double w = cfg.display_width.getFloat();
|
||||
double h = cfg.display_height.getFloat();
|
||||
auto pw = unsigned(cfg.display_pixels_x.getInt());
|
||||
auto ph = unsigned(cfg.display_pixels_y.getInt());
|
||||
|
||||
m_res = Raster::Resolution(pw, ph);
|
||||
m_pxdim = Raster::PixelDim(w/pw, h/ph);
|
||||
m_exp_time_s = mcfg.exposure_time.getFloat();
|
||||
m_exp_time_first_s = mcfg.initial_exposure_time.getFloat();
|
||||
m_layer_height = layer_height;
|
||||
|
||||
auto ro = cfg.display_orientation.getInt();
|
||||
|
||||
// Here is the trick with the orientation.
|
||||
m_o = ro == RO_LANDSCAPE? Raster::Origin::BOTTOM_LEFT :
|
||||
Raster::Origin::TOP_LEFT;
|
||||
|
||||
m_gamma = cfg.gamma_correction.getFloat();
|
||||
}
|
||||
|
||||
FilePrinter(const FilePrinter& ) = delete;
|
||||
FilePrinter(FilePrinter&& m):
|
||||
m_layers_rst(std::move(m.m_layers_rst)),
|
||||
|
|
|
@ -75,7 +75,10 @@ public:
|
|||
struct Resolution {
|
||||
unsigned width_px;
|
||||
unsigned height_px;
|
||||
inline Resolution(unsigned w, unsigned h): width_px(w), height_px(h) {}
|
||||
|
||||
inline Resolution(unsigned w = 0, unsigned h = 0):
|
||||
width_px(w), height_px(h) {}
|
||||
|
||||
inline unsigned pixels() const /*noexcept*/ {
|
||||
return width_px * height_px;
|
||||
}
|
||||
|
@ -85,7 +88,7 @@ public:
|
|||
struct PixelDim {
|
||||
double w_mm;
|
||||
double h_mm;
|
||||
inline PixelDim(double px_width_mm, double px_height_mm ):
|
||||
inline PixelDim(double px_width_mm = 0.0, double px_height_mm = 0.0):
|
||||
w_mm(px_width_mm), h_mm(px_height_mm) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -1008,7 +1008,7 @@ void SLAPrint::process()
|
|||
namespace sl = libnest2d::shapelike; // For algorithms
|
||||
|
||||
// If the raster has vertical orientation, we will flip the coordinates
|
||||
bool flpXY = m_printer_config.display_orientation.getInt() == SLADisplayOrientation::sladoPortrait;
|
||||
// bool flpXY = m_printer_config.display_orientation.getInt() == SLADisplayOrientation::sladoPortrait;
|
||||
|
||||
// Set up custom union and diff functions for clipper polygons
|
||||
auto polyunion = [] (const ClipperPolygons& subjects)
|
||||
|
@ -1066,9 +1066,9 @@ void SLAPrint::process()
|
|||
|
||||
// get polygons for all instances in the object
|
||||
auto get_all_polygons =
|
||||
[flpXY](const ExPolygons& input_polygons,
|
||||
const std::vector<SLAPrintObject::Instance>& instances,
|
||||
bool is_lefthanded)
|
||||
[](const ExPolygons& input_polygons,
|
||||
const std::vector<SLAPrintObject::Instance>& instances,
|
||||
bool is_lefthanded)
|
||||
{
|
||||
ClipperPolygons polygons;
|
||||
polygons.reserve(input_polygons.size() * instances.size());
|
||||
|
@ -1082,7 +1082,7 @@ void SLAPrint::process()
|
|||
|
||||
// We need to reverse if flpXY OR is_lefthanded is true but
|
||||
// not if both are true which is a logical inequality (XOR)
|
||||
bool needreverse = flpXY != is_lefthanded;
|
||||
bool needreverse = /*flpXY !=*/ is_lefthanded;
|
||||
|
||||
// should be a move
|
||||
poly.Contour.reserve(polygon.contour.size() + 1);
|
||||
|
@ -1117,10 +1117,10 @@ void SLAPrint::process()
|
|||
sl::translate(poly, ClipperPoint{instances[i].shift(X),
|
||||
instances[i].shift(Y)});
|
||||
|
||||
if (flpXY) {
|
||||
for(auto& p : poly.Contour) std::swap(p.X, p.Y);
|
||||
for(auto& h : poly.Holes) for(auto& p : h) std::swap(p.X, p.Y);
|
||||
}
|
||||
// if (flpXY) {
|
||||
// for(auto& p : poly.Contour) std::swap(p.X, p.Y);
|
||||
// for(auto& h : poly.Holes) for(auto& p : h) std::swap(p.X, p.Y);
|
||||
// }
|
||||
|
||||
polygons.emplace_back(std::move(poly));
|
||||
}
|
||||
|
@ -1289,27 +1289,29 @@ void SLAPrint::process()
|
|||
|
||||
{ // create a raster printer for the current print parameters
|
||||
// I don't know any better
|
||||
auto& ocfg = m_objects.front()->m_config;
|
||||
auto& matcfg = m_material_config;
|
||||
auto& printcfg = m_printer_config;
|
||||
// auto& ocfg = m_objects.front()->m_config;
|
||||
// auto& matcfg = m_material_config;
|
||||
// auto& printcfg = m_printer_config;
|
||||
|
||||
double w = printcfg.display_width.getFloat();
|
||||
double h = printcfg.display_height.getFloat();
|
||||
auto pw = unsigned(printcfg.display_pixels_x.getInt());
|
||||
auto ph = unsigned(printcfg.display_pixels_y.getInt());
|
||||
double lh = ocfg.layer_height.getFloat();
|
||||
double exp_t = matcfg.exposure_time.getFloat();
|
||||
double iexp_t = matcfg.initial_exposure_time.getFloat();
|
||||
// double w = printcfg.display_width.getFloat();
|
||||
// double h = printcfg.display_height.getFloat();
|
||||
// auto pw = unsigned(printcfg.display_pixels_x.getInt());
|
||||
// auto ph = unsigned(printcfg.display_pixels_y.getInt());
|
||||
// double lh = ocfg.layer_height.getFloat();
|
||||
// double exp_t = matcfg.exposure_time.getFloat();
|
||||
// double iexp_t = matcfg.initial_exposure_time.getFloat();
|
||||
|
||||
double gamma = m_printer_config.gamma_correction.getFloat();
|
||||
// double gamma = m_printer_config.gamma_correction.getFloat();
|
||||
|
||||
if(flpXY) { std::swap(w, h); std::swap(pw, ph); }
|
||||
// if(flpXY) { std::swap(w, h); std::swap(pw, ph); }
|
||||
|
||||
m_printer.reset(
|
||||
new SLAPrinter(w, h, pw, ph, lh, exp_t, iexp_t,
|
||||
flpXY? SLAPrinter::RO_PORTRAIT :
|
||||
SLAPrinter::RO_LANDSCAPE,
|
||||
gamma));
|
||||
// m_printer.reset(
|
||||
// new SLAPrinter(w, h, pw, ph, lh, exp_t, iexp_t,
|
||||
// flpXY? SLAPrinter::RO_PORTRAIT :
|
||||
// SLAPrinter::RO_LANDSCAPE,
|
||||
// gamma));
|
||||
|
||||
m_printer.reset(new SLAPrinter(m_printer_config, m_material_config, m_default_object_config.layer_height.getFloat()));
|
||||
}
|
||||
|
||||
// Allocate space for all the layers
|
||||
|
|
Loading…
Reference in a new issue