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

    • logger

      protected static final Logger.Log logger
    • CAM_FAR

      public double CAM_FAR
      Camera far value
    • CAM_NEAR

      public double CAM_NEAR
      Camera near value
    • pos

      public Vector3b pos
    • posinv

      public Vector3b posinv
    • prevpos

      public Vector3b prevpos
    • tmp

      public Vector3d tmp
    • shift

      public Vector3d shift
    • camera

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

      public float fovFactor
    • angleEdgeRad

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

      protected float ar
      Aspect ratio
    • distance

      protected double distance
      Distance of camera to center
    • parent

      protected CameraManager parent
      The parent
    • camLeft

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

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

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

      protected Matrix4d projection
    • view

      protected Matrix4d view
    • combined

      protected Matrix4d combined
    • frustumd

      protected FrustumDouble frustumd
    • closestBody

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

      protected IFocus closestStar
      The closest particle to the camera
    • closestStarView

      protected FocusView closestStarView
    • proximity

      protected Proximity proximity
    • prevCombined

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

      protected IFocus closest
      The closest between closestBody and closestStar
    • gamepadInput

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

  • Method Details

    • updateAngleEdge

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

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

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

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

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

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

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

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

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

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

      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

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

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

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

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

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

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

      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

      public void copyParamsFrom(AbstractCamera other)
    • getCameraStereoLeft

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

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

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

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

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

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

      public void update(com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3d position, Vector3d direction, Vector3d up)
    • 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
      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
      Parameters:
      cb - The body to check.
    • getClosestBody

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

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

      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

      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

      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

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

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

      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

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

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

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

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

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

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

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

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

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