Package gaiasky.scenegraph.camera
Class AbstractCamera
- java.lang.Object
-
- gaiasky.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 floatangleEdgeRadAngle from the center to the corner of the screen in scene coordinates, in radiansprotected floatarAspect ratiodoubleCAM_FARCamera far valuedoubleCAM_NEARCamera near valuecom.badlogic.gdx.graphics.PerspectiveCameracameraThe main cameraprotected com.badlogic.gdx.graphics.PerspectiveCamera[]camerasVector with all perspective camerasprotected com.badlogic.gdx.graphics.PerspectiveCameracamLeftStereoscopic mode camerasprotected com.badlogic.gdx.graphics.PerspectiveCameracamRightStereoscopic mode camerasprotected IFocusclosestThe closest betweenclosestBodyandclosestStarprotected IFocusclosestBodyClosest non-star body to the cameraprotected IFocusclosestStarThe closest particle to the cameraprotected Matrix4dcombinedprotected doubledistanceDistance of camera to centerfloatfovFactorprotected Frustumdfrustumdprotected static Logger.Logloggerprotected CameraManagerparentThe parentVector3dposVector3dposinvprotected com.badlogic.gdx.math.Matrix4prevCombinedVector3dprevposprotected Matrix4dprojectionVector3dshiftVector3dtmpprotected Matrix4dview
-
Constructor Summary
Constructors Constructor Description AbstractCamera(CameraManager parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckClosestBody(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 nearvoidcheckClosestParticle(IFocus star)Sets the current closest particle to this camera.voidcomputeGaiaScan(ITimeFrameProvider time, CelestialBody cb)protected booleancomputeVisibleFovs(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 anglevoidcopyParamsFrom(AbstractCamera other)floatgetAngleEdge()Gets the angle of the edge of the screen, diagonally.floatgetAngleEdge(int width, int height, float angle)com.badlogic.gdx.graphics.PerspectiveCameragetCameraStereoLeft()com.badlogic.gdx.graphics.PerspectiveCameragetCameraStereoRight()IFocusgetClosest()Returns the current closest objectIFocusgetClosestBody()IFocusgetClosestParticle()Gets the current closest particle to this cameraICameragetCurrent()doublegetDistance()Gets the distance from the camera to the centre of our reference frame (Sun)doublegetFar()floatgetFovFactor()Vector3dgetInversePos()CameraManagergetManager()doublegetNear()Vector3dgetPos()Vector3dgetPreviousPos()com.badlogic.gdx.math.Matrix4getPreviousProjView()com.badlogic.gdx.math.Matrix4getProjView()IFocusgetSecondClosestBody()Vector3dgetShift()Vector3dgetVelocity()booleanisVisible(ITimeFrameProvider time, double viewAngle, Vector3d pos, double distToCamera)booleanisVisible(ITimeFrameProvider time, CelestialBody cb)voidrender(int rw, int rh)voidsetCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetClosest(IFocus focus)Sets the closest of allprotected voidsetFrustumPlanes(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetPos(Vector3d pos)voidsetPreviousPos(Vector3d prevpos)voidsetPreviousProjView(com.badlogic.gdx.math.Matrix4 mat)voidsetShift(Vector3d shift)voidupdate(com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3d position, Vector3d direction, Vector3d up)voidupdateAngleEdge(int width, int height)voidupdateFrustumPlanes()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gaiasky.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 double CAM_FAR
Camera far value
-
CAM_NEAR
public double CAM_NEAR
Camera near value
-
pos
public Vector3d pos
-
posinv
public Vector3d posinv
-
prevpos
public Vector3d prevpos
-
shift
public Vector3d shift
-
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
-
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
-
frustumd
protected Frustumd frustumd
-
fovFactor
public float fovFactor
-
closestBody
protected IFocus closestBody
Closest non-star body to the camera
-
closestStar
protected IFocus closestStar
The closest particle to the camera
-
prevCombined
protected com.badlogic.gdx.math.Matrix4 prevCombined
-
closest
protected IFocus closest
The closest betweenclosestBodyandclosestStar
-
-
Constructor Detail
-
AbstractCamera
public AbstractCamera(CameraManager parent)
-
-
Method Detail
-
updateAngleEdge
public void updateAngleEdge(int width, int height)- Specified by:
updateAngleEdgein interfaceICamera
-
getAngleEdge
public float getAngleEdge(int width, int height, float angle)
-
getFovFactor
public float getFovFactor()
- Specified by:
getFovFactorin interfaceICamera
-
getPreviousPos
public Vector3d getPreviousPos()
- Specified by:
getPreviousPosin interfaceICamera
-
setPreviousPos
public void setPreviousPos(Vector3d prevpos)
- Specified by:
setPreviousPosin interfaceICamera
-
getInversePos
public Vector3d getInversePos()
- Specified by:
getInversePosin interfaceICamera
-
getAngleEdge
public float getAngleEdge()
Description copied from interface:ICameraGets 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:
getAngleEdgein interfaceICamera- Returns:
- The angle in radians.
-
getManager
public CameraManager getManager()
- Specified by:
getManagerin interfaceICamera
-
getCurrent
public ICamera getCurrent()
- Specified by:
getCurrentin interfaceICamera
-
computeGaiaScan
public void computeGaiaScan(ITimeFrameProvider time, CelestialBody cb)
- Specified by:
computeGaiaScanin 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:ICameraGets the distance from the camera to the centre of our reference frame (Sun)- Specified by:
getDistancein interfaceICamera- Returns:
- The distance
-
copyParamsFrom
public void copyParamsFrom(AbstractCamera other)
-
getCameraStereoLeft
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft()
- Specified by:
getCameraStereoLeftin interfaceICamera
-
getCameraStereoRight
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()
- Specified by:
getCameraStereoRightin interfaceICamera
-
setCameraStereoLeft
public void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)
- Specified by:
setCameraStereoLeftin interfaceICamera
-
setCameraStereoRight
public void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)
- Specified by:
setCameraStereoRightin interfaceICamera
-
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:ICameraCalled 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:
checkClosestBodyin interfaceICamera- Parameters:
cb- The body to check
-
getClosestBody
public IFocus getClosestBody()
- Specified by:
getClosestBodyin interfaceICamera
-
getSecondClosestBody
public IFocus getSecondClosestBody()
- Specified by:
getSecondClosestBodyin interfaceICamera
-
getClosestParticle
public IFocus getClosestParticle()
Description copied from interface:ICameraGets the current closest particle to this camera- Specified by:
getClosestParticlein interfaceICamera- Returns:
- The closest particle
-
checkClosestParticle
public void checkClosestParticle(IFocus star)
Description copied from interface:ICameraSets the current closest particle to this camera. This will be only set if the given particle is closer than the current.- Specified by:
checkClosestParticlein interfaceICamera- Parameters:
star- The candidate particle
-
getClosest
public IFocus getClosest()
Description copied from interface:ICameraReturns the current closest object- Specified by:
getClosestin interfaceICamera
-
setClosest
public void setClosest(IFocus focus)
Description copied from interface:ICameraSets the closest of all- Specified by:
setClosestin interfaceICamera- Parameters:
focus- The new closest object
-
getVelocity
public Vector3d getVelocity()
- Specified by:
getVelocityin interfaceICamera
-
updateFrustumPlanes
public void updateFrustumPlanes()
- Specified by:
updateFrustumPlanesin interfaceICamera
-
setFrustumPlanes
protected void setFrustumPlanes(com.badlogic.gdx.graphics.PerspectiveCamera cam)
-
getProjView
public com.badlogic.gdx.math.Matrix4 getProjView()
- Specified by:
getProjViewin interfaceICamera
-
getPreviousProjView
public com.badlogic.gdx.math.Matrix4 getPreviousProjView()
- Specified by:
getPreviousProjViewin interfaceICamera
-
setPreviousProjView
public void setPreviousProjView(com.badlogic.gdx.math.Matrix4 mat)
- Specified by:
setPreviousProjViewin interfaceICamera
-
-