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.9 by gwlarson, Thu Dec 31 12:57:06 1998 UTC vs.
Revision 3.12 by greg, Tue May 13 17:58:33 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 loading and displaying Radiance objects in rholo with GLX.
6   */
# Line 55 | Line 52 | typedef struct dobject {
52          FVECT   center;                 /* orig. object center */
53          FLOAT   radius;                 /* orig. object radius */
54          int     listid;                 /* GL display list identifier */
55 +        int     nlists;                 /* number of lists allocated */
56          int     rtp[3];                 /* associated rtrace process */
57          DLIGHTS *ol;                    /* object lights */
58          FULLXF  xfb;                    /* coordinate transform */
# Line 119 | Line 117 | register DOBJECT       *op;
117          }
118          dobjects = ohead.next;
119          if (!foundlink) {
120 <                glDeleteLists(op->listid, 1);
120 >                glDeleteLists(op->listid, op->nlists);
121                  close_process(op->rtp);
122          }
123          while (op->xfac)
124                  freestr(op->xfav[--op->xfac]);
125 <        free((char *)op);
125 >        free((void *)op);
126          return(1);
127   }
128  
# Line 299 | Line 297 | ssph_compute()                 /* compute source set from sphere sam
297                                                  /* avg. reflected brightness */
298          d = AVGREFL / (double)ncells;  
299          scalecolor(csum, d);
300 <        if (tmCvColors(&dlightsets->larb, TM_NOCHROM, csum, 1) != TM_E_OK)
300 >        if (tmCvColors(&dlightsets->larb, TM_NOCHROM, &csum, 1) != TM_E_OK)
301                  error(CONSISTENCY, "tone mapping problem in ssph_compute");
302                                          /* greedy light source clustering */
303          while (dlightsets->nl < MAXLIGHTS) {
# Line 339 | Line 337 | ssph_compute()                 /* compute source set from sphere sam
337          d = 1.0/ncells;
338          scalecolor(dlightsets->lamb, d);
339   done:                                   /* clear sphere sample array */
340 <        bzero((char *)ssamp, sizeof(ssamp));
340 >        bzero((void *)ssamp, sizeof(ssamp));
341          return(ncells);
342   }
343  
# Line 406 | Line 404 | int    force;
404                          quit(0);
405          if (!ssph_compute()) {          /* compute light sources from sphere */
406                  dlightsets = dl->next;
407 <                free((char *)dl);
407 >                free((void *)dl);
408                  return(0);
409          }
410          op->ol = dl;
# Line 537 | Line 535 | toomany:
535   dobj_load(oct, nam)             /* create/load an octree object */
536   char    *oct, *nam;
537   {
540        extern char     *getlibpath(), *getpath();
538          char    *fpp, fpath[128];
539          register DOBJECT        *op;
540                                          /* check arguments */
# Line 558 | Line 555 | char   *oct, *nam;
555                  return(0);
556          }
557                                          /* get octree path */
558 <        if ((fpp = getpath(oct, getlibpath(), R_OK)) == NULL) {
558 >        if ((fpp = getpath(oct, getrlibpath(), R_OK)) == NULL) {
559                  sprintf(errmsg, "cannot find octree \"%s\"", oct);
560                  error(COMMAND, errmsg);
561                  return(0);
# Line 577 | Line 574 | char   *oct, *nam;
574                                          /* load octree into display list */
575          dolights = 0;
576          domats = 1;
577 <        op->listid = rgl_octlist(fpath, op->center, &op->radius);
577 >        op->listid = rgl_octlist(fpath, op->center, &op->radius, &op->nlists);
578                                          /* start rtrace */
579          rtargv[RTARGC-1] = fpath;
580          rtargv[RTARGC] = NULL;
# Line 614 | Line 611 | dobj_cleanup()                         /* free all resources */
611          savedxf(curobj = NULL);
612          while ((lp = dlightsets) != NULL) {
613                  dlightsets = lp->next;
614 <                free((char *)lp);
614 >                free((void *)lp);
615          }
616          return(1);
617   }
# Line 733 | Line 730 | dobj_unmove()                          /* undo last transform change */
730                  return(0);
731          }
732                                          /* hold last transform */
733 <        bcopy((char *)lastxfav, (char *)txfav,
733 >        bcopy((void *)lastxfav, (void *)txfav,
734                          (txfac=lastxfac)*sizeof(char *));
735                                          /* save this transform */
736 <        bcopy((char *)curobj->xfav, (char *)lastxfav,
736 >        bcopy((void *)curobj->xfav, (void *)lastxfav,
737                          (lastxfac=curobj->xfac)*sizeof(char *));
738                                          /* copy back last transform */
739 <        bcopy((char *)txfav, (char *)curobj->xfav,
739 >        bcopy((void *)txfav, (void *)curobj->xfav,
740                          (curobj->xfac=txfac)*sizeof(char *));
741                                          /* set matrices */
742          fullxf(&curobj->xfb, curobj->xfac, curobj->xfav);
# Line 862 | Line 859 | FVECT   rorg, rdir;
859                  VCOPY(darr, rorg); VCOPY(darr+3, rdir);
860          }
861                                  /* trace it */
862 <        if (process(op->rtp, darr, darr, sizeof(double),
862 >        if (process(op->rtp, (char *)darr, (char *)darr, sizeof(double),
863                          6*sizeof(double)) != sizeof(double))
864                  error(SYSTEM, "rtrace communication error");
865                                  /* return distance */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines