home *** CD-ROM | disk | FTP | other *** search
/ Freeware for SPARC / sparcapps.tar / me / Apps / Graphics / NXplot3d.app / contour.sl < prev    next >
Text File  |  1994-06-07  |  455b  |  20 lines

  1. /* Contour surface generator. Requires the 's' parameter to be a height */
  2. /* field on the surface. Defaults to 10 contours. */
  3. /* Copyright 1994  Steve Ludtke   2/11/94 */
  4. surface
  5. contour( float Kd=.6,Ka=.4,Cst=.05,Csp=.1,Cw=.0025; )
  6. {
  7. float z,w;
  8. color c;
  9.  
  10. c=Cs;
  11. Oi=Os;
  12.  
  13. w=pow(pow(Du(s),2.0)+pow(Dv(s),2.0),.3)*Cw;
  14. for (z=Cst; z<1.0; z+=Csp) {
  15.     if (abs(z-s)<w) { c=color(0,0,0); break; }
  16. }
  17.  
  18. Ci=c*(Ka*ambient()+Kd*diffuse(faceforward(normalize(N),I)));
  19. }
  20.