mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 20:40:41 +08:00
Added small axis marker on the center of rotation when rotating or translating.
This commit is contained in:
parent
8910b4970a
commit
d7edc08287
@ -46,6 +46,7 @@ use constant GROUND_Z => -0.02;
|
|||||||
use constant DEFAULT_COLOR => [1,1,0];
|
use constant DEFAULT_COLOR => [1,1,0];
|
||||||
use constant SELECTED_COLOR => [0,1,0,1];
|
use constant SELECTED_COLOR => [0,1,0,1];
|
||||||
use constant HOVER_COLOR => [0.4,0.9,0,1];
|
use constant HOVER_COLOR => [0.4,0.9,0,1];
|
||||||
|
use constant PI => 3.1415927;
|
||||||
|
|
||||||
# make OpenGL::Array thread-safe
|
# make OpenGL::Array thread-safe
|
||||||
{
|
{
|
||||||
@ -833,11 +834,46 @@ sub Render {
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined $self->_drag_start_pos || defined $self->_drag_start_xy) {
|
||||||
|
$self->draw_center_of_rotation($self->_camera_target->x, $self->_camera_target->y, $self->_camera_target->z);
|
||||||
|
}
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
$self->SwapBuffers();
|
$self->SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub draw_axes {
|
||||||
|
my ($self, $x, $y, $z, $length, $width, $allways_visible) = @_;
|
||||||
|
if ($allways_visible) {
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
} else {
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
glLineWidth($width);
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
# draw line for x axis
|
||||||
|
glColor3f(1, 0, 0);
|
||||||
|
glVertex3f($x, $y, $z);
|
||||||
|
glVertex3f($x + $length, $y, $z);
|
||||||
|
# draw line for y axis
|
||||||
|
glColor3f(0, 1, 0);
|
||||||
|
glVertex3f($x, $y, $z);
|
||||||
|
glVertex3f($x, $y + $length, $z);
|
||||||
|
# draw line for Z axis
|
||||||
|
glColor3f(0, 0, 1);
|
||||||
|
glVertex3f($x, $y, $z);
|
||||||
|
glVertex3f($x, $y, $z + $length);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub draw_center_of_rotation {
|
||||||
|
my ($self, $x, $y, $z) = @_;
|
||||||
|
|
||||||
|
$self->draw_axes($x, $y, $z, 10, 1, 1);
|
||||||
|
$self->draw_axes($x, $y, $z, 10, 4, 0);
|
||||||
|
}
|
||||||
|
|
||||||
sub draw_volumes {
|
sub draw_volumes {
|
||||||
my ($self, $fakecolor) = @_;
|
my ($self, $fakecolor) = @_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user