import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
/**
- * It is used to store coordinates of vertices of 3D objects.
- * It is also used to store coordinates of points in 3D space.
+ * Vertex is a point where two or more lines, line segments, or rays come together.
+ * In other words, it's a corner of a polygon, polyhedron, or other geometric shape.
+ * For example, a triangle has three vertices, a square has four, and a cube has eight.
*/
public class Vertex {
* Vertex coordinate relative to the viewer after transformation.
* Visible vertices have positive z coordinate.
* Viewer is located at (0, 0, 0).
+ * No perspective correction is applied.
*/
public Point3D transformedCoordinate;
/**
- * Vertex coordinate in pixels relative to the top left corner of the screen after transformation.
+ * Vertex coordinate in pixels relative to the top left corner of the screen after transformation
+ * and perspective correction.
*/
public Point2D onScreenCoordinate;
+
+ /**
+ * Coordinate within texture.
+ */
+ public Point2D textureCoordinate;
+
+
/**
* The frame number when this vertex was last transformed.
*/
private int lastTransformedFrame;
public Vertex() {
- coordinate = new Point3D();
- transformedCoordinate = new Point3D();
- onScreenCoordinate = new Point2D();
+ this(new Point3D());
}
public Vertex(final Point3D location) {
+ this(location, null);
+ }
+
+ public Vertex(final Point3D location, Point2D textureCoordinate) {
coordinate = location;
transformedCoordinate = new Point3D();
onScreenCoordinate = new Point2D();
+ this.textureCoordinate = textureCoordinate;
}