|
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.IndexBuffer javax.microedition.m3g.TriangleStripArray
TriangleStripArray defines an array of triangle strips. In a triangle strip, the first three vertex indices define the first triangle. Each subsequent index together with the two previous indices defines a new triangle. For odd triangles, two of the indices must be swapped to produce correct winding. The first triangle is considered even. For example, the strip S = (2, 0, 1, 4) defines two triangles: (2, 0, 1) and (1, 0, 4).
Triangle strip indices may be explicitly defined, as in the example above, or they may be implicit. In an implicit TriangleStripArray, only the first index of the first strip is specified. All subsequent indices are one greater than their predecessor. For example, if there are two strips with lengths 3 and 4, and the initial index is 10, the strips are formed as follows: S1 = (10, 11, 12) and S2 = (13, 14, 15, 16).
Triangle strips may contain so-called degenerate triangles, that is, triangles that have zero area. These are completely valid input to the API. The implementation must take the necessary steps to ensure that degenerate triangles do not produce any rasterizable fragments.
Degenerate triangles often occur in explicit triangle strips that are constructed by merging multiple strips into one at the content authoring stage. Merging of strips requires that the same index be repeated two or three times in a row.
Degenerate triangles may also result from multiple vertices in the associated VertexBuffer having the same coordinates (in screen space, or already before that).
Constructor Summary | |
TriangleStripArray(int[] indices,
int[] stripLengths)
Constructs a triangle strip array with explicit indices. |
|
TriangleStripArray(int firstIndex,
int[] stripLengths)
Constructs a triangle strip array with implicit indices. |
Methods inherited from class javax.microedition.m3g.IndexBuffer |
getIndexCount, getIndices |
Methods inherited from class javax.microedition.m3g.Object3D |
addAnimationTrack, animate, duplicate, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, getUserObject, removeAnimationTrack, setUserID, setUserObject |
Constructor Detail |
public TriangleStripArray(int firstIndex, int[] stripLengths)
Constructs a triangle strip array with implicit indices. The first index of the first strip is specified, along with the lengths of the individual strips.
firstIndex
- index of the initial vertex of the first stripstripLengths
- array of per-strip vertex counts to be copied in
java.lang.NullPointerException
- if stripLengths
is null
java.lang.IllegalArgumentException
- if stripLengths
is empty
java.lang.IllegalArgumentException
- if any element in
stripLengths
is less than 3
java.lang.IndexOutOfBoundsException
- if firstIndex < 0
java.lang.IndexOutOfBoundsException
- if firstIndex +
sum(stripLengths) > 65535
public TriangleStripArray(int[] indices, int[] stripLengths)
Constructs a triangle strip array with explicit indices. An array of indices is given, along with the lengths of the individual strips. The combined length of the strips must not exceed the number of elements in the index array. The contents of both arrays are copied in.
indices
- array of indices to be copied instripLengths
- array of per-strip index counts to be copied in
java.lang.NullPointerException
- if indices
is null
java.lang.NullPointerException
- if stripLengths
is null
java.lang.IllegalArgumentException
- if stripLengths
is empty
java.lang.IllegalArgumentException
- if any element in
stripLengths
is less than 3
java.lang.IllegalArgumentException
- if indices.length <
sum(stripLengths)
java.lang.IndexOutOfBoundsException
- if any element in
indices
is negative
java.lang.IndexOutOfBoundsException
- if any element in
indices
is greater than 65535
|
M3G 1.1 -- Jun 22, 2005 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |