26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Arrays<br />

<strong>The</strong> characters ‘[’ and ‘]’ are self-delimiting tokens that specify the construction of an array<br />

of numbers or strings. An array cannot contain both numbers and strings. If an array<br />

contains at least one floating point value, all integer values in the array are converted to<br />

floating point. Arrays of numbers are used, for example, to specify matrices and points.<br />

Arrays of strings are used in specifying options.<br />

Binary encoding<br />

For efficiency, compressed binary encodings of many types of data are also supported.<br />

<strong>The</strong>se encodings may be freely intermixed with the normal ASCII strings. <strong>The</strong> two encodings<br />

are differentiated by the top bit of the eight-bit bytes in the input stream. If the top bit<br />

is zero, then the byte is interpreted as a 7-bit ASCII character. Otherwise, if the top bit is<br />

one, the byte is interpreted as a compressed token according to the rules given below. This<br />

differentiation is not applied within string constants or the parameter bytes which follow<br />

the initial byte of a compressed token. Table C.1 shows the encoding for compressed tokens<br />

with all byte values displayed in octal.<br />

Values Span Interpreted as...<br />

0–0177 128 ASCII characters<br />

0200–0217 16 encoded integers and fixed-point numbers<br />

0220–0237 16 encoded strings of no more than 15 characters<br />

0240–0243 4 encoded strings longer than 15 characters<br />

0244 1 encoded single precision IEEE floating point value<br />

0245 1 encoded double precision IEEE floating point value<br />

0246 1 encoded RI request<br />

0247–0307 32 nothing (reserved)<br />

0310–0313 4 encoded single precision array (length follows)<br />

0314 1 define encoded request<br />

0315–0316 2 define encoded string token<br />

0317–0320 2 interpolate defined string<br />

0321–0377 46 nothing (reserved)<br />

Table C.1: Binary Encoding<br />

Four separate data types are supported: signed integers, signed fixed-point numbers, strings,<br />

and floating-point numbers. Integers and fixed-point numbers are encoded using a single<br />

format while strings are encoded with two different formats according to the length of<br />

the string. Both single- and double-precision IEEE format floating-point numbers are supported.<br />

Strings that are used repeatedly can be defined and then subsequently referenced<br />

with a compact form that is usually more space efficient.<br />

Arrays of floating-point values are directly supported for efficiency (they can also be specified<br />

using the array definition symbols). Single-precision matrices (arrays of 16 floatingpoint<br />

values) can be specified in a total of 66 bytes, while other arrays may require slightly<br />

more.<br />

177

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!