|
JSR-184 Public Review Draft - Apr. 30, 2003. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.m3d.Object3D | +--javax.microedition.m3d.Appearance
Appearance defines attributes that are needed for rendering a Mesh or Sprite. Appearance attributes effectively define the state of the rendering pipeline, as illustrated in Graphics3D.
Appearance attributes are grouped into component classes, 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 object must always be provided to make something visible.
By default, everything in Appearance works exactly the same way as in OpenGL 1.3. Any deviations are documented explicitly in the component classes.
Field Summary |
Fields inherited from class javax.microedition.m3d.Object3D |
userObject |
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. |
GeometryMode |
getGeometryMode()
Returns the current GeometryMode for this Appearance. |
int |
getLayer()
Gets the current rendering layer for this Appearance. |
Material |
getMaterial()
Returns the current Material 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 |
setGeometryMode(GeometryMode geometryMode)
Sets the GeometryMode 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 |
setTexture(int index,
Texture2D texture)
Sets the texture image and its attributes for the given texturing unit. |
Methods inherited from class javax.microedition.m3d.Object3D |
addAnimationTrack, animate, clone, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, removeAnimationTrack, setUserID |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
layer
- the rendering layer for submeshes and sprites having this Appearance
java.lang.IllegalArgumentException
- 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 setGeometryMode(GeometryMode geometryMode)
Sets the GeometryMode to use for this Appearance. If the GeometryMode is set to null, the default values are used.
geometryMode
- a GeometryMode object, or null to use defaultsgetGeometryMode
public GeometryMode getGeometryMode()
Returns the current GeometryMode for this Appearance.
setGeometryMode
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 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
|
JSR-184 Public Review Draft - Apr. 30, 2003. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |