Package gaiasky.scene.camera
Class AbstractCamera
java.lang.Object
gaiasky.scene.camera.AbstractCamera
- All Implemented Interfaces:
ICamera
- Direct Known Subclasses:
FovCamera,NaturalCamera,RelativisticCamera,SpacecraftCamera
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatAngle from the center to the corner of the screen in scene coordinates, in radiansprotected floatAspect ratiodoubleCamera far valuedoubleCamera near valuecom.badlogic.gdx.graphics.PerspectiveCameraThe main cameraprotected com.badlogic.gdx.graphics.PerspectiveCamera[]Vector with all perspective camerasprotected com.badlogic.gdx.graphics.PerspectiveCameraStereoscopic mode camerasprotected com.badlogic.gdx.graphics.PerspectiveCameraStereoscopic mode camerasprotected IFocusThe closest betweenclosestBodyandclosestStarprotected FocusViewClosest non-star body to the cameraprotected IFocusThe closest particle to the cameraprotected FocusViewprotected Matrix4dprotected doubleDistance of camera to centerfloatprotected Frustumdprotected booleanThe last input event was by a gamepad.protected static final Logger.Logprotected CameraManagerThe parentprotected com.badlogic.gdx.math.Matrix4protected Matrix4dprotected Proximityprotected Matrix4d -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckClosestBody(com.badlogic.ashley.core.Entity cb) Called after updating the body's distance to the cam, it updates the closest body in the camera to figure out the camera nearvoidCalled 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(com.badlogic.ashley.core.Entity cb, FovCamera fCamera) Returns true if a body with the given position is observed in any of the given directions using the given cone angle.voidcopyParamsFrom(AbstractCamera other) floatGets the angle of the edge of the screen, diagonally.floatgetAngleEdge(int width, int height, float angle) com.badlogic.gdx.graphics.PerspectiveCameracom.badlogic.gdx.graphics.PerspectiveCameragetCloseLightSource(int i) Gets the current i-close light source to this cameraReturns the current closest objectGets the current closest particle to this cameradoubleGets the distance from the camera to the centre of our reference frame (Sun)doublegetFar()floatdoublegetNear()getPos()com.badlogic.gdx.math.Matrix4com.badlogic.gdx.math.Matrix4getShift()booleanbooleanbooleanisVisible(com.badlogic.ashley.core.Entity cb) 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) voidsetGamepadInput(boolean state) Main input mode is a gamepad.voidvoidvoidsetPreviousPos(Vector3b pos) voidsetPreviousPos(Vector3d prevpos) voidsetPreviousProjView(com.badlogic.gdx.math.Matrix4 mat) voidvoidvoidupdate(com.badlogic.gdx.graphics.PerspectiveCamera cam, Vector3d position, Vector3d direction, Vector3d up) voidupdateAngleEdge(int width, int height) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gaiasky.scene.camera.ICamera
getCamera, getDirection, getDirections, getFocus, getFrontCameras, getMode, getNCameras, getSpeed, getUp, hasFocus, 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
-
tmp
-
shift
-
camera
public com.badlogic.gdx.graphics.PerspectiveCamera cameraThe main camera -
fovFactor
public float fovFactor -
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 -
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
-
closestBody
Closest non-star body to the camera -
closestStar
The closest particle to the camera -
closestStarView
-
proximity
-
prevCombined
protected com.badlogic.gdx.math.Matrix4 prevCombined -
closest
The closest betweenclosestBodyandclosestStar -
gamepadInput
protected boolean gamepadInputThe last input event was by a gamepad.
-
-
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
-
setPos
-
getPreviousPos
- Specified by:
getPreviousPosin interfaceICamera
-
setPreviousPos
- Specified by:
setPreviousPosin 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
public boolean isVisible(com.badlogic.ashley.core.Entity cb) -
isVisible
-
isVisible
-
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
-
setCameraStereoLeft
public void setCameraStereoLeft(com.badlogic.gdx.graphics.PerspectiveCamera cam) - Specified by:
setCameraStereoLeftin interfaceICamera
-
getCameraStereoRight
public com.badlogic.gdx.graphics.PerspectiveCamera getCameraStereoRight()- Specified by:
getCameraStereoRightin interfaceICamera
-
setCameraStereoRight
public void setCameraStereoRight(com.badlogic.gdx.graphics.PerspectiveCamera cam) - Specified by:
setCameraStereoRightin interfaceICamera
-
getShift
-
setShift
-
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
-
checkClosestBody
public void checkClosestBody(com.badlogic.ashley.core.Entity 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- 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
-
getCloseLightSource
Description copied from interface:ICameraGets the current i-close light source to this camera- Specified by:
getCloseLightSourcein interfaceICamera- Returns:
- The i close light source (star?)
-
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
-
swapBuffers
public void swapBuffers()- Specified by:
swapBuffersin interfaceICamera
-
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
-
setGamepadInput
public void setGamepadInput(boolean state) Description copied from interface:ICameraMain input mode is a gamepad.- Specified by:
setGamepadInputin interfaceICamera
-