Class ParticleSet

java.lang.Object
gaiasky.scene.component.ParticleSet
All Implemented Interfaces:
com.badlogic.ashley.core.Component, IDisposable
Direct Known Subclasses:
StarSet

public class ParticleSet extends Object implements com.badlogic.ashley.core.Component, IDisposable
  • Field Details

    • B31

      protected final Vector3b B31
    • B32

      protected final Vector3b B32
    • D31

      protected final Vector3d D31
    • D32

      protected final Vector3d D32
    • pointData

      public List<IParticleRecord> pointData
      List that contains the point data. It contains only [x y z].
    • columnInfoList

      public List<uk.ac.starlink.table.ColumnInfo> columnInfoList
      List of ColumnInfo objects for the data in this set.
    • renderParticles

      public boolean renderParticles
      This flag enables muting particle rendering.
    • isStars

      public boolean isStars
      Flag indicating whether the particle set holds stars or particles (extended or not).
    • isExtended

      public boolean isExtended
      Flag indicating whether the particle set holds extended particles.
    • renderSetLabel

      public boolean renderSetLabel
      Whether to render the global set label or not.
    • renderParticleLabels

      public boolean renderParticleLabels
      Whether to render particle labels at all for this set.
    • numLabels

      public int numLabels
      Number of labels to render for this group.
    • provider

      public String provider
      Fully qualified name of data provider class.
    • providerParams

      public Map<String,Object> providerParams
      Parameters for the data provider.
    • datafile

      public String datafile
      Path of data file.
    • modelFile

      public String modelFile
      Model file to use (obj, g3db, g3dj, gltf, glb). If present, modelType and modelParams are ignored. The model should have only positions (vector-3), normals (vector-3) and texture coordinates (vector-2) as vertex attributes. Only the first mesh of the model is used. Textures, lighting and material are ignored.
    • model

      public IntModel model
      The loaded model pointed by modelFile.
    • modelType

      public String modelType
      Default model type to use for the particles of this set. Typically, this should be set to quad, but allows for other model types.
    • modelParams

      public Map<String,Object> modelParams
      Parameters for the model, in case 'modelType' is used.
    • modelPrimitive

      public int modelPrimitive
      Render primitive. Triangles by default.
    • proximityDescriptorsLocation

      public String proximityDescriptorsLocation
      Proximity loading location, the location of the directory that contains descriptor JSON files with the name of objects in the dataset. These get loaded whenever the camera gets close to a particle with the given name.
    • proximityDescriptorsPath

      public Path proximityDescriptorsPath
      The path for proximity loading.
    • proximityThreshold

      public double proximityThreshold
      Threshold solid angle when loading happens. About 4 degrees (0.069 rad).
    • proximityLoadingFlag

      public boolean proximityLoadingFlag
      Flag that indicates whether this particle set has proximity loading.
    • proximityLoaded

      public com.badlogic.gdx.utils.IntSet proximityLoaded
      Set that contains the indexes of the particles whose descriptors have already been loaded.
    • proximityMissing

      public com.badlogic.gdx.utils.IntSet proximityMissing
      Contains the indices of the particles whose descriptors are not present.
    • profileDecay

      public float profileDecay
      Profile decay of the particles in the shader, when using quads.
    • colorNoise

      public float colorNoise
      Noise factor for the color in [0,1].
    • colorFromTexture

      public boolean colorFromTexture
      Assign a different color to each texture. Only used when textures are active.
    • fixedAngularSize

      public double fixedAngularSize
      Fixed angular size for all particles in this set, in radians. Applies only to quads. Negative to disable.
    • particleSizeLimitsPoint

      public double[] particleSizeLimitsPoint
      Particle size limits. Applies to legacy point render (using GL_POINTS).
    • particleSizeLimits

      public double[] particleSizeLimits
      Particle size limits for the quad renderer (using quads as GL_TRIANGLES). This will be multiplied by the distance to the particle in the shader, so that size = tan(angle) * dist.
    • textureAttribute

      public String textureAttribute
      The texture attribute is an attribute in the original table that points to the texture to use. Ideally, it should be an integer value from 1 to n, where n is the number of textures.
    • textureFiles

      public String[] textureFiles
      Texture files to use for rendering the particles, at random. Applies only to quads.
    • textureArray

      public com.badlogic.gdx.graphics.TextureArray textureArray
      Reference to the texture array containing the textures for this set, if any. Applies only to quads.
    • meanPosition

      public Vector3d meanPosition
      Temporary storage for the mean position of this particle set, if it is given externally. If this is set, the mean position is not computed from the positions of all the particles automatically.
    • factor

      public Double factor
      Factor to apply to the data points, usually to normalise distances.
    • ccMin

      public float[] ccMin
      Mapping colors.
    • ccMax

      public float[] ccMax
      Mapping colors.
    • forceLabel

      public Set<Integer> forceLabel
      Particles for which forceLabel is enabled.
    • labelColors

      public Map<Integer,float[]> labelColors
      Particles with special label colors.
    • lastSortTime

      public long lastSortTime
      Stores the time when the last sort operation finished, in ms.
    • meanDistance

      public double meanDistance
      The mean distance from the origin of all points in this group. Gives a sense of the scale.
    • maxDistance

      public double maxDistance
    • minDistance

      public double minDistance
    • epochJd

      public double epochJd
      Epoch for positions/proper motions in julian days.
    • currDeltaYears

      public double currDeltaYears
      Current computed epoch time.
    • focus

      public IParticleRecord focus
      Reference to the current focus.
    • focusIndex

      public int focusIndex
      Index of the particle acting as focus. Negative if we have no focus here.
    • candidateFocusIndex

      public int candidateFocusIndex
      Candidate to focus.
    • focusPosition

      public Vector3b focusPosition
      Position of the current focus.
    • focusPositionSph

      public Vector2d focusPositionSph
      Position in equatorial coordinates of the current focus in radians.
    • focusDistToCamera

      public double focusDistToCamera
      FOCUS_MODE attributes.
    • focusSolidAngle

      public double focusSolidAngle
      FOCUS_MODE attributes.
    • focusSolidAngleApparent

      public double focusSolidAngleApparent
      FOCUS_MODE attributes.
    • focusSize

      public double focusSize
      FOCUS_MODE attributes.
    • proximity

      public Proximity proximity
      Proximity particles.
    • disposed

      public boolean disposed
    • index

      public Map<String,Integer> index
    • metadata

      public double[] metadata
    • indices1

      public Integer[] indices1
    • indices2

      public Integer[] indices2
    • active

      public Integer[] active
    • background

      public Integer[] background
    • visibilityArray

      public byte[] visibilityArray
    • entity

      public com.badlogic.ashley.core.Entity entity
    • updating

      public final AtomicBoolean updating
    • updaterTask

      public ParticleSetUpdaterTask updaterTask
    • lastSortCameraPos

      public Vector3b lastSortCameraPos
    • cPosD

      public Vector3b cPosD
    • mat

      protected final Matrix4d mat
  • Constructor Details

    • ParticleSet

      public ParticleSet()
  • Method Details

    • getNextSequence

      public static long getNextSequence()
    • getColorMin

      public float[] getColorMin()
    • setColorMin

      public void setColorMin(double[] colorMin)
    • setColorMin

      public void setColorMin(float[] colorMin)
    • getColorMax

      public float[] getColorMax()
    • setColorMax

      public void setColorMax(double[] colorMax)
    • setColorMax

      public void setColorMax(float[] colorMax)
    • getMeanDistance

      public double getMeanDistance()
    • getMinDistance

      public double getMinDistance()
    • getMaxDistance

      public double getMaxDistance()
    • data

      public List<IParticleRecord> data()
      Returns the list of particles.
    • setData

      public void setData(List<IParticleRecord> pointData)
    • setData

      public void setData(List<IParticleRecord> pointData, boolean regenerateIndex)
    • setColumnInfoList

      public void setColumnInfoList(List<uk.ac.starlink.table.ColumnInfo> columnInfoList)
    • regenerateIndex

      public void regenerateIndex()
      Regenerates the name index
    • generateIndex

      public Map<String,Integer> generateIndex(List<IParticleRecord> pointData)
      Generates the index (maps name to array index) and computes the geometric center of this group
      Parameters:
      pointData - The data
      Returns:
      An map{string,int} mapping names to indices
    • setMeanPosition

      public void setMeanPosition(double[] pos)
    • setPosition

      public void setPosition(double[] pos)
    • setPosKm

      public void setPosKm(double[] pos)
    • setMeanPositionKm

      public void setMeanPositionKm(double[] pos)
    • setPositionKm

      public void setPositionKm(double[] pos)
    • setPosPc

      public void setPosPc(double[] pos)
    • setMeanPositionPc

      public void setMeanPositionPc(double[] pos)
    • setPositionPc

      public void setPositionPc(double[] pos)
    • setPosition

      public void setPosition(int[] pos)
    • setDataFile

      public void setDataFile(String dataFile)
    • setDatafile

      public void setDatafile(String dataFile)
    • setProviderParams

      public void setProviderParams(Map<String,Object> params)
    • setProviderparams

      public void setProviderparams(Map<String,Object> params)
    • setFactor

      public void setFactor(Double factor)
    • setProfiledecay

      @Deprecated public void setProfiledecay(Double profiledecay)
      Deprecated.
    • setProfileDecay

      public void setProfileDecay(Double profileDecay)
    • setColornoise

      @Deprecated public void setColornoise(Double colorNoise)
      Deprecated.
    • setColorNoise

      public void setColorNoise(Double colorNoise)
    • setColorFromTexture

      public void setColorFromTexture(boolean colorFromTexture)
    • setFixedAngularSize

      public void setFixedAngularSize(Double fixedAngularSize)
      Set fixed angular size, in radians.
    • setFixedAngularSizeRad

      public void setFixedAngularSizeRad(Double fixedAngularSizeRad)
      Set fixed angular size, in radians.
    • setFixedAngularSizeDeg

      public void setFixedAngularSizeDeg(Double fixedAngularSizeDeg)
      Set fixed angular size, in degrees.
    • setParticleSizeLimitsDeg

      public void setParticleSizeLimitsDeg(double[] sizeLimits)
    • setParticleSizeLimits

      public void setParticleSizeLimits(double[] sizeLimits)
    • setParticlesizelimits

      public void setParticlesizelimits(double[] sizeLimits)
    • setTextureAttribute

      public void setTextureAttribute(String textureAttribute)
    • setTexture

      public void setTexture(String texture)
    • setTextures

      public void setTextures(String[] textures)
    • setRenderParticles

      public void setRenderParticles(Boolean renderParticles)
    • setRenderSetLabel

      public void setRenderSetLabel(Boolean renderSetLabel)
    • setExtended

      public void setExtended(Boolean extended)
    • setNumLabels

      public void setNumLabels(Long numLabels)
    • get

      public IParticleRecord get(int index)
    • getRandomParticleName

      public String getRandomParticleName()
      Gets the name of a random particle in this group
      Returns:
      The name of a random particle
    • setModelType

      public void setModelType(String modelType)
    • setModelParams

      public void setModelParams(Map<String,Object> params)
    • setModelPrimitive

      public void setModelPrimitive(String modelPrimitive)
    • setProximityDescriptorsLocation

      public void setProximityDescriptorsLocation(String loc)
    • setProximityDescriptors

      public void setProximityDescriptors(String loc)
    • setDescriptorsLocation

      public void setDescriptorsLocation(String loc)
    • setProximityThreshold

      public void setProximityThreshold(Double thRadians)
    • setProximityThresholdRad

      public void setProximityThresholdRad(Double thRadians)
    • setProximityThresholdDeg

      public void setProximityThresholdDeg(Double thDegrees)
    • getSize

      public double getSize()
    • getSize

      public double getSize(int i)
      Returns the size of the particle at index i
      Parameters:
      i - The index
      Returns:
      The size
    • getFocusSize

      public double getFocusSize()
      Default size if not in data, 1e5 km
      Returns:
      The size
    • setFocusIndex

      public void setFocusIndex(String name)
    • getCandidateBean

      public IParticleRecord getCandidateBean()
    • getRadius

      public double getRadius()
    • getRadius

      public double getRadius(int i)
    • getTEff

      public double getTEff()
    • updateFocus

      public void updateFocus(ICamera camera)
      Updates the parameters of the focus, if the focus is active in this group
      Parameters:
      camera - The current camera
    • updateFocusDataPos

      public void updateFocusDataPos()
    • setFocusIndex

      public void setFocusIndex(int index)
    • makeFocus

      public void makeFocus()
    • isVisible

      public boolean isVisible(int index)
      Checks whether the particle with the given index is visible
      Parameters:
      index - The index of the particle
      Returns:
      The visibility of the particle
    • setVisible

      public void setVisible(boolean visible, String name, Render render)
    • setVisible

      public void setVisible(int index, boolean visible, Render render)
      Sets the visibility of the particle with the given index. If the visibility has changed, it marks the particle group for update.
      Parameters:
      index - The index of the particle
      visible - Visibility flag
    • markForUpdate

      public void markForUpdate(Render render)
    • getAbsolutePosition

      public Vector3b getAbsolutePosition(String name, Instant date, Vector3b out)
      Returns the position of the object with the given name at the given date, if any, in the out vector.
      Parameters:
      date - The date at which to get the position. If null, the position is given at the current simulation date.
      out - The out vector.
    • getAbsolutePosition

      public Vector3b getAbsolutePosition(IParticleRecord object, Instant date, Vector3b out)
      Returns the position of the given object at the given date, if any, in the out vector.
      Parameters:
      object - The particle record object.
      date - The date at which to get the position. If null, the position is given at the current simulation date.
      out - The out vector.
    • getAbsolutePosition

      public Vector3b getAbsolutePosition(Instant date, Vector3b out)
      Returns the current focus position at the given date, if any, in the out vector.
      Parameters:
      date - The date at which to get the position. If null, the position is given at the current simulation date.
      out - The out vector.
    • getAbsolutePosition

      public Vector3b getAbsolutePosition(Vector3b out)
      Returns the current focus position, if any, in the out vector.
    • getAbsolutePosition

      public Vector3b getAbsolutePosition(String name, Vector3b out)
      Returns the absolute position of the particle with the given name.
      Parameters:
      name - The name.
      out - The out vector.
      Returns:
      The absolute position in the out vector.
    • getAbsolutePosition

      public Vector3d getAbsolutePosition(String name, Vector3d out)
      Returns the absolute position of the particle with the given name.
      Parameters:
      name - The name.
      out - The out vector.
      Returns:
      The absolute position in the out vector.
    • fetchPositionDouble

      public Vector3d fetchPositionDouble(IParticleRecord pb, Vector3b camPos, Vector3d out, double deltaYears)
      Fetches the real position of the particle. It will apply the necessary integrations (i.e. proper motion). Double-precision version.
      Parameters:
      pb - The particle bean
      camPos - The position of the camera. If null, the camera position is not subtracted so that the coordinates are given in the global reference system instead of the camera reference system.
      out - The output vector
      deltaYears - The delta years
      Returns:
      The vector for chaining
    • fetchPosition

      public Vector3b fetchPosition(IParticleRecord pb, Vector3b camPos, Vector3b out, double deltaYears)
      Fetches the real position of the particle. It will apply the necessary integrations (i.e. proper motion). Arbitrary-precision version.
      Parameters:
      pb - The particle bean.
      camPos - The position of the camera. If null, the camera position is not subtracted so that the coordinates are given in the global reference system instead of the camera reference system.
      out - The output vector.
      deltaYears - The delta years.
      Returns:
      The vector for chaining.
    • setEpoch

      public void setEpoch(Double epochJd)
      Sets the epoch to use for the stars in this set.
      Parameters:
      epochJd - The epoch in julian days (days since January 1, 4713 BCE).
    • setEpochJd

      public void setEpochJd(Double epochJd)
      Sets the epoch to use for the stars in this set.
      Parameters:
      epochJd - The epoch in julian days (days since January 1, 4713 BCE).
    • getDeltaYears

      public double getDeltaYears()
      Returns the delta years to integrate the proper motion.
      Returns:
      The current delta years.
    • getId

      public long getId()
    • getName

      public String getName()
    • getNames

      public String[] getNames()
    • hasName

      public boolean hasName(String candidate)
    • hasName

      public boolean hasName(String candidate, boolean matchCase)
    • getLocalizedName

      public String getLocalizedName()
    • getCandidateId

      public long getCandidateId()
    • getCandidateName

      public String getCandidateName()
    • getCandidateSolidAngleApparent

      public double getCandidateSolidAngleApparent()
    • getSolidAngleApparent

      public double getSolidAngleApparent(int idx)
    • getClosestName

      public String getClosestName()
    • canSelect

      public boolean canSelect(FilterView view)
    • getPosSph

      public Vector2d getPosSph()
    • getAlpha

      public double getAlpha()
    • getDelta

      public double getDelta()
    • getDistToCamera

      public double getDistToCamera()
    • getSolidAngle

      public double getSolidAngle()
    • getSolidAngleApparent

      public double getSolidAngleApparent()
    • isWireframe

      public boolean isWireframe()
    • isBillboard

      public boolean isBillboard()
    • setForceLabel

      public void setForceLabel(Boolean forceLabel, String name)
    • isForceLabel

      public boolean isForceLabel(String name)
    • setLabelColor

      public void setLabelColor(float[] color, String name)
    • dispose

      public void dispose(com.badlogic.ashley.core.Entity entity)
      Specified by:
      dispose in interface IDisposable