mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-19 09:08:57 +08:00
Gradient background for 3D view
This commit is contained in:
parent
504cbd89db
commit
510b472b51
@ -28,6 +28,7 @@ __PACKAGE__->mk_accessors( qw(_quat _dirty init
|
|||||||
bed_shape
|
bed_shape
|
||||||
bed_triangles
|
bed_triangles
|
||||||
bed_grid_lines
|
bed_grid_lines
|
||||||
|
background
|
||||||
origin
|
origin
|
||||||
_mouse_pos
|
_mouse_pos
|
||||||
_hover_volume_idx
|
_hover_volume_idx
|
||||||
@ -60,6 +61,7 @@ sub new {
|
|||||||
my $self = $class->SUPER::new($parent, -1, Wx::wxDefaultPosition, Wx::wxDefaultSize, 0, "",
|
my $self = $class->SUPER::new($parent, -1, Wx::wxDefaultPosition, Wx::wxDefaultSize, 0, "",
|
||||||
[WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0]);
|
[WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0]);
|
||||||
|
|
||||||
|
$self->background(1);
|
||||||
$self->_quat((0, 0, 0, 1));
|
$self->_quat((0, 0, 0, 1));
|
||||||
$self->_stheta(45);
|
$self->_stheta(45);
|
||||||
$self->_sphi(45);
|
$self->_sphi(45);
|
||||||
@ -580,7 +582,7 @@ sub Resize {
|
|||||||
|
|
||||||
return unless $self->GetContext;
|
return unless $self->GetContext;
|
||||||
$self->_dirty(0);
|
$self->_dirty(0);
|
||||||
|
|
||||||
$self->SetCurrent($self->GetContext);
|
$self->SetCurrent($self->GetContext);
|
||||||
glViewport(0, 0, $x, $y);
|
glViewport(0, 0, $x, $y);
|
||||||
|
|
||||||
@ -693,6 +695,30 @@ sub Render {
|
|||||||
glFinish();
|
glFinish();
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# draw fixed background
|
||||||
|
if ($self->background) {
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glColor3f(0.0,0.0,0.0);
|
||||||
|
glVertex2f(-1.0,-1.0);
|
||||||
|
glVertex2f(1,-1.0);
|
||||||
|
glColor3f(10/255,98/255,144/255);
|
||||||
|
glVertex2f(1, 1);
|
||||||
|
glVertex2f(-1.0, 1);
|
||||||
|
glEnd();
|
||||||
|
glPopMatrix();
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
# draw objects
|
# draw objects
|
||||||
$self->draw_volumes;
|
$self->draw_volumes;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user