Class AbstractCamera

java.lang.Object
gaiasky.scene.camera.AbstractCamera
All Implemented Interfaces:
ICamera
Direct Known Subclasses:
NaturalCamera, RelativisticCamera, SpacecraftCamera

public abstract class AbstractCamera extends Object implements ICamera
  • Field Details Link icon

    • logger Link icon

      protected static final Logger.Log logger
    • CAM_FAR Link icon

      public double CAM_FAR
      Camera far value.
    • CAM_NEAR Link icon

      public double CAM_NEAR
      Camera near value.
    • pos Link icon

      public Vector3b pos
    • posInv Link icon

      public Vector3b posInv
    • prevPos Link icon

      public Vector3b prevPos
    • tmp Link icon

      public Vector3d tmp
    • shift Link icon

      public Vector3d shift
    • camera Link icon

      public com.badlogic.gdx.graphics.PerspectiveCamera camera
      The main camera.
    • fovFactor Link icon

      public float fovFactor
    • angleEdgeRad Link icon

      protected float angleEdgeRad
      Angle from the center to the corner of the screen in scene coordinates, in radians.
    • ar Link icon

      protected float ar
      Aspect ratio.
    • distance Link icon

      protected double distance
      Distance of camera to center.
    • parent Link icon

      protected CameraManager parent
      The parent.
    • camLeft Link icon

      protected com.badlogic.gdx.graphics.PerspectiveCamera camLeft
      Stereoscopic mode cameras.
    • camRight Link icon

      protected com.badlogic.gdx.graphics.PerspectiveCamera camRight
      Stereoscopic mode cameras.
    • cameras Link icon

      protected com.badlogic.gdx.graphics.PerspectiveCamera[] cameras
      Vector with all perspective cameras.
    • projection Link icon

      protected Matrix4d projection
    • view Link icon

      protected Matrix4d view
    • combined Link icon

      protected Matrix4d combined
    • frustum Link icon

      protected FrustumDouble frustum
    • closestBody Link icon

      protected FocusView closestBody
      Closest non-star body to the camera.
    • closestStar Link icon

      protected IFocus closestStar
      The closest particle to the camera.
    • closestStarView Link icon

      protected FocusView closestStarView
    • proximity Link icon

      protected Proximity proximity
    • prevCombined Link icon

      protected com.badlogic.gdx.math.Matrix4 prevCombined
    • closest Link icon

      protected IFocus closest
      The closest between closestBody and closestStar.
    • gamepadInput Link icon

      protected boolean gamepadInput
      The last input event was by a gamepad.
  • Constructor Details Link icon

    • AbstractCamera Link icon

      protected AbstractCamera(CameraManager parent)
  • Method Details Link icon

    • updateAngleEdge Link icon

      public void updateAngleEdge(int width, int height)
      Specified by:
      updateAngleEdge in interface ICamera
    • getAngleEdge Link icon

      public float getAngleEdge(int width, int height, float angle)
    • getFovFactor Link icon

      public float getFovFactor()
      Specified by:
      getFovFactor in interface ICamera
    • getPos Link icon

      public Vector3b getPos()
      Specified by:
      getPos in interface ICamera
    • setPos Link icon

      public void setPos(Vector3d pos)
      Specified by:
      setPos in interface ICamera
    • setPos Link icon

      public void setPos(Vector3b pos)
      Specified by:
      setPos in interface ICamera
    • getPreviousPos Link icon

      public Vector3b getPreviousPos()
      Specified by:
      getPreviousPos in interface ICamera
    • setPreviousPos Link icon

      public void setPreviousPos(Vector3b pos)
      Specified by:
      setPreviousPos in interface ICamera
    • setPreviousPos Link icon

      public void setPreviousPos(Vector3d prevpos)
      Specified by:
      setPreviousPos in interface ICamera
    • getInversePos Link icon

      public Vector3b getInversePos()
      Specified by:
      getInversePos in interface ICamera
    • getAngleEdge Link icon

      public float getAngleEdge()
      Description copied from interface: ICamera
      Gets the angle of the edge of the screen, diagonally. It assumes the vertical angle is the field of view and corrects the horizontal using the aspect ratio. It depends on the viewport size and the field of view itself.
      Specified by:
      getAngleEdge in interface ICamera
      Returns:
      The angle in radians.
    • getManager Link icon

      public CameraManager getManager()
      Specified by:
      getManager in interface ICamera
    • render Link icon

      public void render(int rw, int rh)
      Specified by:
      render in interface ICamera
    • getCurrent Link icon

      public ICamera getCurrent()
      Specified by:
      getCurrent in interface ICamera
    • isVisible Link icon

      public boolean isVisible(com.badlogic.ashley.core.Entity cb)
      Specified by:
      isVisible in interface ICamera
    • isVisible Link icon

      public boolean isVisible(double viewAngle, Vector3d pos, double distToCamera)
      Specified by:
      isVisible in interface ICamera
    • isVisible Link icon

      public boolean isVisible(double viewAngle, Vector3b pos, double distToCamera)
    • getDistance Link icon

      public double getDistance()
      Description copied from interface: ICamera
      Gets the distance from the camera to the centre of our reference frame (Sun)
      Specified by:
      getDistance in interface ICamera
      Returns:
      The distance
    • copyParamsFrom Link icon

      public void copyParamsFrom(AbstractCamera other)
    • getCameraStereoLeft Link icon

      public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft()
      Specified by:
      getCameraStereoLeft in interface ICamera
    • setCameraStereoLeft Link icon

      public void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)
      Specified by:
      setCameraStereoLeft in interface ICamera
    • getCameraStereoRight Link icon

      public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()
      Specified by:
      getCameraStereoRight in interface ICamera
    • setCameraStereoRight Link icon

      public void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)
      Specified by:
      setCameraStereoRight in interface ICamera
    • getShift Link icon

      public Vector3d getShift()
      Specified by:
      getShift in interface ICamera
    • setShift Link icon

      public void setShift(Vector3d shift)
      Specified by:
      setShift in interface ICamera
    • update Link icon

      public void update(com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3d position, Vector3d direction, Vector3d up)
    • checkClosestBody Link icon

      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
      Parameters:
      cb - The body to check
    • checkClosestBody Link icon

      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
      Parameters:
      cb - The body to check.
    • getClosestBody Link icon

      public IFocus getClosestBody()
      Specified by:
      getClosestBody in interface ICamera
    • getSecondClosestBody Link icon

      public IFocus getSecondClosestBody()
      Specified by:
      getSecondClosestBody in interface ICamera
    • getClosestParticle Link icon

      public IFocus getClosestParticle()
      Description copied from interface: ICamera
      Gets the current closest particle to this camera
      Specified by:
      getClosestParticle in interface ICamera
      Returns:
      The closest particle
    • getCloseLightSource Link icon

      public IFocus getCloseLightSource(int i)
      Description copied from interface: ICamera
      Gets the current i-close light source to this camera
      Specified by:
      getCloseLightSource in interface ICamera
      Returns:
      The i close light source (star?)
    • checkClosestParticle Link icon

      public void checkClosestParticle(IFocus star)
      Description copied from interface: ICamera
      Sets the current closest particle to this camera. This will be only set if the given particle is closer than the current.
      Specified by:
      checkClosestParticle in interface ICamera
      Parameters:
      star - The candidate particle
    • swapBuffers Link icon

      public void swapBuffers()
      Specified by:
      swapBuffers in interface ICamera
    • getClosest Link icon

      public IFocus getClosest()
      Description copied from interface: ICamera
      Returns the current closest object
      Specified by:
      getClosest in interface ICamera
    • setClosest Link icon

      public void setClosest(IFocus focus)
      Description copied from interface: ICamera
      Sets the closest of all
      Specified by:
      setClosest in interface ICamera
      Parameters:
      focus - The new closest object
    • getVelocity Link icon

      public Vector3d getVelocity()
      Specified by:
      getVelocity in interface ICamera
    • updateFrustumPlanes Link icon

      public void updateFrustumPlanes()
      Specified by:
      updateFrustumPlanes in interface ICamera
    • setFrustumPlanes Link icon

      protected void setFrustumPlanes(com.badlogic.gdx.graphics.PerspectiveCamera cam)
    • getNear Link icon

      public double getNear()
      Specified by:
      getNear in interface ICamera
    • getFar Link icon

      public double getFar()
      Specified by:
      getFar in interface ICamera
    • getProjView Link icon

      public com.badlogic.gdx.math.Matrix4 getProjView()
      Specified by:
      getProjView in interface ICamera
    • getPreviousProjView Link icon

      public com.badlogic.gdx.math.Matrix4 getPreviousProjView()
      Specified by:
      getPreviousProjView in interface ICamera
    • setPreviousProjView Link icon

      public void setPreviousProjView(com.badlogic.gdx.math.Matrix4 mat)
      Specified by:
      setPreviousProjView in interface ICamera
    • setGamepadInput Link icon

      public void setGamepadInput(boolean state)
      Description copied from interface: ICamera
      Main input mode is a gamepad.
      Specified by:
      setGamepadInput in interface ICamera
    • setPointerProjectionOnFocus Link icon

      public void setPointerProjectionOnFocus(com.badlogic.gdx.math.Vector3 point)
      Description copied from interface: ICamera
      Sets the current pointer coordinates, as projected on the current focus object. This only applies when the camera is in focus mode, and the focus is a planet.
      Specified by:
      setPointerProjectionOnFocus in interface ICamera
      Parameters:
      point - The Cartesian coordinates of the pointer on the sphere representing the focus object.