mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Added a race importer. Added imported races to visualizer. Made it so that the host sets the race. Refactored server to no longer be dependant on a specific race. Tested functionality of map manually. Some bugs found and listed below.
#implement #testmanual #story[1275] Known bugs: * Can't move * Map is off center in lobby view. * 3D Map is off center
This commit is contained in:
@@ -14,6 +14,7 @@ import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.Checksum;
|
||||
import javafx.util.Pair;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import seng302.gameServer.messages.BoatAction;
|
||||
@@ -25,8 +26,11 @@ import seng302.gameServer.messages.CustomizeRequestType;
|
||||
import seng302.gameServer.messages.Message;
|
||||
import seng302.gameServer.messages.RegistrationRequestMessage;
|
||||
import seng302.gameServer.messages.RegistrationResponseStatus;
|
||||
import seng302.gameServer.messages.XMLMessage;
|
||||
import seng302.gameServer.messages.XMLMessageSubType;
|
||||
import seng302.model.stream.packets.PacketType;
|
||||
import seng302.model.stream.packets.StreamPacket;
|
||||
import seng302.utilities.XMLParser;
|
||||
|
||||
/**
|
||||
* A class describing a single connection to a Server for the purposes of sending and receiving on
|
||||
@@ -369,4 +373,20 @@ public class ClientToServerThread implements Runnable {
|
||||
public int getClientId () {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void sendXML(String path, String serverName, int legRepeats) {
|
||||
Pair<String, String> regattaRace = XMLParser.parseRaceDef(path, serverName, legRepeats);
|
||||
|
||||
sendByteBuffer(
|
||||
new XMLMessage(
|
||||
regattaRace.getKey(), XMLMessageSubType.REGATTA, regattaRace.getKey().length()
|
||||
).getBuffer()
|
||||
);
|
||||
|
||||
sendByteBuffer(
|
||||
new XMLMessage(
|
||||
regattaRace.getValue(), XMLMessageSubType.RACE, regattaRace.getValue().length()
|
||||
).getBuffer()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,18 +117,18 @@ public class GameClient {
|
||||
* @param ipAddress IP to connect to.
|
||||
* @param portNumber Port to connect to.
|
||||
*/
|
||||
public ServerDescription runAsHost(String ipAddress, Integer portNumber, String serverName, Integer maxPlayers) {
|
||||
public ServerDescription runAsHost(String ipAddress, Integer portNumber, String serverName, Integer maxPlayers, String race, Integer numLegs) {
|
||||
XMLGenerator.setDefaultRaceName(serverName);
|
||||
GameState.setMaxPlayers(maxPlayers);
|
||||
|
||||
server = new MainServerThread();
|
||||
GameState.setMaxPlayers(maxPlayers);
|
||||
|
||||
try {
|
||||
startClientToServerThread(ipAddress, 4942);
|
||||
} catch (IOException e) {
|
||||
showConnectionError("Cannot connect to server as host");
|
||||
}
|
||||
|
||||
socketThread.sendXML(race, serverName, numLegs);
|
||||
while (regattaData == null){
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
|
||||
@@ -48,7 +48,9 @@ public class GameView extends Pane {
|
||||
private ObservableList<Node> gameObjects;
|
||||
private Group markers = new Group();
|
||||
private Group tokens = new Group();
|
||||
private List<CompoundMark> course = new ArrayList<>();
|
||||
private List<CompoundMark> orderedMarks = new ArrayList<>();
|
||||
private List<CompoundMark> compoundMarks = new ArrayList<>();
|
||||
private List<Corner> courseOrder = new ArrayList<>();
|
||||
|
||||
private ImageView mapImage = new ImageView();
|
||||
|
||||
@@ -57,32 +59,52 @@ public class GameView extends Pane {
|
||||
VERTICAL
|
||||
}
|
||||
|
||||
public GameView () {
|
||||
public GameView (List<CompoundMark> marks, List<Corner> course, List<Limit> border) {
|
||||
// updateBorder(border);
|
||||
// updateCourse(marks, orderedMarks);
|
||||
this.compoundMarks = marks;
|
||||
this.courseOrder = course;
|
||||
this.borderPoints = border;
|
||||
gameObjects = this.getChildren();
|
||||
gameObjects.addAll(mapImage, raceBorder, markers, tokens);
|
||||
this.parentProperty().addListener((obs, old, parent) -> {
|
||||
if (parent != null) {
|
||||
canvasWidth = parent.prefWidth(0) * 2;
|
||||
canvasHeight = parent.prefHeight(0) * 2;
|
||||
// rescaleRace(borderPoints);
|
||||
updateBorder(borderPoints);
|
||||
updateCourse(compoundMarks, courseOrder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a course to the GameView. The view is scaled accordingly unless a border is set in which
|
||||
* case the course is added relative ot the border.
|
||||
* Adds a orderedMarks to the GameView. The view is scaled accordingly unless a border is set in which
|
||||
* case the orderedMarks is added relative ot the border.
|
||||
*
|
||||
* @param newCourse the mark objects that make up the course.
|
||||
* @param newCourse the mark objects that make up the orderedMarks.
|
||||
* @param sequence The sequence the marks travel through
|
||||
*/
|
||||
public void updateCourse(List<CompoundMark> newCourse, List<Corner> sequence) {
|
||||
markerObjects = new HashMap<>();
|
||||
|
||||
for (Corner corner : sequence) { //Makes course out of all compound marks.
|
||||
if (newCourse.size() == 0) {
|
||||
return;
|
||||
}
|
||||
compoundMarks = newCourse;
|
||||
markerObjects = new HashMap<>();
|
||||
courseOrder = sequence;
|
||||
|
||||
for (Corner corner : courseOrder) { //Makes orderedMarks out of all compound marks.
|
||||
for (CompoundMark compoundMark : newCourse) {
|
||||
if (corner.getCompoundMarkID() == compoundMark.getId()) {
|
||||
course.add(compoundMark);
|
||||
orderedMarks.add(compoundMark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 16/08/17 Updating mark roundings here. It should not happen here. Nor should it be done this way.
|
||||
for (Corner corner : sequence){
|
||||
CompoundMark compoundMark = course.get(corner.getSeqID() - 1);
|
||||
CompoundMark compoundMark = orderedMarks.get(corner.getSeqID() - 1);
|
||||
compoundMark.setRoundingSide(
|
||||
RoundingSide.getRoundingSide(corner.getRounding())
|
||||
);
|
||||
@@ -137,7 +159,7 @@ public class GameView extends Pane {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates all the data needed for to create mark arrows. Requires that a course has been
|
||||
* Calculates all the data needed for to create mark arrows. Requires that a orderedMarks has been
|
||||
* added to the gameview.
|
||||
* @param sequence The order in which marks are traversed.
|
||||
*/
|
||||
@@ -145,22 +167,22 @@ public class GameView extends Pane {
|
||||
for (int i=1; i < sequence.size()-1; i++) { //General case.
|
||||
double averageLat = 0;
|
||||
double averageLng = 0;
|
||||
int numMarks = course.get(i-1).getMarks().size();
|
||||
for (Mark mark : course.get(i-1).getMarks()) {
|
||||
int numMarks = orderedMarks.get(i-1).getMarks().size();
|
||||
for (Mark mark : orderedMarks.get(i-1).getMarks()) {
|
||||
averageLat += mark.getLat();
|
||||
averageLng += mark.getLng();
|
||||
}
|
||||
GeoPoint lastMarkAv = new GeoPoint(averageLat / numMarks, averageLng / numMarks);
|
||||
numMarks = course.get(i+1).getMarks().size();
|
||||
numMarks = orderedMarks.get(i+1).getMarks().size();
|
||||
averageLat = 0;
|
||||
averageLng = 0;
|
||||
for (Mark mark : course.get(i+1).getMarks()) {
|
||||
for (Mark mark : orderedMarks.get(i+1).getMarks()) {
|
||||
averageLat += mark.getLat();
|
||||
averageLng += mark.getLng();
|
||||
}
|
||||
GeoPoint nextMarkAv = new GeoPoint(averageLat / numMarks, averageLng / numMarks);
|
||||
// TODO: 16/08/17 This comparison doesn't need to exist but the alternative is to user server enum client side.
|
||||
for (Mark mark : course.get(i).getMarks()) {
|
||||
for (Mark mark : orderedMarks.get(i).getMarks()) {
|
||||
markerObjects.get(mark).addArrows(
|
||||
mark.getRoundingSide() == RoundingSide.STARBOARD ? MarkArrowFactory.RoundingSide.STARBOARD : MarkArrowFactory.RoundingSide.PORT,
|
||||
GeoUtility.getBearing(lastMarkAv, mark),
|
||||
@@ -176,13 +198,13 @@ public class GameView extends Pane {
|
||||
double averageLat = 0;
|
||||
double averageLng = 0;
|
||||
int numMarks = 0;
|
||||
for (Mark mark : course.get(1).getMarks()) {
|
||||
for (Mark mark : orderedMarks.get(1).getMarks()) {
|
||||
numMarks += 1;
|
||||
averageLat += mark.getLat();
|
||||
averageLng += mark.getLng();
|
||||
}
|
||||
GeoPoint firstMarkAv = new GeoPoint(averageLat / numMarks, averageLng / numMarks);
|
||||
for (Mark mark : course.get(0).getMarks()) {
|
||||
for (Mark mark : orderedMarks.get(0).getMarks()) {
|
||||
markerObjects.get(mark).addArrows(
|
||||
mark.getRoundingSide() == RoundingSide.STARBOARD ? MarkArrowFactory.RoundingSide.STARBOARD : MarkArrowFactory.RoundingSide.PORT,
|
||||
0d, //90
|
||||
@@ -195,13 +217,13 @@ public class GameView extends Pane {
|
||||
double numMarks = 0;
|
||||
double averageLat = 0;
|
||||
double averageLng = 0;
|
||||
for (Mark mark : course.get(course.size()-2).getMarks()) {
|
||||
for (Mark mark : orderedMarks.get(orderedMarks.size()-2).getMarks()) {
|
||||
numMarks += 1;
|
||||
averageLat += mark.getLat();
|
||||
averageLng += mark.getLng();
|
||||
}
|
||||
GeoPoint secondToLastMarkAv = new GeoPoint(averageLat / numMarks, averageLng / numMarks);
|
||||
for (Mark mark : course.get(course.size()-1).getMarks()) {
|
||||
for (Mark mark : orderedMarks.get(orderedMarks.size()-1).getMarks()) {
|
||||
markerObjects.get(mark).addArrows(
|
||||
mark.getRoundingSide() == RoundingSide.STARBOARD ? MarkArrowFactory.RoundingSide.STARBOARD : MarkArrowFactory.RoundingSide.PORT,
|
||||
GeoUtility.getBearing(secondToLastMarkAv, mark),
|
||||
@@ -254,17 +276,16 @@ public class GameView extends Pane {
|
||||
|
||||
/**
|
||||
* Adds a border to the GameView and rescales to the size of the border, does not rescale if a
|
||||
* border already exists. Assumes the border is larger than the course.
|
||||
* border already exists. Assumes the border is larger than the orderedMarks.
|
||||
*
|
||||
* @param border the race border to be drawn.
|
||||
*/
|
||||
public void updateBorder(List<Limit> border) {
|
||||
if (borderPoints == null) {
|
||||
borderPoints = border;
|
||||
rescaleRace(new ArrayList<>(borderPoints));
|
||||
if (border.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
rescaleRace(new ArrayList<>(border));
|
||||
borderPoints = border;
|
||||
rescaleRace(new ArrayList<>(borderPoints));
|
||||
|
||||
List<Double> boundaryPoints = new ArrayList<>();
|
||||
for (Limit limit : border) {
|
||||
@@ -280,8 +301,8 @@ public class GameView extends Pane {
|
||||
*
|
||||
* @param limitingCoordinates the set of geo points that contains the extremities of the race.
|
||||
*/
|
||||
public void rescaleRace(List<GeoPoint> limitingCoordinates) {
|
||||
//Check is called once to avoid unnecessarily change the course limits once the race is running
|
||||
public void rescaleRace(List<? extends GeoPoint> limitingCoordinates) {
|
||||
//Check is called once to avoid unnecessarily change the orderedMarks limits once the race is running
|
||||
findMinMaxPoint(limitingCoordinates);
|
||||
double minLonToMaxLon = scaleRaceExtremities();
|
||||
calculateReferencePointLocation(minLonToMaxLon);
|
||||
@@ -292,7 +313,7 @@ public class GameView extends Pane {
|
||||
* the leftmost point, rightmost point, southern most point and northern most point
|
||||
* respectively.
|
||||
*/
|
||||
private void findMinMaxPoint(List<GeoPoint> points) {
|
||||
private void findMinMaxPoint(List<? extends GeoPoint> points) {
|
||||
List<GeoPoint> sortedPoints = new ArrayList<>(points);
|
||||
sortedPoints.sort(Comparator.comparingDouble(GeoPoint::getLat));
|
||||
minLatPoint = new GeoPoint(sortedPoints.get(0).getLat(), sortedPoints.get(0).getLng());
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package seng302.visualiser;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javafx.util.Pair;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import seng302.model.stream.xml.parser.RaceXMLData;
|
||||
import seng302.model.stream.xml.parser.RegattaXMLData;
|
||||
import seng302.utilities.XMLParser;
|
||||
|
||||
/**
|
||||
* Created by cir27 on 23/09/17.
|
||||
*/
|
||||
public class MapMaker {
|
||||
|
||||
private List<GameView> gameViews = new ArrayList<>();
|
||||
private List<RaceXMLData> races = new ArrayList<>();
|
||||
private List<RegattaXMLData> regattas = new ArrayList<>();
|
||||
private List<String> filePaths = new ArrayList<>();
|
||||
private static MapMaker instance;
|
||||
private int index = 0;
|
||||
|
||||
public static MapMaker getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new MapMaker();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private MapMaker() {
|
||||
File dir = new File(MapMaker.class.getResource("/maps/").getPath());
|
||||
File[] directoryListing = dir.listFiles();
|
||||
if (directoryListing != null) {
|
||||
for (File child : directoryListing) {
|
||||
Pair<String, String> regattaRace = XMLParser.parseRaceDef(
|
||||
child.getAbsolutePath(), "", 1
|
||||
);
|
||||
filePaths.add(child.getAbsolutePath());
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder db;
|
||||
Document doc = null;
|
||||
try {
|
||||
db = dbf.newDocumentBuilder();
|
||||
doc = db.parse(new InputSource(new StringReader(regattaRace.getKey())));
|
||||
} catch (ParserConfigurationException | IOException | SAXException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
regattas.add(XMLParser.parseRegatta(doc));
|
||||
try {
|
||||
db = dbf.newDocumentBuilder();
|
||||
doc = db.parse(new InputSource(new StringReader(regattaRace.getValue())));
|
||||
} catch (ParserConfigurationException | IOException | SAXException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
RaceXMLData race = XMLParser.parseRace(doc);
|
||||
GameView gameView = new GameView(
|
||||
new ArrayList<>(race.getCompoundMarks().values()),
|
||||
race.getMarkSequence(), race.getCourseLimit()
|
||||
);
|
||||
gameViews.add(gameView);
|
||||
races.add(race);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void next() {
|
||||
index += 1;
|
||||
if (index >= gameViews.size()) {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void previous() {
|
||||
index -= 1;
|
||||
if (index < 0) {
|
||||
index = gameViews.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public GameView getCurrentGameView() {
|
||||
return gameViews.get(index);
|
||||
}
|
||||
|
||||
public RaceXMLData getCurrentRace() {
|
||||
return races.get(index);
|
||||
}
|
||||
|
||||
public RegattaXMLData getCurrentRegatta() {
|
||||
return regattas.get(index);
|
||||
}
|
||||
|
||||
public String getCurrentRacePath() {
|
||||
return filePaths.get(index);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class LobbyController implements Initializable {
|
||||
* Initializes a top down preview of the race course map.
|
||||
*/
|
||||
private void initMapPreview() {
|
||||
gameView = new GameView();
|
||||
gameView = new GameView(new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
|
||||
gameView.setHorizontalBuffer(330d);
|
||||
|
||||
mapWidth = 770d;
|
||||
|
||||
@@ -123,6 +123,7 @@ public class ServerListController implements Initializable, ServerListenerDelega
|
||||
Sounds.playButtonClick();
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.warn("Could not create Server Creation Dialog.");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import seng302.gameServer.ServerDescription;
|
||||
import seng302.utilities.Sounds;
|
||||
import seng302.utilities.XMLParser;
|
||||
import seng302.visualiser.MapMaker;
|
||||
import seng302.visualiser.controllers.ViewManager;
|
||||
import seng302.visualiser.validators.FieldLengthValidator;
|
||||
import seng302.visualiser.validators.ValidationTools;
|
||||
@@ -45,6 +45,8 @@ public class ServerCreationController implements Initializable {
|
||||
@FXML
|
||||
private AnchorPane mapHolder;
|
||||
|
||||
private MapMaker mapMaker = MapMaker.getInstance();
|
||||
|
||||
//---------FXML END---------//
|
||||
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
@@ -81,7 +83,8 @@ public class ServerCreationController implements Initializable {
|
||||
lastMap();
|
||||
});
|
||||
|
||||
XMLParser.parseRaceDef("/maps/horseshoe.xml", "test", 2);
|
||||
mapHolder.getChildren().setAll(mapMaker.getCurrentGameView());
|
||||
mapNameLabel.setText(mapMaker.getCurrentRegatta().getCourseName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +105,7 @@ public class ServerCreationController implements Initializable {
|
||||
private void createServer() {
|
||||
ServerDescription serverDescription = ViewManager.getInstance().getGameClient()
|
||||
.runAsHost("localhost", 4941, serverName.getText(), (int) maxPlayersSlider
|
||||
.getValue());
|
||||
.getValue(), mapMaker.getCurrentRacePath(), (int) legsSlider.getValue());
|
||||
|
||||
ViewManager.getInstance().setProperty("serverName", serverDescription.getName());
|
||||
ViewManager.getInstance().setProperty("mapName", serverDescription.getMapName());
|
||||
@@ -129,11 +132,15 @@ public class ServerCreationController implements Initializable {
|
||||
}
|
||||
|
||||
private void nextMap() {
|
||||
|
||||
mapMaker.next();
|
||||
mapHolder.getChildren().setAll(mapMaker.getCurrentGameView());
|
||||
mapNameLabel.setText(mapMaker.getCurrentRegatta().getCourseName());
|
||||
}
|
||||
|
||||
private void lastMap() {
|
||||
|
||||
mapMaker.previous();
|
||||
mapHolder.getChildren().setAll(mapMaker.getCurrentGameView());
|
||||
mapNameLabel.setText(mapMaker.getCurrentRegatta().getCourseName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
package seng302.visualiser;
|
||||
|
||||
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
|
||||
import javafx.animation.AnimationTimer;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Point3D;
|
||||
import javafx.scene.Camera;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.PerspectiveCamera;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.SceneAntialiasing;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.PhongMaterial;
|
||||
import javafx.scene.shape.MeshView;
|
||||
import javafx.scene.transform.Rotate;
|
||||
import javafx.scene.transform.Scale;
|
||||
import javafx.scene.transform.Translate;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* Created by cir27 on 7/09/17.
|
||||
*/
|
||||
public class test3d extends Application {
|
||||
|
||||
Group root = new Group();
|
||||
Scene scene;
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
// camera = new PerspectiveCamera();
|
||||
// gameObjects = new Group();
|
||||
// root3D = new Group(camera, gameObjects);
|
||||
scene = new Scene(
|
||||
root, 1000, 1000, true, SceneAntialiasing.BALANCED
|
||||
);
|
||||
gameView3DTest();
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
// scene.setCamera(camera);
|
||||
// primaryStage.setScene(scene);
|
||||
// primaryStage.show();
|
||||
//
|
||||
// StlMeshImporter importer = new StlMeshImporter();
|
||||
// importer.read(test3d.class.getResource("/meshes/dinghy_hull.stl").toString());
|
||||
// MeshView boat = new MeshView(importer.getImport());
|
||||
// boat.setMaterial(new PhongMaterial(Color.GREENYELLOW));
|
||||
//
|
||||
// importer = new StlMeshImporter();
|
||||
// importer.read(getClass().getResource("/meshes/dinghy_mast.stl").toString());
|
||||
// MeshView mast = new MeshView(importer.getImport());
|
||||
// mast.setMaterial(new PhongMaterial(Color.GREENYELLOW));
|
||||
//
|
||||
// importer = new StlMeshImporter();
|
||||
// importer.read(getClass().getResource("/meshes/dinghy_sail.stl").toString());
|
||||
// MeshView sail = new MeshView(importer.getImport());
|
||||
// sail.setMaterial(new PhongMaterial(Color.LIGHTGREY));
|
||||
//
|
||||
// gameObjects.getChildren().addAll(boat, mast, sail);
|
||||
//
|
||||
// gameObjects.getTransforms().add(new Scale(25, 25,25));
|
||||
// gameObjects.getTransforms().add(new Translate(15, 20,0));
|
||||
// gameObjects.getTransforms().addAll(
|
||||
// new Rotate(90, new Point3D(0,0,1)),
|
||||
// new Rotate(90, new Point3D(0, 1, 0))
|
||||
// );
|
||||
//
|
||||
//// PointLight light = new PointLight();
|
||||
//// light.setLightOn(true);
|
||||
//// light.getTransforms().add(new Translate(15, 20, 0));
|
||||
////
|
||||
//// PointLight light2 = new PointLight();
|
||||
//// light2.setLightOn(true);
|
||||
//// light2.getTransforms().add(new Translate(30, 40, 0));
|
||||
//
|
||||
//// root3D.getChildren().addAll(light);
|
||||
//
|
||||
// scene.setOnKeyPressed(event -> {
|
||||
// switch (event.getCode()) {
|
||||
// case UP:
|
||||
// gameObjects.getTransforms().add(new Rotate(5, new Point3D(0,0,1)));
|
||||
// break;
|
||||
// case DOWN:
|
||||
// gameObjects.getTransforms().add(new Rotate(-5, new Point3D(0,0,1)));
|
||||
// break;
|
||||
// case LEFT:
|
||||
// gameObjects.getTransforms().add(new Rotate(-5, new Point3D(0,1,0)));
|
||||
// break;
|
||||
// case RIGHT:
|
||||
// gameObjects.getTransforms().add(new Rotate(5, new Point3D(0,1,0)));
|
||||
// break;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// AnimationTimer animationTimer = new AnimationTimer() {
|
||||
// @Override
|
||||
// public void handle(long now) {
|
||||
// sail.getTransforms().add(new Rotate(0.5, 0, -1.36653, 0, new Point3D(0, 0, 1)));
|
||||
// }
|
||||
// };
|
||||
//
|
||||
//// animationTimer.start();
|
||||
}
|
||||
|
||||
private void gameView3DTest() {
|
||||
GameView3D gameView3D = new GameView3D();
|
||||
root.getChildren().add(gameView3D.getAssets());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user