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.
15.5 String Functions<br />
string concat ( string a, b, ... )<br />
Concatenates two or more strings into a single string.<br />
void printf ( string pattern, val1, val2,..., valn )<br />
Print the values of the specified variables on the standard output stream of the renderer<br />
(much like the printf function in C. pattern uses ”%f”, ”%p”, ”%c”, ”%m”, and ”%s”<br />
to indicate float, point, color, matrix, and string, respectively. A vector or normal may<br />
also be printed using ”%p”.<br />
string format ( string pattern, val1, val2,..., valn )<br />
Does a formatted string creation under the control of pattern. This function is similar<br />
to the C function sprintf(). As with the Shading Language printf function, ”%f”, ”%p”,<br />
”%c”, ”%m”, and ”%s” to indicate float, point, color, matrix, and string, respectively.<br />
float match ( string pattern, subject )<br />
Does a string pattern match on subject. Returns 1.0 if the pattern exists anywhere<br />
within subject, and 0.0 if the pattern does not exist within subject. pattern can be<br />
any regular expression, as described in the POSIX manual page on regex()(3X), with<br />
the following exception: the $n notation does not work, as there are no return values<br />
from this function. Note that the pattern does not need to start in the first character of<br />
the subject string, unless the pattern begins with the ˆ (beginning of string) character.<br />
15.6 Shading and Lighting Functions<br />
In this section, built-in shading and lighting functions are defined.<br />
color<br />
ambient()<br />
ambient returns the total amount of ambient light incident upon the surface. An<br />
ambient light source is one in which there is no directional component, that is, a light<br />
which does not have an illuminate or a solar statement.<br />
color<br />
diffuse( normal N )<br />
{<br />
color C = 0;<br />
illuminance( P, N, PI/2 )<br />
C += Cl * normalize(L).N;<br />
return C;<br />
}<br />
141