| Nov 19, 2003 | ||||||||||
| |||||||||||
|
<hr size=2 width="100%" align=center>
javax.microedition.m
3g
Class Mesh
java.lang.Object
|
+--javax.microedition.m3g.Object3D
|
+--javax.microedition.m3g.Transformable
|
+--javax.microedition.m3g.Node
|
+--javax.microedition.m
3g
.Mesh
Direct Known Subclasses:
public class Mesh
extends Node
A scene graph node that represents a 3D object defined as a polygonal surface.
一个场景节点,代表被定义为多边形表面的3D对象。
This class represents a conventional rigid body mesh, while the derived classes MorphingMesh and SkinnedMesh extend it with capabilities to transform vertices independently of each other. The structure of a basic Mesh is shown in the figure below.
这个类代表了传统的刚体Mesh,它的两个子类MorphingMesh和SkinnedMesh扩展到具有独立地变换彼此顶点的能力。一个基本Mesh的结构如下图所示。
A Mesh is composed of one or more submeshes and their associated Appearances. A submesh is an array of triangle strips defined by an IndexBuffer object. The triangle strips are formed by indexing the vertex coordinates and other vertex attributes in an associated VertexBuffer. All submeshes in a Mesh share the same VertexBuffer. However, in the case of a MorphingMesh, a weighted linear combination of multiple VertexBuffers is used in place of a single VertexBuffer.
一个Mesh由数个submesh及其对应的Appearance组成。一个submesh也就是由IndexBuffer对象定义的三角形带的数组。这些三角形带是通过索引它们的顶点坐标系及其它顶点属性在与之相关的VertexBuffer里的顶点属性来形成的。在一个Mesh内所有的submesh都共用同一个VertexBuffer。但是,如果是MorphingMesh,则会使用一个有重量的多个VertexBuffer的线性融合来代替一个单独的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.
Mesh内的submesh以Appearance层中升序的方式渲染,并且同一层内不透明的submesh先于透明submesh渲染。查看Appearance中setLayer
的方法来获取更多的关于层渲染得讨论。
Rendering and picking of a submesh is disabled if its Appearance is null.
如果submesh的Appearance为空,则rendering和picking都是被禁用的。
Deferred exceptions
An exception is thrown if the VertexBuffer or any of the IndexBuffers are in an 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 the contents of a VertexBuffer or an Appearance at any time. However, null IndexBuffers and VertexBuffers are blocked at the constructor, as usual, because the application is not able to change them afterwards.
当进行render或者pick操作时,如果VertexBuffer或者任何一个IndexBuffer处于不可用的状态时,则会抛出一个异常;查看相应类描述文档以获取更多信息。注意,在构造期间去检查这些异常也是没有作用的,因为在任何时间,程序都有可能任意地去修改VertexBuffer或者Appearance的内容。但是,在构造期间,同时为null的IndexBuffer和VertexBuffer是不可以的,因为这样一来就没法构造submesh,程序也就没法去改变它们了。
See Also:
Binary format, VertexBuffer
, IndexBuffer
Fields inherited from class javax.microedition.m 3g .Node |
Constructor Summary | |
使用给定的VertexBuffer和submesh来构造一个新的Mesh |
|
构造一个只有一个submesh的Mesh |
|
Method Summary | |
获得指定submesh的当前Appearance | |
返回指定index的submesh | |
| 获得该Mesh内的submesh的个数 |
获得该Mesh的vertexBuffer | |
|
为指定的submesh设置Appearance |
Methods inherited from class javax.microedition.m 3g .Node |
|
Methods inherited from class javax.microedition.m 3g .Transformable |
|
Methods inherited from class javax.microedition.m 3g .Object3D |
|
Methods inherited from class java.lang.Object |
|
Mesh
public Mesh(VertexBuffer vertices,
IndexBuffer submesh,
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.
构造一个只有一个submesh的Mesh。如果Appearance设置为null, 那么对这个Mesh的render和pick操作就会被初始成为禁用的。
Parameters:
vertices
- a VertexBuffer to use for this mesh 这个mesh使用的VertexBuffer
submesh
- an IndexBuffer defining the triangle strips to draw 定义了要去画的三角形带的IndexBuffer
appearance
- an Appearance to use for this mesh, or null 这个mesh要用的Appearance,或者为null
Throws:
java.lang.NullPointerException
- if vertices
is null
java.lang.NullPointerException
- if submesh
is null
Mesh
public Mesh(VertexBuffer vertices,
IndexBuffer[] submeshes,
Appearance[] appearances)
Constructs a new Mesh with the given VertexBuffer and submeshes. The number of submeshes is set equal to the length of the submeshes
array. The appearances
array is parallel to that, and must have at least as many elements. A null Appearance disables rendering and picking of the corresponding submesh. If the array itself is null, all appearances are initialized to null.
使用给定的VertexBuffer和submesh构造一个新的Mesh。总的submesh的数目等于传入的submeshes数组的长度。传入的appearances数组也类似,并且至少要有同样多的元素个数。一个null的Appearance就是禁用了对应submesh的render和pick操作。如果appearances数组为null,那么所有appearance都会被初始化为null
Parameters:
vertices
- a VertexBuffer to use for all submeshes in this mesh 被该Mesh内所有submesh公用的VertexBuffer
submeshes
- an IndexBuffer array defining the submeshes to draw定义了要去画的三角形带的IndexBuffer
appearances
- an Appearance array parallel to submeshes
与submeshes相同的Appearance数组
Throws:
java.lang.NullPointerException
- if vertices
is null
java.lang.NullPointerException
- if submeshes
is null
java.lang.NullPointerException
- if any element in submeshes
is null
java.lang.IllegalArgumentException
- if submeshes
is empty
java.lang.IllegalArgumentException
- if appearances.length < submeshes.length
setAppearance
public void setAppearance(int index,
Appearance appearance)
Sets the Appearance for the specified submesh.
为指定submesh设置Appearance
Parameters:
index
- index of the submesh to set the Appearance of 要设置Appearance的submesh的序号
appearance
- Appearance to set for the submesh at index
, or null to disable the submesh 为序号为index的submesh设置的Appearance,如果为null,则是禁用此submesh
Throws:
java.lang.IndexOutOfBoundsException
- if (index < 0) || (index >= getSubmeshCount)
See Also:
getAppearance
public Appearance getAppearance(int index)
Gets the current Appearance of the specified submesh.
获得指定submesh的当前Appearance
Parameters:
index
- index of the submesh to get the Appearance of –要获得Appearance的submesh的序号
Returns:
current Appearance of the submesh at index
序号为index的submesh的当前Appearance
Throws:
java.lang.IndexOutOfBoundsException
- if (index < 0) || (index >= getSubmeshCount)
See Also:
getIndexBuffer
public IndexBuffer getIndexBuffer(int index)
Retrieves the submesh at the given index.
返回指定序号的submesh
Parameters:
index
- index of the submesh to get 要获得的submesh的序号
Returns:
current IndexBuffer at index
序号为index的当前IndexBuffer
Throws:
java.lang.IndexOutOfBoundsException
- if (index < 0) || (index >= getSubmeshCount)
getVertexBuffer
public VertexBuffer getVertexBuffer()
Gets the vertex buffer of this Mesh. This is always the original VertexBuffer that was supplied at construction. The VertexBuffer is never written to by the implementation. Specifically, the results of morphing (MorphingMesh) and skinning (SkinnedMesh) are not written to the VertexBuffer, nor are they exposed to the application by any other means.
获得这个Mesh中的VertexBuffer。这通常就是在构造时生成的那个原始VertexBuffer。在这个规范的实现里面,VertexBuffer是永远不会被改写的。需要特别指出的是,MorphingMesh的morphing结果和SkinnedMesh的skinning结果既不会写入到VertexBuffer,它们无论如何也不会直接暴露给应用程序的。
In the case of a MorphingMesh, this VertexBuffer represents the base mesh. The morph target VertexBuffers can be retrieved with the getMorphTarget
method in MorphingMesh.
如果是MorphingMesh,这里的VertexBuffer指得是那个基本的Mesh。而morph目标的VertexBuffer可以通过调用MorphingMesh中的getMorphTarget
方法来获得。
Returns:
the (base) VertexBuffer of this Mesh 该Mesh中的(基本)VertexBuffer
getSubmeshCount
public int getSubmeshCount()
Gets the number of submeshes in this Mesh. This is always at least 1.
获得这个Mesh中submesh的个数。至少为1。
Returns:
the number of submeshes in this Mesh 该Mesh中submesh的个数
<hr size=2 width="100%" align=center>
| Nov 19, 2003 | ||||||||||
| |||||||||||
|
<hr size=2 width="100%" align=center>
Copyright © 2003 Nokia Corporation. See the Copyright Notice for details.