otherwise it dies.
+ Dead cell becomes alive if neighbors count is exactly 3.
-[[file:screenshots/life.png]]
+[[file:Screenshots/Life.png]]
Current application projects 2D game grid/matrix onto three
dimensional space. Extra dimension (height) is used to visualize
:ID: 39250157-db8e-4861-a21b-8568912bd160
:END:
-[[file:screenshots/text editors.png]]
+[[file:Screenshots/Text editors.png]]
Initial test for creating user interfaces in 3D and:
+ window focus handling
*Quite a lot of text editors can be rendered:*
-[[file:screenshots/text editors 2.png]]
+[[file:Screenshots/Text editors 2.png]]
See also [[https://hackers-1995.vercel.app/][similar looking web based demo]] ! :)
** Mathematical formulas
:PROPERTIES:
:CUSTOM_ID: mathematical-formulas
-:ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890
+:ID: b1c2d3e4-f5a6-7890-bcde-f12345678901
:END:
-[[file:screenshots/mathematical formulas.png]]
+[[file:Screenshots/Mathematical formulas.png]]
+ TODO: instead of projecting 2D visualizations onto 3D space,
visualize some formula using all 3 dimensions avaliable.
-** Sine heightmaps and sphere
+** Sine heightmap and sphere
:PROPERTIES:
:CUSTOM_ID: sine-heightmaps-and-sphere
:ID: b2c3d4e5-f6a7-8901-bcde-f12345678901
:END:
-[[file:screenshots/sinus heightmaps and sphere.png]]
+[[file:Screenshots/Sine heightmap and sphere.png]]
Simple test scene. Easy to implement and looks nice.
:ID: c3d4e5f6-a7b8-9012-cdef-123456789012
:END:
-[[file:screenshots/raytracing fractal in voxel polygon hybrid scene.png]]
+[[file:Screenshots/Raytracing fractal in voxel polygon hybrid scene.png]]
Test scene that is generated simultaneously using:
+ conventional polygons
================================================================================
#+end_example
+** Developer tools
+:PROPERTIES:
+:CUSTOM_ID: developer-tools
+:ID: 8c5e2a1f-9d3b-4f6a-b8e7-1c4d5f7a9b2e
+:END:
+
+Press *F12* in any demo to open the Developer Tools panel. This
+debugging interface provides real-time insight into the rendering
+pipeline with diagnostic toggles.
* Source code
:PROPERTIES:
*/
public class GraphDemo {
+ /**
+ * Creates a new GraphDemo instance.
+ */
+ public GraphDemo() {
+ }
+
/** Frequency of the wave pattern in the wobbly surfaces. */
private static final double WAVE_FREQUENCY = 50d;
/** Amplitude of the wave pattern in the wobbly surfaces. */
--- /dev/null
+/*
+ * 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.
+ * <p>
+ * 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
*/
public class OctreeDemo extends WorldNavigationUserInputTracker {
+ /**
+ * Creates a new OctreeDemo instance.
+ */
+ public OctreeDemo() {
+ }
+
/** Scale factor for rendering octree voxels in the scene. */
private static final double magnification = 5;
private final LineAppearance gridAppearance = new LineAppearance(40, new Color(255,
*/
public class RainingNumbersDemo implements FrameListener {
+ /**
+ * Creates a new RainingNumbersDemo instance.
+ */
+ public RainingNumbersDemo() {
+ }
+
/** Number of falling numbers in the scene. */
private static final int NUMBERS_COUNT = 1000;
/** Size of the cubic area containing the numbers. */
*/
public class RandomPolygonsDemo {
+ /**
+ * Creates a new RandomPolygonsDemo instance.
+ */
+ public RandomPolygonsDemo() {
+ }
+
/** Average size of each random polygon. */
private static final double POLYGON_AVERAGE_SIZE = 130;
/** Number of polygons to generate. */
*/
public class ShadedShapesDemo {
+ /**
+ * Creates a new ShadedShapesDemo instance.
+ */
+ public ShadedShapesDemo() {
+ }
+
/** Number of orbiting light sources in the scene. */
private static final int LIGHT_COUNT = 10;
*/
public class TextEditorDemo {
+ /**
+ * Creates a new TextEditorDemo instance.
+ */
+ public TextEditorDemo() {
+ }
+
/**
* Entry point for the text editor demo.
* @param args command line arguments (ignored)
*/
public class TextEditorDemo2 {
+ /**
+ * Creates a new TextEditorDemo2 instance.
+ */
+ public TextEditorDemo2() {
+ }
+
/**
* Entry point for the text editor city demo.
* @param args command line arguments (ignored)
*/
public class WindingOrderDemo {
+ /**
+ * Creates a new WindingOrderDemo instance.
+ */
+ public WindingOrderDemo() {
+ }
+
+ /**
+ * Entry point for the winding order demo.
+ * @param args command line arguments (ignored)
+ */
public static void main(String[] args) {
ViewFrame viewFrame = new ViewFrame();
ViewPanel viewPanel = viewFrame.getViewPanel();
*/
public class SolidCubesTest implements BenchmarkTest {
+ /**
+ * Creates a new SolidCubesTest instance.
+ */
+ public SolidCubesTest() {
+ }
+
private static final int GRID_SIZE = 16;
private static final double SPACING = 80;
private static final double CUBE_SIZE = 25;
*/
public class StarGridTest implements BenchmarkTest {
+ /**
+ * Creates a new StarGridTest instance.
+ */
+ public StarGridTest() {
+ }
+
private static final int GRID_SIZE = 16;
private static final double SPACING = 80;
private static final double STAR_SIZE = 20;
*/
public class TexturedCubesTest implements BenchmarkTest {
+ /**
+ * Creates a new TexturedCubesTest instance.
+ */
+ public TexturedCubesTest() {
+ }
+
private static final int GRID_SIZE = 16;
private static final double SPACING = 80;
private static final double CUBE_SIZE = 25;
*/
public class WireframeCubesTest implements BenchmarkTest {
+ /**
+ * Creates a new WireframeCubesTest instance.
+ */
+ public WireframeCubesTest() {
+ }
+
private static final int GRID_SIZE = 16;
private static final double SPACING = 80;
private static final double CUBE_SIZE = 25;
*/
public class PointCloudDemo {
+ /**
+ * Creates a new PointCloudDemo instance.
+ */
+ public PointCloudDemo() {
+ }
+
/**
* Entry point for the point cloud demo.
* @param args command line arguments (ignored)
--- /dev/null
+/*
+ * Sixth 3D engine demos. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
+ */
+
+/**
+ * Galaxy simulation demo using glowing points.
+ *
+ * <p>Creates a spiral galaxy visualization using
+ * {@link eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.GlowingPoint}
+ * shapes arranged in a mathematical spiral pattern.</p>
+ *
+ * <p>Key classes:</p>
+ * <ul>
+ * <li>{@link eu.svjatoslav.sixth.e3d.examples.galaxy_demo.Galaxy} - The galaxy shape</li>
+ * <li>{@link eu.svjatoslav.sixth.e3d.examples.galaxy_demo.PointCloudDemo} - Demo entry point</li>
+ * </ul>
+ *
+ * @see eu.svjatoslav.sixth.e3d.examples.galaxy_demo.Galaxy
+ */
+
+package eu.svjatoslav.sixth.e3d.examples.galaxy_demo;
\ No newline at end of file
* Sixth 3D engine demos. Author: Svjatoslav Agejenko.
* This project is released under Creative Commons Zero (CC0) license.
*
-*/
+ */
package eu.svjatoslav.sixth.e3d.examples.launcher;
import eu.svjatoslav.sixth.e3d.examples.GraphDemo;
+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;
/**
* Panel containing buttons to launch each demo application.
- * Displays a vertical list of buttons organized in a sequential group layout.
+ * Displays a vertical list with button and description for each demo.
*/
class ApplicationListPanel extends JPanel {
private static final long serialVersionUID = 2012721856427052560L;
- /** Constructs the panel with all demo launcher buttons. */
+ private static final int BUTTON_WIDTH = 160;
+ private static final int GAP = 12;
+
+ private record DemoEntry(String name, String description, AbstractAction action) {}
+
+ private static final DemoEntry[] DEMOS = {
+ new DemoEntry("Minimal Example",
+ "Minimal example showing a single red box",
+ new ShowMinimalExample()),
+ new DemoEntry("Volumetric Octree",
+ "Octree-based rendering with on-demand raytracing",
+ new ShowOctree()),
+ new DemoEntry("Mathematical graphs",
+ "Function graphs rendered in 3D around a sphere",
+ new ShowMathGraphs()),
+ new DemoEntry("Point cloud galaxy",
+ "Spiral galaxy with 10,000 glowing points",
+ new ShowPointCloud()),
+ new DemoEntry("Raining numbers",
+ "Numbers falling through 3D space like rain",
+ new ShowRain()),
+ new DemoEntry("Text editors",
+ "5x5 grid of 3D text editor components",
+ new ShowTextEditors()),
+ new DemoEntry("Text editors city",
+ "3D city of text editor panels as buildings",
+ new ShowTextEditors2()),
+ new DemoEntry("Game of Life",
+ "Conway's Game of Life with 3D visualization",
+ new ShowGameOfLife()),
+ new DemoEntry("Random polygons",
+ "1000 semi-transparent triangles with depth sorting",
+ new ShowRandomPolygons()),
+ new DemoEntry("Shaded Shapes",
+ "Shapes lit by orbiting colored light sources",
+ new ShowShadedShapes()),
+ new DemoEntry("Graphics Benchmark",
+ "Automated performance measuring FPS across modes",
+ new ShowGraphicsBenchmark()),
+ };
+
ApplicationListPanel() {
- final GroupLayout groupLayout = new GroupLayout(this);
- GroupLayout.SequentialGroup sequentialGroup = groupLayout.createSequentialGroup();
- sequentialGroup.addComponent(new JLabel("Choose an example to launch:"));
- sequentialGroup.addComponent(new JButton(new ShowOctree()));
- sequentialGroup.addComponent(new JButton(new ShowMathGraphs()));
- sequentialGroup.addComponent(new JButton(new ShowPointCloud()));
- sequentialGroup.addComponent(new JButton(new ShowRain()));
- sequentialGroup.addComponent(new JButton(new ShowTextEditors()));
- sequentialGroup.addComponent(new JButton(new ShowTextEditors2()));
- sequentialGroup.addComponent(new JButton(new ShowGameOfLife()));
- sequentialGroup.addComponent(new JButton(new ShowRandomPolygons()));
- sequentialGroup.addComponent(new JButton(new ShowShadedShapes()));
- sequentialGroup.addComponent(new JButton(new ShowGraphicsBenchmark()));
+ final GroupLayout layout = new GroupLayout(this);
+ setLayout(layout);
+
+ layout.setAutoCreateGaps(true);
+ layout.setAutoCreateContainerGaps(true);
+
+ final GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup();
+ final GroupLayout.ParallelGroup horizontalButtonGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ final GroupLayout.ParallelGroup horizontalDescGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING);
+
+ final JLabel headerLabel = new JLabel("Choose an example to launch:");
+ headerLabel.setFont(headerLabel.getFont().deriveFont(java.awt.Font.BOLD));
+ verticalGroup.addComponent(headerLabel);
+ horizontalButtonGroup.addComponent(headerLabel);
+ horizontalDescGroup.addComponent(headerLabel);
+
+ for (final DemoEntry entry : DEMOS) {
+ final JButton button = new JButton(entry.action());
+ button.setPreferredSize(new java.awt.Dimension(BUTTON_WIDTH, button.getPreferredSize().height));
+
+ final JLabel descLabel = new JLabel(entry.description());
+ descLabel.setFont(descLabel.getFont().deriveFont(java.awt.Font.PLAIN));
+
+ verticalGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(button)
+ .addComponent(descLabel));
+
+ horizontalButtonGroup.addComponent(button);
+ horizontalDescGroup.addComponent(descLabel);
+ }
+
+ layout.setVerticalGroup(verticalGroup);
+ layout.setHorizontalGroup(layout.createSequentialGroup()
+ .addGroup(horizontalButtonGroup)
+ .addGap(GAP)
+ .addGroup(horizontalDescGroup));
+ }
+
+ private static class ShowMinimalExample extends AbstractAction {
+ ShowMinimalExample() {
+ putValue(NAME, "Minimal Example");
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ MinimalExample.main(null);
+ }
}
- /** Action to launch the TextEditorDemo. */
private static class ShowTextEditors extends AbstractAction {
ShowTextEditors() {
putValue(NAME, "Text editors");
}
}
- /** Action to launch the TextEditorDemo2 (city view). */
private static class ShowTextEditors2 extends AbstractAction {
ShowTextEditors2() {
putValue(NAME, "Text editors city");
}
}
-
- /** Action to launch the RainingNumbersDemo. */
private static class ShowRain extends AbstractAction {
ShowRain() {
putValue(NAME, "Raining numbers");
}
}
- /** Action to launch the PointCloudDemo (galaxy simulation). */
private static class ShowPointCloud extends AbstractAction {
ShowPointCloud() {
putValue(NAME, "Point cloud galaxy");
}
}
- /** Action to launch the GraphDemo (mathematical graphs). */
private static class ShowMathGraphs extends AbstractAction {
ShowMathGraphs() {
putValue(NAME, "Mathematical graphs");
}
}
- /** Action to launch the RandomPolygonsDemo. */
private static class ShowRandomPolygons extends AbstractAction {
ShowRandomPolygons() {
putValue(NAME, "Random polygons");
}
}
- /** Action to launch the OctreeDemo (volumetric rendering). */
private static class ShowOctree extends AbstractAction {
ShowOctree() {
putValue(NAME, "Volumetric Octree");
}
}
- /** Action to launch the Game of Life 3D demo. */
private static class ShowGameOfLife extends AbstractAction {
ShowGameOfLife() {
putValue(NAME, "Game of Life");
}
}
- /** Action to launch the ShadedShapesDemo (lighting demonstration). */
private static class ShowShadedShapes extends AbstractAction {
ShowShadedShapes() {
- putValue(NAME, "Shaded Shapes with Lights");
+ putValue(NAME, "Shaded Shapes");
}
@Override
}
}
- /** Action to launch the GraphicsBenchmark. */
private static class ShowGraphicsBenchmark extends AbstractAction {
ShowGraphicsBenchmark() {
putValue(NAME, "Graphics Benchmark");
GraphicsBenchmark.main(null);
}
}
-
-}
+}
\ No newline at end of file
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(new ApplicationListPanel(), CENTER);
- frame.setSize(400, 300);
+
+ frame.pack();
+ frame.setMinimumSize(frame.getSize());
frame.setLocationRelativeTo(null); // center frame on screen
frame.setVisible(true);
--- /dev/null
+/*
+ * Sixth 3D engine demos. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
+ */
+
+/**
+ * Demo launcher application.
+ *
+ * <p>Provides a GUI window with buttons to launch each demo application.
+ * The main entry point is {@link eu.svjatoslav.sixth.e3d.examples.launcher.Main}.</p>
+ *
+ * @see eu.svjatoslav.sixth.e3d.examples.launcher.Main
+ */
+
+package eu.svjatoslav.sixth.e3d.examples.launcher;
\ No newline at end of file
*/
public class Main extends WorldNavigationUserInputTracker {
+ /**
+ * Creates a new Main instance for the Game of Life demo.
+ */
+ public Main() {
+ }
+
/** The game of life matrix, centered at the origin. */
private static final Matrix MATRIX = new Matrix(
new Point3D() // position matrix in the center of the scene
--- /dev/null
+/*
+ * Sixth 3D engine demos. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
+ */
+
+/**
+ * Conway's Game of Life 3D demo.
+ *
+ * <p>Implements a 30x30 cell matrix where cells evolve based on Conway's rules.
+ * Users can interact by clicking to toggle cell states. The simulation runs
+ * in a 3D view with camera navigation.</p>
+ *
+ * <p>Key classes:</p>
+ * <ul>
+ * <li>{@link eu.svjatoslav.sixth.e3d.examples.life_demo.Main} - Demo entry point</li>
+ * <li>{@link eu.svjatoslav.sixth.e3d.examples.life_demo.Cell} - Individual cell representation</li>
+ * <li>{@link eu.svjatoslav.sixth.e3d.examples.life_demo.Matrix} - The cell grid</li>
+ * </ul>
+ *
+ * @see eu.svjatoslav.sixth.e3d.examples.life_demo.Main
+ */
+
+package eu.svjatoslav.sixth.e3d.examples.life_demo;
\ No newline at end of file