home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
RADIANCE
/
LIB
/
PICTURE.CAL
< prev
next >
Wrap
Text File
|
1993-10-07
|
888b
|
32 lines
{
Calculation of 2d picture coordinates.
Picture is projected onto xy plane with lower left corner at origin.
A1 - Ratio of height to width for tiles.
A2 - Average red value for fadered or grey for fadegrey
A3 - Average green value for fadegreen
A4 - Average blue value for fadeblue
}
pic_u = Px;
pic_v = Py;
tile_u = mod(pic_u,max(1,1/pic_aspect));
tile_v = mod(pic_v,max(1,pic_aspect));
match_u = tri(pic_u,max(1,1/pic_aspect));
match_v = tri(pic_v,max(1,pic_aspect));
stag_u = if(pic_aspect-1,
frac(if(frac(pic_v/pic_aspect/2)-.5,pic_u,pic_u+.5)),
mod(if(frac(pic_v/2)-.5,pic_u,pic_u+.5/pic_aspect),
1/pic_aspect));
stag_v = tile_v;
pic_aspect = if(arg(0)-.5, arg(1), 1);
fadered(r,g,b) = fade(r, A2, T*.1);
fadegreen(r,g,b) = fade(g, A3, T*.1);
fadeblue(r,g,b) = fade(b, A4, T*.1);
fadegrey(r,g,b) = fade(grey(r,g,b), A2, T*.1);