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

Comparing ray/src/cv/obj2rad.c (file contents):
Revision 2.1 by greg, Tue Apr 12 17:12:42 1994 UTC vs.
Revision 2.5 by greg, Wed Apr 13 17:24:24 1994 UTC

# Line 7 | Line 7 | static char SCCSid[] = "$SunId$ LBL";
7   /*
8   * Convert a Wavefront .obj file to Radiance format.
9   *
10 < * Currently, we support only polygonal geometry, and faces
11 < * must be either quads or triangles for smoothing to work.
12 < * Also, texture indices only work for triangles, though
10 > * Currently, we support only polygonal geometry.  Non-planar
11 > * faces are broken rather haphazardly into triangles.
12 > * Also, texture map indices only work for triangles, though
13   * I'm not sure they work correctly.
14   */
15  
16   #include "standard.h"
17  
18 + #include "trans.h"
19 +
20   #include <ctype.h>
21  
20 #define VOIDID          "void"          /* this is defined in object.h */
21
22   #define TCALNAME        "tmesh.cal"     /* triangle interp. file */
23   #define QCALNAME        "surf.cal"      /* quad interp. file */
24   #define PATNAME         "M-pat"         /* mesh pattern name (reused) */
25   #define TEXNAME         "M-nor"         /* mesh texture name (reused) */
26 + #define DEFOBJ          "unnamed"       /* default object name */
27 + #define DEFMAT          "white"         /* default material name */
28  
29   #define  ABS(x)         ((x)>=0 ? (x) : -(x))
30  
# Line 32 | Line 34 | FVECT  *vlist;                 /* our vertex list */
34   int     nvs;                    /* number of vertices in our list */
35   FVECT   *vnlist;                /* vertex normal list */
36   int     nvns;
37 < FLOAT   (*vtlist)[2];           /* texture vertex list */
37 > FLOAT   (*vtlist)[2];           /* map vertex list */
38   int     nvts;
39  
40   typedef FLOAT   BARYCCM[3][4];  /* barycentric coordinate system */
41  
42 < typedef int     VNDX[3];        /* vertex index (point,texture,normal) */
42 > typedef int     VNDX[3];        /* vertex index (point,map,normal) */
43  
44 < #define CHUNKSIZ        128     /* vertex allocation chunk size */
44 > #define CHUNKSIZ        256     /* vertex allocation chunk size */
45  
46   #define MAXARG          64      /* maximum # arguments in a statement */
47  
48 < char    *defmat = VOIDID;       /* default (starting) material name */
49 < char    *defpat = "";           /* default (starting) picture name */
50 < char    *defobj = "F";          /* default (starting) object name */
48 >                                /* qualifiers */
49 > #define Q_MTL           0
50 > #define Q_MAP           1
51 > #define Q_GRP           2
52 > #define Q_OBJ           3
53 > #define Q_FAC           4
54 > #define NQUALS          5
55  
56 < char    picfile[128];           /* current picture file */
56 > char    *qname[NQUALS] = {
57 >        "Material",
58 >        "Map",
59 >        "Group",
60 >        "Object",
61 >        "Face",
62 > };
63 >
64 > QLIST   qlist = {NQUALS, qname};
65 >                                /* valid qualifier ids */
66 > IDLIST  qual[NQUALS];
67 >                                /* mapping rules */
68 > RULEHD  *ourmapping = NULL;
69 >
70 > char    *defmat = DEFMAT;       /* default (starting) material name */
71 > char    *defobj = DEFOBJ;       /* default (starting) object name */
72 > int     donames = 0;            /* only get qualifier names */
73 >
74 > char    *getmtl(), *getonm();
75 >
76 > char    mapname[128];           /* current picture file */
77   char    matname[64];            /* current material name */
78 + char    group[16][32];          /* current group names */
79   char    objname[128];           /* current object name */
80   int     lineno;                 /* current line number */
81 + int     faceno;                 /* number of faces read */
82  
55 int     nfaces;                 /* total number of faces output */
83  
84 <
58 < main(argc, argv)                /* read in T-mesh files and convert */
84 > main(argc, argv)                /* read in .obj file and convert */
85   int     argc;
86   char    *argv[];
87   {
88 <        FILE    *fp;
88 >        char    *fname;
89          int     i;
90  
91          for (i = 1; i < argc && argv[i][0] == '-'; i++)
# Line 67 | Line 93 | char   *argv[];
93                  case 'o':               /* object name */
94                          defobj = argv[++i];
95                          break;
96 <                case 'm':               /* default material */
97 <                        defmat = argv[++i];
96 >                case 'n':               /* just produce name list */
97 >                        donames++;
98                          break;
99 <                case 'p':               /* default picture */
100 <                        defpat = argv[++i];
99 >                case 'm':               /* use custom mapfile */
100 >                        ourmapping = getmapping(argv[++i], &qlist);
101                          break;
102                  default:
103 <                        fprintf(stderr,
78 <                        "Usage: %s [-o obj][-m mat][-p pic] [file ..]\n",
79 <                                        argv[0]);
80 <                        exit(1);
103 >                        goto userr;
104                  }
105 <        if (i >= argc)
106 <                convert("<stdin>", stdin);
107 <        else
108 <                for ( ; i < argc; i++) {
109 <                        if ((fp = fopen(argv[i], "r")) == NULL) {
110 <                                perror(argv[i]);
111 <                                exit(1);
105 >        if (i > argc | i < argc-1)
106 >                goto userr;
107 >        if (i == argc)
108 >                fname = "<stdin>";
109 >        else if (freopen(fname=argv[i], "r", stdin) == NULL) {
110 >                fprintf(stderr, "%s: cannot open\n", fname);
111 >                exit(1);
112 >        }
113 >        if (donames) {                          /* scan for ids */
114 >                getnames(stdin);
115 >                printf("filename \"%s\"\n", fname);
116 >                printf("filetype \"Wavefront\"\n");
117 >                write_quals(&qlist, qual, stdout);
118 >                printf("qualifier %s begin\n", qlist.qual[Q_FAC]);
119 >                printf("[%d:%d]\n", 1, faceno);
120 >                printf("end\n");
121 >        } else {                                /* translate file */
122 >                printf("# ");
123 >                printargs(argc, argv, stdout);
124 >                convert(fname, stdin);
125 >        }
126 >        exit(0);
127 > userr:
128 >        fprintf(stderr, "Usage: %s [-o obj][-m mapping][-n] [file.obj]\n",
129 >                        argv[0]);
130 >        exit(1);
131 > }
132 >
133 >
134 > getnames(fp)                    /* get valid qualifier names */
135 > FILE    *fp;
136 > {
137 >        char    *argv[MAXARG];
138 >        int     argc;
139 >        ID      tmpid;
140 >        register int    i;
141 >
142 >        while (argc = getstmt(argv, fp))
143 >                switch (argv[0][0]) {
144 >                case 'f':                               /* face */
145 >                        if (!argv[0][1])
146 >                                faceno++;
147 >                        break;
148 >                case 'u':
149 >                        if (!strcmp(argv[0], "usemtl")) {       /* material */
150 >                                if (argc < 2)
151 >                                        break;          /* not fatal */
152 >                                tmpid.number = 0;
153 >                                tmpid.name = argv[1];
154 >                                findid(&qual[Q_MTL], &tmpid, 1);
155 >                        } else if (!strcmp(argv[0], "usemap")) {/* map */
156 >                                if (argc < 2 || !strcmp(argv[1], "off"))
157 >                                        break;          /* not fatal */
158 >                                tmpid.number = 0;
159 >                                tmpid.name = argv[1];
160 >                                findid(&qual[Q_MAP], &tmpid, 1);
161                          }
162 <                        convert(argv[i], fp);
163 <                        fclose(fp);
162 >                        break;
163 >                case 'o':               /* object name */
164 >                        if (argv[0][1] || argc < 2)
165 >                                break;
166 >                        tmpid.number = 0;
167 >                        tmpid.name = argv[1];
168 >                        findid(&qual[Q_OBJ], &tmpid, 1);
169 >                        break;
170 >                case 'g':               /* group name(s) */
171 >                        if (argv[0][1])
172 >                                break;
173 >                        tmpid.number = 0;
174 >                        for (i = 1; i < argc; i++) {
175 >                                tmpid.name = argv[i];
176 >                                findid(&qual[Q_GRP], &tmpid, 1);
177 >                        }
178 >                        break;
179                  }
93        exit(0);
180   }
181  
182  
# Line 104 | Line 190 | FILE   *fp;
190          register int    i;
191                                          /* start fresh */
192          freeverts();
193 <        strcpy(picfile, defpat);
193 >        mapname[0] = '\0';
194          strcpy(matname, defmat);
195          strcpy(objname, defobj);
196          lineno = 0;
197          nstats = nunknown = 0;
112
113        printf("\n# Wavefront file read from: %s\n", fname);
198                                          /* scan until EOF */
199          while (argc = getstmt(argv, fp)) {
200                  switch (argv[0][0]) {
# Line 131 | Line 215 | FILE   *fp;
215                                                  atof(argv[3])))
216                                          syntax(fname, lineno, "Zero normal");
217                                  break;
218 <                        case 't':                       /* texture */
218 >                        case 't':                       /* texture map */
219                                  if (argv[0][2])
220                                          goto unknown;
221                                  if (badarg(argc-1,argv+1,"ff"))
# Line 145 | Line 229 | FILE   *fp;
229                  case 'f':                               /* face */
230                          if (argv[0][1])
231                                  goto unknown;
232 +                        faceno++;
233                          switch (argc-1) {
234                          case 0: case 1: case 2:
235                                  syntax(fname, lineno, "Too few vertices");
# Line 173 | Line 258 | FILE   *fp;
258                                  if (argc < 2)
259                                          break;          /* not fatal */
260                                  if (!strcmp(argv[1], "off"))
261 <                                        picfile[0] = '\0';
261 >                                        mapname[0] = '\0';
262                                  else
263 <                                        strcpy(picfile, argv[1]);
263 >                                        strcpy(mapname, argv[1]);
264                          } else
265                                  goto unknown;
266                          break;
# Line 189 | Line 274 | FILE   *fp;
274                  case 'g':               /* group name(s) */
275                          if (argv[0][1])
276                                  goto unknown;
192                        if (argc < 2)
193                                break;          /* not fatal */
194                        objname[0] = '\0';
277                          for (i = 1; i < argc; i++)
278 <                                if (objname[0])
279 <                                        sprintf(objname+strlen(objname),
198 <                                                ".%s", argv[i]);
199 <                                else
200 <                                        strcpy(objname, argv[i]);
278 >                                strcpy(group[i-1], argv[i]);
279 >                        group[i-1][0] = '\0';
280                          break;
281                  case '#':               /* comment */
282                          break;
# Line 208 | Line 287 | FILE   *fp;
287                  }
288                  nstats++;
289          }
290 <        printf("# Done processing file: %s\n", fname);
290 >        printf("\n# Done processing file: %s\n", fname);
291          printf("# %d lines, %d statements, %d unrecognized\n",
292                          lineno, nstats, nunknown);
293   }
# Line 246 | Line 325 | FILE   *fp;
325  
326          return(i);
327   }
249                
328  
329 +
330 + char *
331 + getmtl()                                /* figure material for this face */
332 + {
333 +        register RULEHD *rp = ourmapping;
334 +
335 +        if (rp == NULL)                 /* no rule set */
336 +                return(matname);
337 +                                        /* check for match */
338 +        do {
339 +                if (matchrule(rp)) {
340 +                        if (!strcmp(rp->mnam, VOIDID))
341 +                                return(NULL);   /* match is null */
342 +                        return(rp->mnam);
343 +                }
344 +                rp = rp->next;
345 +        } while (rp != NULL);
346 +                                        /* no match found */
347 +        return(NULL);
348 + }
349 +
350 +
351 + char *
352 + getonm()                                /* invent a good name for object */
353 + {
354 +        static char     name[64];
355 +        register char   *cp1, *cp2;
356 +        register int    i;
357 +
358 +        if (!group[0][0] || strcmp(objname, DEFOBJ))
359 +                return(objname);        /* good enough for us */
360 +
361 +        cp1 = name;                     /* else make name out of groups */
362 +        for (i = 0; group[i][0]; i++) {
363 +                cp2 = group[i];
364 +                if (cp1 > name)
365 +                        *cp1++ = '.';
366 +                while (*cp1 = *cp2++)
367 +                        if (++cp1 >= name+sizeof(name)-2) {
368 +                                *cp1 = '\0';
369 +                                return(name);
370 +                        }
371 +        }
372 +        return(name);
373 + }
374 +
375 +
376 + matchrule(rp)                           /* check for a match on this rule */
377 + register RULEHD *rp;
378 + {
379 +        ID      tmpid;
380 +        int     gotmatch;
381 +        register int    i;
382 +
383 +        if (rp->qflg & FL(Q_MTL)) {
384 +                tmpid.number = 0;
385 +                tmpid.name = matname;
386 +                if (!matchid(&tmpid, &idm(rp)[Q_MTL]))
387 +                        return(0);
388 +        }
389 +        if (rp->qflg & FL(Q_MAP)) {
390 +                tmpid.number = 0;
391 +                tmpid.name = mapname;
392 +                if (!matchid(&tmpid, &idm(rp)[Q_MAP]))
393 +                        return(0);
394 +        }
395 +        if (rp->qflg & FL(Q_GRP)) {
396 +                tmpid.number = 0;
397 +                gotmatch = 0;
398 +                for (i = 0; group[i][0]; i++) {
399 +                        tmpid.name = group[i];
400 +                        gotmatch |= matchid(&tmpid, &idm(rp)[Q_GRP]);
401 +                }
402 +                if (!gotmatch)
403 +                        return(0);
404 +        }
405 +        if (rp->qflg & FL(Q_OBJ)) {
406 +                tmpid.number = 0;
407 +                tmpid.name = objname;
408 +                if (!matchid(&tmpid, &idm(rp)[Q_OBJ]))
409 +                        return(0);
410 +        }
411 +        if (rp->qflg & FL(Q_FAC)) {
412 +                tmpid.name = NULL;
413 +                tmpid.number = faceno;
414 +                if (!matchid(&tmpid, &idm(rp)[Q_FAC]))
415 +                        return(0);
416 +        }
417 +        return(1);
418 + }
419 +
420 +
421   cvtndx(vi, vs)                          /* convert vertex string to index */
422   register VNDX   vi;
423   register char   *vs;
# Line 263 | Line 433 | register char  *vs;
433                          return(0);
434          } else
435                  return(0);
436 <                                        /* get texture */
436 >                                        /* get map */
437          while (*vs)
438                  if (*vs++ == '/')
439                          break;
# Line 295 | Line 465 | register char  *vs;
465   }
466  
467  
468 < putface(ac, av)                         /* put out an N-sided polygon */
468 > nonplanar(ac, av)                       /* are vertices are non-planar? */
469   register int    ac;
470   register char   **av;
471   {
472          VNDX    vi;
473 +        FLOAT   *p0, *p1;
474 +        FVECT   v1, v2, nsum, newn;
475 +        double  d;
476 +        register int    i;
477  
478 <        printf("\n%s polygon %s.%d\n", matname, objname, ++nfaces);
478 >        if (!cvtndx(vi, av[0]))
479 >                return(0);
480 >        if (vi[2] >= 0)
481 >                return(1);              /* has interpolated normals */
482 >        if (ac < 4)
483 >                return(0);              /* it's a triangle! */
484 >                                        /* set up */
485 >        p0 = vlist[vi[0]];
486 >        if (!cvtndx(vi, av[1]))
487 >                return(0);              /* error gets caught later */
488 >        nsum[0] = nsum[1] = nsum[2] = 0.;
489 >        p1 = vlist[vi[0]];
490 >        fvsum(v2, p1, p0, -1.0);
491 >        for (i = 2; i < ac; i++) {
492 >                VCOPY(v1, v2);
493 >                if (!cvtndx(vi, av[i]))
494 >                        return(0);
495 >                p1 = vlist[vi[0]];
496 >                fvsum(v2, p1, p0, -1.0);
497 >                fcross(newn, v1, v2);
498 >                if (normalize(newn) == 0.0) {
499 >                        if (i < 3)
500 >                                return(1);      /* can't deal with this */
501 >                        fvsum(nsum, nsum, nsum, 1./(i-2));
502 >                        continue;
503 >                }
504 >                d = fdot(newn,nsum);
505 >                if (d >= 0) {
506 >                        if (d < (1.0-FTINY)*(i-2))
507 >                                return(1);
508 >                        fvsum(nsum, nsum, newn, 1.0);
509 >                } else {
510 >                        if (d > -(1.0-FTINY)*(i-2))
511 >                                return(1);
512 >                        fvsum(nsum, nsum, newn, -1.0);
513 >                }
514 >        }
515 >        return(0);
516 > }
517 >
518 >
519 > putface(ac, av)                         /* put out an N-sided polygon */
520 > int     ac;
521 > register char   **av;
522 > {
523 >        VNDX    vi;
524 >        char    *mod;
525 >        register int    i;
526 >
527 >        if (nonplanar(ac, av)) {        /* break into quads and triangles */
528 >                while (ac > 3) {
529 >                        if (!putquad(av[0], av[1], av[2], av[3]))
530 >                                return(0);
531 >                        ac -= 2;                /* remove two vertices */
532 >                        for (i = 1; i < ac; i++)
533 >                                av[i] = av[i+2];
534 >                }
535 >                if (ac == 3 && !puttri(av[0], av[1], av[2]))
536 >                        return(0);
537 >                return(1);
538 >        }
539 >        if ((mod = getmtl()) == NULL)
540 >                return(-1);
541 >        printf("\n%s polygon %s.%d\n", mod, getonm(), faceno);
542          printf("0\n0\n%d\n", 3*ac);
543 <        while (ac--) {
544 <                if (!cvtndx(vi, *av++))
543 >        for (i = 0; i < ac; i++) {
544 >                if (!cvtndx(vi, av[i]))
545                          return(0);
546                  pvect(vlist[vi[0]]);
547          }
# Line 315 | Line 552 | register char  **av;
552   puttri(v1, v2, v3)                      /* put out a triangle */
553   char    *v1, *v2, *v3;
554   {
555 <        char    *mod = matname;
555 >        char    *mod;
556          VNDX    v1i, v2i, v3i;
557          BARYCCM bvecs;
558 +        int     texOK, patOK;
559  
560 +        if ((mod = getmtl()) == NULL)
561 +                return(-1);
562 +
563          if (!cvtndx(v1i, v1) || !cvtndx(v2i, v2) || !cvtndx(v3i, v3))
564                  return(0);
565                                          /* compute barycentric coordinates */
566 <        if ((v1i[2]>=0&&v2i[2]>=0&&v3i[2]>=0) ||
567 <                        (v1i[1]>=0&&v2i[1]>=0&&v3i[1]>=0))
566 >        texOK = (v1i[2]>=0 && v2i[2]>=0 && v3i[2]>=0);
567 >        patOK = mapname[0] && (v1i[1]>=0 && v2i[1]>=0 && v3i[1]>=0);
568 >        if (texOK | patOK)
569                  if (comp_baryc(bvecs, vlist[v1i[0]], vlist[v2i[0]],
570                                  vlist[v3i[0]]) < 0)
571 <                        return(0);
571 >                        return(-1);
572                                          /* put out texture (if any) */
573 <        if (v1i[2]>=0 && v2i[2]>=0 && v3i[2]>=0) {
573 >        if (texOK) {
574                  printf("\n%s texfunc %s\n", mod, TEXNAME);
575                  mod = TEXNAME;
576                  printf("4 dx dy dz %s\n", TCALNAME);
# Line 345 | Line 587 | char   *v1, *v2, *v3;
587                                  vnlist[v3i[2]][2]);
588          }
589                                          /* put out pattern (if any) */
590 <        if (picfile[0] && v1i[1]>=0 && v2i[1]>=0 && v3i[1]>=0) {
590 >        if (patOK) {
591                  printf("\n%s colorpict %s\n", mod, PATNAME);
592                  mod = PATNAME;
593 <                printf("7 noneg noneg noneg %s %s u v\n", picfile, TCALNAME);
593 >                printf("7 noneg noneg noneg %s %s u v\n", mapname, TCALNAME);
594                  printf("0\n18\n");
595                  put_baryc(bvecs);
596                  printf("\t%f %f %f\n", vtlist[v1i[1]][0],
# Line 357 | Line 599 | char   *v1, *v2, *v3;
599                                  vtlist[v2i[1]][1], vtlist[v3i[1]][1]);
600          }
601                                          /* put out triangle */
602 <        printf("\n%s polygon %s.%d\n", matname, objname, ++nfaces);
602 >        printf("\n%s polygon %s.%d\n", mod, getonm(), faceno);
603          printf("0\n0\n9\n");
604          pvect(vlist[v1i[0]]);
605          pvect(vlist[v2i[0]]);
# Line 417 | Line 659 | register BARYCCM       bcm;
659   }
660  
661  
662 < putquad(p0, p1, p2, p3)                 /* put out a quadrilateral */
663 < char  *p0, *p1, *p2, *p3;
662 > putquad(p0, p1, p3, p2)                 /* put out a quadrilateral */
663 > char  *p0, *p1, *p3, *p2;               /* names correspond to binary pos. */
664   {
665          VNDX  p0i, p1i, p2i, p3i;
666          FVECT  norm[4];
667 +        char  *mod, *name;
668          int  axis;
669          FVECT  v1, v2, vc1, vc2;
670          int  ok1, ok2;
671 +
672 +        if ((mod = getmtl()) == NULL)
673 +                return(-1);
674 +        name = getonm();
675                                          /* get actual indices */
676          if (!cvtndx(p0i,p0) || !cvtndx(p1i,p1) ||
677                          !cvtndx(p2i,p2) || !cvtndx(p3i,p3))
# Line 439 | Line 686 | char  *p0, *p1, *p2, *p3;
686          fcross(vc2, v1, v2);
687          ok2 = normalize(vc2) != 0.0;
688          if (!(ok1 | ok2))
689 <                return(0);
689 >                return(-1);
690                                          /* compute normal interpolation */
691          axis = norminterp(norm, p0i, p1i, p2i, p3i);
692  
693                                          /* put out quadrilateral? */
694 <        if (ok1 & ok2 && fdot(vc1,vc2) >= 1.0-FTINY*FTINY) {
695 <                printf("\n%s ", matname);
694 >        if (ok1 & ok2 && fabs(fdot(vc1,vc2)) >= 1.0-FTINY) {
695 >                printf("\n%s ", mod);
696                  if (axis != -1) {
697                          printf("texfunc %s\n", TEXNAME);
698                          printf("4 surf_dx surf_dy surf_dz %s\n", QCALNAME);
# Line 458 | Line 705 | char  *p0, *p1, *p2, *p3;
705                          pvect(v1);
706                          printf("\n%s ", TEXNAME);
707                  }
708 <                printf("polygon %s.%d\n", objname, ++nfaces);
708 >                printf("polygon %s.%d\n", name, faceno);
709                  printf("0\n0\n12\n");
710                  pvect(vlist[p0i[0]]);
711                  pvect(vlist[p1i[0]]);
# Line 468 | Line 715 | char  *p0, *p1, *p2, *p3;
715          }
716                                          /* put out triangles? */
717          if (ok1) {
718 <                printf("\n%s ", matname);
718 >                printf("\n%s ", mod);
719                  if (axis != -1) {
720                          printf("texfunc %s\n", TEXNAME);
721                          printf("4 surf_dx surf_dy surf_dz %s\n", QCALNAME);
# Line 480 | Line 727 | char  *p0, *p1, *p2, *p3;
727                          pvect(v1);
728                          printf("\n%s ", TEXNAME);
729                  }
730 <                printf("polygon %s.%d\n", objname, ++nfaces);
730 >                printf("polygon %s.%da\n", name, faceno);
731                  printf("0\n0\n9\n");
732                  pvect(vlist[p0i[0]]);
733                  pvect(vlist[p1i[0]]);
734                  pvect(vlist[p2i[0]]);
735          }
736          if (ok2) {
737 <                printf("\n%s ", matname);
737 >                printf("\n%s ", mod);
738                  if (axis != -1) {
739                          printf("texfunc %s\n", TEXNAME);
740                          printf("4 surf_dx surf_dy surf_dz %s\n", QCALNAME);
# Line 499 | Line 746 | char  *p0, *p1, *p2, *p3;
746                          pvect(v2);
747                          printf("\n%s ", TEXNAME);
748                  }
749 <                printf("polygon %s.%d\n", objname, ++nfaces);
749 >                printf("polygon %s.%db\n", name, faceno);
750                  printf("0\n0\n9\n");
751                  pvect(vlist[p2i[0]]);
752                  pvect(vlist[p1i[0]]);
# Line 633 | Line 880 | double x, y, z;
880  
881  
882   int
883 < newvt(x, y)                     /* create a new texture vertex */
883 > newvt(x, y)                     /* create a new texture map vertex */
884   double  x, y;
885   {
886          if (!(nvts%CHUNKSIZ)) {         /* allocate next block */
# Line 649 | Line 896 | double x, y;
896                          exit(1);
897                  }
898          }
899 <                                        /* assign new texture vertex */
899 >                                        /* assign new vertex */
900          vtlist[nvts][0] = x;
901          vtlist[nvts][1] = y;
902          return(++nvts);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines