Class CelestialBody
- java.lang.Object
-
- gaia.cu9.ari.gaiaorbit.scenegraph.SceneGraphNode
-
- gaia.cu9.ari.gaiaorbit.scenegraph.AbstractPositionEntity
-
- gaia.cu9.ari.gaiaorbit.scenegraph.CelestialBody
-
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,I3DTextRenderable
,IModelRenderable
,IQuadRenderable
,IRenderable
,IFocus
,IStarContainer
,IPosition
public abstract class CelestialBody extends AbstractPositionEntity implements I3DTextRenderable, IQuadRenderable, IModelRenderable, IFocus
Represents any celestial body.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gaia.cu9.ari.gaiaorbit.scenegraph.SceneGraphNode
SceneGraphNode.RenderGroup, SceneGraphNode.TLV3, SceneGraphNode.TLV3D
-
-
Field Summary
Fields Modifier and Type Field Description float
absmag
Absolute magnitude, m = -2.5 log10(flux), with the flux at 10 pcfloat
appmag
Apparent magnitude, m = -2.5 log10(flux)float[]
ccPale
Red, green and blue colors and their revamped cousinsfloat[]
ccTransit
Colour for stars that have been observed by Gaiafloat
colorbv
The B-V color index, calculated as the magnitude in B minus the magnitude in Vfloat
compalpha
Component alpha mirrorprotected boolean
coordinatesTimeOverflow
Whether we are out of the time baseline range in the algorithm that works out the coordinates of this bodylong
lastTransitIncrease
Last observations increase in msRotationComponent
rc
Holds information about the rotation of the bodyfloat
TH_OVER_FACTOR
int
transits
Number of times this body has been observed by Gaia-
Fields inherited from class gaia.cu9.ari.gaiaorbit.scenegraph.AbstractPositionEntity
cc, coordinates, copy, distToCamera, octant, octantId, pos, posSph, size, viewAngle, viewAngleApparent
-
Fields inherited from class gaia.cu9.ari.gaiaorbit.scenegraph.SceneGraphNode
aux3d1, aux3d2, aux3d3, aux3d4, aux3f1, aux3f2, aux3f3, aux3f4, children, computed, ct, id, localTransform, name, namekey, numChildren, opacity, orientation, parent, parentkey, parentName, ROOT_NAME, sg, translation
-
-
Constructor Summary
Constructors Constructor Description CelestialBody()
Simple constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addFocusableObjects(com.badlogic.gdx.utils.Array<IFocus> list)
Adds all the children that are focusable objects to the list.void
addHit(int screenX, int screenY, int w, int h, int minPixDist, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits)
Adds this focus to the hits list if it is hit by the [screenX, screenY] positionprotected void
addToIndex(com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode> map)
Special actions to be taken for this object when adding to the index.protected boolean
checkClickDistance(int screenX, int screenY, com.badlogic.gdx.math.Vector3 pos, NaturalCamera camera, com.badlogic.gdx.graphics.PerspectiveCamera pcamera, double pixelSize)
protected boolean
checkHitCondition()
protected double
computeViewAngle(float fovFactor)
float
getAbsmag()
Gets the absolute magnitudejava.lang.String
getAltname()
float
getAppmag()
Gets the apparent magnitudelong
getCandidateId()
Returns the id of the focus candidate of this object.java.lang.String
getCandidateName()
Returns the name of the focus candidate of this object.double
getCandidateViewAngleApparent()
Returns the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radiansIFocus
getFocus(java.lang.String name)
Prepares the candidate with the given namefloat
getFuzzyRenderSize(ICamera camera)
abstract float
getInnerRad()
Quaterniond
getOrientationQuaternion()
Returns the orientation quaternion of this focusdouble
getPmX()
double
getPmY()
double
getPmZ()
RotationComponent
getRotationComponent()
Returns the rotation component of this focus<T extends SceneGraphNode>
TgetSimpleCopy()
Gets a copy of this object but does not copy its parent or childrenfloat
getTextOpacity()
Gets the text opacityprotected float
getThOverFactor(ICamera camera)
protected float
getThOverFactorScl()
double
getViewAngle()
Returns the current view angle of this entity, in radians.protected float
getViewAnglePow()
boolean
hasAtmosphere()
boolean
isActive()
Returns whether this focus object is active or not.boolean
isCoordinatesTimeOverflow()
Checks whether this foucs is within its valid time range, so that it can be used as a focusboolean
isLabel()
Is it a label or another kind of text?boolean
isStar()
boolean
isValidPosition()
Returns whether the current position is valid (usually, when there is no coordinates overflow)protected abstract float
labelFactor()
protected abstract float
labelMax()
protected float
labelSizeConcrete()
void
makeFocus()
Hook that runs when the candidate is actually made focusprotected void
removeFromIndex(com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode> map)
Special actions to be taken for this object when removing from the index.void
render(ExtSpriteBatch batch, ExtShaderProgram shader, FontRenderSystem sys, RenderingContext rc, ICamera camera)
Label rendering.void
render(ExtShaderProgram shader, float alpha, IntMesh mesh, ICamera camera)
Billboard quad render, for planets and stars.boolean
renderText()
Tells whether the text must be rendered or not for this entityvoid
setAbsmag(java.lang.Double absmag)
void
setAltname(java.lang.String altname)
void
setAppmag(java.lang.Double appmag)
protected void
setColor2Data()
void
setMag(java.lang.Double mag)
void
setRotation(RotationComponent rc)
Sets the rotation period in hoursvoid
setSize(java.lang.Double size)
Sets the size of this entity in kilometersjava.lang.String
text()
Returns the textfloat[]
textColour()
Returns an array with the text colour in the fashion [r, g, b, a]void
textDepthBuffer()
Executes the blending for the textvoid
textPosition(ICamera cam, Vector3d out)
Sets the position of this text in the out vectorfloat
textScale()
Returns the text scale for the scale varying in the shaderfloat
textSize()
Returns the text sizeabstract double
THRESHOLD_NONE()
radius/distance limit for rendering at all.abstract double
THRESHOLD_POINT()
radius/distance limit for rendering as point.abstract double
THRESHOLD_QUAD()
radius/distance limit for rendering as shader.protected boolean
timeCondition(ITimeFrameProvider time)
void
update(ITimeFrameProvider time, Vector3d parentTransform, ICamera camera)
Overrides the update adding the magnitude limit thingy.void
updateTransitNumber(boolean visible, ITimeFrameProvider time, FovCamera fcamera)
Updates the transit number of this body if visible is true and it is a new transit.boolean
withinMagLimit()
Returns true if the focus is within the magnitude limit defined inGlobalConf
-
Methods inherited from class gaia.cu9.ari.gaiaorbit.scenegraph.AbstractPositionEntity
addToRenderLists, computeFuturePosition, doneLoading, getAbsoluteOrientation, getAbsolutePosition, getAbsolutePosition, getAlpha, getDelta, getDistToCamera, getHeight, getHeight, getHeight, getHeightScale, getNext, getOctant, getPos, getPosition, getPosition, getPosSph, getPredictedPosition, getRadius, getSize, getViewAngleApparent, isCopy, mustUpdatePosition, render2DLabel, render2DLabel, render2DLabel, render2DLabel, render3DLabel, setColor, setColor, setCoordinates, setSize, updateLocal, updateLocalValues
-
Methods inherited from class gaia.cu9.ari.gaiaorbit.scenegraph.SceneGraphNode
add, add, addChild, addChild, addNodes, addToRender, dispose, getAggregatedChildren, getChildByName, getChildByNameAndType, getChildrenByType, getComponentType, getCt, getFirstStarAncestor, getId, getLineCopy, getName, getNode, getNode, getOpacity, getOrientation, getRoot, getSceneGraphDepth, getStarCount, getVelocity, initialize, insert, isInRender, isInRender, isVisibilityOn, mustAddToIndex, removeChild, removeFromRender, returnToPool, setComputedFlag, setCt, setCt, setId, setName, setNamekey, setParent, setParentkey, setUp, toString, update, updateNames, updateNamesRec
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gaia.cu9.ari.gaiaorbit.scenegraph.IFocus
getAbsolutePosition, getAbsolutePosition, getAlpha, getCt, getDelta, getDistToCamera, getFirstStarAncestor, getHeight, getHeight, getHeight, getHeightScale, getId, getName, getNext, getOctant, getOrientation, getPos, getPosSph, getPredictedPosition, getRadius, getSceneGraphDepth, getSize, getViewAngleApparent, isCopy
-
Methods inherited from interface gaia.cu9.ari.gaiaorbit.render.IModelRenderable
render
-
Methods inherited from interface gaia.cu9.ari.gaiaorbit.render.IRenderable
getComponentType, getDistToCamera, getOpacity
-
-
-
-
Field Detail
-
TH_OVER_FACTOR
public float TH_OVER_FACTOR
-
absmag
public float absmag
Absolute magnitude, m = -2.5 log10(flux), with the flux at 10 pc
-
appmag
public float appmag
Apparent magnitude, m = -2.5 log10(flux)
-
ccPale
public float[] ccPale
Red, green and blue colors and their revamped cousins
-
ccTransit
public float[] ccTransit
Colour for stars that have been observed by Gaia
-
colorbv
public float colorbv
The B-V color index, calculated as the magnitude in B minus the magnitude in V
-
rc
public RotationComponent rc
Holds information about the rotation of the body
-
transits
public int transits
Number of times this body has been observed by Gaia
-
lastTransitIncrease
public long lastTransitIncrease
Last observations increase in ms
-
compalpha
public float compalpha
Component alpha mirror
-
coordinatesTimeOverflow
protected boolean coordinatesTimeOverflow
Whether we are out of the time baseline range in the algorithm that works out the coordinates of this body
-
-
Method Detail
-
THRESHOLD_NONE
public abstract double THRESHOLD_NONE()
radius/distance limit for rendering at all. If angle is smaller than this quantity, no rendering happens.
-
THRESHOLD_QUAD
public abstract double THRESHOLD_QUAD()
radius/distance limit for rendering as shader. If angle is any bigger, we render as a model.
-
THRESHOLD_POINT
public abstract double THRESHOLD_POINT()
radius/distance limit for rendering as point. If angle is any bigger, we render with shader.
-
update
public void update(ITimeFrameProvider time, Vector3d parentTransform, ICamera camera)
Overrides the update adding the magnitude limit thingy.- Overrides:
update
in classSceneGraphNode
-
render
public void render(ExtShaderProgram shader, float alpha, IntMesh mesh, ICamera camera)
Billboard quad render, for planets and stars.- Specified by:
render
in interfaceIQuadRenderable
-
getFuzzyRenderSize
public float getFuzzyRenderSize(ICamera camera)
-
render
public void render(ExtSpriteBatch batch, ExtShaderProgram shader, FontRenderSystem sys, RenderingContext rc, ICamera camera)
Label rendering.- Specified by:
render
in interfaceI3DTextRenderable
- Parameters:
batch
- The sprite batchshader
- The shadersys
- The font render systemrc
- The render contextcamera
- The camera
-
getViewAnglePow
protected float getViewAnglePow()
-
getThOverFactorScl
protected float getThOverFactorScl()
-
getThOverFactor
protected float getThOverFactor(ICamera camera)
-
setColor2Data
protected void setColor2Data()
-
getInnerRad
public abstract float getInnerRad()
-
setMag
public void setMag(java.lang.Double mag)
-
setAbsmag
public void setAbsmag(java.lang.Double absmag)
-
setAppmag
public void setAppmag(java.lang.Double appmag)
-
getAppmag
public float getAppmag()
Description copied from interface:IFocus
Gets the apparent magnitude
-
getAbsmag
public float getAbsmag()
Description copied from interface:IFocus
Gets the absolute magnitude
-
isActive
public boolean isActive()
Description copied from interface:IFocus
Returns whether this focus object is active or not. Useful for particle groups
-
addFocusableObjects
public void addFocusableObjects(com.badlogic.gdx.utils.Array<IFocus> list)
Adds all the children that are focusable objects to the list.- Overrides:
addFocusableObjects
in classSceneGraphNode
- Parameters:
list
-
-
getViewAngle
public double getViewAngle()
Description copied from class:AbstractPositionEntity
Returns the current view angle of this entity, in radians.- Specified by:
getViewAngle
in interfaceIFocus
- Overrides:
getViewAngle
in classAbstractPositionEntity
- Returns:
- The view angle in radians.
-
setSize
public void setSize(java.lang.Double size)
Sets the size of this entity in kilometers- Overrides:
setSize
in classAbstractPositionEntity
- Parameters:
size
- The size in km
-
isStar
public boolean isStar()
-
setRotation
public void setRotation(RotationComponent rc)
Sets the rotation period in hours
-
withinMagLimit
public boolean withinMagLimit()
Description copied from interface:IFocus
Returns true if the focus is within the magnitude limit defined inGlobalConf
- Specified by:
withinMagLimit
in interfaceIFocus
- Returns:
- True if focus within magnitude limit
-
getSimpleCopy
public <T extends SceneGraphNode> T getSimpleCopy()
Description copied from class:AbstractPositionEntity
Gets a copy of this object but does not copy its parent or children- Overrides:
getSimpleCopy
in classAbstractPositionEntity
- Returns:
- The copied object
-
updateTransitNumber
public void updateTransitNumber(boolean visible, ITimeFrameProvider time, FovCamera fcamera)
Updates the transit number of this body if visible is true and it is a new transit. It also updates the colour if needed.- Parameters:
visible
-time
-
-
timeCondition
protected boolean timeCondition(ITimeFrameProvider time)
-
renderText
public boolean renderText()
Description copied from interface:I3DTextRenderable
Tells whether the text must be rendered or not for this entity- Specified by:
renderText
in interfaceI3DTextRenderable
- Returns:
- True if text must be rendered
-
textColour
public float[] textColour()
Description copied from interface:I3DTextRenderable
Returns an array with the text colour in the fashion [r, g, b, a]- Specified by:
textColour
in interfaceI3DTextRenderable
- Returns:
- Array with the colour
-
textScale
public float textScale()
Description copied from interface:I3DTextRenderable
Returns the text scale for the scale varying in the shader- Specified by:
textScale
in interfaceI3DTextRenderable
- Returns:
- The scale
-
textSize
public float textSize()
Description copied from interface:I3DTextRenderable
Returns the text size- Specified by:
textSize
in interfaceI3DTextRenderable
- Returns:
- The text size
-
labelSizeConcrete
protected float labelSizeConcrete()
-
labelFactor
protected abstract float labelFactor()
-
labelMax
protected abstract float labelMax()
-
textPosition
public void textPosition(ICamera cam, Vector3d out)
Description copied from interface:I3DTextRenderable
Sets the position of this text in the out vector- Specified by:
textPosition
in interfaceI3DTextRenderable
out
- The out parameter with the result
-
text
public java.lang.String text()
Description copied from interface:I3DTextRenderable
Returns the text- Specified by:
text
in interfaceI3DTextRenderable
- Returns:
- The text
-
textDepthBuffer
public void textDepthBuffer()
Description copied from interface:I3DTextRenderable
Executes the blending for the text- Specified by:
textDepthBuffer
in interfaceI3DTextRenderable
-
hasAtmosphere
public boolean hasAtmosphere()
- Specified by:
hasAtmosphere
in interfaceIModelRenderable
-
isLabel
public boolean isLabel()
Description copied from interface:I3DTextRenderable
Is it a label or another kind of text?- Specified by:
isLabel
in interfaceI3DTextRenderable
- Returns:
- Whether this is a label
-
getPmX
public double getPmX()
-
getPmY
public double getPmY()
-
getPmZ
public double getPmZ()
-
getRotationComponent
public RotationComponent getRotationComponent()
Description copied from interface:IFocus
Returns the rotation component of this focus- Specified by:
getRotationComponent
in interfaceIFocus
- Returns:
- The rotation component. Can be null
-
getOrientationQuaternion
public Quaterniond getOrientationQuaternion()
Description copied from interface:IFocus
Returns the orientation quaternion of this focus- Specified by:
getOrientationQuaternion
in interfaceIFocus
- Returns:
- The orientation quaternion. Can be null
-
addHit
public void addHit(int screenX, int screenY, int w, int h, int minPixDist, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits)
Description copied from interface:IFocus
Adds this focus to the hits list if it is hit by the [screenX, screenY] position
-
checkClickDistance
protected boolean checkClickDistance(int screenX, int screenY, com.badlogic.gdx.math.Vector3 pos, NaturalCamera camera, com.badlogic.gdx.graphics.PerspectiveCamera pcamera, double pixelSize)
-
computeViewAngle
protected double computeViewAngle(float fovFactor)
-
checkHitCondition
protected boolean checkHitCondition()
-
makeFocus
public void makeFocus()
Description copied from interface:IFocus
Hook that runs when the candidate is actually made focus
-
getCandidateId
public long getCandidateId()
Description copied from interface:IFocus
Returns the id of the focus candidate of this object. Defaults toIFocus.getId()
- Specified by:
getCandidateId
in interfaceIFocus
- Returns:
- The id of the candidate
-
getCandidateName
public java.lang.String getCandidateName()
Description copied from interface:IFocus
Returns the name of the focus candidate of this object. Defaults toIFocus.getName()
- Specified by:
getCandidateName
in interfaceIFocus
- Returns:
- The name of the candidate
-
getCandidateViewAngleApparent
public double getCandidateViewAngleApparent()
Description copied from interface:IFocus
Returns the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radians- Specified by:
getCandidateViewAngleApparent
in interfaceIFocus
- Returns:
- The apparent view angle in radians
-
isCoordinatesTimeOverflow
public boolean isCoordinatesTimeOverflow()
Description copied from interface:IFocus
Checks whether this foucs is within its valid time range, so that it can be used as a focus- Specified by:
isCoordinatesTimeOverflow
in interfaceIFocus
- Returns:
- Whether the focus object is within its valid time range
-
getTextOpacity
public float getTextOpacity()
Description copied from interface:I3DTextRenderable
Gets the text opacity- Specified by:
getTextOpacity
in interfaceI3DTextRenderable
- Returns:
- Text opacity
-
setAltname
public void setAltname(java.lang.String altname)
-
getAltname
public java.lang.String getAltname()
-
addToIndex
protected void addToIndex(com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode> map)
Description copied from class:SceneGraphNode
Special actions to be taken for this object when adding to the index.- Overrides:
addToIndex
in classSceneGraphNode
- Parameters:
map
- The index
-
removeFromIndex
protected void removeFromIndex(com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode> map)
Description copied from class:SceneGraphNode
Special actions to be taken for this object when removing from the index. Must implement if addToIndex is implemented- Overrides:
removeFromIndex
in classSceneGraphNode
- Parameters:
map
- The index
-
getFocus
public IFocus getFocus(java.lang.String name)
Description copied from interface:IFocus
Prepares the candidate with the given name
-
isValidPosition
public boolean isValidPosition()
Description copied from class:SceneGraphNode
Returns whether the current position is valid (usually, when there is no coordinates overflow)- Overrides:
isValidPosition
in classSceneGraphNode
- Returns:
-
-