object. Lines 10 to 12 declare a TransparencyAttributes object and set its characteristic to
ALLOW_VALUE_WRITE and BLENDED. With these declarations, the appearance of the
visual object can be set using the TransparencyAttributes object.
Line 15 invokes the TransparencyInterpolator, which takes in an associated alpha object,
the TransparencyAttributes object, and the maximum and minimum transparency values as
arguments. A transparency value of 1.0f corresponds to a situation when the visual object
is fully opaque, while a transparency value of 0.0f gives rise to a fully transparent object.
In this example, the object is made to change from a fully opaque object to one that is more
transparent with a transparency value of 0.2.
Through ColorInterpolator class, the diffuse color of the associated material objects may
be altered. Note that this behavior class and the material object may have more than one
target visual objects. Also, if Lighting is not set, the effect of ColorInterpolator will not
In the example in Figure 10, a material object is created at line 7 to define the appearance
of a visual object under illumination. The use of ALLOW_COMPONENT_WRITE sets this
object to allow for the possibility to change individual component field information.
ColorInterpolator is invoked in line 9. After specifying the alpha and material object
used, the initial and the final color are stated in the subsequent lines. SchedulingBounds
is also specified so that the change in color can be seen. Also, as the presence of lighting is
needed, directional light is declared in line 27. The visual object is declared as a Shape3D
object starting from line 13, and its appearance node is modified using the material object
In its default mode, the Billboard class supports rotation about the y-axis only, and allows
the user to view the declared 3D objects in a 2D view as the viewing angle rotates. An
example is presented in Figures 11 to 15.
In the code segments in Figures 11 and 12, four visual 3D objects are declared. Of
these, the road markers and tree shape objects are individually created and translated into
the scene graph by adding transform groups.
The inclusion of the relevant billboard objects into the scene graph is then carried out
in the loops in Figure 14. Specifically, the following steps are followed.
Search WWH ::