| 10 |
|
#include "rtio.h" |
| 11 |
|
#include "rtmath.h" |
| 12 |
|
#include "objutil.h" |
| 13 |
< |
#include <stdlib.h> |
| 13 |
> |
#include "paths.h" |
| 14 |
|
|
| 15 |
– |
|
| 16 |
– |
char *progname; |
| 17 |
– |
|
| 15 |
|
int verbose = 0; |
| 16 |
|
|
| 17 |
|
char let[]="0123456789._ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; |
| 271 |
|
int |
| 272 |
|
main(int argc, char *argv[]) |
| 273 |
|
{ |
| 274 |
+ |
int smooth = 0; |
| 275 |
|
int nsegs = 1; |
| 276 |
|
int objout = 0; |
| 277 |
|
int i; |
| 278 |
|
|
| 281 |
– |
progname = argv[0]; |
| 282 |
– |
|
| 279 |
|
if (argc < 6) |
| 280 |
|
goto userr; |
| 281 |
|
|
| 297 |
|
case 'i': /* invert surface normals */ |
| 298 |
|
rev = 1; |
| 299 |
|
break; |
| 300 |
+ |
case 's': /* normal smoothing? */ |
| 301 |
+ |
smooth = 1; |
| 302 |
+ |
break; |
| 303 |
|
case 'r': /* rounded edges/corners */ |
| 304 |
|
rounde = 1; |
| 305 |
|
/* fall through */ |
| 396 |
|
side(6, 4, 5, 7); |
| 397 |
|
} |
| 398 |
|
if (obj != NULL) { /* need to write output? */ |
| 399 |
+ |
if (!smooth) |
| 400 |
+ |
removeNormals(obj, 0, 0); |
| 401 |
|
if (objout) { |
| 402 |
< |
coalesceVertices(obj, 2.*FTINY); |
| 402 |
> |
if (rounde) /* joins corners to edges */ |
| 403 |
> |
coalesceVertices(obj, 2.*FTINY); |
| 404 |
|
if (toOBJ(obj, stdout) <= 0) |
| 405 |
|
return(1); |
| 406 |
|
} else if (toRadiance(obj, stdout, 0, 0) <= 0) |
| 411 |
|
userr: |
| 412 |
|
fprintf(stderr, "Usage: %s ", argv[0]); |
| 413 |
|
fprintf(stderr, "material name xsize ysize zsize "); |
| 414 |
< |
fprintf(stderr, "[-i] [-b bevel | -r round [-n nsegs]] [-o]\n"); |
| 414 |
> |
fprintf(stderr, "[-i] [-b bevel | -r round [-n nsegs][-s]] [-o]\n"); |
| 415 |
|
return(1); |
| 416 |
|
} |