1 |
– |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* getbbox.c - compute bounding box for scene files |
6 |
|
* |
13 |
|
|
14 |
|
#include "object.h" |
15 |
|
|
19 |
– |
#ifndef DEFPATH |
20 |
– |
#define DEFPATH ":/usr/local/lib/ray" |
21 |
– |
#endif |
22 |
– |
|
16 |
|
char *progname; /* argv[0] */ |
17 |
|
|
25 |
– |
char *libpath; /* library search path */ |
26 |
– |
|
18 |
|
int nowarn = 0; /* supress warnings? */ |
19 |
|
|
20 |
< |
int (*addobjnotify[])() = {NULL}; /* new object notifier functions */ |
20 |
> |
void (*addobjnotify[])() = {NULL}; /* new object notifier functions */ |
21 |
|
|
22 |
|
FVECT bbmin, bbmax; /* bounding box */ |
23 |
|
|
38 |
|
|
39 |
|
progname = argv[0]; |
40 |
|
|
50 |
– |
if ((libpath = getenv("RAYPATH")) == NULL) |
51 |
– |
libpath = DEFPATH; |
52 |
– |
|
41 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) { |
42 |
|
switch (argv[i][1]) { |
43 |
|
case 'w': |
54 |
|
bbmax[0] = bbmax[1] = bbmax[2] = -FHUGE; |
55 |
|
/* read input */ |
56 |
|
if (i >= argc) |
57 |
< |
readobj(NULL, addobject); |
57 |
> |
readobj2(NULL, addobject); |
58 |
|
else |
59 |
|
for ( ; i < argc; i++) |
60 |
|
if (!strcmp(argv[i], "-")) /* from stdin */ |
61 |
< |
readobj(NULL, addobject); |
61 |
> |
readobj2(NULL, addobject); |
62 |
|
else /* from file */ |
63 |
< |
readobj(argv[i], addobject); |
63 |
> |
readobj2(argv[i], addobject); |
64 |
|
/* print bounding box */ |
65 |
|
if (!nohead) |
66 |
|
printf( |
67 |
< |
" xmin xmax ymin ymax zmin zmax\n"); |
67 |
> |
" xmin xmax ymin ymax zmin zmax\n"); |
68 |
|
|
69 |
|
printf("%9g %9g %9g %9g %9g %9g\n", bbmin[0], bbmax[0], |
70 |
|
bbmin[1], bbmax[1], bbmin[2], bbmax[2]); |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
+ |
void |
76 |
|
quit(code) /* exit program */ |
77 |
|
int code; |
78 |
|
{ |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
+ |
void |
84 |
|
cputs() /* interactive error */ |
85 |
|
{ |
86 |
|
/* referenced, but not used */ |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
+ |
void |
91 |
|
wputs(s) /* warning message */ |
92 |
|
char *s; |
93 |
|
{ |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
+ |
void |
100 |
|
eputs(s) /* put string to stderr */ |
101 |
|
register char *s; |
102 |
|
{ |