-
Notifications
You must be signed in to change notification settings - Fork 18
/
Tetra.dctl
75 lines (54 loc) · 2.86 KB
/
Tetra.dctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
DEFINE_UI_PARAMS(r_R, Red-Red, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.001 )
DEFINE_UI_PARAMS(r_G, Red-Green, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(r_B, Red-Blue, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(g_R, Green-Red, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(g_G, Green-Green, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(g_B, Green-Blue, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(b_R, Blue-Red, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(b_G, Blue-Green, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(b_B, Blue-Blue, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(c_R, Cyan-Red, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(c_G, Cyan-Green, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(c_B, Cyan-Blue, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(m_R, Magenta-Red, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(m_G, Magenta-Green, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(m_B, Magenta-Blue, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(y_R, Yellow-Red, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(y_G, Yellow-Green, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(y_B, Yellow-Blue, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(w_R, White-Red, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(w_G, White-Green, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
DEFINE_UI_PARAMS(w_B, White-Blue, DCTLUI_SLIDER_FLOAT, 0.0, -3.0, 3.0, 0.01)
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B)
{
float3 Color;
float3 red = make_float3(r_R + 1.f, r_G, r_B);
float3 grn = make_float3(g_R, g_G + 1.f, g_B);
float3 blu = make_float3(b_R, b_G, b_B + 1.f);
float3 cyn = make_float3(c_R, c_G + 1.f, c_B + 1.f);
float3 mag = make_float3(m_R + 1.f, m_G, m_B + 1.f);
float3 yel = make_float3(y_R + 1.f, y_G + 1.f, y_B);
float3 wht = make_float3(w_R + 1.f, w_G + 1.f, w_B + 1.f);
if (p_R>p_G) {
if (p_G>p_B){
Color = p_R * red + p_G * (yel-red) + p_B * (wht-yel);
}
else if (p_R>p_B){
Color = p_R * red + p_G * (wht-mag) + p_B * (mag-red);
}
else{
Color = p_R * (mag-blu) + p_G * (wht-mag) + p_B * blu;
}
} else {
if (p_B>p_G){
Color = p_R * (wht-cyn) + p_G * (cyn-blu) + p_B * blu;
}
else if (p_B>p_R){
Color = p_R * (wht-cyn) + p_G * grn + p_B * (cyn-grn);
}
else{
Color = p_R * (yel-grn) + p_G * grn + p_B * (wht-yel);
}
}
return Color;
}