<html><head><title>Node Component Objects</title></head>
<body bgcolor=#ffffff>
<center>
<table width=100% cellpadding="0" cellspacing="0" border="0">
<tr bgcolor="#cccccc">
<td align=left>
<font face="helvetica, arial" size="2">
The Java 3D API Specification</font>
<td valign="top" align="right">
<a href="index.html"><img src="shared/toc01.gif" alt="Contents" width="30" height="26" border="0" VSPACE="0"></a> <a href="SceneGraphSharing.html"><img src="shared/prev01.gif" alt="Previous" width="30" height="26" border="0" VSPACE="0"></a> <a href="ViewModel.html"><img src="shared/next01.gif" alt="Next" width="30" height="26" border="0" VSPACE="0"></a> <a href="j3dIX.html"><img src="shared/index01.gif" alt="Index" width="30" height="26" border="0" VSPACE="0"</a> </td></tr>
</table>
<br>
</center>
<br>
<center>
<a name="47227">
<table width=90% border=0><tr>
<td align=right><font size=3>C H A P T E R</font><font size=7><img src="shared/sm-space.gif"> 8</td></table>
</a></center><center>
<a name="51731">
<table width=90% border=0><tr><td align=right>
<hr size=7 noshade>
<font size=6>Node Component Objects</font></td></table>
</a></center><blockquote>
<p><br><br><br><P><a name="51734">
<font size=7><b>N</b></font>ODE component objects include the actual geometry and appearance attributes used to render the geometry.</a>
<p><a name="66062">
<h2>8.1 <spacer type=block width=20>Node Component Objects: Attributes</h2>
</a><a name="51735">
Node objects by themselves do not fully specify their exact semantics. They contain information that further refines their exact meaning. Some of that information is specified as an attribute and an associated floating-point or integer value. In many cases, however, the information consists of references to more complex entities called <em>node component objects</em>. Node component objects encapsulate related state information in a single entity. See <a href="Components.html#61722">Figure  8-1</a>.</a>
<p><a name="75603">
<h3>8.1.1 <spacer type=block width=10>Alpha Object</h3>
</a><a name="75604">
The Alpha node component object provides common methods for converting a time value into an alpha value (a value in the range 0.0 to 1.0). See <a href="Behaviorsa.html#51014">Section 10.6, "Interpolator Behaviors</a>," for a description of the Alpha object.</a>
<p><a name="90906">
<h3>8.1.2 <spacer type=block width=10>Appearance Object</h3>
</a><a name="90908">
The Appearance object is a component object of a Shape3D node that defines all rendering state attributes for that shape node. If the Appearance object in a Shape3D node is <code>null</code>, default values will be used for all rendering state attributes.</a>
<p><a name="90909">
<h5> Constants</h5>
</a><a name="90910">
The Appearance component object defines the following flags:</a>
<p><a name="47320">
<img src="figures/Components.doc.anc.gif"></a>
<p>
<p>
<a name="61722">
<ul><font size=-1><b><i>Figure 8-1 </i><img src="shared/sm-blank.gif" border=0> Attribute Component Object Hierarchy</b></font></ul>
</a><p>
<pre><b><a name="75584">public static final int ALLOW_MATERIAL_READ
</a><a name="75586">public static final int ALLOW_MATERIAL_WRITE
</a><a name="75588">public static final int ALLOW_TEXTURE_READ
</a><a name="75590">public static final int ALLOW_TEXTURE_WRITE
</a><a name="75592">public static final int ALLOW_TEXGEN_READ
</a><a name="75594">public static final int ALLOW_TEXGEN_WRITE
</a><a name="75596">public static final int ALLOW_TEXTURE_ATTRIBUTES_READ
</a><a name="61740">public static final int ALLOW_TEXTURE_ATTRIBUTES_WRITE
</a><a name="61752">public static final int ALLOW_COLORING_ATTRIBUTES_READ
</a><a name="61761">public static final int ALLOW_COLORING_ATTRIBUTES_WRITE
</a><a name="61768">public static final int ALLOW_TRANSPARENCY_ATTRIBUTES_READ
</a><a name="61775">public static final int ALLOW_TRANSPARENCY_ATTRIBUTES_WRITE
</a><a name="61784">public static final int ALLOW_RENDERING_ATTRIBUTES_READ
</a><a name="61791">public static final int ALLOW_RENDERING_ATTRIBUTES_WRITE
</a><a name="61800">public static final int ALLOW_POLYGON_ATTRIBUTES_READ
</a><a name="61807">public static final int ALLOW_POLYGON_ATTRIBUTES_WRITE
</a><a name="61814">public static final int ALLOW_LINE_ATTRIBUTES_READ
</a><a name="61817">public static final int ALLOW_LINE_ATTRIBUTES_WRITE
</a><a name="61824">public static final int ALLOW_POINT_ATTRIBUTES_READ
</a><a name="61827">public static final int ALLOW_POINT_ATTRIBUTES_WRITE
</a><a name="84582">public static final int ALLOW_TEXTURE_UNIT_STATE_READ
</a><a name="84591">public static final int ALLOW_TEXTURE_UNIT_STATE_WRITE
</a></b></pre><a name="47353">
These flags, when enabled using the <code>setCapability</code> method, allow an application to invoke methods that read and write the specified component object reference (material, texture, texture coordinate generation, and so forth). These capability flags are enforced only when the object is part of a live or compiled scene graph.</a>
<p><a name="47354">
<h5> Constructors</h5>
</a><a name="52729">
The Appearance object has the following constructor:</a>
<p><pre><b><a name="52731">public Appearance()
</a></b></pre><a name="73380">
Constructs and initializes an Appearance object using defaults for all state variables. All component object references are initialized to null.</a>
<p><a name="47360">
<h5> Methods</h5>
</a><a name="47361">
The Appearance object has the following methods:</a>
<p><pre><b><a name="47363">public void setMaterial(Material material)
</a><a name="47365">public Material getMaterial()
</a></b></pre><a name="47367">
The Material object specifies the desired material properties used for lighting. Setting it to <code>null</code> disables lighting.</a>
<p><pre><b><a name="47369">public void setTexture(Texture texture)
</a><a name="64433">public Texture getTexture()
</a></b></pre><a name="84620">
The Texture object specifies the desired texture map and texture parameters. Setting it to <code>null</code> disables texture mapping. Applications must not set individual texture component objects (texture, textureAttributes, or texCoordGeneration) and the texture unit state array in the same Appearance object. Doing so will result in an exception being thrown.</a>
<p><pre><b><a name="61840">public void setTextureAttributes(TextureAttributes
</a><a name="90748"> textureAttributes)
</a><a name="61847">public TextureAttributes getTextureAttributes()
</a></b></pre><a name="84787">
These methods set and retrieve the TextureAttributes object. Setting it to <code>null</code> results in default attribute use. Applications must not set individual texture component objects (texture, textureAttributes, or texCoordGeneration) and the texture unit state array in the same Appearance object. Doing so will result in an exception being thrown.</a>
<p><pre><b><a name="84643">public void setColoringAttributes(ColoringAttributes
</a><a name="90749"> coloringAttributes)
</a><a name="68343">public ColoringAttributes getColoringAttributes()
</a></b></pre><a name="68344">
These methods set and retrieve the ColoringAttributes object. Setting it to <code>null</code> results in default attribute use.</a>
<p><pre><b><a name="68346">public void setTransparencyAttributes(
</a><a name="90750"> TransparencyAttributes transparencyAttributes)
</a><a name="61904">public TransparencyAttributes getTransparencyAttributes()
</a></b></pre><a name="68350">
These methods set and retrieve the TransparencyAttributes object. Setting it to <code>null</code> results in default attribute use.</a>
<p><pre><b><a name="61921">public void setRenderingAttributes(RenderingAttributes
</a><a name="90751"> renderingAttributes)
</a><a name="61936">public RenderingAttributes getRenderingAttributes()
</a></b></pre><a name="68354">
These methods set and retrieve the RenderingAttributes object. Setting it to <code>null</code> results in default attribute use.</a>
<p><pre><b><a name="61951"