1 |
+ |
# RCSid $Id$ |
2 |
|
# *Radiance* File Formats |
3 |
|
This chapter discusses the standard file formats specific to *Radiance*, and gives their internal structure, with pointers to routines for reading and writing them. The following file formats (listed with their conventional suffixes) are covered: |
4 |
|
|
50 |
|
|
51 |
|
!xform -n chair1 -t 10 5 8 chair.rad |
52 |
|
|
53 |
< |
The command is executed during file parsing, and its output is read as more input. Long commands may be continued on multiple lines by escaping the newline character with a backslash ('\'): |
53 |
> |
The command is executed during file parsing, and its output is read as more input. Long commands may be continued on multiple lines by escaping the newline character with a backslash ('\\'): |
54 |
|
|
55 |
|
!gensurf marble sink '15.5+x(theta(s),phi(t))' \ |
56 |
|
'10.5+y(theta(s),phi(t))' \ |
258 |
|
: surface normal |
259 |
|
|
260 |
|
`Px, Py, Pz` |
261 |
< |
:intersection point |
261 |
> |
: intersection point |
262 |
|
|
263 |
|
`T` |
264 |
|
: distance from start |
523 |
|
**Table 4.** Programs in the *Radiance* distribution that read and write font files. |
524 |
|
|
525 |
|
### *Radiance* C Library |
526 |
< |
Similar to data files, font files are usually read and stored in a lookup table. The data structures for fonts are in src/common/font.h, and the routines for reading and spacing them are in `src/common/font.c`. The main structure type is `FONT`. The routine `getfont(fname)` loads a font file from the *Radiance* library (set by the `RAYPATH` environment variable), and returns a pointer to the resulting `FONT` structure. If the file has been previously loaded, a pointer to the stored structure is returned. The `freefont(fname)` routine frees memory associated with the named font file and deletes it from the table, or frees all font data if `fname` is `NULL`. |
526 |
> |
Similar to data files, font files are usually read and stored in a lookup table. The data structures for fonts are in `src/common/font.h`, and the routines for reading and spacing them are in `src/common/font.c`. The main structure type is `FONT`. The routine `getfont(fname)` loads a font file from the *Radiance* library (set by the `RAYPATH` environment variable), and returns a pointer to the resulting `FONT` structure. If the file has been previously loaded, a pointer to the stored structure is returned. The `freefont(fname)` routine frees memory associated with the named font file and deletes it from the table, or frees all font data if `fname` is `NULL`. |
527 |
|
|
528 |
|
Three different routines are available for text spacing. The `uniftext(sp,tp,f`) function takes the nul-terminated string `tp` and computes uniform per-character spacing for the font `f`, returned in the short integer array `sp`. (This is a fairly simple process, and all spacing values will be 255 unless a character has no corresponding glyph.) The `squeeztext(sp,tp,f,cis)` performs a similar function, but puts only `ci`s units between adjacent characters, based on the actual width of each font glyph. The most sophisticated spacing function is `proptext(sp,tp,f,cis,nsi)`, which produces a total line length equal to what it would be with uniform spacing, while maintaining equal inter-character spacing throughout (i.e., proportional spacing). The `nsi` argument is the number of spaces (zero-vertex glyphs) considered as an indent. That is, if this many or more adjacent spaces occur in `tp`, the indented text following will appear at the same point as it would have had the spacing been uniform. This maintains columns in tabulated text despite the proportional spacing. Tabs are not understood or interpreted by any of these routines, and must be expanded to the appropriate number of spaces via **expand**. |
529 |
|
|
609 |
|
**Table 5.** Programs in the *Radiance* distribution that read and write octree files. |
610 |
|
|
611 |
|
### *Radiance* C Library |
612 |
< |
Since reading an octree file also may involve reading a *Radiance* scene description, some of the same library routines are called indirectly. The header file `src/common/octree.h` is needed in addition to the `src/common/object.`h file. The module `src/ot/writeoct.c` contains the main routines for writing an octree to stdout, while `src/common/readoct.c` contains the corresponding routines for reading an octree from a file. Both modules access routines in `src/common/portio.c` for reading and writing portable binary data. |
612 |
> |
Since reading an octree file also may involve reading a *Radiance* scene description, some of the same library routines are called indirectly. The header file `src/common/octree.h` is needed in addition to the `src/common/object.h` file. The module `src/ot/writeoct.c` contains the main routines for writing an octree to stdout, while `src/common/readoct.c` contains the corresponding routines for reading an octree from a file. Both modules access routines in `src/common/portio.c` for reading and writing portable binary data. |
613 |
|
|
614 |
|
Here is the main call for writing out an octree: |
615 |
|
|
793 |
|
: Macro** | puts real exposure value `ex` to stream `fp`. |
794 |
|
|
795 |
|
`iscolcor(s)` |
796 |
< |
:Macro returns non-zero if the line `s` is a `COLORCORR` setting. |
796 |
> |
: Macro returns non-zero if the line `s` is a `COLORCORR` setting. |
797 |
|
|
798 |
|
`colcorval(cc,s)` |
799 |
|
: Macro assign color correction value from line `s` in the `COLOR` |