Modified title screen to use View3D with skybox and ambient lighting
#story[1301]
This commit is contained in:
@@ -1,17 +1,25 @@
|
||||
package visualiser.Controllers;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.AmbientLight;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.media.AudioClip;
|
||||
import javafx.scene.media.Media;
|
||||
import javafx.scene.media.MediaPlayer;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Modality;
|
||||
import mock.exceptions.EventConstructionException;
|
||||
import visualiser.app.App;
|
||||
import visualiser.layout.SkyBox;
|
||||
import visualiser.layout.Subject3D;
|
||||
import visualiser.layout.View3D;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -30,9 +38,27 @@ import java.util.logging.Logger;
|
||||
public class TitleController extends Controller {
|
||||
private @FXML RadioButton dayModeRD;
|
||||
private @FXML RadioButton nightModeRD;
|
||||
private @FXML Label tutorialLabel;
|
||||
private @FXML Button tutorialButton;
|
||||
private @FXML Pane menuPane;
|
||||
private @FXML ImageView imgSun;
|
||||
private @FXML GridPane view3DContainer;
|
||||
|
||||
public void initialize() {
|
||||
AmbientLight ambientLight = new AmbientLight(Color.web("#CCCCFF"));
|
||||
ambientLight.setTranslateX(250);
|
||||
ambientLight.setTranslateZ(210);
|
||||
ambientLight.setLightOn(true);
|
||||
|
||||
ObservableList<Subject3D> subjects = FXCollections.observableArrayList();
|
||||
View3D view3D = new View3D();
|
||||
view3D.addAmbientLight(ambientLight);
|
||||
view3D.setItems(subjects);
|
||||
|
||||
SkyBox skyBox = new SkyBox(750,200,250,0,250);
|
||||
subjects.addAll(skyBox.getSkyBoxPlanes());
|
||||
|
||||
view3DContainer.add(view3D, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called when the 'host a game' button is pressed.
|
||||
@@ -72,7 +98,7 @@ public class TitleController extends Controller {
|
||||
public void setNightMode(){
|
||||
nightModeRD.getScene().getStylesheets().clear();
|
||||
menuPane.getStylesheets().clear();
|
||||
imgSun.setImage(new Image(getClass().getResource("/visualiser/images/sunsleep.png").toExternalForm()));
|
||||
//imgSun.setImage(new Image(getClass().getResource("/visualiser/images/sunsleep.png").toExternalForm()));
|
||||
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
|
||||
menuPane.setStyle("-fx-background-color: #1f2c60;");
|
||||
dayModeRD.setSelected(false);
|
||||
|
||||
Reference in New Issue
Block a user