ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/ot/writeoct.c
(Generate patch)

Comparing ray/src/ot/writeoct.c (file contents):
Revision 2.3 by greg, Sat Feb 22 02:07:26 2003 UTC vs.
Revision 2.5 by schorsch, Sat Mar 27 12:41:45 2004 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char       RCSid[] = "$Id$";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  writeoct.c - routines for writing octree information to stdout.
# Line 10 | Line 10 | static const char      RCSid[] = "$Id$";
10   #include  "standard.h"
11  
12   #include  "octree.h"
13
13   #include  "object.h"
14 + #include  "oconv.h"
15  
16 #include  "otypes.h"
16  
17 < static int  oputint(), oputstr(), puttree(), putobj();
17 > static void oputstr(char *s);
18 > static void putfullnode(OCTREE fn);
19 > static void oputint(long i, int siz);
20 > static void oputflt(double f);
21 > static void puttree(OCTREE ot);
22  
23  
24 < writeoct(store, scene, ofn)             /* write octree structures to stdout */
25 < int  store;
26 < CUBE  *scene;
27 < char  *ofn[];
24 > void
25 > writeoct(               /* write octree structures to stdout */
26 >        int  store,
27 >        CUBE  *scene,
28 >        char  *ofn[]
29 > )
30   {
31          char  sbuf[64];
32 <        register int  i;
32 >        int  i;
33                                          /* write format number */
34          oputint((long)(OCTMAGIC+sizeof(OBJECT)), 2);
35  
# Line 53 | Line 58 | char  *ofn[];
58          if (store & IO_FILES || !(store & IO_SCENE))
59                  return;
60                                          /* write the scene */
61 <        for (i = 0; i < NUMOTYPE; i++)
57 <                oputstr(ofun[i].funame);
58 <        oputstr("");
59 <        for (i = 0; i < nobjects; i++)
60 <                putobj(objptr(i));
61 <        putobj(NULL);
61 >        writescene(0, nobjects, stdout);
62   }
63  
64  
65 < static
66 < oputstr(s)                      /* write null-terminated string to stdout */
67 < register char  *s;
65 > static void
66 > oputstr(                        /* write null-terminated string to stdout */
67 >        register char  *s
68 > )
69   {
70          putstr(s, stdout);
71          if (ferror(stdout))
# Line 72 | Line 73 | register char  *s;
73   }
74  
75  
76 < static
77 < putfullnode(fn)                 /* write out a full node */
78 < OCTREE  fn;
76 > static void
77 > putfullnode(                    /* write out a full node */
78 >        OCTREE  fn
79 > )
80   {
81          OBJECT  oset[MAXSET+1];
82          register int  i;
# Line 85 | Line 87 | OCTREE  fn;
87   }
88  
89  
90 < static
91 < oputint(i, siz)                 /* write a siz-byte integer to stdout */
92 < register long  i;
93 < register int  siz;
90 > static void
91 > oputint(                        /* write a siz-byte integer to stdout */
92 >        register long  i,
93 >        register int  siz
94 > )
95   {
96          putint(i, siz, stdout);
97          if (ferror(stdout))
# Line 96 | Line 99 | register int  siz;
99   }
100  
101  
102 < static
103 < oputflt(f)                      /* put out floating point number */
104 < double  f;
102 > static void
103 > oputflt(                        /* put out floating point number */
104 >        double  f
105 > )
106   {
107          putflt(f, stdout);
108          if (ferror(stdout))
# Line 106 | Line 110 | double  f;
110   }
111  
112  
113 < static
114 < puttree(ot)                     /* write octree to stdout in pre-order form */
115 < register OCTREE  ot;
113 > static void
114 > puttree(                        /* write octree to stdout in pre-order form */
115 >        register OCTREE  ot
116 > )
117   {
118          register int  i;
119          
# Line 121 | Line 126 | register OCTREE  ot;
126                  putfullnode(ot);                /* write fullnode */
127          } else
128                  putc(OT_EMPTY, stdout);         /* indicate empty */
124 }
125
126
127 static
128 putobj(o)                       /* write out object */
129 register OBJREC  *o;
130 {
131        register int  i;
132
133        if (o == NULL) {                /* terminator */
134                oputint(-1L, 1);
135                return;
136        }
137        oputint((long)o->otype, 1);
138        oputint((long)o->omod, sizeof(OBJECT));
139        oputstr(o->oname);
140        oputint((long)o->oargs.nsargs, 2);
141        for (i = 0; i < o->oargs.nsargs; i++)
142                oputstr(o->oargs.sarg[i]);
143 #ifdef  IARGS
144        oputint((long)o->oargs.niargs, 2);
145        for (i = 0; i < o->oargs.niargs; i++)
146                oputint((long)o->oargs.iarg[i], 4);
147 #endif
148        oputint((long)o->oargs.nfargs, 2);
149        for (i = 0; i < o->oargs.nfargs; i++)
150                oputflt(o->oargs.farg[i]);
129   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines