color wheel and picker

This commit is contained in:
2017-12-05 22:25:38 +00:00
parent 8a21f3f78a
commit 9978709645
12 changed files with 226 additions and 42 deletions

View File

@@ -177,7 +177,7 @@ void App::initShaders()
"}";
static const char* shader_color_quad_f =
SHADER_VERSION
"uniform mediump vec4 col;"
"uniform mediump vec4 col; // HSV\n"
"in mediump vec3 uv;"
"out mediump vec4 frag;"
"mediump vec3 rgb2hsv(mediump vec3 c) {"
@@ -194,8 +194,7 @@ void App::initShaders()
" return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);"
"}"
"void main() {"
" mediump float hue = rgb2hsv(col.rgb).x;"
" frag = vec4(hsv2rgb(vec3(hue, uv.x, 1.0 - uv.y)), 1.0);"
" frag = vec4(hsv2rgb(vec3(col.x, uv.x, 1.0 - uv.y)), 1.0);"
"}";
// COLOR TRI
static const char* shader_color_tri_f =