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.10 by gwlarson, Fri Jan 29 15:33:36 1999 UTC vs.
Revision 3.14 by schorsch, Mon Jun 30 14:59:11 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   */
7  
8 + #include <string.h>
9 +
10   #include "radogl.h"
11   #include "tonemap.h"
12   #include "rhdisp.h"
13   #include "rhdriver.h"
14   #include "rhdobj.h"
15 + #include "rtprocess.h"
16  
17   extern FILE     *sstdout;               /* user standard output */
18  
# Line 53 | Line 53 | typedef struct dobject {
53          struct dobject  *next;          /* next object in list */
54          char    name[64];               /* object name */
55          FVECT   center;                 /* orig. object center */
56 <        FLOAT   radius;                 /* orig. object radius */
56 >        RREAL   radius;                 /* orig. object radius */
57          int     listid;                 /* GL display list identifier */
58          int     nlists;                 /* number of lists allocated */
59 <        int     rtp[3];                 /* associated rtrace process */
59 >        SUBPROC rtp;                    /* associated rtrace process */
60          DLIGHTS *ol;                    /* object lights */
61          FULLXF  xfb;                    /* coordinate transform */
62          short   drawcode;               /* drawing code */
# Line 121 | Line 121 | register DOBJECT       *op;
121          dobjects = ohead.next;
122          if (!foundlink) {
123                  glDeleteLists(op->listid, op->nlists);
124 <                close_process(op->rtp);
124 >                close_process(&(op->rtp));
125          }
126          while (op->xfac)
127                  freestr(op->xfav[--op->xfac]);
128 <        free((char *)op);
128 >        free((void *)op);
129          return(1);
130   }
131  
# Line 300 | Line 300 | ssph_compute()                 /* compute source set from sphere sam
300                                                  /* avg. reflected brightness */
301          d = AVGREFL / (double)ncells;  
302          scalecolor(csum, d);
303 <        if (tmCvColors(&dlightsets->larb, TM_NOCHROM, csum, 1) != TM_E_OK)
303 >        if (tmCvColors(&dlightsets->larb, TM_NOCHROM, &csum, 1) != TM_E_OK)
304                  error(CONSISTENCY, "tone mapping problem in ssph_compute");
305                                          /* greedy light source clustering */
306          while (dlightsets->nl < MAXLIGHTS) {
# Line 340 | Line 340 | ssph_compute()                 /* compute source set from sphere sam
340          d = 1.0/ncells;
341          scalecolor(dlightsets->lamb, d);
342   done:                                   /* clear sphere sample array */
343 <        bzero((char *)ssamp, sizeof(ssamp));
343 >        memset((void *)ssamp, '\0', sizeof(ssamp));
344          return(ncells);
345   }
346  
# Line 407 | Line 407 | int    force;
407                          quit(0);
408          if (!ssph_compute()) {          /* compute light sources from sphere */
409                  dlightsets = dl->next;
410 <                free((char *)dl);
410 >                free((void *)dl);
411                  return(0);
412          }
413          op->ol = dl;
# Line 538 | Line 538 | toomany:
538   dobj_load(oct, nam)             /* create/load an octree object */
539   char    *oct, *nam;
540   {
541        extern char     *getlibpath(), *getpath();
541          char    *fpp, fpath[128];
542          register DOBJECT        *op;
543                                          /* check arguments */
# Line 559 | Line 558 | char   *oct, *nam;
558                  return(0);
559          }
560                                          /* get octree path */
561 <        if ((fpp = getpath(oct, getlibpath(), R_OK)) == NULL) {
561 >        if ((fpp = getpath(oct, getrlibpath(), R_OK)) == NULL) {
562                  sprintf(errmsg, "cannot find octree \"%s\"", oct);
563                  error(COMMAND, errmsg);
564                  return(0);
# Line 582 | Line 581 | char   *oct, *nam;
581                                          /* start rtrace */
582          rtargv[RTARGC-1] = fpath;
583          rtargv[RTARGC] = NULL;
584 <        open_process(op->rtp, rtargv);
584 >        open_process(&(op->rtp), rtargv);
585                                          /* insert into main list */
586          op->next = dobjects;
587          curobj = dobjects = op;
# Line 615 | Line 614 | dobj_cleanup()                         /* free all resources */
614          savedxf(curobj = NULL);
615          while ((lp = dlightsets) != NULL) {
616                  dlightsets = lp->next;
617 <                free((char *)lp);
617 >                free((void *)lp);
618          }
619          return(1);
620   }
# Line 734 | Line 733 | dobj_unmove()                          /* undo last transform change */
733                  return(0);
734          }
735                                          /* hold last transform */
736 <        bcopy((char *)lastxfav, (char *)txfav,
736 >        memcpy((void *)txfav, (void *)lastxfav,
737                          (txfac=lastxfac)*sizeof(char *));
738                                          /* save this transform */
739 <        bcopy((char *)curobj->xfav, (char *)lastxfav,
739 >        memcpy((void *)lastxfav, (void *)curobj->xfav,
740                          (lastxfac=curobj->xfac)*sizeof(char *));
741                                          /* copy back last transform */
742 <        bcopy((char *)txfav, (char *)curobj->xfav,
742 >        memcpy((void *)curobj->xfav, (void *)txfav,
743                          (curobj->xfac=txfac)*sizeof(char *));
744                                          /* set matrices */
745          fullxf(&curobj->xfb, curobj->xfac, curobj->xfav);
# Line 863 | Line 862 | FVECT   rorg, rdir;
862                  VCOPY(darr, rorg); VCOPY(darr+3, rdir);
863          }
864                                  /* trace it */
865 <        if (process(op->rtp, darr, darr, sizeof(double),
865 >        if (process(&(op->rtp), (char *)darr, (char *)darr, sizeof(double),
866                          6*sizeof(double)) != sizeof(double))
867                  error(SYSTEM, "rtrace communication error");
868                                  /* return distance */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines