Package gaiasky.scenegraph
Class CelestialBody
- java.lang.Object
-
- gaiasky.scenegraph.SceneGraphNode
-
- gaiasky.scenegraph.CelestialBody
-
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,I3DTextRenderable,IModelRenderable,IQuadRenderable,IRenderable,IFocus,IStarContainer,IPosition
public abstract class CelestialBody extends SceneGraphNode implements I3DTextRenderable, IQuadRenderable, IModelRenderable, IFocus
Represents any celestial body.
-
-
Field Summary
Fields Modifier and Type Field Description floatabsmagAbsolute magnitude, m = -2.5 log10(flux), with the flux at 10 pcfloatappmagApparent magnitude, m = -2.5 log10(flux)float[]ccPaleRed, green and blue colors and their revamped cousinsfloat[]ccTransitColour for stars that have been observed by GaiafloatcolorbvThe B-V color index, calculated as the magnitude in B minus the magnitude in VfloatcompalphaComponent alpha mirrorprotected booleancoordinatesTimeOverflowWhether we are out of the time baseline range in the algorithm that works out the coordinates of this bodylonglastTransitIncreaseLast observations increase in msRotationComponentrcHolds information about the rotation of the bodyfloatTH_OVER_FACTORinttransitsNumber of times this body has been observed by Gaia-
Fields inherited from class gaiasky.scenegraph.SceneGraphNode
aux3d1, aux3d2, aux3d3, aux3d4, aux3f1, aux3f2, aux3f3, aux3f4, cc, children, computed, coordinates, copy, ct, distToCamera, id, localTransform, namekey, names, numChildren, octant, octantId, opacity, orientation, parent, parentkey, parentName, pos, posSph, ROOT_NAME, sg, size, translation, viewAngle, viewAngleApparent
-
-
Constructor Summary
Constructors Constructor Description CelestialBody()Simple constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddFocusableObjects(com.badlogic.gdx.utils.Array<IFocus> list)Adds all the children that are focusable objects to the list.voidaddHit(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] positionvoidaddHit(Vector3d p0, Vector3d p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits)Adds this focus to the hits list if it is hit by the given rayprotected booleancheckClickDistance(int screenX, int screenY, com.badlogic.gdx.math.Vector3 pos, NaturalCamera camera, com.badlogic.gdx.graphics.PerspectiveCamera pcamera, double pixelSize)protected booleancheckHitCondition()protected doublecomputeViewAngle(float fovFactor)floatgetAbsmag()Gets the absolute magnitudefloatgetAppmag()Gets the apparent magnitudelonggetCandidateId()Returns the id of the focus candidate of this object.java.lang.StringgetCandidateName()Returns the name of the focus candidate of this object.doublegetCandidateViewAngleApparent()Returns the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radiansVector3dgetClosestAbsolutePos(Vector3d out)doublegetClosestDistToCamera()Same asIFocus.getDistToCamera()java.lang.StringgetClosestName()Same asIFocus.getName()IFocusgetFocus(java.lang.String name)Prepares the candidate with the given namefloatgetFuzzyRenderSize(ICamera camera)abstract floatgetInnerRad()QuaterniondgetOrientationQuaternion()Returns the orientation quaternion of this focusdoublegetPmX()doublegetPmY()doublegetPmZ()RotationComponentgetRotationComponent()Returns the rotation component of this focus<T extends SceneGraphNode>
TgetSimpleCopy()Gets a copy of this object but does not copy its parent or childrenfloatgetTextOpacity()Gets the text opacityprotected floatgetThOverFactor(ICamera camera)protected floatgetThOverFactorScl()doublegetViewAngle()Returns the current view angle of this entity, in radians.protected floatgetViewAnglePow()booleanhasAtmosphere()booleanisActive()Returns whether this focus object is active or not.booleanisCoordinatesTimeOverflow()Checks whether this foucs is within its valid time range, so that it can be used as a focusbooleanisLabel()Is it a label or another kind of text?booleanisStar()booleanisValidPosition()Returns whether the current position is valid (usually, when there is no coordinates overflow)protected abstract floatlabelFactor()protected abstract floatlabelMax()protected floatlabelSizeConcrete()voidmakeFocus()Hook that runs when the candidate is actually made focusvoidrender(ExtSpriteBatch batch, ExtShaderProgram shader, FontRenderSystem sys, RenderingContext rc, ICamera camera)Label rendering.voidrender(ExtShaderProgram shader, float alpha, IntMesh mesh, ICamera camera)Billboard quad render, for planets and stars.booleanrenderText()Tells whether the text must be rendered or not for this entityvoidsetAbsmag(java.lang.Double absmag)voidsetAltname(java.lang.String altname)voidsetAppmag(java.lang.Double appmag)protected voidsetColor2Data()voidsetMag(java.lang.Double mag)voidsetRotation(RotationComponent rc)Sets the rotation period in hoursvoidsetSize(java.lang.Double size)Sets the size of this entity in kilometersjava.lang.Stringtext()Returns the textfloat[]textColour()Returns an array with the text colour in the fashion [r, g, b, a]voidtextDepthBuffer()Executes the blending for the textvoidtextPosition(ICamera cam, Vector3d out)Sets the position of this text in the out vectorfloattextScale()Returns the text scale for the scale varying in the shaderfloattextSize()Returns the text sizeabstract doubleTHRESHOLD_NONE()radius/distance limit for rendering at all.abstract doubleTHRESHOLD_POINT()radius/distance limit for rendering as point.abstract doubleTHRESHOLD_QUAD()radius/distance limit for rendering as shader.voidupdate(ITimeFrameProvider time, Vector3d parentTransform, ICamera camera)Overrides the update adding the magnitude limit thingy.booleanwithinMagLimit()Returns true if the focus is within the magnitude limit defined inGlobalConf-
Methods inherited from class gaiasky.scenegraph.SceneGraphNode
add, add, addChild, addChild, addName, addNodes, addToIndex, addToRender, addToRenderLists, computeFuturePosition, dispose, doneLoading, getAbsoluteOrientation, getAbsolutePosition, getAbsolutePosition, getAggregatedChildren, getAlpha, getChildByName, getChildByNameAndType, getChildrenByType, getComponentType, getCt, getDelta, getDistToCamera, getFirstStarAncestor, getHeight, getHeight, getHeight, getHeightScale, getId, getLineCopy, getName, getNames, getNext, getNode, getNode, getOctant, getOpacity, getOrientation, getPos, getPosition, getPosition, getPosSph, getPredictedPosition, getRadius, getRoot, getSceneGraphDepth, getSize, getStarCount, getUnrotatedPos, getVelocity, getViewAngleApparent, hasName, hasName, initialize, insert, insert, isCopy, isInRender, isInRender, isVisibilityOn, mustAddToIndex, mustUpdatePosition, namesConcat, removeChild, removeFromIndex, removeFromRender, render2DLabel, render2DLabel, render2DLabel, render2DLabel, render3DLabel, render3DLabel, returnToPool, setColor, setColor, setComputedFlag, setCoordinates, setCt, setCt, setId, setLabelcolor, setLabelcolor, setName, setNamekey, setNames, setParent, setParentkey, setSize, setUp, toString, update, updateLocal, updateLocalValues, updateNames, updateNamesRec
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gaiasky.scenegraph.IFocus
getAbsolutePosition, getAbsolutePosition, getAlpha, getCt, getDelta, getDistToCamera, getFirstStarAncestor, getHeight, getHeight, getHeight, getHeightScale, getId, getName, getNames, getNext, getOctant, getOrientation, getPos, getPosSph, getPredictedPosition, getRadius, getSceneGraphDepth, getSize, getViewAngleApparent, hasName, hasName, isCopy
-
Methods inherited from interface gaiasky.render.IModelRenderable
render
-
Methods inherited from interface gaiasky.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:
updatein classSceneGraphNode
-
render
public void render(ExtShaderProgram shader, float alpha, IntMesh mesh, ICamera camera)
Billboard quad render, for planets and stars.- Specified by:
renderin 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:
renderin 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:IFocusGets the apparent magnitude
-
getAbsmag
public float getAbsmag()
Description copied from interface:IFocusGets the absolute magnitude
-
isActive
public boolean isActive()
Description copied from interface:IFocusReturns 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:
addFocusableObjectsin classSceneGraphNode- Parameters:
list-
-
getViewAngle
public double getViewAngle()
Description copied from class:SceneGraphNodeReturns the current view angle of this entity, in radians.- Specified by:
getViewAnglein interfaceIFocus- Overrides:
getViewAnglein classSceneGraphNode- Returns:
- The view angle in radians.
-
setSize
public void setSize(java.lang.Double size)
Sets the size of this entity in kilometers- Overrides:
setSizein classSceneGraphNode- 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:IFocusReturns true if the focus is within the magnitude limit defined inGlobalConf- Specified by:
withinMagLimitin interfaceIFocus- Returns:
- True if focus within magnitude limit
-
getSimpleCopy
public <T extends SceneGraphNode> T getSimpleCopy()
Description copied from class:SceneGraphNodeGets a copy of this object but does not copy its parent or children- Overrides:
getSimpleCopyin classSceneGraphNode- Returns:
- The copied object
-
renderText
public boolean renderText()
Description copied from interface:I3DTextRenderableTells whether the text must be rendered or not for this entity- Specified by:
renderTextin interfaceI3DTextRenderable- Returns:
- True if text must be rendered
-
textColour
public float[] textColour()
Description copied from interface:I3DTextRenderableReturns an array with the text colour in the fashion [r, g, b, a]- Specified by:
textColourin interfaceI3DTextRenderable- Returns:
- Array with the colour
-
textScale
public float textScale()
Description copied from interface:I3DTextRenderableReturns the text scale for the scale varying in the shader- Specified by:
textScalein interfaceI3DTextRenderable- Returns:
- The scale
-
textSize
public float textSize()
Description copied from interface:I3DTextRenderableReturns the text size- Specified by:
textSizein 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:I3DTextRenderableSets the position of this text in the out vector- Specified by:
textPositionin interfaceI3DTextRenderableout- The out parameter with the result
-
text
public java.lang.String text()
Description copied from interface:I3DTextRenderableReturns the text- Specified by:
textin interfaceI3DTextRenderable- Returns:
- The text
-
textDepthBuffer
public void textDepthBuffer()
Description copied from interface:I3DTextRenderableExecutes the blending for the text- Specified by:
textDepthBufferin interfaceI3DTextRenderable
-
hasAtmosphere
public boolean hasAtmosphere()
- Specified by:
hasAtmospherein interfaceIModelRenderable
-
isLabel
public boolean isLabel()
Description copied from interface:I3DTextRenderableIs it a label or another kind of text?- Specified by:
isLabelin 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:IFocusReturns the rotation component of this focus- Specified by:
getRotationComponentin interfaceIFocus- Returns:
- The rotation component. Can be null
-
getOrientationQuaternion
public Quaterniond getOrientationQuaternion()
Description copied from interface:IFocusReturns the orientation quaternion of this focus- Specified by:
getOrientationQuaternionin 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:IFocusAdds this focus to the hits list if it is hit by the [screenX, screenY] position
-
addHit
public void addHit(Vector3d p0, Vector3d p1, NaturalCamera camera, com.badlogic.gdx.utils.Array<IFocus> hits)
Description copied from interface:IFocusAdds this focus to the hits list if it is hit by the given ray
-
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:IFocusHook that runs when the candidate is actually made focus
-
getCandidateId
public long getCandidateId()
Description copied from interface:IFocusReturns the id of the focus candidate of this object. Defaults toIFocus.getId()- Specified by:
getCandidateIdin interfaceIFocus- Returns:
- The id of the candidate
-
getCandidateName
public java.lang.String getCandidateName()
Description copied from interface:IFocusReturns the name of the focus candidate of this object. Defaults toIFocus.getName()- Specified by:
getCandidateNamein interfaceIFocus- Returns:
- The name of the candidate
-
getCandidateViewAngleApparent
public double getCandidateViewAngleApparent()
Description copied from interface:IFocusReturns the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radians- Specified by:
getCandidateViewAngleApparentin interfaceIFocus- Returns:
- The apparent view angle in radians
-
isCoordinatesTimeOverflow
public boolean isCoordinatesTimeOverflow()
Description copied from interface:IFocusChecks whether this foucs is within its valid time range, so that it can be used as a focus- Specified by:
isCoordinatesTimeOverflowin interfaceIFocus- Returns:
- Whether the focus object is within its valid time range
-
getTextOpacity
public float getTextOpacity()
Description copied from interface:I3DTextRenderableGets the text opacity- Specified by:
getTextOpacityin interfaceI3DTextRenderable- Returns:
- Text opacity
-
setAltname
public void setAltname(java.lang.String altname)
-
getFocus
public IFocus getFocus(java.lang.String name)
Description copied from interface:IFocusPrepares the candidate with the given name
-
isValidPosition
public boolean isValidPosition()
Description copied from class:SceneGraphNodeReturns whether the current position is valid (usually, when there is no coordinates overflow)- Overrides:
isValidPositionin classSceneGraphNode- Returns:
-
getClosestName
public java.lang.String getClosestName()
Description copied from interface:IFocusSame asIFocus.getName()- Specified by:
getClosestNamein interfaceIFocus- Returns:
- The name
-
getClosestDistToCamera
public double getClosestDistToCamera()
Description copied from interface:IFocusSame asIFocus.getDistToCamera()- Specified by:
getClosestDistToCamerain interfaceIFocus- Returns:
- The distance to the camera in internal units
-
getClosestAbsolutePos
public Vector3d getClosestAbsolutePos(Vector3d out)
Description copied from interface:IFocus- Specified by:
getClosestAbsolutePosin interfaceIFocus- Parameters:
out- Vector3d where to put the return value- Returns:
- The absolute position, same as aux
-
-