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

Comparing ray/src/common/depthcodec.c (file contents):
Revision 2.7 by greg, Sat Jan 25 02:36:25 2020 UTC vs.
Revision 2.11 by greg, Tue Jan 26 18:47:25 2021 UTC

# Line 26 | Line 26 | depth2code(double d, double dref)
26          if (d > dref)
27                  return (int)(32768.001 - 32768.*dref/d) - 1;
28  
29 <        return (int)(32767.*d/dref - 32768.);
29 >        return (int)(32767.*d/dref - 32768.999);
30   }
31   #endif
32  
# Line 97 | Line 97 | headline(char *s, void *p)
97                          }
98                          return -1;
99                  }
100 +                if (dcp->hdrflags & HF_ENCODE)
101 +                        return 0;       /* will add this later */
102          } else if (!strncmp(s, "SAMP360=", 8))
103                  dcp->gotview--;
104          else if (isview(s))             /* get view params */
# Line 250 | Line 252 | compute_worldpos(FVECT wpos, DEPTHCODEC *dcp, int x, i
252          RREAL   loc[2];
253          FVECT   rdir;
254  
255 +        if (d >= FHUGE*.99)
256 +                goto badval;
257 +
258          pix2loc(loc, &dcp->res, x, y);
259  
260 <        if (viewray(wpos, rdir, &dcp->vw, loc[0], loc[1]) < -FTINY) {
261 <                VCOPY(wpos, dcp->vw.vp);
262 <                return 0;
260 >        if (viewray(wpos, rdir, &dcp->vw, loc[0], loc[1]) >= -FTINY) {
261 >                VSUM(wpos, wpos, rdir, d);
262 >                return 1;
263          }
264 <        VSUM(wpos, wpos, rdir, d);
265 <        return 1;
264 > badval:
265 >        VCOPY(wpos, dcp->vw.vp);
266 >        return 0;
267   }
268  
269  
# Line 317 | Line 323 | seek_dc_pix(DEPTHCODEC *dcp, int x, int y)
323                  return -1;
324          }
325          dcp->curpos = seekpos;
326 +        dcp->use_last = 0;
327          return 1;
328   }
329  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines