Package gaiasky.scene.camera
Class AbstractCamera
java.lang.Object
gaiasky.scene.camera.AbstractCamera
- All Implemented Interfaces:
ICamera
- Direct Known Subclasses:
NaturalCamera
,RelativisticCamera
,SpacecraftCamera
-
Field Summary
Modifier and TypeFieldDescriptionprotected float
Angle from the center to the corner of the screen in scene coordinates, in radians.protected float
Aspect ratio.double
Camera far value.double
Camera near value.com.badlogic.gdx.graphics.PerspectiveCamera
The main camera.protected com.badlogic.gdx.graphics.PerspectiveCamera[]
Vector with all perspective cameras.protected com.badlogic.gdx.graphics.PerspectiveCamera
Stereoscopic mode cameras.protected com.badlogic.gdx.graphics.PerspectiveCamera
Stereoscopic mode cameras.protected IFocus
The closest betweenclosestBody
andclosestStar
.protected FocusView
Closest non-star body to the camera.protected IFocus
The closest particle to the camera.protected FocusView
protected double
Distance of camera to center.float
protected boolean
The last input event was by a gamepad.protected static final Logger.Log
protected CameraManager
The parent.protected com.badlogic.gdx.math.Matrix4
protected Proximity
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkClosestBody
(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 nearvoid
Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera nearvoid
checkClosestParticle
(IFocus star) Sets the current closest particle to this camera.void
copyParamsFrom
(AbstractCamera other) float
Gets the angle of the edge of the screen, diagonally.float
getAngleEdge
(int width, int height, float angle) com.badlogic.gdx.graphics.PerspectiveCamera
com.badlogic.gdx.graphics.PerspectiveCamera
getCloseLightSource
(int i) Gets the current i-close light source to this cameraReturns the current closest objectGets the current closest particle to this cameradouble
Gets the distance from the camera to the centre of our reference frame (Sun)getDPos()
double
getFar()
float
double
getNear()
getPos()
com.badlogic.gdx.math.Matrix4
com.badlogic.gdx.math.Matrix4
getShift()
double
double
boolean
boolean
boolean
isVisible
(com.badlogic.ashley.core.Entity cb) void
render
(int rw, int rh) void
setCameraStereoLeft
(com.badlogic.gdx.graphics.PerspectiveCamera cam) void
setCameraStereoRight
(com.badlogic.gdx.graphics.PerspectiveCamera cam) void
setClosest
(IFocus focus) Sets the closest of allvoid
void
protected void
setFrustumPlanes
(com.badlogic.gdx.graphics.PerspectiveCamera cam) void
setGamepadInput
(boolean state) Main input mode is a gamepad.void
setPointerProjectionOnFocus
(com.badlogic.gdx.math.Vector3 point) Sets the current pointer coordinates, as projected on the current focus object.void
void
void
setPreviousPos
(Vector3b pos) void
setPreviousPos
(Vector3d prevpos) void
setPreviousProjView
(com.badlogic.gdx.math.Matrix4 mat) void
void
void
updateAngleEdge
(int width, int height) void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface gaiasky.scene.camera.ICamera
doneLoading, getCamera, getDirection, getDirections, getFocus, getFrontCameras, getMode, getNCameras, getSpeed, getUp, hasFocus, isFocus, resize, setCamera, setDirection, speedScaling, update, updateMode
-
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 betweenclosestBody
andclosestStar
. -
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:
updateAngleEdge
in interfaceICamera
-
getAngleEdge
public float getAngleEdge(int width, int height, float angle) -
getFovFactor
public float getFovFactor()- Specified by:
getFovFactor
in interfaceICamera
-
getPos
-
setPos
-
setPos
-
getPreviousPos
- Specified by:
getPreviousPos
in interfaceICamera
-
setPreviousPos
- Specified by:
setPreviousPos
in interfaceICamera
-
setPreviousPos
- Specified by:
setPreviousPos
in interfaceICamera
-
setDPos
-
setDPos
-
getDPos
-
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
- Specified by:
getManager
in interfaceICamera
-
render
public void render(int rw, int rh) -
getCurrent
- Specified by:
getCurrent
in interfaceICamera
-
isVisible
public boolean isVisible(com.badlogic.ashley.core.Entity cb) -
isVisible
-
isVisible
-
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
-
copyParamsFrom
-
getCameraStereoLeft
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft()- Specified by:
getCameraStereoLeft
in interfaceICamera
-
setCameraStereoLeft
public void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam) - Specified by:
setCameraStereoLeft
in interfaceICamera
-
getCameraStereoRight
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()- Specified by:
getCameraStereoRight
in interfaceICamera
-
setCameraStereoRight
public void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam) - Specified by:
setCameraStereoRight
in interfaceICamera
-
getShift
-
setShift
-
checkClosestBody
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:
checkClosestBody
in interfaceICamera
- Parameters:
cb
- The body to check
-
checkClosestBody
public void checkClosestBody(com.badlogic.ashley.core.Entity 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:
checkClosestBody
in interfaceICamera
- Parameters:
cb
- The body to check.
-
getClosestBody
- Specified by:
getClosestBody
in interfaceICamera
-
getSecondClosestBody
- Specified by:
getSecondClosestBody
in interfaceICamera
-
getClosestParticle
Description copied from interface:ICamera
Gets the current closest particle to this camera- Specified by:
getClosestParticle
in interfaceICamera
- Returns:
- The closest particle
-
getCloseLightSource
Description copied from interface:ICamera
Gets the current i-close light source to this camera- Specified by:
getCloseLightSource
in interfaceICamera
- Returns:
- The i close light source (star?)
-
checkClosestParticle
Description copied from interface:ICamera
Sets the current closest particle to this camera. This will be only set if the given particle is closer than the current.- Specified by:
checkClosestParticle
in interfaceICamera
- Parameters:
star
- The candidate particle
-
swapBuffers
public void swapBuffers()- Specified by:
swapBuffers
in interfaceICamera
-
getClosest
Description copied from interface:ICamera
Returns the current closest object- Specified by:
getClosest
in interfaceICamera
-
setClosest
Description copied from interface:ICamera
Sets the closest of all- Specified by:
setClosest
in interfaceICamera
- Parameters:
focus
- The new closest object
-
getVelocity
- Specified by:
getVelocity
in interfaceICamera
-
updateFrustumPlanes
public void updateFrustumPlanes()- Specified by:
updateFrustumPlanes
in interfaceICamera
-
setFrustumPlanes
protected void setFrustumPlanes(com.badlogic.gdx.graphics.PerspectiveCamera cam) -
getNear
public double getNear() -
getFar
public double getFar() -
getProjView
public com.badlogic.gdx.math.Matrix4 getProjView()- Specified by:
getProjView
in interfaceICamera
-
getPreviousProjView
public com.badlogic.gdx.math.Matrix4 getPreviousProjView()- Specified by:
getPreviousProjView
in interfaceICamera
-
setPreviousProjView
public void setPreviousProjView(com.badlogic.gdx.math.Matrix4 mat) - Specified by:
setPreviousProjView
in interfaceICamera
-
setGamepadInput
public void setGamepadInput(boolean state) Description copied from interface:ICamera
Main input mode is a gamepad.- Specified by:
setGamepadInput
in interfaceICamera
-
setPointerProjectionOnFocus
public void setPointerProjectionOnFocus(com.badlogic.gdx.math.Vector3 point) Description copied from interface:ICamera
Sets 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:
setPointerProjectionOnFocus
in interfaceICamera
- Parameters:
point
- The Cartesian coordinates of the pointer on the sphere representing the focus object.
-
getSpeedScaling
public double getSpeedScaling()- Specified by:
getSpeedScaling
in interfaceICamera
-
getSpeedScalingCapped
public double getSpeedScalingCapped()- Specified by:
getSpeedScalingCapped
in interfaceICamera
-