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

Comparing ray/src/common/mesh.c (file contents):
Revision 2.24 by greg, Tue Nov 6 01:04:23 2012 UTC vs.
Revision 2.27 by greg, Tue Mar 22 03:56:17 2016 UTC

# Line 99 | Line 99 | getmesh(                               /* get new mesh data reference */
99          }
100          if ((pathname = getpath(mname, getrlibpath(), R_OK)) == NULL) {
101                  sprintf(errmsg, "cannot find mesh file \"%s\"", mname);
102 <                error(USER, errmsg);
102 >                error(SYSTEM, errmsg);
103          }
104          flags &= ~ms->ldflags;
105          if (flags)
# Line 151 | Line 151 | nextmeshtri(                           /* get next triangle ID */
151          int             pn;
152          MESHPATCH       *pp;
153  
154 <        if (*tip == OVOID) {                    /* check for first index */
155 <                *tip = 0;
156 <                return(mp->npatches > 0);       /* assumes 1 local triangle */
157 <        }
158 <        pn = *tip >> 10;
159 <        if (pn >= mp->npatches)                 /* past end? */
160 <                return(0);
161 <        pp = &mp->patch[pn];
162 <        if (!(*tip & 0x200)) {                  /* local triangle? */
163 <                if ((*tip & 0x1ff) < pp->ntris-1) {
164 <                        ++*tip;
165 <                        return(1);
154 >        pn = ++(*tip) >> 10;                    /* next triangle (OVOID init) */
155 >        while (pn < mp->npatches) {
156 >                pp = &mp->patch[pn];
157 >                if (!(*tip & 0x200)) {          /* local triangle? */
158 >                        if ((*tip & 0x1ff) < pp->ntris)
159 >                                return(1);
160 >                        *tip &= ~0x1ff;         /* move on to single-joiners */
161 >                        *tip |= 0x200;
162                  }
163 <                *tip &= ~0x1ff;                 /* move on to single-joiners */
164 <                *tip |= 0x200;
165 <                if (pp->nj1tris)                /* is there at least one? */
166 <                        return(1);
167 <        }
172 <        if (!(*tip & 0x100)) {                  /* single joiner? */
173 <                if ((*tip & 0xff) < pp->nj1tris-1) {
174 <                        ++*tip;
175 <                        return(1);
163 >                if (!(*tip & 0x100)) {          /* single joiner? */
164 >                        if ((*tip & 0xff) < pp->nj1tris)
165 >                                return(1);
166 >                        *tip &= ~0xff;          /* move on to double-joiners */
167 >                        *tip |= 0x100;
168                  }
169 <                *tip &= ~0xff;                  /* move on to double-joiners */
178 <                *tip |= 0x100;
179 <                if (pp->nj2tris)                /* is there one? */
169 >                if ((*tip & 0xff) < pp->nj2tris)
170                          return(1);
171 +                *tip = ++pn << 10;              /* first in next patch */
172          }
173 <        if ((*tip & 0xff) < pp->nj2tris-1) {    /* double-joiner? */
183 <                ++*tip;
184 <                return(1);
185 <        }
186 <        *tip = ++pn << 10;                      /* first in next patch */
187 <        return(pn < mp->npatches);
173 >        return(0);                              /* out of patches */
174   }
175  
176   int

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines