mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 11:17:51 -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
|
@ -28,8 +28,6 @@ const float UndefFloat = -999.f;
|
|||
|
||||
// connector colors
|
||||
|
||||
using ColorRGBA = std::array<float, 4>;
|
||||
|
||||
static const ColorRGBA BLACK() { return {0.0f, 0.0f, 0.0f, 1.0f}; }
|
||||
static const ColorRGBA BLUE() { return {0.0f, 0.0f, 1.0f, 1.0f}; }
|
||||
static const ColorRGBA BLUEISH() { return {0.5f, 0.5f, 1.0f, 1.0f}; }
|
||||
|
@ -103,8 +101,8 @@ static void rotate_z_3d(std::array<Vec3d, 4>& verts, float radian_angle)
|
|||
|
||||
const double GLGizmoAdvancedCut::Offset = 10.0;
|
||||
const double GLGizmoAdvancedCut::Margin = 20.0;
|
||||
const std::array<float, 4> GLGizmoAdvancedCut::GrabberColor = { 1.0, 1.0, 0.0, 1.0 };
|
||||
const std::array<float, 4> GLGizmoAdvancedCut::GrabberHoverColor = { 0.7, 0.7, 0.0, 1.0};
|
||||
const ColorRGBA GLGizmoAdvancedCut::GrabberColor = { 1.0f, 1.0f, 0.0f, 1.0f };
|
||||
const ColorRGBA GLGizmoAdvancedCut::GrabberHoverColor = { 0.7f, 0.7f, 0.0f, 1.0f };
|
||||
|
||||
GLGizmoAdvancedCut::GLGizmoAdvancedCut(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||
: GLGizmoRotate3D(parent, icon_filename, sprite_id, nullptr)
|
||||
|
@ -525,11 +523,7 @@ void GLGizmoAdvancedCut::on_render_for_picking()
|
|||
float mean_size = (float)((box.size().x() + box.size().y() + box.size().z()) / 3.0);
|
||||
#endif
|
||||
|
||||
std::array<float, 4> color = picking_color_component(0);
|
||||
m_move_grabber.color[0] = color[0];
|
||||
m_move_grabber.color[1] = color[1];
|
||||
m_move_grabber.color[2] = color[2];
|
||||
m_move_grabber.color[3] = color[3];
|
||||
m_move_grabber.color = picking_color_component(0);
|
||||
m_move_grabber.render_for_picking(mean_size);
|
||||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
|
@ -564,7 +558,7 @@ void GLGizmoAdvancedCut::on_render_for_picking()
|
|||
const Transform3d view_model_matrix = translate_tf * m_rotate_matrix * scale_tf;
|
||||
|
||||
|
||||
std::array<float, 4> color = picking_color_component(i+1);
|
||||
ColorRGBA color = picking_color_component(i+1);
|
||||
render_connector_model(m_shapes[connectors[i].attribs], color, view_model_matrix, true);
|
||||
}
|
||||
}
|
||||
|
@ -919,7 +913,7 @@ void GLGizmoAdvancedCut::render_cut_plane_and_grabbers()
|
|||
// m_move_grabber.hover_color = GrabberHoverColor;
|
||||
// m_move_grabber.render(m_hover_id == get_group_id(), (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0));
|
||||
bool hover = (m_hover_id == get_group_id());
|
||||
std::array<float, 4> render_color;
|
||||
ColorRGBA render_color;
|
||||
if (hover) {
|
||||
render_color = GrabberHoverColor;
|
||||
}
|
||||
|
@ -1036,7 +1030,7 @@ void GLGizmoAdvancedCut::render_cut_line()
|
|||
glDisable(GL_LINE_STIPPLE);
|
||||
}
|
||||
|
||||
void GLGizmoAdvancedCut::render_connector_model(GLModel &model, const std::array<float, 4> &color, Transform3d view_model_matrix, bool for_picking)
|
||||
void GLGizmoAdvancedCut::render_connector_model(GLModel &model, const ColorRGBA &color, Transform3d view_model_matrix, bool for_picking)
|
||||
{
|
||||
glPushMatrix();
|
||||
GLShaderProgram *shader = nullptr;
|
||||
|
|
|
@ -27,8 +27,8 @@ struct Rotate_data {
|
|||
private:
|
||||
static const double Offset;
|
||||
static const double Margin;
|
||||
static const std::array<float, 4> GrabberColor;
|
||||
static const std::array<float, 4> GrabberHoverColor;
|
||||
static const ColorRGBA GrabberColor;
|
||||
static const ColorRGBA GrabberHoverColor;
|
||||
|
||||
mutable double m_movement;
|
||||
mutable double m_height; // height of cut plane to heatbed
|
||||
|
@ -201,7 +201,7 @@ private:
|
|||
void render_connectors();
|
||||
void render_clipper_cut();
|
||||
void render_cut_line();
|
||||
void render_connector_model(GLModel &model, const std::array<float, 4>& color, Transform3d view_model_matrix, bool for_picking = false);
|
||||
void render_connector_model(GLModel &model, const ColorRGBA& color, Transform3d view_model_matrix, bool for_picking = false);
|
||||
|
||||
void clear_selection();
|
||||
void init_connector_shapes();
|
||||
|
|
|
@ -21,51 +21,51 @@ const float GLGizmoBase::Grabber::FixedGrabberSize = 16.0f;
|
|||
const float GLGizmoBase::Grabber::FixedRadiusSize = 80.0f;
|
||||
|
||||
|
||||
std::array<float, 4> GLGizmoBase::DEFAULT_BASE_COLOR = { 0.625f, 0.625f, 0.625f, 1.0f };
|
||||
std::array<float, 4> GLGizmoBase::DEFAULT_DRAG_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
std::array<float, 4> GLGizmoBase::DEFAULT_HIGHLIGHT_COLOR = { 1.0f, 0.38f, 0.0f, 1.0f };
|
||||
std::array<std::array<float, 4>, 3> GLGizmoBase::AXES_HOVER_COLOR = {{
|
||||
ColorRGBA GLGizmoBase::DEFAULT_BASE_COLOR = { 0.625f, 0.625f, 0.625f, 1.0f };
|
||||
ColorRGBA GLGizmoBase::DEFAULT_DRAG_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
ColorRGBA GLGizmoBase::DEFAULT_HIGHLIGHT_COLOR = {1.0f, 0.38f, 0.0f, 1.0f};
|
||||
std::array<ColorRGBA, 3> GLGizmoBase::AXES_HOVER_COLOR = {{
|
||||
{ 0.7f, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.0f, 0.7f, 0.0f, 1.0f },
|
||||
{ 0.0f, 0.0f, 0.7f, 1.0f }
|
||||
}};
|
||||
|
||||
std::array<std::array<float, 4>, 3> GLGizmoBase::AXES_COLOR = { {
|
||||
std::array<ColorRGBA, 3> GLGizmoBase::AXES_COLOR = {{
|
||||
{ 1.0, 0.0f, 0.0f, 1.0f },
|
||||
{ 0.0f, 1.0f, 0.0f, 1.0f },
|
||||
{ 0.0f, 0.0f, 1.0f, 1.0f }
|
||||
}};
|
||||
|
||||
std::array<float, 4> GLGizmoBase::CONSTRAINED_COLOR = { 0.5f, 0.5f, 0.5f, 1.0f };
|
||||
std::array<float, 4> GLGizmoBase::FLATTEN_COLOR = { 0.96f, 0.93f, 0.93f, 0.5f };
|
||||
std::array<float, 4> GLGizmoBase::FLATTEN_HOVER_COLOR = { 1.0f, 1.0f, 1.0f, 0.75f };
|
||||
ColorRGBA GLGizmoBase::CONSTRAINED_COLOR = {0.5f, 0.5f, 0.5f, 1.0f};
|
||||
ColorRGBA GLGizmoBase::FLATTEN_COLOR = {0.96f, 0.93f, 0.93f, 0.5f};
|
||||
ColorRGBA GLGizmoBase::FLATTEN_HOVER_COLOR = {1.0f, 1.0f, 1.0f, 0.75f};
|
||||
|
||||
// new style color
|
||||
std::array<float, 4> GLGizmoBase::GRABBER_NORMAL_COL = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
std::array<float, 4> GLGizmoBase::GRABBER_HOVER_COL = {0.863f, 0.125f, 0.063f, 1.0f};
|
||||
std::array<float, 4> GLGizmoBase::GRABBER_UNIFORM_COL = {0, 1.0, 1.0, 1.0f};
|
||||
std::array<float, 4> GLGizmoBase::GRABBER_UNIFORM_HOVER_COL = {0, 0.7, 0.7, 1.0f};
|
||||
ColorRGBA GLGizmoBase::GRABBER_NORMAL_COL = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
ColorRGBA GLGizmoBase::GRABBER_HOVER_COL = {0.863f, 0.125f, 0.063f, 1.0f};
|
||||
ColorRGBA GLGizmoBase::GRABBER_UNIFORM_COL = {0, 1.0, 1.0, 1.0f};
|
||||
ColorRGBA GLGizmoBase::GRABBER_UNIFORM_HOVER_COL = {0, 0.7, 0.7, 1.0f};
|
||||
|
||||
|
||||
void GLGizmoBase::update_render_colors()
|
||||
{
|
||||
GLGizmoBase::AXES_COLOR = { {
|
||||
GLColor(RenderColor::colors[RenderCol_Grabber_X]),
|
||||
GLColor(RenderColor::colors[RenderCol_Grabber_Y]),
|
||||
GLColor(RenderColor::colors[RenderCol_Grabber_Z])
|
||||
ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Grabber_X]),
|
||||
ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Grabber_Y]),
|
||||
ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Grabber_Z])
|
||||
} };
|
||||
|
||||
GLGizmoBase::FLATTEN_COLOR = GLColor(RenderColor::colors[RenderCol_Flatten_Plane]);
|
||||
GLGizmoBase::FLATTEN_HOVER_COLOR = GLColor(RenderColor::colors[RenderCol_Flatten_Plane_Hover]);
|
||||
GLGizmoBase::FLATTEN_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Flatten_Plane]);
|
||||
GLGizmoBase::FLATTEN_HOVER_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_Flatten_Plane_Hover]);
|
||||
}
|
||||
|
||||
void GLGizmoBase::load_render_colors()
|
||||
{
|
||||
RenderColor::colors[RenderCol_Grabber_X] = IMColor(GLGizmoBase::AXES_COLOR[0]);
|
||||
RenderColor::colors[RenderCol_Grabber_Y] = IMColor(GLGizmoBase::AXES_COLOR[1]);
|
||||
RenderColor::colors[RenderCol_Grabber_Z] = IMColor(GLGizmoBase::AXES_COLOR[2]);
|
||||
RenderColor::colors[RenderCol_Flatten_Plane] = IMColor(GLGizmoBase::FLATTEN_COLOR);
|
||||
RenderColor::colors[RenderCol_Flatten_Plane_Hover] = IMColor(GLGizmoBase::FLATTEN_HOVER_COLOR);
|
||||
RenderColor::colors[RenderCol_Grabber_X] = ImGuiWrapper::to_ImVec4(GLGizmoBase::AXES_COLOR[0]);
|
||||
RenderColor::colors[RenderCol_Grabber_Y] = ImGuiWrapper::to_ImVec4(GLGizmoBase::AXES_COLOR[1]);
|
||||
RenderColor::colors[RenderCol_Grabber_Z] = ImGuiWrapper::to_ImVec4(GLGizmoBase::AXES_COLOR[2]);
|
||||
RenderColor::colors[RenderCol_Flatten_Plane] = ImGuiWrapper::to_ImVec4(GLGizmoBase::FLATTEN_COLOR);
|
||||
RenderColor::colors[RenderCol_Flatten_Plane_Hover] = ImGuiWrapper::to_ImVec4(GLGizmoBase::FLATTEN_HOVER_COLOR);
|
||||
}
|
||||
|
||||
GLGizmoBase::Grabber::Grabber()
|
||||
|
@ -80,7 +80,7 @@ GLGizmoBase::Grabber::Grabber()
|
|||
|
||||
void GLGizmoBase::Grabber::render(bool hover, float size) const
|
||||
{
|
||||
std::array<float, 4> render_color;
|
||||
ColorRGBA render_color;
|
||||
if (hover) {
|
||||
render_color = hover_color;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ const GLModel& GLGizmoBase::Grabber::get_cube() const
|
|||
return cube;
|
||||
}
|
||||
|
||||
void GLGizmoBase::Grabber::render(float size, const std::array<float, 4>& render_color, bool picking) const
|
||||
void GLGizmoBase::Grabber::render(float size, const ColorRGBA& render_color, bool picking) const
|
||||
{
|
||||
if (! cube_initialized) {
|
||||
// This cannot be done in constructor, OpenGL is not yet
|
||||
|
@ -179,10 +179,6 @@ void GLGizmoBase::set_hover_id(int id)
|
|||
}
|
||||
}
|
||||
|
||||
void GLGizmoBase::set_highlight_color(const std::array<float, 4>& color)
|
||||
{
|
||||
m_highlight_color = color;
|
||||
}
|
||||
|
||||
void GLGizmoBase::enable_grabber(unsigned int id)
|
||||
{
|
||||
|
@ -265,22 +261,13 @@ void GLGizmoBase::GizmoImguiSetNextWIndowPos(float &x, float y, int flag, float
|
|||
m_imgui->set_next_window_pos(x, y, flag, pivot_x, pivot_y);
|
||||
}
|
||||
|
||||
std::array<float, 4> GLGizmoBase::picking_color_component(unsigned int id) const
|
||||
ColorRGBA GLGizmoBase::picking_color_component(unsigned int id) const
|
||||
{
|
||||
static const float INV_255 = 1.0f / 255.0f;
|
||||
|
||||
id = BASE_ID - id;
|
||||
|
||||
if (m_group_id > -1)
|
||||
id -= m_group_id;
|
||||
|
||||
// color components are encoded to match the calculation of volume_id made into GLCanvas3D::_picking_pass()
|
||||
return std::array<float, 4> {
|
||||
float((id >> 0) & 0xff) * INV_255, // red
|
||||
float((id >> 8) & 0xff) * INV_255, // green
|
||||
float((id >> 16) & 0xff) * INV_255, // blue
|
||||
float(picking_checksum_alpha_channel(id & 0xff, (id >> 8) & 0xff, (id >> 16) & 0xff))* INV_255 // checksum for validating against unwanted alpha blending and multi sampling
|
||||
};
|
||||
return picking_decode(id);
|
||||
}
|
||||
|
||||
void GLGizmoBase::render_grabbers(const BoundingBoxf3& box) const
|
||||
|
@ -316,8 +303,7 @@ void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
|
|||
|
||||
for (unsigned int i = 0; i < (unsigned int)m_grabbers.size(); ++i) {
|
||||
if (m_grabbers[i].enabled) {
|
||||
std::array<float, 4> color = picking_color_component(i);
|
||||
m_grabbers[i].color = color;
|
||||
m_grabbers[i].color = picking_color_component(i);
|
||||
m_grabbers[i].render_for_picking(mean_size);
|
||||
}
|
||||
}
|
||||
|
@ -354,23 +340,5 @@ std::string GLGizmoBase::get_name(bool include_shortcut) const
|
|||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Produce an alpha channel checksum for the red green blue components. The alpha channel may then be used to verify, whether the rgb components
|
||||
// were not interpolated by alpha blending or multi sampling.
|
||||
unsigned char picking_checksum_alpha_channel(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
// 8 bit hash for the color
|
||||
unsigned char b = ((((37 * red) + green) & 0x0ff) * 37 + blue) & 0x0ff;
|
||||
// Increase enthropy by a bit reversal
|
||||
b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
|
||||
b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
|
||||
b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
|
||||
// Flip every second bit to increase the enthropy even more.
|
||||
b ^= 0x55;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define slic3r_GLGizmoBase_hpp_
|
||||
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/Color.hpp"
|
||||
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/GLModel.hpp"
|
||||
|
@ -38,18 +39,18 @@ public:
|
|||
static float INV_ZOOM;
|
||||
|
||||
//BBS colors
|
||||
static std::array<float, 4> DEFAULT_BASE_COLOR;
|
||||
static std::array<float, 4> DEFAULT_DRAG_COLOR;
|
||||
static std::array<float, 4> DEFAULT_HIGHLIGHT_COLOR;
|
||||
static std::array<std::array<float, 4>, 3> AXES_COLOR;
|
||||
static std::array<std::array<float, 4>, 3> AXES_HOVER_COLOR;
|
||||
static std::array<float, 4> CONSTRAINED_COLOR;
|
||||
static std::array<float, 4> FLATTEN_COLOR;
|
||||
static std::array<float, 4> FLATTEN_HOVER_COLOR;
|
||||
static std::array<float, 4> GRABBER_NORMAL_COL;
|
||||
static std::array<float, 4> GRABBER_HOVER_COL;
|
||||
static std::array<float, 4> GRABBER_UNIFORM_COL;
|
||||
static std::array<float, 4> GRABBER_UNIFORM_HOVER_COL;
|
||||
static ColorRGBA DEFAULT_BASE_COLOR;
|
||||
static ColorRGBA DEFAULT_DRAG_COLOR;
|
||||
static ColorRGBA DEFAULT_HIGHLIGHT_COLOR;
|
||||
static std::array<ColorRGBA, 3> AXES_COLOR;
|
||||
static std::array<ColorRGBA, 3> AXES_HOVER_COLOR;
|
||||
static ColorRGBA CONSTRAINED_COLOR;
|
||||
static ColorRGBA FLATTEN_COLOR;
|
||||
static ColorRGBA FLATTEN_HOVER_COLOR;
|
||||
static ColorRGBA GRABBER_NORMAL_COL;
|
||||
static ColorRGBA GRABBER_HOVER_COL;
|
||||
static ColorRGBA GRABBER_UNIFORM_COL;
|
||||
static ColorRGBA GRABBER_UNIFORM_HOVER_COL;
|
||||
|
||||
static void update_render_colors();
|
||||
static void load_render_colors();
|
||||
|
@ -65,8 +66,8 @@ protected:
|
|||
|
||||
Vec3d center;
|
||||
Vec3d angles;
|
||||
std::array<float, 4> color;
|
||||
std::array<float, 4> hover_color;
|
||||
ColorRGBA color;
|
||||
ColorRGBA hover_color;
|
||||
bool enabled;
|
||||
bool dragging;
|
||||
|
||||
|
@ -80,7 +81,7 @@ protected:
|
|||
const GLModel& get_cube() const;
|
||||
|
||||
private:
|
||||
void render(float size, const std::array<float, 4>& render_color, bool picking) const;
|
||||
void render(float size, const ColorRGBA& render_color, bool picking) const;
|
||||
|
||||
GLModel cube;
|
||||
bool cube_initialized = false;
|
||||
|
@ -114,9 +115,9 @@ protected:
|
|||
unsigned int m_sprite_id;
|
||||
int m_hover_id;
|
||||
bool m_dragging;
|
||||
std::array<float, 4> m_base_color;
|
||||
std::array<float, 4> m_drag_color;
|
||||
std::array<float, 4> m_highlight_color;
|
||||
ColorRGBA m_base_color;
|
||||
ColorRGBA m_drag_color;
|
||||
ColorRGBA m_highlight_color;
|
||||
mutable std::vector<Grabber> m_grabbers;
|
||||
ImGuiWrapper* m_imgui;
|
||||
bool m_first_input_window_render;
|
||||
|
@ -169,7 +170,7 @@ public:
|
|||
int get_hover_id() const { return m_hover_id; }
|
||||
void set_hover_id(int id);
|
||||
|
||||
void set_highlight_color(const std::array<float, 4>& color);
|
||||
void set_highlight_color(const ColorRGBA& color) { m_highlight_color = color; }
|
||||
|
||||
void enable_grabber(unsigned int id);
|
||||
void disable_grabber(unsigned int id);
|
||||
|
@ -219,7 +220,7 @@ protected:
|
|||
void GizmoImguiSetNextWIndowPos(float &x, float y, int flag, float pivot_x = 0.0f, float pivot_y = 0.0f);
|
||||
// Returns the picking color for the given id, based on the BASE_ID constant
|
||||
// No check is made for clashing with other picking color (i.e. GLVolumes)
|
||||
std::array<float, 4> picking_color_component(unsigned int id) const;
|
||||
ColorRGBA picking_color_component(unsigned int id) const;
|
||||
void render_grabbers(const BoundingBoxf3& box) const;
|
||||
void render_grabbers(float size) const;
|
||||
void render_grabbers_for_picking(const BoundingBoxf3& box) const;
|
||||
|
@ -235,11 +236,6 @@ private:
|
|||
int count = 0;
|
||||
};
|
||||
|
||||
|
||||
// Produce an alpha channel checksum for the red green blue components. The alpha channel may then be used to verify, whether the rgb components
|
||||
// were not interpolated by alpha blending or multi sampling.
|
||||
extern unsigned char picking_checksum_alpha_channel(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace GUI {
|
|||
|
||||
const double GLGizmoCut::Offset = 10.0;
|
||||
const double GLGizmoCut::Margin = 20.0;
|
||||
const std::array<float, 4> GLGizmoCut::GrabberColor = { 1.0, 0.5, 0.0, 1.0 };
|
||||
static const ColorRGBA GRABBER_COLOR = ColorRGBA::ORANGE();
|
||||
static const ColorRGBA PLANE_COLOR = { 0.8f, 0.8f, 0.8f, 0.5f };
|
||||
|
||||
GLGizmoCut::GLGizmoCut(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||
: GLGizmoBase(parent, icon_filename, sprite_id)
|
||||
|
@ -103,7 +104,7 @@ void GLGizmoCut::on_render()
|
|||
|
||||
// Draw the cutting plane
|
||||
::glBegin(GL_QUADS);
|
||||
::glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
|
||||
::glColor4fv(PLANE_COLOR.data());
|
||||
::glVertex3f(min_x, min_y, plane_center.z());
|
||||
::glVertex3f(max_x, min_y, plane_center.z());
|
||||
::glVertex3f(max_x, max_y, plane_center.z());
|
||||
|
@ -134,7 +135,7 @@ void GLGizmoCut::on_render()
|
|||
shader->start_using();
|
||||
shader->set_uniform("emission_factor", 0.1f);
|
||||
|
||||
m_grabbers[0].color = GrabberColor;
|
||||
m_grabbers[0].color = GRABBER_COLOR;
|
||||
m_grabbers[0].render(m_hover_id == 0, (float)((box.size().x() + box.size().y() + box.size().z()) / 3.0));
|
||||
|
||||
shader->stop_using();
|
||||
|
|
|
@ -13,7 +13,6 @@ class GLGizmoCut : public GLGizmoBase
|
|||
{
|
||||
static const double Offset;
|
||||
static const double Margin;
|
||||
static const std::array<float, 4> GrabberColor;
|
||||
|
||||
double m_cut_z{ 0.0 };
|
||||
double m_max_z{ 0.0 };
|
||||
|
|
|
@ -640,7 +640,7 @@ void GLGizmoFdmSupports::update_from_model_object(bool first_update)
|
|||
m_volume_timestamps.clear();
|
||||
|
||||
int volume_id = -1;
|
||||
std::vector<std::array<float, 4>> ebt_colors;
|
||||
std::vector<ColorRGBA> ebt_colors;
|
||||
ebt_colors.push_back(GLVolume::NEUTRAL_COLOR);
|
||||
ebt_colors.push_back(TriangleSelectorGUI::enforcers_color);
|
||||
ebt_colors.push_back(TriangleSelectorGUI::blockers_color);
|
||||
|
|
|
@ -114,7 +114,7 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) cons
|
|||
glsafe(::glTranslated(0.0, 0.0, m_c->selection_info()->get_sla_shift()));
|
||||
glsafe(::glMultMatrixd(instance_matrix.data()));
|
||||
|
||||
std::array<float, 4> render_color;
|
||||
ColorRGBA render_color;
|
||||
const sla::DrainHoles& drain_holes = m_c->selection_info()->model_object()->sla_drain_holes;
|
||||
size_t cache_size = drain_holes.size();
|
||||
|
||||
|
@ -127,8 +127,7 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) cons
|
|||
|
||||
// First decide about the color of the point.
|
||||
if (picking) {
|
||||
std::array<float, 4> color = picking_color_component(i);
|
||||
render_color = color;
|
||||
render_color = picking_color_component(i);
|
||||
}
|
||||
else {
|
||||
if (size_t(m_hover_id) == i) {
|
||||
|
@ -140,11 +139,7 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) cons
|
|||
render_color = {1.f, 0.f, 0.f, .5f};
|
||||
}
|
||||
else { // neigher hover nor picking
|
||||
|
||||
render_color[0] = point_selected ? 1.0f : 1.f;
|
||||
render_color[1] = point_selected ? 0.3f : 1.f;
|
||||
render_color[2] = point_selected ? 0.3f : 1.f;
|
||||
render_color[3] = 0.5f;
|
||||
render_color = point_selected ? ColorRGBA(1.0f, 0.3f, 0.3f, 0.5f) : ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,14 +539,11 @@ RENDER_AGAIN:
|
|||
}
|
||||
|
||||
m_imgui->disabled_begin(! m_enable_hollowing);
|
||||
float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
|
||||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("offset"));
|
||||
ImGui::SameLine(settings_sliders_left, m_imgui->get_item_spacing().x);
|
||||
ImGui::PushItemWidth(window_width - settings_sliders_left);
|
||||
m_imgui->slider_float("##offset", &offset, offset_min, offset_max, "%.1f mm");
|
||||
if (m_imgui->get_last_slider_status().hovered)
|
||||
m_imgui->tooltip((_utf8(opts[0].second->tooltip)).c_str(), max_tooltip_width);
|
||||
m_imgui->slider_float("##offset", &offset, offset_min, offset_max, "%.1f mm", 1.0f, true, _L(opts[0].second->tooltip));
|
||||
|
||||
bool slider_clicked = m_imgui->get_last_slider_status().clicked; // someone clicked the slider
|
||||
bool slider_edited =m_imgui->get_last_slider_status().edited; // someone is dragging the slider
|
||||
|
@ -561,9 +553,7 @@ RENDER_AGAIN:
|
|||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("quality"));
|
||||
ImGui::SameLine(settings_sliders_left, m_imgui->get_item_spacing().x);
|
||||
m_imgui->slider_float("##quality", &quality, quality_min, quality_max, "%.1f");
|
||||
if (m_imgui->get_last_slider_status().hovered)
|
||||
m_imgui->tooltip((_utf8(opts[1].second->tooltip)).c_str(), max_tooltip_width);
|
||||
m_imgui->slider_float("##quality", &quality, quality_min, quality_max, "%.1f", 1.0f, true, _L(opts[1].second->tooltip));
|
||||
|
||||
slider_clicked |= m_imgui->get_last_slider_status().clicked;
|
||||
slider_edited |= m_imgui->get_last_slider_status().edited;
|
||||
|
@ -574,9 +564,7 @@ RENDER_AGAIN:
|
|||
ImGui::AlignTextToFramePadding();
|
||||
m_imgui->text(m_desc.at("closing_distance"));
|
||||
ImGui::SameLine(settings_sliders_left, m_imgui->get_item_spacing().x);
|
||||
m_imgui->slider_float("##closing_distance", &closing_d, closing_d_min, closing_d_max, "%.1f mm");
|
||||
if (m_imgui->get_last_slider_status().hovered)
|
||||
m_imgui->tooltip((_utf8(opts[2].second->tooltip)).c_str(), max_tooltip_width);
|
||||
m_imgui->slider_float("##closing_distance", &closing_d, closing_d_min, closing_d_max, "%.1f mm", 1.0f, true, _L(opts[2].second->tooltip));
|
||||
|
||||
slider_clicked |= m_imgui->get_last_slider_status().clicked;
|
||||
slider_edited |= m_imgui->get_last_slider_status().edited;
|
||||
|
|
|
@ -58,11 +58,11 @@ bool GLGizmoMmuSegmentation::on_is_activable() const
|
|||
}
|
||||
|
||||
//BBS: use the global one in 3DScene.cpp
|
||||
/*static std::vector<std::array<float, 4>> get_extruders_colors()
|
||||
/*static std::vector<ColorRGBA> get_extruders_colors()
|
||||
{
|
||||
unsigned char rgb_color[3] = {};
|
||||
std::vector<std::string> colors = Slic3r::GUI::wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||
std::vector<std::array<float, 4>> colors_out(colors.size());
|
||||
std::vector<ColorRGBA> colors_out(colors.size());
|
||||
for (const std::string &color : colors) {
|
||||
Slic3r::GUI::BitmapCache::parse_color(color, rgb_color);
|
||||
size_t color_idx = &color - &colors.front();
|
||||
|
@ -276,18 +276,14 @@ bool GLGizmoMmuSegmentation::on_key_down_select_tool_type(int keyCode) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static void render_extruders_combo(const std::string &label,
|
||||
const std::vector<std::string> &extruders,
|
||||
const std::vector<std::array<float, 4>> &extruders_colors,
|
||||
size_t &selection_idx)
|
||||
static void render_extruders_combo(const std::string& label,
|
||||
const std::vector<std::string>& extruders,
|
||||
const std::vector<ColorRGBA>& extruders_colors,
|
||||
size_t& selection_idx)
|
||||
{
|
||||
assert(!extruders_colors.empty());
|
||||
assert(extruders_colors.size() == extruders_colors.size());
|
||||
|
||||
auto convert_to_imu32 = [](const std::array<float, 4> &color) -> ImU32 {
|
||||
return IM_COL32(uint8_t(color[0] * 255.f), uint8_t(color[1] * 255.f), uint8_t(color[2] * 255.f), uint8_t(color[3] * 255.f));
|
||||
};
|
||||
|
||||
size_t selection_out = selection_idx;
|
||||
// It is necessary to use BeginGroup(). Otherwise, when using SameLine() is called, then other items will be drawn inside the combobox.
|
||||
ImGui::BeginGroup();
|
||||
|
@ -303,7 +299,7 @@ static void render_extruders_combo(const std::string &labe
|
|||
ImGui::SameLine();
|
||||
ImGuiStyle &style = ImGui::GetStyle();
|
||||
float height = ImGui::GetTextLineHeight();
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_position, ImVec2(start_position.x + height + height / 2, start_position.y + height), convert_to_imu32(extruders_colors[extruder_idx]));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_position, ImVec2(start_position.x + height + height / 2, start_position.y + height), ImGuiWrapper::to_ImU32(extruders_colors[extruder_idx]));
|
||||
ImGui::GetWindowDrawList()->AddRect(start_position, ImVec2(start_position.x + height + height / 2, start_position.y + height), IM_COL32_BLACK);
|
||||
|
||||
ImGui::SetCursorScreenPos(ImVec2(start_position.x + height + height / 2 + style.FramePadding.x, start_position.y));
|
||||
|
@ -321,7 +317,7 @@ static void render_extruders_combo(const std::string &labe
|
|||
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||
float height = ImGui::GetTextLineHeight();
|
||||
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + height + height / 2, p.y + height), convert_to_imu32(extruders_colors[selection_idx]));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + height + height / 2, p.y + height), ImGuiWrapper::to_ImU32(extruders_colors[selection_idx]));
|
||||
ImGui::GetWindowDrawList()->AddRect(p, ImVec2(p.x + height + height / 2, p.y + height), IM_COL32_BLACK);
|
||||
|
||||
ImGui::SetCursorScreenPos(ImVec2(p.x + height + height / 2 + style.FramePadding.x, p.y));
|
||||
|
@ -448,8 +444,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||
const float item_spacing = m_imgui->scaled(0.8f);
|
||||
size_t n_extruder_colors = std::min((size_t)EnforcerBlockerType::ExtruderMax, m_extruders_colors.size());
|
||||
for (int extruder_idx = 0; extruder_idx < n_extruder_colors; extruder_idx++) {
|
||||
const std::array<float, 4> &extruder_color = m_extruders_colors[extruder_idx];
|
||||
ImVec4 color_vec(extruder_color[0], extruder_color[1], extruder_color[2], extruder_color[3]);
|
||||
const ColorRGBA &extruder_color = m_extruders_colors[extruder_idx];
|
||||
ImVec4 color_vec = ImGuiWrapper::to_ImVec4(extruder_color);
|
||||
std::string color_label = std::string("##extruder color ") + std::to_string(extruder_idx);
|
||||
std::string item_text = std::to_string(extruder_idx + 1);
|
||||
const ImVec2 label_size = ImGui::CalcTextSize(item_text.c_str(), NULL, true);
|
||||
|
@ -486,7 +482,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||
if (extruder_idx < 9 && ImGui::IsItemHovered()) m_imgui->tooltip(_L("Shortcut Key ") + std::to_string(extruder_idx + 1), max_tooltip_width);
|
||||
|
||||
// draw filament id
|
||||
float gray = 0.299 * extruder_color[0] + 0.587 * extruder_color[1] + 0.114 * extruder_color[2];
|
||||
float gray = 0.299 * extruder_color.r() + 0.587 * extruder_color.g() + 0.114 * extruder_color.b();
|
||||
ImGui::SameLine(button_offset + (button_size.x - label_size.x) / 2.f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {10.0,15.0});
|
||||
if (gray * 255.f < 80.f)
|
||||
|
@ -811,7 +807,7 @@ void GLGizmoMmuSegmentation::init_model_triangle_selectors()
|
|||
continue;
|
||||
|
||||
int extruder_idx = (mv->extruder_id() > 0) ? mv->extruder_id() - 1 : 0;
|
||||
std::vector<std::array<float, 4>> ebt_colors;
|
||||
std::vector<ColorRGBA> ebt_colors;
|
||||
ebt_colors.push_back(m_extruders_colors[size_t(extruder_idx)]);
|
||||
ebt_colors.insert(ebt_colors.end(), m_extruders_colors.begin(), m_extruders_colors.end());
|
||||
|
||||
|
@ -833,7 +829,7 @@ void GLGizmoMmuSegmentation::update_triangle_selectors_colors()
|
|||
TriangleSelectorPatch* selector = dynamic_cast<TriangleSelectorPatch*>(m_triangle_selectors[i].get());
|
||||
int extruder_idx = m_volumes_extruder_idxs[i];
|
||||
int extruder_color_idx = std::max(0, extruder_idx - 1);
|
||||
std::vector<std::array<float, 4>> ebt_colors;
|
||||
std::vector<ColorRGBA> ebt_colors;
|
||||
ebt_colors.push_back(m_extruders_colors[extruder_color_idx]);
|
||||
ebt_colors.insert(ebt_colors.end(), m_extruders_colors.begin(), m_extruders_colors.end());
|
||||
selector->set_ebt_colors(ebt_colors);
|
||||
|
@ -871,7 +867,7 @@ PainterGizmoType GLGizmoMmuSegmentation::get_painter_type() const
|
|||
}
|
||||
|
||||
// BBS
|
||||
std::array<float, 4> GLGizmoMmuSegmentation::get_cursor_hover_color() const
|
||||
ColorRGBA GLGizmoMmuSegmentation::get_cursor_hover_color() const
|
||||
{
|
||||
if (m_selected_extruder_idx < m_extruders_colors.size())
|
||||
return m_extruders_colors[m_selected_extruder_idx];
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
protected:
|
||||
// BBS
|
||||
std::array<float, 4> get_cursor_hover_color() const override;
|
||||
ColorRGBA get_cursor_hover_color() const override;
|
||||
void on_set_state() override;
|
||||
|
||||
EnforcerBlockerType get_left_button_state_type() const override { return EnforcerBlockerType(m_selected_extruder_idx + 1); }
|
||||
|
@ -107,7 +107,7 @@ protected:
|
|||
|
||||
// BBS
|
||||
size_t m_selected_extruder_idx = 0;
|
||||
std::vector<std::array<float, 4>> m_extruders_colors;
|
||||
std::vector<ColorRGBA> m_extruders_colors;
|
||||
std::vector<int> m_volumes_extruder_idxs;
|
||||
|
||||
// BBS
|
||||
|
|
|
@ -170,7 +170,7 @@ void GLGizmoMove3D::on_render_for_picking()
|
|||
//get picking colors only
|
||||
for (unsigned int i = 0; i < (unsigned int) m_grabbers.size(); ++i) {
|
||||
if (m_grabbers[i].enabled) {
|
||||
std::array<float, 4> color = picking_color_component(i);
|
||||
ColorRGBA color = picking_color_component(i);
|
||||
m_grabbers[i].color = color;
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box
|
|||
|
||||
double size = 0.75 * GLGizmoBase::Grabber::FixedGrabberSize * GLGizmoBase::INV_ZOOM;
|
||||
|
||||
std::array<float, 4> color = m_grabbers[axis].color;
|
||||
ColorRGBA color = m_grabbers[axis].color;
|
||||
if (!picking && m_hover_id != -1) {
|
||||
if (m_hover_id == axis) {
|
||||
color = m_grabbers[axis].hover_color;
|
||||
|
|
|
@ -177,7 +177,7 @@ void GLGizmoPainterBase::render_cursor_circle() const
|
|||
glsafe(::glLineWidth(1.5f));
|
||||
|
||||
// BBS
|
||||
std::array<float, 4> render_color = this->get_cursor_hover_color();
|
||||
ColorRGBA render_color = this->get_cursor_hover_color();
|
||||
if (m_button_down == Button::Left)
|
||||
render_color = this->get_cursor_sphere_left_button_color();
|
||||
else if (m_button_down == Button::Right)
|
||||
|
@ -225,7 +225,7 @@ void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
|
|||
glFrontFace(GL_CW);
|
||||
|
||||
// BBS
|
||||
std::array<float, 4> render_color = this->get_cursor_hover_color();
|
||||
ColorRGBA render_color = this->get_cursor_hover_color();
|
||||
if (m_button_down == Button::Left)
|
||||
render_color = this->get_cursor_sphere_left_button_color();
|
||||
else if (m_button_down == Button::Right)
|
||||
|
@ -1002,13 +1002,16 @@ TriangleSelector::ClippingPlane GLGizmoPainterBase::get_clipping_plane_in_volume
|
|||
return TriangleSelector::ClippingPlane({float(normal_transformed.x()), float(normal_transformed.y()), float(normal_transformed.z()), offset_transformed});
|
||||
}
|
||||
|
||||
std::array<float, 4> TriangleSelectorGUI::get_seed_fill_color(const std::array<float, 4> &base_color)
|
||||
ColorRGBA TriangleSelectorGUI::enforcers_color = {0.5f, 1.f, 0.5f, 1.f};
|
||||
ColorRGBA TriangleSelectorGUI::blockers_color = {1.f, 0.5f, 0.5f, 1.f};
|
||||
|
||||
ColorRGBA TriangleSelectorGUI::get_seed_fill_color(const ColorRGBA& base_color)
|
||||
{
|
||||
// BBS
|
||||
return {
|
||||
base_color[0] * 1.25f < 1.f ? base_color[0] * 1.25f : 1.f,
|
||||
base_color[1] * 1.25f < 1.f ? base_color[1] * 1.25f : 1.f,
|
||||
base_color[2] * 1.25f < 1.f ? base_color[2] * 1.25f : 1.f,
|
||||
base_color.r() * 1.25f < 1.f ? base_color.r() * 1.25f : 1.f,
|
||||
base_color.g() * 1.25f < 1.f ? base_color.g() * 1.25f : 1.f,
|
||||
base_color.b() * 1.25f < 1.f ? base_color.b() * 1.25f : 1.f,
|
||||
1.f};
|
||||
}
|
||||
|
||||
|
@ -1036,7 +1039,7 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
|
|||
for (auto &iva : m_iva_seed_fills)
|
||||
if (iva.has_VBOs()) {
|
||||
size_t color_idx = &iva - &m_iva_seed_fills.front();
|
||||
const std::array<float, 4> &color = TriangleSelectorGUI::get_seed_fill_color(color_idx == 1 ? enforcers_color :
|
||||
const ColorRGBA& color = TriangleSelectorGUI::get_seed_fill_color(color_idx == 1 ? enforcers_color :
|
||||
color_idx == 2 ? blockers_color :
|
||||
GLVolume::NEUTRAL_COLOR);
|
||||
shader->set_uniform("uniform_color", color);
|
||||
|
@ -1166,18 +1169,18 @@ void TriangleSelectorPatch::render(ImGuiWrapper* imgui)
|
|||
for (size_t buffer_idx = 0; buffer_idx < m_triangle_patches.size(); ++buffer_idx) {
|
||||
if (this->has_VBOs(buffer_idx)) {
|
||||
const TrianglePatch& patch = m_triangle_patches[buffer_idx];
|
||||
std::array<float, 4> color;
|
||||
ColorRGBA color;
|
||||
if (patch.is_fragment() && !patch.neighbor_types.empty()) {
|
||||
size_t color_idx = (size_t)*patch.neighbor_types.begin();
|
||||
color = m_ebt_colors[color_idx];
|
||||
color[3] = 0.85;
|
||||
color.a(0.85);
|
||||
}
|
||||
else {
|
||||
size_t color_idx = (size_t)patch.type;
|
||||
color = m_ebt_colors[color_idx];
|
||||
}
|
||||
//to make black not too hard too see
|
||||
std::array<float, 4> new_color = adjust_color_for_rendering(color);
|
||||
ColorRGBA new_color = adjust_color_for_rendering(color);
|
||||
shader->set_uniform("uniform_color", new_color);
|
||||
//shader->set_uniform("uniform_color", color);
|
||||
//BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", buffer_idx %1%: new_color[%2%, %3%, %4%, %5%]")%buffer_idx%new_color[0]%new_color[1]%new_color[2]%new_color[3];
|
||||
|
|
|
@ -84,8 +84,8 @@ public:
|
|||
};
|
||||
|
||||
// BBS
|
||||
static constexpr std::array<float, 4> enforcers_color{ 0.5f, 1.f, 0.5f, 1.f };
|
||||
static constexpr std::array<float, 4> blockers_color{ 1.f, 0.5f, 0.5f, 1.f };
|
||||
static ColorRGBA enforcers_color;
|
||||
static ColorRGBA blockers_color;
|
||||
|
||||
#ifdef PRUSASLICER_TRIANGLE_SELECTOR_DEBUG
|
||||
void render_debug(ImGuiWrapper* imgui);
|
||||
|
@ -98,7 +98,7 @@ protected:
|
|||
// BBS
|
||||
bool m_paint_changed = true;
|
||||
|
||||
static std::array<float, 4> get_seed_fill_color(const std::array<float, 4> &base_color);
|
||||
static ColorRGBA get_seed_fill_color(const ColorRGBA &base_color);
|
||||
|
||||
private:
|
||||
void update_render_data();
|
||||
|
@ -128,7 +128,7 @@ struct TrianglePatch {
|
|||
|
||||
class TriangleSelectorPatch : public TriangleSelectorGUI {
|
||||
public:
|
||||
explicit TriangleSelectorPatch(const TriangleMesh& mesh, const std::vector<std::array<float, 4>> ebt_colors, float edge_limit = 0.6f)
|
||||
explicit TriangleSelectorPatch(const TriangleMesh& mesh, const std::vector<ColorRGBA> ebt_colors, float edge_limit = 0.6f)
|
||||
: TriangleSelectorGUI(mesh, edge_limit), m_ebt_colors(ebt_colors) {}
|
||||
virtual ~TriangleSelectorPatch() = default;
|
||||
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
void update_selector_triangles();
|
||||
void update_triangles_per_patch();
|
||||
|
||||
void set_ebt_colors(const std::vector<std::array<float, 4>> ebt_colors) { m_ebt_colors = ebt_colors; }
|
||||
void set_ebt_colors(const std::vector<ColorRGBA> ebt_colors) { m_ebt_colors = ebt_colors; }
|
||||
void set_filter_state(bool is_filter_state);
|
||||
|
||||
constexpr static float GapAreaMin = 0.f;
|
||||
|
@ -195,7 +195,7 @@ protected:
|
|||
std::vector<unsigned int> m_vertices_VBO_ids;
|
||||
std::vector<unsigned int> m_triangle_indices_VBO_ids;
|
||||
|
||||
std::vector<std::array<float, 4>> m_ebt_colors;
|
||||
std::vector<ColorRGBA> m_ebt_colors;
|
||||
|
||||
bool m_filter_state = false;
|
||||
|
||||
|
@ -247,10 +247,10 @@ protected:
|
|||
virtual void update_model_object() = 0;
|
||||
virtual void update_from_model_object(bool first_update) = 0;
|
||||
|
||||
virtual std::array<float, 4> get_cursor_sphere_left_button_color() const { return {0.f, 0.f, 1.f, 0.25f}; }
|
||||
virtual std::array<float, 4> get_cursor_sphere_right_button_color() const { return {1.f, 0.f, 0.f, 0.25f}; }
|
||||
virtual ColorRGBA get_cursor_sphere_left_button_color() const { return {0.f, 0.f, 1.f, 0.25f}; }
|
||||
virtual ColorRGBA get_cursor_sphere_right_button_color() const { return {1.f, 0.f, 0.f, 0.25f}; }
|
||||
// BBS
|
||||
virtual std::array<float, 4> get_cursor_hover_color() const { return { 0.f, 0.f, 0.f, 0.25f }; }
|
||||
virtual ColorRGBA get_cursor_hover_color() const { return { 0.f, 0.f, 0.f, 0.25f }; }
|
||||
|
||||
virtual EnforcerBlockerType get_left_button_state_type() const { return EnforcerBlockerType::ENFORCER; }
|
||||
virtual EnforcerBlockerType get_right_button_state_type() const { return EnforcerBlockerType::BLOCKER; }
|
||||
|
|
|
@ -331,7 +331,7 @@ void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool pick
|
|||
//float mean_size = (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0);
|
||||
//double size = m_dragging ? (double)m_grabbers[0].get_dragging_half_size(mean_size) : (double)m_grabbers[0].get_half_size(mean_size);
|
||||
|
||||
std::array<float, 4> color = m_grabbers[0].color;
|
||||
ColorRGBA color = m_grabbers[0].color;
|
||||
if (!picking && m_hover_id != -1) {
|
||||
color = m_grabbers[0].hover_color;
|
||||
//color[0] = 1.0f - color[0];
|
||||
|
|
|
@ -388,7 +388,7 @@ void GLGizmoSeam::update_from_model_object(bool first_update)
|
|||
m_triangle_selectors.clear();
|
||||
|
||||
int volume_id = -1;
|
||||
std::vector<std::array<float, 4>> ebt_colors;
|
||||
std::vector<ColorRGBA> ebt_colors;
|
||||
ebt_colors.push_back(GLVolume::NEUTRAL_COLOR);
|
||||
ebt_colors.push_back(TriangleSelectorGUI::enforcers_color);
|
||||
ebt_colors.push_back(TriangleSelectorGUI::blockers_color);
|
||||
|
|
|
@ -137,7 +137,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
|
|||
glsafe(::glTranslated(0.0, 0.0, z_shift));
|
||||
glsafe(::glMultMatrixd(instance_matrix.data()));
|
||||
|
||||
std::array<float, 4> render_color;
|
||||
ColorRGBA render_color;
|
||||
for (size_t i = 0; i < cache_size; ++i) {
|
||||
const sla::SupportPoint& support_point = m_editing_mode ? m_editing_cache[i].support_point : m_normal_cache[i];
|
||||
const bool& point_selected = m_editing_mode ? m_editing_cache[i].selected : false;
|
||||
|
@ -219,10 +219,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
|
|||
|
||||
// Now render the drain holes:
|
||||
if (has_holes && ! picking) {
|
||||
render_color[0] = 0.7f;
|
||||
render_color[1] = 0.7f;
|
||||
render_color[2] = 0.7f;
|
||||
render_color[3] = 0.7f;
|
||||
render_color = { 0.7f, 0.7f, 0.7f, 0.7f };
|
||||
const_cast<GLModel*>(&m_cylinder)->set_color(-1, render_color);
|
||||
if (shader)
|
||||
shader->set_uniform("emission_factor", 0.5f);
|
||||
|
|
|
@ -445,7 +445,7 @@ void GLGizmoText::on_render()
|
|||
|
||||
m_grabbers[0].center = m_mouse_position_world;
|
||||
m_grabbers[0].enabled = true;
|
||||
std::array<float, 4> color = picking_color_component(0);
|
||||
ColorRGBA color = picking_color_component(0);
|
||||
m_grabbers[0].color = color;
|
||||
m_grabbers[0].render_for_picking(mean_size);
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ void GLGizmoText::on_render_for_picking()
|
|||
float mean_size = (float) (GLGizmoBase::Grabber::FixedGrabberSize);
|
||||
m_grabbers[0].center = m_mouse_position_world;
|
||||
m_grabbers[0].enabled = true;
|
||||
std::array<float, 4> color = picking_color_component(0);
|
||||
ColorRGBA color = picking_color_component(0);
|
||||
m_grabbers[0].color = color;
|
||||
m_grabbers[0].render_for_picking(mean_size);
|
||||
}
|
||||
|
|
|
@ -221,8 +221,8 @@ void InstancesHider::render_cut() const
|
|||
if (mv->is_model_part())
|
||||
glsafe(::glColor3f(0.8f, 0.3f, 0.0f));
|
||||
else {
|
||||
const std::array<float, 4>& c = color_from_model_volume(*mv);
|
||||
glsafe(::glColor4f(c[0], c[1], c[2], c[3]));
|
||||
const ColorRGBA color = color_from_model_volume(*mv);
|
||||
glsafe(::glColor4fv(color.data()));
|
||||
}
|
||||
glsafe(::glPushAttrib(GL_DEPTH_TEST));
|
||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue