7 |
|
|
8 |
|
#include <string.h> |
9 |
|
|
10 |
+ |
#include "platform.h" |
11 |
+ |
#include "rterror.h" |
12 |
|
#include "rholo.h" |
11 |
– |
#include "view.h" |
13 |
|
|
14 |
|
char *progname; /* our program name */ |
15 |
|
char *hdkfile; /* holodeck file name */ |
31 |
|
|
32 |
|
extern int nowarn; /* turn warnings off? */ |
33 |
|
|
34 |
+ |
static void dopicture(int fn); |
35 |
+ |
static void render_frame(PACKHEAD *bl, int nb); |
36 |
+ |
static void startpicture(int fn); |
37 |
+ |
static int endpicture(void); |
38 |
+ |
static void initialize(void); |
39 |
+ |
/* from rhpict2.c */ |
40 |
+ |
extern void pixFinish(double ransamp); |
41 |
+ |
extern void pixBeam(BEAM *bp, HDBEAMI *hb); |
42 |
|
|
43 |
< |
main(argc, argv) |
44 |
< |
int argc; |
45 |
< |
char *argv[]; |
43 |
> |
|
44 |
> |
int |
45 |
> |
main( |
46 |
> |
int argc, |
47 |
> |
char *argv[] |
48 |
> |
) |
49 |
|
{ |
50 |
|
int i, rval; |
51 |
|
|
136 |
|
"Usage: %s [-w][-r rf][-pa pa][-pe ex][-x hr][-y vr][-S stfn][-o outp][view] input.hdk\n", |
137 |
|
progname); |
138 |
|
quit(1); |
139 |
+ |
return 1; /* pro forma return */ |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
< |
dopicture(fn) /* render view from holodeck */ |
144 |
< |
int fn; |
143 |
> |
static void |
144 |
> |
dopicture( /* render view from holodeck */ |
145 |
> |
int fn |
146 |
> |
) |
147 |
|
{ |
148 |
|
char *err; |
149 |
|
int rval; |
180 |
|
} |
181 |
|
|
182 |
|
|
183 |
< |
render_frame(bl, nb) /* render frame from beam values */ |
184 |
< |
register PACKHEAD *bl; |
185 |
< |
int nb; |
183 |
> |
static void |
184 |
> |
render_frame( /* render frame from beam values */ |
185 |
> |
PACKHEAD *bl, |
186 |
> |
int nb |
187 |
> |
) |
188 |
|
{ |
189 |
< |
extern void pixBeam(); |
190 |
< |
register HDBEAMI *bil; |
174 |
< |
register int i; |
189 |
> |
HDBEAMI *bil; |
190 |
> |
int i; |
191 |
|
|
192 |
|
if (nb <= 0) return; |
193 |
|
if ((bil = (HDBEAMI *)malloc(nb*sizeof(HDBEAMI))) == NULL) |
202 |
|
} |
203 |
|
|
204 |
|
|
205 |
< |
startpicture(fn) /* initialize picture for rendering & output */ |
206 |
< |
int fn; |
205 |
> |
static void |
206 |
> |
startpicture( /* initialize picture for rendering & output */ |
207 |
> |
int fn |
208 |
> |
) |
209 |
|
{ |
210 |
|
extern char VersionID[]; |
211 |
|
double pa = pixaspect; |
216 |
|
/* prepare output */ |
217 |
|
if (outspec != NULL) { |
218 |
|
sprintf(fname, outspec, fn); |
219 |
< |
if (freopen(fname, "w", stdout) == NULL) { |
219 |
> |
if (freopen(fname, "wb", stdout) == NULL) { |
220 |
|
sprintf(errmsg, "cannot open output \"%s\"", fname); |
221 |
|
error(SYSTEM, errmsg); |
222 |
|
} |
245 |
|
} |
246 |
|
|
247 |
|
|
248 |
< |
int |
249 |
< |
endpicture() /* finish and write out pixels */ |
248 |
> |
static int |
249 |
> |
endpicture(void) /* finish and write out pixels */ |
250 |
|
{ |
251 |
|
int lastr = -1, nunrend = 0; |
252 |
|
int32 lastp, lastrp; |
253 |
< |
register int32 p; |
254 |
< |
register double d; |
253 |
> |
int32 p; |
254 |
> |
double d; |
255 |
|
/* compute final pixel values */ |
256 |
|
for (p = hres*vres; p--; ) { |
257 |
|
if (myweight[p] <= FTINY) { |
279 |
|
} |
280 |
|
|
281 |
|
|
282 |
< |
initialize() /* initialize holodeck and buffers */ |
282 |
> |
static void |
283 |
> |
initialize(void) /* initialize holodeck and buffers */ |
284 |
|
{ |
285 |
|
int fd; |
286 |
|
FILE *fp; |
287 |
|
int n; |
288 |
< |
int32 nextloc; |
288 |
> |
off_t nextloc; |
289 |
|
/* open holodeck file */ |
290 |
< |
if ((fp = fopen(hdkfile, "r")) == NULL) { |
290 |
> |
if ((fp = fopen(hdkfile, "rb")) == NULL) { |
291 |
|
sprintf(errmsg, "cannot open \"%s\" for reading", hdkfile); |
292 |
|
error(SYSTEM, errmsg); |
293 |
|
} |
303 |
|
fd = dup(fileno(fp)); /* dup file descriptor */ |
304 |
|
fclose(fp); /* done with stdio */ |
305 |
|
for (n = 0; nextloc > 0L; n++) { /* initialize each section */ |
306 |
< |
lseek(fd, (off_t)nextloc, 0); |
306 |
> |
lseek(fd, nextloc, SEEK_SET); |
307 |
|
read(fd, (char *)&nextloc, sizeof(nextloc)); |
308 |
|
hdinit(fd, NULL); |
309 |
|
} |
317 |
|
|
318 |
|
|
319 |
|
void |
320 |
< |
eputs(s) /* put error message to stderr */ |
302 |
< |
register char *s; |
320 |
> |
eputs(const char *s) /* put error message to stderr */ |
321 |
|
{ |
322 |
|
static int midline = 0; |
323 |
|
|