Package gaiasky.scenegraph.camera
Class CameraManager
- java.lang.Object
-
- gaiasky.scenegraph.camera.CameraManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCameraManager.CameraModeConvenience enum to describe the camera mode
-
Field Summary
Fields Modifier and Type Field Description ICameracurrentFovCamerafovCameraCameraManager.CameraModemodeNaturalCameranaturalCameraRelativisticCamerarelativisticCameraSpacecraftCameraspacecraftCameraprotected doublespeedCurrent velocity in km/hprotected Vector3dvelocityVelocity vectorprotected Vector3dvelocitynorVelocity vector
-
Constructor Summary
Constructors Constructor Description CameraManager(com.badlogic.gdx.assets.AssetManager manager, CameraManager.CameraMode mode, boolean vr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckClosestBody(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 nearvoidcheckClosestParticle(IFocus particle)Sets the current closest particle to this camera.voidcomputeGaiaScan(ITimeFrameProvider time, CelestialBody cb)floatgetAngleEdge()Gets the angle of the edge of the screen, diagonally.com.badlogic.gdx.graphics.PerspectiveCameragetCamera()Returns the perspective camera.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()Vector3dgetDirection()Vector3d[]getDirections()doublegetDistance()Gets the distance from the camera to the centre of our reference frame (Sun)doublegetFar()IFocusgetFocus()Returns the foucs if anyfloatgetFovFactor()com.badlogic.gdx.graphics.PerspectiveCamera[]getFrontCameras()Vector3dgetInversePos()CameraManagergetManager()CameraManager.CameraModegetMode()intgetNCameras()doublegetNear()Vector3dgetPos()Vector3dgetPreviousPos()com.badlogic.gdx.math.Matrix4getPreviousProjView()com.badlogic.gdx.math.Matrix4getProjView()IFocusgetSecondClosestBody()Vector3dgetShift()doublegetSpeed()Gets the current velocity of the camera in km/h.doublegetTranslateUnits()Vector3dgetUp()Vector3dgetVelocity()booleanisFocus(IFocus cb)Checks if this body is the current focusbooleanisNatural()booleanisVisible(ITimeFrameProvider time, double viewAngle, Vector3d pos, double distToCamera)booleanisVisible(ITimeFrameProvider time, CelestialBody cb)voidnotify(Events event, java.lang.Object... data)voidrender(int rw, int rh)voidresize(int width, int height)voidsetCamera(com.badlogic.gdx.graphics.PerspectiveCamera cam)Sets the active cameravoidsetCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetClosest(IFocus focus)Sets the closest of allvoidsetDirection(Vector3d dir)voidsetPos(Vector3d pos)voidsetPreviousPos(Vector3d prevpos)voidsetPreviousProjView(com.badlogic.gdx.math.Matrix4 mat)voidsetShift(Vector3d shift)voidupdate(double dt, ITimeFrameProvider time)Update method.voidupdateAngleEdge(int width, int height)voidupdateCurrentCamera(CameraManager.CameraMode previousMode)voidupdateFrustumPlanes()voidupdateMode(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, boolean vr)
-
-
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:ICameraReturns the perspective camera.
-
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
-
getVelocity
public Vector3d getVelocity()
- Specified by:
getVelocityin interfaceICamera
-
getDirection
public Vector3d getDirection()
- Specified by:
getDirectionin interfaceICamera
-
setDirection
public void setDirection(Vector3d dir)
- Specified by:
setDirectionin 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:
updateModein interfaceICamera- Parameters:
mode-
-
notify
public void notify(Events event, java.lang.Object... data)
-
getDirections
public Vector3d[] getDirections()
- Specified by:
getDirectionsin interfaceICamera
-
getNCameras
public int getNCameras()
- Specified by:
getNCamerasin interfaceICamera
-
getFrontCameras
public com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras()
- Specified by:
getFrontCamerasin interfaceICamera
-
getMode
public CameraManager.CameraMode getMode()
-
updateAngleEdge
public void updateAngleEdge(int width, int height)- Specified by:
updateAngleEdgein 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
-
getSpeed
public double getSpeed()
Description copied from interface:ICameraGets the current velocity of the camera in km/h.
-
isFocus
public boolean isFocus(IFocus cb)
Description copied from interface:ICameraChecks if this body is the current focus
-
checkClosestBody
public void checkClosestBody(IFocus focus)
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:
focus- The body to check
-
getFocus
public IFocus getFocus()
Description copied from interface:ICameraReturns the foucs if any
-
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)
-
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
-
setCamera
public void setCamera(com.badlogic.gdx.graphics.PerspectiveCamera cam)
Description copied from interface:ICameraSets the active camera
-
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
-
getCameraStereoLeft
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft()
- Specified by:
getCameraStereoLeftin interfaceICamera
-
getCameraStereoRight
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()
- Specified by:
getCameraStereoRightin interfaceICamera
-
getClosestBody
public IFocus getClosestBody()
- Specified by:
getClosestBodyin interfaceICamera
-
getSecondClosestBody
public IFocus getSecondClosestBody()
- Specified by:
getSecondClosestBodyin interfaceICamera
-
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
-
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 particle)
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:
particle- 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
-
getTranslateUnits
public double getTranslateUnits()
- Specified by:
getTranslateUnitsin interfaceICamera
-
updateFrustumPlanes
public void updateFrustumPlanes()
- Specified by:
updateFrustumPlanesin interfaceICamera
-
-