Class BoxMaker

java.lang.Object
visuals.cubeFactories.BoxMaker

public class BoxMaker extends Object
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 Details

    • backFace

      private Box backFace
    • topFace

      private Box topFace
    • rightFace

      private Box rightFace
    • leftFace

      private Box leftFace
    • frontFace

      private Box frontFace
    • bottomFace

      private Box bottomFace
    • material1

      private PhongMaterial material1
    • material2

      private PhongMaterial material2
    • material3

      private PhongMaterial material3
    • material4

      private PhongMaterial material4
    • material5

      private PhongMaterial material5
    • material6

      private PhongMaterial material6
    • boxGroup

      private Group boxGroup
    • width

      private final double width
    • height

      private final double height
    • id

      private final int id
    • gameController

      private final FXIGameController gameController
    • rotateValueUp

      private final DoubleProperty rotateValueUp
    • rotationAxisUp

      private final ObjectProperty<Point3D> rotationAxisUp
    • rotateValueDown

      private final DoubleProperty rotateValueDown
    • rotationAxisDown

      private final ObjectProperty<Point3D> rotationAxisDown
    • timelineUp

      private final Timeline timelineUp
    • timelineDown

      private final Timeline timelineDown
    • isActive

      private Boolean 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

      public Boolean getActiveState()
      Returns the value of the isActive field.
      Returns:
      true if the isActive field is true, false otherwise.
    • createMaterials

      private void createMaterials(Image findImage, Image backImage, Image behindImage)
      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

      public Group getBox()
    • rotateUp

      public void rotateUp(Group group)
    • rotateDown

      public void rotateDown(Group group)