Package gaiasky.scene.camera
Class FovCamera
java.lang.Object
gaiasky.scene.camera.AbstractCamera
gaiasky.scene.camera.FovCamera
-
Field Summary
Modifier and TypeFieldDescriptionlong
Vector3d[]
int
long
float
long
time that has to pass with the current scan rate so that we scan to the edge of the current field of view.Fields inherited from class gaiasky.scene.camera.AbstractCamera
angleEdgeRad, ar, CAM_FAR, CAM_NEAR, camera, cameras, camLeft, camRight, closest, closestBody, closestStar, closestStarView, combined, distance, fovFactor, frustumd, gamepadInput, logger, parent, pos, posinv, prevCombined, prevpos, projection, proximity, shift, tmp, view
-
Constructor Summary
ConstructorDescriptionFovCamera
(com.badlogic.gdx.assets.AssetManager assetManager, CameraManager parent, com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch) -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.graphics.PerspectiveCamera
Returns the perspective camera.final Vector3d[]
Vector3d[]
getFocus()
Returns the focus if any.float
com.badlogic.gdx.graphics.PerspectiveCamera[]
getMode()
int
double
getSpeed()
Gets the current velocity of the camera in km/h.getUp()
boolean
hasFocus()
Checks whether the current camera has a focus set.void
initialize
(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch) boolean
isFocus
(com.badlogic.ashley.core.Entity entity) Checks if the given entity is the current focus.boolean
isVisible
(com.badlogic.ashley.core.Entity cb) void
Event notification call.void
render
(int rw, int rh) void
resize
(int width, int height) void
setCamera
(com.badlogic.gdx.graphics.PerspectiveCamera perspectiveCamera) Sets the active cameravoid
setDirection
(Vector3d dir) double
void
update
(double dt, ITimeFrameProvider time) Updates the camera.void
updateAngleEdge
(int width, int height) We have fixed field of view angles and thus fixed aspect ratio.void
Updates both FOVs' directions applying the right transformation.void
updateMode
(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode newMode, boolean centerFocus, boolean postEvent) Methods inherited from class gaiasky.scene.camera.AbstractCamera
checkClosestBody, checkClosestBody, checkClosestParticle, computeVisibleFovs, copyParamsFrom, getAngleEdge, getAngleEdge, getCameraStereoLeft, getCameraStereoRight, getCloseLightSource, getClosest, getClosestBody, getClosestParticle, getCurrent, getDistance, getFar, getInversePos, getManager, getNear, getPos, getPreviousPos, getPreviousProjView, getProjView, getSecondClosestBody, getShift, getVelocity, isVisible, isVisible, setCameraStereoLeft, setCameraStereoRight, setClosest, setFrustumPlanes, setGamepadInput, setPos, setPos, setPreviousPos, setPreviousPos, setPreviousProjView, setShift, swapBuffers, update, updateFrustumPlanes
-
Field Details
-
MAX_OVERLAP_TIME
public long MAX_OVERLAP_TIMEtime that has to pass with the current scan rate so that we scan to the edge of the current field of view. -
MAX_OVERLAP_ANGLE
public float MAX_OVERLAP_ANGLE -
directions
-
interpolatedDirections
-
currentTime
public long currentTime -
lastTime
public long lastTime -
dirIndex
public int dirIndex
-
-
Constructor Details
-
FovCamera
public FovCamera(com.badlogic.gdx.assets.AssetManager assetManager, CameraManager parent, com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch)
-
-
Method Details
-
initialize
public void initialize(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch) -
update
Description copied from interface:ICamera
Updates the camera. -
updateDirections
Updates both FOVs' directions applying the right transformation.- Parameters:
time
- The time frame provider.
-
getDirections
-
getFrontCameras
public com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras()- Specified by:
getFrontCameras
in interfaceICamera
-
getCamera
public com.badlogic.gdx.graphics.PerspectiveCamera getCamera()Description copied from interface:ICamera
Returns the perspective camera. -
setCamera
public void setCamera(com.badlogic.gdx.graphics.PerspectiveCamera perspectiveCamera) Description copied from interface:ICamera
Sets the active camera -
getFovFactor
public float getFovFactor()- Specified by:
getFovFactor
in interfaceICamera
- Overrides:
getFovFactor
in classAbstractCamera
-
getDirection
- Specified by:
getDirection
in interfaceICamera
-
setDirection
- Specified by:
setDirection
in interfaceICamera
-
getUp
-
getDirections
- Specified by:
getDirections
in interfaceICamera
-
notify
Description copied from interface:IObserver
Event notification call. -
updateMode
public void updateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode newMode, boolean centerFocus, boolean postEvent) - Specified by:
updateMode
in interfaceICamera
-
getNCameras
public int getNCameras()- Specified by:
getNCameras
in interfaceICamera
-
getMode
-
updateAngleEdge
public void updateAngleEdge(int width, int height) We have fixed field of view angles and thus fixed aspect ratio.- Specified by:
updateAngleEdge
in interfaceICamera
- Overrides:
updateAngleEdge
in classAbstractCamera
-
render
public void render(int rw, int rh) - Specified by:
render
in interfaceICamera
- Overrides:
render
in classAbstractCamera
-
getSpeed
public double getSpeed()Description copied from interface:ICamera
Gets the current velocity of the camera in km/h. -
isFocus
public boolean isFocus(com.badlogic.ashley.core.Entity entity) Description copied from interface:ICamera
Checks if the given entity is the current focus. -
getFocus
Description copied from interface:ICamera
Returns the focus if any. -
hasFocus
public boolean hasFocus()Description copied from interface:ICamera
Checks whether the current camera has a focus set. -
isVisible
public boolean isVisible(com.badlogic.ashley.core.Entity cb) - Specified by:
isVisible
in interfaceICamera
- Overrides:
isVisible
in classAbstractCamera
-
resize
public void resize(int width, int height) -
getFrustum2
-
speedScaling
public double speedScaling()- Specified by:
speedScaling
in interfaceICamera
-