Package gaiasky.scene.camera
Interface ICamera
- All Known Implementing Classes:
AbstractCamera
,CameraManager
,NaturalCamera
,RelativisticCamera
,SpacecraftCamera
public interface ICamera
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkClosestBody
(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 nearvoid
checkClosestBody
(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 nearvoid
checkClosestParticle
(IFocus particle) Sets the current closest particle to this camera.float
Gets the angle of the edge of the screen, diagonally.com.badlogic.gdx.graphics.PerspectiveCamera
Returns the perspective camera.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 cameraVector3d[]
double
Gets the distance from the camera to the centre of our reference frame (Sun)double
getFar()
getFocus()
Returns the focus if any.float
com.badlogic.gdx.graphics.PerspectiveCamera[]
getMode()
int
double
getNear()
getPos()
com.badlogic.gdx.math.Matrix4
com.badlogic.gdx.math.Matrix4
getShift()
double
getSpeed()
Gets the current velocity of the camera in km/h.getUp()
boolean
hasFocus()
Checks whether the current camera has a focus set.boolean
isFocus
(com.badlogic.ashley.core.Entity entity) Checks if the given entity is the current focus.boolean
boolean
isVisible
(com.badlogic.ashley.core.Entity cb) void
render
(int rw, int rh) void
resize
(int width, int height) void
setCamera
(com.badlogic.gdx.graphics.PerspectiveCamera perspectiveCamera) Sets the active cameravoid
setCameraStereoLeft
(com.badlogic.gdx.graphics.PerspectiveCamera cam) void
setCameraStereoRight
(com.badlogic.gdx.graphics.PerspectiveCamera cam) void
setClosest
(IFocus focus) Sets the closest of allvoid
setDirection
(Vector3d dir) 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 pos) void
setPreviousProjView
(com.badlogic.gdx.math.Matrix4 mat) void
double
void
void
update
(double dt, ITimeFrameProvider time) Updates the camera.void
updateAngleEdge
(int width, int height) void
void
updateMode
(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode newMode, boolean centerFocus, boolean postEvent)
-
Method Details
-
getCamera
com.badlogic.gdx.graphics.PerspectiveCamera getCamera()Returns the perspective camera.- Returns:
- The perspective camera.
-
setCamera
void setCamera(com.badlogic.gdx.graphics.PerspectiveCamera perspectiveCamera) Sets the active camera- Parameters:
perspectiveCamera
- The perspective camera.
-
getCameraStereoLeft
com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft() -
setCameraStereoLeft
void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam) -
getCameraStereoRight
com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight() -
setCameraStereoRight
void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam) -
getFrontCameras
com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras() -
getCurrent
ICamera getCurrent() -
getFovFactor
float getFovFactor() -
getPos
Vector3b getPos() -
setPos
-
setPos
-
getPreviousPos
Vector3b getPreviousPos() -
setPreviousPos
-
setPreviousPos
-
getInversePos
Vector3b getInversePos() -
getDirection
Vector3d getDirection() -
setDirection
-
getVelocity
Vector3d getVelocity() -
getUp
Vector3d getUp() -
getDirections
Vector3d[] getDirections() -
getNCameras
int getNCameras() -
speedScaling
double speedScaling() -
getShift
Vector3d getShift() -
setShift
-
getProjView
com.badlogic.gdx.math.Matrix4 getProjView() -
getPreviousProjView
com.badlogic.gdx.math.Matrix4 getPreviousProjView() -
setPreviousProjView
void setPreviousProjView(com.badlogic.gdx.math.Matrix4 mat) -
update
Updates the camera.- Parameters:
dt
- The time since the las frame in seconds.time
- The frame time provider (simulation time).
-
updateMode
void updateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode newMode, boolean centerFocus, boolean postEvent) -
getMode
CameraManager.CameraMode getMode() -
updateAngleEdge
void updateAngleEdge(int width, int height) -
getAngleEdge
float getAngleEdge()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.- Returns:
- The angle in radians.
-
getManager
CameraManager getManager() -
render
void render(int rw, int rh) -
getSpeed
double getSpeed()Gets the current velocity of the camera in km/h.- Returns:
- The velocity in km/h.
-
getDistance
double getDistance()Gets the distance from the camera to the centre of our reference frame (Sun)- Returns:
- The distance
-
getFocus
IFocus getFocus()Returns the focus if any.- Returns:
- The focus object if it is in focus mode. Null otherwise.
-
hasFocus
boolean hasFocus()Checks whether the current camera has a focus set.- Returns:
- True if the camera has a focus.
-
isFocus
boolean isFocus(com.badlogic.ashley.core.Entity entity) Checks if the given entity is the current focus.- Parameters:
entity
- The entity.- Returns:
- Whether the entity is focus.
-
checkClosestBody
Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera near- Parameters:
focus
- The body to check
-
checkClosestBody
void checkClosestBody(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 near- Parameters:
entity
- The body to check.
-
getClosestBody
IFocus getClosestBody() -
getSecondClosestBody
IFocus getSecondClosestBody() -
isVisible
boolean isVisible(com.badlogic.ashley.core.Entity cb) -
isVisible
-
resize
void resize(int width, int height) -
getClosestParticle
IFocus getClosestParticle()Gets the current closest particle to this camera- Returns:
- The closest particle
-
getCloseLightSource
Gets the current i-close light source to this camera- Returns:
- The i close light source (star?)
-
checkClosestParticle
Sets the current closest particle to this camera. This will be only set if the given particle is closer than the current.- Parameters:
particle
- The candidate particle
-
getClosest
IFocus getClosest()Returns the current closest object -
setClosest
Sets the closest of all- Parameters:
focus
- The new closest object
-
updateFrustumPlanes
void updateFrustumPlanes() -
getNear
double getNear() -
getFar
double getFar() -
swapBuffers
void swapBuffers() -
setGamepadInput
void setGamepadInput(boolean state) Main input mode is a gamepad. -
setPointerProjectionOnFocus
void setPointerProjectionOnFocus(com.badlogic.gdx.math.Vector3 point) 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.- Parameters:
point
- The Cartesian coordinates of the pointer on the sphere representing the focus object.
-