home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freeware for SPARC
/
sparcapps.tar
/
me
/
Apps
/
Graphics
/
NXplot3d.app
/
contour.sl
< prev
next >
Wrap
Text File
|
1994-06-07
|
455b
|
20 lines
/* Contour surface generator. Requires the 's' parameter to be a height */
/* field on the surface. Defaults to 10 contours. */
/* Copyright 1994 Steve Ludtke 2/11/94 */
surface
contour( float Kd=.6,Ka=.4,Cst=.05,Csp=.1,Cw=.0025; )
{
float z,w;
color c;
c=Cs;
Oi=Os;
w=pow(pow(Du(s),2.0)+pow(Dv(s),2.0),.3)*Cw;
for (z=Cst; z<1.0; z+=Csp) {
if (abs(z-s)<w) { c=color(0,0,0); break; }
}
Ci=c*(Ka*ambient()+Kd*diffuse(faceforward(normalize(N),I)));
}