|
M3G 1.1 -- Jun 22, 2005 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.m3g.Object3D javax.microedition.m3g.Appearance
A set of component objects that define the rendering attributes of a Mesh or Sprite3D.
Appearance attributes are grouped into component objects, each encapsulating a set of properties that are functionally and logically related to each other. This division helps applications to conserve memory by sharing component objects across multiple meshes and sprites. The Appearance component classes and a summary of their contents are presented in the figure below.
All components of a newly created Appearance object are initialized to null. It is completely legal for any or all of the components to be null even when rendering. The behavior when each of the components is null is as follows:
Using a null Appearance on a submesh (or sprite) disables rendering and picking of that submesh (or sprite). An Appearance must always be provided for an object in order to make it visible.
By default, everything in Appearance works exactly the same way as in OpenGL 1.3. As a general exception, the color index (palette) mode is not supported. Other than that, any deviations from the OpenGL 1.3 specification are documented explicitly in the individual Appearance component classes.
Constructor Summary | |
Appearance()
Constructs an Appearance object with default values. |
Method Summary | |
CompositingMode |
getCompositingMode()
Returns the current CompositingMode for this Appearance. |
Fog |
getFog()
Returns the current fogging attributes for this Appearance. |
int |
getLayer()
Gets the current rendering layer for this Appearance. |
Material |
getMaterial()
Returns the current Material for this Appearance. |
PolygonMode |
getPolygonMode()
Returns the current PolygonMode for this Appearance. |
Texture2D |
getTexture(int index)
Retrieves the current texture image and its attributes for the given texturing unit. |
void |
setCompositingMode(CompositingMode compositingMode)
Sets the CompositingMode to use for this Appearance. |
void |
setFog(Fog fog)
Sets the fogging attributes to use for this Appearance. |
void |
setLayer(int layer)
Sets the rendering layer for this Appearance. |
void |
setMaterial(Material material)
Sets the Material to use when lighting this Appearance. |
void |
setPolygonMode(PolygonMode polygonMode)
Sets the PolygonMode to use for this Appearance. |
void |
setTexture(int index,
Texture2D texture)
Sets the texture image and its attributes for the given texturing unit. |
Methods inherited from class javax.microedition.m3g.Object3D |
addAnimationTrack, animate, duplicate, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, getUserObject, removeAnimationTrack, setUserID, setUserObject |
Constructor Detail |
public Appearance()
Constructs an Appearance object with default values. The default values are:
Method Detail |
public void setLayer(int layer)
Sets the rendering layer for this Appearance. When rendering
a World, Group or Mesh, submeshes and sprites are guaranteed to
be rendered in the order of ascending layers. That is,
all submeshes and sprites with an appearance at a lower
layer are rendered prior to any submeshes or sprites at
the higher layers. Furthermore, all opaque submeshes and
sprites at a specific layer are rendered prior to any
blended submeshes or sprites at the same layer. A submesh or a
sprite is defined to be opaque if it uses the REPLACE
blending mode (see CompositingMode), and blended otherwise.
Implementations are free to do any additional state sorting as long as the aforementioned constraints are met. To allow implementations to operate as efficiently as possible, applications should only use layering constraints when required. As a result of the rules above, the default layer of zero should be sufficient for most uses. Cases where non-zero layers may be useful include background geometry, sky boxes, lens flares, halos, and other special effects.
Note that the rendering layer has no effect on picking.
layer
- the rendering layer for submeshes and sprites
having this Appearance
java.lang.IndexOutOfBoundsException
- if layer
is
not in [-63, 63]getLayer
,
Mesh
public int getLayer()
Gets the current rendering layer for this Appearance.
setLayer
public void setFog(Fog fog)
Sets the fogging attributes to use for this Appearance. If the Fog object is set to null, fogging is disabled.
fog
- a Fog object, or null to disable fogginggetFog
public Fog getFog()
Returns the current fogging attributes for this Appearance.
setFog
public void setPolygonMode(PolygonMode polygonMode)
Sets the PolygonMode to use for this Appearance. If the PolygonMode is set to null, the default values are used.
polygonMode
- a PolygonMode object, or null to use the
defaultsgetPolygonMode
public PolygonMode getPolygonMode()
Returns the current PolygonMode for this Appearance.
setPolygonMode
public void setCompositingMode(CompositingMode compositingMode)
Sets the CompositingMode to use for this Appearance. If the CompositingMode is set to null, the default values are used.
compositingMode
- a CompositingMode object, or null to use
the defaultsgetCompositingMode
public CompositingMode getCompositingMode()
Returns the current CompositingMode for this Appearance.
setCompositingMode
public void setTexture(int index, Texture2D texture)
Sets the texture image and its attributes for the given texturing unit. If the texture object is set to null, the specified texturing unit is disabled.
index
- texturing unit indextexture
- a texture object for the specified texturing
unit, or null to disable the unit
java.lang.IndexOutOfBoundsException
- if index
is not
a valid texturing unit indexgetTexture
public Texture2D getTexture(int index)
Retrieves the current texture image and its attributes for the given texturing unit.
index
- texturing unit index
java.lang.IndexOutOfBoundsException
- if index
is not
a valid texturing unit indexsetTexture
public void setMaterial(Material material)
Sets the Material to use when lighting this Appearance. If the Material is set to null, lighting is disabled. See the Material class description for more information.
material
- a Material object, or null to disable lightinggetMaterial
public Material getMaterial()
Returns the current Material for this Appearance.
setMaterial
|
M3G 1.1 -- Jun 22, 2005 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |