--- ray/src/ot/writeoct.c 1992/07/13 15:43:33 2.2 +++ ray/src/ot/writeoct.c 2003/03/14 21:27:46 2.4 @@ -1,9 +1,6 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +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. * @@ -16,18 +13,16 @@ static char SCCSid[] = "$SunId$ LBL"; #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); @@ -56,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); } @@ -124,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]); }