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

Comparing ray/src/common/rglinst.c (file contents):
Revision 3.4 by gwlarson, Wed Sep 2 18:42:11 1998 UTC vs.
Revision 3.10 by schorsch, Thu Jun 26 00:58:09 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 reading instances and converting to OpenGL.
6   */
7  
8 + #include "copyright.h"
9 +
10   #include "radogl.h"
11   #include "octree.h"
12 + #include "platform.h"
13  
14   #define MAXLEVEL        16              /* maximum instance hierarchy level */
15  
# Line 20 | Line 20 | typedef struct {
20          char    octfile[256];                   /* octree file path */
21   } OCTINST;                              /* octree to instantiate */
22  
23 OBJECT  nobjects;                       /* number of objects loaded so far */
24
25 extern int      free();
26
23   static double  ogetflt();
24   static long  ogetint();
25   static char  *ogetstr();
26 < static int  loadobj(), octerror(), skiptree();
26 > static int  loadobj();
27 > static void  skiptree();
28 > static void  octerror();
29   static OCTINST  *getoct();
30  
31   static char  *infn;                     /* input file name */
# Line 41 | Line 39 | static LUTAB   imtab = {imhash,NULL,NULL,NULL,0,NULL,0};
39   static LUTAB    ottab = LU_SINIT(free,free);
40  
41  
42 + int
43   o_instance(o)                           /* convert instance to list call */
44   register OBJREC *o;
45   {
# Line 69 | Line 68 | register OBJREC        *o;
68          }
69          ot = getoct(o->oargs.sarg[0]);  /* get octree reference */
70          if (ot->localmatl &= o->os != NULL)     /* set material */
71 <                setmaterial(o->os, ot->cent, 0);
71 >                setmaterial((MATREC *)o->os, ot->cent, 0);
72                                          /* call the assigned list */
73          glCallList(ot->listid);
74  
# Line 79 | Line 78 | register OBJREC        *o;
78                  glPopAttrib();
79          }
80          rgl_checkerr("creating instance");
81 +        return(0);
82   }
83  
84  
# Line 124 | Line 124 | static OCTINST *
124   getoct(name)                            /* get/assign octree list id */
125   char    *name;
126   {
127        extern char     *getpath(), *getlibpath();
127          char    *path;
128          register LUENT  *lp;
129          register OCTINST        *op;
# Line 138 | Line 137 | char   *name;
137                  strcpy(lp->key, name);
138          }
139          if ((op = (OCTINST *)lp->data) == NULL) {
140 <                path = getpath(name, getlibpath(), R_OK);
140 >                path = getpath(name, getrlibpath(), R_OK);
141                  if (path == NULL) {
142                          sprintf(errmsg, "cannot find octree \"%s\"", name);
143                          error(USER, errmsg);
# Line 170 | Line 169 | FVECT  cent;
169                  sprintf(errmsg, "cannot open octree file \"%s\"", fname);
170                  error(SYSTEM, errmsg);
171          }
172 < #ifdef MSDOS
174 <        setmode(fileno(infp), O_BINARY);
175 < #endif
172 >        SET_FILE_BINARY(infp);
173                                          /* get header */
174          if (checkheader(infp, OCTFMT, NULL) < 0)
175                  octerror(USER, "not an octree");
# Line 197 | Line 194 | FVECT  cent;
194   }
195  
196  
197 + int
198   loadoct(fname)                          /* read in objects from octree */
199   char  *fname;
200   {
# Line 208 | Line 206 | char  *fname;
206          
207          infn = fname;
208          infp = fopen(fname, "r");       /* assume already checked */
209 < #ifdef MSDOS
212 <        setmode(fileno(infp), O_BINARY);
213 < #endif
209 >        SET_FILE_BINARY(infp);
210                                          /* skip header */
211          getheader(infp, NULL, NULL);
212                                          /* get format */
# Line 286 | Line 282 | ogetflt()                      /* get a floating point number */
282   }
283          
284  
285 < static
285 > static void
286   skiptree()                              /* skip octree on input */
287   {
288          register int  i;
# Line 311 | Line 307 | skiptree()                             /* skip octree on input */
307   }
308  
309  
310 < static
310 > static int
311   loadobj()                               /* get next object */
312   {
313          static OBJREC    ob;
# Line 360 | Line 356 | loadobj()                              /* get next object */
356   #endif
357                                          /* get real arguments */
358          if (ob.oargs.nfargs = ogetint(2)) {
359 <                ob.oargs.farg = (FLOAT *)malloc
360 <                                (ob.oargs.nfargs*sizeof(FLOAT));
359 >                ob.oargs.farg = (RREAL *)malloc
360 >                                (ob.oargs.nfargs*sizeof(RREAL));
361                  if (ob.oargs.farg == NULL)
362                          goto memerr;
363                  for (i = 0; i < ob.oargs.nfargs; i++)
# Line 384 | Line 380 | memerr:
380   }
381  
382  
383 < static
383 > static void
384   octerror(etyp, msg)                     /* octree error */
385   int  etyp;
386   char  *msg;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines