Add Basic Reflectance mode back as an option

- Tweaks to top-surface coloring debug exports
This commit is contained in:
sentientstardust
2026-06-01 01:54:47 +01:00
parent 1a6bb9d652
commit f6c56bf2bb
4 changed files with 209 additions and 30 deletions

View File

@@ -824,6 +824,8 @@ struct TopSurfaceImageDebugAnchoredRegionTiming {
};
struct TopSurfaceImageDebugAnchoredSurfaceExport {
size_t print_object_id { 0 };
size_t model_object_id { 0 };
unsigned int zone_id { 0 };
size_t region_id { 0 };
int source_layer_id { -1 };
@@ -839,6 +841,8 @@ struct TopSurfaceImageDebugAnchoredSurfaceExport {
};
struct TopSurfaceImageDebugAnchoredLayerTiming {
size_t print_object_id { 0 };
size_t model_object_id { 0 };
unsigned int zone_id { 0 };
size_t region_id { 0 };
int source_layer_id { -1 };
@@ -865,6 +869,17 @@ static TopSurfaceImageDebugManifest& top_surface_image_debug_manifest()
return manifest;
}
static size_t top_surface_image_debug_print_object_id(const PrintObject &object)
{
return object.id().id;
}
static size_t top_surface_image_debug_model_object_id(const PrintObject &object)
{
const ModelObject *model_object = object.model_object();
return model_object == nullptr ? 0 : model_object->id().id;
}
static nlohmann::json top_surface_image_debug_bbox_json(const BoundingBox &bbox)
{
if (!bbox.defined)
@@ -993,6 +1008,8 @@ static nlohmann::json top_surface_image_debug_region_timing_json(const TopSurfac
static nlohmann::json top_surface_image_debug_layer_timing_json(const TopSurfaceImageDebugAnchoredLayerTiming &timing)
{
return {
{ "print_object_id", timing.print_object_id },
{ "model_object_id", timing.model_object_id },
{ "zone_id", timing.zone_id },
{ "region_id", timing.region_id },
{ "source_layer_id", timing.source_layer_id },
@@ -1134,7 +1151,7 @@ static void top_surface_image_debug_write_manifest_locked(const TopSurfaceImageD
{
const std::filesystem::path path = top_surface_image_debug_output_dir() / "debug_manifest.json";
nlohmann::json root;
root["schema_version"] = 4;
root["schema_version"] = 5;
root["output_dir"] = top_surface_image_debug_output_dir().string();
root["object_exports"] = nlohmann::json::array();
@@ -1156,6 +1173,8 @@ static void top_surface_image_debug_write_manifest_locked(const TopSurfaceImageD
root["anchored_surfaces"] = nlohmann::json::array();
for (const TopSurfaceImageDebugAnchoredSurfaceExport &surface : manifest.anchored_surfaces) {
nlohmann::json surface_json;
surface_json["print_object_id"] = surface.print_object_id;
surface_json["model_object_id"] = surface.model_object_id;
surface_json["zone_id"] = surface.zone_id;
surface_json["region_id"] = surface.region_id;
surface_json["source_layer_id"] = surface.source_layer_id;
@@ -1215,7 +1234,7 @@ static void top_surface_image_debug_export_object_mesh(const PrintObject &object
TopSurfaceImageDebugManifest &manifest = top_surface_image_debug_manifest();
std::lock_guard<std::mutex> lock(manifest.mutex);
const size_t print_object_id = object.get_id();
const size_t print_object_id = top_surface_image_debug_print_object_id(object);
auto it = std::find_if(manifest.object_exports.begin(),
manifest.object_exports.end(),
[print_object_id](const TopSurfaceImageDebugObjectExport &entry) {
@@ -1237,7 +1256,7 @@ static void top_surface_image_debug_export_object_mesh(const PrintObject &object
filename << "object_"
<< print_object_id
<< "_model_"
<< model_object->id().id
<< top_surface_image_debug_model_object_id(object)
<< "_slicing_space.obj";
const std::string path = filename.str();
const std::string full_path = (top_surface_image_debug_output_dir() / path).string();
@@ -1248,7 +1267,7 @@ static void top_surface_image_debug_export_object_mesh(const PrintObject &object
TopSurfaceImageDebugObjectExport entry;
entry.print_object_id = print_object_id;
entry.model_object_id = model_object->id().id;
entry.model_object_id = top_surface_image_debug_model_object_id(object);
entry.path = path;
entry.vertex_count = mesh.its.vertices.size();
entry.face_count = mesh.its.indices.size();
@@ -3822,6 +3841,7 @@ static ExPolygons top_surface_image_debug_bbox_expolygons(const BoundingBox &bbo
static std::string top_surface_image_debug_anchored_base_filename(const TopSurfaceImageRegionPlan &plan,
const Layer &source_layer,
const PrintObject &object,
TopSurfaceImageSourceSurface source_surface,
size_t region_idx)
{
@@ -3830,6 +3850,10 @@ static std::string top_surface_image_debug_anchored_base_filename(const TopSurfa
<< plan.zone_id
<< "_region_"
<< plan.region_id
<< "_object_"
<< top_surface_image_debug_print_object_id(object)
<< "_model_"
<< top_surface_image_debug_model_object_id(object)
<< "_"
<< top_surface_image_source_surface_debug_name(source_surface)
<< "_source_layer_"
@@ -3896,6 +3920,100 @@ static bool top_surface_image_debug_export_region_infos(const std::string
return true;
}
static bool top_surface_image_debug_export_merged_texture_rgb_patches(
const std::string &filename,
const std::vector<int> &grid,
int cols,
int rows,
const std::vector<TopSurfaceImageContoningVectorLabel> &labels,
const std::vector<std::optional<TopSurfaceImageContoningCellSample>> &cell_samples,
size_t &valid_pixels,
const ThrowIfCanceled *throw_if_canceled)
{
valid_pixels = 0;
if (grid.empty() || labels.empty() || cols <= 0 || rows <= 0 ||
grid.size() != size_t(cols) * size_t(rows) ||
cell_samples.size() != grid.size())
return false;
std::vector<uint8_t> image(grid.size() * 3, 0);
std::vector<unsigned char> visited(grid.size(), 0);
for (int row = 0; row < rows; ++row) {
if ((row & 15) == 0)
check_canceled(throw_if_canceled);
for (int col = 0; col < cols; ++col) {
const int start_idx = row * cols + col;
const int label = grid[size_t(start_idx)];
if (label < 0 || label >= int(labels.size()) || visited[size_t(start_idx)])
continue;
std::vector<int> queue;
queue.push_back(start_idx);
visited[size_t(start_idx)] = 1;
double sample_weight = 0.;
std::array<double, 3> oklab_sum { { 0., 0., 0. } };
for (size_t queue_idx = 0; queue_idx < queue.size(); ++queue_idx) {
if ((queue_idx & 255) == 0)
check_canceled(throw_if_canceled);
const int idx = queue[queue_idx];
if (cell_samples[size_t(idx)]) {
const TopSurfaceImageContoningCellSample &sample = *cell_samples[size_t(idx)];
const std::array<float, 3> sample_oklab = color_solver_oklab_from_srgb(sample.rgb);
const double weight = double(std::max(1, sample.sample_count));
oklab_sum[0] += double(sample_oklab[0]) * weight;
oklab_sum[1] += double(sample_oklab[1]) * weight;
oklab_sum[2] += double(sample_oklab[2]) * weight;
sample_weight += weight;
}
const int r = idx / cols;
const int c = idx - r * cols;
const std::array<std::pair<int, int>, 4> neighbors{
std::pair<int, int>{ c - 1, r },
std::pair<int, int>{ c + 1, r },
std::pair<int, int>{ c, r - 1 },
std::pair<int, int>{ c, r + 1 }
};
for (const std::pair<int, int> &neighbor : neighbors) {
const int nc = neighbor.first;
const int nr = neighbor.second;
if (nc < 0 || nc >= cols || nr < 0 || nr >= rows)
continue;
const int nidx = nr * cols + nc;
if (visited[size_t(nidx)] || grid[size_t(nidx)] != label)
continue;
visited[size_t(nidx)] = 1;
queue.push_back(nidx);
}
}
std::array<float, 3> patch_rgb = labels[size_t(label)].rgb;
if (sample_weight > 0.) {
const std::array<float, 3> average_oklab {
float(oklab_sum[0] / sample_weight),
float(oklab_sum[1] / sample_weight),
float(oklab_sum[2] / sample_weight)
};
patch_rgb = color_solver_srgb_from_oklab(average_oklab);
}
const std::array<unsigned char, 3> patch_bytes = top_surface_image_debug_rgb_bytes(patch_rgb);
for (int idx : queue) {
const int r = idx / cols;
const int c = idx - r * cols;
top_surface_image_debug_set_raster_pixel(image, cols, rows, r, c, patch_bytes);
++valid_pixels;
}
}
}
return valid_pixels > 0 &&
png::write_rgb_to_file((top_surface_image_debug_output_dir() / filename).string(),
size_t(cols),
size_t(rows),
image);
}
static void top_surface_image_debug_export_anchored_rasters(
const std::string &base,
const std::vector<int> &grid,
@@ -3990,6 +4108,27 @@ static void top_surface_image_debug_export_anchored_rasters(
source_z_mm));
}
{
size_t valid_pixels = 0;
const std::string filename = base + "_merged_texture_rgb_patches.png";
if (top_surface_image_debug_export_merged_texture_rgb_patches(filename,
grid,
cols,
rows,
labels,
cell_samples,
valid_pixels,
throw_if_canceled)) {
TopSurfaceImageDebugRasterExport raster = base_raster;
raster.valid_pixels = valid_pixels;
out_files.push_back(top_surface_image_debug_raster_file_export("merged_texture_rgb_patches_png",
filename,
raster,
-1,
source_z_mm));
}
}
for (int depth : active_depths) {
check_canceled(throw_if_canceled);
if (depth < 0)
@@ -4058,6 +4197,7 @@ static void top_surface_image_debug_export_anchored_rasters(
static void top_surface_image_debug_write_anchored_surface_plan(const TopSurfaceImageRegionPlan &plan,
const Layer &source_layer,
const PrintObject &object,
const TopSurfaceImageContoningAnchoredSurfacePlan &anchored_plan,
TopSurfaceImageSourceSurface source_surface,
const ThrowIfCanceled *throw_if_canceled)
@@ -4072,7 +4212,7 @@ static void top_surface_image_debug_write_anchored_surface_plan(const TopSurface
continue;
const std::string base =
top_surface_image_debug_anchored_base_filename(plan, source_layer, source_surface, region_idx);
top_surface_image_debug_anchored_base_filename(plan, source_layer, object, source_surface, region_idx);
std::vector<TopSurfaceImageDebugFileExport> exported_files = region.debug_raster_files;
std::vector<TopSurfaceImageDebugDepthExport> exported_depths;
@@ -4204,6 +4344,8 @@ static void top_surface_image_debug_write_anchored_surface_plan(const TopSurface
if (!exported_files.empty()) {
TopSurfaceImageDebugAnchoredSurfaceExport metadata;
metadata.print_object_id = top_surface_image_debug_print_object_id(object);
metadata.model_object_id = top_surface_image_debug_model_object_id(object);
metadata.zone_id = plan.zone_id;
metadata.region_id = plan.region_id;
metadata.source_layer_id = source_layer.id();
@@ -5088,7 +5230,7 @@ static void top_surface_image_contoning_solve_anchored_region(
});
if (has_depth_regions) {
const std::string base =
top_surface_image_debug_anchored_base_filename(plan, source_layer, source_surface, debug_region_idx);
top_surface_image_debug_anchored_base_filename(plan, source_layer, object, source_surface, debug_region_idx);
const double source_z_mm = source_surface == TopSurfaceImageSourceSurface::Bottom ?
source_layer.bottom_z() :
source_layer.print_z;
@@ -5144,6 +5286,8 @@ static std::shared_ptr<TopSurfaceImageContoningAnchoredSurfacePlan> top_surface_
const auto debug_total_start = top_surface_image_debug_now();
TopSurfaceImageDebugAnchoredLayerTiming debug_timing;
if (debug_enabled) {
debug_timing.print_object_id = top_surface_image_debug_print_object_id(object);
debug_timing.model_object_id = top_surface_image_debug_model_object_id(object);
debug_timing.zone_id = plan.zone_id;
debug_timing.region_id = plan.region_id;
debug_timing.source_layer_id = source_layer.id();
@@ -5340,7 +5484,7 @@ static std::shared_ptr<TopSurfaceImageContoningAnchoredSurfacePlan> top_surface_
}
debug_step_start = top_surface_image_debug_now();
top_surface_image_debug_write_anchored_surface_plan(plan, source_layer, *out, source_surface, throw_if_canceled);
top_surface_image_debug_write_anchored_surface_plan(plan, source_layer, object, *out, source_surface, throw_if_canceled);
if (debug_enabled)
top_surface_image_debug_accumulate_timing_step(debug_timing.steps,
"write_debug_exports",
@@ -6643,6 +6787,7 @@ static std::vector<TopSurfaceImageRegionPlan> top_surface_image_region_plans(
!plan.contoning_td_effective_alpha_correction_enabled &&
zone->top_surface_contoning_beer_lambert_rgb_correction_enabled;
plan.contoning_variable_layer_height_compensation_enabled =
plan.contoning_td_adjustment_enabled &&
zone->top_surface_contoning_variable_layer_height_compensation_enabled;
plan.contoning_generic_solver_mix_model =
std::clamp(zone->generic_solver_mix_model,

View File

@@ -735,6 +735,8 @@ static std::string top_surface_contoning_color_prediction_mode_name(int mode)
return "td_effective_alpha";
if (mode == int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb))
return "rgb_beer_lambert";
if (mode == int(TextureMappingZone::ContoningColorPredictionBasicReflectance))
return "basic_reflectance";
return "default";
}
@@ -748,6 +750,10 @@ static int top_surface_contoning_color_prediction_mode_from_name(std::string nam
return int(TextureMappingZone::ContoningColorPredictionTdEffectiveAlpha);
if (name == "rgb_beer_lambert" || name == "beer_lambert_rgb" || name == "beer_lambert")
return int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb);
if (name == "basic_reflectance" ||
name == "basic_reflectance_no_td_correction" ||
name == "no_td_correction")
return int(TextureMappingZone::ContoningColorPredictionBasicReflectance);
return TextureMappingZone::DefaultTopSurfaceContoningColorPredictionMode;
}
@@ -767,6 +773,8 @@ static int top_surface_contoning_polygonization_mode_from_name(std::string name)
});
if (name == "marching_squares" || name == "marching_square")
return int(TextureMappingZone::ContoningPolygonizationMarchingSquares);
if (name == "vector_border_shared_gaussian_partition")
return int(TextureMappingZone::ContoningPolygonizationVectorBorderSharedGaussianPartition);
return TextureMappingZone::DefaultTopSurfaceContoningPolygonizationMode;
}
@@ -1979,7 +1987,7 @@ void TextureMappingManager::load_entries(const std::string &serialized,
color_prediction_mode_it->get<int>() :
TextureMappingZone::DefaultTopSurfaceContoningColorPredictionMode,
int(TextureMappingZone::ContoningColorPredictionDefault),
int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb));
int(TextureMappingZone::ContoningColorPredictionBasicReflectance));
zone.top_surface_contoning_beer_lambert_rgb_correction_enabled =
TextureMappingZone::DefaultTopSurfaceContoningBeerLambertRgbCorrectionEnabled;
zone.top_surface_contoning_td_effective_alpha_correction_enabled =

View File

@@ -92,7 +92,8 @@ struct TextureMappingZone
enum TopSurfaceContoningColorPredictionMode : uint8_t {
ContoningColorPredictionDefault = 0,
ContoningColorPredictionTdEffectiveAlpha = 1,
ContoningColorPredictionBeerLambertRgb = 2
ContoningColorPredictionBeerLambertRgb = 2,
ContoningColorPredictionBasicReflectance = 3
};
enum TopSurfaceContoningPolygonizationMode : uint8_t {
@@ -214,7 +215,7 @@ struct TextureMappingZone
static constexpr bool DefaultTopSurfaceContoningPolygonizeColorRegionsEnabled = true;
static constexpr bool DefaultTopSurfaceContoningFastModeEnabled = true;
static constexpr int DefaultTopSurfaceContoningPolygonizationMode =
int(ContoningPolygonizationVectorBorderSharedGaussianPartition);
int(ContoningPolygonizationMarchingSquares);
static constexpr int DefaultTopSurfaceContoningPolygonizeResolution = 4;
static constexpr bool DefaultTopSurfaceContoningSurfaceAnchoredStacksEnabled = true;
static constexpr bool DefaultTopSurfaceContoningSurfaceAnchoredStackOptimizationsEnabled = true;
@@ -353,8 +354,9 @@ struct TextureMappingZone
static constexpr int normalize_top_surface_contoning_polygonization_mode(int mode)
{
return mode == int(ContoningPolygonizationMarchingSquares) ?
int(ContoningPolygonizationMarchingSquares) :
return mode == int(ContoningPolygonizationVectorBorderSharedGaussianPartition) ||
mode == int(ContoningPolygonizationMarchingSquares) ?
mode :
DefaultTopSurfaceContoningPolygonizationMode;
}
@@ -365,9 +367,10 @@ struct TextureMappingZone
static bool effective_top_surface_contoning_surface_scatter_enabled(bool td_adjustment,
bool surface_scatter,
bool beer_lambert_rgb,
bool td_effective_alpha)
{
return td_adjustment && surface_scatter && !td_effective_alpha;
return td_adjustment && surface_scatter && beer_lambert_rgb && !td_effective_alpha;
}
static int effective_top_surface_contoning_color_prediction_mode(int mode)
@@ -376,7 +379,7 @@ struct TextureMappingZone
return SlicerDefaultTopSurfaceContoningColorPredictionMode;
return std::clamp(mode,
int(ContoningColorPredictionTdEffectiveAlpha),
int(ContoningColorPredictionBeerLambertRgb));
int(ContoningColorPredictionBasicReflectance));
}
static bool effective_top_surface_contoning_layer_phase_enabled(bool value, bool surface_anchored_stacks)
@@ -651,6 +654,7 @@ struct TextureMappingZone
return TextureMappingZone::effective_top_surface_contoning_surface_scatter_enabled(
top_surface_contoning_td_adjustment_enabled,
top_surface_contoning_surface_scatter_enabled,
top_surface_contoning_beer_lambert_rgb_correction_enabled,
top_surface_contoning_td_effective_alpha_correction_enabled);
}
@@ -662,10 +666,13 @@ struct TextureMappingZone
void normalize_top_surface_contoning_td_correction()
{
const int mode = effective_top_surface_contoning_color_prediction_mode();
top_surface_contoning_td_adjustment_enabled = true;
const bool beer_lambert_rgb =
effective_top_surface_contoning_color_prediction_mode() == int(ContoningColorPredictionBeerLambertRgb);
mode == int(ContoningColorPredictionBeerLambertRgb);
top_surface_contoning_beer_lambert_rgb_correction_enabled = beer_lambert_rgb;
top_surface_contoning_td_effective_alpha_correction_enabled = !beer_lambert_rgb;
top_surface_contoning_td_effective_alpha_correction_enabled =
mode == int(ContoningColorPredictionTdEffectiveAlpha);
}
void apply_top_surface_contoning_experimental_defaults()
@@ -698,9 +705,10 @@ struct TextureMappingZone
top_surface_contoning_layer_phase_enabled = false;
top_surface_contoning_blue_noise_error_diffusion_enabled = false;
}
top_surface_contoning_td_adjustment_enabled = true;
normalize_top_surface_contoning_td_correction();
if (top_surface_contoning_td_effective_alpha_correction_enabled)
if (!top_surface_contoning_td_adjustment_enabled ||
!top_surface_contoning_beer_lambert_rgb_correction_enabled ||
top_surface_contoning_td_effective_alpha_correction_enabled)
top_surface_contoning_surface_scatter_enabled = false;
}

View File

@@ -2099,6 +2099,8 @@ static wxString texture_mapping_contoning_color_prediction_mode_label(int mode)
switch (TextureMappingZone::effective_top_surface_contoning_color_prediction_mode(mode)) {
case int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb):
return _L("RGB Beer-Lambert - not recommended");
case int(TextureMappingZone::ContoningColorPredictionBasicReflectance):
return _L("Basic Reflectance");
default:
return _L("TD Effective Alpha");
}
@@ -2121,6 +2123,8 @@ static int texture_mapping_contoning_color_prediction_mode_choice_selection(int
switch (TextureMappingZone::effective_top_surface_contoning_color_prediction_mode(mode)) {
case int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb):
return 2;
case int(TextureMappingZone::ContoningColorPredictionBasicReflectance):
return 3;
default:
return 1;
}
@@ -2133,6 +2137,8 @@ static int texture_mapping_contoning_color_prediction_mode_from_choice_selection
return int(TextureMappingZone::ContoningColorPredictionTdEffectiveAlpha);
case 2:
return int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb);
case 3:
return int(TextureMappingZone::ContoningColorPredictionBasicReflectance);
default:
return TextureMappingZone::DefaultTopSurfaceContoningColorPredictionMode;
}
@@ -2148,7 +2154,7 @@ static int texture_mapping_contoning_polygonization_mode_from_choice_selection(i
{
return selection == 1 ?
int(TextureMappingZone::ContoningPolygonizationMarchingSquares) :
TextureMappingZone::DefaultTopSurfaceContoningPolygonizationMode;
int(TextureMappingZone::ContoningPolygonizationVectorBorderSharedGaussianPartition);
}
class TextureMappingAdvancedOptionsDialog : public wxDialog
@@ -2921,15 +2927,18 @@ public:
0,
wxEXPAND | wxTOP | wxBOTTOM,
gap / 2);
const int top_surface_contoning_effective_color_prediction_mode =
TextureMappingZone::effective_top_surface_contoning_color_prediction_mode(top_surface_contoning_color_prediction_mode);
const bool top_surface_contoning_td_adjustment_selected = true;
const bool top_surface_contoning_td_effective_alpha_correction_selected =
TextureMappingZone::effective_top_surface_contoning_color_prediction_mode(top_surface_contoning_color_prediction_mode) ==
int(TextureMappingZone::ContoningColorPredictionTdEffectiveAlpha);
top_surface_contoning_effective_color_prediction_mode == int(TextureMappingZone::ContoningColorPredictionTdEffectiveAlpha);
m_top_surface_contoning_surface_scatter_checkbox =
new wxCheckBox(m_top_surface_contoning_checkboxes_panel, wxID_ANY, _L("Surface scatter correction"));
m_top_surface_contoning_surface_scatter_checkbox->SetValue(
TextureMappingZone::effective_top_surface_contoning_surface_scatter_enabled(
true,
top_surface_contoning_td_adjustment_selected,
top_surface_contoning_surface_scatter_enabled,
top_surface_contoning_effective_color_prediction_mode == int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb),
top_surface_contoning_td_effective_alpha_correction_selected));
m_top_surface_contoning_surface_scatter_checkbox->SetMinSize(
wxSize(-1, std::max(m_top_surface_contoning_surface_scatter_checkbox->GetBestSize().GetHeight(), FromDIP(24))));
@@ -2946,6 +2955,7 @@ public:
contoning_td_correction_choices.Add(texture_mapping_contoning_color_prediction_default_label());
contoning_td_correction_choices.Add(texture_mapping_contoning_color_prediction_mode_label(int(TextureMappingZone::ContoningColorPredictionTdEffectiveAlpha)));
contoning_td_correction_choices.Add(texture_mapping_contoning_color_prediction_mode_label(int(TextureMappingZone::ContoningColorPredictionBeerLambertRgb)));
contoning_td_correction_choices.Add(texture_mapping_contoning_color_prediction_mode_label(int(TextureMappingZone::ContoningColorPredictionBasicReflectance)));
m_top_surface_contoning_td_correction_choice =
new wxChoice(m_top_surface_contoning_checkboxes_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, contoning_td_correction_choices);
m_top_surface_contoning_td_correction_choice->SetSelection(
@@ -3104,7 +3114,7 @@ public:
wxALIGN_CENTER_VERTICAL | wxRIGHT,
gap);
wxArrayString contoning_polygonization_mode_choices;
contoning_polygonization_mode_choices.Add(_L("Vector-border shared Gaussian partition"));
contoning_polygonization_mode_choices.Add(_L("Vector-border shared Gaussian partition (very slow)"));
contoning_polygonization_mode_choices.Add(_L("Marching squares"));
m_top_surface_contoning_polygonization_mode_choice =
new wxChoice(m_top_surface_contoning_polygonization_mode_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, contoning_polygonization_mode_choices);
@@ -3751,6 +3761,7 @@ public:
m_top_surface_contoning_surface_scatter_checkbox == nullptr ?
TextureMappingZone::DefaultTopSurfaceContoningSurfaceScatterEnabled :
m_top_surface_contoning_surface_scatter_checkbox->GetValue(),
top_surface_contoning_beer_lambert_rgb_correction_enabled(),
top_surface_contoning_td_effective_alpha_correction_enabled());
}
bool top_surface_contoning_beer_lambert_rgb_correction_enabled() const
@@ -3767,9 +3778,10 @@ public:
}
bool top_surface_contoning_variable_layer_height_compensation_enabled() const
{
return m_top_surface_contoning_variable_layer_height_compensation_checkbox == nullptr ?
TextureMappingZone::DefaultTopSurfaceContoningVariableLayerHeightCompensationEnabled :
m_top_surface_contoning_variable_layer_height_compensation_checkbox->GetValue();
return top_surface_contoning_td_adjustment_enabled() &&
(m_top_surface_contoning_variable_layer_height_compensation_checkbox == nullptr ?
TextureMappingZone::DefaultTopSurfaceContoningVariableLayerHeightCompensationEnabled :
m_top_surface_contoning_variable_layer_height_compensation_checkbox->GetValue());
}
bool minimum_visibility_offset_enabled() const
{
@@ -4556,13 +4568,18 @@ private:
m_top_surface_contoning_color_lower_surfaces_checkbox->Enable(contoning);
}
if (m_top_surface_contoning_surface_scatter_checkbox != nullptr) {
const bool td_adjustment = contoning;
const bool td_adjustment =
contoning &&
top_surface_contoning_td_adjustment_enabled();
const bool beer_lambert_rgb =
td_adjustment &&
top_surface_contoning_beer_lambert_rgb_correction_enabled();
const bool td_effective_alpha =
td_adjustment &&
top_surface_contoning_td_effective_alpha_correction_selected();
m_top_surface_contoning_surface_scatter_checkbox->Show(contoning);
m_top_surface_contoning_surface_scatter_checkbox->Enable(td_adjustment && !td_effective_alpha);
if (td_effective_alpha && m_top_surface_contoning_surface_scatter_checkbox->GetValue())
m_top_surface_contoning_surface_scatter_checkbox->Enable(td_adjustment && beer_lambert_rgb && !td_effective_alpha);
if (!td_adjustment || !beer_lambert_rgb || td_effective_alpha)
m_top_surface_contoning_surface_scatter_checkbox->SetValue(false);
}
if (m_top_surface_contoning_td_correction_choice != nullptr) {
@@ -4571,7 +4588,8 @@ private:
}
if (m_top_surface_contoning_variable_layer_height_compensation_checkbox != nullptr) {
m_top_surface_contoning_variable_layer_height_compensation_checkbox->Show(contoning);
m_top_surface_contoning_variable_layer_height_compensation_checkbox->Enable(contoning);
m_top_surface_contoning_variable_layer_height_compensation_checkbox->Enable(
contoning && top_surface_contoning_td_adjustment_enabled());
}
if (m_top_surface_contoning_only_one_perimeter_around_shell_infill_checkbox != nullptr) {
m_top_surface_contoning_only_one_perimeter_around_shell_infill_checkbox->Show(contoning);