Tech ENABLE_COLOR_CLASSES - 1st installment -> Introduction of classes ColorRGB and ColorRGBA to unify color data definition and manipulation
This commit is contained in:
parent
48098fbaff
commit
cd4094743e
53 changed files with 1810 additions and 60 deletions
|
@ -24,7 +24,13 @@
|
|||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#if ENABLE_COLOR_CLASSES
|
||||
static const Slic3r::ColorRGBA UNIFORM_SCALE_COLOR = Slic3r::ColorRGBA::ORANGE();
|
||||
static const Slic3r::ColorRGBA SOLID_PLANE_COLOR = Slic3r::ColorRGBA::ORANGE();
|
||||
static const Slic3r::ColorRGBA TRANSPARENT_PLANE_COLOR = { 0.8f, 0.8f, 0.8f, 0.5f };
|
||||
#else
|
||||
static const std::array<float, 4> UNIFORM_SCALE_COLOR = { 0.923f, 0.504f, 0.264f, 1.0f };
|
||||
#endif // ENABLE_COLOR_CLASSES
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
@ -453,11 +459,15 @@ void Selection::clear()
|
|||
for (unsigned int i : m_list) {
|
||||
GLVolume& volume = *(*m_volumes)[i];
|
||||
volume.selected = false;
|
||||
bool transparent = volume.color[3] < 1.0f;
|
||||
if (transparent)
|
||||
#if ENABLE_COLOR_CLASSES
|
||||
bool is_transparent = volume.color.is_transparent();
|
||||
#else
|
||||
bool is_transparent = volume.color[3] < 1.0f;
|
||||
#endif // ENABLE_COLOR_CLASSES
|
||||
if (is_transparent)
|
||||
volume.force_transparent = true;
|
||||
volume.set_render_color();
|
||||
if (transparent)
|
||||
if (is_transparent)
|
||||
volume.force_transparent = false;
|
||||
}
|
||||
#else
|
||||
|
@ -1919,10 +1929,17 @@ void Selection::render_bounding_box(const BoundingBoxf3& box, float* color) cons
|
|||
glsafe(::glEnd());
|
||||
}
|
||||
|
||||
#if ENABLE_COLOR_CLASSES
|
||||
static ColorRGBA get_color(Axis axis)
|
||||
{
|
||||
return AXES_COLOR[axis];
|
||||
};
|
||||
#else
|
||||
static std::array<float, 4> get_color(Axis axis)
|
||||
{
|
||||
return { AXES_COLOR[axis][0], AXES_COLOR[axis][1], AXES_COLOR[axis][2], AXES_COLOR[axis][3] };
|
||||
};
|
||||
#endif // ENABLE_COLOR_CLASSES
|
||||
|
||||
void Selection::render_sidebar_position_hints(const std::string& sidebar_field) const
|
||||
{
|
||||
|
@ -2052,10 +2069,15 @@ void Selection::render_sidebar_layers_hints(const std::string& sidebar_field) co
|
|||
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
|
||||
|
||||
::glBegin(GL_QUADS);
|
||||
#if ENABLE_COLOR_CLASSES
|
||||
::glColor4fv((camera_on_top && type == 1) || (!camera_on_top && type == 2) ?
|
||||
SOLID_PLANE_COLOR.data() : TRANSPARENT_PLANE_COLOR.data());
|
||||
#else
|
||||
if ((camera_on_top && type == 1) || (!camera_on_top && type == 2))
|
||||
::glColor4f(1.0f, 0.38f, 0.0f, 1.0f);
|
||||
else
|
||||
::glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
|
||||
#endif // ENABLE_COLOR_CLASSES
|
||||
::glVertex3f(min_x, min_y, z1);
|
||||
::glVertex3f(max_x, min_y, z1);
|
||||
::glVertex3f(max_x, max_y, z1);
|
||||
|
@ -2063,10 +2085,15 @@ void Selection::render_sidebar_layers_hints(const std::string& sidebar_field) co
|
|||
glsafe(::glEnd());
|
||||
|
||||
::glBegin(GL_QUADS);
|
||||
#if ENABLE_COLOR_CLASSES
|
||||
::glColor4fv((camera_on_top && type == 2) || (!camera_on_top && type == 1) ?
|
||||
SOLID_PLANE_COLOR.data() : TRANSPARENT_PLANE_COLOR.data());
|
||||
#else
|
||||
if ((camera_on_top && type == 2) || (!camera_on_top && type == 1))
|
||||
::glColor4f(1.0f, 0.38f, 0.0f, 1.0f);
|
||||
else
|
||||
::glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
|
||||
#endif // ENABLE_COLOR_CLASSES
|
||||
::glVertex3f(min_x, min_y, z2);
|
||||
::glVertex3f(max_x, min_y, z2);
|
||||
::glVertex3f(max_x, max_y, z2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue