Merge remote-tracking branch 'origin/third-person-default' into story1299_next_mark_direction
This commit is contained in:
@@ -385,11 +385,29 @@ public class RaceViewController extends Controller {
|
|||||||
viewSubjects.add(markModel);
|
viewSubjects.add(markModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
// 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()) {
|
if (boat.isClientBoat()) {
|
||||||
|
// Add player boat highlight
|
||||||
Shockwave boatHighlight = new Shockwave(10);
|
Shockwave boatHighlight = new Shockwave(10);
|
||||||
boatHighlight.getMesh().setMaterial(new PhongMaterial(new Color(1, 1, 0, 0.1)));
|
boatHighlight.getMesh().setMaterial(new PhongMaterial(new Color(1, 1, 0, 0.1)));
|
||||||
viewSubjects.add(boatHighlight);
|
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() {
|
AnimationTimer highlightTrack = new AnimationTimer() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(long now) {
|
public void handle(long now) {
|
||||||
@@ -398,24 +416,18 @@ public class RaceViewController extends Controller {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
highlightTrack.start();
|
highlightTrack.start();
|
||||||
|
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 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());
|
|
||||||
|
|
||||||
viewSubjects.add(boatModel);
|
|
||||||
|
|
||||||
//add sail
|
//add sail
|
||||||
Sails3D sails3D = new Sails3D();
|
Sails3D sails3D = new Sails3D();
|
||||||
@@ -501,17 +513,9 @@ public class RaceViewController extends Controller {
|
|||||||
};
|
};
|
||||||
trackBoat.start();
|
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);
|
Subject3D shockwave = new Shockwave(10);
|
||||||
|
|
||||||
viewSubjects.add(shockwave);
|
viewSubjects.add(shockwave);
|
||||||
|
|
||||||
boat.legProperty().addListener((o, prev, curr) -> Platform.runLater(() -> swapColours(curr)));
|
|
||||||
boat.hasCollidedProperty().addListener((o, prev, curr) -> Platform.runLater(() -> showCollision(boat, shockwave)));
|
boat.hasCollidedProperty().addListener((o, prev, curr) -> Platform.runLater(() -> showCollision(boat, shockwave)));
|
||||||
}
|
}
|
||||||
// Fix initial bird's-eye position
|
// Fix initial bird's-eye position
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class View3D extends Pane {
|
|||||||
/**
|
/**
|
||||||
* Distance to stop zoom
|
* Distance to stop zoom
|
||||||
*/
|
*/
|
||||||
private final double ZOOM_IN_LIMIT = 30;
|
private final double ZOOM_IN_LIMIT = 3;
|
||||||
private final double ZOOM_OUT_LIMIT = 700;
|
private final double ZOOM_OUT_LIMIT = 700;
|
||||||
private final double MAX_ZOOM_LIMIT = 1500;
|
private final double MAX_ZOOM_LIMIT = 1500;
|
||||||
private final double MAX_PITCH = 60; // birds eye view
|
private final double MAX_PITCH = 60; // birds eye view
|
||||||
|
|||||||
Reference in New Issue
Block a user