mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Added pirate ship meshes to application. Updated boat model to allow for jib sails and a fixed sail. #story[1274]
This commit is contained in:
@@ -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.CAT_ATE_A_MERINGUE, this.boatColor);
|
||||
BoatModel bo = ModelFactory.boatIconView(BoatMeshType.PIRATE_SHIP, this.boatColor);
|
||||
group.getChildren().add(bo.getAssets());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,22 +2,29 @@ package seng302.visualiser.fxObjects.assets_3D;
|
||||
|
||||
/**
|
||||
* Enum for boat meshes. Enum values should be of the form :
|
||||
* ENUM_VALUE (hull file, mast file, Y offset of mast CoR from origin, sail file, Y offset of sail CoR from origin)
|
||||
* ENUM_VALUE (hull file, mast file, Y offset of mast CoR from origin, sail file, Y offset of sail CoR from origin, jib file, fixed sail)
|
||||
* Files must be valid .stl files.
|
||||
*/
|
||||
public enum BoatMeshType {
|
||||
|
||||
DINGHY ("dinghy_hull.stl", "dinghy_mast.stl", 1.36653, "dinghy_sail.stl", 1.36653),
|
||||
CAT_ATE_A_MERINGUE ("catamaran_hull.stl", "catamaran_mast.stl", 0.997, "catamaran_sail.stl", 0.997);
|
||||
DINGHY("dinghy_hull.stl", "dinghy_mast.stl", 1.36653, "dinghy_sail.stl", 1.36653, null, false),
|
||||
CAT_ATE_A_MERINGUE("catamaran_hull.stl", "catamaran_mast.stl", 0.997, "catamaran_sail.stl",
|
||||
0.997, null, false),
|
||||
PIRATE_SHIP("pirateship_hull.stl", "pirateship_mast.stl", -0.5415, "pirateship_mainsail.stl",
|
||||
-0.5415, "pirateship_frontsail.stl", true);
|
||||
|
||||
final String hullFile, mastFile, sailFile;
|
||||
final String hullFile, mastFile, sailFile, jibFile;
|
||||
final double mastOffset, sailOffset;
|
||||
final boolean fixedSail;
|
||||
|
||||
BoatMeshType(String hullFile, String mastFile, double mastOffset, String sailFile, double sailOffset) {
|
||||
BoatMeshType(String hullFile, String mastFile, double mastOffset, String sailFile,
|
||||
double sailOffset, String jibFile, boolean fixedSail) {
|
||||
this.hullFile = hullFile;
|
||||
this.mastFile = mastFile;
|
||||
this.mastOffset = mastOffset;
|
||||
this.sailFile = sailFile;
|
||||
this.sailOffset = sailOffset;
|
||||
this.jibFile = jibFile;
|
||||
this.fixedSail = fixedSail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,14 +34,16 @@ public class BoatModel extends Model {
|
||||
* @param degrees The rotation of the sail in degrees
|
||||
*/
|
||||
public void rotateSail(double degrees) {
|
||||
MeshView mast = getMeshViewChild(MAST_INDEX);
|
||||
MeshView sail = getMeshViewChild(SAIL_INDEX);
|
||||
mast.getTransforms().setAll(
|
||||
if (!meshType.fixedSail) {
|
||||
MeshView mast = getMeshViewChild(MAST_INDEX);
|
||||
MeshView sail = getMeshViewChild(SAIL_INDEX);
|
||||
mast.getTransforms().setAll(
|
||||
new Rotate(degrees, 0, -meshType.mastOffset, 0, new Point3D(0, 0, 1))
|
||||
);
|
||||
sail.getTransforms().setAll(
|
||||
);
|
||||
sail.getTransforms().setAll(
|
||||
new Rotate(degrees, 0, -meshType.sailOffset,0, new Point3D(0, 0, 1))
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void hideSail() {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BoatObject extends Group {
|
||||
* Creates a BoatGroup with the default triangular boat polygon.
|
||||
*/
|
||||
public BoatObject() {
|
||||
boatAssets = ModelFactory.boatGameView(BoatMeshType.CAT_ATE_A_MERINGUE, colour);
|
||||
boatAssets = ModelFactory.boatGameView(BoatMeshType.PIRATE_SHIP, colour);
|
||||
boatAssets.hideSail();
|
||||
boatAssets.getAssets().getTransforms().addAll(
|
||||
rotation
|
||||
|
||||
@@ -84,6 +84,7 @@ public class ModelFactory {
|
||||
}
|
||||
|
||||
private static Group getUnmodifiedBoatModel(BoatMeshType boatType, Color primaryColour) {
|
||||
|
||||
Group boatAssets = new Group();
|
||||
MeshView hull = importSTL(boatType.hullFile);
|
||||
hull.setMaterial(new PhongMaterial(primaryColour));
|
||||
@@ -91,7 +92,15 @@ public class ModelFactory {
|
||||
mast.setMaterial(new PhongMaterial(primaryColour));
|
||||
MeshView sail = importSTL(boatType.sailFile);
|
||||
sail.setMaterial(new PhongMaterial(Color.WHITE));
|
||||
boatAssets.getChildren().addAll(hull, mast, sail);
|
||||
|
||||
if (boatType.jibFile != null) {
|
||||
MeshView jib = importSTL(boatType.jibFile);
|
||||
sail.setMaterial(new PhongMaterial(Color.WHITE));
|
||||
boatAssets.getChildren().addAll(hull, mast, sail, jib);
|
||||
} else {
|
||||
boatAssets.getChildren().addAll(hull, mast, sail);
|
||||
}
|
||||
|
||||
return boatAssets;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user