mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Introduction of classes ColorRGB and ColorRGBA to unify color data definition and manipulation
(cherry picked from commit prusa3d/PrusaSlicer@d0bff2d996 )
This commit is contained in:
parent
36ffb18059
commit
28d0147d09
60 changed files with 1290 additions and 1174 deletions
|
@ -26,9 +26,11 @@
|
|||
#endif
|
||||
|
||||
static const float GROUND_Z = -0.04f;
|
||||
static const std::array<float, 4> DEFAULT_MODEL_COLOR = { 0.3255f, 0.337f, 0.337f, 1.0f };
|
||||
static const std::array<float, 4> DEFAULT_MODEL_COLOR_DARK = { 0.255f, 0.255f, 0.283f, 1.0f };
|
||||
static const std::array<float, 4> PICKING_MODEL_COLOR = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
static const Slic3r::ColorRGBA DEFAULT_MODEL_COLOR = { 0.3255f, 0.337f, 0.337f, 1.0f };
|
||||
static const Slic3r::ColorRGBA DEFAULT_MODEL_COLOR_DARK = { 0.255f, 0.255f, 0.283f, 1.0f };
|
||||
static const Slic3r::ColorRGBA PICKING_MODEL_COLOR = Slic3r::ColorRGBA::BLACK();
|
||||
static const Slic3r::ColorRGBA DEFAULT_SOLID_GRID_COLOR = { 0.9f, 0.9f, 0.9f, 1.0f };
|
||||
static const Slic3r::ColorRGBA DEFAULT_TRANSPARENT_GRID_COLOR = { 0.9f, 0.9f, 0.9f, 0.6f };
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
@ -137,22 +139,22 @@ const float Bed3D::Axes::DefaultStemLength = 25.0f;
|
|||
const float Bed3D::Axes::DefaultTipRadius = 2.5f * Bed3D::Axes::DefaultStemRadius;
|
||||
const float Bed3D::Axes::DefaultTipLength = 5.0f;
|
||||
|
||||
std::array<float, 4> Bed3D::AXIS_X_COLOR = decode_color_to_float_array("#FF0000");
|
||||
std::array<float, 4> Bed3D::AXIS_Y_COLOR = decode_color_to_float_array("#00FF00");
|
||||
std::array<float, 4> Bed3D::AXIS_Z_COLOR = decode_color_to_float_array("#0000FF");
|
||||
ColorRGBA Bed3D::AXIS_X_COLOR = ColorRGBA::X();
|
||||
ColorRGBA Bed3D::AXIS_Y_COLOR = ColorRGBA::Y();
|
||||
ColorRGBA Bed3D::AXIS_Z_COLOR = ColorRGBA::Z();
|
||||
|
||||
void Bed3D::update_render_colors()
|
||||
{
|
||||
Bed3D::AXIS_X_COLOR = GLColor(RenderColor::colors[RenderCol_Axis_X]);
|
||||
Bed3D::AXIS_Y_COLOR = GLColor(RenderColor::colors[RenderCol_Axis_Y]);
|
||||
Bed3D::AXIS_Z_COLOR = GLColor(RenderColor::colors[RenderCol_Axis_Z]);
|
||||
Bed3D::AXIS_X_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Axis_X]);
|
||||
Bed3D::AXIS_Y_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Axis_Y]);
|
||||
Bed3D::AXIS_Z_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Axis_Z]);
|
||||
}
|
||||
|
||||
void Bed3D::load_render_colors()
|
||||
{
|
||||
RenderColor::colors[RenderCol_Axis_X] = IMColor(Bed3D::AXIS_X_COLOR);
|
||||
RenderColor::colors[RenderCol_Axis_Y] = IMColor(Bed3D::AXIS_Y_COLOR);
|
||||
RenderColor::colors[RenderCol_Axis_Z] = IMColor(Bed3D::AXIS_Z_COLOR);
|
||||
RenderColor::colors[RenderCol_Axis_X] = ImGuiWrapper::to_ImVec4(Bed3D::AXIS_X_COLOR);
|
||||
RenderColor::colors[RenderCol_Axis_Y] = ImGuiWrapper::to_ImVec4(Bed3D::AXIS_Y_COLOR);
|
||||
RenderColor::colors[RenderCol_Axis_Z] = ImGuiWrapper::to_ImVec4(Bed3D::AXIS_Z_COLOR);
|
||||
}
|
||||
|
||||
void Bed3D::Axes::render() const
|
||||
|
@ -724,10 +726,7 @@ void Bed3D::render_default(bool bottom) const
|
|||
/*if (!picking) {
|
||||
// draw grid
|
||||
glsafe(::glLineWidth(1.5f * m_scale_factor));
|
||||
if (has_model && !bottom)
|
||||
glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 1.0f));
|
||||
else
|
||||
glsafe(::glColor4f(0.9f, 0.9f, 0.9f, 0.6f));
|
||||
glsafe(::glColor4fv(has_model && !bottom ? DEFAULT_SOLID_GRID_COLOR.data() : DEFAULT_TRANSPARENT_GRID_COLOR.data()));
|
||||
glsafe(::glVertexPointer(3, GL_FLOAT, default_triangles.get_vertex_data_size(), (GLvoid*)m_gridlines.get_vertices_data()));
|
||||
glsafe(::glDrawArrays(GL_LINES, 0, (GLsizei)m_gridlines.get_vertices_count()));
|
||||
}*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue