|
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.VertexArray
An array of integer vectors representing vertex positions, normals, colors, or texture coordinates.
VertexArray objects are referenced by VertexBuffer objects. Each VertexArray may be referenced by any number of VertexBuffers, or even multiple times by the same VertexBuffer. The role in which the array is referenced determines the interpretation of the vertex attributes contained in it. For example, if a VertexArray is referenced as a normal vector array, the array entries are interpreted as 3D vectors. If the same array is referenced as a texture coordinate array, the entries are interpreted as 3D points.
Certain restrictions exist on the types of data that can be used in each role. The restrictions are as follows:
Constructor Summary | |
VertexArray(int numVertices,
int numComponents,
int componentSize)
Constructs a new VertexArray with the given dimensions. |
Method Summary | |
void |
get(int firstVertex,
int numVertices,
byte[] values)
Returns a range of 8-bit vertex attributes. |
void |
get(int firstVertex,
int numVertices,
short[] values)
Returns a range of 16-bit vertex attributes. |
int |
getComponentCount()
Returns the number of components per vertex. |
int |
getComponentType()
Returns the data type (size) of vertex components. |
int |
getVertexCount()
Returns the number of vertices in this array. |
void |
set(int firstVertex,
int numVertices,
byte[] values)
Copies in an array of 8-bit vertex attributes. |
void |
set(int firstVertex,
int numVertices,
short[] values)
Copies in an array of 16-bit vertex attributes. |
Methods inherited from class javax.microedition.m3g.Object3D |
addAnimationTrack, animate, duplicate, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, getUserObject, removeAnimationTrack, setUserID, setUserObject |
Constructor Detail |
public VertexArray(int numVertices, int numComponents, int componentSize)
Constructs a new VertexArray with the given dimensions. The array
elements are initialized to zero. The elements can be set later with
either the 8-bit or the 16-bit version of the set
method,
depending on the component size selected here.
numVertices
- number of vertices in this VertexArray;
must be [1, 65535]numComponents
- number of components per vertex; must be [2, 4]componentSize
- number of bytes per component; must be [1, 2]
java.lang.IllegalArgumentException
- if any of the parameters are outside
of their allowed rangesMethod Detail |
public void set(int firstVertex, int numVertices, short[] values)
Copies in an array of 16-bit vertex attributes. Positions,
normals, and texture coordinates can be set with this method,
but colors must be set with 8-bit input. This method is
available only if componentSize
, specified in the
constructor, is 2.
The vertex attributes are copied in starting from the first
element of the source array. The number of elements copied in
is numComponents * numVertices
, where
numComponents
is either 2, 3, or 4, as specified
at construction time. The source array must have at least that
many elements.
firstVertex
- index of the first vertex to replacenumVertices
- number of vertices to replacevalues
- array of 16-bit integers to copy vertex attributes from
java.lang.NullPointerException
- if values
is null
java.lang.IllegalStateException
- if this is not a 16-bit VertexArray
java.lang.IllegalArgumentException
- if numVertices < 0
java.lang.IllegalArgumentException
- if values.length <
numVertices * getComponentCount
java.lang.IndexOutOfBoundsException
- if firstVertex < 0
java.lang.IndexOutOfBoundsException
- if firstVertex +
numVertices > getVertexCount
public void set(int firstVertex, int numVertices, byte[] values)
Copies in an array of 8-bit vertex attributes. All vertex
attributes can be set with this method, including positions,
normals, colors, and texture coordinates. This method is
available only if componentSize
, specified in
the constructor, is 1.
The vertex attributes are copied in as specified in the
other set
variant.
firstVertex
- index of the first vertex to replacenumVertices
- number of vertices to replacevalues
- array of 8-bit integers to copy vertex attributes from
java.lang.NullPointerException
- if values
is null
java.lang.IllegalStateException
- if this is not an 8-bit VertexArray
java.lang.IllegalArgumentException
- if numVertices < 0
java.lang.IllegalArgumentException
- if values.length <
numVertices * getComponentCount
java.lang.IndexOutOfBoundsException
- if firstVertex < 0
java.lang.IndexOutOfBoundsException
- if firstVertex +
numVertices > getVertexCount
public int getVertexCount()
public int getComponentCount()
public int getComponentType()
public void get(int firstVertex, int numVertices, short[] values)
set
method.
firstVertex
- index of the first vertex to getnumVertices
- number of vertices to getvalues
- array of 16-bit integers to copy vertex attributes to
java.lang.NullPointerException
- if values
is null
java.lang.IllegalStateException
- if this is not a 16-bit VertexArray
java.lang.IllegalArgumentException
- if numVertices < 0
java.lang.IllegalArgumentException
- if values.length <
numVertices * getComponentCount
java.lang.IndexOutOfBoundsException
- if firstVertex < 0
java.lang.IndexOutOfBoundsException
- if firstVertex +
numVertices > getVertexCount
public void get(int firstVertex, int numVertices, byte[] values)
set
method.
firstVertex
- index of the first vertex to getnumVertices
- number of vertices to getvalues
- array of 8-bit integers to copy vertex attributes to
java.lang.NullPointerException
- if values
is null
java.lang.IllegalStateException
- if this is not an 8-bit VertexArray
java.lang.IllegalArgumentException
- if numVertices < 0
java.lang.IllegalArgumentException
- if values.length <
numVertices * getComponentCount
java.lang.IndexOutOfBoundsException
- if firstVertex < 0
java.lang.IndexOutOfBoundsException
- if firstVertex +
numVertices > getVertexCount
|
M3G 1.1 -- Jun 22, 2005 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |