2 * Sixth 3D engine demos. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public License
6 * or later as published by the Free Software Foundation.
9 package eu.svjatoslav.sixth.e3d.examples;
11 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
12 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
13 import eu.svjatoslav.sixth.e3d.geometry.Rectangle;
14 import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
15 import eu.svjatoslav.sixth.e3d.math.Transform;
16 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
17 import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.TextEditComponent;
18 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
19 import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection;
20 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
21 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Grid2D;
23 public class TextEditorDemo {
25 private static Grid2D createGrid() {
26 final Transform transform = new Transform(new Point3D(0, 100, 0), 0,
29 final Rectangle rectangle = new Rectangle(2000);
30 final LineAppearance appearance = new LineAppearance(10, new Color(
33 return new Grid2D(transform, rectangle, 10, 10, appearance);
36 public static void main(final String[] args) {
38 final ViewFrame viewFrame = new ViewFrame();
39 final ViewPanel viewPanel = viewFrame.getViewPanel();
41 final ShapeCollection shapeCollection = viewFrame.getViewPanel()
42 .getRootShapeCollection();
44 shapeCollection.addShape(createGrid());
47 for (double z = -500 * m; z <= (500 * m); z += 250 * m)
48 for (double x = -500 * m; x <= (500 * m); x += 250 * m) {
50 final TextEditComponent textEditor = new TextEditComponent(
51 new Transform(new Point3D(x, 0, z)), viewPanel,
52 new Point2D(200, 120));
54 shapeCollection.addShape(textEditor);
57 viewPanel.getAvatar().setLocation(new Point3D(500, -300, -800));
58 viewPanel.getAvatar().setAngleXZ(0.6);
59 viewPanel.getAvatar().setAngleYZ(-0.5);