Added nightmode skybox. Changed how next mark arrow works.
@@ -35,12 +35,15 @@ public class NextMarkController {
|
|||||||
private @FXML Pane pane2d;
|
private @FXML Pane pane2d;
|
||||||
private @FXML Pane pane3d;
|
private @FXML Pane pane3d;
|
||||||
|
|
||||||
|
private View3D view3D;
|
||||||
private VisualiserBoat boat;
|
private VisualiserBoat boat;
|
||||||
|
private boolean zoomedOut = false;
|
||||||
|
|
||||||
public void initialiseArrowView(VisualiserBoat boat) {
|
public void initialiseArrowView(View3D view3D, VisualiserBoat boat) {
|
||||||
|
this.view3D = view3D;
|
||||||
this.boat = boat;
|
this.boat = boat;
|
||||||
pane2d.setVisible(true);
|
pane2d.setVisible(false);
|
||||||
pane3d.setVisible(false);
|
pane3d.setVisible(true);
|
||||||
initialise2dArrowView();
|
initialise2dArrowView();
|
||||||
initialise3dArrowView();
|
initialise3dArrowView();
|
||||||
}
|
}
|
||||||
@@ -66,13 +69,15 @@ public class NextMarkController {
|
|||||||
String arrowPath = "assets/mark_arrow.x3d";
|
String arrowPath = "assets/mark_arrow.x3d";
|
||||||
|
|
||||||
Shape3D arrow = Assets3D.loadX3d(arrowPath);
|
Shape3D arrow = Assets3D.loadX3d(arrowPath);
|
||||||
|
AmbientLight ambientLight = new AmbientLight(Color.web("#999999"));
|
||||||
|
|
||||||
arrow.setScaleX(15);
|
arrow.setScaleX(15);
|
||||||
arrow.setScaleY(25);
|
arrow.setScaleY(15);
|
||||||
arrow.setScaleZ(50);
|
arrow.setScaleZ(200);
|
||||||
arrow.setRotationAxis(new Point3D(1,0,0));
|
arrow.setRotationAxis(new Point3D(1,0,0));
|
||||||
|
|
||||||
arrowStackPane3d.getChildren().add(arrow);
|
arrowStackPane3d.getChildren().add(arrow);
|
||||||
|
arrowStackPane3d.getChildren().add(ambientLight);
|
||||||
|
|
||||||
AnimationTimer arrow3d = new AnimationTimer() {
|
AnimationTimer arrow3d = new AnimationTimer() {
|
||||||
@Override
|
@Override
|
||||||
@@ -80,7 +85,7 @@ public class NextMarkController {
|
|||||||
if (boat.getCurrentLeg().getEndCompoundMark() != null) {
|
if (boat.getCurrentLeg().getEndCompoundMark() != null) {
|
||||||
arrow.getTransforms().clear();
|
arrow.getTransforms().clear();
|
||||||
double zRotation = calculateZRotate();
|
double zRotation = calculateZRotate();
|
||||||
arrow.setRotate(calculateXRotate(zRotation));
|
arrow.getTransforms().add(new Rotate(calculateXRotate(), new Point3D(1, 0, 0)));
|
||||||
arrow.getTransforms().add(new Rotate(zRotation, new Point3D(0, 0, 1)));
|
arrow.getTransforms().add(new Rotate(zRotation, new Point3D(0, 0, 1)));
|
||||||
} else {
|
} else {
|
||||||
stop();
|
stop();
|
||||||
@@ -91,33 +96,23 @@ public class NextMarkController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void show2d() {
|
public void show2d() {
|
||||||
pane3d.setVisible(false);
|
zoomedOut = true;
|
||||||
pane2d.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show3d() {
|
public void show3d() {
|
||||||
pane2d.setVisible(false);
|
zoomedOut = false;
|
||||||
pane3d.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double calculateZRotate() {
|
private double calculateZRotate() {
|
||||||
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
|
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
|
||||||
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
|
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
|
||||||
|
if (zoomedOut) {
|
||||||
|
return -headingToMark.degrees() + 180;
|
||||||
|
}
|
||||||
return -headingToMark.degrees() + boat.getBearing().degrees() + 180;
|
return -headingToMark.degrees() + boat.getBearing().degrees() + 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double calculateXRotate(double zRotation) {
|
private double calculateXRotate() {
|
||||||
// if (zRotation > 360) {
|
return 100 - view3D.getPitch();
|
||||||
// zRotation -=360;
|
|
||||||
// } else if (zRotation < 0) {
|
|
||||||
// zRotation += 360;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (zRotation > 180) {
|
|
||||||
// zRotation = 360 - zRotation;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return 70;
|
|
||||||
//return 90 - 20 * Math.cos(Math.toRadians(zRotation));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,12 +308,6 @@ public class RaceViewController extends Controller {
|
|||||||
private void initialiseView3D(VisualiserRaceEvent race) {
|
private void initialiseView3D(VisualiserRaceEvent race) {
|
||||||
viewSubjects = FXCollections.observableArrayList();
|
viewSubjects = FXCollections.observableArrayList();
|
||||||
|
|
||||||
try {
|
|
||||||
nextMarkController.initialiseArrowView(race.getVisualiserRaceState().getBoat(race.getVisualiserRaceState().getPlayerBoatID()));
|
|
||||||
} catch (BoatNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
AmbientLight ambientLight = new AmbientLight(Color.web("#CCCCFF"));
|
AmbientLight ambientLight = new AmbientLight(Color.web("#CCCCFF"));
|
||||||
ambientLight.setTranslateX(250);
|
ambientLight.setTranslateX(250);
|
||||||
ambientLight.setTranslateZ(210);
|
ambientLight.setTranslateZ(210);
|
||||||
@@ -324,6 +318,11 @@ public class RaceViewController extends Controller {
|
|||||||
pointLight.setTranslateZ(210);
|
pointLight.setTranslateZ(210);
|
||||||
pointLight.setLightOn(true);
|
pointLight.setLightOn(true);
|
||||||
|
|
||||||
|
if (!App.dayMode) {
|
||||||
|
ambientLight.setColor(Color.web("#9999AA"));
|
||||||
|
pointLight.setColor(Color.web("#777799"));
|
||||||
|
}
|
||||||
|
|
||||||
// Import boat mesh
|
// Import boat mesh
|
||||||
URL asset = RaceViewController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
|
URL asset = RaceViewController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
|
||||||
StlMeshImporter importer = new StlMeshImporter();
|
StlMeshImporter importer = new StlMeshImporter();
|
||||||
@@ -350,6 +349,12 @@ public class RaceViewController extends Controller {
|
|||||||
windCompass = new WindCompass(view3D, this.raceState.windProperty());
|
windCompass = new WindCompass(view3D, this.raceState.windProperty());
|
||||||
arrowPane.getChildren().add(windCompass);
|
arrowPane.getChildren().add(windCompass);
|
||||||
|
|
||||||
|
try {
|
||||||
|
nextMarkController.initialiseArrowView(view3D, race.getVisualiserRaceState().getBoat(race.getVisualiserRaceState().getPlayerBoatID()));
|
||||||
|
} catch (BoatNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
// Set up projection from GPS to view
|
// Set up projection from GPS to view
|
||||||
RaceDataSource raceData = visualiserRace.getVisualiserRaceState().getRaceDataSource();
|
RaceDataSource raceData = visualiserRace.getVisualiserRaceState().getRaceDataSource();
|
||||||
final GPSConverter gpsConverter = new GPSConverter(raceData, 450, 450);
|
final GPSConverter gpsConverter = new GPSConverter(raceData, 450, 450);
|
||||||
@@ -357,6 +362,7 @@ public class RaceViewController extends Controller {
|
|||||||
SkyBox skyBox = new SkyBox(750, 200, 250, 0, 210);
|
SkyBox skyBox = new SkyBox(750, 200, 250, 0, 210);
|
||||||
viewSubjects.addAll(skyBox.getSkyBoxPlanes());
|
viewSubjects.addAll(skyBox.getSkyBoxPlanes());
|
||||||
|
|
||||||
|
|
||||||
// Set up sea surface
|
// Set up sea surface
|
||||||
SeaSurface sea = new SeaSurface(750, 200);
|
SeaSurface sea = new SeaSurface(750, 200);
|
||||||
sea.setX(250);
|
sea.setX(250);
|
||||||
@@ -410,8 +416,12 @@ public class RaceViewController extends Controller {
|
|||||||
AnimationTimer highlightTrack = new AnimationTimer() {
|
AnimationTimer highlightTrack = new AnimationTimer() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(long now) {
|
public void handle(long now) {
|
||||||
boatHighlight.setX(gpsConverter.convertGPS(boat.getPosition()).getX());
|
double boatX = gpsConverter.convertGPS(boat.getPosition()).getX();
|
||||||
boatHighlight.setZ(gpsConverter.convertGPS(boat.getPosition()).getY());
|
double boatZ = gpsConverter.convertGPS(boat.getPosition()).getY();
|
||||||
|
boatHighlight.setX(boatX);
|
||||||
|
boatHighlight.setZ(boatZ);
|
||||||
|
pointLight.setTranslateX(boatX);
|
||||||
|
pointLight.setTranslateZ(boatZ);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
highlightTrack.start();
|
highlightTrack.start();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import javafx.scene.paint.Color;
|
|||||||
import javafx.scene.paint.PhongMaterial;
|
import javafx.scene.paint.PhongMaterial;
|
||||||
import javafx.scene.shape.MeshView;
|
import javafx.scene.shape.MeshView;
|
||||||
import javafx.scene.transform.Rotate;
|
import javafx.scene.transform.Rotate;
|
||||||
|
import visualiser.app.App;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -44,7 +45,9 @@ public class SkyBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addTop() {
|
private void addTop() {
|
||||||
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream("images/skybox/ThickCloudsWaterUp2048.png")), size);
|
String imagePath = "images/skybox/ThickCloudsWaterUp2048.png";
|
||||||
|
if (!App.dayMode) imagePath = "images/skybox/DarkStormyUp2048.png";
|
||||||
|
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream(imagePath)), size);
|
||||||
|
|
||||||
surface.setRotationAxis(new Point3D(0, 0, 1));
|
surface.setRotationAxis(new Point3D(0, 0, 1));
|
||||||
surface.setRotate(180);
|
surface.setRotate(180);
|
||||||
@@ -58,7 +61,9 @@ public class SkyBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addRight() {
|
private void addRight() {
|
||||||
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream("images/skybox/ThickCloudsWaterRight2048.png")), size + 1);
|
String imagePath = "images/skybox/ThickCloudsWaterRight2048.png";
|
||||||
|
if (!App.dayMode) imagePath = "images/skybox/DarkStormyRight2048.png";
|
||||||
|
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream(imagePath)), size + 1);
|
||||||
|
|
||||||
surface.setTranslateX(size/2);
|
surface.setTranslateX(size/2);
|
||||||
surface.setTranslateY(size/2);
|
surface.setTranslateY(size/2);
|
||||||
@@ -77,7 +82,9 @@ public class SkyBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addLeft() {
|
private void addLeft() {
|
||||||
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream("images/skybox/ThickCloudsWaterLeft2048.png")), size + 1);
|
String imagePath = "images/skybox/ThickCloudsWaterLeft2048.png";
|
||||||
|
if (!App.dayMode) imagePath = "images/skybox/DarkStormyLeft2048.png";
|
||||||
|
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream(imagePath)), size + 1);
|
||||||
|
|
||||||
surface.setTranslateX(size/2);
|
surface.setTranslateX(size/2);
|
||||||
surface.setTranslateY(size/2);
|
surface.setTranslateY(size/2);
|
||||||
@@ -99,7 +106,9 @@ public class SkyBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addBack() {
|
private void addBack() {
|
||||||
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream("images/skybox/ThickCloudsWaterBack2048.png")), size);
|
String imagePath = "images/skybox/ThickCloudsWaterBack2048.png";
|
||||||
|
if (!App.dayMode) imagePath = "images/skybox/DarkStormyBack2048.png";
|
||||||
|
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream(imagePath)), size);
|
||||||
surface.getTransforms().add(new Rotate(90, 0, 0));
|
surface.getTransforms().add(new Rotate(90, 0, 0));
|
||||||
|
|
||||||
surface.setRotationAxis(new Point3D(1, 0, 0));
|
surface.setRotationAxis(new Point3D(1, 0, 0));
|
||||||
@@ -117,8 +126,9 @@ public class SkyBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addFront() {
|
private void addFront() {
|
||||||
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream("images/skybox/ThickCloudsWaterFront2048.png")), size);
|
String imagePath = "images/skybox/ThickCloudsWaterFront2048.png";
|
||||||
|
if (!App.dayMode) imagePath = "images/skybox/DarkStormyFront2048.png";
|
||||||
|
MeshView surface = makeSurface(new Image(getClass().getClassLoader().getResourceAsStream(imagePath)), size);
|
||||||
surface.setTranslateX(size/2);
|
surface.setTranslateX(size/2);
|
||||||
surface.setTranslateY(size/2);
|
surface.setTranslateY(size/2);
|
||||||
surface.setRotationAxis(new Point3D(0, 0, 1));
|
surface.setRotationAxis(new Point3D(0, 0, 1));
|
||||||
@@ -126,6 +136,7 @@ public class SkyBox {
|
|||||||
surface.setTranslateX(-size/2);
|
surface.setTranslateX(-size/2);
|
||||||
surface.setTranslateY(-size/2);
|
surface.setTranslateY(-size/2);
|
||||||
|
|
||||||
|
|
||||||
surface.setTranslateX(x + size/2 - clipOverlap);
|
surface.setTranslateX(x + size/2 - clipOverlap);
|
||||||
surface.setTranslateY(y + yshift);
|
surface.setTranslateY(y + yshift);
|
||||||
surface.setTranslateZ(z);
|
surface.setTranslateZ(z);
|
||||||
|
|||||||
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 48 KiB |