Back to index

radiance  4R0+20100331
Typedefs | Functions
oconv.h File Reference
#include "octree.h"
#include "object.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void ro_cbfunc (OBJREC *o)

Functions

void ot_initotypes (void)
void writeoct (int store, CUBE *scene, char *ofn[])
void add2bbox (OBJREC *o, FVECT bbmin, FVECT bbmax)
void readobj2 (char *input, ro_cbfunc callback)

Typedef Documentation

typedef void ro_cbfunc(OBJREC *o)

Definition at line 26 of file oconv.h.


Function Documentation

void add2bbox ( OBJREC o,
FVECT  bbmin,
FVECT  bbmax 
)
void ot_initotypes ( void  )

Definition at line 22 of file initotypes.c.

Here is the caller graph for this function:

void readobj2 ( char *  input,
ro_cbfunc  callback 
)

Definition at line 25 of file readobj2.c.

{
       char  *fgetline();
       FILE  *infp;
       char  buf[2048];
       register int  c;

       if (input == NULL) {
              infp = stdin;
              input = "standard input";
       } else if (input[0] == '!') {
              if ((infp = popen(input+1, "r")) == NULL) {
                     sprintf(errmsg, "cannot execute \"%s\"", input);
                     error(SYSTEM, errmsg);
              }
       } else if ((infp = fopen(input, "r")) == NULL) {
              sprintf(errmsg, "cannot open scene file \"%s\"", input);
              error(SYSTEM, errmsg);
       }
       while ((c = getc(infp)) != EOF) {
              if (isspace(c))
                     continue;
              if (c == '#') {                           /* comment */
                     fgets(buf, sizeof(buf), infp);
              } else if (c == '!') {                    /* command */
                     ungetc(c, infp);
                     fgetline(buf, sizeof(buf), infp);
                     readobj2(buf, callback);
              } else {                           /* object */
                     ungetc(c, infp);
                     getobject2(input, infp, callback);
              }
       }
       if (input[0] == '!')
              pclose(infp);
       else
              fclose(infp);
}

Here is the call graph for this function:

Here is the caller 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: