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.25 by greg, Mon Nov 10 19:08:18 2008 UTC vs.
Revision 2.26 by greg, Thu Sep 16 03:28:21 2010 UTC

# Line 36 | Line 36 | RREAL  (*vtlist)[2];           /* map vertex list */
36   int     nvts;
37  
38   int     ndegen = 0;             /* count of degenerate faces */
39 + int     n0norm = 0;             /* count of zero normals */
40  
41   typedef int     VNDX[3];        /* vertex index (point,map,normal) */
42  
# Line 144 | Line 145 | main(          /* read in .obj file and convert */
145          }
146          if (ndegen)
147                  printf("# %d degenerate faces\n", ndegen);
148 +        if (n0norm)
149 +                printf("# %d invalid (zero) normals\n", n0norm);
150          exit(0);
151   userr:
152          fprintf(stderr, "Usage: %s [-o obj][-m mapping][-n][-f] [file.obj]\n",
# Line 498 | Line 501 | cvtndx(                                /* convert vertex string to index */
501                          return(0);
502          } else
503                  vi[2] = -1;
504 +                                        /* zero normal is not normal */
505 +        if (vi[2] >= 0 && DOT(vnlist[vi[2]],vnlist[vi[2]]) <= FTINY)
506 +                vi[2] = -1;
507          return(1);
508   }
509  
# Line 753 | Line 759 | newvn(                 /* create a new vertex normal */
759          vnlist[nvns][0] = x;
760          vnlist[nvns][1] = y;
761          vnlist[nvns][2] = z;
762 <        if (normalize(vnlist[nvns]) == 0.0)
757 <                return(0);
762 >        n0norm += (normalize(vnlist[nvns]) == 0.0);
763          return(++nvns);
764   }
765  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines