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.3 by schorsch, Thu Jun 5 19:29:34 2003 UTC vs.
Revision 2.12 by greg, Thu Apr 29 14:36:49 2004 UTC

# Line 5 | Line 5 | static const char RCSid[] = "$Id$";
5   *  Routines for reading a compiled mesh from a file
6   */
7  
8 + #include  <time.h>
9 +
10 + #include  "platform.h"
11   #include  "standard.h"
12   #include  "octree.h"
13   #include  "object.h"
14   #include  "mesh.h"
15 + #include  "resolu.h"
16  
17 + #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
18 + #define getc    getc_unlocked
19 + #endif
20 +
21   static char     *meshfn;        /* input file name */
22   static FILE     *meshfp;        /* mesh file pointer */
23   static int      objsize;        /* sizeof(OBJECT) from writer */
# Line 73 | Line 81 | gettree()                              /* get a pre-ordered octree */
81          register int  i;
82          
83          switch (getc(meshfp)) {
84 <        case OT_EMPTY:
85 <                return(EMPTY);
86 <        case OT_FULL:
87 <                return(getfullnode());
88 <        case OT_TREE:
89 <                if ((ot = octalloc()) == EMPTY)
90 <                        mesherror(SYSTEM, "out of tree space in readmesh");
91 <                for (i = 0; i < 8; i++)
92 <                        octkid(ot, i) = gettree();
93 <                return(ot);
94 <        case EOF:
95 <                mesherror(USER, "truncated mesh octree");
96 <        default:
97 <                mesherror(USER, "damaged mesh octree");
84 >                case OT_EMPTY:
85 >                        return(EMPTY);
86 >                case OT_FULL:
87 >                        return(getfullnode());
88 >                case OT_TREE:
89 >                        if ((ot = octalloc()) == EMPTY)
90 >                                mesherror(SYSTEM, "out of tree space in readmesh");
91 >                        for (i = 0; i < 8; i++)
92 >                                octkid(ot, i) = gettree();
93 >                        return(ot);
94 >                case EOF:
95 >                        mesherror(USER, "truncated mesh octree");
96 >                default:
97 >                        mesherror(USER, "damaged mesh octree");
98          }
99 +        return (OCTREE)NULL; /* pro forma return */
100   }
101  
102  
# Line 130 | Line 139 | register MESHPATCH     *pp;
139          pp->nverts = mgetint(2);
140          if (pp->nverts <= 0 || pp->nverts > 256)
141                  mesherror(USER, "bad number of patch vertices");
142 <        pp->xyz = (uint4 (*)[3])malloc(pp->nverts*3*sizeof(uint4));
142 >        pp->xyz = (uint32 (*)[3])malloc(pp->nverts*3*sizeof(uint32));
143          if (pp->xyz == NULL)
144                  goto nomem;
145          if (flags & MT_N) {
146 <                pp->norm = (int4 *)calloc(pp->nverts, sizeof(int4));
146 >                pp->norm = (int32 *)calloc(pp->nverts, sizeof(int32));
147                  if (pp->norm == NULL)
148                          goto nomem;
149          } else
150                  pp->norm = NULL;
151          if (flags & MT_UV) {
152 <                pp->uv = (uint4 (*)[2])calloc(pp->nverts, 2*sizeof(uint4));
152 >                pp->uv = (uint32 (*)[2])calloc(pp->nverts, 2*sizeof(uint32));
153                  if (pp->uv == NULL)
154                          goto nomem;
155          } else
# Line 176 | Line 185 | register MESHPATCH     *pp;
185                  pp->tri = NULL;
186                                          /* local triangle material(s) */
187          if (mgetint(2) > 1) {
188 <                pp->trimat = (int2 *)malloc(pp->ntris*sizeof(int2));
188 >                pp->trimat = (int16 *)malloc(pp->ntris*sizeof(int16));
189                  if (pp->trimat == NULL)
190                          goto nomem;
191                  for (i = 0; i < pp->ntris; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines