Added scroll-wheel zooming

- Race pane listens to scroll delta and sets View3D distance accordingly
- GPSConverter has more applicable property names for infinite 3D

#story[1190]
This commit is contained in:
Connor Taylor-Brown
2017-09-07 23:22:27 +12:00
parent 7bad0e53ff
commit 54baf4f884
4 changed files with 47 additions and 66 deletions
@@ -51,8 +51,6 @@ public class View3D extends Pane {
*/
private Rotate pitch;
private PerspectiveCamera camera;
/**
* Default constructor for View3D. Sets up Scene and PerspectiveCamera.
*/
@@ -88,9 +86,7 @@ public class View3D extends Pane {
yaw = new Rotate(0, Rotate.Y_AXIS);
pitch = new Rotate(0, Rotate.X_AXIS);
camera.getTransforms().addAll(pivot, yaw, pitch, distance);
centerCamera();
this.camera = camera;
return camera;
}
@@ -120,12 +116,6 @@ public class View3D extends Pane {
this.pivot.setZ(pivot.getZ());
}
public void updatePosition(double x, double y, double z) {
this.distance.setX(x);
this.distance.setY(y);
this.distance.setZ(z);
}
/**
* Set distance of camera from pivot
* @param distance in units
@@ -134,6 +124,10 @@ public class View3D extends Pane {
this.distance.setZ(-distance);
}
public void updateDistance(double delta) {
this.distance.setZ(this.distance.getZ() - delta);
}
/**
* Set angle of camera from z-axis along ground
* @param yaw in degrees
@@ -149,13 +143,4 @@ public class View3D extends Pane {
public void setPitch(double pitch) {
this.pitch.setAngle(-pitch);
}
public void centerCamera(){
}
public void rotateCamera(double angle, double x, double y, double z){
camera.setRotationAxis(new Point3D(x, y, z));
camera.setRotate(-90);
}
}