Package visuals.cubeFactories
Class BoxMaker
java.lang.Object
visuals.cubeFactories.BoxMaker
The BoxMaker class represents a 3D box made up of six faces. Each face is a
rectangular 3D object that has a PhongMaterial with an image applied to it.
This class creates the box and sets the PhongMaterial for each face.
It also provides methods to toggle the isActive field and get the active state of the box.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Boxprivate Boxprivate Groupprivate Boxprivate final FXIGameControllerprivate final doubleprivate final intprivate Booleanprivate Boxprivate PhongMaterialprivate PhongMaterialprivate PhongMaterialprivate PhongMaterialprivate PhongMaterialprivate PhongMaterialprivate Boxprivate final DoublePropertyprivate final DoublePropertyprivate final ObjectProperty<Point3D>private final ObjectProperty<Point3D>private final Timelineprivate final Timelineprivate Boxprivate final double -
Constructor Summary
ConstructorsConstructorDescriptionBoxMaker(double width, double height, Image findImage, Image backImage, Image behindImage, FXIGameController gameController, int id) Creates a new instance of BoxMaker. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidCreates the six faces of the box.private voidprivate voidcreateMaterials(Image findImage, Image backImage, Image behindImage) Creates the PhongMaterial for each face.Returns the value of the isActive field.getBox()voidprivate voidvoidrotateDown(Group group) voidprivate voidsendId()voidToggles the state of the isActive field.
-
Field Details
-
backFace
-
topFace
-
rightFace
-
leftFace
-
frontFace
-
bottomFace
-
material1
-
material2
-
material3
-
material4
-
material5
-
material6
-
boxGroup
-
width
private final double width -
height
private final double height -
id
private final int id -
gameController
-
rotateValueUp
-
rotationAxisUp
-
rotateValueDown
-
rotationAxisDown
-
timelineUp
-
timelineDown
-
isActive
-
-
Constructor Details
-
BoxMaker
public BoxMaker(double width, double height, Image findImage, Image backImage, Image behindImage, FXIGameController gameController, int id) Creates a new instance of BoxMaker. The 3D box will have a width and height that are passed as parameters. The findImage, backImage, and behindImage parameters are image files that will be used to set the PhongMaterial of each face. The gui parameter is an instance of the FXIGameController class. The id parameter is an int that identifies the box.- Parameters:
width- The width of the box.height- The height of the box.findImage- An image file for the face that is on top of the box.backImage- An image file for the back and side faces of the box.behindImage- An image file for the face that is on the bottom of the box.gameController- An instance of the FXIGameController class.id- An int that identifies the box.
-
-
Method Details
-
setActive
public void setActive()Toggles the state of the isActive field. -
getActiveState
Returns the value of the isActive field.- Returns:
- true if the isActive field is true, false otherwise.
-
createMaterials
Creates the PhongMaterial for each face.- Parameters:
findImage- An image file for the face that is on top of the box.backImage- An image file for the back and side faces of the box.behindImage- An image file for the face that is on the bottom of the box.
-
createFaces
private void createFaces()Creates the six faces of the box. -
createGroup
private void createGroup() -
rotateBox
private void rotateBox() -
sendId
private void sendId() -
resetImage
public void resetImage() -
getBox
-
rotateUp
-
rotateDown
-