home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / util / raytracr.sit / g_bal.c.bin / g_bal.c
Encoding:
C/C++ Source or Header  |  1988-11-13  |  772 b   |  41 lines  |  [TEXT/KAHL]

  1. #include <stdio.h>
  2. #include "rtd.h"
  3. #include "extern.h"
  4.  
  5. char * mlalloc();
  6.  
  7. g_bal (df)
  8. FILE * df;
  9. {
  10.     int     i;
  11.     double  x,
  12.             y,
  13.             z,
  14.             r,
  15.             ior,
  16.             rfr,
  17.             rfl,
  18.             dif,
  19.             amb;
  20.      struct ball *bp;
  21.      
  22.     for (i = 0;
  23.         fscanf (df, "%lf %lf %lf %lf %lf %lf %lf %lf %lf",
  24.         &x, &y, &z, &r, &ior, &rfr, &rfl, &dif, &amb) != EOF;
  25.         i++) {
  26.     bl[i] = (struct ball   *) mlalloc ((long) sizeof (struct ball));
  27.     if (bl[i] == NULL) booboo("Out of memory.");
  28.     bp = bl[i];
  29.     bp -> s.cent.x = x;
  30.     bl[i] -> s.cent.y = y;
  31.     bl[i] -> s.cent.z = z;
  32.     bl[i] -> s.rad = r;
  33.     bl[i] -> ior = ior;
  34.     bl[i] -> rfr = rfr;
  35.     bl[i] -> rfl = rfl;
  36.     bl[i] -> dif = dif;
  37.     bl[i] -> amb = amb;
  38.     }
  39.     return (i);
  40. }
  41.