Class CameraManager

    • Constructor Detail

      • CameraManager

        public CameraManager​(com.badlogic.gdx.assets.AssetManager manager,
                             CameraManager.CameraMode mode,
                             boolean vr)
    • Method Detail

      • isNatural

        public boolean isNatural()
      • 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.
      • update

        public void update​(double dt,
                           ITimeFrameProvider time)
        Update method.
        Specified by:
        update in interface ICamera
        Parameters:
        dt - Delta time in seconds.
        time - The time frame provider.
      • updateMode

        public void updateMode​(CameraManager.CameraMode mode,
                               boolean centerFocus,
                               boolean postEvent)
        Sets the new camera mode and updates the frustum
        Specified by:
        updateMode in interface ICamera
        Parameters:
        mode -
      • notify

        public void notify​(Events event,
                           java.lang.Object... data)
        Specified by:
        notify in interface IObserver
      • getFrontCameras

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

        public void updateAngleEdge​(int width,
                                    int height)
        Specified by:
        updateAngleEdge 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.
      • render

        public void render​(int rw,
                           int rh)
        Specified by:
        render 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.
      • isFocus

        public boolean isFocus​(IFocus cb)
        Description copied from interface: ICamera
        Checks if this body is the current focus
        Specified by:
        isFocus in interface ICamera
        Parameters:
        cb - The body
        Returns:
        Whether the body is focus
      • checkClosestBody

        public void checkClosestBody​(IFocus focus)
        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:
        focus - The body to check
      • getFocus

        public IFocus getFocus()
        Description copied from interface: ICamera
        Returns the foucs if any
        Specified by:
        getFocus in interface ICamera
        Returns:
        The foucs object if it is in focus mode. Null otherwise
      • 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
      • setCamera

        public void setCamera​(com.badlogic.gdx.graphics.PerspectiveCamera cam)
        Description copied from interface: ICamera
        Sets the active camera
        Specified by:
        setCamera in interface ICamera
      • setCameraStereoLeft

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

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

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

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

        public void resize​(int width,
                           int height)
        Specified by:
        resize 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
      • getClosestStar

        public IStarFocus getClosestStar()
        Description copied from interface: ICamera
        Gets the current closest star to this camera
        Specified by:
        getClosestStar in interface ICamera
        Returns:
        The closest star
      • checkClosestStar

        public void checkClosestStar​(IStarFocus star)
        Description copied from interface: ICamera
        Sets the current closest star to this camera. This will be only set if the given star is closer than the current.
        Specified by:
        checkClosestStar in interface ICamera
        Parameters:
        star - The candidate star
      • 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
      • getNear

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

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