Added View3D control for rendering 3D shapes under a PerspectiveCamera, which is not currently working.
#story[1196]
This commit is contained in:
@@ -6,8 +6,10 @@ import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import mock.app.Event;
|
||||
import mock.exceptions.EventConstructionException;
|
||||
import visualiser.model.View3D;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
@@ -44,11 +46,18 @@ public class HostController extends Controller {
|
||||
@FXML
|
||||
AnchorPane specPane;
|
||||
|
||||
@FXML
|
||||
GridPane playerContainer;
|
||||
|
||||
private Event game;
|
||||
|
||||
private View3D fancyStuff;
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
fancyStuff = new View3D();
|
||||
playerContainer.add(fancyStuff, 0,0);
|
||||
fancyStuff.spinBox();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.ResourceBundle;
|
||||
public class LobbyController extends Controller {
|
||||
|
||||
@FXML
|
||||
AnchorPane lobbyWrapper;
|
||||
private AnchorPane lobbyWrapper;
|
||||
@FXML
|
||||
private TableView<RaceConnection> lobbyTable;
|
||||
@FXML
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
package visualiser.Controllers;
|
||||
|
||||
import javafx.animation.AnimationTimer;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.shape.Box;
|
||||
import javafx.scene.shape.CullFace;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import visualiser.app.App;
|
||||
@@ -38,8 +32,6 @@ public class TitleController extends Controller {
|
||||
@FXML
|
||||
RadioButton nightModeRD;
|
||||
|
||||
Group group3d;
|
||||
|
||||
/**
|
||||
* Method called when the 'host a game' button is pressed.
|
||||
* Opens the next window allowing a user to host their own game.
|
||||
@@ -89,31 +81,6 @@ public class TitleController extends Controller {
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
System.out.println("Initializing...");
|
||||
|
||||
Box box = new Box(50,50,50);
|
||||
box.setTranslateX(100);
|
||||
box.setTranslateY(100);
|
||||
box.setCullFace(CullFace.BACK);
|
||||
|
||||
Rotate ry = new Rotate(0, 0,0,0, Rotate.Y_AXIS);
|
||||
Rotate rx = new Rotate(20, 0, 0, 0, Rotate.X_AXIS);
|
||||
box.getTransforms().add(ry);
|
||||
box.getTransforms().add(rx);
|
||||
|
||||
group3d = new Group(box);
|
||||
|
||||
titleWrapper.getChildren().add(0, group3d);
|
||||
group3d.toFront();
|
||||
|
||||
AnimationTimer rotation = new AnimationTimer() {
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
ry.setAngle(ry.getAngle() + 0.1);
|
||||
}
|
||||
};
|
||||
|
||||
rotation.start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package visualiser.model;
|
||||
|
||||
import javafx.animation.AnimationTimer;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.PerspectiveCamera;
|
||||
import javafx.scene.SubScene;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.shape.Box;
|
||||
import javafx.scene.shape.CullFace;
|
||||
import javafx.scene.transform.Rotate;
|
||||
|
||||
/**
|
||||
* Created by connortaylorbrown on 30/08/17.
|
||||
*/
|
||||
public class View3D extends Pane {
|
||||
SubScene scene;
|
||||
PerspectiveCamera camera;
|
||||
Box box;
|
||||
|
||||
public View3D() {
|
||||
scene = new SubScene(this, 500, 500);
|
||||
camera = new PerspectiveCamera();
|
||||
scene.setCamera(camera);
|
||||
}
|
||||
|
||||
public void spinBox() {
|
||||
camera.getTransforms().add(new Rotate(-20, Rotate.X_AXIS));
|
||||
|
||||
box = new Box(50,50,50);
|
||||
box.setTranslateX(100);
|
||||
box.setTranslateY(100);
|
||||
box.setCullFace(CullFace.BACK);
|
||||
|
||||
Rotate ry = new Rotate(0, 0,0,0, Rotate.Y_AXIS);
|
||||
box.getTransforms().add(ry);
|
||||
|
||||
this.getChildren().add(camera);
|
||||
this.getChildren().add(box);
|
||||
|
||||
AnimationTimer rotation = new AnimationTimer() {
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
ry.setAngle(ry.getAngle() + 0.1);
|
||||
}
|
||||
};
|
||||
|
||||
rotation.start();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.HostController">
|
||||
<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.HostController">
|
||||
<children>
|
||||
<SplitPane fx:id="splitPane" dividerPositions="0.7724935732647815" layoutX="580.0" layoutY="129.0" prefHeight="160.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<items>
|
||||
@@ -36,123 +32,36 @@
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="50.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" prefHeight="173.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="50.0" minHeight="10.0" prefHeight="50.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" prefHeight="173.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="50.0" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<AnchorPane GridPane.rowIndex="1">
|
||||
<children>
|
||||
<Pane layoutX="22.0" layoutY="28.0" prefHeight="150.0" prefWidth="156.0" style="-fx-border-color: black; -fx-background-color: rgba(100, 100, 100, 0.8);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0" GridPane.rowIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</GridPane.margin>
|
||||
<padding>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</padding>
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
</Pane>
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="No Player" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane layoutX="10.0" layoutY="78.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||
<children>
|
||||
<Pane layoutX="22.0" layoutY="28.0" prefHeight="150.0" prefWidth="156.0" style="-fx-border-color: black; -fx-background-color: rgba(100, 100, 100, 0.8);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0" GridPane.rowIndex="1">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<padding>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</padding>
|
||||
<GridPane.margin>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</GridPane.margin>
|
||||
</Pane>
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="No Player" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane layoutX="209.0" layoutY="78.0" GridPane.columnIndex="2" GridPane.rowIndex="1">
|
||||
<children>
|
||||
<Pane layoutX="22.0" layoutY="28.0" prefHeight="150.0" prefWidth="156.0" style="-fx-border-color: black; -fx-background-color: rgba(100, 100, 100, 0.8);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0" GridPane.rowIndex="1">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<padding>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</padding>
|
||||
<GridPane.margin>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</GridPane.margin>
|
||||
</Pane>
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="No Player" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane layoutX="408.0" layoutY="78.0" GridPane.rowIndex="3">
|
||||
<children>
|
||||
<Pane layoutX="22.0" layoutY="28.0" prefHeight="150.0" prefWidth="156.0" style="-fx-border-color: black; -fx-background-color: rgba(100, 100, 100, 0.8);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0" GridPane.rowIndex="1">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<padding>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</padding>
|
||||
<GridPane.margin>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</GridPane.margin>
|
||||
</Pane>
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="No Player" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane layoutX="10.0" layoutY="334.0" GridPane.columnIndex="1" GridPane.rowIndex="3">
|
||||
<children>
|
||||
<Pane layoutX="22.0" layoutY="28.0" prefHeight="150.0" prefWidth="156.0" style="-fx-border-color: black; -fx-background-color: rgba(100, 100, 100, 0.8);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0" GridPane.rowIndex="1">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<padding>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</padding>
|
||||
<GridPane.margin>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</GridPane.margin>
|
||||
</Pane>
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="No Player" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane layoutX="209.0" layoutY="334.0" GridPane.columnIndex="2" GridPane.rowIndex="3">
|
||||
<children>
|
||||
<Pane layoutX="22.0" layoutY="28.0" prefHeight="150.0" prefWidth="156.0" style="-fx-border-color: black; -fx-background-color: rgba(100, 100, 100, 0.8);" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0" GridPane.rowIndex="1">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<padding>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</padding>
|
||||
<GridPane.margin>
|
||||
<Insets left="20.0" right="20.0" />
|
||||
</GridPane.margin>
|
||||
</Pane>
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="No Player" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Quit" GridPane.rowIndex="4">
|
||||
<Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Quit" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets left="20.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
<Button alignment="CENTER_RIGHT" contentDisplay="RIGHT" mnemonicParsing="false" onAction="#startBtnPressed" text="Start Game" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="4">
|
||||
<Button alignment="CENTER_RIGHT" contentDisplay="RIGHT" mnemonicParsing="false" onAction="#startBtnPressed" text="Start Game" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets right="20.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="Map: MapNameHere" textFill="WHITE" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="4">
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" text="Map: MapNameHere" textFill="WHITE" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<GridPane fx:id="playerContainer" GridPane.columnSpan="3" GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
</GridPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
<Label alignment="TOP_CENTER" text="Get Ready For The Next Race" textFill="#fffdfd" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="20.0">
|
||||
|
||||
Reference in New Issue
Block a user