1 |
– |
/* Copyright (c) 1995 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 |
|
* Make illum sources for optimizing rendering process |
6 |
|
*/ |
7 |
|
|
11 |
– |
#include "mkillum.h" |
12 |
– |
|
8 |
|
#include <signal.h> |
14 |
– |
|
9 |
|
#include <ctype.h> |
10 |
+ |
#include <stdio.h> |
11 |
|
|
12 |
+ |
#include "platform.h" |
13 |
+ |
#include "mkillum.h" |
14 |
+ |
|
15 |
|
/* default parameters */ |
16 |
|
#define SAMPDENS 48 /* points per projected steradian */ |
17 |
|
#define NSAMPS 32 /* samples per point */ |
28 |
|
"-ab", "2", "-ad", "256", "-as", "128", "-aa", ".15", }; |
29 |
|
int rtargc = 14; |
30 |
|
/* overriding rtrace options */ |
31 |
< |
char *myrtopts[] = { "-I-", "-i-", "-ov", "-h-", "-fff", "-y", "0", NULL }; |
31 |
> |
char *myrtopts[] = { "-I-", "-i-", "-ld-", "-ov", "-h-", |
32 |
> |
"-fff", "-y", "0", NULL }; |
33 |
|
|
34 |
|
struct rtproc rt; /* our rtrace process */ |
35 |
|
|
58 |
|
|
59 |
|
int warnings = 1; /* print warnings? */ |
60 |
|
|
62 |
– |
extern char *fgetline(), *fgetword(), *sskip(), |
63 |
– |
*atos(), *iskip(), *fskip(), *strcpy(); |
64 |
– |
extern FILE *popen(); |
61 |
|
|
66 |
– |
|
62 |
|
main(argc, argv) /* compute illum distributions using rtrace */ |
63 |
|
int argc; |
64 |
|
char *argv[]; |
65 |
|
{ |
71 |
– |
extern char *getenv(), *getpath(); |
66 |
|
char *rtpath; |
67 |
|
FILE *fp; |
68 |
|
register int i; |
131 |
|
} |
132 |
|
|
133 |
|
|
134 |
+ |
void |
135 |
|
quit(status) /* exit with status */ |
136 |
|
int status; |
137 |
|
{ |
157 |
|
ofun[OBJ_SPHERE].funp = o_sphere; |
158 |
|
ofun[OBJ_RING].funp = o_ring; |
159 |
|
/* set up signal handling */ |
160 |
+ |
#ifndef _WIN32 /* XXX what do we use instead? */ |
161 |
|
signal(SIGPIPE, quit); |
162 |
+ |
#endif |
163 |
|
/* start rtrace process */ |
164 |
|
errno = 0; |
165 |
|
maxbytes = open_process(rt.pd, rtargv); |
181 |
|
} |
182 |
|
|
183 |
|
|
184 |
+ |
void |
185 |
|
eputs(s) /* put string to stderr */ |
186 |
|
register char *s; |
187 |
|
{ |
197 |
|
} |
198 |
|
|
199 |
|
|
200 |
+ |
void |
201 |
|
wputs(s) /* print warning if enabled */ |
202 |
|
char *s; |
203 |
|
{ |
257 |
|
case ' ': |
258 |
|
case '\t': |
259 |
|
case '\n': |
260 |
+ |
case '\r': |
261 |
+ |
case '\f': |
262 |
|
cp++; |
263 |
|
continue; |
264 |
|
case 'm': /* material name */ |
326 |
|
case 'd': /* point sample density */ |
327 |
|
if (*++cp != '=') |
328 |
|
break; |
329 |
< |
if (!isintd(++cp, " \t\n")) |
329 |
> |
if (!isintd(++cp, " \t\n\r")) |
330 |
|
break; |
331 |
|
thisillum.sampdens = atoi(cp); |
332 |
|
cp = sskip(cp); |
334 |
|
case 's': /* point super-samples */ |
335 |
|
if (*++cp != '=') |
336 |
|
break; |
337 |
< |
if (!isintd(++cp, " \t\n")) |
337 |
> |
if (!isintd(++cp, " \t\n\r")) |
338 |
|
break; |
339 |
|
thisillum.nsamps = atoi(cp); |
340 |
|
cp = sskip(cp); |
352 |
|
case 'b': /* brightness */ |
353 |
|
if (*++cp != '=') |
354 |
|
break; |
355 |
< |
if (!isfltd(++cp, " \t\n")) |
355 |
> |
if (!isfltd(++cp, " \t\n\r")) |
356 |
|
break; |
357 |
|
thisillum.minbrt = atof(cp); |
358 |
|
if (thisillum.minbrt < 0.) |
447 |
|
if (fgetword(str, MAXSTR, fp) == NULL) |
448 |
|
goto readerr; |
449 |
|
/* is it an alias? */ |
450 |
< |
if (!strcmp(str, ALIASID)) { |
450 |
> |
if (!strcmp(str, ALIASKEY)) { |
451 |
|
if (fgetword(str, MAXSTR, fp) == NULL) |
452 |
|
goto readerr; |
453 |
< |
printf("\n%s %s %s", thisillum.altmat, ALIASID, str); |
453 |
> |
printf("\n%s %s %s", thisillum.altmat, ALIASKEY, str); |
454 |
|
if (fgetword(str, MAXSTR, fp) == NULL) |
455 |
|
goto readerr; |
456 |
|
printf("\t%s\n", str); |