/**
* Vertex coordinate relative to the viewer after transformation.
+ * Visible vertices have positive z coordinate.
+ * Viewer is located at (0, 0, 0).
*/
public Point3D transformedCoordinate;
/**
- * Vertex coordinate on screen after transformation.
+ * Vertex coordinate in pixels relative to the top left corner of the screen after transformation.
*/
public Point2D onScreenCoordinate;
+ /**
+ * The frame number when this vertex was last transformed.
+ */
private int lastTransformedFrame;
public Vertex() {
onScreenCoordinate = new Point2D();
}
+
/**
- * Transforms the coordinate.
+ * Transforms vertex coordinate to calculate its location relative to the viewer.
+ * It also calculates its location on the screen.
*
- * @param transforms The transforms pipeline.
- * @param renderContext The rendering context.
+ * @param transforms Transforms pipeline.
+ * @param renderContext Rendering context.
*/
- public void transform(final TransformsPipeline transforms,
- final RenderingContext renderContext) {
+ public void calculateLocationRelativeToViewer(final TransformsStack transforms,
+ final RenderingContext renderContext) {
if (lastTransformedFrame == renderContext.frameNumber)
return;