--- ray/src/rt/lookamb.c 1989/02/02 10:41:25 1.1 +++ ray/src/rt/lookamb.c 1991/06/06 10:09:50 1.3 @@ -1,4 +1,4 @@ -/* Copyright (c) 1986 Regents of the University of California */ +/* Copyright (c) 1991 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -15,11 +15,9 @@ static char SCCSid[] = "$SunId$ LBL"; #include "color.h" -typedef double FVECT[3]; - typedef struct ambval { - FVECT pos; /* position in space */ - FVECT dir; /* normal direction */ + float pos[3]; /* position in space */ + float dir[3]; /* normal direction */ int lvl; /* recursion level of parent ray */ float weight; /* weight of parent ray */ COLOR val; /* computed ambient value */ @@ -75,7 +73,7 @@ char *argv[]; lookamb(fp) /* get ambient values from a file */ FILE *fp; { - while (fread(&av, sizeof(AMBVAL), 1, fp) == 1) { + while (fread((char *)&av, sizeof(AMBVAL), 1, fp) == 1) { if (dataonly) { printf("%f\t%f\t%f\t", av.pos[0], av.pos[1], av.pos[2]); printf("%f\t%f\t%f\t", av.dir[0], av.dir[1], av.dir[2]); @@ -105,12 +103,12 @@ FILE *fp; for ( ; ; ) { if (!dataonly) fscanf(fp, "%*s"); - if (fscanf(fp, "%lf %lf %lf", + if (fscanf(fp, "%f %f %f", &av.pos[0], &av.pos[1], &av.pos[2]) != 3) return; if (!dataonly) fscanf(fp, "%*s"); - if (fscanf(fp, "%lf %lf %lf", + if (fscanf(fp, "%f %f %f", &av.dir[0], &av.dir[1], &av.dir[2]) != 3) return; if (!dataonly) @@ -123,7 +121,7 @@ FILE *fp; if (fscanf(fp, "%f %f %f", &av.val[RED], &av.val[GRN], &av.val[BLU]) != 3) return; - fwrite(&av, sizeof(AMBVAL), 1, stdout); + fwrite((char *)&av, sizeof(AMBVAL), 1, stdout); if (ferror(stdout)) exit(1); }