mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 22:54:08 -06:00
Merge remote-tracking branch 'origin/scene_manipulators'
This commit is contained in:
commit
00324a14b8
5 changed files with 43 additions and 9 deletions
|
@ -1316,12 +1316,18 @@ sub Render {
|
|||
$self->mark_volumes_for_layer_height;
|
||||
$self->volumes->set_print_box($self->bed_bounding_box->x_min, $self->bed_bounding_box->y_min, 0.0, $self->bed_bounding_box->x_max, $self->bed_bounding_box->y_max, $self->{config}->get('max_print_height'));
|
||||
$self->volumes->update_outside_state($self->{config}, 0);
|
||||
# do not cull backfaces to show broken geometry, if any
|
||||
glDisable(GL_CULL_FACE);
|
||||
}
|
||||
$self->{plain_shader}->enable if $self->{plain_shader};
|
||||
$self->volumes->render_VBOs;
|
||||
$self->{plain_shader}->disable;
|
||||
glEnable(GL_CULL_FACE) if ($self->enable_picking);
|
||||
} else {
|
||||
# do not cull backfaces to show broken geometry, if any
|
||||
glDisable(GL_CULL_FACE) if ($self->enable_picking);
|
||||
$self->volumes->render_legacy;
|
||||
glEnable(GL_CULL_FACE) if ($self->enable_picking);
|
||||
}
|
||||
|
||||
# draw cutting plane
|
||||
|
@ -1358,6 +1364,9 @@ sub draw_volumes {
|
|||
# $fakecolor is a boolean indicating, that the objects shall be rendered in a color coding the object index for picking.
|
||||
my ($self, $fakecolor) = @_;
|
||||
|
||||
# do not cull backfaces to show broken geometry, if any
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
@ -1385,6 +1394,8 @@ sub draw_volumes {
|
|||
}
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
if (defined $self->cutting_plane_z) {
|
||||
glLineWidth(2);
|
||||
|
@ -1812,6 +1823,7 @@ sub _fragment_shader_Gouraud {
|
|||
return <<'FRAGMENT';
|
||||
#version 110
|
||||
|
||||
const vec4 OUTSIDE_COLOR = vec4(0.24, 0.42, 0.62, 1.0);
|
||||
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
// x = tainted, y = specular;
|
||||
|
@ -1824,13 +1836,11 @@ uniform vec4 uniform_color;
|
|||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(intensity.y, intensity.y, intensity.y, 0.0) + uniform_color * intensity.x;
|
||||
// if the fragment is outside the print volume use predefined color
|
||||
vec4 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? OUTSIDE_COLOR : uniform_color;
|
||||
|
||||
// if the fragment is outside the print volume darken it and set it as transparent
|
||||
if (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO)))
|
||||
gl_FragColor = vec4(mix(gl_FragColor.xyz, ZERO, 0.5), 0.5 * uniform_color.a);
|
||||
else
|
||||
gl_FragColor.a = uniform_color.a;
|
||||
gl_FragColor = vec4(intensity.y, intensity.y, intensity.y, 0.0) + color * intensity.x;
|
||||
gl_FragColor.a = color.a;
|
||||
}
|
||||
|
||||
FRAGMENT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue