1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
88 |
|
if (fnobjects != m) |
89 |
|
octerror(USER, "too many objects"); |
90 |
|
|
91 |
< |
if (load & IO_TREE) { |
92 |
< |
/* get the octree */ |
91 |
> |
if (load & IO_TREE) /* get the octree */ |
92 |
|
scene->cutree = gettree(); |
93 |
< |
if (load & IO_SCENE) /* get the scene */ |
94 |
< |
if (nf == 0) { |
95 |
< |
for (i = 0; *ogetstr(sbuf); i++) |
96 |
< |
if ((otypmap[i] = otype(sbuf)) < 0) { |
97 |
< |
sprintf(errmsg, "unknown type \"%s\"", |
98 |
< |
sbuf); |
99 |
< |
octerror(WARNING, errmsg); |
100 |
< |
} |
101 |
< |
while (getobj() != OVOID) |
102 |
< |
; |
103 |
< |
} else { /* consistency checks */ |
104 |
< |
/* check object count */ |
105 |
< |
if (nobjects != objorig+fnobjects) |
106 |
< |
octerror(USER, "bad object count; octree stale?"); |
107 |
< |
/* check for non-surfaces */ |
108 |
< |
if (nonsurfinset(objorig, fnobjects)) |
109 |
< |
octerror(USER, "modifier in tree; octree stale?"); |
110 |
< |
} |
111 |
< |
} |
93 |
> |
else if (load & IO_SCENE && nf == 0) |
94 |
> |
skiptree(); |
95 |
> |
|
96 |
> |
if (load & IO_SCENE) /* get the scene */ |
97 |
> |
if (nf == 0) { |
98 |
> |
for (i = 0; *ogetstr(sbuf); i++) |
99 |
> |
if ((otypmap[i] = otype(sbuf)) < 0) { |
100 |
> |
sprintf(errmsg, "unknown type \"%s\"", sbuf); |
101 |
> |
octerror(WARNING, errmsg); |
102 |
> |
} |
103 |
> |
while (getobj() != OVOID) |
104 |
> |
; |
105 |
> |
} else { /* consistency checks */ |
106 |
> |
/* check object count */ |
107 |
> |
if (nobjects != objorig+fnobjects) |
108 |
> |
octerror(USER, "bad object count; octree stale?"); |
109 |
> |
/* check for non-surfaces */ |
110 |
> |
if (nonsurfinset(objorig, fnobjects)) |
111 |
> |
octerror(USER, "modifier in tree; octree stale?"); |
112 |
> |
} |
113 |
|
fclose(infp); |
114 |
|
return(nf); |
115 |
|
} |
189 |
|
for (i = 0; i < 8; i++) |
190 |
|
octkid(ot, i) = gettree(); |
191 |
|
return(ot); |
192 |
+ |
case EOF: |
193 |
+ |
octerror(USER, "truncated octree"); |
194 |
+ |
default: |
195 |
+ |
octerror(USER, "damaged octree"); |
196 |
+ |
} |
197 |
+ |
} |
198 |
+ |
|
199 |
+ |
|
200 |
+ |
static |
201 |
+ |
skiptree() /* skip octree on input */ |
202 |
+ |
{ |
203 |
+ |
register int i; |
204 |
+ |
|
205 |
+ |
switch (getc(infp)) { |
206 |
+ |
case OT_EMPTY: |
207 |
+ |
return; |
208 |
+ |
case OT_FULL: |
209 |
+ |
for (i = ogetint(objsize); i-- > 0; ) |
210 |
+ |
ogetint(objsize); |
211 |
+ |
return; |
212 |
+ |
case OT_TREE: |
213 |
+ |
for (i = 0; i < 8; i++) |
214 |
+ |
skiptree(); |
215 |
+ |
return; |
216 |
|
case EOF: |
217 |
|
octerror(USER, "truncated octree"); |
218 |
|
default: |