diff --git a/src/main/java/seng302/visualiser/controllers/cells/PlayerCell.java b/src/main/java/seng302/visualiser/controllers/cells/PlayerCell.java index 6fb35708..7af80e04 100644 --- a/src/main/java/seng302/visualiser/controllers/cells/PlayerCell.java +++ b/src/main/java/seng302/visualiser/controllers/cells/PlayerCell.java @@ -37,7 +37,7 @@ public class PlayerCell { // Add Rotating Boat to Player Cell with players color on it. Group group = new Group(); boatPane.getChildren().add(group); - BoatModel bo = ModelFactory.boatIconView(BoatMeshType.DINGHY, this.boatColor); + BoatModel bo = ModelFactory.boatIconView(BoatMeshType.CATAMARAN, this.boatColor); group.getChildren().add(bo.getAssets()); } diff --git a/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatMeshType.java b/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatMeshType.java index 9747b892..96bd3459 100644 --- a/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatMeshType.java +++ b/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatMeshType.java @@ -7,7 +7,8 @@ package seng302.visualiser.fxObjects.assets_3D; */ public enum BoatMeshType { - DINGHY ("dinghy_hull.stl", "dinghy_mast.stl", -1.36653, "dinghy_sail.stl", -1.36653); + DINGHY ("dinghy_hull.stl", "dinghy_mast.stl", -1.36653, "dinghy_sail.stl", -1.36653), + CATAMARAN ("catamaran_hull.stl", "catamaran_mast.stl", -1.36845, "catamaran_sail.stl", -1.36845); final String hullFile, mastFile, sailFile; final double mastOffset, sailOffset; diff --git a/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatObject.java b/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatObject.java index 57975935..e93152d5 100644 --- a/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatObject.java +++ b/src/main/java/seng302/visualiser/fxObjects/assets_3D/BoatObject.java @@ -36,7 +36,7 @@ public class BoatObject extends Group { * Creates a BoatGroup with the default triangular boat polygon. */ public BoatObject() { - boatAssets = ModelFactory.boatGameView(BoatMeshType.DINGHY, colour); + boatAssets = ModelFactory.boatGameView(BoatMeshType.CATAMARAN, colour); boatAssets.hideSail(); boatAssets.getAssets().getTransforms().addAll( rotation diff --git a/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelFactory.java b/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelFactory.java index f0c50abe..702e8619 100644 --- a/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelFactory.java +++ b/src/main/java/seng302/visualiser/fxObjects/assets_3D/ModelFactory.java @@ -86,19 +86,19 @@ public class ModelFactory { private static Group getUnmodifiedBoatModel(BoatMeshType boatType, Color primaryColour) { Group boatAssets = new Group(); - MeshView hull = importFile(boatType.hullFile); + MeshView hull = importSTL(boatType.hullFile); hull.setMaterial(new PhongMaterial(primaryColour)); - MeshView mast = importFile(boatType.mastFile); + MeshView mast = importSTL(boatType.mastFile); mast.setMaterial(new PhongMaterial(primaryColour)); - MeshView sail = importFile(boatType.sailFile); + MeshView sail = importSTL(boatType.sailFile); sail.setMaterial(new PhongMaterial(Color.WHITE)); boatAssets.getChildren().addAll(hull, mast, sail); return boatAssets; } - private static MeshView importFile(String fileName) { + private static MeshView importSTL(String fileName) { StlMeshImporter importer = new StlMeshImporter(); - importer.read(ModelFactory.class.getResource("/meshes/" + fileName)); + importer.read(ModelFactory.class.getResource("/meshes/boatSTLs/" + fileName)); MeshView importedFile = new MeshView(importer.getImport()); importedFile.setCache(true); importedFile.setCacheHint(CacheHint.SCALE_AND_ROTATE); diff --git a/src/main/java/seng302/visualiser/test3d.java b/src/main/java/seng302/visualiser/test3d.java deleted file mode 100644 index 6440e563..00000000 --- a/src/main/java/seng302/visualiser/test3d.java +++ /dev/null @@ -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()); - } -} diff --git a/src/main/resources/meshes/boatSTLs/catamaran_hull.stl b/src/main/resources/meshes/boatSTLs/catamaran_hull.stl new file mode 100644 index 00000000..e93a9787 Binary files /dev/null and b/src/main/resources/meshes/boatSTLs/catamaran_hull.stl differ diff --git a/src/main/resources/meshes/boatSTLs/catamaran_mast.stl b/src/main/resources/meshes/boatSTLs/catamaran_mast.stl new file mode 100644 index 00000000..79bc742b Binary files /dev/null and b/src/main/resources/meshes/boatSTLs/catamaran_mast.stl differ diff --git a/src/main/resources/meshes/boatSTLs/catamaran_sail.stl b/src/main/resources/meshes/boatSTLs/catamaran_sail.stl new file mode 100644 index 00000000..a2723d98 Binary files /dev/null and b/src/main/resources/meshes/boatSTLs/catamaran_sail.stl differ diff --git a/src/main/resources/meshes/dinghy_hull.stl b/src/main/resources/meshes/boatSTLs/dinghy_hull.stl similarity index 100% rename from src/main/resources/meshes/dinghy_hull.stl rename to src/main/resources/meshes/boatSTLs/dinghy_hull.stl diff --git a/src/main/resources/meshes/dinghy_mast.stl b/src/main/resources/meshes/boatSTLs/dinghy_mast.stl similarity index 100% rename from src/main/resources/meshes/dinghy_mast.stl rename to src/main/resources/meshes/boatSTLs/dinghy_mast.stl diff --git a/src/main/resources/meshes/dinghy_sail.stl b/src/main/resources/meshes/boatSTLs/dinghy_sail.stl similarity index 100% rename from src/main/resources/meshes/dinghy_sail.stl rename to src/main/resources/meshes/boatSTLs/dinghy_sail.stl diff --git a/src/main/resources/meshes/catamaran_hull.stl b/src/main/resources/meshes/catamaran_hull.stl deleted file mode 100644 index f80d0b8e..00000000 Binary files a/src/main/resources/meshes/catamaran_hull.stl and /dev/null differ diff --git a/src/main/resources/meshes/catamaran_mast.stl b/src/main/resources/meshes/catamaran_mast.stl deleted file mode 100644 index f80d0b8e..00000000 Binary files a/src/main/resources/meshes/catamaran_mast.stl and /dev/null differ diff --git a/src/main/resources/meshes/catamaran_sail.stl b/src/main/resources/meshes/catamaran_sail.stl deleted file mode 100644 index f80d0b8e..00000000 Binary files a/src/main/resources/meshes/catamaran_sail.stl and /dev/null differ