--- ray/src/rt/func.c 1991/04/23 15:46:22 1.14 +++ ray/src/rt/func.c 1991/06/17 08:28:26 1.16 @@ -33,10 +33,13 @@ OBJREC *m; register RAY *r; XF *bx; { - extern double l_noise3(), l_noise3a(), l_noise3b(), l_noise3c(); - extern double l_hermite(), l_fnoise3(), l_arg(); + extern double l_arg(); extern long eclock; static char *initfile = "rayinit.cal"; + static long lastrno = -1; + /* check to see if already set */ + if (m == fobj && r->rno == lastrno) + return; /* initialize if first call */ if (initfile != NULL) { loadfunc(initfile); @@ -49,12 +52,7 @@ XF *bx; scompile("Jx=$19;Jy=$20;Jz=$21;", NULL, 0); scompile("Kx=$22;Ky=$23;Kz=$24;", NULL, 0); funset("arg", 1, '=', l_arg); - funset("noise3", 3, ':', l_noise3); - funset("noise3a", 3, ':', l_noise3a); - funset("noise3b", 3, ':', l_noise3b); - funset("noise3c", 3, ':', l_noise3c); - funset("hermite", 5, ':', l_hermite); - funset("fnoise3", 3, ':', l_fnoise3); + setnoisefuncs(); initfile = NULL; } fobj = m; @@ -67,6 +65,7 @@ XF *bx; copystruct(&funcxf, &r->rox->b); else copystruct(&funcxf, bx); + lastrno = r->rno; eclock++; /* notify expression evaluator */ }