Class AbstractCamera
java.lang.Object
gaiasky.scene.camera.AbstractCamera
- All Implemented Interfaces:
ICamera
- Direct Known Subclasses:
NaturalCamera, RelativisticCamera, SpacecraftCamera
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatAngle from the center to the corner of the screen in scene coordinates, in radians.protected floatAspect ratio.doubleCamera far value.doubleCamera near value.com.badlogic.gdx.graphics.PerspectiveCameraThe main camera.protected com.badlogic.gdx.graphics.PerspectiveCamera[]Vector with all perspective cameras.protected com.badlogic.gdx.graphics.PerspectiveCameraStereoscopic mode cameras.protected com.badlogic.gdx.graphics.PerspectiveCameraStereoscopic mode cameras.protected IFocusThe closest betweenclosestBodyandclosestStar.protected FocusViewClosest non-star body to the camera.protected IFocusThe closest particle to the camera.protected FocusViewprotected doubleDistance of camera to center.floatprotected booleanThe last input event was by a gamepad.protected static final Logger.Logprotected CameraManagerThe parent.protected com.badlogic.gdx.math.Matrix4protected Proximity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckClosestBody(com.badlogic.ashley.core.Entity cb) Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera nearvoidCalled 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.voidcopyParamsFrom(AbstractCamera other) floatGets the angle of the edge of the screen, diagonally.floatgetAngleEdge(int width, int height, float angle) 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 cameradoubleGets the distance from the camera to the centre of our reference frame (Sun)getDPos()doublegetFar()floatdoublegetNear()getPos()com.badlogic.gdx.math.Matrix4com.badlogic.gdx.math.Matrix4getShift()doubledoublebooleanCheck whether the camera is currently rotating around the (possible) focus object.booleanbooleanbooleanisVisible(com.badlogic.ashley.core.Entity 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 allvoidvoidprotected voidsetFrustumPlanes(com.badlogic.gdx.graphics.PerspectiveCamera cam) voidsetGamepadInput(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 pos) voidsetPreviousProjView(com.badlogic.gdx.math.Matrix4 mat) voidvoidvoidupdateAngleEdge(int width, int height) protected voidUpdate the FOV factor using the reference FOV.voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ICamera
doneLoading, getCamera, getDirection, getDirections, getFocus, getFrontCameras, getMode, getNCameras, getSpeed, getUp, hasFocus, isFocus, resize, setCamera, setDirection, speedScaling, update, updateModeModifier and TypeMethodDescriptionvoiddoneLoading(com.badlogic.gdx.assets.AssetManager manager) Loading is finished, gather resources.com.badlogic.gdx.graphics.PerspectiveCameraReturns the perspective camera.Vector3D[]getFocus()Returns the focus if any.com.badlogic.gdx.graphics.PerspectiveCamera[]getMode()intdoublegetSpeed()Gets the current velocity of the camera in km/h.getUp()booleanhasFocus()Checks whether the current camera has a focus set.booleanisFocus(com.badlogic.ashley.core.Entity entity) Checks if the given entity is the current focus.voidresize(int width, int height) voidsetCamera(com.badlogic.gdx.graphics.PerspectiveCamera perspectiveCamera) Sets the active cameravoidsetDirection(Vector3D dir) doublevoidupdate(double dt, ITimeFrameProvider time) Updates the camera.voidupdateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode newMode, boolean centerFocus)
-
Field Details
-
logger
-
CAM_NEAR
public double CAM_NEARCamera near value. -
CAM_FAR
public double CAM_FARCamera far value. -
pos
-
posInv
-
prevPos
-
dPos
-
tmp
-
shift
-
camera
public com.badlogic.gdx.graphics.PerspectiveCamera cameraThe main camera. -
fovFactor
public float fovFactor -
angleEdgeRad
protected float angleEdgeRadAngle from the center to the corner of the screen in scene coordinates, in radians. -
ar
protected float arAspect ratio. -
distance
protected double distanceDistance of camera to center. -
parent
The parent. -
camLeft
protected com.badlogic.gdx.graphics.PerspectiveCamera camLeftStereoscopic mode cameras. -
camRight
protected com.badlogic.gdx.graphics.PerspectiveCamera camRightStereoscopic mode cameras. -
cameras
protected com.badlogic.gdx.graphics.PerspectiveCamera[] camerasVector with all perspective cameras. -
closestBody
Closest non-star body to the camera. -
closestStar
The closest particle to the camera. -
closestStarView
-
proximity
-
prevCombined
protected com.badlogic.gdx.math.Matrix4 prevCombined -
closest
The closest betweenclosestBodyandclosestStar. -
gamepadInput
protected boolean gamepadInputThe last input event was by a gamepad.
-
-
Constructor Details
-
AbstractCamera
-
-
Method Details
-
updateAngleEdge
public void updateAngleEdge(int width, int height) - Specified by:
updateAngleEdgein interfaceICamera
-
getAngleEdge
public float getAngleEdge(int width, int height, float angle) -
updateFovFactor
protected void updateFovFactor()Update the FOV factor using the reference FOV. -
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
-
setDPos
-
setDPos
-
getDPos
-
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
- Specified by:
getManagerin interfaceICamera
-
render
-
getCurrent
- Specified by:
getCurrentin interfaceICamera
-
isVisible
-
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
-
copyParamsFrom
-
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
-
getShift
-
setShift
-
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:
cb- The body to check
-
checkClosestBody
public void checkClosestBody(com.badlogic.ashley.core.Entity 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
- Specified by:
getClosestBodyin interfaceICamera
-
getSecondClosestBody
- Specified by:
getSecondClosestBodyin interfaceICamera
-
getClosestParticle
Description copied from interface:ICameraGets the current closest particle to this camera- Specified by:
getClosestParticlein interfaceICamera- Returns:
- The closest particle
-
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?)
-
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:
star- The candidate particle
-
swapBuffers
public void swapBuffers()- Specified by:
swapBuffersin interfaceICamera
-
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
-
getVelocity
- Specified by:
getVelocityin interfaceICamera
-
updateFrustumPlanes
public void updateFrustumPlanes()- Specified by:
updateFrustumPlanesin interfaceICamera
-
setFrustumPlanes
protected void setFrustumPlanes(com.badlogic.gdx.graphics.PerspectiveCamera cam) -
getNear
-
getFar
-
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
-
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
-
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.
-