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

Comparing ray/src/hd/rhdobj.c (file contents):
Revision 3.20 by greg, Fri May 20 02:06:39 2011 UTC vs.
Revision 3.22 by greg, Fri Feb 28 05:18:49 2020 UTC

# Line 102 | Line 102 | getdobj(                       /* get object from list by name */
102          char    *nm
103   )
104   {
105 <        register DOBJECT        *op;
105 >        DOBJECT *op;
106  
107          if (nm == NULL)
108                  return(NULL);
# Line 117 | Line 117 | getdobj(                       /* get object from list by name */
117  
118   static int
119   freedobj(                       /* free resources and memory assoc. with op */
120 <        register DOBJECT        *op
120 >        DOBJECT *op
121   )
122   {
123          int     foundlink = 0;
124          DOBJECT ohead;
125 <        register DOBJECT        *opl;
125 >        DOBJECT *opl;
126  
127          if (op == NULL)
128                  return(0);
# Line 135 | Line 135 | freedobj(                      /* free resources and memory assoc. with o
135          dobjects = ohead.next;
136          if (!foundlink) {
137                  glDeleteLists(op->listid, op->nlists);
138 <                close_process(&(op->rtp));
138 >                close_process(&op->rtp);
139          }
140          while (op->xfac)
141                  freestr(op->xfav[--op->xfac]);
# Line 146 | Line 146 | freedobj(                      /* free resources and memory assoc. with o
146  
147   static int
148   savedxf(                        /* save transform for display object */
149 <        register DOBJECT        *op
149 >        DOBJECT *op
150   )
151   {
152                                          /* free old */
# Line 174 | Line 174 | ssph_sample(   /* add sample to current source sphere */
174   {
175          COLOR   col;
176          double  d;
177 <        register int    alt, azi;
177 >        int     alt, azi;
178  
179          if (dlightsets == NULL)
180                  return;
# Line 213 | Line 213 | ssph_direc(    /* compute sphere sampling direction */
213  
214   static int
215   ssph_neigh(             /* neighbor counter on sphere */
216 <        register int    sp[2],
216 >        int     sp[2],
217          int     next
218   )
219   {
220          static short    nneigh = 0;             /* neighbor count */
221          static short    neighlist[NAZI+6][2];   /* neighbor list (0 is home) */
222 <        register int    i;
222 >        int     i;
223  
224          if (next) {
225                  if (nneigh <= 0)
# Line 286 | Line 286 | ssph_compute(void)                     /* compute source set from sphere
286          FVECT   v;
287          double  d, thresh, maxbr;
288          int     maxalt, maxazi, spos[2];
289 <        register int    alt, azi;
290 <        register struct lsource *ls;
289 >        int     alt, azi;
290 >        struct lsource  *ls;
291                                          /* count & average sampled cells */
292          setcolor(csum, 0., 0., 0.);
293          ncells = nsamps = 0;
# Line 368 | Line 368 | done:                                  /* clear sphere sample array */
368  
369   static int
370   getdlights(             /* get lights for display object */
371 <        register DOBJECT        *op,
371 >        DOBJECT *op,
372          int     force
373   )
374   {
375          double  d2, mind2 = FHUGE*FHUGE;
376          FVECT   ocent;
377          VIEW    cvw;
378 <        register DLIGHTS        *dl;
378 >        DLIGHTS *dl;
379  
380          op->ol = NULL;
381          if (op->drawcode != DO_LIGHT)
# Line 451 | Line 451 | cmderror(              /* report command error */
451   }
452  
453  
454 < extern int
454 > int
455   dobj_command(           /* run object display command */
456          char    *cmd,
457 <        register char   *args
457 >        char    *args
458   )
459   {
460          int     somechange = 0;
461          int     cn, na;
462 <        register int    nn;
462 >        int     nn;
463          char    *alist[MAXAC+1], *nm;
464                                          /* find command */
465          for (cn = 0; cn < DO_NCMDS; cn++)
# Line 561 | Line 561 | toomany:
561   }
562  
563  
564 < extern int
564 > int
565   dobj_load(              /* create/load an octree object */
566          char    *oct,
567          char    *nam
568   )
569   {
570          char    *fpp, fpath[128];
571 <        register DOBJECT        *op;
571 >        DOBJECT *op;
572                                          /* check arguments */
573          if (oct == NULL) {
574                  error(COMMAND, "missing octree");
# Line 610 | Line 610 | dobj_load(             /* create/load an octree object */
610                                          /* start rtrace */
611          rtargv[RTARGC-1] = fpath;
612          rtargv[RTARGC] = NULL;
613 <        open_process(&(op->rtp), rtargv);
613 >        op->rtp = sp_inactive;
614 >        open_process(&op->rtp, rtargv);
615                                          /* insert into main list */
616          op->next = dobjects;
617          curobj = dobjects = op;
# Line 619 | Line 620 | dobj_load(             /* create/load an octree object */
620   }
621  
622  
623 < extern int
623 > int
624   dobj_unload(                    /* free the named object */
625          char    *nam
626   )
627   {
628 <        register DOBJECT        *op;
628 >        DOBJECT *op;
629  
630          if ((op = getdobj(nam)) == NULL) {
631                  error(COMMAND, "no object");
# Line 636 | Line 637 | dobj_unload(                   /* free the named object */
637   }
638  
639  
640 < extern int
640 > int
641   dobj_cleanup(void)                              /* free all resources */
642   {
643 <        register DLIGHTS        *lp;
643 >        DLIGHTS *lp;
644  
645          while (dobjects != NULL)
646                  freedobj(dobjects);
# Line 652 | Line 653 | dobj_cleanup(void)                             /* free all resources */
653   }
654  
655  
656 < extern int
656 > int
657   dobj_xform(             /* set/add transform for nam */
658          char    *nam,
659          int     rel,
# Line 660 | Line 661 | dobj_xform(            /* set/add transform for nam */
661          char    **av
662   )
663   {
664 <        register DOBJECT        *op;
664 >        DOBJECT *op;
665          FVECT   cent;
666          double  rad;
667          char    scoord[16];
# Line 717 | Line 718 | dobj_xform(            /* set/add transform for nam */
718   }
719  
720  
721 < extern int
721 > int
722   dobj_putstats(                  /* put out statistics for nam */
723          char    *nam,
724          FILE    *fp
725   )
726   {
727          FVECT   ocent;
728 <        register DOBJECT        *op;
729 <        register int    i;
728 >        DOBJECT *op;
729 >        int     i;
730  
731          if (nam == NULL) {
732                  error(COMMAND, "no current object");
# Line 760 | Line 761 | dobj_putstats(                 /* put out statistics for nam */
761   }
762  
763  
764 < extern int
764 > int
765   dobj_unmove(void)                               /* undo last transform change */
766   {
767          int     txfac;
# Line 787 | Line 788 | dobj_unmove(void)                              /* undo last transform change */
788   }
789  
790  
791 < extern int
791 > int
792   dobj_dup(                       /* duplicate object oldnm as nam */
793          char    *oldnm,
794          char    *nam
795   )
796   {
797 <        register DOBJECT        *op, *opdup;
797 >        DOBJECT *op, *opdup;
798                                          /* check arguments */
799          if ((op = getdobj(oldnm)) == NULL) {
800                  error(COMMAND, "no object");
# Line 829 | Line 830 | dobj_dup(                      /* duplicate object oldnm as nam */
830   }
831  
832  
833 < extern int
833 > int
834   dobj_lighting(          /* set up lighting for display object */
835          char    *nam,
836          int     cn
# Line 837 | Line 838 | dobj_lighting(         /* set up lighting for display object
838   {
839          int     i, res[2];
840          VIEW    *dv;
841 <        register DOBJECT        *op;
841 >        DOBJECT *op;
842  
843          if (nam == NULL) {
844                  error(COMMAND, "no current object");
# Line 869 | Line 870 | dobj_lighting(         /* set up lighting for display object
870   }
871  
872  
873 < extern double
873 > double
874   dobj_trace(     /* check for ray intersection with object(s) */
875          char    nm[],
876          FVECT  rorg,
877          FVECT  rdir
878   )
879   {
880 <        register DOBJECT        *op;
880 >        DOBJECT *op;
881          FVECT   xorg, xdir;
882          double  darr[6];
883                                          /* check each visible object? */
# Line 908 | Line 909 | dobj_trace(    /* check for ray intersection with object(
909                  VCOPY(darr, rorg); VCOPY(darr+3, rdir);
910          }
911                                  /* trace it */
912 <        if (process(&(op->rtp), (char *)darr, (char *)darr, sizeof(double),
912 >        if (process(&op->rtp, (char *)darr, (char *)darr, sizeof(double),
913                          6*sizeof(double)) != sizeof(double))
914                  error(SYSTEM, "rtrace communication error");
915                                  /* return distance */
# Line 918 | Line 919 | dobj_trace(    /* check for ray intersection with object(
919   }
920  
921  
922 < extern int
922 > int
923   dobj_render(void)                       /* render our objects in OpenGL */
924   {
925          int     nrendered = 0;
926          GLboolean       normalizing;
927          GLfloat vec[4];
928          FVECT   v1;
929 <        register DOBJECT        *op;
930 <        register int    i;
929 >        DOBJECT *op;
930 >        int     i;
931                                          /* anything to render? */
932          for (op = dobjects; op != NULL; op = op->next)
933                  if (op->drawcode != DO_HIDE)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines