implementing color wheel and new color picker
This commit is contained in:
@@ -25,16 +25,16 @@ void NodePanelColor::init_controls()
|
||||
m_hue = find<NodeSliderHue>("hue");
|
||||
m_hue->on_hue_changed = [this](Node*, glm::vec4 hue_color) {
|
||||
m_base_color = m_quad->m_color = hue_color;
|
||||
auto x = glm::mix(m_base_color, glm::vec4(1, 1, 1, 1), m_cursor.x);
|
||||
m_color = glm::mix(x, glm::vec4(0, 0, 0, 1), m_cursor.y);
|
||||
float hue = convert_rgb2hsv(m_base_color).x;
|
||||
m_color = glm::vec4(convert_hsv2rgb(glm::vec3(hue, m_cursor.x, 1.f-m_cursor.y)), 1.f);
|
||||
if (on_color_changed)
|
||||
on_color_changed(this, m_color);
|
||||
};
|
||||
m_quad->on_value_changed = [this](Node*, glm::vec2 pos)
|
||||
{
|
||||
auto x = glm::mix(m_base_color, glm::vec4(1, 1, 1, 1), pos.x);
|
||||
m_color = glm::mix(x, glm::vec4(0, 0, 0, 1), pos.y);
|
||||
m_cursor = pos;
|
||||
float hue = convert_rgb2hsv(m_base_color).x;
|
||||
m_color = glm::vec4(convert_hsv2rgb(glm::vec3(hue, m_cursor.x, 1.f-m_cursor.y)), 1.f);
|
||||
if (on_color_changed)
|
||||
on_color_changed(this, m_color);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user