Class AbstractCamera
- java.lang.Object
-
- gaia.cu9.ari.gaiaorbit.scenegraph.camera.AbstractCamera
-
- All Implemented Interfaces:
ICamera
- Direct Known Subclasses:
FovCamera
,NaturalCamera
,RelativisticCamera
,SpacecraftCamera
public abstract class AbstractCamera extends java.lang.Object implements ICamera
-
-
Field Summary
Fields Modifier and Type Field Description protected float
angleEdgeRad
Angle from the center to the corner of the screen in scene coordinates, in radiansprotected float
ar
Aspect ratiostatic double
CAM_FAR
Camera far valuestatic double
CAM_NEAR
Camera near valuescom.badlogic.gdx.graphics.PerspectiveCamera
camera
The main cameraprotected com.badlogic.gdx.graphics.PerspectiveCamera[]
cameras
Vector with all perspective camerasprotected com.badlogic.gdx.graphics.PerspectiveCamera
camLeft
Stereoscopic mode camerasprotected com.badlogic.gdx.graphics.PerspectiveCamera
camRight
Stereoscopic mode camerasprotected IFocus
closest
Closest entity to cameraprotected IStarFocus
closestStar
The closest star to the cameraprotected Matrix4d
combined
protected double
distance
Distance of camera to centerfloat
fovFactor
protected static Logger.Log
logger
protected CameraManager
parent
The parentVector3d
pos
Vector3d
posinv
protected Matrix4d
projection
Vector3d
tmp
protected Matrix4d
view
-
Constructor Summary
Constructors Constructor Description AbstractCamera(CameraManager parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkClosest(IFocus cb)
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)
protected boolean
computeVisibleFovs(CelestialBody cb, FovCamera fcamera)
Returns true if a body with the given position is observed in any of the given directions using the given cone anglevoid
copyParamsFrom(AbstractCamera other)
float
getAngleEdge()
Gets the angle of the edge of the screen, diagonally.float
getAngleEdge(int width, int height, float angle)
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()
double
getDistance()
Gets the distance from the camera to the centre of our reference frame (Sun)float
getFovFactor()
Vector3d
getInversePos()
CameraManager
getManager()
Vector3d
getPos()
Vector3d
getVelocity()
boolean
isVisible(ITimeFrameProvider time, double viewAngle, Vector3d pos, double distToCamera)
boolean
isVisible(ITimeFrameProvider time, CelestialBody cb)
void
render(int rw, int rh)
void
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
setPos(Vector3d pos)
void
updateAngleEdge(int width, int height)
void
updateFrustum(Frustumd frustum, com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3d position, Vector3d direction, Vector3d up)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gaia.cu9.ari.gaiaorbit.scenegraph.camera.ICamera
getCamera, getDirection, getDirections, getFocus, getFrontCameras, getMode, getNCameras, getSpeed, getTranslateUnits, getUp, isFocus, resize, setCamera, setDirection, update, updateMode
-
-
-
-
Field Detail
-
logger
protected static final Logger.Log logger
-
CAM_FAR
public static final double CAM_FAR
Camera far value- See Also:
- Constant Field Values
-
CAM_NEAR
public static final double CAM_NEAR
Camera near values- See Also:
- Constant Field Values
-
pos
public Vector3d pos
-
posinv
public Vector3d posinv
-
tmp
public Vector3d tmp
-
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
-
closest
protected IFocus closest
Closest entity to camera
-
camera
public com.badlogic.gdx.graphics.PerspectiveCamera camera
The main camera
-
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
-
fovFactor
public float fovFactor
-
closestStar
protected IStarFocus closestStar
The closest star to the camera
-
-
Constructor Detail
-
AbstractCamera
public AbstractCamera(CameraManager parent)
-
-
Method Detail
-
updateAngleEdge
public void updateAngleEdge(int width, int height)
- Specified by:
updateAngleEdge
in interfaceICamera
-
getAngleEdge
public float getAngleEdge(int width, int height, float angle)
-
getFovFactor
public float getFovFactor()
- Specified by:
getFovFactor
in interfaceICamera
-
getInversePos
public Vector3d getInversePos()
- Specified by:
getInversePos
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
-
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)
-
computeVisibleFovs
protected boolean computeVisibleFovs(CelestialBody cb, FovCamera fcamera)
Returns true if a body with the given position is observed in any of the given directions using the given cone angle- Parameters:
cb
- The body.fcamera
- The FovCamera.- Returns:
- True if the body is observed. False 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 interfaceICamera
- Returns:
- The distance
-
checkClosest
public void checkClosest(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:
checkClosest
in interfaceICamera
- Parameters:
cb
- The body to check
-
getClosest
public IFocus getClosest()
- Specified by:
getClosest
in interfaceICamera
-
getClosest2
public IFocus getClosest2()
- Specified by:
getClosest2
in interfaceICamera
-
copyParamsFrom
public void copyParamsFrom(AbstractCamera other)
-
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
-
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
-
updateFrustum
public void updateFrustum(Frustumd frustum, com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3d position, Vector3d direction, Vector3d up)
-
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
-
getVelocity
public Vector3d getVelocity()
- Specified by:
getVelocity
in interfaceICamera
-
-