ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/mgf2inv.c
(Generate patch)

Comparing ray/src/cv/mgflib/mgf2inv.c (file contents):
Revision 1.3 by greg, Tue Dec 5 10:34:12 1995 UTC vs.
Revision 1.8 by greg, Fri Feb 28 20:11:29 2003 UTC

# Line 1 | Line 1
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   * Convert MGF to Inventor file.
6   *
# Line 12 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9  
10   #include <stdio.h>
11  
12 + #include <stdlib.h>
13 +
14   #include <math.h>
15  
16   #include <ctype.h>
17  
18 + #include <string.h>
19 +
20   #include "parser.h"
21  
22   #include "lookup.h"
23  
24   #define O_INV1          1       /* Inventor 1.0 output */
25   #define O_INV2          2       /* Inventor 2.0 output */
26 < #define O_VRML          3       /* VRML output */
26 > #define O_VRML1         3       /* VRML 1.0 output */
27  
28   #define MAXID           48      /* maximum identifier length */
29  
# Line 97 | Line 98 | char   *argv[];
98                                  /* get options and print format line */
99          for (i = 1; i < argc && argv[i][0] == '-'; i++)
100                  if (!strcmp(argv[i], "-vrml"))
101 <                        outtype = O_VRML;
101 >                        outtype = O_VRML1;
102                  else if (!strcmp(argv[i], "-1"))
103                          outtype = O_INV1;
104                  else if (!strcmp(argv[i], "-2"))
# Line 111 | Line 112 | char   *argv[];
112          case O_INV2:
113                  printf("#Inventor V2.0 ascii\n");
114                  break;
115 <        case O_VRML:
116 <                printf("#VRML 1.0 ascii\n");
115 >        case O_VRML1:
116 >                printf("#VRML V1.0 ascii\n");
117                  break;
118          }
119          printf("## Translated from MGF Version %d.%d\n", MG_VMAJOR, MG_VMINOR);
# Line 338 | Line 339 | put_material()                 /* put out current material */
339                  mgf2rgb(&c_cmaterial->rs_c, c_cmaterial->rs, rgbval);
340                  printf("%sspecularColor %.4f %.4f %.4f\n", tabs,
341                                  rgbval[0], rgbval[1], rgbval[2]);
342 <                printf("%sshininess %.3f\n", tabs, 1.-c_cmaterial->rs_a);
342 >                printf("%sshininess %.3f\n", tabs, 1.-sqrt(c_cmaterial->rs_a));
343          }
344          if (c_cmaterial->ed > FTINY) {
345                  mgf2rgb(&c_cmaterial->ed_c, 1.0, rgbval);
# Line 468 | Line 469 | char   **av;
469          va[1] = v2->p[1] - v1->p[1];
470          va[2] = v2->p[2] - v1->p[2];
471          length = sqrt(DOT(va,va));
472 <        angle = acos(va[1]/length);
472 >        if (va[1] >= length)
473 >                angle = 0.;
474 >        else if (va[1] <= -length)
475 >                angle = PI;
476 >        else
477 >                angle = acos(va[1]/length);
478          printf("%sTranslation { translation %13.9g %13.9g %13.9g }\n", tabs,
479                          .5*(v1->p[0]+v2->p[0]), .5*(v1->p[1]+v2->p[1]),
480                          .5*(v1->p[2]+v2->p[2]));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines