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

Comparing ray/src/rt/rv3.c (file contents):
Revision 2.41 by greg, Wed Nov 7 18:34:58 2018 UTC vs.
Revision 2.44 by greg, Wed Nov 15 18:02:53 2023 UTC

# Line 15 | Line 15 | static const char      RCSid[] = "$Id$";
15   #include  "rpaint.h"
16   #include  "otypes.h"
17   #include  "otspecial.h"
18 #include  "source.h"
18   #include  "random.h"
19  
20   #ifndef WFLUSH
# Line 92 | Line 91 | getinterest(           /* get area of interest */
91          double  *mp
92   )
93   {
95        int  x, y;
96        RAY  thisray;
97        int  i;
98
94          if (sscanf(s, "%lf", mp) != 1)
95                  *mp = 1.0;
96          else if (*mp < -FTINY)          /* negative zoom is reduction */
# Line 105 | Line 100 | getinterest(           /* get area of interest */
100                  return(-1);
101          }
102          if (!sscanvec(sskip(s), vec)) {
103 +                RAY  thisray;
104 +                int  x, y;
105                  if (dev->getcur == NULL)
106                          return(-1);
107                  (*dev->comout)("Pick view center\n");
# Line 116 | Line 113 | getinterest(           /* get area of interest */
113                          return(-1);
114                  }
115                  if (!direc || ourview.type == VT_PAR) {
116 +                        int     weakhit = 0;
117 +                        FVECT   weakpt;
118                          rayorigin(&thisray, PRIMARY, NULL, NULL);
119                          while (localhit(&thisray, &thescene)) {
120 <                                OBJREC  *m = findmaterial(thisray.ro);
121 <                                if (m != NULL && !istransp(m->otype) &&
122 <                                                !isBSDFproxy(m) &&
123 <                                                (thisray.clipset == NULL ||
124 <                                                        !inset(thisray.clipset,
125 <                                                            thisray.ro->omod)))
126 <                                        break;          /* found something */
120 >                                OBJREC  *m = NULL;
121 >                                if (thisray.clipset == NULL ||
122 >                                                !inset(thisray.clipset,
123 >                                                            thisray.ro->omod))
124 >                                        m = findmaterial(thisray.ro);
125 >                                if ((m != NULL) & !weakhit &&
126 >                                                istransp(m->otype) &&
127 >                                                m->otype != MAT_MIST) {
128 >                                        weakhit = 1;
129 >                                        VCOPY(weakpt, thisray.rop);
130 >                                } else if (m != NULL && !istransp(m->otype) &&
131 >                                                !isBSDFproxy(m))
132 >                                        break;          /* something solid */
133                                  VCOPY(thisray.rorg, thisray.rop);
134                                  rayclear(&thisray);     /* skip invisible */
135                          }
136 <                        if (thisray.ro == NULL) {
137 <                                error(COMMAND, "not a local object");
138 <                                return(-1);
136 >                        if ((thisray.ro == NULL) | (thisray.ro == &Aftplane)) {
137 >                                if (!weakhit) {
138 >                                        error(COMMAND, "not a local object");
139 >                                        return(-1);
140 >                                }                       /* else use weak obj. */
141 >                                VCOPY(thisray.rop, weakpt);
142                          }
143                  }
144                  if (direc)
145                          if (ourview.type == VT_PAR)
146 <                                for (i = 0; i < 3; i++)
139 <                                        vec[i] = thisray.rop[i] - ourview.vp[i];
146 >                                VSUB(vec, thisray.rop, ourview.vp);
147                          else
148                                  VCOPY(vec, thisray.rdir);
149                  else
150                          VCOPY(vec, thisray.rop);
151          } else if (direc) {
152 <                for (i = 0; i < 3; i++)
146 <                        vec[i] -= ourview.vp[i];
152 >                VSUB(vec, vec, ourview.vp);
153                  if (normalize(vec) == 0.0) {
154                          error(COMMAND, "point at view origin");
155                          return(-1);
# Line 207 | Line 213 | paint(                 /* compute and paint a rectangle */
213          
214          if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, &ourview,
215                          h/hresolu, v/vresolu)) < -FTINY) {
216 <                setcolor(thisray.rcol, 0.0, 0.0, 0.0);
216 >                scolorblack(thisray.rcol);
217          } else if (!ray_pnprocs) {              /* immediate mode */
218                  ray_trace(&thisray);
219          } else {                                /* queuing mode */
# Line 223 | Line 229 | paint(                 /* compute and paint a rectangle */
229                  p = (PNODE *)thisray.rno;
230          }
231  
232 <        copycolor(p->v, thisray.rcol);
232 >        scolor_color(p->v, thisray.rcol);
233          scalecolor(p->v, exposure);
234  
235          recolor(p);                             /* paint it */
# Line 265 | Line 271 | waitrays(void)                                 /* finish up pending rays */
271                  return(0);
272          while ((rval = ray_presult(&raydone, 0)) > 0) {
273                  PNODE  *p = (PNODE *)raydone.rno;
274 <                copycolor(p->v, raydone.rcol);
274 >                scolor_color(p->v, raydone.rcol);
275                  scalecolor(p->v, exposure);
276                  recolor(p);
277                  nwaited++;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines