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

Comparing ray/src/cv/bsdf2klems.c (file contents):
Revision 2.3 by greg, Tue Apr 23 23:19:09 2013 UTC vs.
Revision 2.5 by greg, Thu Apr 25 03:14:52 2013 UTC

# Line 17 | Line 17 | static const char RCSid[] = "$Id$";
17   #include "calcomp.h"
18   #include "bsdfrep.h"
19   #include "bsdf_m.h"
20 +                                /* assumed maximum # Klems patches */
21 + #define MAXPATCHES      145
22                                  /* global argv[0] */
23   char                    *progname;
24                                  /* selected basis function name */
# Line 172 | Line 174 | eval_bsdf(const char *fname)
174                      sum = 0;                    /* average over patches */
175                      for (n = npsamps; n-- > 0; ) {
176                          fo_getvec(vout, j+(n+frandom())/npsamps, abp);
177 <                        fi_getvec(vin, i+(n+frandom())/npsamps, abp);
177 >                        fi_getvec(vin, i+urand(n), abp);
178                          ec = SDevalBSDF(&sv, vout, vin, &bsd);
179                          if (ec != SDEnone)
180                                  goto err;
# Line 193 | Line 195 | eval_bsdf(const char *fname)
195                      sum = 0;                    /* average over patches */
196                      for (n = npsamps; n-- > 0; ) {
197                          bo_getvec(vout, j+(n+frandom())/npsamps, abp);
198 <                        bi_getvec(vin, i+(n+frandom())/npsamps, abp);
198 >                        bi_getvec(vin, i+urand(n), abp);
199                          ec = SDevalBSDF(&sv, vout, vin, &bsd);
200                          if (ec != SDEnone)
201                                  goto err;
# Line 214 | Line 216 | eval_bsdf(const char *fname)
216                      sum = 0;                    /* average over patches */
217                      for (n = npsamps; n-- > 0; ) {
218                          bo_getvec(vout, j+(n+frandom())/npsamps, abp);
219 <                        fi_getvec(vin, i+(n+frandom())/npsamps, abp);
219 >                        fi_getvec(vin, i+urand(n), abp);
220                          ec = SDevalBSDF(&sv, vout, vin, &bsd);
221                          if (ec != SDEnone)
222                                  goto err;
# Line 235 | Line 237 | eval_bsdf(const char *fname)
237                      sum = 0;                    /* average over patches */
238                      for (n = npsamps; n-- > 0; ) {
239                          fo_getvec(vout, j+(n+frandom())/npsamps, abp);
240 <                        bi_getvec(vin, i+(n+frandom())/npsamps, abp);
240 >                        bi_getvec(vin, i+urand(n), abp);
241                          ec = SDevalBSDF(&sv, vout, vin, &bsd);
242                          if (ec != SDEnone)
243                                  goto err;
# Line 263 | Line 265 | eval_function(char *funame)
265          double          sum;
266          int             i, j, n;
267  
268 +        initurand(npsamps);
269          data_prologue();                        /* begin output */
270          for (j = 0; j < abp->nangles; j++) {    /* run through directions */
271              for (i = 0; i < abp->nangles; i++) {
# Line 274 | Line 277 | eval_function(char *funame)
277                          bo_getvec(iovec+3, j+(n+frandom())/npsamps, abp);
278  
279                      if (input_orient > 0)
280 <                        fi_getvec(iovec, i+(n+frandom())/npsamps, abp);
280 >                        fi_getvec(iovec, i+urand(n), abp);
281                      else
282 <                        bi_getvec(iovec, i+(n+frandom())/npsamps, abp);
282 >                        bi_getvec(iovec, i+urand(n), abp);
283  
284                      sum += funvalue(funame, 6, iovec);
285                  }
# Line 291 | Line 294 | eval_function(char *funame)
294   static void
295   eval_rbf(void)
296   {
294 #define MAXPATCHES      145
297          ANGLE_BASIS     *abp = get_basis(kbasis);
298          float           bsdfarr[MAXPATCHES*MAXPATCHES];
299          FVECT           vin, vout;
# Line 332 | Line 334 | eval_rbf(void)
334              putchar('\n');
335          }
336          data_epilogue();                        /* finish output */
335 #undef MAXPATCHES
337   }
338  
339   /* Read in BSDF and interpolate as Klems matrix representation */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines