Package gaiasky.scenegraph.camera
Class SpacecraftCamera
- java.lang.Object
-
- gaiasky.scenegraph.camera.AbstractCamera
-
- gaiasky.scenegraph.camera.SpacecraftCamera
-
public class SpacecraftCamera extends AbstractCamera implements IObserver
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
Fields Modifier and Type Field Description Vector3ddirectionDirection and up vectorsVector3drelposDirection and up vectorsVector3dupDirection and up vectors-
Fields 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, shift, tmp, view
-
-
Constructor Summary
Constructors Constructor Description SpacecraftCamera(CameraManager parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckClosestBody(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 neardoubleconvertAngle(double angle)com.badlogic.gdx.graphics.PerspectiveCameragetCamera()Returns the perspective camera.Vector3dgetDirection()Vector3d[]getDirections()IFocusgetFocus()Returns the foucs if anycom.badlogic.gdx.graphics.PerspectiveCamera[]getFrontCameras()CameraManager.CameraModegetMode()intgetNCameras()IFocusgetSecondClosestBody()doublegetSpeed()Gets the current velocity of the camera in km/h.doublegetTranslateUnits()Vector3dgetUp()Vector3dgetVelocity()booleanisFocus(IFocus cb)Checks if this body is the current focusvoidnotify(Events event, java.lang.Object... data)voidrender(int rw, int rh)voidresize(int width, int height)voidsetCamera(com.badlogic.gdx.graphics.PerspectiveCamera cam)Sets the active cameravoidsetDirection(Vector3d dir)voidupdate(double dt, ITimeFrameProvider time)Updates the camera.voidupdateHard(double dt, ITimeFrameProvider time)Updates the position and direction of the camera using a hard analytical algorithm.voidupdateMode(CameraManager.CameraMode mode, boolean centerFocus, boolean postEvent)protected voidupdatePerspectiveCamera()-
Methods inherited from class gaiasky.scenegraph.camera.AbstractCamera
checkClosestParticle, computeGaiaScan, computeVisibleFovs, copyParamsFrom, getAngleEdge, getAngleEdge, getCameraStereoLeft, getCameraStereoRight, getClosest, getClosestBody, getClosestParticle, getCurrent, getDistance, getFar, getFovFactor, getInversePos, getManager, getNear, getPos, getPreviousPos, getPreviousProjView, getProjView, getShift, isVisible, isVisible, setCameraStereoLeft, setCameraStereoRight, setClosest, setFrustumPlanes, setPos, setPreviousPos, setPreviousProjView, setShift, update, updateAngleEdge, updateFrustumPlanes
-
-
-
-
Constructor Detail
-
SpacecraftCamera
public SpacecraftCamera(CameraManager parent)
-
-
Method Detail
-
getCamera
public com.badlogic.gdx.graphics.PerspectiveCamera getCamera()
Description copied from interface:ICameraReturns the perspective camera.
-
setCamera
public void setCamera(com.badlogic.gdx.graphics.PerspectiveCamera cam)
Description copied from interface:ICameraSets the active camera
-
getFrontCameras
public com.badlogic.gdx.graphics.PerspectiveCamera[] getFrontCameras()
- Specified by:
getFrontCamerasin interfaceICamera
-
getDirection
public Vector3d getDirection()
- Specified by:
getDirectionin interfaceICamera
-
setDirection
public void setDirection(Vector3d dir)
- Specified by:
setDirectionin interfaceICamera
-
getDirections
public Vector3d[] getDirections()
- Specified by:
getDirectionsin interfaceICamera
-
getNCameras
public int getNCameras()
- Specified by:
getNCamerasin interfaceICamera
-
update
public void update(double dt, ITimeFrameProvider time)Description copied from interface:ICameraUpdates the camera.
-
updateHard
public void updateHard(double dt, ITimeFrameProvider time)Updates the position and direction of the camera using a hard analytical algorithm.- Parameters:
dt-time-
-
convertAngle
public double convertAngle(double angle)
-
updatePerspectiveCamera
protected void updatePerspectiveCamera()
-
updateMode
public void updateMode(CameraManager.CameraMode mode, boolean centerFocus, boolean postEvent)
- Specified by:
updateModein interfaceICamera
-
getMode
public CameraManager.CameraMode getMode()
-
getSpeed
public double getSpeed()
Description copied from interface:ICameraGets the current velocity of the camera in km/h.
-
getFocus
public IFocus getFocus()
Description copied from interface:ICameraReturns the foucs if any
-
isFocus
public boolean isFocus(IFocus cb)
Description copied from interface:ICameraChecks if this body is the current focus
-
notify
public void notify(Events event, java.lang.Object... data)
-
render
public void render(int rw, int rh)- Specified by:
renderin interfaceICamera- Overrides:
renderin classAbstractCamera
-
checkClosestBody
public void checkClosestBody(IFocus 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- Overrides:
checkClosestBodyin classAbstractCamera- Parameters:
cb- The body to check
-
getSecondClosestBody
public IFocus getSecondClosestBody()
- Specified by:
getSecondClosestBodyin interfaceICamera- Overrides:
getSecondClosestBodyin classAbstractCamera
-
getVelocity
public Vector3d getVelocity()
- Specified by:
getVelocityin interfaceICamera- Overrides:
getVelocityin classAbstractCamera
-
getTranslateUnits
public double getTranslateUnits()
- Specified by:
getTranslateUnitsin interfaceICamera
-
-