--- ray/src/rt/t_func.c 1994/01/12 16:46:54 2.3 +++ ray/src/rt/t_func.c 2012/06/09 07:16:47 2.9 @@ -1,18 +1,15 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: t_func.c,v 2.9 2012/06/09 07:16:47 greg Exp $"; #endif - /* * t_func.c - routine for procedural textures. - * - * 4/8/86 */ -#include "ray.h" +#include "copyright.h" +#include "ray.h" #include "func.h" +#include "rtotypes.h" /* * A procedural texture perturbs the surface normal @@ -31,9 +28,11 @@ static char SCCSid[] = "$SunId$ LBL"; */ -t_func(m, r) /* compute texture for ray */ -register OBJREC *m; -register RAY *r; +extern int +t_func( /* compute texture for ray */ + register OBJREC *m, + register RAY *r +) { FVECT disp; double d; @@ -47,19 +46,18 @@ register RAY *r; errno = 0; for (i = 0; i < 3; i++) { disp[i] = evalue(mf->ep[i]); - if (errno) { + if (errno == EDOM || errno == ERANGE) { objerror(m, WARNING, "compute error"); return(0); } } - if (mf->f != &unitxf) - multv3(disp, disp, mf->f->xfm); + if (mf->fxp != &unitxf) + multv3(disp, disp, mf->fxp->xfm); if (r->rox != NULL) { multv3(disp, disp, r->rox->f.xfm); - d = 1.0 / (mf->f->sca * r->rox->f.sca); + d = 1.0 / (mf->fxp->sca * r->rox->f.sca); } else - d = 1.0 / mf->f->sca; - for (i = 0; i < 3; i++) - r->pert[i] += disp[i] * d; + d = 1.0 / mf->fxp->sca; + VSUM(r->pert, r->pert, disp, d); return(0); }