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
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 bodyRotationComponentrcHolds information about the rotation of the bodyfloatTH_OVER_FACTORjava.lang.StringwikinameNAME 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, sg, size, translation, viewAngle, viewAngleApparent, visible -
Constructor Summary
Constructors Constructor Description CelestialBody()Simple constructor -
Method Summary
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 radiansVector3bgetClosestAbsolutePos(Vector3b 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()java.lang.StringgetWikiname()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()voidsetColorbv(java.lang.Double colorbv)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 kilometersvoidsetWikiname(java.lang.String wikiname)java.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.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, insert, isCopy, isInRender, isInRender, isVisibilityOn, isVisible, isVisible, 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, shouldRender, toString, update, update, updateLocal, updateLocalValues, updateNames, updateNamesRecMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, isCopyMethods inherited from interface gaiasky.render.IModelRenderable
renderMethods inherited from interface gaiasky.render.IRenderable
getComponentType, getDistToCamera, getOpacity
-
Field Details
-
TH_OVER_FACTOR
public float TH_OVER_FACTOR -
wikiname
public java.lang.String wikinameNAME 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:
renderin 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:
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
-
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
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
-
setColorbv
public void setColorbv(java.lang.Double colorbv) -
isStar
public boolean isStar() -
setRotation
Sets the rotation period in hours -
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
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
Description copied from interface:IFocusReturns the rotation component of this focus- Specified by:
getRotationComponentin interfaceIFocus- Returns:
- The rotation component. Can be null
-
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
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
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
-
getWikiname
public java.lang.String getWikiname() -
setWikiname
public void setWikiname(java.lang.String wikiname)
-