From: Svjatoslav Agejenko Date: Mon, 8 May 2023 23:24:14 +0000 (+0300) Subject: Improved code readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=5a51f90f06561a1262ea9805f58d856a9cadd015;p=sixth-3d.git Improved code readability --- diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/package-info.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/package-info.java new file mode 100644 index 0000000..9423419 --- /dev/null +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/package-info.java @@ -0,0 +1,5 @@ +package eu.svjatoslav.sixth.e3d.geometry; + +/** + * Goal is to provide basic geometry classes. + */ \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java index abbf0dd..f2d58c9 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java @@ -11,6 +11,9 @@ import static java.lang.Math.sin; /** * The avatar is a user-controlled object in the 3D world. + * + * It is a point in space that can be moved around by the user. + * It has orientation in space, and it can also be rotated around. */ public class Avatar implements ViewRenderListener { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java index a5f7fb7..63ff0d9 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java @@ -13,13 +13,32 @@ import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.awt.image.WritableRaster; +/** + * Rendering context that contains all the information that is needed to render the scene. + */ + public class RenderingContext { public static final int bufferedImageType = BufferedImage.TYPE_4BYTE_ABGR; + public final Graphics2D graphics; + + /** + * Pixels of the rendering area. + * Each pixel is represented by 4 bytes: alpha, blue, green, red. + */ public final byte[] pixels; + + /** + * Width of the rendering area in pixels. + */ public final int width; + + /** + * Height of the rendering area in pixels. + */ public final int height; + /** * Center of the screen in screen space (pixels). * This is the point where (0,0) coordinate of the world space is rendered. diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java index 6a824c8..a7b0445 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java @@ -12,7 +12,7 @@ import java.awt.event.WindowEvent; import java.awt.event.WindowListener; /** - * Java Swing GUI frame that contains canvas for 3D rendering. + * Java Swing GUI frame that contains {@link ViewPanel} with canvas for 3D rendering. */ public class ViewFrame extends JFrame implements WindowListener { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/package-info.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/package-info.java index 3773a0a..ff8dff5 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/package-info.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/package-info.java @@ -1,7 +1,5 @@ package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; /** - * This package contains a text editor component. - * - * It is a simple text editor. + * This package contains a simple text editor component. */ \ No newline at end of file