home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / share / k3d / shaders / imager / k3d_bluescreen.sl < prev    next >
Encoding:
Text File  |  2008-01-23  |  565 b   |  32 lines

  1. /*
  2.  * bluescreen.sl
  3.  *   puts a background color behind an image.
  4.  *
  5.  * PARAMETERS:
  6.  *   background - the color of the background
  7.  */
  8.  
  9. imager k3d_bluescreen (
  10.  
  11. color background = color(0.0, 0.0, 1.0); 
  12. string texturename = ""
  13. )
  14. {
  15. float resolution[3];
  16. float lenx, leny;
  17. color tex;
  18.  
  19.     if (option("Format", resolution) == 1.0) {
  20.        lenx = xcomp(P)/ resolution[0];
  21.        leny = ycomp(P)/ resolution[1];
  22.     }
  23.  
  24.     if (texturename != "") {
  25.     tex = texture(texturename, lenx, leny);
  26.     Ci+=(1-alpha)*  tex;
  27.     }
  28.     else
  29.        Ci+=(1-alpha)*background;
  30.     Oi=1;
  31. }
  32.