Added catamaran mesh to possible boat meshes. Made catamaran the default boat.

#implement #story[1274]
This commit is contained in:
Calum
2017-09-20 15:58:22 +12:00
parent 9ed52a1225
commit 9d61a43bd7
14 changed files with 9 additions and 116 deletions
@@ -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;
@@ -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
@@ -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);