| 9 |
|
#include <stdlib.h> |
| 10 |
|
#include <math.h> |
| 11 |
|
#include <string.h> |
| 12 |
+ |
|
| 13 |
+ |
#include "platform.h" |
| 14 |
|
#include "mgflib/parser.h" |
| 15 |
|
#include "color.h" |
| 16 |
|
#include "tmesh.h" |
| 25 |
|
|
| 26 |
|
FILE *matfp; /* material output file */ |
| 27 |
|
|
| 26 |
– |
int r_comment(), r_cone(), r_cyl(), r_face(), r_ies(), r_ring(), r_sph(); |
| 27 |
– |
char *material(), *object(), *addarg(); |
| 28 |
|
|
| 29 |
+ |
int r_comment(int ac, char **av); |
| 30 |
+ |
int r_cone(int ac, char **av); |
| 31 |
+ |
int r_cyl(int ac, char **av); |
| 32 |
+ |
int r_sph(int ac, char **av); |
| 33 |
+ |
int r_ring(int ac, char **av); |
| 34 |
+ |
int r_face(int ac, char **av); |
| 35 |
+ |
int r_ies(int ac, char **av); |
| 36 |
+ |
char * material(void); |
| 37 |
+ |
char * object(void); |
| 38 |
+ |
char * addarg(char *op, char *arg); |
| 39 |
+ |
void do_tri(char *mat, C_VERTEX *cv1, C_VERTEX *cv2, C_VERTEX *cv3, int iv); |
| 40 |
+ |
void cvtcolor(COLOR radrgb, register C_COLOR *ciec, double intensity); |
| 41 |
|
|
| 42 |
< |
main(argc, argv) /* convert files to stdout */ |
| 43 |
< |
int argc; |
| 44 |
< |
char *argv[]; |
| 42 |
> |
|
| 43 |
> |
int |
| 44 |
> |
main( |
| 45 |
> |
int argc, |
| 46 |
> |
char *argv[] |
| 47 |
> |
) |
| 48 |
|
{ |
| 49 |
|
int i; |
| 50 |
|
|
| 135 |
|
|
| 136 |
|
|
| 137 |
|
int |
| 138 |
< |
r_comment(ac, av) /* repeat a comment verbatim */ |
| 139 |
< |
register int ac; |
| 140 |
< |
register char **av; |
| 138 |
> |
r_comment( /* repeat a comment verbatim */ |
| 139 |
> |
register int ac, |
| 140 |
> |
register char **av |
| 141 |
> |
) |
| 142 |
|
{ |
| 143 |
|
putchar('#'); /* use Radiance comment character */ |
| 144 |
|
while (--ac) { /* pass through verbatim */ |
| 151 |
|
|
| 152 |
|
|
| 153 |
|
int |
| 154 |
< |
r_cone(ac, av) /* put out a cone */ |
| 155 |
< |
int ac; |
| 156 |
< |
char **av; |
| 154 |
> |
r_cone( /* put out a cone */ |
| 155 |
> |
int ac, |
| 156 |
> |
char **av |
| 157 |
> |
) |
| 158 |
|
{ |
| 159 |
|
static int ncones; |
| 160 |
|
char *mat; |
| 200 |
|
|
| 201 |
|
|
| 202 |
|
int |
| 203 |
< |
r_cyl(ac, av) /* put out a cylinder */ |
| 204 |
< |
int ac; |
| 205 |
< |
char **av; |
| 203 |
> |
r_cyl( /* put out a cylinder */ |
| 204 |
> |
int ac, |
| 205 |
> |
char **av |
| 206 |
> |
) |
| 207 |
|
{ |
| 208 |
|
static int ncyls; |
| 209 |
|
char *mat; |
| 239 |
|
|
| 240 |
|
|
| 241 |
|
int |
| 242 |
< |
r_sph(ac, av) /* put out a sphere */ |
| 243 |
< |
int ac; |
| 244 |
< |
char **av; |
| 242 |
> |
r_sph( /* put out a sphere */ |
| 243 |
> |
int ac, |
| 244 |
> |
char **av |
| 245 |
> |
) |
| 246 |
|
{ |
| 247 |
|
static int nsphs; |
| 248 |
|
char *mat; |
| 273 |
|
|
| 274 |
|
|
| 275 |
|
int |
| 276 |
< |
r_ring(ac, av) /* put out a ring */ |
| 277 |
< |
int ac; |
| 278 |
< |
char **av; |
| 276 |
> |
r_ring( /* put out a ring */ |
| 277 |
> |
int ac, |
| 278 |
> |
char **av |
| 279 |
> |
) |
| 280 |
|
{ |
| 281 |
|
static int nrings; |
| 282 |
|
char *mat; |
| 311 |
|
|
| 312 |
|
|
| 313 |
|
int |
| 314 |
< |
r_face(ac, av) /* convert a face */ |
| 315 |
< |
int ac; |
| 316 |
< |
char **av; |
| 314 |
> |
r_face( /* convert a face */ |
| 315 |
> |
int ac, |
| 316 |
> |
char **av |
| 317 |
> |
) |
| 318 |
|
{ |
| 319 |
|
static int nfaces; |
| 320 |
|
int myi = invert; |
| 322 |
|
register int i; |
| 323 |
|
register C_VERTEX *cv; |
| 324 |
|
FVECT v; |
| 325 |
< |
int rv; |
| 325 |
> |
|
| 326 |
|
/* check argument count and type */ |
| 327 |
|
if (ac < 4) |
| 328 |
|
return(MG_EARGC); |
| 371 |
|
|
| 372 |
|
|
| 373 |
|
int |
| 374 |
< |
r_ies(ac, av) /* convert an IES luminaire file */ |
| 375 |
< |
int ac; |
| 376 |
< |
char **av; |
| 374 |
> |
r_ies( /* convert an IES luminaire file */ |
| 375 |
> |
int ac, |
| 376 |
> |
char **av |
| 377 |
> |
) |
| 378 |
|
{ |
| 379 |
|
int xa0 = 2; |
| 380 |
|
char combuf[128]; |
| 436 |
|
} |
| 437 |
|
|
| 438 |
|
|
| 439 |
< |
do_tri(mat, cv1, cv2, cv3, iv) /* put out smoothed triangle */ |
| 440 |
< |
char *mat; |
| 441 |
< |
C_VERTEX *cv1, *cv2, *cv3; |
| 442 |
< |
int iv; |
| 439 |
> |
void |
| 440 |
> |
do_tri( /* put out smoothed triangle */ |
| 441 |
> |
char *mat, |
| 442 |
> |
C_VERTEX *cv1, |
| 443 |
> |
C_VERTEX *cv2, |
| 444 |
> |
C_VERTEX *cv3, |
| 445 |
> |
int iv |
| 446 |
> |
) |
| 447 |
|
{ |
| 448 |
|
static int ntris; |
| 449 |
|
BARYCCM bvecs; |
| 485 |
|
|
| 486 |
|
|
| 487 |
|
char * |
| 488 |
< |
material() /* get (and print) current material */ |
| 488 |
> |
material(void) /* get (and print) current material */ |
| 489 |
|
{ |
| 490 |
|
char *mname = "mat"; |
| 491 |
|
COLOR radrgb, c2; |
| 492 |
|
double d; |
| 467 |
– |
register int i; |
| 493 |
|
|
| 494 |
|
if (c_cmname != NULL) |
| 495 |
|
mname = c_cmname; |
| 604 |
|
} |
| 605 |
|
|
| 606 |
|
|
| 607 |
< |
cvtcolor(radrgb, ciec, intensity) /* convert a CIE XYZ color to RGB */ |
| 608 |
< |
COLOR radrgb; |
| 609 |
< |
register C_COLOR *ciec; |
| 610 |
< |
double intensity; |
| 607 |
> |
void |
| 608 |
> |
cvtcolor( /* convert a CIE XYZ color to RGB */ |
| 609 |
> |
COLOR radrgb, |
| 610 |
> |
register C_COLOR *ciec, |
| 611 |
> |
double intensity |
| 612 |
> |
) |
| 613 |
|
{ |
| 614 |
|
static COLOR ciexyz; |
| 615 |
|
|
| 622 |
|
|
| 623 |
|
|
| 624 |
|
char * |
| 625 |
< |
object() /* return current object name */ |
| 625 |
> |
object(void) /* return current object name */ |
| 626 |
|
{ |
| 627 |
|
static char objbuf[64]; |
| 628 |
|
register int i; |
| 644 |
|
|
| 645 |
|
|
| 646 |
|
char * |
| 647 |
< |
addarg(op, arg) /* add argument and advance pointer */ |
| 648 |
< |
register char *op, *arg; |
| 647 |
> |
addarg( /* add argument and advance pointer */ |
| 648 |
> |
register char *op, |
| 649 |
> |
register char *arg |
| 650 |
> |
) |
| 651 |
|
{ |
| 652 |
|
*op = ' '; |
| 653 |
|
while ( (*++op = *arg++) ) |