2 * Sixth 3D engine demos. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
7 package eu.svjatoslav.sixth.e3d.examples;
9 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
10 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
11 import eu.svjatoslav.sixth.e3d.geometry.Rectangle;
12 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
13 import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
14 import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.TextEditComponent;
15 import eu.svjatoslav.sixth.e3d.math.Transform;
16 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
17 import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection;
18 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
19 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Grid2D;
21 public class TextEditorDemo {
23 private static Grid2D createGrid() {
24 final Transform transform = new Transform(new Point3D(0, 100, 0), 0,
27 final Rectangle rectangle = new Rectangle(2000);
28 final LineAppearance appearance = new LineAppearance(10, new Color(
31 return new Grid2D(transform, rectangle, 10, 10, appearance);
34 public static void main(final String[] args) {
36 final ViewFrame viewFrame = new ViewFrame();
37 final ViewPanel viewPanel = viewFrame.getViewPanel();
39 final ShapeCollection shapeCollection = viewFrame.getViewPanel()
40 .getRootShapeCollection();
42 shapeCollection.addShape(createGrid());
45 for (double z = -500 * m; z <= (500 * m); z += 250 * m)
46 for (double x = -500 * m; x <= (500 * m); x += 250 * m) {
48 final TextEditComponent textEditor = new TextEditComponent(
49 new Transform(new Point3D(x, 0, z)), viewPanel,
50 new Point2D(200, 120));
52 shapeCollection.addShape(textEditor);
55 viewPanel.getAvatar().setLocation(new Point3D(500, -300, -800));
56 viewPanel.getAvatar().setAngleXZ(0.6);
57 viewPanel.getAvatar().setAngleYZ(-0.5);