home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / NEWS / RADIANCE / LIB / PICTURE.CAL < prev    next >
Text File  |  1993-10-07  |  888b  |  32 lines

  1. {
  2.     Calculation of 2d picture coordinates.
  3.     Picture is projected onto xy plane with lower left corner at origin.
  4.  
  5.     A1        - Ratio of height to width for tiles.
  6.     A2        - Average red value for fadered or grey for fadegrey
  7.     A3        - Average green value for fadegreen
  8.     A4        - Average blue value for fadeblue
  9. }
  10.  
  11. pic_u = Px;
  12. pic_v = Py;
  13.  
  14. tile_u = mod(pic_u,max(1,1/pic_aspect));
  15. tile_v = mod(pic_v,max(1,pic_aspect));
  16.  
  17. match_u = tri(pic_u,max(1,1/pic_aspect));
  18. match_v = tri(pic_v,max(1,pic_aspect));
  19.  
  20. stag_u = if(pic_aspect-1,
  21.         frac(if(frac(pic_v/pic_aspect/2)-.5,pic_u,pic_u+.5)),
  22.         mod(if(frac(pic_v/2)-.5,pic_u,pic_u+.5/pic_aspect),
  23.             1/pic_aspect));
  24. stag_v = tile_v;
  25.  
  26. pic_aspect = if(arg(0)-.5, arg(1), 1);
  27.  
  28. fadered(r,g,b) = fade(r, A2, T*.1);
  29. fadegreen(r,g,b) = fade(g, A3, T*.1);
  30. fadeblue(r,g,b) = fade(b, A4, T*.1);
  31. fadegrey(r,g,b) = fade(grey(r,g,b), A2, T*.1);
  32.