| 
 | M3G 1.1 -- Jun 22, 2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.m3g.Object3D
javax.microedition.m3g.Material
An Appearance component encapsulating material attributes for lighting computations. Other attributes required for lighting are defined in Light, PolygonMode and VertexBuffer.
The diagram below illustrates how the final, lit color is
obtained for a vertex. Lighting is disabled for a submesh if it has
a null Material, and enabled otherwise. If lighting is disabled, the
final vertex color is taken from the associated VertexBuffer as such.
If lighting is enabled, the final color is computed according to the
OpenGL 1.3 lighting equation (p. 48), using the material colors
specified here. Finally, if vertex color tracking is enabled, the
AMBIENT and DIFFUSE material colors are
replaced with the per-vertex colors or the default color obtained
from the VertexBuffer.

Lighting is computed according to the OpenGL 1.3 specification, section 2.13.1, with the following exceptions:
AMBIENT_AND_DIFFUSE;
| Field Summary | |
| static int | AMBIENTA parameter to setColorandgetColor,
 specifying that the ambient color component is to be set or
 retrieved. | 
| static int | DIFFUSEA parameter to setColorandgetColor,
 specifying that the diffuse color component is to be set or
 retrieved. | 
| static int | EMISSIVEA parameter to setColorandgetColor,
 specifying that the emissive color component is to be set or
 retrieved. | 
| static int | SPECULARA parameter to setColorandgetColor,
 specifying that the specular color component is to be set or
 retrieved. | 
| Constructor Summary | |
| Material()Creates a Material object with default values. | |
| Method Summary | |
|  int | getColor(int target)Gets the value of the specified color component of this Material. | 
|  float | getShininess()Gets the current shininess of this Material. | 
|  boolean | isVertexColorTrackingEnabled()Queries whether vertex color tracking is enabled. | 
|  void | setColor(int target,
         int ARGB)Sets the given value to the specified color component(s) of this Material. | 
|  void | setShininess(float shininess)Sets the shininess of this Material. | 
|  void | setVertexColorTrackingEnable(boolean enable)Enables or disables vertex color tracking. | 
| Methods inherited from class javax.microedition.m3g.Object3D | 
| addAnimationTrack, animate, duplicate, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, getUserObject, removeAnimationTrack, setUserID, setUserObject | 
| Field Detail | 
public static final int AMBIENT
A parameter to setColor and getColor,
 specifying that the ambient color component is to be set or
 retrieved.
public static final int DIFFUSE
A parameter to setColor and getColor,
 specifying that the diffuse color component is to be set or
 retrieved.
public static final int EMISSIVE
A parameter to setColor and getColor,
 specifying that the emissive color component is to be set or
 retrieved.
public static final int SPECULAR
A parameter to setColor and getColor,
 specifying that the specular color component is to be set or
 retrieved.
| Constructor Detail | 
public Material()
Creates a Material object with default values. The default values are:
Note that even though the alpha component can be set for all color components, it is ignored for all but the diffuse component.
| Method Detail | 
public void setColor(int target,
                     int ARGB)
Sets the given value to the specified color component(s) of this Material. The color components to set are specified as an inclusive OR of one or more of the symbolic constants listed above. The color is given in ARGB format, but the alpha component is ignored for all but the diffuse color.
target - a bitmask of color component identifiersARGB - color for the target property (or properties)
        in 0xAARRGGBB format
java.lang.IllegalArgumentException - if target has a value
         other than an inclusive OR of one or more of AMBIENT,
         DIFFUSE, EMISSIVE, SPECULARgetColorpublic int getColor(int target)
Gets the value of the specified color component of this Material. The alpha component of the returned value is guaranteed to be zero for all but the diffuse color component.
target - exactly one of AMBIENT, DIFFUSE, EMISSIVE,
        SPECULAR
java.lang.IllegalArgumentException - if target has a value
         other than one of those listed abovesetColorpublic void setShininess(float shininess)
Sets the shininess of this Material. Shininess is the specular exponent term in the lighting equation, and it can take on values between [0, 128]. Large values of shininess make the specular highlights more concentrated, and small values make them more spread out.
shininess - the specular exponent value to set for this Material
java.lang.IllegalArgumentException - if shininess is not
         in [0, 128]getShininesspublic float getShininess()
Gets the current shininess of this Material.
setShininesspublic void setVertexColorTrackingEnable(boolean enable)
Enables or disables vertex color tracking. When enabled, the
 AMBIENT and DIFFUSE material colors
 will take on color values from the associated VertexBuffer on a
 per-vertex basis. The ambient and diffuse color values of this
 Material are ignored in that case.
enable - true to turn vertex color tracking on;
        false to turn it offpublic boolean isVertexColorTrackingEnabled()
Queries whether vertex color tracking is enabled.
| 
 | M3G 1.1 -- Jun 22, 2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||