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.

typedef RtPointer<br />

typedef RtPointer<br />

RtLightHandle;<br />

RtContextHandle;<br />

All procedures and values defined in the interface are prefixed with Ri (for <strong>RenderMan</strong><br />

<strong>Interface</strong>). All types are prefixed with Rt (for <strong>RenderMan</strong> type). Boolean values are either<br />

RI FALSE or RI TRUE. Special floating point values RI INFINITY and RI EPSILON are defined.<br />

<strong>The</strong> expression −RI INFINITY has the obvious meaning. <strong>The</strong> number of components<br />

in a color is initially three, but can be changed (See the section Additional options, p. 33). A<br />

bound is a bounding box and is specified by 6 floating point values in the order xmin, xmax,<br />

ymin, ymax, zmin, zmax. A matrix is an array of 16 numbers describing a 4 by 4 transformation<br />

matrix. All multidimensional arrays are specified in row-major order, and points<br />

are assumed to be represented as row vectors, not column vectors. For example, a 4 by 4<br />

translation matrix to the location (2,3,4) is specified with<br />

{ { 1.0, 0.0, 0.0, 0.0},<br />

{ 0.0, 1.0, 0.0, 0.0},<br />

{ 0.0, 0.0, 1.0, 0.0},<br />

{ 2.0, 3.0, 4.0, 1.0} }<br />

Tokens are strings that have a special meaning to procedures implementing the interface.<br />

<strong>The</strong>se meanings are described with each procedure. <strong>The</strong> capabilities of the <strong>RenderMan</strong> <strong>Interface</strong><br />

can be extended by defining new tokens and passing them to various procedures.<br />

<strong>The</strong> most important of these are the tokens identifying variables defined by procedures<br />

called shaders, written in the Shading Language. Variables passed through the Render-<br />

Man <strong>Interface</strong> are bound by name to shader variables. To make the standard predeclared<br />

tokens and user-defined tokens similar, <strong>RenderMan</strong> <strong>Interface</strong> tokens are represented by<br />

strings. Associated with each of the standard predefined tokens, however, is a predefined<br />

string constant that the <strong>RenderMan</strong> <strong>Interface</strong> procedures can use for efficient parsing. <strong>The</strong><br />

names of these string constants are derived from the token names used in this document<br />

by prepending an RI to a capitalized version of the string. For example, the predefined<br />

constant token for ”rgb” is RI RGB. <strong>The</strong> special predefined token RI NULL is used to specify<br />

a null token.<br />

In the C binding presented in this document, parameters are passed by value or by reference.<br />

C implementations of the <strong>RenderMan</strong> <strong>Interface</strong> are expected to make copies of any<br />

parameters whose values are to be retained across procedure invocations.<br />

Many procedures in the <strong>RenderMan</strong> <strong>Interface</strong> have variable length parameter lists. <strong>The</strong>se<br />

are indicated by the syntactical construct ...parameterlist... in the procedure’s argument list.<br />

In the C binding described, a parameterlist is a sequence of pairs of arguments, the first being<br />

an RtToken and the second being an RtPointer, an untyped pointer to an array of either<br />

RtFloat, RtString or other values. <strong>The</strong> list is terminated by the special token RI NULL.<br />

In addition, each such procedure has an alternate vector interface, which passes the parameterlist<br />

as three arguments: an RtInt indicating the length of the parameter list; an array of that<br />

length that contains the RtTokens; and another array of the same length that contains the<br />

RtPointers. This alternate procedure is denoted by appending an uppercase V to the procedure<br />

name.<br />

For example the procedure RiFoo declared as<br />

8

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

Saved successfully!

Ooh no, something went wrong!