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
FieldsModifier 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
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 bodyfloat
Factor to apply to labels.float
float
Render scale.Holds information about the rotation of the bodyfloat
double
Minimum solid angle for rendering the lable of this object.double
Minimum solid angle for rendering at all.double
Minimum solid angle for rendering as a point.double
Minimum solid angle limit for rendering as a quad.NAME FOR WIKIPEDIAFields inherited from class gaiasky.scenegraph.SceneGraphNode
B31, B32, B33, B34, cc, children, computed, coordinates, copy, ct, D31, D32, D33, D34, distToCamera, F31, F32, F33, F34, forceLabel, id, labelcolor, lastStateChangeTimeMs, localizedNameIndex, localTransform, names, numChildren, octant, octantId, opacity, orientation, parent, parentName, pos, posSph, ROOT_NAME, size, translation, viewAngle, viewAngleApparent, visible
-
Constructor Summary
Constructors -
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] position.void
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 ray.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
protected double
computeViewAngle
(float fovFactor) float
Gets the absolute magnitude.float
Gets the apparent magnitude.long
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 radians.Same asIFocus.getAbsolutePosition(Vector3b)
.double
Same asIFocus.getDistToCamera()
.Same asIFocus.getName()
.Prepares the candidate with the given name.float
getFuzzyRenderSize
(ICamera camera) abstract float
Returns the orientation quaternion of this focus.double
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 opacitydouble
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 focus.boolean
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 float
void
Hook that runs when the candidate is actually made focus.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
Tells whether the text must be rendered or not for this entityvoid
void
setAltname
(String altname) void
protected void
void
setColorbv
(Double colorbv) void
setLabelFactor
(Double labelFactor) void
setLabelMax
(Double labelMax) void
void
setPrimitiveRenderScale
(Double primitiveRenderScale) void
Sets the rotation period in hoursvoid
Sets the size of this entity in kilometersvoid
setTextScale
(Double textScale) void
setThresholdNone
(Double thresholdNone) void
setThresholdPoint
(Double thresholdPoint) void
setThresholdQuad
(Double thresholdQuad) void
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 sizeMethods 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, getCoordinates, getCt, getDelta, getDescription, getDistToCamera, getFirstStarAncestor, getHeight, getHeight, getHeight, getHeightScale, getId, getLabelcolor, getLineCopy, getLocalizedName, 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, isForceLabel, isForceLabel, isInRender, isInRender, isVisibilityOn, isVisible, isVisible, isVisible, isVisibleGroup, isVisibleGroup, msSinceStateChange, mustAddToIndex, mustUpdatePosition, namesConcat, removeChild, removeFromIndex, removeFromRender, render2DLabel, render2DLabel, render2DLabel, render2DLabel, render3DLabel, render3DLabel, returnToPool, setColor, setColor, setComputedFlag, setCoordinates, setCt, setCt, setDescription, setForcelabel, setForceLabel, setForceLabel, setId, setLabelcolor, setLabelcolor, setLabelcolor, setName, setName, setNames, setParent, setPos, setSize, setUp, setVisible, setVisible, setVisibleGroup, shouldRender, toString, update, update, updateLocal, updateLocalizedName, updateLocalizedNameRecursive, updateLocalValues
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, getLocalizedName, 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
-
thresholdNone
public double thresholdNoneMinimum solid angle for rendering at all. If angle is smaller than this quantity, no rendering happens. -
thresholdQuad
public double thresholdQuadMinimum solid angle limit for rendering as a quad. If angle is any bigger, we render as a model. -
thresholdPoint
public double thresholdPointMinimum solid angle for rendering as a point. If angle is any bigger, we render with shader. -
thresholdLabel
public double thresholdLabelMinimum solid angle for rendering the lable of this object. -
labelFactor
public float labelFactorFactor to apply to labels. -
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 -
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 -
labelMax
public float labelMax -
textScale
public float textScale -
coordinatesTimeOverflow
protected boolean coordinatesTimeOverflowWhether we are out of the time baseline range in the algorithm that works out the coordinates of this body -
primitiveRenderScale
public float primitiveRenderScaleRender scale.
-
-
Constructor Details
-
CelestialBody
public CelestialBody()Simple constructor
-
-
Method Details
-
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() -
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() -
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
Same asIFocus.getAbsolutePosition(Vector3b)
.- Specified by:
getClosestAbsolutePos
in interfaceIFocus
- Parameters:
out
- Vector3d where to put the return value.- Returns:
- The absolute position, same as aux.
-
getWikiname
-
setWikiname
-
setPrimitiveRenderScale
-
setThresholdNone
-
setThresholdQuad
-
setThresholdPoint
-
setLabelFactor
-
setLabelMax
-
setTextScale
-