X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fmath%2FVertex.java;h=6e083fc541ebd448a2dc65083fb27f29c758fb03;hp=0c77868b426dc844cd666376f5eeb24b3fa106d0;hb=a38bc412f8c6ae6c8fdf9466ae9b2073c2a73614;hpb=de8fb260a5e99922231b1d0f437916e796ec6ccb diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/Vertex.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/Vertex.java index 0c77868..6e083fc 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/math/Vertex.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/Vertex.java @@ -21,14 +21,19 @@ public class Vertex { /** * 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() { @@ -43,14 +48,16 @@ public class 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;