ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/rt/rxfluxmtx.cpp
(Generate patch)

Comparing ray/src/rt/rxfluxmtx.cpp (file contents):
Revision 2.2 by greg, Thu Oct 23 01:26:48 2025 UTC vs.
Revision 2.3 by greg, Thu Oct 23 16:33:39 2025 UTC

# Line 82 | Line 82 | struct PARAMS {
82          int             (*sample_basis)(PARAMS *p, int b, FVECT orig_dir[]);
83   };
84  
85 < PARAMS          curparams;
86 < char            curmod[MAXSTR];
87 < char            newparams[1024];
85 > static PARAMS           curparams;
86 > static char             curmod[MAXSTR];
87 > static char             newparams[1024];
88  
89   typedef int     SURFSAMP(FVECT, SURF *, double);
90  
91 < SURFSAMP        ssamp_bad, ssamp_poly, ssamp_ring;
91 > static SURFSAMP ssamp_bad, ssamp_poly, ssamp_ring;
92  
93 < SURFSAMP        *orig_in_surf[4] = {
93 > static SURFSAMP *orig_in_surf[4] = {
94                  ssamp_bad, ssamp_poly, ssamp_ring, ssamp_bad
95          };
96  
# Line 99 | Line 99 | double         dstrpix = 0;            // pixel jitter
99   double          dblur = 0;              // depth-of-field
100  
101   /* Clear parameter set */
102 < void
102 > static void
103   clear_params(PARAMS *p, bool reset_only = true)
104   {
105          while (p->slist != NULL) {
# Line 119 | Line 119 | clear_params(PARAMS *p, bool reset_only = true)
119   }
120  
121   /* Get surface type from name */
122 < int
122 > static int
123   surf_type(const char *otype)
124   {
125          if (!strcmp(otype, "polygon"))
# Line 132 | Line 132 | surf_type(const char *otype)
132   }
133  
134   /* Add arguments to oconv command */
135 < char *
135 > static char *
136   oconv_command(int ac, char *av[])
137   {
138          static char     oconvbuf[4096] = "!oconv -f ";
# Line 179 | Line 179 | overrun:
179   }
180  
181   /* Get normalized direction vector from string specification */
182 < int
182 > static int
183   get_direction(FVECT dv, const char *s)
184   {
185          int     sign = 1;
# Line 219 | Line 219 | nextchar:
219   }
220  
221   /* Parse program parameters (directives) */
222 < int
222 > static int
223   parse_params(PARAMS *p, char *pargs)
224   {
225          char    *cp = pargs;
# Line 298 | Line 298 | parse_params(PARAMS *p, char *pargs)
298   }
299  
300   /* Add receiver modifier and associated parameters */
301 < void
301 > static void
302   finish_receiver()
303   {
304          bool            uniform = false;
# Line 412 | Line 412 | finish_receiver()
412   }
413  
414   /* Make randomly oriented tangent plane axes for given normal direction */
415 < void
415 > static void
416   make_axes(FVECT uva[2], const FVECT nrm)
417   {
418          int     i;
# Line 423 | Line 423 | make_axes(FVECT uva[2], const FVECT nrm)
423   }
424  
425   /* Illegal sender surfaces end up here */
426 < int
426 > static int
427   ssamp_bad(FVECT orig, SURF *sp, double x)
428   {
429          sprintf(errmsg, "illegal sender surface '%s'", sp->sname);
# Line 432 | Line 432 | ssamp_bad(FVECT orig, SURF *sp, double x)
432   }
433  
434   /* Generate origin on ring surface from uniform random variable */
435 < int
435 > static int
436   ssamp_ring(FVECT orig, SURF *sp, double x)
437   {
438          FVECT   *uva = (FVECT *)sp->priv;
# Line 460 | Line 460 | ssamp_ring(FVECT orig, SURF *sp, double x)
460   }
461  
462   /* Add triangle to polygon's list (call-back function) */
463 < int
463 > static int
464   add_triangle(const Vert2_list *tp, int a, int b, int c)
465   {
466          POLYTRIS        *ptp = (POLYTRIS *)tp->p;
# Line 473 | Line 473 | add_triangle(const Vert2_list *tp, int a, int b, int c
473   }
474  
475   /* Generate origin on polygon surface from uniform random variable */
476 < int
476 > static int
477   ssamp_poly(FVECT orig, SURF *sp, double x)
478   {
479          POLYTRIS        *ptp = (POLYTRIS *)sp->priv;
# Line 545 | Line 545 | memerr:
545   }
546  
547   /* Compute sample origin based on projected areas of sender subsurfaces */
548 < int
548 > static int
549   sample_origin(PARAMS *p, FVECT orig, const FVECT rdir, double x)
550   {
551          static double   *projsa;
# Line 586 | Line 586 | sample_origin(PARAMS *p, FVECT orig, const FVECT rdir,
586   }
587  
588   /* Uniform sample generator */
589 < int
589 > static int
590   sample_uniform(PARAMS *p, int b, FVECT orig_dir[])
591   {
592          int     n = myRCmanager.accum;
# Line 613 | Line 613 | sample_uniform(PARAMS *p, int b, FVECT orig_dir[])
613   }
614  
615   /* Shirly-Chiu sample generator */
616 < int
616 > static int
617   sample_shirchiu(PARAMS *p, int b, FVECT orig_dir[])
618   {
619          int     n = myRCmanager.accum;
# Line 641 | Line 641 | sample_shirchiu(PARAMS *p, int b, FVECT orig_dir[])
641   }
642  
643   /* Reinhart/Tregenza sample generator */
644 < int
644 > static int
645   sample_reinhart(PARAMS *p, int b, FVECT orig_dir[])
646   {
647   #define T_NALT  7
# Line 691 | Line 691 | sample_reinhart(PARAMS *p, int b, FVECT orig_dir[])
691   }
692  
693   /* Klems sample generator */
694 < int
694 > static int
695   sample_klems(PARAMS *p, int b, FVECT orig_dir[])
696   {
697          static const char       bname[4][20] = {
# Line 739 | Line 739 | sample_klems(PARAMS *p, int b, FVECT orig_dir[])
739   }
740  
741   /* Prepare hemisphere basis sampler that will send rays to rcontrib */
742 < int
742 > static int
743   prepare_sampler(PARAMS *p)
744   {
745          if (p->slist == NULL) {         /* missing sample surface! */
# Line 821 | Line 821 | unrecognized:
821   }
822  
823   /* Compute normal and area for polygon */
824 < int
824 > static int
825   finish_polygon(SURF *p)
826   {
827          const int       nv = p->nfargs / 3;
# Line 843 | Line 843 | finish_polygon(SURF *p)
843   }
844  
845   /* Add a surface to our current parameters */
846 < void
846 > static void
847   add_surface(int st, const char *oname, FILE *fp)
848   {
849          SURF    *snew;
# Line 919 | Line 919 | badnorm:
919   }
920  
921   /* Parse a receiver object (look for modifiers to add) */
922 < int
922 > static int
923   add_recv_object(FILE *fp)
924   {
925          int             st;
# Line 955 | Line 955 | add_recv_object(FILE *fp)
955   }
956  
957   /* Parse a sender object */
958 < int
958 > static int
959   add_send_object(FILE *fp)
960   {
961          int             st;
# Line 995 | Line 995 | add_send_object(FILE *fp)
995   }
996  
997   /* Load a Radiance scene using the given callback function for objects */
998 < int
998 > static int
999   load_scene(const char *inspec, int (*ocb)(FILE *))
1000   {
1001          int     rv = 0;
# Line 1087 | Line 1087 | eputs(                         /* put string to stderr */
1087   }
1088  
1089   /* set input/output format */
1090 < void
1090 > static void
1091   setformat(const char *fmt)
1092   {
1093          switch (fmt[0]) {
# Line 1127 | Line 1127 | fmterr:
1127          error(USER, errmsg);
1128   }
1129  
1130 < inline double
1130 > static inline double
1131   pixjitter()
1132   {
1133          return(0.5 + dstrpix*(frandom()-0.5));
# Line 1135 | Line 1135 | pixjitter()
1135  
1136   // Compute a set of view rays for the given pixel accumulator
1137   bool
1138 < viewRays(FVECT orig_dir[], int x, int y)
1138 > viewRayBundle(FVECT orig_dir[], int x, int y)
1139   {
1140          for (int n = 0; n < myRCmanager.accum; orig_dir += 2, n++) {
1141                  const double    d = viewray(orig_dir[0], orig_dir[1], &ourview,
# Line 1160 | Line 1160 | viewRays(FVECT orig_dir[], int x, int y)
1160  
1161   // Load a set of rays for accumulation (do not normalize direction)
1162   int
1163 < getRays(FVECT orig_dir[])
1163 > getRayBundle(FVECT orig_dir[])
1164   {
1165          int     n;
1166                                                  // read directly if possible
# Line 1198 | Line 1198 | getRays(FVECT orig_dir[])
1198   }
1199  
1200   /* Set default options */
1201 < void
1201 > static void
1202   default_options()
1203   {
1204          rand_samp = 1;
# Line 1216 | Line 1216 | default_options()
1216   }
1217  
1218   /* Set overriding options */
1219 < void
1219 > static void
1220   override_options()
1221   {
1222          shadthresh = 0;
# Line 1549 | Line 1549 | main(int argc, char *argv[])
1549                  for (i = myRCmanager.yres; i--; )       // from the top!
1550                          for (int x = 0; x < myRCmanager.xres; x++) {
1551                                  report_progress();
1552 <                                if (!viewRays(rayarr, x, i))
1552 >                                if (!viewRayBundle(rayarr, x, i))
1553                                          quit(1);
1554                                  if (myRCmanager.ComputeRecord(rayarr) != myRCmanager.accum)
1555                                          error(USER, "failed call to ComputeRecord()");
# Line 1568 | Line 1568 | main(int argc, char *argv[])
1568                  }
1569                  for (i = 0; i < myRCmanager.GetRowMax(); i++) {
1570                          report_progress();
1571 <                        if (getRays(rayarr) != myRCmanager.accum) {
1571 >                        if (getRayBundle(rayarr) != myRCmanager.accum) {
1572                                  sprintf(errmsg, "ray read error after %d of %d",
1573                                                  myRCmanager.GetRowCount(),
1574                                                  myRCmanager.GetRowMax());

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)