|
|
|
|
@ -385,11 +385,29 @@ public class RaceViewController extends Controller {
|
|
|
|
|
viewSubjects.add(markModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Position and add each boat to view
|
|
|
|
|
for(VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
|
|
|
|
Shape3D mesh = Assets3D.getBoat();
|
|
|
|
|
|
|
|
|
|
PhongMaterial boatColorMat = new PhongMaterial(boat.getColor());
|
|
|
|
|
//mesh.setMaterial(boatColorMat);
|
|
|
|
|
Subject3D boatModel = new Subject3D(mesh, boat.getSourceID());
|
|
|
|
|
|
|
|
|
|
// Configure visualiser for client's boat
|
|
|
|
|
if (boat.isClientBoat()) {
|
|
|
|
|
// Add player boat highlight
|
|
|
|
|
Shockwave boatHighlight = new Shockwave(10);
|
|
|
|
|
boatHighlight.getMesh().setMaterial(new PhongMaterial(new Color(1, 1, 0, 0.1)));
|
|
|
|
|
viewSubjects.add(boatHighlight);
|
|
|
|
|
|
|
|
|
|
// Track player boat with camera
|
|
|
|
|
viewSubjects.add(boatModel);
|
|
|
|
|
Platform.runLater(() -> {
|
|
|
|
|
view3D.trackSubject(boatModel);
|
|
|
|
|
view3D.setThirdPerson();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Track player boat with highlight
|
|
|
|
|
AnimationTimer highlightTrack = new AnimationTimer() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(long now) {
|
|
|
|
|
@ -398,24 +416,18 @@ public class RaceViewController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
highlightTrack.start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Position and add each boat to view
|
|
|
|
|
for(VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
|
|
|
|
// MeshView mesh;
|
|
|
|
|
// if(boat.getSourceID() == race.getVisualiserRaceState().getPlayerBoatID()) {
|
|
|
|
|
// mesh = new MeshView(importer.getImport());
|
|
|
|
|
// } else {
|
|
|
|
|
// mesh = new MeshView(importerBurgerBoat.getImport());
|
|
|
|
|
// }
|
|
|
|
|
Shape3D mesh = Assets3D.getBoat();
|
|
|
|
|
|
|
|
|
|
PhongMaterial boatColorMat = new PhongMaterial(boat.getColor());
|
|
|
|
|
//mesh.setMaterial(boatColorMat);
|
|
|
|
|
Subject3D boatModel = new Subject3D(mesh, boat.getSourceID());
|
|
|
|
|
|
|
|
|
|
// Highlight next mark only for player boat
|
|
|
|
|
Material markColor = new PhongMaterial(new Color(0.15,0.9,0.2,1));
|
|
|
|
|
CompoundMark nextMark = boat.getCurrentLeg().getEndCompoundMark();
|
|
|
|
|
view3D.getShape(nextMark.getMark1().getSourceID()).getMesh().setMaterial(markColor);
|
|
|
|
|
if(nextMark.getMark2() != null) {
|
|
|
|
|
view3D.getShape(nextMark.getMark2().getSourceID()).getMesh().setMaterial(markColor);
|
|
|
|
|
}
|
|
|
|
|
boat.legProperty().addListener((o, prev, curr) -> Platform.runLater(() -> swapColours(curr)));
|
|
|
|
|
} else {
|
|
|
|
|
viewSubjects.add(boatModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add sail
|
|
|
|
|
Sails3D sails3D = new Sails3D();
|
|
|
|
|
@ -501,17 +513,9 @@ public class RaceViewController extends Controller {
|
|
|
|
|
};
|
|
|
|
|
trackBoat.start();
|
|
|
|
|
|
|
|
|
|
Material markColor = new PhongMaterial(new Color(0.15,0.9,0.2,1));
|
|
|
|
|
CompoundMark nextMark = boat.getCurrentLeg().getEndCompoundMark();
|
|
|
|
|
view3D.getShape(nextMark.getMark1().getSourceID()).getMesh().setMaterial(markColor);
|
|
|
|
|
if(nextMark.getMark2() != null) {
|
|
|
|
|
view3D.getShape(nextMark.getMark2().getSourceID()).getMesh().setMaterial(markColor);
|
|
|
|
|
}
|
|
|
|
|
Subject3D shockwave = new Shockwave(10);
|
|
|
|
|
|
|
|
|
|
viewSubjects.add(shockwave);
|
|
|
|
|
|
|
|
|
|
boat.legProperty().addListener((o, prev, curr) -> Platform.runLater(() -> swapColours(curr)));
|
|
|
|
|
boat.hasCollidedProperty().addListener((o, prev, curr) -> Platform.runLater(() -> showCollision(boat, shockwave)));
|
|
|
|
|
}
|
|
|
|
|
// Fix initial bird's-eye position
|
|
|
|
|
|