<patch> ‐ A Bezier patch
This element defines a Bezier patch with n×m control points. Figure 5-14 shows the geometrical definition of a 4×4 Bezier surface from 16 control points and Figure 5-15 shows a graphical rendering of such a textured patch. The integer value of the segments attribute is the number of steps that will be used to build the mesh of the ruled surface when rendering it. The integer value n of the size attribute is the number of m-point Bezier curve that define the Bezier patch.
This element can have elements in its scope that define the properties of the patch: color, material, materialRaytrace, shader, texture, or video. In addition to these optional elements, it must have n Bezier curves with m control points as child element that defines the geometry of the patch. The integer values of the rank attribute of these n curves must cover the set of integer {1, 2...n}.
The following elements must occur in patch: n Bezier curves with m control points and, possibly, color, material, materialRaytrace, shader, texture, or video.
The example below defines a textured patch generated by four 4-point Bezier curves. The coordinates of the control points of the second, third, and fourth curve are omitted for conciseness.
<node id="node_veil">
<patch id="veil{#n}" size="4" segments="30">
<video xlink:href="/dev/video0" id="Wall" type="videoloop"
begin="0.0" end="1000000.0" dur="1000000.0" period="100.0"
tile_s="(640/1024)" tile_t="(480/512)" />
<bezier size="4" rank="1"
x1="3.0" y1="1.0" z1="-2.0"
x2="1.0" y2="1.0" z2="-2.0"
x3="-3.0" y3="1.0" z3="-2.0"
x4="-8.0" y4="1.0" z4="-2.0"
/>
<bezier size="4" rank="2"... />
<bezier size="4" rank="3"... />
<bezier size="4" rank="4"... />
</patch>
</node>
The attribute values of the Bezier curves that define a patch can be accessed through the sequence node:rank:attribute in which node is the patch node ID, rank is value of the rank attribute (the set of values {b1, b2...bn}), and attribute is the curve attribute.
The example below prints the y2 attribute of the second Bezier curve in the patch named node_patch.
<action> <write_console value="Bezier #2 y2 ({$node_patch:b2:y2})" /> </action>