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

Comparing ray/src/common/readmesh.c (file contents):
Revision 2.2 by greg, Fri Mar 14 21:27:46 2003 UTC vs.
Revision 2.6 by greg, Fri Jun 20 00:25:49 2003 UTC

# Line 6 | Line 6 | static const char RCSid[] = "$Id$";
6   */
7  
8   #include  "standard.h"
9 + #include  "platform.h"
10   #include  "octree.h"
11   #include  "object.h"
12   #include  "mesh.h"
13 + #include  "resolu.h"
14  
15   static char     *meshfn;        /* input file name */
16   static FILE     *meshfp;        /* mesh file pointer */
# Line 73 | Line 75 | gettree()                              /* get a pre-ordered octree */
75          register int  i;
76          
77          switch (getc(meshfp)) {
78 <        case OT_EMPTY:
79 <                return(EMPTY);
80 <        case OT_FULL:
81 <                return(getfullnode());
82 <        case OT_TREE:
83 <                if ((ot = octalloc()) == EMPTY)
84 <                        mesherror(SYSTEM, "out of tree space in readmesh");
85 <                for (i = 0; i < 8; i++)
86 <                        octkid(ot, i) = gettree();
87 <                return(ot);
88 <        case EOF:
89 <                mesherror(USER, "truncated mesh octree");
90 <        default:
91 <                mesherror(USER, "damaged mesh octree");
78 >                case OT_EMPTY:
79 >                        return(EMPTY);
80 >                case OT_FULL:
81 >                        return(getfullnode());
82 >                case OT_TREE:
83 >                        if ((ot = octalloc()) == EMPTY)
84 >                                mesherror(SYSTEM, "out of tree space in readmesh");
85 >                        for (i = 0; i < 8; i++)
86 >                                octkid(ot, i) = gettree();
87 >                        return(ot);
88 >                case EOF:
89 >                        mesherror(USER, "truncated mesh octree");
90 >                default:
91 >                        mesherror(USER, "damaged mesh octree");
92          }
93 +        return NULL; /* pro forma return */
94   }
95  
96  
# Line 130 | Line 133 | register MESHPATCH     *pp;
133          pp->nverts = mgetint(2);
134          if (pp->nverts <= 0 || pp->nverts > 256)
135                  mesherror(USER, "bad number of patch vertices");
136 <        pp->xyz = (uint4 (*)[3])malloc(pp->nverts*3*sizeof(uint4));
136 >        pp->xyz = (uint32 (*)[3])malloc(pp->nverts*3*sizeof(uint32));
137          if (pp->xyz == NULL)
138                  goto nomem;
139          if (flags & MT_N) {
140 <                pp->norm = (int4 *)calloc(pp->nverts, sizeof(int4));
140 >                pp->norm = (int32 *)calloc(pp->nverts, sizeof(int32));
141                  if (pp->norm == NULL)
142                          goto nomem;
143          } else
144                  pp->norm = NULL;
145          if (flags & MT_UV) {
146 <                pp->uv = (uint4 (*)[2])calloc(pp->nverts, 2*sizeof(uint4));
146 >                pp->uv = (uint32 (*)[2])calloc(pp->nverts, 2*sizeof(uint32));
147                  if (pp->uv == NULL)
148                          goto nomem;
149          } else
# Line 176 | Line 179 | register MESHPATCH     *pp;
179                  pp->tri = NULL;
180                                          /* local triangle material(s) */
181          if (mgetint(2) > 1) {
182 <                pp->trimat = (int2 *)malloc(pp->ntris*sizeof(int2));
182 >                pp->trimat = (int16 *)malloc(pp->ntris*sizeof(int16));
183                  if (pp->trimat == NULL)
184                          goto nomem;
185                  for (i = 0; i < pp->ntris; i++)
# Line 244 | Line 247 | int    flags;
247                  sprintf(errmsg, "cannot open mesh file \"%s\"", path);
248                  error(SYSTEM, errmsg);
249          }
250 < #ifdef MSDOS
248 <        setmode(fileno(meshfp), O_BINARY);
249 < #endif
250 >        SET_FILE_BINARY(meshfp);
251                                          /* read header */
252          checkheader(meshfp, MESHFMT, flags&IO_INFO ? stdout : (FILE *)NULL);
253                                          /* read format number */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines