Merge branch 'master' of https://github.com/prusa3d/Slic3r into et_copy_and_paste

This commit is contained in:
Enrico Turri 2019-04-12 11:28:43 +02:00
commit 341e5276db
4 changed files with 32 additions and 22 deletions

View File

@ -2,30 +2,21 @@
const vec3 ZERO = vec3(0.0, 0.0, 0.0); const vec3 ZERO = vec3(0.0, 0.0, 0.0);
varying vec3 clipping_planes_dots;
// x = tainted, y = specular; // x = tainted, y = specular;
varying vec2 intensity; varying vec2 intensity;
varying vec3 delta_box_min; varying vec3 delta_box_min;
varying vec3 delta_box_max; varying vec3 delta_box_max;
varying vec3 world_pos;
uniform vec4 uniform_color; uniform vec4 uniform_color;
// x = min z, y = max z;
uniform vec2 z_range;
// clipping plane (general orientation):
uniform vec4 clipping_plane;
void main() void main()
{ {
if ((world_pos.z < z_range.x) || (z_range.y < world_pos.z)) if (any(lessThan(clipping_planes_dots, ZERO)))
discard; discard;
if (world_pos.x*clipping_plane.x + world_pos.y*clipping_plane.y + world_pos.z*clipping_plane.z + clipping_plane.w < 0.0 )
discard;
// if the fragment is outside the print volume -> use darker color // if the fragment is outside the print volume -> use darker color
vec3 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? mix(uniform_color.rgb, ZERO, 0.3333) : uniform_color.rgb; vec3 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? mix(uniform_color.rgb, ZERO, 0.3333) : uniform_color.rgb;
gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + color * intensity.x, uniform_color.a); gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + color * intensity.x, uniform_color.a);

View File

@ -28,13 +28,18 @@ struct PrintBoxDetection
uniform PrintBoxDetection print_box; uniform PrintBoxDetection print_box;
// Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
uniform vec2 z_range;
// Clipping plane - general orientation. Used by the SLA gizmo.
uniform vec4 clipping_plane;
// x = tainted, y = specular; // x = tainted, y = specular;
varying vec2 intensity; varying vec2 intensity;
varying vec3 delta_box_min; varying vec3 delta_box_min;
varying vec3 delta_box_max; varying vec3 delta_box_max;
varying vec3 world_pos; varying vec3 clipping_planes_dots;
void main() void main()
{ {
@ -66,8 +71,11 @@ void main()
{ {
delta_box_min = ZERO; delta_box_min = ZERO;
delta_box_max = ZERO; delta_box_max = ZERO;
} }
gl_Position = ftransform(); gl_Position = ftransform();
world_pos = vec3(print_box.volume_world_matrix * gl_Vertex); // Point in homogenous coordinates.
} vec4 world_pos = print_box.volume_world_matrix * gl_Vertex;
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
}

View File

@ -801,12 +801,16 @@ bool PresetCollection::delete_current_preset()
void PresetCollection::load_bitmap_default(wxWindow *window, const std::string &file_name) void PresetCollection::load_bitmap_default(wxWindow *window, const std::string &file_name)
{ {
*m_bitmap_main_frame = create_scaled_bitmap(window, file_name); // XXX: See note in PresetBundle::load_compatible_bitmaps()
(void)window;
*m_bitmap_main_frame = create_scaled_bitmap(nullptr, file_name);
} }
void PresetCollection::load_bitmap_add(wxWindow *window, const std::string &file_name) void PresetCollection::load_bitmap_add(wxWindow *window, const std::string &file_name)
{ {
*m_bitmap_add = create_scaled_bitmap(window, file_name); // XXX: See note in PresetBundle::load_compatible_bitmaps()
(void)window;
*m_bitmap_add = create_scaled_bitmap(nullptr, file_name);
} }
const Preset* PresetCollection::get_selected_preset_parent() const const Preset* PresetCollection::get_selected_preset_parent() const

View File

@ -398,10 +398,17 @@ void PresetBundle::export_selections(AppConfig &config)
void PresetBundle::load_compatible_bitmaps(wxWindow *window) void PresetBundle::load_compatible_bitmaps(wxWindow *window)
{ {
*m_bitmapCompatible = create_scaled_bitmap(window, "flag_green"); // We don't actually pass the window pointer here and instead generate
*m_bitmapIncompatible = create_scaled_bitmap(window, "flag_red"); // a low DPI bitmap, because the wxBitmapComboBox and wxDataViewControl don't support
*m_bitmapLock = create_scaled_bitmap(window, "lock_closed"); // high DPI bitmaps very well, they compute their dimensions wrong.
*m_bitmapLockOpen = create_scaled_bitmap(window, "sys_unlock.png"); // TODO: Update this when fixed in wxWidgets
// See also PresetCollection::load_bitmap_default() and PresetCollection::load_bitmap_add()
(void)window;
*m_bitmapCompatible = create_scaled_bitmap(nullptr, "flag_green");
*m_bitmapIncompatible = create_scaled_bitmap(nullptr, "flag_red");
*m_bitmapLock = create_scaled_bitmap(nullptr, "lock_closed");
*m_bitmapLockOpen = create_scaled_bitmap(nullptr, "sys_unlock.png");
prints .set_bitmap_compatible(m_bitmapCompatible); prints .set_bitmap_compatible(m_bitmapCompatible);
filaments .set_bitmap_compatible(m_bitmapCompatible); filaments .set_bitmap_compatible(m_bitmapCompatible);