Class CameraManager
- java.lang.Object
-
- gaia.cu9.ari.gaiaorbit.scenegraph.camera.CameraManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CameraManager.CameraMode
Convenience enum to describe the camera mode
-
Field Summary
Fields Modifier and Type Field Description ICamera
current
FovCamera
fovCamera
CameraManager.CameraMode
mode
NaturalCamera
naturalCamera
RelativisticCamera
relativisticCamera
SpacecraftCamera
spacecraftCamera
protected double
speed
Current velocity in km/hprotected Vector3d
velocity
Velocity vectorprotected Vector3d
velocitynor
Velocity vector
-
Constructor Summary
Constructors Constructor Description CameraManager(com.badlogic.gdx.assets.AssetManager manager, CameraManager.CameraMode mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkClosest(IFocus focus)
Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera nearvoid
computeGaiaScan(ITimeFrameProvider time, CelestialBody cb)
float
getAngleEdge()
Gets the angle of the edge of the screen, diagonally.com.badlogic.gdx.graphics.PerspectiveCamera
getCamera()
Returns the perspective camera.com.badlogic.gdx.graphics.PerspectiveCamera
getCameraStereoLeft()
com.badlogic.gdx.graphics.PerspectiveCamera
getCameraStereoRight()
IFocus
getClosest()
IFocus
getClosest2()
IStarFocus
getClosestStar()
Gets the current closest star to this cameraICamera
getCurrent()
Vector3d
getDirection()
Vector3d[]
getDirections()
double
getDistance()
Gets the distance from the camera to the centre of our reference frame (Sun)IFocus
getFocus()
Returns the foucs if anyfloat
getFovFactor()
com.badlogic.gdx.graphics.PerspectiveCamera[]
getFrontCameras()
Vector3d
getInversePos()
CameraManager
getManager()
CameraManager.CameraMode
getMode()
int
getNCameras()
Vector3d
getPos()
double
getSpeed()
Gets the current velocity of the camera in km/h.double
getTranslateUnits()
Vector3d
getUp()
Vector3d
getVelocity()
boolean
isFocus(IFocus cb)
Checks if this body is the current focusboolean
isNatural()
boolean
isVisible(ITimeFrameProvider time, double viewAngle, Vector3d pos, double distToCamera)
boolean
isVisible(ITimeFrameProvider time, CelestialBody cb)
void
notify(Events event, java.lang.Object... data)
void
render(int rw, int rh)
void
resize(int width, int height)
void
setCamera(com.badlogic.gdx.graphics.PerspectiveCamera cam)
Sets the active cameravoid
setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)
void
setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)
void
setClosestStar(IStarFocus star)
Sets the current closest star to this camera.void
setDirection(Vector3d dir)
void
setPos(Vector3d pos)
void
update(double dt, ITimeFrameProvider time)
Update method.void
updateAngleEdge(int width, int height)
void
updateCurrentCamera(CameraManager.CameraMode previousMode)
void
updateMode(CameraManager.CameraMode mode, boolean centerFocus, boolean postEvent)
Sets the new camera mode and updates the frustum
-
-
-
Field Detail
-
mode
public CameraManager.CameraMode mode
-
current
public ICamera current
-
naturalCamera
public NaturalCamera naturalCamera
-
fovCamera
public FovCamera fovCamera
-
spacecraftCamera
public SpacecraftCamera spacecraftCamera
-
relativisticCamera
public RelativisticCamera relativisticCamera
-
speed
protected double speed
Current velocity in km/h
-
velocity
protected Vector3d velocity
Velocity vector
-
velocitynor
protected Vector3d velocitynor
Velocity vector
-
-
Constructor Detail
-
CameraManager
public CameraManager(com.badlogic.gdx.assets.AssetManager manager, CameraManager.CameraMode mode)
-
-
Method Detail
-
updateCurrentCamera
public void updateCurrentCamera(CameraManager.CameraMode previousMode)
-
isNatural
public boolean isNatural()
-
getCamera
public com.badlogic.gdx.graphics.PerspectiveCamera getCamera()
Description copied from interface:ICamera
Returns the perspective camera.
-
getFovFactor
public float getFovFactor()
- Specified by:
getFovFactor
in interfaceICamera
-
getInversePos
public Vector3d getInversePos()
- Specified by:
getInversePos
in interfaceICamera
-
getVelocity
public Vector3d getVelocity()
- Specified by:
getVelocity
in interfaceICamera
-
getDirection
public Vector3d getDirection()
- Specified by:
getDirection
in interfaceICamera
-
setDirection
public void setDirection(Vector3d dir)
- Specified by:
setDirection
in interfaceICamera
-
update
public void update(double dt, ITimeFrameProvider time)
Update method.
-
updateMode
public void updateMode(CameraManager.CameraMode mode, boolean centerFocus, boolean postEvent)
Sets the new camera mode and updates the frustum- Specified by:
updateMode
in interfaceICamera
- Parameters:
mode
-
-
notify
public void notify(Events event, java.lang.Object... data)
-
getDirections
public Vector3d[] getDirections()
- Specified by:
getDirections
in interfaceICamera
-
getNCameras
public int getNCameras()
- Specified by:
getNCameras
in interfaceICamera
-
getFrontCameras
public com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras()
- Specified by:
getFrontCameras
in interfaceICamera
-
getMode
public CameraManager.CameraMode getMode()
-
updateAngleEdge
public void updateAngleEdge(int width, int height)
- Specified by:
updateAngleEdge
in interfaceICamera
-
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 interfaceICamera
- Returns:
- The angle in radians.
-
getManager
public CameraManager getManager()
- Specified by:
getManager
in interfaceICamera
-
getCurrent
public ICamera getCurrent()
- Specified by:
getCurrent
in interfaceICamera
-
getSpeed
public double getSpeed()
Description copied from interface:ICamera
Gets the current velocity of the camera in km/h.
-
isFocus
public boolean isFocus(IFocus cb)
Description copied from interface:ICamera
Checks if this body is the current focus
-
checkClosest
public void checkClosest(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:
checkClosest
in interfaceICamera
- Parameters:
focus
- The body to check
-
getFocus
public IFocus getFocus()
Description copied from interface:ICamera
Returns the foucs if any
-
computeGaiaScan
public void computeGaiaScan(ITimeFrameProvider time, CelestialBody cb)
- Specified by:
computeGaiaScan
in interfaceICamera
-
isVisible
public boolean isVisible(ITimeFrameProvider time, CelestialBody cb)
-
isVisible
public boolean isVisible(ITimeFrameProvider time, double viewAngle, Vector3d 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 interfaceICamera
- Returns:
- The distance
-
setCamera
public void setCamera(com.badlogic.gdx.graphics.PerspectiveCamera cam)
Description copied from interface:ICamera
Sets the active camera
-
setCameraStereoLeft
public void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)
- Specified by:
setCameraStereoLeft
in interfaceICamera
-
setCameraStereoRight
public void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)
- Specified by:
setCameraStereoRight
in interfaceICamera
-
getCameraStereoLeft
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft()
- Specified by:
getCameraStereoLeft
in interfaceICamera
-
getCameraStereoRight
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()
- Specified by:
getCameraStereoRight
in interfaceICamera
-
getClosest
public IFocus getClosest()
- Specified by:
getClosest
in interfaceICamera
-
getClosest2
public IFocus getClosest2()
- Specified by:
getClosest2
in interfaceICamera
-
getClosestStar
public IStarFocus getClosestStar()
Description copied from interface:ICamera
Gets the current closest star to this camera- Specified by:
getClosestStar
in interfaceICamera
- Returns:
- The closest star
-
setClosestStar
public void setClosestStar(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:
setClosestStar
in interfaceICamera
- Parameters:
star
- The candidate star
-
getTranslateUnits
public double getTranslateUnits()
- Specified by:
getTranslateUnits
in interfaceICamera
-
-