mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 20:28:08 -06:00
Initial work for a GUI for the cut feature
This commit is contained in:
parent
334bc4c581
commit
882a98ed44
6 changed files with 215 additions and 10 deletions
|
@ -14,7 +14,9 @@ use Wx::GLCanvas qw(:all);
|
|||
__PACKAGE__->mk_accessors( qw(quat dirty init mview_init
|
||||
object_bounding_box object_shift
|
||||
volumes initpos
|
||||
sphi stheta) );
|
||||
sphi stheta
|
||||
cutting_plane_z
|
||||
) );
|
||||
|
||||
use constant TRACKBALLSIZE => 0.8;
|
||||
use constant TURNTABLE_MODE => 1;
|
||||
|
@ -114,6 +116,11 @@ sub load_object {
|
|||
}
|
||||
}
|
||||
|
||||
sub SetCuttingPlane {
|
||||
my ($self, $z) = @_;
|
||||
$self->cutting_plane_z($z);
|
||||
}
|
||||
|
||||
# Given an axis and angle, compute quaternion.
|
||||
sub axis_to_quat {
|
||||
my ($ax, $phi) = @_;
|
||||
|
@ -440,6 +447,23 @@ sub Render {
|
|||
glVertex3f($axis_len, $y, $ground_z);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
# draw cutting plane
|
||||
if (defined $self->cutting_plane_z) {
|
||||
my $plane_z = $z0 + $self->cutting_plane_z;
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBegin(GL_QUADS);
|
||||
glColor4f(1, 0.8, 0.8, 0.5);
|
||||
glVertex3f(-$axis_len, -$axis_len, $plane_z);
|
||||
glVertex3f($axis_len, -$axis_len, $plane_z);
|
||||
glVertex3f($axis_len, $axis_len, $plane_z);
|
||||
glVertex3f(-$axis_len, $axis_len, $plane_z);
|
||||
glEnd();
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue