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
,IVisibilitySwitch
,IPosition
public abstract class CelestialBody
extends SceneGraphNode
implements I3DTextRenderable, IQuadRenderable, IModelRenderable, IFocus
Represents any celestial body.
-
Field Summary
Modifier and TypeFieldDescriptionfloat
Absolute magnitude, m = -2.5 log10(flux), with the flux at 10 pcfloat
Apparent magnitude, m = -2.5 log10(flux)float[]
Red, green and blue colors and their revamped cousinsfloat[]
Colour for stars that have been observed by Gaiafloat
The B-V color index, calculated as the magnitude in B minus the magnitude in Vfloat
Component alpha mirrorprotected boolean
Whether we are out of the time baseline range in the algorithm that works out the coordinates of this bodyHolds information about the rotation of the bodyfloat
NAME FOR WIKIPEDIAFields inherited from class gaiasky.scenegraph.SceneGraphNode
aux3b1, aux3b2, aux3b3, aux3b4, aux3d1, aux3d2, aux3d3, aux3d4, aux3f1, aux3f2, aux3f3, aux3f4, cc, children, computed, coordinates, copy, ct, distToCamera, id, lastStateChangeTimeMs, localTransform, namekey, names, numChildren, octant, octantId, opacity, orientation, parent, parentkey, parentName, pos, posSph, ROOT_NAME, size, translation, viewAngle, viewAngleApparent, visible
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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] positionvoid
addHit(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 boolean
checkClickDistance(int screenX, int screenY, com.badlogic.gdx.math.Vector3 pos, NaturalCamera camera, com.badlogic.gdx.graphics.PerspectiveCamera pcamera, double pixelSize)
protected boolean
protected double
computeViewAngle(float fovFactor)
float
Gets the absolute magnitudefloat
Gets the apparent magnitudelong
Returns the id of the focus candidate of this object.Returns the name of the focus candidate of this object.double
Returns the candidate apparent view angle (view angle corrected with the field of view) of this entity, in radiansdouble
Same asIFocus.getDistToCamera()
Same asIFocus.getName()
Prepares the candidate with the given namefloat
getFuzzyRenderSize(ICamera camera)
abstract float
Returns the orientation quaternion of this focusdouble
getPmX()
double
getPmY()
double
getPmZ()
Returns the rotation component of this focus<T extends SceneGraphNode>
TGets a copy of this object but does not copy its parent or children.float
Gets the text opacityprotected float
getThOverFactor(ICamera camera)
protected float
double
Returns the current view angle of this entity, in radians.protected float
boolean
boolean
isActive()
Returns whether this focus object is active or not.boolean
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
Returns whether the current position is valid (usually, when there is no coordinates overflow).protected abstract float
protected abstract float
labelMax()
protected float
void
Hook that runs when the candidate is actually made focusvoid
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
Tells whether the text must be rendered or not for this entityvoid
void
setAltname(String altname)
void
protected void
void
setColorbv(Double colorbv)
void
void
Sets the rotation period in hoursvoid
Sets the size of this entity in kilometersvoid
setWikiname(String wikiname)
text()
Returns the textfloat[]
Returns an array with the text colour in the fashion [r, g, b, a]void
Executes the blending for the textvoid
textPosition(ICamera cam, Vector3d out)
Sets the position of this text in the out vectorfloat
Returns the text scale for the scale varying in the shaderfloat
textSize()
Returns the text sizeabstract double
radius/distance limit for rendering at all.abstract double
radius/distance limit for rendering as point.abstract double
radius/distance limit for rendering as shader.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, getChildrenByComponentType, getChildrenByType, getColor, getComponentType, getCt, getDelta, getDescription, 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, getVisibilityOpacityFactor, hasCt, hasName, hasName, initialize, insert, isCopy, isInRender, isInRender, isVisibilityOn, isVisible, isVisible, isVisible, isVisibleGroup, msSinceStateChange, mustAddToIndex, mustUpdatePosition, namesConcat, removeChild, removeFromIndex, removeFromRender, render2DLabel, render2DLabel, render2DLabel, render2DLabel, render3DLabel, render3DLabel, returnToPool, setColor, setColor, setComputedFlag, setCoordinates, setCt, setCt, setDescription, setId, setLabelcolor, setLabelcolor, setName, setNamekey, setNames, setParent, setParentkey, setSize, setUp, setVisible, setVisible, setVisibleGroup, shouldRender, toString, update, 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, getColor, 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 Details
-
TH_OVER_FACTOR
public float TH_OVER_FACTOR -
wikiname
NAME FOR WIKIPEDIA -
absmag
public float absmagAbsolute magnitude, m = -2.5 log10(flux), with the flux at 10 pc -
appmag
public float appmagApparent magnitude, m = -2.5 log10(flux) -
ccPale
public float[] ccPaleRed, green and blue colors and their revamped cousins -
ccTransit
public float[] ccTransitColour for stars that have been observed by Gaia -
colorbv
public float colorbvThe B-V color index, calculated as the magnitude in B minus the magnitude in V -
rc
Holds information about the rotation of the body -
compalpha
public float compalphaComponent alpha mirror -
coordinatesTimeOverflow
protected boolean coordinatesTimeOverflowWhether we are out of the time baseline range in the algorithm that works out the coordinates of this body
-
-
Constructor Details
-
CelestialBody
public CelestialBody()Simple constructor
-
-
Method Details
-
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. -
render
Billboard quad render, for planets and stars.- Specified by:
render
in interfaceIQuadRenderable
- Parameters:
shader
- The shader programalpha
- Opacity valuemesh
- The meshcamera
- The camera
-
getFuzzyRenderSize
-
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
-
setColor2Data
protected void setColor2Data() -
getInnerRad
public abstract float getInnerRad() -
setMag
-
setAbsmag
-
setAppmag
-
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
Adds all the children that are focusable objects to the list.- Overrides:
addFocusableObjects
in classSceneGraphNode
- Parameters:
list
- The list to add to.
-
getViewAngle
public double getViewAngle()Description copied from class:SceneGraphNode
Returns the current view angle of this entity, in radians.- Specified by:
getViewAngle
in interfaceIFocus
- Overrides:
getViewAngle
in classSceneGraphNode
- Returns:
- The view angle in radians.
-
setSize
Sets the size of this entity in kilometers- Overrides:
setSize
in classSceneGraphNode
- Parameters:
size
- The size in km
-
setColorbv
-
isStar
public boolean isStar() -
setRotation
Sets the rotation period in hours -
getSimpleCopy
Description copied from class:SceneGraphNode
Gets a copy of this object but does not copy its parent or children.- Overrides:
getSimpleCopy
in classSceneGraphNode
- Returns:
- The copied object.
-
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
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
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
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
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 -
addHit
public void addHit(Vector3d p0, Vector3d p1, 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 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: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
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
-
getFocus
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
-
getClosestName
Description copied from interface:IFocus
Same asIFocus.getName()
- Specified by:
getClosestName
in interfaceIFocus
- Returns:
- The name
-
getClosestDistToCamera
public double getClosestDistToCamera()Description copied from interface:IFocus
Same asIFocus.getDistToCamera()
- Specified by:
getClosestDistToCamera
in interfaceIFocus
- Returns:
- The distance to the camera in internal units
-
getClosestAbsolutePos
Description copied from interface:IFocus
- Specified by:
getClosestAbsolutePos
in interfaceIFocus
- Parameters:
out
- Vector3d where to put the return value- Returns:
- The absolute position, same as aux
-
getWikiname
-
setWikiname
-