Fix color issues

This commit is contained in:
Benjamin Landers 2018-06-22 23:02:21 -07:00
parent f352d433bc
commit 7362e56578
2 changed files with 15 additions and 14 deletions

View File

@ -7,7 +7,7 @@ class DefaultColor : public ColorScheme {
public:
const std::string name() const { return "Default"; }
const bool SOLID_BACKGROUNDCOLOR() const { return false; };
const wxColour SELECTED_COLOR() const { return wxColour(0, 1, 0); };
const wxColour SELECTED_COLOR() const { return wxColour(0, 255, 0); };
const wxColour HOVER_COLOR() const { return wxColour(255*0.4, 255*0.9, 0); }; //<Hover over Model
const wxColour TOP_COLOR() const { return wxColour(10,98,144); }; //<TOP Backgroud color
const wxColour BOTTOM_COLOR() const { return wxColour(0,0,0); }; //<BOTTOM Backgroud color
@ -15,10 +15,10 @@ public:
const wxColour GRID_COLOR() const { return wxColour(255*0.2, 255*0.2, 255*0.2, 255*0.4); }; //<Grid color
const wxColour GROUND_COLOR() const { return wxColour(255*0.8, 255*0.6, 255*0.5, 255*0.4); }; //<Ground or Plate color
const wxColour COLOR_CUTPLANE() const { return wxColour(255*0.8, 255*0.8, 255*0.8, 255*0.5); };
const wxColour COLOR_PARTS() const { return wxColour(1, 255*0.95, 255*0.2, 1); }; //<Perimeter color
const wxColour COLOR_INFILL() const { return wxColour(1, 255*0.45, 255*0.45, 1); };
const wxColour COLOR_SUPPORT() const { return wxColour(255*0.5, 1, 255*0.5, 1); };
const wxColour COLOR_UNKNOWN() const { return wxColour(255*0.5, 255*0.5, 1, 1); };
const wxColour COLOR_PARTS() const { return wxColour(255, 255*0.95, 255*0.2); }; //<Perimeter color
const wxColour COLOR_INFILL() const { return wxColour(255, 255*0.45, 255*0.45); };
const wxColour COLOR_SUPPORT() const { return wxColour(255*0.5, 1, 255*0.5); };
const wxColour COLOR_UNKNOWN() const { return wxColour(255*0.5, 255*0.5, 1); };
const wxColour BED_COLOR() const { return wxColour(255, 255, 255); };
const wxColour BED_GRID() const { return wxColour(230, 230, 230); };
const wxColour BED_SELECTED() const { return wxColour(255, 166, 128); };

View File

@ -46,7 +46,7 @@ void Plate3D::update(){
}
}
}
color_volumes();
}
void Plate3D::color_volumes(){
@ -59,8 +59,9 @@ void Plate3D::color_volumes(){
if(object.selected){
rendervolume.color = ui_settings->color->SELECTED_COLOR();
}else{
rendervolume.color = wxColor(255,255,0);//ui_settings->color->COLOR_PARTS(); <- invisible because alpha is 1 (out of 255)
rendervolume.color = ui_settings->color->COLOR_PARTS();
}
i++;
}
}
}
@ -74,7 +75,7 @@ void Plate3D::before_render(){
//glDisable(GL_MULTISAMPLE) if ($self->{can_multisample});
glDisable(GL_LIGHTING);
uint i = 0;
uint i = 1;
for(Volume &volume : volumes){
volume.color = wxColor((i>>16)&0xFF,(i>>8)&0xFF,i&0xFF);
i++;
@ -82,16 +83,16 @@ void Plate3D::before_render(){
draw_volumes();
glFlush();
glFinish();
GLubyte color[4] = {0,0,0,0};
glReadPixels(pos.x, /*offset*/GetSize().GetHeight()- pos.y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
GLubyte color[4] = {0,0,0,0};
glReadPixels(pos.x, GetSize().GetHeight()- pos.y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
uint index = color[0] + (color[1]<<8) + (color[2]<<16);
uint index = (color[0]<<16) + (color[1]<<8) + color[2];
hover = false;
///*$self->_hover_volume_idx(undef);
//$_->hover(0) for @{$self->volumes};
if (index < volumes.size()) {
if (index != 0 && index <= volumes.size()) {
hover = true;
hover_volume = index;
hover_volume = index - 1;
/*
$self->volumes->[$volume_idx]->hover(1);
my $group_id = $self->volumes->[$volume_idx]->select_group_id;
@ -105,7 +106,7 @@ void Plate3D::before_render(){
glFlush();
glFinish();
glEnable(GL_LIGHTING);
color_volumes();
color_volumes();
mouse = false;
}