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
      • 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
      • checkClosestParticle

        public void checkClosestParticle​(IFocus particle)
        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:
        particle - The candidate particle
      • 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
      • speedScaling

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

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

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

        public com.badlogic.gdx.math.Matrix4 getFrustumCornersWorld​(com.badlogic.gdx.math.Matrix4 frustumCorners)
        Stores the normalized rays representing the camera frustum in world space in a 4x4 matrix. Each row is a vector.
        Parameters:
        frustumCorners - The matrix to fill
        Returns:
        The same matrix
      • getFrustumCornersEye

        public static com.badlogic.gdx.math.Matrix4 getFrustumCornersEye​(com.badlogic.gdx.graphics.PerspectiveCamera cam,
                                                                         com.badlogic.gdx.math.Matrix4 frustumCorners)
        Stores the normalized rays representing the camera frustum in eye space in a 4x4 matrix. Each row is a vector.
        Parameters:
        cam - The perspective camera
        frustumCorners - The matrix to fill
        Returns:
        The same matrix