Class SpacecraftCamera

java.lang.Object
gaiasky.scene.camera.AbstractCamera
gaiasky.scene.camera.SpacecraftCamera
All Implemented Interfaces:
IObserver, ICamera

public class SpacecraftCamera extends AbstractCamera implements IObserver
Implements a spacecraft-like movement. The spacecraft is modeled as a rigid solid and it has a mass and an engine model. The rest is physics
  • Field Details

    • direction

      public Vector3d direction
      Direction and up vectors.
    • up

      public Vector3d up
      Direction and up vectors.
    • relpos

      public Vector3b relpos
  • Constructor Details

    • SpacecraftCamera

      public SpacecraftCamera(CameraManager parent)
  • Method Details

    • getSpacecraft

      public com.badlogic.ashley.core.Entity getSpacecraft()
    • getSpacecraftView

      public SpacecraftView getSpacecraftView()
    • getCamera

      public com.badlogic.gdx.graphics.PerspectiveCamera getCamera()
      Description copied from interface: ICamera
      Returns the perspective camera.
      Specified by:
      getCamera in interface ICamera
      Returns:
      The perspective camera.
    • setCamera

      public void setCamera(com.badlogic.gdx.graphics.PerspectiveCamera perspectiveCamera)
      Description copied from interface: ICamera
      Sets the active camera
      Specified by:
      setCamera in interface ICamera
      Parameters:
      perspectiveCamera - The perspective camera.
    • getFrontCameras

      public com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras()
      Specified by:
      getFrontCameras in interface ICamera
    • getDirection

      public Vector3d getDirection()
      Specified by:
      getDirection in interface ICamera
    • setDirection

      public void setDirection(Vector3d dir)
      Specified by:
      setDirection in interface ICamera
    • getUp

      public Vector3d getUp()
      Specified by:
      getUp in interface ICamera
    • getDirections

      public Vector3d[] getDirections()
      Specified by:
      getDirections in interface ICamera
    • getNCameras

      public int getNCameras()
      Specified by:
      getNCameras in interface ICamera
    • update

      public void update(double dt, ITimeFrameProvider time)
      Description copied from interface: ICamera
      Updates the camera.
      Specified by:
      update in interface ICamera
      Parameters:
      dt - The time since the las frame in seconds.
      time - The frame time provider (simulation time).
    • updateHard

      public void updateHard(double dt)
      Updates the position and direction of the camera using a hard analytical algorithm.
    • updatePerspectiveCamera

      protected void updatePerspectiveCamera()
    • updateMode

      public void updateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode mode, boolean centerFocus, boolean postEvent)
      Specified by:
      updateMode in interface ICamera
    • getMode

      public CameraManager.CameraMode getMode()
      Specified by:
      getMode in interface ICamera
    • getSpeed

      public double getSpeed()
      Description copied from interface: ICamera
      Gets the current velocity of the camera in km/h.
      Specified by:
      getSpeed in interface ICamera
      Returns:
      The velocity in km/h.
    • getFocus

      public IFocus getFocus()
      Description copied from interface: ICamera
      Returns the focus if any.
      Specified by:
      getFocus in interface ICamera
      Returns:
      The focus object if it is in focus mode. Null otherwise.
    • hasFocus

      public boolean hasFocus()
      Description copied from interface: ICamera
      Checks whether the current camera has a focus set.
      Specified by:
      hasFocus in interface ICamera
      Returns:
      True if the camera has a focus.
    • isFocus

      public boolean isFocus(com.badlogic.ashley.core.Entity entity)
      Description copied from interface: ICamera
      Checks if the given entity is the current focus.
      Specified by:
      isFocus in interface ICamera
      Parameters:
      entity - The entity.
      Returns:
      Whether the entity is focus.
    • addGamepadListener

      public void addGamepadListener()
    • removeGamepadListener

      public void removeGamepadListener()
    • notify

      public void notify(Event event, Object source, Object... data)
      Description copied from interface: IObserver
      Event notification call.
      Specified by:
      notify in interface IObserver
      Parameters:
      event - The event type.
      source - The source object, if any.
      data - The data associated with this event.
    • render

      public void render(int rw, int rh)
      Specified by:
      render in interface ICamera
      Overrides:
      render in class AbstractCamera
    • checkClosestBody

      public void checkClosestBody(IFocus cb)
      Description copied from interface: ICamera
      Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera near
      Specified by:
      checkClosestBody in interface ICamera
      Overrides:
      checkClosestBody in class AbstractCamera
      Parameters:
      cb - The body to check
    • checkClosestBody

      public void checkClosestBody(com.badlogic.ashley.core.Entity cb)
      Description copied from interface: ICamera
      Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera near
      Specified by:
      checkClosestBody in interface ICamera
      Overrides:
      checkClosestBody in class AbstractCamera
      Parameters:
      cb - The body to check.
    • getSecondClosestBody

      public IFocus getSecondClosestBody()
      Specified by:
      getSecondClosestBody in interface ICamera
      Overrides:
      getSecondClosestBody in class AbstractCamera
    • resize

      public void resize(int width, int height)
      Specified by:
      resize in interface ICamera
    • getVelocity

      public Vector3d getVelocity()
      Specified by:
      getVelocity in interface ICamera
      Overrides:
      getVelocity in class AbstractCamera
    • speedScaling

      public double speedScaling()
      Specified by:
      speedScaling in interface ICamera