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

Comparing ray/src/rt/virtuals.c (file contents):
Revision 2.6 by gwlarson, Mon Aug 10 18:37:06 1998 UTC vs.
Revision 2.11 by schorsch, Mon Jul 21 22:30:19 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Routines for simulating virtual light sources
6   *      Thus far, we only support planar mirrors.
7 + *
8 + *  External symbols declared in source.h
9   */
10  
11 + #include "copyright.h"
12 +
13   #include  "ray.h"
14  
14 #include  "octree.h"
15
15   #include  "otypes.h"
16  
17   #include  "source.h"
# Line 23 | Line 22 | static char SCCSid[] = "$SunId$ SGI";
22   #define  STESTMAX       32              /* maximum seeks per sample */
23  
24  
26 double  getdisk();
27
25   static OBJECT  *vobject;                /* virtual source objects */
26   static int  nvobjects = 0;              /* number of virtual source objects */
27  
28  
29 + void
30   markvirtuals()                  /* find and mark virtual sources */
31   {
32          register OBJREC  *o;
# Line 37 | Line 35 | markvirtuals()                 /* find and mark virtual sources */
35          if (directrelay <= 0)
36                  return;
37                                          /* find virtual source objects */
38 <        for (i = 0; i < nobjects; i++) {
38 >        for (i = 0; i < nsceneobjs; i++) {
39                  o = objptr(i);
40                  if (!issurface(o->otype) || o->omod == OVOID)
41                          continue;
# Line 51 | Line 49 | markvirtuals()                 /* find and mark virtual sources */
49                  if (nvobjects == 0)
50                          vobject = (OBJECT *)malloc(sizeof(OBJECT));
51                  else
52 <                        vobject = (OBJECT *)realloc((char *)vobject,
52 >                        vobject = (OBJECT *)realloc((void *)vobject,
53                                  (unsigned)(nvobjects+1)*sizeof(OBJECT));
54                  if (vobject == NULL)
55                          error(SYSTEM, "out of memory in addvirtuals");
# Line 66 | Line 64 | markvirtuals()                 /* find and mark virtual sources */
64          for (i = nsources; i-- > 0; )
65                  addvirtuals(i, directrelay);
66                                          /* done with our object list */
67 <        free((char *)vobject);
67 >        free((void *)vobject);
68          nvobjects = 0;
69   }
70  
71  
72 + void
73   addvirtuals(sn, nr)             /* add virtuals associated with source */
74   int  sn;
75   int  nr;
# Line 88 | Line 87 | int  nr;
87   }
88  
89  
90 + void
91   vproject(o, sn, n)              /* create projected source(s) if they exist */
92   OBJREC  *o;
93   int  sn;
# Line 194 | Line 194 | MAT4  pm;
194                  else
195                          nsflags &= ~SSPOT;
196                  if (source[sn].sflags & SSPOT) {
197 <                        copystruct(&theirspot, source[sn].sl.s);
197 >                        theirspot = *(source[sn].sl.s);
198                          multv3(theirspot.aim, source[sn].sl.s->aim, pm);
199                          normalize(theirspot.aim);
200                          if (nsflags & SSPOT) {
# Line 204 | Line 204 | MAT4  pm;
204                                          return(-1);     /* no overlap */
205                          } else {
206                                  nsflags |= SSPOT;
207 <                                copystruct(&ourspot, &theirspot);
207 >                                ourspot = theirspot;
208                                  d = 2.*ourspot.siz;
209                          }
210                          if (ourspot.siz < d-FTINY) {    /* it shrunk */
# Line 244 | Line 244 | MAT4  pm;
244          if (nsflags & SSPOT) {
245                  if ((source[i].sl.s = (SPOT *)malloc(sizeof(SPOT))) == NULL)
246                          goto memerr;
247 <                copystruct(source[i].sl.s, &ourspot);
247 >                *(source[i].sl.s) = ourspot;
248          }
249          if (nsflags & SPROX)
250                  source[i].sl.prox = source[sn].sl.prox;
# Line 395 | Line 395 | register int  sn;      /* target source number */
395          
396  
397   #ifdef DEBUG
398 + void
399   virtverb(sn, fp)        /* print verbose description of virtual source */
400   register int  sn;
401   FILE  *fp;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines