--- ray/src/ot/writeoct.c 2003/02/22 02:07:26 2.3 +++ ray/src/ot/writeoct.c 2003/03/14 21:27:46 2.4 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: writeoct.c,v 2.3 2003/02/22 02:07:26 greg Exp $"; +static const char RCSid[] = "$Id: writeoct.c,v 2.4 2003/03/14 21:27:46 greg Exp $"; #endif /* * writeoct.c - routines for writing octree information to stdout. @@ -13,18 +13,16 @@ static const char RCSid[] = "$Id: writeoct.c,v 2.3 200 #include "object.h" -#include "otypes.h" +static int oputint(), oputstr(), puttree(); -static int oputint(), oputstr(), puttree(), putobj(); - writeoct(store, scene, ofn) /* write octree structures to stdout */ int store; CUBE *scene; char *ofn[]; { char sbuf[64]; - register int i; + int i; /* write format number */ oputint((long)(OCTMAGIC+sizeof(OBJECT)), 2); @@ -53,12 +51,7 @@ char *ofn[]; if (store & IO_FILES || !(store & IO_SCENE)) return; /* write the scene */ - for (i = 0; i < NUMOTYPE; i++) - oputstr(ofun[i].funame); - oputstr(""); - for (i = 0; i < nobjects; i++) - putobj(objptr(i)); - putobj(NULL); + writescene(0, nobjects, stdout); } @@ -121,31 +114,4 @@ register OCTREE ot; putfullnode(ot); /* write fullnode */ } else putc(OT_EMPTY, stdout); /* indicate empty */ -} - - -static -putobj(o) /* write out object */ -register OBJREC *o; -{ - register int i; - - if (o == NULL) { /* terminator */ - oputint(-1L, 1); - return; - } - oputint((long)o->otype, 1); - oputint((long)o->omod, sizeof(OBJECT)); - oputstr(o->oname); - oputint((long)o->oargs.nsargs, 2); - for (i = 0; i < o->oargs.nsargs; i++) - oputstr(o->oargs.sarg[i]); -#ifdef IARGS - oputint((long)o->oargs.niargs, 2); - for (i = 0; i < o->oargs.niargs; i++) - oputint((long)o->oargs.iarg[i], 4); -#endif - oputint((long)o->oargs.nfargs, 2); - for (i = 0; i < o->oargs.nfargs; i++) - oputflt(o->oargs.farg[i]); }