|
|
|
|
@ -51,22 +51,31 @@ public class TitleController extends Controller {
|
|
|
|
|
private @FXML ImageView imgSun;
|
|
|
|
|
private @FXML GridPane view3DContainer;
|
|
|
|
|
private ToggleGroup toggleGroup = new ToggleGroup();
|
|
|
|
|
private SkyBox skyBox;
|
|
|
|
|
private SeaSurface seaSurface;
|
|
|
|
|
private Subject3D boat;
|
|
|
|
|
private AmbientLight ambientLight;
|
|
|
|
|
private ObservableList<Subject3D> subjects = FXCollections.observableArrayList();
|
|
|
|
|
|
|
|
|
|
public void initialize() {
|
|
|
|
|
dayModeRD.setToggleGroup(toggleGroup);
|
|
|
|
|
nightModeRD.setToggleGroup(toggleGroup);
|
|
|
|
|
|
|
|
|
|
AmbientLight ambientLight = new AmbientLight(Color.web("#CCCCFF"));
|
|
|
|
|
if (App.dayMode) dayModeRD.setSelected(true);
|
|
|
|
|
else nightModeRD.setSelected(true);
|
|
|
|
|
|
|
|
|
|
ambientLight = new AmbientLight(Color.web("#CCCCFF"));
|
|
|
|
|
ambientLight.setTranslateX(250);
|
|
|
|
|
ambientLight.setTranslateZ(210);
|
|
|
|
|
ambientLight.setLightOn(true);
|
|
|
|
|
|
|
|
|
|
if (!App.dayMode) ambientLight.setColor(Color.web("#9999AA"));
|
|
|
|
|
|
|
|
|
|
PointLight pointLight = new PointLight(Color.web("#AAAAFF"));
|
|
|
|
|
pointLight.setTranslateX(250);
|
|
|
|
|
pointLight.setTranslateZ(210);
|
|
|
|
|
pointLight.setLightOn(true);
|
|
|
|
|
|
|
|
|
|
ObservableList<Subject3D> subjects = FXCollections.observableArrayList();
|
|
|
|
|
View3D view3D = new View3D();
|
|
|
|
|
view3D.addAmbientLight(ambientLight);
|
|
|
|
|
view3D.addPointLight(pointLight);
|
|
|
|
|
@ -74,10 +83,10 @@ public class TitleController extends Controller {
|
|
|
|
|
view3D.setPitch(5);
|
|
|
|
|
view3D.setItems(subjects);
|
|
|
|
|
|
|
|
|
|
SkyBox skyBox = new SkyBox(750,200,250,0,250);
|
|
|
|
|
skyBox = new SkyBox(750,200,250,0,250);
|
|
|
|
|
subjects.addAll(skyBox.getSkyBoxPlanes());
|
|
|
|
|
|
|
|
|
|
SeaSurface seaSurface = new SeaSurface(750, 200);
|
|
|
|
|
seaSurface = new SeaSurface(750, 200);
|
|
|
|
|
seaSurface.setX(250);
|
|
|
|
|
seaSurface.setZ(250);
|
|
|
|
|
subjects.add(seaSurface);
|
|
|
|
|
@ -85,7 +94,7 @@ public class TitleController extends Controller {
|
|
|
|
|
URL asset = RaceViewController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
|
|
|
|
|
StlMeshImporter importer = new StlMeshImporter();
|
|
|
|
|
importer.read(asset);
|
|
|
|
|
Subject3D boat = new Subject3D(new MeshView(importer.getImport()), 0);
|
|
|
|
|
boat = new Subject3D(new MeshView(importer.getImport()), 0);
|
|
|
|
|
|
|
|
|
|
double radius = 100;
|
|
|
|
|
boat.setX(0);
|
|
|
|
|
@ -140,6 +149,7 @@ public class TitleController extends Controller {
|
|
|
|
|
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
|
|
|
|
|
nightModeRD.setSelected(false);
|
|
|
|
|
App.dayMode = true;
|
|
|
|
|
newSkyBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -150,6 +160,7 @@ public class TitleController extends Controller {
|
|
|
|
|
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
|
|
|
|
|
dayModeRD.setSelected(false);
|
|
|
|
|
App.dayMode = false;
|
|
|
|
|
newSkyBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -172,4 +183,21 @@ public class TitleController extends Controller {
|
|
|
|
|
hgc.hostGamePressed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void newSkyBox() {
|
|
|
|
|
if (skyBox != null) {
|
|
|
|
|
SkyBox newSkyBox = new SkyBox(750,200,250,0,250);
|
|
|
|
|
subjects.removeAll(skyBox.getSkyBoxPlanes());
|
|
|
|
|
subjects.addAll(newSkyBox.getSkyBoxPlanes());
|
|
|
|
|
skyBox = newSkyBox;
|
|
|
|
|
seaSurface.getMesh().toFront();
|
|
|
|
|
boat.getMesh().toFront();
|
|
|
|
|
|
|
|
|
|
if (App.dayMode) {
|
|
|
|
|
ambientLight.setColor(Color.web("#CCCCFF"));
|
|
|
|
|
} else {
|
|
|
|
|
ambientLight.setColor(Color.web("#9999AA"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|