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.

• conditional execution,<br />

• loops, and<br />

• function calls.<br />

<strong>The</strong>se constructs are all modeled after C. Statement grouping allows a single statement to<br />

be replaced with a sequence of statements.<br />

{<br />

}<br />

stmt;<br />

...<br />

stmt;<br />

Any variables declared within such a brace-delimited series of statements are only visible<br />

within that block. In other words, variables follow the same local scoping rules as in the C<br />

language.<br />

Conditional execution is controlled by<br />

if ( boolean expression ) stmt else stmt<br />

<strong>The</strong>re are two loop statements,<br />

and<br />

while ( boolean expression ) stmt<br />

for ( expr ; boolean expression ; expr ) stmt<br />

A boolean expression is an expression involving a relational operator, one of: , =, ==, and !=. It is not legal to use an arbitrary float, point or color expression directly<br />

as a boolean expression to control execution. A boolean expression can not be used as a<br />

floating point expression.<br />

<strong>The</strong><br />

and<br />

break [n]<br />

continue [n]<br />

statements cause either the for or the while loop at level n to be exited or to begin the next<br />

iteration. <strong>The</strong> default value for n is 1 and refers to the immediately enclosing loop.<br />

Built-in and user-progrmamed functions are called just as in C. <strong>The</strong><br />

return expr<br />

statement is used to return a value to the caller. Any functions that do not return a value<br />

should be declared as void, just as in ANSI C, and should not contain a return statement.<br />

126

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

Saved successfully!

Ooh no, something went wrong!