| 1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* writeoct.c - routines for writing octree information to stdout. |
| 6 |
|
* |
| 13 |
|
|
| 14 |
|
#include "object.h" |
| 15 |
|
|
| 16 |
< |
#include "otypes.h" |
| 16 |
> |
static int oputint(), oputstr(), puttree(); |
| 17 |
|
|
| 21 |
– |
static int oputint(), oputstr(), puttree(), putobj(); |
| 18 |
|
|
| 23 |
– |
|
| 19 |
|
writeoct(store, scene, ofn) /* write octree structures to stdout */ |
| 20 |
|
int store; |
| 21 |
|
CUBE *scene; |
| 22 |
|
char *ofn[]; |
| 23 |
|
{ |
| 24 |
|
char sbuf[64]; |
| 25 |
< |
register int i; |
| 25 |
> |
int i; |
| 26 |
|
/* write format number */ |
| 27 |
|
oputint((long)(OCTMAGIC+sizeof(OBJECT)), 2); |
| 28 |
|
|
| 51 |
|
if (store & IO_FILES || !(store & IO_SCENE)) |
| 52 |
|
return; |
| 53 |
|
/* write the scene */ |
| 54 |
< |
for (i = 0; i < NUMOTYPE; i++) |
| 60 |
< |
oputstr(ofun[i].funame); |
| 61 |
< |
oputstr(""); |
| 62 |
< |
for (i = 0; i < nobjects; i++) |
| 63 |
< |
putobj(objptr(i)); |
| 64 |
< |
putobj(NULL); |
| 54 |
> |
writescene(0, nobjects, stdout); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
|
| 114 |
|
putfullnode(ot); /* write fullnode */ |
| 115 |
|
} else |
| 116 |
|
putc(OT_EMPTY, stdout); /* indicate empty */ |
| 127 |
– |
} |
| 128 |
– |
|
| 129 |
– |
|
| 130 |
– |
static |
| 131 |
– |
putobj(o) /* write out object */ |
| 132 |
– |
register OBJREC *o; |
| 133 |
– |
{ |
| 134 |
– |
register int i; |
| 135 |
– |
|
| 136 |
– |
if (o == NULL) { /* terminator */ |
| 137 |
– |
oputint(-1L, 1); |
| 138 |
– |
return; |
| 139 |
– |
} |
| 140 |
– |
oputint((long)o->otype, 1); |
| 141 |
– |
oputint((long)o->omod, sizeof(OBJECT)); |
| 142 |
– |
oputstr(o->oname); |
| 143 |
– |
oputint((long)o->oargs.nsargs, 2); |
| 144 |
– |
for (i = 0; i < o->oargs.nsargs; i++) |
| 145 |
– |
oputstr(o->oargs.sarg[i]); |
| 146 |
– |
#ifdef IARGS |
| 147 |
– |
oputint((long)o->oargs.niargs, 2); |
| 148 |
– |
for (i = 0; i < o->oargs.niargs; i++) |
| 149 |
– |
oputint((long)o->oargs.iarg[i], 4); |
| 150 |
– |
#endif |
| 151 |
– |
oputint((long)o->oargs.nfargs, 2); |
| 152 |
– |
for (i = 0; i < o->oargs.nfargs; i++) |
| 153 |
– |
oputflt(o->oargs.farg[i]); |
| 117 |
|
} |