Package gaiasky.scenegraph.camera
Class AbstractCamera
java.lang.Object
gaiasky.scenegraph.camera.AbstractCamera
- All Implemented Interfaces:
ICamera
- Direct Known Subclasses:
FovCamera,NaturalCamera,RelativisticCamera,SpacecraftCamera
public abstract class AbstractCamera extends java.lang.Object implements ICamera
-
Field Summary
Fields Modifier and Type Field Description protected floatangleEdgeRadAngle from the center to the corner of the screen in scene coordinates, in radiansprotected floatarAspect ratiodoubleCAM_FARCamera far valuedoubleCAM_NEARCamera near valuecom.badlogic.gdx.graphics.PerspectiveCameracameraThe main cameraprotected com.badlogic.gdx.graphics.PerspectiveCamera[]camerasVector with all perspective camerasprotected com.badlogic.gdx.graphics.PerspectiveCameracamLeftStereoscopic mode camerasprotected com.badlogic.gdx.graphics.PerspectiveCameracamRightStereoscopic mode camerasprotected IFocusclosestThe closest betweenclosestBodyandclosestStarprotected IFocusclosestBodyClosest non-star body to the cameraprotected IFocusclosestStarThe closest particle to the cameraprotected Matrix4dcombinedprotected doubledistanceDistance of camera to centerfloatfovFactorprotected Frustumdfrustumdprotected static Logger.Logloggerprotected CameraManagerparentThe parentVector3dposVector3dposinvprotected com.badlogic.gdx.math.Matrix4prevCombinedVector3dprevposprotected Matrix4dprojectionVector3dshiftVector3dtmpprotected Matrix4dview -
Constructor Summary
Constructors Constructor Description AbstractCamera(CameraManager parent) -
Method Summary
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 nearvoidcheckClosestParticle(IFocus star)Sets the current closest particle to this camera.protected booleancomputeVisibleFovs(CelestialBody cb, FovCamera fcamera)Returns true if a body with the given position is observed in any of the given directions using the given cone anglevoidcopyParamsFrom(AbstractCamera other)floatgetAngleEdge()Gets the angle of the edge of the screen, diagonally.floatgetAngleEdge(int width, int height, float angle)com.badlogic.gdx.graphics.PerspectiveCameragetCameraStereoLeft()com.badlogic.gdx.graphics.PerspectiveCameragetCameraStereoRight()IFocusgetClosest()Returns the current closest objectIFocusgetClosestBody()IFocusgetClosestParticle()Gets the current closest particle to this cameraICameragetCurrent()doublegetDistance()Gets the distance from the camera to the centre of our reference frame (Sun)doublegetFar()floatgetFovFactor()Vector3dgetInversePos()CameraManagergetManager()doublegetNear()Vector3dgetPos()Vector3dgetPreviousPos()com.badlogic.gdx.math.Matrix4getPreviousProjView()com.badlogic.gdx.math.Matrix4getProjView()IFocusgetSecondClosestBody()Vector3dgetShift()Vector3dgetVelocity()booleanisVisible(ITimeFrameProvider time, double viewAngle, Vector3d pos, double distToCamera)booleanisVisible(ITimeFrameProvider time, CelestialBody cb)booleanisVisible(ITimeFrameProvider time, Vector3d pos)voidrender(int rw, int rh)voidsetCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetClosest(IFocus focus)Sets the closest of allprotected voidsetFrustumPlanes(com.badlogic.gdx.graphics.PerspectiveCamera cam)voidsetPos(Vector3d pos)voidsetPreviousPos(Vector3d prevpos)voidsetPreviousProjView(com.badlogic.gdx.math.Matrix4 mat)voidsetShift(Vector3d shift)voidupdate(com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3d position, Vector3d direction, Vector3d up)voidupdateAngleEdge(int width, int height)voidupdateFrustumPlanes()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gaiasky.scenegraph.camera.ICamera
getCamera, getDirection, getDirections, getFocus, getFrontCameras, getMode, getNCameras, getSpeed, getUp, isFocus, resize, setCamera, setDirection, speedScaling, update, updateMode
-
Field Details
-
logger
-
CAM_FAR
public double CAM_FARCamera far value -
CAM_NEAR
public double CAM_NEARCamera near value -
pos
-
posinv
-
prevpos
-
shift
-
tmp
-
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 -
camera
public com.badlogic.gdx.graphics.PerspectiveCamera cameraThe main camera -
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 -
projection
-
view
-
combined
-
frustumd
-
fovFactor
public float fovFactor -
closestBody
Closest non-star body to the camera -
closestStar
The closest particle to the camera -
prevCombined
protected com.badlogic.gdx.math.Matrix4 prevCombined -
closest
The closest betweenclosestBodyandclosestStar
-
-
Constructor Details
-
AbstractCamera
-
-
Method Details
-
updateAngleEdge
public void updateAngleEdge(int width, int height)- Specified by:
updateAngleEdgein interfaceICamera
-
getAngleEdge
public float getAngleEdge(int width, int height, float angle) -
getFovFactor
public float getFovFactor()- Specified by:
getFovFactorin interfaceICamera
-
getPos
-
setPos
-
getPreviousPos
- Specified by:
getPreviousPosin interfaceICamera
-
setPreviousPos
- Specified by:
setPreviousPosin interfaceICamera
-
getInversePos
- Specified by:
getInversePosin interfaceICamera
-
getAngleEdge
public float getAngleEdge()Description copied from interface:ICameraGets 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:
getAngleEdgein interfaceICamera- Returns:
- The angle in radians.
-
getManager
- Specified by:
getManagerin interfaceICamera
-
render
public void render(int rw, int rh) -
getCurrent
- Specified by:
getCurrentin interfaceICamera
-
isVisible
-
isVisible
-
isVisible
public boolean isVisible(ITimeFrameProvider time, double viewAngle, Vector3d pos, double distToCamera) -
computeVisibleFovs
Returns true if a body with the given position is observed in any of the given directions using the given cone angle- Parameters:
cb- The body.fcamera- The FovCamera.- Returns:
- True if the body is observed. False otherwise.
-
getDistance
public double getDistance()Description copied from interface:ICameraGets the distance from the camera to the centre of our reference frame (Sun)- Specified by:
getDistancein interfaceICamera- Returns:
- The distance
-
copyParamsFrom
-
getCameraStereoLeft
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoLeft()- Specified by:
getCameraStereoLeftin interfaceICamera
-
getCameraStereoRight
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()- Specified by:
getCameraStereoRightin interfaceICamera
-
setCameraStereoLeft
public void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam)- Specified by:
setCameraStereoLeftin interfaceICamera
-
setCameraStereoRight
public void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam)- Specified by:
setCameraStereoRightin interfaceICamera
-
setShift
-
getShift
-
update
-
checkClosestBody
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- Parameters:
cb- The body to check
-
getClosestBody
- Specified by:
getClosestBodyin interfaceICamera
-
getSecondClosestBody
- Specified by:
getSecondClosestBodyin interfaceICamera
-
getClosestParticle
Description copied from interface:ICameraGets the current closest particle to this camera- Specified by:
getClosestParticlein interfaceICamera- Returns:
- The closest particle
-
checkClosestParticle
Description copied from interface:ICameraSets the current closest particle to this camera. This will be only set if the given particle is closer than the current.- Specified by:
checkClosestParticlein interfaceICamera- Parameters:
star- The candidate particle
-
getClosest
Description copied from interface:ICameraReturns the current closest object- Specified by:
getClosestin interfaceICamera
-
setClosest
Description copied from interface:ICameraSets the closest of all- Specified by:
setClosestin interfaceICamera- Parameters:
focus- The new closest object
-
getVelocity
- Specified by:
getVelocityin interfaceICamera
-
updateFrustumPlanes
public void updateFrustumPlanes()- Specified by:
updateFrustumPlanesin 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:
getProjViewin interfaceICamera
-
getPreviousProjView
public com.badlogic.gdx.math.Matrix4 getPreviousProjView()- Specified by:
getPreviousProjViewin interfaceICamera
-
setPreviousProjView
public void setPreviousProjView(com.badlogic.gdx.math.Matrix4 mat)- Specified by:
setPreviousProjViewin interfaceICamera
-