implementing color wheel and new color picker

This commit is contained in:
2017-11-23 20:26:57 +00:00
parent d44434a458
commit a90aa4a60e
23 changed files with 371 additions and 26 deletions

View File

@@ -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);
};