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

Comparing ray/src/util/dctimestep.c (file contents):
Revision 2.8 by greg, Sun Jun 21 21:49:13 2009 UTC vs.
Revision 2.11 by greg, Wed Dec 9 20:33:48 2009 UTC

# Line 38 | Line 38 | cm_alloc(int nrows, int ncols)
38          CMATRIX *cm;
39  
40          if ((nrows <= 0) | (ncols <= 0))
41 <                return(NULL);
41 >                error(USER, "attempt to create empty matrix");
42          cm = (CMATRIX *)malloc(sizeof(CMATRIX) +
43                                  3*sizeof(COLORV)*(nrows*ncols - 1));
44          if (cm == NULL)
# Line 294 | Line 294 | static CMATRIX *
294   cm_bsdf(const struct BSDF_data *bsdf)
295   {
296          CMATRIX *cm = cm_alloc(bsdf->nout, bsdf->ninc);
297        COLORV  *mp = cm->cmem;
297          int     nbadohm = 0;
298          int     nneg = 0;
299          int     r, c;
# Line 313 | Line 312 | cm_bsdf(const struct BSDF_data *bsdf)
312  
313                  for (r = 0; r < cm->nrows; r++) {
314                          float   f = BSDF_value(bsdf,c,r);
315 +                        COLORV  *mp = cm_lval(cm,r,c);
316  
317                          if (f <= .0) {
318                                  nneg += (f < -FTINY);
319                                  f = .0f;
320                          }
321                        mp = cm_lval(cm,r,c);
321                          mp[0] = mp[1] = mp[2] = f * dom;
322                  }
323          }
# Line 405 | Line 404 | sum_images(const char *fspec, const CMATRIX *cv)
404          return(fflush(stdout) == 0);
405   }
406  
407 < /* check to see if a string contains a %d specification */
408 < int
409 < hasDecimalSpec(const char *s)
407 > /* check to see if a string contains a %d or %o specification */
408 > static int
409 > hasNumberFormat(const char *s)
410   {
411          while (*s && *s != '%')
412                  s++;
# Line 417 | Line 416 | hasDecimalSpec(const char *s)
416                  ++s;
417          while (isdigit(*s));
418  
419 <        return(*s == 'd');
419 >        return(*s == 'd' | *s == 'i' | *s == 'o' | *s == 'x' | *s == 'X');
420   }
421  
422   int
# Line 448 | Line 447 | main(int argc, char *argv[])
447          free_BSDF(btdf);
448          cvec = cm_multiply(Tmat, ivec);         /* cvec = component vector */
449          cm_free(Tmat); cm_free(ivec);
450 <        if (hasDecimalSpec(argv[1])) {          /* generating image */
450 >        if (hasNumberFormat(argv[1])) {         /* generating image */
451                  SET_FILE_BINARY(stdout);
452                  newheader("RADIANCE", stdout);
453                  printargs(argc, argv, stdout);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines