-
Notifications
You must be signed in to change notification settings - Fork 0
/
MARS_SONY.DCTL
40 lines (29 loc) · 928 Bytes
/
MARS_SONY.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
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, __TEXTURE__ p_TexR, __TEXTURE__ p_TexG, __TEXTURE__ p_TexB)
{
float r = 0;
float g = 0;
float b = 0;
int Y=p_Y;
int X=p_X;
if (X%2 == 0 && Y%2 == 1) {
r = _tex2D(p_TexR, X, Y-1);
g = ((_tex2D(p_TexG, X, Y) + _tex2D(p_TexG, X+1, Y+1))/2);
b = _tex2D(p_TexB, X+1, Y+1);
}
if (X%2 == 1 && Y%2 == 1) {
r = _tex2D(p_TexR, X-1, Y-1);
g = ((_tex2D(p_TexG, X-1, Y) + _tex2D(p_TexG, X, Y+1))/2);
b = _tex2D(p_TexB, X, Y);
}
if (X%2 == 0 && Y%2 == 0) {
r = _tex2D(p_TexR, X, Y);
g = ((_tex2D(p_TexG, X, Y-1) + _tex2D(p_TexG, X+1, Y))/2);
b = _tex2D(p_TexB, X+1, Y-1);
}
if (X%2 == 1 && Y%2 == 0) {
r = _tex2D(p_TexR, X-1, Y);
g = ((_tex2D(p_TexG, X, Y) + _tex2D(p_TexG, X-1, Y-1))/2);
b = _tex2D(p_TexB, X, Y-1);
}
return make_float3(r, g, b);
}