Class ParticleSet
java.lang.Object
gaiasky.scene.component.ParticleSet
- All Implemented Interfaces:
com.badlogic.ashley.core.Component, IDisposable
- Direct Known Subclasses:
StarSet
Contains the parameters for particle sets. These are groups of point particles with optional additional
attributes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumControls whether the brightness twinkles.static enumShading type, for lighting the particles. -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanFlag that flips when the particle set has been added to the main index.booleanWhether to allow the star streaks effect, where particles get stretched in the direction of motion when the camera moves.floatAmbient light for billboard and spherical lighting.protected final Vector3Qprotected final Vector3QintCandidate to focus.float[]Mapping colors.float[]Mapping colors.booleanAssign a different color to each texture.floatNoise factor for the color in [0,1].List<uk.ac.starlink.table.ColumnInfo> List ofColumnInfoobjects for the data in this set.Last sort position.doubleCurrent computed epoch time.protected final Vector3Dprotected final Vector3DPath of data file.booleanSet has been disposed.com.badlogic.ashley.core.EntityReference to the entity.doubleEpoch for positions/proper motions in julian days.Factor to apply to the data points, usually to normalize distances.doubleFixed angular size for all particles in this set, in radians.Reference to the current focus.doubleFOCUS_MODE attributes.intIndex of the particle acting as focus.Position of the current focus.Position in equatorial coordinates of the current focus in radians.doubleFOCUS_MODE attributes.doubleFOCUS_MODE attributes.doubleFOCUS_MODE attributes.booleanWhether to generate an index or not.Name to array index.int[]Indices buffer.com.badlogic.gdx.utils.IntSetIndices of stars that are not visible.booleanFlag indicating whether the particle set holds Keplerian elements particles (typeParticleKepler).booleanFlag indicating whether the particle set holds extended particles.booleanFlag indicating whether the particle set holds stars or particles (extended or not).com.badlogic.gdx.utils.IntMap<float[]> Particles with special label colors.com.badlogic.gdx.utils.IntSetIndices of particles for whichlabelDisplayis set toLabel.LabelDisplay.ALWAYS.com.badlogic.gdx.utils.IntSetIndices of particles for whichlabelDisplayis set toLabel.LabelDisplay.NEVER.Last sort position.doubleStores the time when the last sort operation finished, in seconds.protected final Matrix4DAuxiliary matrix.doubledoubleThe mean distance from the origin of all points in this group.Temporary storage for the mean position of this particle set, if it is given externally.double[]Metadata, for sorting - holds distances from each particle to the camera, squared.doubleThe loaded model pointed by modelFile.Model file to use (obj,g3db,g3dj,gltf,glb).Parameters for the model, in case 'modelType' is used.intRender primitive.Default model type to use for the particles of this set.intNumber of labels to render for this group.double[]Particle size limits for the quad renderer (using quads as GL_TRIANGLES).List that contains the point data.floatProfile decay of the particles in the shader, when using quads and plainParticleSet.ShadingType.Fully qualified name of data provider class.Parameters for the data provider.Proximity particles.Proximity loading location, the location of the directory that contains descriptor JSON files with the name of objects in the dataset.The path for proximity loading.com.badlogic.gdx.utils.IntSetSet that contains the indexes of the particles whose descriptors have already been loaded.booleanFlag that indicates whether this particle set has proximity loading.booleanFlag that indicates whether loading should also happen on focus.com.badlogic.gdx.utils.IntSetContains the indices of the particles whose descriptors are not present.doubleThreshold solid angle when loading happens.booleanWhether to render particle labels at all for this set.booleanThis flag enables muting particle rendering.booleanWhether to render the global set label or not.Render target for the particles of this set.Shading style to use for this set.The shading type, for lighting the particles.doubleThe noise in the size determination for particles.floatControls how sharply the sphere edges darken (higher values = more pronounced sphere appearance with darker edges).com.badlogic.gdx.graphics.TextureArrayReference to the texture array containing the textures for this set, if any.The texture attribute is an attribute in the original table that points to the texture to use.String[]Texture files to use for rendering the particles, at random.Updater task. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanSelect(FilterView view) data()Returns the list of particles.voiddispose(com.badlogic.ashley.core.Entity entity) fetchPosition(IParticleRecord pb, Vector3Q camPos, Vector3Q out, double deltaYears) Fetches the real position of the particle.fetchPositionDouble(IParticleRecord pb, Vector3Q camPos, Vector3D out, double deltaYears) Fetches the real position of the particle.generateIndex(List<IParticleRecord> pointData) Generates the index (maps name to array index) and computes the geometric center of this groupget(int index) getAbsolutePosition(IParticleRecord object, Instant date, Vector3Q out) Returns the position of the given object at the given date, if any, in the out vector.Returns the current focus position, if any, in the out vector.getAbsolutePosition(String name, Vector3D out) Returns the absolute position of the particle with the given name.getAbsolutePosition(String name, Vector3Q out) Returns the absolute position of the particle with the given name.getAbsolutePosition(String name, Instant date, Vector3Q out) Returns the position of the object with the given name at the given date, if any, in the out vector.getAbsolutePosition(Instant date, Vector3Q out) Returns the current focus position at the given date, if any, in the out vector.doublegetAlpha()longdoublefloat[]float[]doublegetDelta()doubleReturns the delta years to integrate the proper motion.doubleGets the name of a random particle in this groupdoubleDefault size if not in data, 1e5 kmlonggetId()doubledoubledoublegetName()String[]getNames()static longdoubledoublegetRadius(int i) doublegetSize()doublegetSize(int i) Returns the size of the particle at index idoubledoubledoublegetSolidAngleApparent(int idx) doublegetTEff()booleanbooleanbooleanbooleanisForceLabel(String name) booleanisModel()booleanisRenderLabel(int idx) booleanisRenderLabel(String name) booleanisVisible(int index) Checks whether the particle with the given index is visiblebooleanvoidvoidmarkForUpdate(Render render) voidRegenerates the name indexvoidsetAmbientLight(Double ambient) voidsetColorFromTexture(boolean colorFromTexture) voidsetColorMax(double[] colorMax) voidsetColorMax(float[] colorMax) voidsetColorMin(double[] colorMin) voidsetColorMin(float[] colorMin) voidsetColornoise(Double colorNoise) Deprecated.voidsetColorNoise(Double colorNoise) voidsetColumnInfoList(List<uk.ac.starlink.table.ColumnInfo> columnInfoList) voidsetData(List<IParticleRecord> pointData) voidsetData(List<IParticleRecord> pointData, boolean regenerateIndex) voidsetDatafile(String dataFile) voidsetDataFile(String dataFile) voidvoidSets the epoch to use for the stars in this set.voidsetEpochJd(Double epochJd) Sets the epoch to use for the stars in this set.voidsetExtended(Boolean extended) voidvoidsetFixedAngularSize(Double fixedAngularSize) Set fixed angular size, in radians.voidsetFixedAngularSizeDeg(Double fixedAngularSizeDeg) Set fixed angular size, in degrees.voidsetFixedAngularSizeRad(Double fixedAngularSizeRad) Set fixed angular size, in radians.voidsetFocusIndex(int index) voidsetFocusIndex(String name) voidsetForceLabel(Boolean forceLabel, String name) voidsetGenerateIndex(boolean generateIndex) voidsetLabelColor(float[] color, String name) voidsetLabelDisplay(Label.LabelDisplay state, String name) voidsetMeanPosition(double[] pos) voidsetMeanPositionKm(double[] pos) voidsetMeanPositionPc(double[] pos) voidsetModelParams(Map<String, Object> params) voidsetModelPrimitive(String modelPrimitive) voidsetModelType(String modelType) voidsetNumLabels(Long numLabels) voidsetParticlesizelimits(double[] sizeLimits) voidsetParticleSizeLimits(double[] sizeLimits) voidsetParticleSizeLimitsDeg(double[] sizeLimits) voidsetPosition(double[] pos) voidsetPosition(int[] pos) voidsetPositionKm(double[] pos) voidsetPositionPc(double[] pos) voidsetPosKm(double[] pos) voidsetPosPc(double[] pos) voidsetProfiledecay(Double profiledecay) Deprecated.voidsetProfileDecay(Double profileDecay) voidsetProviderparams(Map<String, Object> params) voidsetProviderParams(Map<String, Object> params) voidvoidvoidsetProximityLoadOnFocus(Boolean proxLoadOnFocus) voidsetProximityThreshold(Double thRadians) voidsetProximityThresholdDeg(Double thDegrees) voidsetProximityThresholdRad(Double thRadians) voidsetRenderLabel(Boolean renderLabel, String name) voidsetRenderParticles(Boolean renderParticles) voidsetRenderSetLabel(Boolean renderSetLabel) voidsetRenderTarget(Long renderTarget) voidsetRenderTarget(String renderTarget) voidsetShadingStyle(String style) voidsetShadingType(int type) voidsetShadingType(String type) voidsetSizeNoise(Double sizeNoise) Set the size noise.voidsetSphericalPower(Double power) voidsetTexture(String texture) voidsetTextureAttribute(String textureAttribute) voidsetTextures(String[] textures) voidsetUniformEpoch(boolean uniformEpoch) voidsetVisible(boolean visible, String name, Render render) voidsetVisible(int index, boolean visible, Render render) Sets the visibility of the particle with the given index.voidupdateFocus(ICamera camera) Updates the parameters of the focus, if the focus is active in this groupvoidvoidupdateNumLabelsValue(int n, com.badlogic.ashley.core.Entity e)
-
Field Details
-
B31
-
B32
-
D31
-
D32
-
pointData
List that contains the point data. It contains only [x y z]. -
columnInfoList
List ofColumnInfoobjects for the data in this set. -
renderParticles
public boolean renderParticlesThis flag enables muting particle rendering. -
isStars
public boolean isStarsFlag indicating whether the particle set holds stars or particles (extended or not). -
isExtended
public boolean isExtendedFlag indicating whether the particle set holds extended particles. -
isElements
public boolean isElementsFlag indicating whether the particle set holds Keplerian elements particles (typeParticleKepler). -
renderSetLabel
public boolean renderSetLabelWhether to render the global set label or not. -
renderParticleLabels
public boolean renderParticleLabelsWhether to render particle labels at all for this set. -
numLabels
public int numLabelsNumber of labels to render for this group. -
provider
Fully qualified name of data provider class. -
providerParams
-
datafile
Path of data file. -
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
The loaded model pointed by modelFile. -
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
-
modelPrimitive
public int modelPrimitiveRender primitive. Triangles by default. -
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
The path for proximity loading. -
proximityLoadingFlag
public boolean proximityLoadingFlagFlag that indicates whether this particle set has proximity loading. -
proximityLoadOnFocus
public boolean proximityLoadOnFocusFlag that indicates whether loading should also happen on focus. -
proximityThreshold
public double proximityThresholdThreshold solid angle when loading happens. About 4 degrees (0.064 rad). -
proximityLoaded
public com.badlogic.gdx.utils.IntSet proximityLoadedSet that contains the indexes of the particles whose descriptors have already been loaded. -
proximityMissing
public com.badlogic.gdx.utils.IntSet proximityMissingContains the indices of the particles whose descriptors are not present. -
renderTarget
Render target for the particles of this set.- The default scene buffer, affected by post-processing effects.
- The layer buffer, which contains labels and lines, unaffected by post-processing effects.
-
profileDecay
public float profileDecayProfile decay of the particles in the shader, when using quads and plainParticleSet.ShadingType. -
colorNoise
public float colorNoiseNoise factor for the color in [0,1]. -
colorFromTexture
public boolean colorFromTextureAssign a different color to each texture. Only used when textures are active. -
sizeNoise
public double sizeNoiseThe noise in the size determination for particles. This only has effect if particles themselves do not provide a size. In that case, the final size is computed asclamp(body.size + rand.gaussian() * body.size * sizeNoise). -
fixedAngularSize
public double fixedAngularSizeFixed angular size for all particles in this set, in radians. Applies only to quads. Negative to disable. -
particleSizeLimits
public double[] particleSizeLimitsParticle 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 thatsize = tan(angle) * dist. -
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
Texture files to use for rendering the particles, at random. Applies only to quads. -
textureArray
public com.badlogic.gdx.graphics.TextureArray textureArrayReference to the texture array containing the textures for this set, if any. Applies only to quads. -
shadingType
The shading type, for lighting the particles. -
sphericalPower
public float sphericalPowerControls how sharply the sphere edges darken (higher values = more pronounced sphere appearance with darker edges). -
ambientLight
public float ambientLightAmbient light for billboard and spherical lighting. If this is set, the final ambient light used is this plus the global setting. -
shadingStyle
Shading style to use for this set. -
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
Factor to apply to the data points, usually to normalize distances. -
ccMin
public float[] ccMinMapping colors. -
ccMax
public float[] ccMaxMapping colors. -
labelDisplayAlways
public com.badlogic.gdx.utils.IntSet labelDisplayAlwaysIndices of particles for whichlabelDisplayis set toLabel.LabelDisplay.ALWAYS. -
labelDisplayNever
public com.badlogic.gdx.utils.IntSet labelDisplayNeverIndices of particles for whichlabelDisplayis set toLabel.LabelDisplay.NEVER. -
labelColors
public com.badlogic.gdx.utils.IntMap<float[]> labelColorsParticles with special label colors. -
lastSortTime
public double lastSortTimeStores the time when the last sort operation finished, in seconds. -
generateIndex
public boolean generateIndexWhether to generate an index or not. Defaults to false for particle sets. Unused in star sets. -
allowStreaks
public boolean allowStreaksWhether to allow the star streaks effect, where particles get stretched in the direction of motion when the camera moves. -
meanDistance
public double meanDistanceThe 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 epochJdEpoch for positions/proper motions in julian days. -
currDeltaYears
public double currDeltaYearsCurrent computed epoch time. -
focus
Reference to the current focus. -
focusIndex
public int focusIndexIndex of the particle acting as focus. Negative if we have no focus here. -
candidateFocusIndex
public int candidateFocusIndexCandidate to focus. -
focusPosition
Position of the current focus. -
focusPositionSph
Position in equatorial coordinates of the current focus in radians. -
focusDistToCamera
public double focusDistToCameraFOCUS_MODE attributes. -
focusSolidAngle
public double focusSolidAngleFOCUS_MODE attributes. -
focusSolidAngleApparent
public double focusSolidAngleApparentFOCUS_MODE attributes. -
focusSize
public double focusSizeFOCUS_MODE attributes. -
proximity
Proximity particles. -
disposed
public boolean disposedSet has been disposed. -
index
Name to array index. -
addedToMainIndex
public boolean addedToMainIndexFlag that flips when the particle set has been added to the main index. -
metadata
public double[] metadataMetadata, for sorting - holds distances from each particle to the camera, squared. -
indices
public int[] indicesIndices buffer. -
invisibilityArray
public com.badlogic.gdx.utils.IntSet invisibilityArrayIndices of stars that are not visible. -
entity
public com.badlogic.ashley.core.Entity entityReference to the entity. -
updaterTask
Updater task. -
lastSortCameraPos
Last sort position. -
cPosD
Last sort position. -
mat
Auxiliary matrix.
-
-
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
Returns the list of particles. -
setData
-
setData
-
setColumnInfoList
-
regenerateIndex
public void regenerateIndex()Regenerates the name index -
generateIndex
Generates the index (maps name to array index) and computes the geometric center of this group- Parameters:
pointData- The data- Returns:
- A 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
-
setDatafile
-
setProviderParams
-
setProviderparams
-
setFactor
-
setProfiledecay
Deprecated. -
setProfileDecay
-
setRenderTarget
-
setRenderTarget
-
setColornoise
Deprecated. -
setColorNoise
-
setColorFromTexture
public void setColorFromTexture(boolean colorFromTexture) -
setGenerateIndex
public void setGenerateIndex(boolean generateIndex) -
setFixedAngularSize
Set fixed angular size, in radians. -
setSizeNoise
Set the size noise. -
setFixedAngularSizeRad
Set fixed angular size, in radians. -
setFixedAngularSizeDeg
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
-
setTexture
-
setTextures
-
setShadingType
public void setShadingType(int type) -
setShadingType
-
setSphericalPower
-
setAmbientLight
-
setShadingStyle
-
setRenderParticles
-
setRenderSetLabel
-
setExtended
-
setNumLabels
-
updateNumLabelsValue
public void updateNumLabelsValue(int n, com.badlogic.ashley.core.Entity e) -
get
-
getFirstParticleName
Gets the name of a random particle in this group- Returns:
- The name of a random particle
-
setModelType
-
setModelParams
-
setModelPrimitive
-
setProximityDescriptorsLocation
-
setProximityDescriptors
-
setDescriptorsLocation
-
setProximityLoadOnFocus
-
setProximityThreshold
-
setProximityThresholdRad
-
setProximityThresholdDeg
-
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
-
getCandidateBean
-
getRadius
public double getRadius() -
getRadius
public double getRadius(int i) -
getTEff
public double getTEff() -
updateFocus
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
-
setVisible
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 particlevisible- Visibility flag
-
markForUpdate
-
getAbsolutePosition
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
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
-
getAbsolutePosition
-
getAbsolutePosition
-
getAbsolutePosition
-
fetchPositionDouble
public Vector3D fetchPositionDouble(IParticleRecord pb, Vector3Q 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 beancamPos- 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 vectordeltaYears- The delta years- Returns:
- The vector for chaining
-
fetchPosition
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
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
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
-
getNames
-
hasName
-
hasName
-
getLocalizedName
-
getCandidateId
public long getCandidateId() -
getCandidateName
-
getCandidateSolidAngleApparent
public double getCandidateSolidAngleApparent() -
getSolidAngleApparent
public double getSolidAngleApparent(int idx) -
getClosestName
-
getClosestLocalizedName
-
canSelect
-
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() -
isModel
public boolean isModel() -
setLabelDisplay
-
setForceLabel
-
isForceLabel
-
setRenderLabel
-
isRenderLabel
-
isRenderLabel
public boolean isRenderLabel(int idx) -
setLabelColor
-
setUniformEpoch
public void setUniformEpoch(boolean uniformEpoch) -
dispose
public void dispose(com.badlogic.ashley.core.Entity entity) - Specified by:
disposein interfaceIDisposable
-
setColorNoise(Double).