1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
15 |
|
#include "color.h" |
16 |
|
|
17 |
|
|
18 |
– |
typedef double FVECT[3]; |
19 |
– |
|
18 |
|
typedef struct ambval { |
19 |
< |
FVECT pos; /* position in space */ |
20 |
< |
FVECT dir; /* normal direction */ |
19 |
> |
float pos[3]; /* position in space */ |
20 |
> |
float dir[3]; /* normal direction */ |
21 |
|
int lvl; /* recursion level of parent ray */ |
22 |
|
float weight; /* weight of parent ray */ |
23 |
|
COLOR val; /* computed ambient value */ |
73 |
|
lookamb(fp) /* get ambient values from a file */ |
74 |
|
FILE *fp; |
75 |
|
{ |
76 |
< |
while (fread(&av, sizeof(AMBVAL), 1, fp) == 1) { |
76 |
> |
while (fread((char *)&av, sizeof(AMBVAL), 1, fp) == 1) { |
77 |
|
if (dataonly) { |
78 |
|
printf("%f\t%f\t%f\t", av.pos[0], av.pos[1], av.pos[2]); |
79 |
|
printf("%f\t%f\t%f\t", av.dir[0], av.dir[1], av.dir[2]); |
103 |
|
for ( ; ; ) { |
104 |
|
if (!dataonly) |
105 |
|
fscanf(fp, "%*s"); |
106 |
< |
if (fscanf(fp, "%lf %lf %lf", |
106 |
> |
if (fscanf(fp, "%f %f %f", |
107 |
|
&av.pos[0], &av.pos[1], &av.pos[2]) != 3) |
108 |
|
return; |
109 |
|
if (!dataonly) |
110 |
|
fscanf(fp, "%*s"); |
111 |
< |
if (fscanf(fp, "%lf %lf %lf", |
111 |
> |
if (fscanf(fp, "%f %f %f", |
112 |
|
&av.dir[0], &av.dir[1], &av.dir[2]) != 3) |
113 |
|
return; |
114 |
|
if (!dataonly) |
121 |
|
if (fscanf(fp, "%f %f %f", |
122 |
|
&av.val[RED], &av.val[GRN], &av.val[BLU]) != 3) |
123 |
|
return; |
124 |
< |
fwrite(&av, sizeof(AMBVAL), 1, stdout); |
124 |
> |
fwrite((char *)&av, sizeof(AMBVAL), 1, stdout); |
125 |
|
if (ferror(stdout)) |
126 |
|
exit(1); |
127 |
|
} |