home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 9.img / NULLSURF.SL < prev    next >
Encoding:
Text File  |  1992-04-15  |  1.6 KB  |  50 lines

  1. /*****************************************************************************
  2.  *
  3.  *  nullsurf.sl
  4.  *  Copyright (C) 1991-1992 by Autodesk, Inc.
  5.  *
  6.  *  Permission to use, copy, modify, and distribute this software
  7.  *  for any purpose and without fee is hereby granted, provided
  8.  *  that the above copyright notice appears in all copies and that
  9.  *  both that copyright notice and this permission notice appear in
  10.  *  all supporting documentation.
  11.  *
  12.  *  THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
  13.  *  WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
  14.  *  PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
  15.  *
  16.  ****************************************************************************/
  17. /*****************************************************************************
  18.  *  R12 Render
  19.  *
  20.  *  Updated (LTK - 2/92) to include the new_color parameter for R12 Render.
  21.  *
  22.  *  AutoShade v2.0 default Surface shader for SURFACE option of C:RMPROP.
  23.  ****************************************************************************/
  24.  
  25. surface
  26. nullsurf    (
  27.         float   Ka  = 0.3,
  28.                 Kd  = 0.7,
  29.                 Ks  = 0.0,
  30.                 roughness = 0.1;
  31.         color   new_color = -1
  32.             )
  33. {
  34.     varying vector Nf, NI;
  35.  
  36.     Nf = faceforward( normalize(N), I);
  37.  
  38.     /* If new_color >= 0, use the new_color value for the surface color, Cs */
  39.     if (comp(new_color, 0) >= 0)
  40.         Cs = new_color;
  41.  
  42.     Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf));
  43.     if (Ks != 0.0)
  44.     {
  45.         NI =  normalize(-I);
  46.         Ci += Ks * specular(Nf,NI,roughness);
  47.     }
  48.     Oi = Os;
  49.     Ci = Os * Ci;
  50. }