Back to index

radiance  4R0+20100331
Functions | Variables
writeoct.c File Reference
#include "standard.h"
#include "octree.h"
#include "object.h"
#include "oconv.h"

Go to the source code of this file.

Functions

static void oputstr (char *s)
static void putfullnode (OCTREE fn)
static void oputint (long i, int siz)
static void oputflt (double f)
static void puttree (OCTREE ot)
void writeoct (int store, CUBE *scene, char *ofn[])
static void oputstr (register char *s)
static void oputint (register long i, register int siz)
static void puttree (register OCTREE ot)

Variables

static const char RCSid [] = "$Id: writeoct.c,v 2.7 2004/11/09 16:09:20 greg Exp $"

Function Documentation

static void oputflt ( double  f) [static]

Definition at line 107 of file writeoct.c.

{
       putflt(f, stdout);
       if (ferror(stdout))
              error(SYSTEM, "write error in putflt");
}

Here is the call graph for this function:

static void oputint ( long  i,
int  siz 
) [static]

Here is the caller graph for this function:

static void oputint ( register long  i,
register int  siz 
) [static]

Definition at line 95 of file writeoct.c.

{
       putint(i, siz, stdout);
       if (ferror(stdout))
              error(SYSTEM, "write error in putint");
}

Here is the call graph for this function:

static void oputstr ( char *  s) [static]

Here is the caller graph for this function:

static void oputstr ( register char *  s) [static]

Definition at line 70 of file writeoct.c.

{
       putstr(s, stdout);
       if (ferror(stdout))
              error(SYSTEM, "write error in putstr");
}

Here is the call graph for this function:

static void putfullnode ( OCTREE  fn) [static]

Definition at line 81 of file writeoct.c.

{
       OBJECT  oset[MAXSET+1];
       register int  i;

       objset(oset, fn);
       for (i = 0; i <= oset[0]; i++)
              oputint((long)oset[i], sizeof(OBJECT));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void puttree ( OCTREE  ot) [static]
static void puttree ( register OCTREE  ot) [static]

Definition at line 118 of file writeoct.c.

{
       register int  i;
       
       if (istree(ot)) {
              putc(OT_TREE, stdout);             /* indicate tree */
              for (i = 0; i < 8; i++)            /* write tree */
                     puttree(octkid(ot, i));
       } else if (isfull(ot)) {
              putc(OT_FULL, stdout);             /* indicate fullnode */
              putfullnode(ot);            /* write fullnode */
       } else
              putc(OT_EMPTY, stdout);            /* indicate empty */
}

Here is the call graph for this function:

void writeoct ( int  store,
CUBE scene,
char *  ofn[] 
)

Definition at line 29 of file writeoct.c.

{
       char  sbuf[64];
       int  i;
                                   /* write format number */
       oputint((long)(OCTMAGIC+sizeof(OBJECT)), 2);

       if (!(store & IO_BOUNDS))
              return;
                                   /* write boundaries */
       for (i = 0; i < 3; i++) {
              sprintf(sbuf, "%.12g", scene->cuorg[i]);
              oputstr(sbuf);
       }
       sprintf(sbuf, "%.12g", scene->cusize);
       oputstr(sbuf);
                                   /* write object file names */
       if (store & IO_FILES)
              for (i = 0; ofn[i] != NULL; i++)
                     oputstr(ofn[i]);
       oputstr("");
                                   /* write number of objects */
       oputint((long)nobjects, sizeof(OBJECT));

       if (!(store & IO_TREE))
              return;
                                   /* write the octree */
       puttree(scene->cutree);

       if (store & IO_FILES || !(store & IO_SCENE))
              return;
                                   /* write the scene */
       writescene(0, nobjects, stdout);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char RCSid[] = "$Id: writeoct.c,v 2.7 2004/11/09 16:09:20 greg Exp $" [static]

Definition at line 2 of file writeoct.c.