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

Comparing ray/src/rt/o_instance.c (file contents):
Revision 1.7 by greg, Fri Jan 19 00:00:17 1990 UTC vs.
Revision 1.8 by greg, Sat Dec 15 15:03:30 1990 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1988 Regents of the University of California */
1 > /* Copyright (c) 1990 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 31 | Line 31 | register RAY  *r;
31          rcont.rno = nrays;
32          rcont.ro = NULL;
33          rcont.rot = FHUGE;
34 <        multp3(rcont.rorg, r->rorg, in->b.xfm);
35 <        multv3(rcont.rdir, r->rdir, in->b.xfm);
34 >        multp3(rcont.rorg, r->rorg, in->x.b.xfm);
35 >        multv3(rcont.rdir, r->rdir, in->x.b.xfm);
36          for (i = 0; i < 3; i++)
37 <                rcont.rdir[i] /= in->b.sca;
37 >                rcont.rdir[i] /= in->x.b.sca;
38                                          /* trace it */
39          if (!localhit(&rcont, &in->obj->scube))
40                  return(0);              /* missed */
41 <        if (rcont.rot * in->f.sca >= r->rot)
41 >        if (rcont.rot * in->x.f.sca >= r->rot)
42                  return(0);              /* not close enough */
43  
44          if (o->omod != OVOID) {         /* if we have modifier, use it */
45                  r->ro = o;
46 <                r->rofs = 1.0; setident4(r->rofx);
47 <                r->robs = 1.0; setident4(r->robx);
46 >                r->rox = NULL;
47          } else {                        /* else use theirs */
48                  r->ro = rcont.ro;
49 <                multmat4(r->rofx, rcont.rofx, in->f.xfm);
50 <                r->rofs = rcont.rofs * in->f.sca;
51 <                multmat4(r->robx, in->b.xfm, rcont.robx);
52 <                r->robs = in->b.sca * rcont.robs;
49 >                newrayxf(r);            /* allocate transformation */
50 >                                /* NOTE: r->rox may equal rcont.rox! */
51 >                if (rcont.rox != NULL) {
52 >                        multmat4(r->rox->f.xfm, rcont.rox->f.xfm, in->x.f.xfm);
53 >                        r->rox->f.sca = rcont.rox->f.sca * in->x.f.sca;
54 >                        multmat4(r->rox->b.xfm, in->x.b.xfm, rcont.rox->b.xfm);
55 >                        r->rox->b.sca = in->x.b.sca * rcont.rox->b.sca;
56 >                } else
57 >                        copystruct(r->rox, &in->x);
58          }
59                                          /* transform it back */
60 <        r->rot = rcont.rot * in->f.sca;
61 <        multp3(r->rop, rcont.rop, in->f.xfm);
62 <        multv3(r->ron, rcont.ron, in->f.xfm);
60 >        r->rot = rcont.rot * in->x.f.sca;
61 >        multp3(r->rop, rcont.rop, in->x.f.xfm);
62 >        multv3(r->ron, rcont.ron, in->x.f.xfm);
63          for (i = 0; i < 3; i++)
64 <                r->ron[i] /= in->f.sca;
64 >                r->ron[i] /= in->x.f.sca;
65          r->rod = rcont.rod;
66                                          /* return hit */
67          return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines