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

Comparing ray/src/cv/mgflib/parser.c (file contents):
Revision 1.23 by greg, Wed Jun 19 22:34:59 1996 UTC vs.
Revision 1.25 by greg, Fri Mar 21 12:32:41 1997 UTC

# Line 67 | Line 67 | static int     e_any_toss(),           /* discard unneeded entity *
67                  e_cmix(),               /* color mixtures */
68                  e_cspec();              /* color spectra */
69  
70 int             e_include(),            /* include file */
71                e_sph(),                /* sphere */
72                e_cyl(),                /* cylinder */
73                e_cone(),               /* cone */
74                e_prism(),              /* prism */
75                e_ring(),               /* ring */
76                e_torus();              /* torus */
77
70                                  /* alternate handler support functions */
71  
72   static int      (*e_supp[MG_NENTITIES])();
# Line 124 | Line 116 | mg_init()                      /* initialize alternate entity handlers */
116                  ineed |= 1L<<MG_E_POINT|1L<<MG_E_NORMAL|1L<<MG_E_VERTEX;
117          } else
118                  uneed |= 1L<<MG_E_POINT|1L<<MG_E_NORMAL|1L<<MG_E_VERTEX|1L<<MG_E_XF;
119 +        if (mg_ehand[MG_E_FACE] == NULL)
120 +                mg_ehand[MG_E_FACE] = mg_ehand[MG_E_FACEH];
121 +        else if (mg_ehand[MG_E_FACEH] == NULL)
122 +                mg_ehand[MG_E_FACEH] = e_faceh;
123          if (mg_ehand[MG_E_COLOR] != NULL) {
124                  if (mg_ehand[MG_E_CMIX] == NULL) {
125                          mg_ehand[MG_E_CMIX] = e_cmix;
# Line 319 | Line 315 | mg_parse()                     /* parse current input line */
315   {
316          char    abuf[MG_MAXLINE];
317          char    *argv[MG_MAXARGC];
322        int     en;
318          register char   *cp, *cp2, **ap;
319                                          /* copy line, removing escape chars */
320          cp = abuf; cp2 = mg_file->inpline;
# Line 464 | Line 459 | char   **av;
459   }
460  
461  
462 + int
463 + e_faceh(ac, av)                 /* replace face+holes with single contour */
464 + int     ac;
465 + char    **av;
466 + {
467 +        char    *newav[MG_MAXARGC];
468 +        int     lastp = 0;
469 +        register int    i, j;
470 +
471 +        newav[0] = mg_ename[MG_E_FACE];
472 +        for (i = 1; i < ac; i++)
473 +                if (av[i][0] == '-') {
474 +                        if (i < 4)
475 +                                return(MG_EARGC);
476 +                        if (i >= ac-1)
477 +                                break;
478 +                        if (!lastp)
479 +                                lastp = i-1;
480 +                        for (j = i+1; j < ac-1 && av[j+1][0] != '-'; j++)
481 +                                ;
482 +                        if (j - i < 3)
483 +                                return(MG_EARGC);
484 +                        newav[i] = av[j];       /* connect hole loop */
485 +                } else
486 +                        newav[i] = av[i];       /* hole or perimeter vertex */
487 +        if (lastp)
488 +                newav[i++] = av[lastp];         /* finish seam to outside */
489 +        newav[i] = NULL;
490 +        return(mg_handle(MG_E_FACE, i, newav));
491 + }
492 +
493 +
494   static void
495   make_axes(u, v, w)              /* compute u and v given w (normalized) */
496   FVECT   u, v, w;
# Line 782 | Line 809 | char   **av;
809                  if (rad2 == 0.)
810                          return(MG_EILL);
811          } else if (rad2 != 0.) {
812 <                if (rad1 < 0. ^ rad2 < 0.)
812 >                if ((rad1 < 0.) ^ (rad2 < 0.))
813                          return(MG_EILL);
814          } else {                        /* swap */
815                  C_VERTEX        *cv;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines