| 66 |
|
|
| 67 |
|
***********************************************************************/ |
| 68 |
|
|
| 69 |
+ |
#include <stdlib.h> |
| 70 |
|
#include <stdio.h> |
| 71 |
+ |
#include <string.h> |
| 72 |
|
|
| 73 |
+ |
#include "rtmath.h" |
| 74 |
+ |
|
| 75 |
+ |
typedef double Flt ; |
| 76 |
+ |
typedef Flt Vec[3] ; |
| 77 |
+ |
typedef Vec Point ; |
| 78 |
+ |
typedef Vec Color ; |
| 79 |
+ |
|
| 80 |
+ |
#define VecCopy(a,b) (b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2]; |
| 81 |
+ |
#define NCOLORS (738) |
| 82 |
+ |
|
| 83 |
+ |
typedef struct t_color_entry { |
| 84 |
+ |
char * ce_name ; |
| 85 |
+ |
Vec ce_color ; |
| 86 |
+ |
} ColorEntry ; |
| 87 |
+ |
|
| 88 |
+ |
#define LESS_THAN -1 |
| 89 |
+ |
#define GREATER_THAN 1 |
| 90 |
+ |
#define EQUAL_TO 0 |
| 91 |
+ |
|
| 92 |
|
char *viewfile = NULL; /* view parameters file */ |
| 93 |
|
|
| 94 |
|
char *progname; |
| 95 |
|
|
| 96 |
+ |
void init(void); |
| 97 |
+ |
void nff2rad(void); |
| 98 |
+ |
void comment(void); |
| 99 |
+ |
void view(void); |
| 100 |
+ |
void light(void); |
| 101 |
+ |
void background(void); |
| 102 |
+ |
void fill(void); |
| 103 |
+ |
void cone(void); |
| 104 |
+ |
void sphere(void); |
| 105 |
+ |
void poly(void); |
| 106 |
+ |
int LookupColorByName(char * name, Vec color); |
| 107 |
+ |
int BinarySearch(char * name, int l, int h, ColorEntry array[]); |
| 108 |
|
|
| 109 |
< |
main(argc, argv) /* convert NFF file to Radiance */ |
| 110 |
< |
int argc; |
| 111 |
< |
char *argv[]; |
| 109 |
> |
|
| 110 |
> |
int |
| 111 |
> |
main( /* convert NFF file to Radiance */ |
| 112 |
> |
int argc, |
| 113 |
> |
char *argv[] |
| 114 |
> |
) |
| 115 |
|
{ |
| 116 |
|
int i; |
| 117 |
|
|
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
|
| 141 |
< |
init() /* spit out initial definitions */ |
| 141 |
> |
void |
| 142 |
> |
init(void) /* spit out initial definitions */ |
| 143 |
|
{ |
| 144 |
|
printf("# File created by %s\n", progname); |
| 145 |
|
printf("\nvoid light light\n"); |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
|
| 152 |
< |
nff2rad() /* convert NFF on stdin to Radiance on stdout */ |
| 152 |
> |
void |
| 153 |
> |
nff2rad(void) /* convert NFF on stdin to Radiance on stdout */ |
| 154 |
|
{ |
| 155 |
|
register int c; |
| 156 |
|
|
| 206 |
|
|
| 207 |
|
******************/ |
| 208 |
|
|
| 209 |
< |
comment() |
| 209 |
> |
void |
| 210 |
> |
comment(void) |
| 211 |
|
{ |
| 212 |
|
register int c; |
| 213 |
|
|
| 264 |
|
|
| 265 |
|
***************/ |
| 266 |
|
|
| 267 |
< |
view() |
| 267 |
> |
void |
| 268 |
> |
view(void) |
| 269 |
|
{ |
| 270 |
|
static FILE *fp = NULL; |
| 271 |
|
float from[3], at[3], up[3], angle; |
| 314 |
|
|
| 315 |
|
**************************/ |
| 316 |
|
|
| 317 |
< |
light() |
| 317 |
> |
void |
| 318 |
> |
light(void) |
| 319 |
|
{ |
| 320 |
|
static int nlights = 0; |
| 321 |
|
register int c; |
| 344 |
|
|
| 345 |
|
********************/ |
| 346 |
|
|
| 347 |
< |
background() |
| 347 |
> |
void |
| 348 |
> |
background(void) |
| 349 |
|
{ |
| 350 |
|
float r, g, b; |
| 351 |
|
char colname[50]; |
| 392 |
|
|
| 393 |
|
*********************/ |
| 394 |
|
|
| 395 |
< |
fill() |
| 395 |
> |
void |
| 396 |
> |
fill(void) |
| 397 |
|
{ |
| 398 |
|
float r, g, b, d, s, p, t, n; |
| 399 |
|
char colname[50]; |
| 458 |
|
|
| 459 |
|
************************/ |
| 460 |
|
|
| 461 |
< |
cone() |
| 461 |
> |
void |
| 462 |
> |
cone(void) |
| 463 |
|
{ |
| 464 |
|
static int ncs = 0; |
| 465 |
|
int invert; |
| 504 |
|
|
| 505 |
|
******************/ |
| 506 |
|
|
| 507 |
< |
sphere() |
| 507 |
> |
void |
| 508 |
> |
sphere(void) |
| 509 |
|
{ |
| 510 |
|
static int nspheres = 0; |
| 511 |
|
float x, y, z, r; |
| 560 |
|
|
| 561 |
|
*******************/ |
| 562 |
|
|
| 563 |
< |
poly() |
| 563 |
> |
void |
| 564 |
> |
poly(void) |
| 565 |
|
{ |
| 566 |
|
static int npolys = 0; |
| 567 |
|
int ispatch; |
| 594 |
|
* $Revision$ |
| 595 |
|
* $Date$ |
| 596 |
|
* $Log$ |
| 597 |
+ |
* Revision 2.7 2003/11/15 17:54:06 schorsch |
| 598 |
+ |
* Continued ANSIfication and reduced compile warnings. |
| 599 |
+ |
* |
| 600 |
|
* Revision 2.6 2003/07/27 22:12:01 schorsch |
| 601 |
|
* Added grouping parens to reduce ambiguity warnings. |
| 602 |
|
* |
| 618 |
|
* |
| 619 |
|
***********************************************************************/ |
| 620 |
|
|
| 572 |
– |
typedef double Flt ; |
| 573 |
– |
typedef Flt Vec[3] ; |
| 574 |
– |
typedef Vec Point ; |
| 575 |
– |
typedef Vec Color ; |
| 576 |
– |
|
| 577 |
– |
#define VecCopy(a,b) (b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2]; |
| 578 |
– |
#define NCOLORS (738) |
| 579 |
– |
|
| 580 |
– |
typedef struct t_color_entry { |
| 581 |
– |
char * ce_name ; |
| 582 |
– |
Vec ce_color ; |
| 583 |
– |
} ColorEntry ; |
| 584 |
– |
|
| 585 |
– |
#define LESS_THAN -1 |
| 586 |
– |
#define GREATER_THAN 1 |
| 587 |
– |
#define EQUAL_TO 0 |
| 588 |
– |
|
| 621 |
|
/* |
| 622 |
|
* Note: These colors must be in sorted order, because we binary search |
| 623 |
|
* for them. |
| 1367 |
|
} ; |
| 1368 |
|
|
| 1369 |
|
int |
| 1370 |
< |
LookupColorByName(name, color) |
| 1371 |
< |
char * name ; |
| 1372 |
< |
Vec color ; |
| 1370 |
> |
LookupColorByName( |
| 1371 |
> |
char * name, |
| 1372 |
> |
Vec color |
| 1373 |
> |
) |
| 1374 |
|
{ |
| 1375 |
|
int rc ; |
| 1376 |
|
rc = BinarySearch(name, 0, NCOLORS - 1 , Colors) ; |
| 1384 |
|
|
| 1385 |
|
|
| 1386 |
|
int |
| 1387 |
< |
BinarySearch(name, l, h, array) |
| 1388 |
< |
char * name ; |
| 1389 |
< |
int l, h ; |
| 1390 |
< |
ColorEntry array[] ; |
| 1387 |
> |
BinarySearch( |
| 1388 |
> |
char * name, |
| 1389 |
> |
int l, |
| 1390 |
> |
int h, |
| 1391 |
> |
ColorEntry array[] |
| 1392 |
> |
) |
| 1393 |
|
{ |
| 1394 |
|
int m, rc ; |
| 1395 |
|
if (l > h) |