[GLSL]HSV 转为 RGB
1vec3 rgb(float h, float s, float v)
2{
3 int hi = int(mod(floor(h / 60), 6));
4 float f = h / 60 - hi;
5 float p = v * (1 - s);
6 float q = v * (1 - f * s);
7 float t = v * (1 - (1 - f) * s);
8 switch(hi)
9 {
10 case 0:
11 return vec3(v, t, p);
12 case 1:
13 return vec3(q, v, p);
14 case 2:
15 return vec3(p, v, t);
16 case 3:
17 return vec3(p, q, v);
18 case 4:
19 return vec3(t, p, v);
20 case 5:
21 return vec3(v, p, q);
22 }
23}
glsl