Using new arrow / arrow textures. Made sails not clickable.

This commit is contained in:
Joseph
2017-09-26 18:30:29 +13:00
parent affbb69029
commit 699df2e775
5 changed files with 72 additions and 14 deletions
@@ -19,6 +19,8 @@ import javafx.scene.transform.Rotate;
import shared.model.Bearing;
import shared.model.CompoundMark;
import shared.model.GPSCoordinate;
import visualiser.layout.Annotation3D;
import visualiser.layout.Assets3D;
import visualiser.layout.Subject3D;
import visualiser.layout.View3D;
import visualiser.model.VisualiserBoat;
@@ -57,24 +59,16 @@ public class NextMarkController {
private void initialise3dArrowView() {
ObservableList<Subject3D> viewSubjects = FXCollections.observableArrayList();
URL asset = this.getClass().getClassLoader().getResource("assets/arrow V1.0.4.stl");
StlMeshImporter importer = new StlMeshImporter();
importer.read(asset);
String arrowPath = "assets/mark_arrow.x3d";
MeshView arrow = new MeshView(importer.getImport());
PhongMaterial arrowMat = new PhongMaterial(Color.GREEN);
arrow.setMaterial(arrowMat);
AmbientLight ambientLight = new AmbientLight(Color.web("#777777"));
ambientLight.setLightOn(true);
Shape3D arrow = Assets3D.loadX3d(arrowPath);
arrow.setScaleX(25);
arrow.setScaleY(25);
arrow.setScaleZ(200);
arrow.setScaleZ(100);
arrow.setRotationAxis(new Point3D(1,0,0));
arrowStackPane3d.getChildren().add(arrow);
//arrowStackPane3d.getChildren().add(ambientLight);
AnimationTimer arrow3d = new AnimationTimer() {
@Override
@@ -101,7 +95,7 @@ public class NextMarkController {
private double calculateZRotate() {
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
return -headingToMark.degrees() + boat.getBearing().degrees();
return -headingToMark.degrees() + boat.getBearing().degrees() + 180;
}
private double calculateXRotate(double zRotation) {
@@ -115,6 +109,7 @@ public class NextMarkController {
zRotation = 360 - zRotation;
}
return 90 - 20 * Math.cos(Math.toRadians(zRotation));
return 110;
// return 90 - 20 * Math.cos(Math.toRadians(zRotation));
}
}
@@ -420,6 +420,7 @@ public class RaceViewController extends Controller {
//add sail
Sails3D sails3D = new Sails3D();
Subject3D sailsSubject = new Subject3D(sails3D, 0);
sails3D.setMouseTransparent(true);
sails3D.setMaterial(boatColorMat);
sailsSubject.setXRot(0d);
sailsSubject.setHeading(visualiserRace.getVisualiserRaceState().getWindDirection().degrees());
@@ -52,7 +52,7 @@ public class Assets3D {
windArrow = new Annotation3D(loadX3d(arrowPath));
}
private static Shape3D loadX3d(String path){
public static Shape3D loadX3d(String path){
X3dModelImporter x3dModelImporter = new X3dModelImporter();
URL asset = Assets3D.class.getClassLoader().getResource(path);
x3dModelImporter.read(asset);