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

Comparing ray/src/ot/oconv.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:33:04 1989 UTC vs.
Revision 1.4 by greg, Thu Jun 1 19:23:13 1989 UTC

# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ LBL";
18  
19   #include  "otypes.h"
20  
21 + #define  OMARGIN        (10*FTINY)      /* margin around global cube */
22 +
23   #define  MAXOBJFIL      63              /* maximum number of scene files */
24  
25   char  *progname;                        /* argv[0] */
# Line 55 | Line 57 | char  **argv;
57          if ((libpath = getenv("RAYPATH")) == NULL)
58                  libpath = ":/usr/local/lib/ray";
59  
60 <        for (i = 1; i < argc && argv[i][0] == '-'; i++)
60 >        for (i = 1; i < argc && argv[i][0] == '-' && argv[i][1]; i++)
61                  switch (argv[i][1]) {
62                  case 'i':                               /* input octree */
63                          infile = argv[++i];
64                          break;
65                  case 'b':                               /* bounding cube */
66 <                        thescene.cuorg[0] = atof(argv[++i]) - FTINY;
67 <                        thescene.cuorg[1] = atof(argv[++i]) - FTINY;
68 <                        thescene.cuorg[2] = atof(argv[++i]) - FTINY;
69 <                        thescene.cusize = atof(argv[++i]) + 2*FTINY;
66 >                        thescene.cuorg[0] = atof(argv[++i]) - OMARGIN;
67 >                        thescene.cuorg[1] = atof(argv[++i]) - OMARGIN;
68 >                        thescene.cuorg[2] = atof(argv[++i]) - OMARGIN;
69 >                        thescene.cusize = atof(argv[++i]) + 2*OMARGIN;
70                          break;
71                  case 'n':                               /* set limit */
72                          objlim = atoi(argv[++i]);
# Line 83 | Line 85 | char  **argv;
85                          error(USER, errmsg);
86                          break;
87                  }
88 <        
88 >
89          if (infile != NULL) {           /* get old octree & objects */
90                  if (thescene.cusize > FTINY)
91                          error(USER, "only one of '-b' or '-i'");
# Line 99 | Line 101 | char  **argv;
101  
102          startobj = nobjects;            /* previous objects already converted */
103          
104 <        for ( ; i < argc; i++) {                /* read new files */
105 <                if (nfiles >= MAXOBJFIL)
106 <                        error(INTERNAL, "too many scene files");
107 <                readobj(ofname[nfiles++] = argv[i]);
108 <        }
104 >        for ( ; i < argc; i++)          /* read new scene descriptions */
105 >                if (!strcmp(argv[i], "-")) {    /* from stdin */
106 >                        readobj(NULL);
107 >                        outflags &= ~IO_FILES;
108 >                } else {                        /* from file */
109 >                        if (nfiles >= MAXOBJFIL)
110 >                                error(INTERNAL, "too many scene files");
111 >                        readobj(ofname[nfiles++] = argv[i]);
112 >                }
113 >
114          ofname[nfiles] = NULL;
115                                                  /* find bounding box */
116          bbmin[0] = bbmin[1] = bbmin[2] = FHUGE;
# Line 114 | Line 121 | char  **argv;
121          if (thescene.cusize == 0.0) {
122                  if (bbmin[0] <= bbmax[0]) {
123                          for (i = 0; i < 3; i++) {
124 <                                bbmin[i] -= FTINY;
125 <                                bbmax[i] += FTINY;
124 >                                bbmin[i] -= OMARGIN;
125 >                                bbmax[i] += OMARGIN;
126                          }
120                        VCOPY(thescene.cuorg, bbmin);
127                          for (i = 0; i < 3; i++)
128                                  if (bbmax[i] - bbmin[i] > thescene.cusize)
129                                          thescene.cusize = bbmax[i] - bbmin[i];
130 +                        for (i = 0; i < 3; i++)
131 +                                thescene.cuorg[i] =
132 +                                        (bbmax[i]+bbmin[i]-thescene.cusize)*.5;
133                  }
134          } else {
135                  for (i = 0; i < 3; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines