|
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.Node | +--javax.microedition.m3d.Mesh
Mesh is a renderable 3D geometry object, defined as a polygonal surface. Mesh is also the base class for MorphingMesh and SkinnedMesh. These extend the basic, rigid body mesh with capabilities to transform the vertices independently of each other. The structure of a basic Mesh is shown in the figure below.
A Mesh is composed of one or more submeshes. A submesh is a {VertexBuffer, IndexBuffer, Appearance} triplet that defines a set of vertices and their attributes (VertexBuffer), a set of triangle strips connecting the vertices (IndexBuffer) and the visual properties of the surface (Appearance). All submeshes in a Mesh share the same VertexBuffer. In the case of a MorphingMesh, a weighted linear combination of multiple VertexBuffers is used instead of a single VertexBuffer.
Submeshes within a Mesh are rendered in the order of ascending Appearance layers,
and such that opaque submeshes are rendered before transparent submeshes on the same
layer. See the setLayer
method in Appearance for more
discussion on layered rendering.
Rendering and picking of a submesh is disabled if its Appearance is null. An exception is thrown if the VertexBuffer or any of the IndexBuffers are in invalid state when rendering or picking; see the respective class descriptions for more information. Note that it would be useless to check for these exception cases at construction time, because the application may freely change Appearances and VertexBuffer contents at any time. However, null IndexBuffers and VertexBuffers are blocked at the constructor, as usual, because the application is not able to set them to non-null afterwards.
VertexBuffer
,
IndexBuffer
Field Summary |
Fields inherited from class javax.microedition.m3d.Node |
NONE, ORIGIN, X_AXIS, Y_AXIS, Z_AXIS |
Fields inherited from class javax.microedition.m3d.Object3D |
userObject |
Constructor Summary | |
Mesh(VertexBuffer vertices,
IndexBuffer[] triangles,
Appearance[] appearances)
Constructs a new Mesh with the given VertexBuffer and submeshes. |
|
Mesh(VertexBuffer vertices,
IndexBuffer triangles,
Appearance appearance)
Constructs a new Mesh consisting of only one submesh. |
Method Summary | |
Appearance |
getAppearance(int index)
Gets the current Appearance of the specified submesh. |
IndexBuffer |
getIndexBuffer(int index)
Gets the IndexBuffer of the specified submesh. |
int |
getSubmeshCount()
Gets the number of submeshes in this Mesh. |
VertexBuffer |
getVertexBuffer()
Gets the vertex buffer of this Mesh. |
void |
setAppearance(int index,
Appearance appearance)
Sets the Appearance of the specified submesh. |
Methods inherited from class javax.microedition.m3d.Node |
getAlphaFactor, getOrientation, getParent, getScale, getScopeID, getTransform, getTransformTo, getTranslation, isEnabled, setAlignment, setAlphaFactor, setEnable, setOrientation, setScale, setScopeID, setTransform, setTranslation |
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 Mesh(VertexBuffer vertices, IndexBuffer triangles, Appearance appearance)
Constructs a new Mesh consisting of only one submesh. Rendering and picking of the Mesh is initially disabled if the Appearance is set to null.
vertices
- a VertexBuffer to use for this meshtriangles
- an IndexBuffer defining the triangle strips to drawappearance
- an Appearance to use for this mesh, or nullpublic Mesh(VertexBuffer vertices, IndexBuffer[] triangles, Appearance[] appearances)
Constructs a new Mesh with the given VertexBuffer and submeshes. The
number of submeshes is set equal to the length of triangles
.
The appearances
array is parallel to that, and must have at
least as many elements. Alternatively, it may be null, in which case all
the Appearances are initialized to null.
vertices
- a VertexBuffer to use for all submeshes in this meshtriangles
- an IndexBuffer array defining the triangle strips to drawappearances
- an Appearance array parallel to triangles
;
a null element disables rendering of that submesh, and a null array
initializes all appearances to null
java.lang.IllegalArgumentException
- if triangles
is empty
java.lang.IllegalArgumentException
- if appearances.length < triangles.length
Method Detail |
public void setAppearance(int index, Appearance appearance)
Sets the Appearance of the specified submesh.
index
- index of the submesh to set the Appearance ofappearance
- Appearance to set for the submesh at index
,
or null to disable the submesh
java.lang.IndexOutOfBoundsException
- if index
is not between [0, N-1],
where N is the number of submeshesgetAppearance
public Appearance getAppearance(int index)
Gets the current Appearance of the specified submesh.
index
- index of the submesh to get the Appearance of
index
java.lang.IndexOutOfBoundsException
- if index
is not between [0, N-1],
where N is the number of submeshessetAppearance
public IndexBuffer getIndexBuffer(int index)
Gets the IndexBuffer of the specified submesh.
index
- index of the submesh to get the IndexBuffer of
index
java.lang.IndexOutOfBoundsException
- if index
is not between [0, N-1],
where N is the number of submeshespublic VertexBuffer getVertexBuffer()
Gets the vertex buffer of this Mesh. In the case of a MorphingMesh, this represents the base mesh; the morph targets can be obtained with a separate method in MorphingMesh.
public int getSubmeshCount()
Gets the number of submeshes in this Mesh. This is always at least 1.
|
JSR-184 Public Review Draft - Apr. 30, 2003. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |