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

Comparing ray/src/cv/robjutil.c (file contents):
Revision 2.1 by greg, Mon Mar 30 18:28:35 2020 UTC vs.
Revision 2.4 by greg, Fri Mar 12 18:32:33 2021 UTC

# Line 28 | Line 28 | main(int argc, char *argv[])
28          int             save_mats = 1;
29          int             do_tex = 0;
30          int             do_norm = 0;
31 +        int             do_triangulate = 0;
32 +        char            *xfm = NULL;
33          char            cbuf[256];
34          double          verteps = -1.;
35          int     i, n;
# Line 85 | Line 87 | main(int argc, char *argv[])
87                  case 'r':                       /* output to Radiance file? */
88                          radout = (argv[i][0] == '+');
89                          break;
90 +                case 'T':                       /* triangulate faces? */
91 +                        do_triangulate = (argv[i][0] == '+');
92 +                        break;
93 +                case 'x':                       /* apply a transform */
94 +                        if (xfm != NULL) {
95 +                                fprintf(stderr, "%s: only one '-x' option allowed\n",
96 +                                                argv[0]);
97 +                                exit(1);
98 +                        }
99 +                        xfm = argv[++i];
100 +                        break;
101                  default:
102                          fprintf(stderr, "%s: unknown option: %s\n",
103                                          argv[0], argv[i]);
# Line 178 | Line 191 | main(int argc, char *argv[])
191                  sprintf(cbuf, "Removed %d duplicate faces", n);
192                  addComment(myScene, cbuf);
193          }
194 +        if (do_triangulate) {
195 +                if (verbose)
196 +                        fputs("Making sure all faces are triangles...\n", stderr);
197 +                n = triangulateScene(myScene);
198 +                if (n > 0) {
199 +                        sprintf(cbuf, "Added %d faces during triangulation", n);
200 +                        addComment(myScene, cbuf);
201 +                }
202 +        }
203 +        if (xfm != NULL) {
204 +                if (verbose)
205 +                        fputs("Applying transform...\n", stderr);
206 +                if (!xfmScene(myScene, xfm)) {
207 +                        fprintf(stderr, "%s: transform error\n", argv[0]);
208 +                        exit(1);
209 +                }
210 +        }
211          if (verbose)
212                  fputs("Writing out scene...\n", stderr);
213  
# Line 201 | Line 231 | userr:
231          fprintf(stderr, "\t+/-t\t\t\t# keep/remove texture coordinates\n");
232          fprintf(stderr, "\t+/-n\t\t\t# keep/remove vertex normals\n");
233          fprintf(stderr, "\t-c epsilon\t\t# coalesce vertices within epsilon\n");
234 +        fprintf(stderr, "\t+T\t\t\t# turn all faces into triangles\n");
235 +        fprintf(stderr, "\t-x 'xf spec'\t# apply the quoted transform\n");
236          return(1);
237   }
238  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines