Spec-Zone .ru
спецификации, руководства, описания, API
|
public class TriangleMesh extends Mesh
Note that the term point, as used in the method names and method descriptions, actually refers to a set of x, y, and z point representing the position of a single vertex. The term points (plural) is used to indicate sets of x, y, and z points for multiple vertices. Similarly, the term texCoord is used to indicate a set of u and v texture coordinates for a single vertex, while the term texCoords (plural) is used to indicate sets of u and v texture coordinates for multiple vertices. Lastly, the term face is used to indicate 3 set of interleaving points and texture coordinates that together represent the geometric topology of a single triangle, while the term faces (plural) is used to indicate sets of triangles (each represent by a face).
For example, the faces that represent a single textured rectangle, using 2 triangles, has the following data order: [
p0, t0, p1, t1, p3, t3, // First triangle of a textured rectangle
p1, t1, p2, t2, p3, t3 // Second triangle of a textured rectangle
]
where p0, p1, p2 and p3 are indices into the points array, and t0, t1, t2 and t3 are indices into the texCoords array.
The maximum number of vertices in the mesh can not exceed 65536.
Therefore the maximum array lengths are 65536 * 3 (x, y, z per point) for points,
and 65536 * 2 (u, v per texture coordinate) for texCoords.
The length of points
, texCoords
, and faces
must be
divisible by 3, 2, and 6 respectively.
The values in the faces array must be within the range of the number of vertices
in the points array (0 to points.length / 3 - 1) for the point indices and
within the range of the number of the vertices in
the texCoords array (0 to texCoords.length / 2 - 1) for the texture coordinate indices.
A warning will be recorded to the logger and the mesh will not be rendered (and will have an empty bounds) if any of the array lengths are invalid or if any of the values in the faces array are out of range.
Modifier and Type | Field and Description |
---|---|
static int |
NUM_COMPONENTS_PER_FACE |
static int |
NUM_COMPONENTS_PER_POINT |
static int |
NUM_COMPONENTS_PER_TEXCOORD |
Constructor and Description |
---|
TriangleMesh()
Creates a new instance of
TriangleMesh class. |
Modifier and Type | Method and Description |
---|---|
ObservableIntegerArray |
getFaces()
Gets the
ObservableIntegerArray of faces, indices into the points
and texCoords arrays, of this TriangleMesh |
ObservableIntegerArray |
getFaceSmoothingGroups()
Gets the
ObservableIntegerArray of face smoothing groups
of this TriangleMesh . |
ObservableFloatArray |
getPoints()
Gets the
ObservableFloatArray of points of this TriangleMesh . |
ObservableFloatArray |
getTexCoords()
Gets the
ObservableFloatArray of texture coordinates of this TriangleMesh . |
public static final int NUM_COMPONENTS_PER_POINT
public static final int NUM_COMPONENTS_PER_TEXCOORD
public static final int NUM_COMPONENTS_PER_FACE
public TriangleMesh()
TriangleMesh
class.public ObservableFloatArray getPoints()
ObservableFloatArray
of points of this TriangleMesh
.ObservableFloatArray
of points where each point is
represented by 3 float values x, y and z, in that order.public ObservableFloatArray getTexCoords()
ObservableFloatArray
of texture coordinates of this TriangleMesh
.ObservableFloatArray
array of texture coordinates
where each texture coordinate is represented by 2 float values: u and v,
in that orderpublic ObservableIntegerArray getFaces()
ObservableIntegerArray
of faces, indices into the points
and texCoords arrays, of this TriangleMesh
ObservableIntegerArray
of faces where each face is
6 integers p0, t0, p1, t1, p3, t3, where p0, p1 and p2 are indices of
points in points ObservableFloatArray
and t0, t1 and t2 are
indices of texture coordinates in texCoords ObservableFloatArray
.
Both indices are in terms of vertices (points or texCoords), not individual
floats.public ObservableIntegerArray getFaceSmoothingGroups()
ObservableIntegerArray
of face smoothing groups
of this TriangleMesh
.
Smoothing affects how a mesh is rendered but it does not effect its
geometry. The face smoothing group value is used to control the smoothing
between adjacent faces.
The face smoothing group is represented by an array of bits and up to 32 unique groups is possible; (1 << 0) to (1 << 31). The face smoothing group value can range from 0 (no smoothing group) to all 32 groups. A face can belong to zero or more smoothing groups. A face is a member of group N if bit N is set, for example, groups |= (1 << N). A value of 0 implies no smoothing group or hard edges. Smoothing is applied when adjacent pair of faces shared a smoothing group. Otherwise the faces are rendered with a hard edge between them.
An empty faceSmoothingGroups implies all faces in this mesh have a smoothing group value of 1.
Note: If faceSmoothingGroups is not empty, is size must be equal to number of faces.
Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. Use is subject to