VertexFormat
and a set of separate arrays of vertex components such as points, normals,
texture coordinates, and an array of faces that define the individual triangles
of the mesh.
Note that the term point, as used in the method names and method descriptions, actually refers to a 3D point (x, y, z) in space representing the position of a single vertex. The term points (plural) is used to indicate sets of 3D points for multiple vertices. Similarly, the term normal is used to indicate a 3D vector (nx, ny, nz) in space representing the direction of a single vertex. The term normals (plural) is used to indicate sets of 3D vectors for multiple vertices. The term texCoord is used to indicate a single pair of 2D texture coordinates (u, v) for a single vertex, while the term texCoords (plural) is used to indicate sets of texture coordinates for multiple vertices. Lastly, the term face is used to indicate 3 sets of interleaving points, normals (optional, depending on the associated VertexFormat) 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 with VertexFormat.POINT_TEXCOORD that represent
a single textured rectangle, using 2 triangles, have 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
]
whereas the faces with VertexFormat.POINT_NORMAL_TEXCOORD that represent
a single textured rectangle, using 2 triangles, have the following data order: [
p0, n0, t0, p1, n1, t1, p3, n3, t3, // First triangle of a textured rectangle
p1, n1, t1, p2, n2, t2, p3, n3, t3 // Second triangle of a textured rectangle
]
where p0, p1, p2 and p3 are indices into the points array, n0, n1, n2 and n3 are indices into the normals array, and t0, t1, t2 and t3 are indices into the texCoords array.
A triangle has a front and back face. The winding order of a triangle's vertices
determines which side is the front face. JavaFX chooses the counter-clockwise
(or right-hand rule) winding order as the front face. By default, only the
front face of a triangle is rendered. See CullFace for more
information.
The length of points, normals, and texCoords must be
divisible by 3, 3, and 2 respectively. The length of faces must be
divisible by 6 if it is of VertexFormat.POINT_TEXCOORD else it must
be divisible by 9 if it is of VertexFormat.POINT_NORMAL_TEXCOORD.
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, within
the range of the number of vertices in the normals array
(0 to normals.length / 3 - 1) for the normal 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 | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private BaseBounds | |
| private final ObservableFaceArray | |
| private final ObservableIntegerArray | |
| private final TriangleMesh. | |
| private final TriangleMesh. | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private final boolean | |
| private boolean | |
| private boolean | |
| private final ObservableFloatArray | |
| private final TriangleMesh. | |
| private NGTriangleMesh | |
| private final ObservableFloatArray | |
| private final TriangleMesh. | |
| private int | |
| private final ObservableFloatArray | |
| private final TriangleMesh. | |
| private ObjectProperty | vertexFormat
Specifies the vertex format of this |
| Access | Constructor and Description |
|---|---|
| public | TriangleMesh()
Creates a new instance of |
| public | TriangleMesh(VertexFormat
specifies the vertex format type. vertexFormat)Creates a new instance of |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv BaseBounds | |
| private Point3D | Returns: the triangle centroidx coord of first vertex of the triangle v0x, double y coord of first vertex of the triangle v0y, double z coord of first vertex of the triangle v0z, double x coord of second vertex of the triangle v1x, double y coord of second vertex of the triangle v1y, double z coord of second vertex of the triangle v1z, double x coord of third vertex of the triangle v2x, double y coord of third vertex of the triangle v2y, double z coord of third vertex of the triangle v2z)Computes the centroid of the given triangle |
| private Point2D | Returns: the triangle centroidvertex of the triangle v0, Point2D vertex of the triangle v1, Point2D vertex of the triangle v2)Computes the centroid of the given triangle |
| private boolean | Returns: true if the pick ray intersects with the face (regardless of whether the result has been updated)pick ray pickRay, Vec3d pick ray's origin origin, Vec3d pick ray's direction dir, int index of the face to test faceIndex, CullFace cull face of the Node (and thus the tested face) cullFace, Node the owner node (for the possible placement to the result) candidate, boolean whether or not to report he hit face reportFace, PickResultChooser the pick result to be updated if a closer intersection is found result)Computes intersection of a pick ray and a single triangle face. |
| pack-priv synchronized void | |
| private boolean | doComputeIntersects(PickRay pickRay, PickResultChooser pickResult, Node candidate, CullFace cullFace, boolean reportFace)
|
| public final int | Returns: number of elementsReturns the number of elements that represents a face. |
| public final ObservableFaceArray | Returns: faces array where each face is of
3 * VertexFormat.getVertexIndexSize() integers.Gets the |
| public final ObservableIntegerArray | Returns: thefaceSmoothingGroups array of this TriangleMeshGets the |
| public final int | Returns: number of elementsReturns the number of elements that represents a normal. |
| public final ObservableFloatArray | Returns: normals array where each normal is
represented by 3 float values nx, ny and nz, in that order.Gets the |
| pack-priv NGTriangleMesh | |
| pack-priv NGTriangleMesh | |
| public final int | Returns: number of elementsReturns the number of elements that represents a point. |
| public final ObservableFloatArray | Returns: points array where each point is
represented by 3 float values x, y and z, in that order.Gets the |
| pack-priv int | |
| public final int | Returns: number of elementsReturns the number of elements that represents a texture coordinates. |
| public final ObservableFloatArray | Returns: texCoord array where each texture coordinate is represented
by 2 float values: u and v, in that order.Gets the |
| public final VertexFormat | |
| pack-priv synchronized void | |
| pack-priv void | |
| public final void | |
| pack-priv void | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| public final ObjectProperty |
| cachedBounds | back to summary |
|---|---|
| private BaseBounds cachedBounds | |
| faces | back to summary |
|---|---|
| private final ObservableFaceArray faces | |
| faceSmoothingGroups | back to summary |
|---|---|
| private final ObservableIntegerArray faceSmoothingGroups | |
| faceSmoothingGroupsSyncer | back to summary |
|---|---|
| private final TriangleMesh. | |
| facesSyncer | back to summary |
|---|---|
| private final TriangleMesh. | |
| isFaceSmoothingGroupValid | back to summary |
|---|---|
| private boolean isFaceSmoothingGroupValid | |
| isFacesValid | back to summary |
|---|---|
| private boolean isFacesValid | |
| isNormalsValid | back to summary |
|---|---|
| private boolean isNormalsValid | |
| isPointsValid | back to summary |
|---|---|
| private boolean isPointsValid | |
| isPredefinedShape | back to summary |
|---|---|
| private final boolean isPredefinedShape | |
| isTexCoordsValid | back to summary |
|---|---|
| private boolean isTexCoordsValid | |
| isValidDirty | back to summary |
|---|---|
| private boolean isValidDirty | |
| normals | back to summary |
|---|---|
| private final ObservableFloatArray normals | |
| normalsSyncer | back to summary |
|---|---|
| private final TriangleMesh. | |
| peer | back to summary |
|---|---|
| private NGTriangleMesh peer | |
| points | back to summary |
|---|---|
| private final ObservableFloatArray points | |
| pointsSyncer | back to summary |
|---|---|
| private final TriangleMesh. | |
| refCount | back to summary |
|---|---|
| private int refCount | |
| texCoords | back to summary |
|---|---|
| private final ObservableFloatArray texCoords | |
| texCoordsSyncer | back to summary |
|---|---|
| private final TriangleMesh. | |
| vertexFormat | back to summary |
|---|---|
| private ObjectProperty<VertexFormat> vertexFormat Specifies the vertex format of this
| |
| TriangleMesh | back to summary |
|---|---|
| public TriangleMesh() Creates a new instance of | |
| TriangleMesh | back to summary |
|---|---|
| public TriangleMesh(VertexFormat vertexFormat) Creates a new instance of
| |
| TriangleMesh | back to summary |
|---|---|
| pack-priv TriangleMesh(boolean isPredefinedShape) | |
| computeBounds | back to summary |
|---|---|
| pack-priv BaseBounds computeBounds(BaseBounds bounds) Implements abstract javafx.
| |
| computeCentroid | back to summary |
|---|---|
| private Point3D computeCentroid(double v0x, double v0y, double v0z, double v1x, double v1y, double v1z, double v2x, double v2y, double v2z) Computes the centroid of the given triangle
| |
| computeCentroid | back to summary |
|---|---|
| private Point2D computeCentroid(Point2D v0, Point2D v1, Point2D v2) Computes the centroid of the given triangle | |
| computeIntersectsFace | back to summary |
|---|---|
| private boolean computeIntersectsFace(PickRay pickRay, Vec3d origin, Vec3d dir, int faceIndex, CullFace cullFace, Node candidate, boolean reportFace, PickResultChooser result) Computes intersection of a pick ray and a single triangle face. It takes pickRay, origin and dir. The latter two can be of course obtained from the pickRay, but we need them to be converted to Point3D and don't want to do that for all faces. Therefore the conversion is done just once and passed to the method for all the faces.
| |
| decRef | back to summary |
|---|---|
| pack-priv synchronized void decRef() | |
| doComputeIntersects | back to summary |
|---|---|
| private boolean doComputeIntersects(PickRay pickRay, PickResultChooser pickResult, Node candidate, CullFace cullFace, boolean reportFace) | |
| getFaceElementSize | back to summary |
|---|---|
| public final int getFaceElementSize() Returns the number of elements that represents a face.
| |
| getFaces | back to summary |
|---|---|
| public final ObservableFaceArray getFaces() Gets the
| |
| getFaceSmoothingGroups | back to summary |
|---|---|
| public final ObservableIntegerArray getFaceSmoothingGroups() Gets the The face smoothing group value 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. If faceSmoothingGroups is not empty, its size must be equal to number of faces. This faceSmoothingGroups has no effect on its
| |
| getNormalElementSize | back to summary |
|---|---|
| public final int getNormalElementSize() Returns the number of elements that represents a normal.
| |
| getNormals | back to summary |
|---|---|
| public final ObservableFloatArray getNormals() Gets the
| |
| getPGMesh | back to summary |
|---|---|
| pack-priv NGTriangleMesh getPGMesh() Implements abstract javafx.
| |
| getPGTriangleMesh | back to summary |
|---|---|
| pack-priv NGTriangleMesh getPGTriangleMesh() | |
| getPointElementSize | back to summary |
|---|---|
| public final int getPointElementSize() Returns the number of elements that represents a point.
| |
| getPoints | back to summary |
|---|---|
| public final ObservableFloatArray getPoints() Gets the
| |
| getRefCount | back to summary |
|---|---|
| pack-priv int getRefCount() | |
| getTexCoordElementSize | back to summary |
|---|---|
| public final int getTexCoordElementSize() Returns the number of elements that represents a texture coordinates.
| |
| getTexCoords | back to summary |
|---|---|
| public final ObservableFloatArray getTexCoords() Gets the
| |
| getVertexFormat | back to summary |
|---|---|
| public final VertexFormat getVertexFormat() | |
| incRef | back to summary |
|---|---|
| pack-priv synchronized void incRef() | |
| setDirty | back to summary |
|---|---|
| pack-priv void setDirty(boolean value) Overrides javafx.
| |
| setVertexFormat | back to summary |
|---|---|
| public final void setVertexFormat(VertexFormat value) | |
| updatePG | back to summary |
|---|---|
| pack-priv void updatePG() Implements abstract javafx.
| |
| validate | back to summary |
|---|---|
| private boolean validate() | |
| validateFaces | back to summary |
|---|---|
| private boolean validateFaces() | |
| validateFaceSmoothingGroups | back to summary |
|---|---|
| private boolean validateFaceSmoothingGroups() | |
| validateNormals | back to summary |
|---|---|
| private boolean validateNormals() | |
| validatePoints | back to summary |
|---|---|
| private boolean validatePoints() | |
| validateTexCoords | back to summary |
|---|---|
| private boolean validateTexCoords() | |
| vertexFormatProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| Modifier and Type | Field and Description |
|---|---|
| protected final T | |
| protected boolean | |
| protected boolean | dirtyInFull
Array was replaced |
| protected int | |
| protected int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected final void | addDirtyRange(int
index of the first modified element from, int length of the modified range length)Adds a dirty range |
| protected void | |
| public void | onChanged(T observableArray, boolean sizeChanged, int from, int to)
Implements javafx. Called after a change has been made to an ObservableArray. |
| public final void | setDirty(boolean
if true, the whole collection is marked as dirty;
if false, the whole collection is marked as not-dirty dirty)
|
| public float[] | syncTo(float[] array, int[] fromAndLengthIndices)
Implements com. This method is used to sync arrays on pulses. |
| public int[] | syncTo(int[] array, int[] fromAndLengthIndices)
Implements com. This method is used to sync arrays on pulses. |
| array | back to summary |
|---|---|
| protected final T array | |
| dirty | back to summary |
|---|---|
| protected boolean dirty | |
| dirtyInFull | back to summary |
|---|---|
| protected boolean dirtyInFull Array was replaced | |
| dirtyRangeFrom | back to summary |
|---|---|
| protected int dirtyRangeFrom | |
| dirtyRangeLength | back to summary |
|---|---|
| protected int dirtyRangeLength | |
| Listener | back to summary |
|---|---|
| public Listener(T array) | |
| addDirtyRange | back to summary |
|---|---|
| protected final void addDirtyRange(int from, int length) Adds a dirty range
| |
| markDirty | back to summary |
|---|---|
| protected void markDirty() | |
| onChanged | back to summary |
|---|---|
| public void onChanged(T observableArray, boolean sizeChanged, int from, int to) Implements javafx. Doc from javafx. Called after a change has been made to an ObservableArray.
| |
| setDirty | back to summary |
|---|---|
public final void setDirty(boolean dirty)
| |
| syncTo | back to summary |
|---|---|
| public float[] syncTo(float[] array, int[] fromAndLengthIndices) Implements com. Doc from com. This method is used to sync arrays on pulses. This method expects
the same array was synced before. The usage is similar to toArray method
so always use it as following:
| |
| syncTo | back to summary |
|---|---|
| public int[] syncTo(int[] array, int[] fromAndLengthIndices) Implements com. Doc from com. This method is used to sync arrays on pulses. This method expects
the same array was synced before. The usage is similar to toArray method
so always use it as following:
| |