Class Entity

java.lang.Object
engine.entities.Entity
Direct Known Subclasses:
Camera

public class Entity extends Object
Represents any 3D entity's textured model, position and rotation within the 3D world. Camera extends this class by having position and rotation, but no textured model.
  • Field Details

    • position

      protected org.joml.Vector3f position
    • rotX

      protected float rotX
    • rotY

      protected float rotY
    • rotZ

      protected float rotZ
    • scale

      protected float scale
  • Constructor Details

    • Entity

      public Entity(TexturedModel model, org.joml.Vector3f position, float rotX, float rotY, float rotZ, float scale)
      Constructor for regular entities which have a TexturedModel.
      Parameters:
      model - - The textured model of the entity
      position - - Position in 3D space
      rotX - - X rotation
      rotY - - Y rotation
      rotZ - Z - rotation
      scale - - Size of the Entity relative to it's TexturedModel.
    • Entity

      public Entity(org.joml.Vector3f position)
      Secondary Constructor used by the light and camera to position them in 3D space. Initializes rotation to 0. These 2 Entities have a visible effect on the game and shader's however they are not visible in game themselves.
      Parameters:
      position - - Position in 3D space
  • Method Details

    • getModel

      public TexturedModel getModel()
      Returns:
      TexturedModel of the Entity
    • setModel

      public void setModel(TexturedModel model)
      Parameters:
      model - - TexturedModel to which the Entity will be set
    • getPosition

      public org.joml.Vector3f getPosition()
      Returns:
      the position of the Entity in 3D space as a Vector3f
    • setPosition

      public void setPosition(org.joml.Vector3f position)
      Parameters:
      position - - Position in 3D space to which the Entity will be set to
    • getRotX

      public float getRotX()
      Returns:
      X rotation as a float
    • setRotX

      public void setRotX(float rotX)
      Parameters:
      rotX - set X rotation
    • getRotY

      public float getRotY()
      Returns:
      Y rotation as a float
    • setRotY

      public void setRotY(float rotY)
      Parameters:
      rotY - set Y rotation
    • getRotZ

      public float getRotZ()
      Returns:
      get Z rotation as a float
    • setRotZ

      public void setRotZ(float rotZ)
      Parameters:
      rotZ - Set the Z rotation
    • getScale

      public float getScale()
      Returns:
      The scale as a float
    • setScale

      public void setScale(float scale)
      Parameters:
      scale - set the scale
    • increasePosition

      public void increasePosition(float dx, float dy, float dz)
      Increase the position of the Entity by the addition of the Vector3f of x, y and z
      Parameters:
      dx -
      dy -
      dz -
    • increaseRotation

      public void increaseRotation(float dx, float dy, float dz)
      Increase the rotation of the Entity by the addition of the Vector3f of dx, dy and dz
      Parameters:
      dx -
      dy -
      dz -