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
Direct Known Subclasses:
Invisible, ModelBody, Particle

public abstract class CelestialBody extends SceneGraphNode implements I3DTextRenderable, IQuadRenderable, IModelRenderable, IFocus
Represents any celestial body.
  • Field Details

    • thresholdNone

      public double thresholdNone
      Minimum solid angle for rendering at all. If angle is smaller than this quantity, no rendering happens.
    • thresholdQuad

      public double thresholdQuad
      Minimum solid angle limit for rendering as a quad. If angle is any bigger, we render as a model.
    • thresholdPoint

      public double thresholdPoint
      Minimum solid angle for rendering as a point. If angle is any bigger, we render with shader.
    • thresholdLabel

      public double thresholdLabel
      Minimum solid angle for rendering the lable of this object.
    • labelFactor

      public float labelFactor
      Factor to apply to labels.
    • wikiname

      public String wikiname
      NAME FOR WIKIPEDIA
    • 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
    • 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
    • compalpha

      public float compalpha
      Component alpha mirror
    • labelMax

      public float labelMax
    • textScale

      public float textScale
    • coordinatesTimeOverflow

      protected boolean coordinatesTimeOverflow
      Whether we are out of the time baseline range in the algorithm that works out the coordinates of this body
    • primitiveRenderScale

      public float primitiveRenderScale
      Render scale.
  • Constructor Details

    • CelestialBody

      public CelestialBody()
      Simple constructor
  • Method Details

    • render

      public void render(ExtShaderProgram shader, float alpha, IntMesh mesh, ICamera camera)
      Billboard quad render, for planets and stars.
      Specified by:
      render in interface IQuadRenderable
      Parameters:
      shader - The shader program
      alpha - Opacity value
      mesh - The mesh
      camera - The camera
    • 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 interface I3DTextRenderable
      Parameters:
      batch - The sprite batch
      shader - The shader
      sys - The font render system
      rc - The render context
      camera - The camera
    • getViewAnglePow

      protected float getViewAnglePow()
    • setColor2Data

      protected void setColor2Data()
    • getInnerRad

      public abstract float getInnerRad()
    • setMag

      public void setMag(Double mag)
    • setAbsmag

      public void setAbsmag(Double absmag)
    • setAppmag

      public void setAppmag(Double appmag)
    • getAppmag

      public float getAppmag()
      Description copied from interface: IFocus
      Gets the apparent magnitude.
      Specified by:
      getAppmag in interface IFocus
      Returns:
      The apparent magnitude.
    • getAbsmag

      public float getAbsmag()
      Description copied from interface: IFocus
      Gets the absolute magnitude.
      Specified by:
      getAbsmag in interface IFocus
      Returns:
      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.
      Specified by:
      isActive in interface IFocus
      Returns:
      The active status.
    • 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 class SceneGraphNode
      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 interface IFocus
      Overrides:
      getViewAngle in class SceneGraphNode
      Returns:
      The view angle in radians.
    • setSize

      public void setSize(Double size)
      Sets the size of this entity in kilometers
      Overrides:
      setSize in class SceneGraphNode
      Parameters:
      size - The size in km
    • setColorbv

      public void setColorbv(Double colorbv)
    • isStar

      public boolean isStar()
    • setRotation

      public void setRotation(RotationComponent rc)
      Sets the rotation period in hours
    • getSimpleCopy

      public <T extends SceneGraphNode> T getSimpleCopy()
      Description copied from class: SceneGraphNode
      Gets a copy of this object but does not copy its parent or children.
      Overrides:
      getSimpleCopy in class SceneGraphNode
      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 interface I3DTextRenderable
      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 interface I3DTextRenderable
      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 interface I3DTextRenderable
      Returns:
      The scale
    • textSize

      public float textSize()
      Description copied from interface: I3DTextRenderable
      Returns the text size
      Specified by:
      textSize in interface I3DTextRenderable
      Returns:
      The text size
    • labelSizeConcrete

      protected float labelSizeConcrete()
    • 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 interface I3DTextRenderable
      out - The out parameter with the result
    • text

      public String text()
      Description copied from interface: I3DTextRenderable
      Returns the text
      Specified by:
      text in interface I3DTextRenderable
      Returns:
      The text
    • textDepthBuffer

      public void textDepthBuffer()
      Description copied from interface: I3DTextRenderable
      Executes the blending for the text
      Specified by:
      textDepthBuffer in interface I3DTextRenderable
    • hasAtmosphere

      public boolean hasAtmosphere()
      Specified by:
      hasAtmosphere in interface IModelRenderable
    • isLabel

      public boolean isLabel()
      Description copied from interface: I3DTextRenderable
      Is it a label or another kind of text?
      Specified by:
      isLabel in interface I3DTextRenderable
      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 interface IFocus
      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 interface IFocus
      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.
      Specified by:
      addHit in interface IFocus
      Parameters:
      screenX - The x position of the hit.
      screenY - The y position of the hit.
      w - The viewport width.
      h - The viewport height.
      minPixDist - The minimum pixel distance to consider as hit.
      camera - The camera.
      hits - The list where to add the element.
    • 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.
      Specified by:
      addHit in interface IFocus
      Parameters:
      p0 - Start point of the ray.
      p1 - End point of the ray.
      camera - The camera.
      hits - The list where the focus is to be added.
    • 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.
      Specified by:
      makeFocus in interface IFocus
    • getCandidateId

      public long getCandidateId()
      Description copied from interface: IFocus
      Returns the id of the focus candidate of this object. Defaults to IFocus.getId().
      Specified by:
      getCandidateId in interface IFocus
      Returns:
      The id of the candidate.
    • getCandidateName

      public String getCandidateName()
      Description copied from interface: IFocus
      Returns the name of the focus candidate of this object. Defaults to IFocus.getName().
      Specified by:
      getCandidateName in interface IFocus
      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 interface IFocus
      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 interface IFocus
      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 interface I3DTextRenderable
      Returns:
      Text opacity
    • setAltname

      public void setAltname(String altname)
    • getFocus

      public IFocus getFocus(String name)
      Description copied from interface: IFocus
      Prepares the candidate with the given name.
      Specified by:
      getFocus in interface IFocus
      Parameters:
      name - The name in lower case.
    • 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 class SceneGraphNode
    • getClosestName

      public String getClosestName()
      Description copied from interface: IFocus
      Specified by:
      getClosestName in interface IFocus
      Returns:
      The name.
    • getClosestDistToCamera

      public double getClosestDistToCamera()
      Description copied from interface: IFocus
      Specified by:
      getClosestDistToCamera in interface IFocus
      Returns:
      The distance to the camera in internal units.
    • getClosestAbsolutePos

      public Vector3b getClosestAbsolutePos(Vector3b out)
      Description copied from interface: IFocus
      Specified by:
      getClosestAbsolutePos in interface IFocus
      Parameters:
      out - Vector3d where to put the return value.
      Returns:
      The absolute position, same as aux.
    • getWikiname

      public String getWikiname()
    • setWikiname

      public void setWikiname(String wikiname)
    • setPrimitiveRenderScale

      public void setPrimitiveRenderScale(Double primitiveRenderScale)
    • setThresholdNone

      public void setThresholdNone(Double thresholdNone)
    • setThresholdQuad

      public void setThresholdQuad(Double thresholdQuad)
    • setThresholdPoint

      public void setThresholdPoint(Double thresholdPoint)
    • setLabelFactor

      public void setLabelFactor(Double labelFactor)
    • setLabelMax

      public void setLabelMax(Double labelMax)
    • setTextScale

      public void setTextScale(Double textScale)