Package gaiasky.scenegraph.camera
Class SpacecraftCamera
java.lang.Object
gaiasky.scenegraph.camera.AbstractCamera
gaiasky.scenegraph.camera.SpacecraftCamera
Implements a spacecraft-like movement. The spacecraft is modeled as a rigid
solid and it has a mass and an engine model. The rest is physics
-
Field Summary
Modifier and TypeFieldDescriptionDirection and up vectorsDirection and up vectorsFields inherited from class gaiasky.scenegraph.camera.AbstractCamera
angleEdgeRad, ar, CAM_FAR, CAM_NEAR, camera, cameras, camLeft, camRight, closest, closestBody, closestStar, combined, distance, fovFactor, frustumd, logger, parent, pos, posinv, prevCombined, prevpos, projection, proximity, shift, tmp, view
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkClosestBody(IFocus cb)
Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera nearcom.badlogic.gdx.graphics.PerspectiveCamera
Returns the perspective camera.Vector3d[]
getFocus()
Returns the foucs if anycom.badlogic.gdx.graphics.PerspectiveCamera[]
getMode()
int
double
getSpeed()
Gets the current velocity of the camera in km/h.getUp()
boolean
Checks if this body is the current focusvoid
void
render(int rw, int rh)
void
resize(int width, int height)
void
setCamera(com.badlogic.gdx.graphics.PerspectiveCamera cam)
Sets the active cameravoid
setDirection(Vector3d dir)
double
void
update(double dt, ITimeFrameProvider time)
Updates the camera.void
updateHard(double dt)
Updates the position and direction of the camera using a hard analytical algorithm.void
updateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode mode, boolean centerFocus, boolean postEvent)
protected void
Methods inherited from class gaiasky.scenegraph.camera.AbstractCamera
checkClosestParticle, computeVisibleFovs, copyParamsFrom, getAngleEdge, getAngleEdge, getCameraStereoLeft, getCameraStereoRight, getCloseLightSource, getClosest, getClosestBody, getClosestParticle, getCurrent, getDistance, getFar, getFovFactor, getInversePos, getManager, getNear, getPos, getPreviousPos, getPreviousProjView, getProjView, getShift, isVisible, isVisible, isVisible, setCameraStereoLeft, setCameraStereoRight, setClosest, setFrustumPlanes, setPos, setPos, setPreviousPos, setPreviousPos, setPreviousProjView, setShift, swapBuffers, update, updateAngleEdge, updateFrustumPlanes
-
Field Details
-
direction
Direction and up vectors -
up
Direction and up vectors -
relpos
-
-
Constructor Details
-
SpacecraftCamera
-
-
Method Details
-
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 cam)Description copied from interface:ICamera
Sets the active camera -
getFrontCameras
public com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras()- Specified by:
getFrontCameras
in interfaceICamera
-
getDirection
- Specified by:
getDirection
in interfaceICamera
-
setDirection
- Specified by:
setDirection
in interfaceICamera
-
getUp
-
getDirections
- Specified by:
getDirections
in interfaceICamera
-
getNCameras
public int getNCameras()- Specified by:
getNCameras
in interfaceICamera
-
update
Description copied from interface:ICamera
Updates the camera. -
updateHard
public void updateHard(double dt)Updates the position and direction of the camera using a hard analytical algorithm. -
updatePerspectiveCamera
protected void updatePerspectiveCamera() -
updateMode
public void updateMode(ICamera previousCam, CameraManager.CameraMode previousMode, CameraManager.CameraMode mode, boolean centerFocus, boolean postEvent)- Specified by:
updateMode
in interfaceICamera
-
getMode
-
getSpeed
public double getSpeed()Description copied from interface:ICamera
Gets the current velocity of the camera in km/h. -
getFocus
Description copied from interface:ICamera
Returns the foucs if any -
isFocus
Description copied from interface:ICamera
Checks if this body is the current focus -
notify
-
render
public void render(int rw, int rh)- Specified by:
render
in interfaceICamera
- Overrides:
render
in classAbstractCamera
-
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
- Overrides:
checkClosestBody
in classAbstractCamera
- Parameters:
cb
- The body to check
-
getSecondClosestBody
- Specified by:
getSecondClosestBody
in interfaceICamera
- Overrides:
getSecondClosestBody
in classAbstractCamera
-
resize
public void resize(int width, int height) -
getVelocity
- Specified by:
getVelocity
in interfaceICamera
- Overrides:
getVelocity
in classAbstractCamera
-
speedScaling
public double speedScaling()- Specified by:
speedScaling
in interfaceICamera
-