5.92. Wave (media-object)

<wave> ‐ A ruled surface generated by two Bezier curves

5.92.1. Attributes

NameTypeDefaults
idIDNone (required)
segmentsINTEGERNB_ITERATIONS_BEZIER (100)

5.92.2. Description

This element defines a ruled surface generated by 2 Bezier curves. Figure 5-29 shows a graphical rendering of a wave defined by two four-point Bezier curves. 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.

This element can have elements in its scope that define the properties of the wave: color, material, materialRaytrace, shader, texture, or video. In addition to these optional elements, it must have two Bezier curves as child elements that define the geometry of the wave. The values of the location attribute of these two curves must be in and out.

5.92.3. Expected children

The following elements must occur in wave: two Bezier curves and, possibly, color, material, materialRaytrace, shader, texture, or video.

Figure 5-29. Control Points of a Wave

5.92.4. Example

The example below defines a textured wave generated by two 4-point Bezier curves. The coordinates of the control points of the second curve are omitted for conciseness.

<node id="node_car_#1">
  <wave id="body_#1" segments="5">
    <texture encoding="jpeg" xlink:href="textures/commuter1.jpg" 
      id="commuter1" tile_s="1" tile_t="-1" />
    <bezier size="4" location="in"
        x1="-0.02" y1="0.00" z1="0.00"
        x2="-0.02" y2="0.06" z2="0.01"
        x3="-0.02" y3="0.01" z3="-0.05"
        x4="-0.02" y4="0.07" z4="-0.04" />
    <bezier size="4" location="out" ... />
  </wave>
</node>

5.92.5. Access to Children Attributes

The attribute values of the Bezier curves that define a wave can be accessed through the sequence node:location:attribute in which node is the wave node ID, location is value of the location attribute (in or out), and attribute is the curve attribute.

The example below prints the y2 attribute of the in Bezier curve in the wave named node_wave.

<action>
  <write_console value="Bezier in y2 ({$node_wave:in:y2})" />
</action>