The RenderMan Interface - Paul Bourke
The RenderMan Interface - Paul Bourke
The RenderMan Interface - Paul Bourke
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
In the following sections the syntax for each encoding is presented as a sequence of bytes<br />
separated by ‘|’ symbols. Numeric values should interpreted as octal values (base 8) if<br />
they have a leading ‘0’ digit, otherwise as decimal values. Items shown in angle brackets<br />
‘< >’ represent varying items, such as a numeric value or string that is being encoded.<br />
Integers and fixed-point numbers. Integer and fixed-point values can be transmitted in<br />
2-5 bytes. <strong>The</strong> encoded token has the form:<br />
0200 + (d · 4) + w | <br />
where the next w + 1 bytes form a signed integer taken from the most significant byte to<br />
the least significant byte, and the bottom d bytes are after the decimal point.<br />
Strings. Strings shorter than 16 bytes, say w bytes, can be transmitted with a prefixing<br />
token:<br />
0220 + w | <br />
Other strings must use a prefixing token followed by a variable length string length, and<br />
then followed by the string itself:<br />
0240 + l | | <br />
where l + 1 is the number of bytes needed to specify the length of the string, 0 ≤ l ≤ 3. <strong>The</strong><br />
string length is an unsigned value and is transmitted from most significant byte to least<br />
significant byte. Unlike unencoded strings, there are no escape or special characters in an<br />
encoded string.<br />
Defining strings. For strings that are to be transmitted repeatedly, a string token can be<br />
defined with:<br />
0315 + w | | <br />
where w + 1 is the number of bytes needed to specify the token, (1 or 2), and the string<br />
being defined is transmitted in an encoded or unencoded form. <strong>The</strong> token is an unsigned<br />
value and is transmitted from most significant byte to least significant byte. For efficiency,<br />
the range of tokens defined should be as compact as possible.<br />
Referencing defined strings. To interpolate a string that has previously been defined (as<br />
described above), the following is used:<br />
0317 + w | <br />
where the token refers to the string to be interpolated.<br />
Floating-point values. Floating-point values are transmitted in single-precision or doubleprecision<br />
IEEE format from most significant byte to least significant byte. Single-precision<br />
floating-point values occupy four bytes in the input stream and double-precision values<br />
occupy eight bytes.<br />
Floating point arrays. Aggregates of single-precision floating-point values can be transmitted<br />
with a prefixing token byte. Variable sized arrays are transmitted as a token byte<br />
followed by a variable length array size, and then followed by the array itself:<br />
0310 + l | | <br />
<strong>The</strong> array length is an unsigned value, l + 1 bytes long, and is transmitted from most<br />
178