|
|
|
@ -1,9 +1,12 @@
|
|
|
|
package visualiser.Controllers;
|
|
|
|
package visualiser.Controllers;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
|
|
|
|
|
|
|
|
import javafx.animation.AnimationTimer;
|
|
|
|
import javafx.collections.FXCollections;
|
|
|
|
import javafx.collections.FXCollections;
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.scene.AmbientLight;
|
|
|
|
import javafx.scene.AmbientLight;
|
|
|
|
|
|
|
|
import javafx.scene.PointLight;
|
|
|
|
import javafx.scene.control.Button;
|
|
|
|
import javafx.scene.control.Button;
|
|
|
|
import javafx.scene.control.RadioButton;
|
|
|
|
import javafx.scene.control.RadioButton;
|
|
|
|
import javafx.scene.image.Image;
|
|
|
|
import javafx.scene.image.Image;
|
|
|
|
@ -14,9 +17,11 @@ import javafx.scene.media.AudioClip;
|
|
|
|
import javafx.scene.media.Media;
|
|
|
|
import javafx.scene.media.Media;
|
|
|
|
import javafx.scene.media.MediaPlayer;
|
|
|
|
import javafx.scene.media.MediaPlayer;
|
|
|
|
import javafx.scene.paint.Color;
|
|
|
|
import javafx.scene.paint.Color;
|
|
|
|
|
|
|
|
import javafx.scene.shape.MeshView;
|
|
|
|
import javafx.stage.Modality;
|
|
|
|
import javafx.stage.Modality;
|
|
|
|
import mock.exceptions.EventConstructionException;
|
|
|
|
import mock.exceptions.EventConstructionException;
|
|
|
|
import visualiser.app.App;
|
|
|
|
import visualiser.app.App;
|
|
|
|
|
|
|
|
import visualiser.layout.SeaSurface;
|
|
|
|
import visualiser.layout.SkyBox;
|
|
|
|
import visualiser.layout.SkyBox;
|
|
|
|
import visualiser.layout.Subject3D;
|
|
|
|
import visualiser.layout.Subject3D;
|
|
|
|
import visualiser.layout.View3D;
|
|
|
|
import visualiser.layout.View3D;
|
|
|
|
@ -49,15 +54,44 @@ public class TitleController extends Controller {
|
|
|
|
ambientLight.setTranslateZ(210);
|
|
|
|
ambientLight.setTranslateZ(210);
|
|
|
|
ambientLight.setLightOn(true);
|
|
|
|
ambientLight.setLightOn(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PointLight pointLight = new PointLight(Color.web("#AAAAFF"));
|
|
|
|
|
|
|
|
pointLight.setTranslateX(250);
|
|
|
|
|
|
|
|
pointLight.setTranslateZ(210);
|
|
|
|
|
|
|
|
pointLight.setLightOn(true);
|
|
|
|
|
|
|
|
|
|
|
|
ObservableList<Subject3D> subjects = FXCollections.observableArrayList();
|
|
|
|
ObservableList<Subject3D> subjects = FXCollections.observableArrayList();
|
|
|
|
View3D view3D = new View3D();
|
|
|
|
View3D view3D = new View3D();
|
|
|
|
view3D.addAmbientLight(ambientLight);
|
|
|
|
view3D.addAmbientLight(ambientLight);
|
|
|
|
|
|
|
|
view3D.addPointLight(pointLight);
|
|
|
|
|
|
|
|
view3D.setDistance(10);
|
|
|
|
|
|
|
|
view3D.setPitch(5);
|
|
|
|
view3D.setItems(subjects);
|
|
|
|
view3D.setItems(subjects);
|
|
|
|
|
|
|
|
|
|
|
|
SkyBox skyBox = new SkyBox(750,200,250,0,250);
|
|
|
|
SkyBox skyBox = new SkyBox(750,200,250,0,250);
|
|
|
|
subjects.addAll(skyBox.getSkyBoxPlanes());
|
|
|
|
subjects.addAll(skyBox.getSkyBoxPlanes());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SeaSurface seaSurface = new SeaSurface(750, 200);
|
|
|
|
|
|
|
|
seaSurface.setX(250);
|
|
|
|
|
|
|
|
seaSurface.setZ(250);
|
|
|
|
|
|
|
|
subjects.add(seaSurface);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.setScale(0.1);
|
|
|
|
|
|
|
|
subjects.add(boat);
|
|
|
|
|
|
|
|
view3D.trackSubject(boat, -45);
|
|
|
|
|
|
|
|
|
|
|
|
view3DContainer.add(view3D, 0, 0);
|
|
|
|
view3DContainer.add(view3D, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AnimationTimer loop = new AnimationTimer() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void handle(long now) {
|
|
|
|
|
|
|
|
boat.setZ(boat.getPosition().getZ() + 0.05);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
loop.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|