Class CameraManager
java.lang.Object
gaiasky.scene.camera.CameraManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumConvenience enum to describe the camera mode -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCameraManager(com.badlogic.gdx.assets.AssetManager manager, CameraManager.CameraMode mode, boolean vr, GlobalResources globalResources) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcheckClosestBody(com.badlogic.ashley.core.Entity entity) Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera nearvoidcheckClosestBody(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.voiddoneLoading(com.badlogic.gdx.assets.AssetManager manager) Loading is finished, gather resources.floatGets the angle of the edge of the screen, diagonally.com.badlogic.gdx.graphics.PerspectiveCameraReturns the perspective camera.com.badlogic.gdx.graphics.PerspectiveCameracom.badlogic.gdx.graphics.PerspectiveCameragetCloseLightSource(int i) Gets the current i-close light source to this cameraReturns the current closest objectGets the current closest particle to this cameraVector3D[]doubleGets the distance from the camera to the centre of our reference frame (Sun)getDPos()doublegetFar()getFocus()Returns the focus if any.floatcom.badlogic.gdx.graphics.PerspectiveCamera[]static voidgetFrustumCornersEye(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.getMode()intdoublegetNear()getPos()com.badlogic.gdx.math.Matrix4com.badlogic.gdx.math.Matrix4getShift()doublegetSpeed()Gets the current velocity of the camera in km/h.doubledoublegetUp()booleanhasFocus()Checks whether the current camera has a focus set.booleanisFocus(com.badlogic.ashley.core.Entity cb) Checks if the given entity is the current focus.booleanbooleanCheck whether the camera is currently rotating around the (possible) focus object.booleanbooleanisVisible(com.badlogic.ashley.core.Entity cb) voidEvent notification call.voidrender(int rw, int rh) voidresize(int width, int height) voidvoidsetCamera(com.badlogic.gdx.graphics.PerspectiveCamera perspectiveCamera) 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) voidvoidvoidsetGamepadInput(boolean state) Main input mode is a gamepad.voidsetPointerProjectionOnFocus(com.badlogic.gdx.math.Vector3 point) Sets the current pointer coordinates, as projected on the current focus object.voidvoidvoidsetPreviousPos(Vector3D prevPos) voidsetPreviousPos(Vector3Q prevPos) voidsetPreviousProjView(com.badlogic.gdx.math.Matrix4 mat) voiddoublevoidvoidupdate(double dt, ITimeFrameProvider time) Update method.voidupdateAngleEdge(int width, int height) voidvoidvoidupdateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode newMode, boolean centerFocus) Runs on each camera after a mode change.
-
Field Details
-
mode
-
current
-
naturalCamera
-
spacecraftCamera
-
relativisticCamera
-
previousClosest
-
speed
protected double speedCurrent velocity in km/h -
velocity
Velocity vector -
velocityNormalized
Velocity vector
-
-
Constructor Details
-
CameraManager
public CameraManager(com.badlogic.gdx.assets.AssetManager manager, CameraManager.CameraMode mode, boolean vr, GlobalResources globalResources)
-
-
Method Details
-
doneLoading
public void doneLoading(com.badlogic.gdx.assets.AssetManager manager) Description copied from interface:ICameraLoading is finished, gather resources.- Specified by:
doneLoadingin interfaceICamera- Parameters:
manager- The asset manager.
-
getFrustumCornersEye
public static void 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 camerafrustumCorners- The matrix to fill
-
updateCurrentCamera
public void updateCurrentCamera() -
isNatural
public boolean isNatural() -
getCamera
-
setCamera
-
getFovFactor
public float getFovFactor()- Specified by:
getFovFactorin interfaceICamera
-
getPos
-
setPos
-
setPos
-
getPreviousPos
- Specified by:
getPreviousPosin interfaceICamera
-
setPreviousPos
- Specified by:
setPreviousPosin interfaceICamera
-
setPreviousPos
- Specified by:
setPreviousPosin interfaceICamera
-
getDPos
-
setDPos
-
setDPos
-
getInversePos
- Specified by:
getInversePosin interfaceICamera
-
getVelocity
- Specified by:
getVelocityin interfaceICamera
-
getDirection
- Specified by:
getDirectionin interfaceICamera
-
setDirection
- Specified by:
setDirectionin interfaceICamera
-
getUp
-
swapBuffers
public void swapBuffers()- Specified by:
swapBuffersin interfaceICamera
-
setGamepadInput
public void setGamepadInput(boolean state) Description copied from interface:ICameraMain input mode is a gamepad.- Specified by:
setGamepadInputin interfaceICamera
-
setPointerProjectionOnFocus
public void setPointerProjectionOnFocus(com.badlogic.gdx.math.Vector3 point) Description copied from interface:ICameraSets the current pointer coordinates, as projected on the current focus object. This only applies when the camera is in focus mode, and the focus is a planet.- Specified by:
setPointerProjectionOnFocusin interfaceICamera- Parameters:
point- The Cartesian coordinates of the pointer on the sphere representing the focus object.
-
getSpeedScaling
public double getSpeedScaling()- Specified by:
getSpeedScalingin interfaceICamera
-
getSpeedScalingCapped
public double getSpeedScalingCapped()- Specified by:
getSpeedScalingCappedin interfaceICamera
-
backupCamera
public void backupCamera() -
restoreCamera
public void restoreCamera() -
update
Update method. -
updateMode
public void updateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode newMode, boolean centerFocus) Runs on each camera after a mode change.- Specified by:
updateModein interfaceICamera
-
notify
-
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
-
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
- Specified by:
getManagerin interfaceICamera
-
render
-
getCurrent
- Specified by:
getCurrentin interfaceICamera
-
getSpeed
-
isFocus
-
checkClosestBody
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
-
checkClosestBody
public void checkClosestBody(com.badlogic.ashley.core.Entity entity) 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:
entity- The body to check.
-
getFocus
-
hasFocus
-
isVisible
-
isVisible
-
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
-
isRotating
public boolean isRotating()Description copied from interface:ICameraCheck whether the camera is currently rotating around the (possible) focus object.- Specified by:
isRotatingin interfaceICamera- Returns:
- Whether the camera is rotating.
-
getCameraStereoLeft
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft()- Specified by:
getCameraStereoLeftin interfaceICamera
-
setCameraStereoLeft
public void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam) - Specified by:
setCameraStereoLeftin interfaceICamera
-
getCameraStereoRight
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()- Specified by:
getCameraStereoRightin interfaceICamera
-
setCameraStereoRight
public void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam) - Specified by:
setCameraStereoRightin interfaceICamera
-
getClosestBody
- Specified by:
getClosestBodyin interfaceICamera
-
getSecondClosestBody
- Specified by:
getSecondClosestBodyin interfaceICamera
-
getCloseLightSource
Description copied from interface:ICameraGets the current i-close light source to this camera- Specified by:
getCloseLightSourcein interfaceICamera- Returns:
- The i close light source (star?)
-
resize
-
getShift
-
setShift
-
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
Description copied from interface:ICameraGets the current closest particle to this camera- Specified by:
getClosestParticlein interfaceICamera- Returns:
- The closest particle
-
checkClosestParticle
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
Description copied from interface:ICameraReturns the current closest object- Specified by:
getClosestin interfaceICamera
-
setClosest
Description copied from interface:ICameraSets the closest of all- Specified by:
setClosestin interfaceICamera- Parameters:
focus- The new closest object
-
speedScaling
public double speedScaling()- Specified by:
speedScalingin interfaceICamera
-
updateFrustumPlanes
public void updateFrustumPlanes()- Specified by:
updateFrustumPlanesin interfaceICamera
-
getNear
-
getFar
-