correction Point
This commit is contained in:
parent
84db074e0b
commit
7b14b546c4
@ -3,6 +3,7 @@ package lsystem;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import lsystem.screen.gl2d.SwingGLCanvas2D;
|
||||
import lsystem.screen.gl3d.GLCanvas;
|
||||
import lsystem.screen.main.MainFrame;
|
||||
import lsystem.utils.Pair;
|
||||
|
||||
@ -18,7 +19,7 @@ public class Main2D {
|
||||
new Thread(() -> joglFrame = new SwingGLCanvas2D()).start();
|
||||
} */
|
||||
|
||||
public static void main(String[] args) {
|
||||
/* public static void main(String[] args) {
|
||||
|
||||
MainFrame frame = new MainFrame();
|
||||
frame.setVisible(true);
|
||||
@ -32,6 +33,17 @@ public class Main2D {
|
||||
joglFrame.setLSystem(axiom,rules,5);
|
||||
joglFrame.setVisible(true);
|
||||
}).start();
|
||||
} */
|
||||
|
||||
public static MainFrame mainFrame;
|
||||
public static SwingGLCanvas2D joglFrame;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Thread(() -> {
|
||||
mainFrame = new MainFrame();
|
||||
mainFrame.setVisible(true);
|
||||
}).start();
|
||||
new Thread(() -> joglFrame = new SwingGLCanvas2D()).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,16 +54,16 @@ public class JoglEventListener2D implements GLEventListener {
|
||||
public void dispose(GLAutoDrawable glAutoDrawable) {
|
||||
}
|
||||
|
||||
public void drawAll (GL2 gl, Element actual, lsystem.screen.gl2d.Point origin) {
|
||||
public void drawAll (GL2 gl, Element actual, lsystem.screen.gl2d.Point2 origin) {
|
||||
if (actual.property == ElementProperties.DRAW) {
|
||||
System.out.println("DESSIN");
|
||||
lsystem.screen.gl2d.Point newOrigin = new lsystem.screen.gl2d.Point (origin, actual.getRotation2D());
|
||||
lsystem.screen.gl2d.Point2 newOrigin = new lsystem.screen.gl2d.Point2 (origin, actual.getRotation2D());
|
||||
DrawHelper.drawStick(gl, origin, newOrigin);
|
||||
}
|
||||
System.out.println(actual.children.isEmpty());
|
||||
for (Element children : actual.children) {
|
||||
System.out.println("CHILD");
|
||||
drawAll(gl, children, new lsystem.screen.gl2d.Point (origin, actual.getRotation2D()));
|
||||
drawAll(gl, children, new lsystem.screen.gl2d.Point2 (origin, actual.getRotation2D()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class JoglEventListener2D implements GLEventListener {
|
||||
|
||||
GL2 gl = glAutoDrawable.getGL().getGL2();
|
||||
|
||||
drawAll (gl, canvas.getLSystem(), new lsystem.screen.gl2d.Point(-1.0f, -1.0f));
|
||||
drawAll (gl, canvas.getLSystem(), new lsystem.screen.gl2d.Point2(-1.0f, -1.0f));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
package lsystem.screen.gl2d;
|
||||
|
||||
public class Point {
|
||||
public class Point2 {
|
||||
private float x;
|
||||
private float y;
|
||||
|
||||
public Point () {
|
||||
public Point2 () {
|
||||
|
||||
}
|
||||
|
||||
public Point (float x, float y) {
|
||||
public Point2 (float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Point (Point old, int angle) {
|
||||
public Point2 (Point2 old, int angle) {
|
||||
angle = compactAngle(angle);
|
||||
//Point a = new Point();
|
||||
//x = getNewOrigin(old, angle, 0.1f);
|
||||
@ -36,7 +36,7 @@ public class Point {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void getNewOrigin (Point old, int angle, float echelle) {
|
||||
public void getNewOrigin (Point2 old, int angle, float echelle) {
|
||||
|
||||
int newX=0, newY=0;
|
||||
switch (angle) {
|
@ -4,6 +4,7 @@ import com.jogamp.opengl.GL2;
|
||||
import com.jogamp.opengl.util.gl2.GLUT;
|
||||
|
||||
import lsystem.screen.gl2d.Point;
|
||||
import lsystem.screen.gl2d.Point2;
|
||||
import lsystem.screen.gl2d.SwingGLCanvas2D;
|
||||
|
||||
public class DrawHelper {
|
||||
@ -103,7 +104,7 @@ public class DrawHelper {
|
||||
+ canvas.camera[3] + " pitch = " + canvas.camera[4] + " roll = " + canvas.camera[5]);
|
||||
}
|
||||
|
||||
public static void drawStick(GL2 gl, Point origin, Point newOrigin) {
|
||||
public static void drawStick(GL2 gl, Point2 origin, Point2 newOrigin) {
|
||||
|
||||
gl.glBegin(GL2.GL_LINES);
|
||||
gl.glVertex2f(origin.getX(), origin.getY());
|
||||
|
Loading…
Reference in New Issue
Block a user