diff --git a/racevisionGame/src/main/java/visualiser/Controllers/InGameLobbyController.java b/racevisionGame/src/main/java/visualiser/Controllers/InGameLobbyController.java index e4629790..4e326e42 100644 --- a/racevisionGame/src/main/java/visualiser/Controllers/InGameLobbyController.java +++ b/racevisionGame/src/main/java/visualiser/Controllers/InGameLobbyController.java @@ -76,6 +76,9 @@ public class InGameLobbyController extends Controller { @FXML private Button startButton; + @FXML + private GridPane animatedPane; + @FXML private Button quitButton; @@ -110,6 +113,60 @@ public class InGameLobbyController extends Controller { importer.read(asset); lobbyUpdateListener = new PopulatePlayers(); + AmbientLight ambientLight = new AmbientLight(Color.web("#888888")); + ambientLight.setTranslateX(250); + ambientLight.setTranslateZ(210); + ambientLight.setLightOn(true); + + PointLight pointLight = new PointLight(Color.web("#888888")); + pointLight.setTranslateX(250); + pointLight.setTranslateZ(210); + pointLight.setLightOn(true); + + ObservableList subjects = FXCollections.observableArrayList(); + View3D view3D = new View3D(); + view3D.addAmbientLight(ambientLight); + view3D.addPointLight(pointLight); + view3D.setDistance(10); + view3D.setPitch(5); + view3D.setItems(subjects); + + SkyBox skyBox = new SkyBox(750,200,250,0,250); + subjects.addAll(skyBox.getSkyBoxPlanes()); + + SeaSurface seaSurface = new SeaSurface(750, 200); + seaSurface.setX(250); + seaSurface.setZ(250); + subjects.add(seaSurface); + + 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); + + double radius = 100; + boat.setX(0); + boat.setZ(radius); + boat.setScale(0.1); + + subjects.add(boat); + view3D.trackSubject(boat, -45); + + animatedPane.add(view3D, 0, 0); + + AnimationTimer loop = new AnimationTimer() { + double angle = -90; + double offset = 0.05; + @Override + public void handle(long now) { + boat.setX(radius * Math.cos(angle * Math.PI/180)); + boat.setZ(radius * Math.sin(angle * Math.PI/180)); + boat.setHeading(-angle); + angle += offset; + } + }; + loop.start(); + } private void resetLobby(){ diff --git a/racevisionGame/src/main/resources/visualiser/scenes/gameLobby.fxml b/racevisionGame/src/main/resources/visualiser/scenes/gameLobby.fxml index c84c16a6..fb153817 100644 --- a/racevisionGame/src/main/resources/visualiser/scenes/gameLobby.fxml +++ b/racevisionGame/src/main/resources/visualiser/scenes/gameLobby.fxml @@ -1,15 +1,26 @@ + + + + + + + + + + + - + @@ -82,5 +93,17 @@ + + + + + + + + + + + +