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 */ |
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 |
|
|
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 */ |