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.

RiFoo( ...parameterlist... )<br />

could be called in the following ways:<br />

RtColor colors;<br />

RtPoint points;<br />

RtFloat one float;<br />

RtToken tokens[3];<br />

RtPointer values[3];<br />

RiFoo ( RI NULL);<br />

RiFoo ((RtToken)”P”, (RtPointer)points, (RtToken)”Cs”, (RtPointer)colors,<br />

(RtToken)”Kd”, (RtPointer)&one float, RI NULL);<br />

RiFoo (RI P, (RtPointer)points, RI CS, (RtPointer)colors,<br />

RI KD, (RtPointer)&one float, RI NULL);<br />

tokens[0] = RI P; values[0] = (RtPointer)points;<br />

tokens[1] = RI CS; values[1] = (RtPointer)colors;<br />

tokens[2] = RI KD; values[2] = (RtPointer)&one float;<br />

RiFooV ( 3, tokens, values);<br />

It is not the intent of this document to propose that other language bindings use an identical<br />

mechanism for passing parameter lists. For example, a Fortran or Pascal binding might<br />

pass parameters using four arguments: an integer indicating the length of the parameter<br />

list, an array of that length that contains the tokens, an array of the same length containing<br />

integer indices into the final array containing the real values. A Common Lisp binding<br />

would be particularly simple because it has intrinsic support for variable length argument<br />

lists.<br />

<strong>The</strong>re may be more than one rendering context. This would allow a program to, for example,<br />

output to mutiple RIB files. <strong>RenderMan</strong> <strong>Interface</strong> procedure calls apply to the currently<br />

active context. At any one time, there is at most one globally active rendering context. <strong>The</strong><br />

<strong>RenderMan</strong> <strong>Interface</strong> is not intended to be reentrant. In other words, the active context is<br />

truly global to a program process, and there cannot be have multiple simultaneous threads<br />

in one process, each with a different active context. Following is an example of writing<br />

to multiple contexts, in which a sphere is written to one RIB file and a cylinder is written<br />

to a different RIB file (the semantics of the context switching routines are presented in<br />

Section 4).<br />

RtContextHandle ctx1, ctx2;<br />

RiBegin (”file1.rib”);<br />

ctx1 = RiGetContext ( );<br />

RiBegin (”file2.rib”);<br />

ctx2 = RiGetContext ( );<br />

...<br />

RiContext (ctx1);<br />

RiSphere (1, -1, 1, 360, RI NULL);<br />

RiContext (ctx2);<br />

RiCylinder (1, -1, 1, 360, RI NULL);<br />

RiEnd ( ); /* Ends context 2 */<br />

9

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

Saved successfully!

Ooh no, something went wrong!