From: Svjatoslav Agejenko Date: Sun, 15 Mar 2026 22:46:16 +0000 (+0200) Subject: refactor: rename MyFirstScene to MinimalExample X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=9b3eb20af61e8670cf2fb8e8d2eeed58ad494c5b;p=sixth-3d-demos.git refactor: rename MyFirstScene to MinimalExample Rename class for clarity - it's the minimal working example from the documentation. --- diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/MinimalExample.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/MinimalExample.java new file mode 100644 index 0000000..af755e8 --- /dev/null +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/MinimalExample.java @@ -0,0 +1,44 @@ +/* + * Sixth 3D engine demos. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. + * + */ +package eu.svjatoslav.sixth.e3d.examples; + +import eu.svjatoslav.sixth.e3d.geometry.Point3D; +import eu.svjatoslav.sixth.e3d.gui.ViewFrame; +import eu.svjatoslav.sixth.e3d.math.Transform; +import eu.svjatoslav.sixth.e3d.renderer.raster.Color; +import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection; +import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.solid.SolidPolygonRectangularBox; + +/** + * Minimal example demonstrating how to create a basic 3D scene. + *

+ * Creates a window with a single red box. This is the "Create Your First 3D Scene" + * example from the Sixth 3D documentation. + */ +public class MinimalExample { + + /** + * Entry point for the minimal scene demo. + * @param args command line arguments (ignored) + */ + public static void main(String[] args) { + ViewFrame viewFrame = new ViewFrame(); + ShapeCollection shapes = viewFrame.getViewPanel().getRootShapeCollection(); + + Transform boxTransform = new Transform(new Point3D(0, 0, 0), 0, 0); + SolidPolygonRectangularBox box = new SolidPolygonRectangularBox( + new Point3D(-50, -50, -50), + new Point3D(50, 50, 50), + Color.RED + ); + box.setTransform(boxTransform); + shapes.addShape(box); + + viewFrame.getViewPanel().getCamera().getTransform().setTranslation(new Point3D(0, -100, -300)); + + viewFrame.getViewPanel().ensureRenderThreadStarted(); + } +} \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/MyFirstScene.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/MyFirstScene.java deleted file mode 100644 index ffef135..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/MyFirstScene.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Sixth 3D engine demos. Author: Svjatoslav Agejenko. - * This project is released under Creative Commons Zero (CC0) license. - * - */ -package eu.svjatoslav.sixth.e3d.examples; - -import eu.svjatoslav.sixth.e3d.geometry.Point3D; -import eu.svjatoslav.sixth.e3d.gui.ViewFrame; -import eu.svjatoslav.sixth.e3d.math.Transform; -import eu.svjatoslav.sixth.e3d.renderer.raster.Color; -import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection; -import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.solid.SolidPolygonRectangularBox; - -/** - * Minimal example demonstrating how to create a basic 3D scene. - *

- * Creates a window with a single red box. This is the "Create Your First 3D Scene" - * example from the Sixth 3D documentation. - */ -public class MyFirstScene { - - /** - * Entry point for the minimal scene demo. - * @param args command line arguments (ignored) - */ - public static void main(String[] args) { - ViewFrame viewFrame = new ViewFrame(); - ShapeCollection shapes = viewFrame.getViewPanel().getRootShapeCollection(); - - Transform boxTransform = new Transform(new Point3D(0, 0, 0), 0, 0); - SolidPolygonRectangularBox box = new SolidPolygonRectangularBox( - new Point3D(-50, -50, -50), - new Point3D(50, 50, 50), - Color.RED - ); - box.setTransform(boxTransform); - shapes.addShape(box); - - viewFrame.getViewPanel().getCamera().getTransform().setTranslation(new Point3D(0, -100, -300)); - - viewFrame.getViewPanel().ensureRenderThreadStarted(); - } -} \ No newline at end of file diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/ApplicationListPanel.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/ApplicationListPanel.java index f34148c..bd0d9a8 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/ApplicationListPanel.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/ApplicationListPanel.java @@ -7,7 +7,7 @@ package eu.svjatoslav.sixth.e3d.examples.launcher; import eu.svjatoslav.sixth.e3d.examples.GraphDemo; -import eu.svjatoslav.sixth.e3d.examples.MyFirstScene; +import eu.svjatoslav.sixth.e3d.examples.MinimalExample; import eu.svjatoslav.sixth.e3d.examples.OctreeDemo; import eu.svjatoslav.sixth.e3d.examples.RandomPolygonsDemo; import eu.svjatoslav.sixth.e3d.examples.RainingNumbersDemo; @@ -33,9 +33,9 @@ class ApplicationListPanel extends JPanel { private record DemoEntry(String name, String description, AbstractAction action) {} private static final DemoEntry[] DEMOS = { - new DemoEntry("My First Scene", + new DemoEntry("Minimal Example", "Minimal example showing a single red box", - new ShowMyFirstScene()), + new ShowMinimalExample()), new DemoEntry("Volumetric Octree", "Octree-based rendering with on-demand raytracing", new ShowOctree()), @@ -107,14 +107,14 @@ class ApplicationListPanel extends JPanel { .addGroup(horizontalDescGroup)); } - private static class ShowMyFirstScene extends AbstractAction { - ShowMyFirstScene() { - putValue(NAME, "My First Scene"); + private static class ShowMinimalExample extends AbstractAction { + ShowMinimalExample() { + putValue(NAME, "Minimal Example"); } @Override public void actionPerformed(final ActionEvent e) { - MyFirstScene.main(null); + MinimalExample.main(null); } }